Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

YueHaibing and committed by
David S. Miller
ed175d9c 56431e38

+3
+3
net/core/devlink.c
··· 4086 4086 return -ENOMEM; 4087 4087 nlh = nlmsg_put(skb, info->snd_portid, info->snd_seq, 4088 4088 NLMSG_DONE, 0, flags | NLM_F_MULTI); 4089 + if (!nlh) 4090 + goto nla_put_failure; 4091 + 4089 4092 err = genlmsg_reply(skb, info); 4090 4093 if (err) 4091 4094 return err;