]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
devlink: Add missing check of nlmsg_put
authorYueHaibing <yuehaibing@huawei.com>
Mon, 21 Jan 2019 09:34:53 +0000 (09:34 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Jan 2019 04:08:23 +0000 (20:08 -0800)
nlmsg_put may fail, this fix add a check of its return value.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/devlink.c

index 60248a53c0ad08ff676d4dd497148c86204f2bc5..059575c85ddeb7d3da9a50233c63f524c222eef0 100644 (file)
@@ -4086,6 +4086,9 @@ devlink_health_buffer_snd(struct genl_info *info,
                return -ENOMEM;
        nlh = nlmsg_put(skb, info->snd_portid, info->snd_seq,
                        NLMSG_DONE, 0, flags | NLM_F_MULTI);
+       if (!nlh)
+               goto nla_put_failure;
+
        err = genlmsg_reply(skb, info);
        if (err)
                return err;