[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240905052532.533159-1-lizhi.xu@windriver.com>
Date: Thu, 5 Sep 2024 13:25:32 +0800
From: Lizhi Xu <lizhi.xu@...driver.com>
To: <syzbot+8811381d455e3e9ec788@...kaller.appspotmail.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<pabeni@...hat.com>, <syzkaller-bugs@...glegroups.com>
Subject: Re: [syzbot] [net?] KASAN: slab-use-after-free Read in unix_stream_read_actor (2)
The sock queue oob twice, the first manage_oob (in unix_stream_read_generic) peek next skb only,
and the next skb is the oob skb, so if skb is oob skb we need use manage_oob dealwith it.
#syz test
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 0be0dcb07f7b..2821a8b5dea9 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2918,6 +2918,14 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state,
/* Mark read part of skb as used */
if (!(flags & MSG_PEEK)) {
+#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
+ if (skb == u->oob_skb) {
+ skb = manage_oob(skb, sk, flags, copied);
+ if (!skb && copied) {
+ break;
+ }
+ }
+#endif
UNIXCB(skb).consumed += chunk;
sk_peek_offset_bwd(sk, chunk);
Powered by blists - more mailing lists