Skip to content

Commit 83fe9a9

Browse files
Dan Carpenterdavem330
authored andcommitted
devlink: double free in devlink_resource_fill()
Smatch reports that devlink_dpipe_send_and_alloc_skb() frees the skb on error so this is a double free. We fixed a bunch of these bugs in commit 7fe4d6d ("devlink: Remove redundant free on error path") but we accidentally overlooked this one. Fixes: d9f9b9a ("devlink: Add support for resource abstraction") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e6ce382 commit 83fe9a9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/core/devlink.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,15 +2592,14 @@ static int devlink_resource_fill(struct genl_info *info,
25922592
if (!nlh) {
25932593
err = devlink_dpipe_send_and_alloc_skb(&skb, info);
25942594
if (err)
2595-
goto err_skb_send_alloc;
2595+
return err;
25962596
goto send_done;
25972597
}
25982598
return genlmsg_reply(skb, info);
25992599

26002600
nla_put_failure:
26012601
err = -EMSGSIZE;
26022602
err_resource_put:
2603-
err_skb_send_alloc:
26042603
nlmsg_free(skb);
26052604
return err;
26062605
}

0 commit comments

Comments
 (0)