Skip to content

Commit

Permalink
RDMA/nldev: missing error code in nldev_res_get_doit()
Browse files Browse the repository at this point in the history
We should return -ENOMEM if the allocation fails.  The current code
accidentally returns success.

Fixes: bf3c5a9 ("RDMA/nldev: Provide global resource utilization")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Dan Carpenter authored and Jason Gunthorpe committed Feb 1, 2018
1 parent 0da6550 commit f34727a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/infiniband/core/nldev.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,10 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
return -EINVAL;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg)
if (!msg) {
ret = -ENOMEM;
goto err;
}

nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET),
Expand Down

0 comments on commit f34727a

Please sign in to comment.