Skip to content
/ linux Public

Commit 2b96156

Browse files
KamalheibSasha Levin
authored andcommitted
RDMA/ionic: Fix potential NULL pointer dereference in ionic_query_port
[ Upstream commit fd80bd7 ] The function ionic_query_port() calls ib_device_get_netdev() without checking the return value which could lead to NULL pointer dereference, Fix it by checking the return value and return -ENODEV if the 'ndev' is NULL. Fixes: 2075bbe ("RDMA/ionic: Register device ops for miscellaneous functionality") Signed-off-by: Kamal Heib <kheib@redhat.com> Link: https://patch.msgid.link/20260220222125.16973-2-kheib@redhat.com Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3126a2f commit 2b96156

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/infiniband/hw/ionic/ionic_ibdev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ static int ionic_query_port(struct ib_device *ibdev, u32 port,
8181
return -EINVAL;
8282

8383
ndev = ib_device_get_netdev(ibdev, port);
84+
if (!ndev)
85+
return -ENODEV;
8486

8587
if (netif_running(ndev) && netif_carrier_ok(ndev)) {
8688
attr->state = IB_PORT_ACTIVE;

0 commit comments

Comments
 (0)