From ed175d9c6f0d4df0f83f22ff4c887c21b7d021cd Mon Sep 17 00:00:00 2001 From: YueHaibing Date: Mon, 21 Jan 2019 09:34:53 +0000 Subject: devlink: Add missing check of nlmsg_put nlmsg_put may fail, this fix add a check of its return value. Signed-off-by: YueHaibing Signed-off-by: David S. Miller --- net/core/devlink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/devlink.c b/net/core/devlink.c index 60248a53c0ad..059575c85dde 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -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; -- cgit v1.2.3