nlmsg_put may fail, this fix add a check of its return value. Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx> --- net/core/devlink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/devlink.c b/net/core/devlink.c index 60248a5..059575c 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -4086,6 +4086,9 @@ void devlink_health_buffer_nest_cancel(struct devlink_health_buffer *buffer) 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;