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

RDMA/core: Fix error code in stat_get_doit_qp()

We need to set the error codes on these paths. Currently the only
possible error code is -EMSGSIZE so that's what the patch uses.

Fixes: 83c2c1fcbd08 ("RDMA/nldev: Allow get counter mode through RDMA netlink")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Link: https://lore.kernel.org/r/20190809101311.GA17867@mwanda
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Dan Carpenter and committed by
Doug Ledford
932727c5 17c19287

+6 -2
+6 -2
drivers/infiniband/core/nldev.c
··· 1952 1952 1953 1953 if (fill_nldev_handle(msg, device) || 1954 1954 nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, port) || 1955 - nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_MODE, mode)) 1955 + nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_MODE, mode)) { 1956 + ret = -EMSGSIZE; 1956 1957 goto err_msg; 1958 + } 1957 1959 1958 1960 if ((mode == RDMA_COUNTER_MODE_AUTO) && 1959 - nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK, mask)) 1961 + nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK, mask)) { 1962 + ret = -EMSGSIZE; 1960 1963 goto err_msg; 1964 + } 1961 1965 1962 1966 nlmsg_end(msg, nlh); 1963 1967 ib_device_put(device);