From: WANG Cong Date: Sun, 18 Sep 2016 22:52:20 +0000 (-0700) Subject: net_sched: check NULL on error path in route4_change() X-Git-Tag: MMI-PSA29.97-13-9~7063^2~91 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=21641c2e1ffd0b504610a33beaeab8fcc5140677;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git net_sched: check NULL on error path in route4_change() On error path in route4_change(), 'f' could be NULL, so we should check NULL before calling tcf_exts_destroy(). Fixes: b9a24bb76bf6 ("net_sched: properly handle failure case of tcf_exts_init()") Reported-by: kbuild test robot Cc: Jamal Hadi Salim Signed-off-by: Cong Wang Acked-by: Jamal Hadi Salim Signed-off-by: David S. Miller --- diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index a4ce39b19be0..455fc8f83d0a 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c @@ -559,7 +559,8 @@ static int route4_change(struct net *net, struct sk_buff *in_skb, return 0; errout: - tcf_exts_destroy(&f->exts); + if (f) + tcf_exts_destroy(&f->exts); kfree(f); return err; }