mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:44:45 +01:00
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: 2075bbe8ef ("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>
This commit is contained in:
parent
3d2e5d12a2
commit
fd80bd7105
1 changed files with 2 additions and 0 deletions
|
|
@ -81,6 +81,8 @@ static int ionic_query_port(struct ib_device *ibdev, u32 port,
|
|||
return -EINVAL;
|
||||
|
||||
ndev = ib_device_get_netdev(ibdev, port);
|
||||
if (!ndev)
|
||||
return -ENODEV;
|
||||
|
||||
if (netif_running(ndev) && netif_carrier_ok(ndev)) {
|
||||
attr->state = IB_PORT_ACTIVE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue