Skip to content

Commit

Permalink
net: sched: sch_taprio: fix memleak in error path for sched list parse
Browse files Browse the repository at this point in the history
In error case, all entries should be freed from the sched list
before deleting it. For simplicity use rcu way.

Fixes: 5a781cc ("tc: Add support for configuring the taprio scheduler")
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ivan Khoronzhuk authored and David S. Miller committed Aug 9, 2019
1 parent fe90689 commit 51650d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/sched/sch_taprio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
spin_unlock_bh(qdisc_lock(sch));

free_sched:
kfree(new_admin);
if (new_admin)
call_rcu(&new_admin->rcu, taprio_free_sched_cb);

return err;
}
Expand Down

0 comments on commit 51650d3

Please sign in to comment.