devlink: Add missing check of nlmsg_put

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>
This commit is contained in:
YueHaibing 2019-01-21 09:34:53 +00:00 committed by David S. Miller
parent 56431e38ef
commit ed175d9c6f
1 changed files with 3 additions and 0 deletions

View 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;