mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+7ec955e36bb239bd720f@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [net?] KASAN: slab-out-of-bounds Read in dsa_user_prechangeupper
Date: Tue, 16 Jan 2024 22:13:16 +0800	[thread overview]
Message-ID: <tencent_CBECC6CDB07A5A6C182C156DAC9490EB160A@qq.com> (raw)
In-Reply-To: <00000000000002faa2060f02e766@google.com>

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.h b/net/dsa/user.h
index 996069130bea..9a40918ee7fc 100644
--- a/net/dsa/user.h
+++ b/net/dsa/user.h
@@ -53,7 +53,11 @@ int dsa_user_manage_vlan_filtering(struct net_device *dev,
 
 static inline struct dsa_port *dsa_user_to_port(const struct net_device *dev)
 {
-	struct dsa_user_priv *p = netdev_priv(dev);
+	const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
+	struct dsa_user_priv *p = ops->priv_size >= sizeof(*p) ? 
+		netdev_priv(dev) : NULL;
+	if (!p)
+		return NULL;
 
 	return p->dp;
 }


  parent reply	other threads:[~2024-01-16 14:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 21:43 syzbot
2024-01-16  9:13 ` Edward Adam Davis
2024-01-16  9:56   ` syzbot
2024-01-16 10:02 ` Edward Adam Davis
2024-01-16 10:18   ` syzbot
2024-01-16 11:34 ` Hillf Danton
2024-01-16 11:55   ` syzbot
2024-01-16 12:33 ` Hillf Danton
2024-01-16 12:56   ` syzbot
2024-01-16 14:13 ` Edward Adam Davis [this message]
2024-01-16 14:51   ` syzbot
2024-01-16 14:47 ` Vladimir Oltean
2024-01-16 14:56 ` [PATCH] net/dsa: fix oob " Edward Adam Davis
2024-01-16 15:31   ` Vladimir Oltean

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=tencent_CBECC6CDB07A5A6C182C156DAC9490EB160A@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+7ec955e36bb239bd720f@syzkaller.appspotmail.com \
    --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

all inboxes | Powered by JetHome®