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

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/ionic: Fix potential NULL pointer dereference in ionic_query_port

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: 2075bbe8ef03 ("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>

authored by

Kamal Heib and committed by
Leon Romanovsky
fd80bd71 3d2e5d12

+2
+2
drivers/infiniband/hw/ionic/ionic_ibdev.c
··· 81 81 return -EINVAL; 82 82 83 83 ndev = ib_device_get_netdev(ibdev, port); 84 + if (!ndev) 85 + return -ENODEV; 84 86 85 87 if (netif_running(ndev) && netif_carrier_ok(ndev)) { 86 88 attr->state = IB_PORT_ACTIVE;