Skip to content

Commit 610771c

Browse files
msanallajgunthorpe
authored andcommitted
IB/core: Fix IPv6 netlink message size in ib_nl_ip_send_msg()
When resolving an RDMA-CM IPv6 address, ib_nl_ip_send_msg() sends a netlink request to the userspace daemon to perform IP-to-GID resolution in certain cases. The function allocates the netlink message buffer using nla_total_size(sizeof(size)), which passes 8 bytes (the size of size_t) instead of 16 bytes (the size of an IPv6 address). This results in an 8-byte under-allocation. This is currently masked by nlmsg_new() over-allocation of the skb in its internal logic. However, the code remains incorrect. Fix the issue by supplying the proper IPv6 address length to nla_total_size(). Fixes: ae43f82 ("IB/core: Add IP to GID netlink offload") Link: https://patch.msgid.link/r/20260427-security-bug-fixes-v3-3-4621fa52de0e@nvidia.com Signed-off-by: Maher Sanalla <msanalla@nvidia.com> Reviewed-by: Patrisious Haddad <phaddad@nvidia.com> Signed-off-by: Edward Srouji <edwards@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 9bee81c commit 610771c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/infiniband/core/addr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr,
149149
attrtype = RDMA_NLA_F_MANDATORY | LS_NLA_TYPE_IPV6;
150150
}
151151

152-
len = nla_total_size(sizeof(size));
152+
len = nla_total_size(size);
153153
len += NLMSG_ALIGN(sizeof(*header));
154154

155155
skb = nlmsg_new(len, GFP_KERNEL);

0 commit comments

Comments
 (0)