net/sched: move NULL ptr check to qdisc_put() too
PATCH 1/1 net/sched: move NULL ptr check to qdisc_put() too
In commit 92833e8b5db6c209e9311ac8c6a44d3bf1856659 titled "net: sched: rename qdisc_destroy() to qdisc_put()" part of the functionality of qdisc_destroy() was moved into a (for linux-4.19.y) new function qdisk_put(), and the previous calls to qdisc_destroy() were changed to qdisk_put().
This made it similar to f.e. 5.10.y and current master.
There was one part of qdisc_destroy() not moved over to qdisc_put() and that was the check for a NULL pointer, causing oopses.
(See upstream commit: 6efb971ba8edfbd80b666f29de12882852f095ae) This patch fixes that.
--- net/sched/sch_generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/sched/sch_generic.c +3 -2
@@ -970,8 +970,6 @@ static void qdisc_destroy(struct Qdisc *qdisc)const struct Qdisc_ops *ops;struct sk_buff *skb, *tmp; -if (!qdisc) -return ; ops = qdisc->ops;#ifdef CONFIG_NET_SCHED
@@ -1003,6 +1001,9 @@ static void qdisc_destroy(struct Qdisc *qdisc)void qdisc_put (struct Qdisc *qdisc) { +if (!qdisc) +return ; +if (qdisc->flags &TCQ_F_BUILTIN || !refcount_dec_and_test (&qdisc->refcnt))return ;
Signature · 1 line
2.36.1
Quoted 12 lines · Diederik de Haas
In commit
92833e8b5db6c209e9311ac8c6a44d3bf1856659titled "net: sched: renameqdisc_destroy()toqdisc_put()" part of the functionality ofqdisc_destroy()was moved into a (for linux-4.19.y) new functionqdisk_put(), and the previous calls toqdisc_destroy()were changed toqdisk_put().
This made it similar to f.e. 5.10.y and current master.There was one part of
qdisc_destroy()not moved over toqdisc_put()and that was the check for a NULL pointer, causing oopses.
(See upstream commit:6efb971ba8edfbd80b666f29de12882852f095ae) This patch fixes that.
Quoted 7 lines
Fixes 92833e8b5db6c209e9311ac8c6a44d3bf1856659Reported-by Thorsten Glaser <[email protected]>Signed-off-by Diederik de Haas <[email protected]>--- net/sched/sch_generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Now queued up, thanks.
greg k-h