RDMA/addr: Be strict with gid size
authorLeon Romanovsky <leonro@nvidia.com>
Mon, 5 Apr 2021 07:44:34 +0000 (10:44 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Apr 2021 06:42:12 +0000 (08:42 +0200)
commit5700c3d4abb2084aea0ff5b0ae69c32f8142db3a
tree7b123ff3782c966e82ee7b66dbf9cf1ae8e20319
parente53ff6e59144993af7db78642e30a7d801543ea6
RDMA/addr: Be strict with gid size

[ Upstream commit d1c803a9ccd7bd3aff5e989ccfb39ed3b799b975 ]

The nla_len() is less than or equal to 16.  If it's less than 16 then end
of the "gid" buffer is uninitialized.

Fixes: ae43f8286730 ("IB/core: Add IP to GID netlink offload")
Link: https://lore.kernel.org/r/20210405074434.264221-1-leon@kernel.org
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/addr.c