Skip to content

Commit 6ff57a2

Browse files
Qianqiang Liurleon
authored andcommitted
RDMA/nldev: Fix NULL pointer dereferences issue in rdma_nl_notify_event
nlmsg_put() may return a NULL pointer assigned to nlh, which will later be dereferenced in nlmsg_end(). Fixes: 9cbed5a ("RDMA/nldev: Add support for RDMA monitoring") Link: https://patch.msgid.link/r/Zva71Yf3F94uxi5A@iZbp1asjb3cy8ks0srf007Z Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 8e65aba commit 6ff57a2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/infiniband/core/nldev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2816,6 +2816,8 @@ int rdma_nl_notify_event(struct ib_device *device, u32 port_num,
28162816
nlh = nlmsg_put(skb, 0, 0,
28172817
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_MONITOR),
28182818
0, 0);
2819+
if (!nlh)
2820+
goto err_free;
28192821

28202822
switch (type) {
28212823
case RDMA_REGISTER_EVENT:

0 commit comments

Comments
 (0)