[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_60371697EC37444A2C756B77D567103CA109@qq.com>
Date: Tue, 16 Jan 2024 18:02:45 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+7ec955e36bb239bd720f@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [net?] KASAN: slab-out-of-bounds Read in dsa_user_prechangeupper
please test slab-out-of-bounds Read in dsa_user_prechangeupper
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3e7aeb78ab01
diff --git a/net/dsa/user.c b/net/dsa/user.c
index b738a466e2dc..2034587b3a68 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -2865,14 +2865,16 @@ static int dsa_user_changeupper(struct net_device *dev,
static int dsa_user_prechangeupper(struct net_device *dev,
struct netdev_notifier_changeupper_info *info)
{
- struct dsa_port *dp = dsa_user_to_port(dev);
+ const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
+ struct dsa_port *dp = ops->priv_size >= sizeof(*dp) ?
+ dsa_user_to_port(dev) : NULL;
if (!dsa_user_dev_check(dev))
return NOTIFY_DONE;
- if (netif_is_bridge_master(info->upper_dev) && !info->linking)
+ if (netif_is_bridge_master(info->upper_dev) && !info->linking && dp)
dsa_port_pre_bridge_leave(dp, info->upper_dev);
- else if (netif_is_lag_master(info->upper_dev) && !info->linking)
+ else if (netif_is_lag_master(info->upper_dev) && !info->linking && dp)
dsa_port_pre_lag_leave(dp, info->upper_dev);
/* dsa_port_pre_hsr_leave is not yet necessary since hsr devices cannot
* meaningfully placed under a bridge yet
--
2.43.0
Powered by blists - more mailing lists