]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: sched: potential NULL dereference in tcf_block_find()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 18 Feb 2019 09:26:32 +0000 (12:26 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Feb 2019 21:11:07 +0000 (13:11 -0800)
The error code isn't set on this path so it would result in returning
ERR_PTR(0) and a NULL dereference in the caller.

Fixes: 18d3eefb17cf ("net: sched: refactor tcf_block_find() into standalone functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_api.c

index 9ad53895e6040c6643368592d7c4ab38c9dda2c7..28592e9f803f1bfa472c23e7ceeb93e87b3273e1 100644 (file)
@@ -1309,8 +1309,10 @@ static struct tcf_block *tcf_block_find(struct net *net, struct Qdisc **q,
                goto errout_qdisc;
 
        block = __tcf_block_find(net, *q, *cl, ifindex, block_index, extack);
-       if (IS_ERR(block))
+       if (IS_ERR(block)) {
+               err = PTR_ERR(block);
                goto errout_qdisc;
+       }
 
        return block;