From: syzbot <syzbot+5fe14f2ff4ccbace9a26@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] Re: [syzbot] [net?] KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
Date: Thu, 10 Oct 2024 02:12:02 -0700 [thread overview]
Message-ID: <67079a62.050a0220.8109b.0004.GAE@google.com> (raw)
In-Reply-To: <000000000000657ecd0614456af8@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [net?] KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
Author: cmeiohas@nvidia.com
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 93c6d27b5d8f..eafdf1741582 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2062,19 +2062,14 @@ void ib_dispatch_event_clients(struct ib_event *event)
up_read(&event->device->event_handler_rwsem);
}
-static int iw_query_port(struct ib_device *device,
- u32 port_num,
- struct ib_port_attr *port_attr)
+static int iw_query_port(struct ib_device *device, u32 port_num,
+ struct ib_port_attr *port_attr,
+ struct net_device *netdev)
{
struct in_device *inetdev;
- struct net_device *netdev;
memset(port_attr, 0, sizeof(*port_attr));
- netdev = ib_device_get_netdev(device, port_num);
- if (!netdev)
- return -ENODEV;
-
port_attr->max_mtu = IB_MTU_4096;
port_attr->active_mtu = ib_mtu_int_to_enum(netdev->mtu);
@@ -2097,7 +2092,6 @@ static int iw_query_port(struct ib_device *device,
rcu_read_unlock();
}
- dev_put(netdev);
return device->ops.query_port(device, port_num, port_attr);
}
@@ -2135,13 +2129,27 @@ int ib_query_port(struct ib_device *device,
u32 port_num,
struct ib_port_attr *port_attr)
{
+ struct net_device *netdev = NULL;
+ int ret;
+
if (!rdma_is_port_valid(device, port_num))
return -EINVAL;
+ if (rdma_protocol_iwarp(device, port_num) ||
+ rdma_protocol_roce(device, port_num)) {
+ netdev = ib_device_get_netdev(device, port_num);
+ if (!netdev)
+ return -ENODEV;
+ }
+
if (rdma_protocol_iwarp(device, port_num))
- return iw_query_port(device, port_num, port_attr);
+ ret = iw_query_port(device, port_num, port_attr, netdev);
else
- return __ib_query_port(device, port_num, port_attr);
+ ret = __ib_query_port(device, port_num, port_attr);
+ if (netdev)
+ dev_put(netdev);
+ return ret;
+
}
EXPORT_SYMBOL(ib_query_port);
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 75d1407db52d..c5d439bebc24 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -605,6 +605,7 @@ static int rxe_notify(struct notifier_block *not_blk,
switch (event) {
case NETDEV_UNREGISTER:
+ ib_device_set_netdev(&rxe->ib_dev, NULL, 1);
ib_unregister_device_queued(&rxe->ib_dev);
break;
case NETDEV_UP:
diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
index 17abef48abcd..1b7d34798783 100644
--- a/drivers/infiniband/sw/siw/siw_main.c
+++ b/drivers/infiniband/sw/siw/siw_main.c
@@ -400,6 +400,7 @@ static int siw_netdev_event(struct notifier_block *nb, unsigned long event,
break;
case NETDEV_UNREGISTER:
+ ib_device_set_netdev(&sdev->base_dev, NULL, 1);
ib_unregister_device_queued(&sdev->base_dev);
break;
next prev parent reply other threads:[~2024-10-10 9:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-22 20:10 [syzbot] [net?] KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings syzbot
2024-03-25 12:09 ` Denis Kirjanov
2024-03-25 13:08 ` Eric Dumazet
2024-09-28 12:21 ` Hillf Danton
2024-09-29 11:46 ` Hillf Danton
2024-09-30 8:32 ` Eric Dumazet
2024-09-30 12:27 ` Hillf Danton
2024-09-27 18:26 ` syzbot
2024-09-28 8:22 ` Hillf Danton
2024-09-28 9:08 ` syzbot
2024-09-29 10:38 ` Hillf Danton
2024-09-29 11:17 ` syzbot
2024-10-08 1:44 ` syzbot
2024-10-08 11:44 ` [syzbot] " syzbot
2024-10-08 11:51 ` syzbot
2024-10-10 8:25 ` syzbot
2024-10-10 9:12 ` syzbot [this message]
2024-10-10 13:27 ` syzbot
2024-10-10 13:46 ` syzbot
2024-10-13 10:54 ` syzbot
2024-10-13 11:44 ` syzbot
2024-10-13 15:45 ` syzbot
2024-10-16 12:24 ` syzbot
2024-10-16 20:28 ` syzbot
2024-10-19 17:04 ` syzbot
2024-10-20 6:49 ` syzbot
2024-10-20 6:54 ` syzbot
2024-10-21 10:09 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67079a62.050a0220.8109b.0004.GAE@google.com \
--to=syzbot+5fe14f2ff4ccbace9a26@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox