net: sched: sch_taprio: fix memleak in error path for sched list parse
authorIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Tue, 6 Aug 2019 22:45:40 +0000 (01:45 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Aug 2019 05:00:24 +0000 (22:00 -0700)
In error case, all entries should be freed from the sched list
before deleting it. For simplicity use rcu way.

Fixes: 5a781ccbd19e46 ("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>
net/sched/sch_taprio.c

index c39db507ba3f42234c14e4e24184909509b9e2e7..e25d414ae12fdd9a7c4b8ea1903293e36e4ae12a 100644 (file)
@@ -1195,7 +1195,8 @@ unlock:
        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;
 }