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 <fengguang...@intel.com>
Cc: Jamal Hadi Salim <j...@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangc...@gmail.com>
---
 net/sched/cls_route.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index c91e65d..aaab7a0 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -562,7 +562,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;
 }
-- 
2.1.0

Reply via email to