Re: [PATCH net] net/sched: act_simple: don't leak 'index' in the error path

2018-03-15 Thread Cong Wang
On Wed, Mar 14, 2018 at 3:43 PM, Davide Caratti wrote: > hello Cong, thank you for reviewing this. > > On Wed, 2018-03-14 at 11:41 -0700, Cong Wang wrote: >> On Tue, Mar 13, 2018 at 7:13 PM, Davide Caratti wrote: >> >> Looks like we just need to replace

Re: [PATCH net] net/sched: act_simple: don't leak 'index' in the error path

2018-03-14 Thread Davide Caratti
hello Cong, thank you for reviewing this. On Wed, 2018-03-14 at 11:41 -0700, Cong Wang wrote: > On Tue, Mar 13, 2018 at 7:13 PM, Davide Caratti wrote: > > Looks like we just need to replace the tcf_idr_cleanup() with > tcf_idr_release()? Which is also simpler. I just tried

Re: [PATCH net] net/sched: act_simple: don't leak 'index' in the error path

2018-03-14 Thread Cong Wang
On Tue, Mar 13, 2018 at 7:13 PM, Davide Caratti wrote: > Similarly to what other TC actions do, we can duplicate 'sdata' before > calling tcf_idr_create(), and avoid calling tcf_idr_cleanup(), so that > leaks of 'index' don't occur anymore. Looks like we just need to replace

[PATCH net] net/sched: act_simple: don't leak 'index' in the error path

2018-03-13 Thread Davide Caratti
if the kernel fails duplicating 'sdata', creation of a new action fails with -ENOMEM. However, subsequent attempts to install the same action using the same value of 'index' will systematically fail with -ENOSPC, and that value of 'index' will no more be usable by act_simple, until rmmod / insmod