From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+d7c7a495a5e466c031b6@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [v9fs?] KASAN: slab-use-after-free Read in p9_fid_destroy
Date: Sat, 18 May 2024 09:33:41 +0800 [thread overview]
Message-ID: <20240518013341.1649-1-hdanton@sina.com> (raw)
In-Reply-To: <00000000000049897e0618a4b1ff@google.com>
On Fri, 17 May 2024 04:31:28 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: ea5f6ad9ad96 Merge tag 'platform-drivers-x86-v6.10-1' of g..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11df3084980000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ea5f6ad9ad96
--- x/include/net/9p/client.h
+++ y/include/net/9p/client.h
@@ -11,6 +11,7 @@
#include <linux/utsname.h>
#include <linux/idr.h>
+#include <linux/mutex.h>
#include <linux/tracepoint-defs.h>
/* Number of requests per row */
@@ -122,6 +123,7 @@ struct p9_client {
struct idr fids;
struct idr reqs;
+ struct mutex destroy_mutex;
char name[__NEW_UTS_LEN + 1];
};
--- x/net/9p/client.c
+++ y/net/9p/client.c
@@ -1041,6 +1041,7 @@ struct p9_client *p9_client_create(const
0, 0, P9_HDRSZ + 4,
clnt->msize - (P9_HDRSZ + 4),
NULL);
+ mutex_init(&clnt->destroy_mutex);
return clnt;
@@ -1058,6 +1059,7 @@ void p9_client_destroy(struct p9_client
{
struct p9_fid *fid;
int id;
+ int clean;
p9_debug(P9_DEBUG_MUX, "clnt %p\n", clnt);
@@ -1066,9 +1068,18 @@ void p9_client_destroy(struct p9_client
v9fs_put_trans(clnt->trans_mod);
+again:
+ clean = 1;
+ mutex_lock(&clnt->destroy_mutex);
idr_for_each_entry(&clnt->fids, fid, id) {
pr_info("Found fid %d not clunked\n", fid->fid);
- p9_fid_destroy(fid);
+ clean = 0;
+ break;
+ }
+ mutex_unlock(&clnt->destroy_mutex);
+ if (!clean) {
+ schedule_timeout_idle(2);
+ goto again;
}
p9_tag_cleanup(clnt);
@@ -1454,7 +1465,9 @@ error:
if (retries++ == 0)
goto again;
} else {
+ mutex_lock(&clnt->destroy_mutex);
p9_fid_destroy(fid);
+ mutex_unlock(&clnt->destroy_mutex);
}
return err;
}
--
next prev parent reply other threads:[~2024-05-18 1:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 8:14 syzbot
2024-05-17 11:31 ` syzbot
2024-05-17 23:59 ` Hillf Danton
2024-05-18 0:20 ` syzbot
2024-05-18 1:33 ` Hillf Danton [this message]
2024-05-18 1:58 ` syzbot
2024-05-18 11:41 ` Hillf Danton
2024-05-18 12:01 ` syzbot
2024-05-18 13:32 ` Hillf Danton
2024-05-18 13:55 ` syzbot
2024-05-18 23:08 ` Hillf Danton
2024-05-18 23:30 ` syzbot
2024-05-19 0:14 ` Hillf Danton
2024-05-19 0:39 ` syzbot
2024-05-22 23:19 ` Hillf Danton
2024-05-22 23:44 ` syzbot
2024-05-23 14:37 ` David Howells
2024-05-23 15:04 ` syzbot
2024-05-23 16:46 ` asmadeus
2024-05-23 18:07 ` David Howells
2024-05-23 20:57 ` asmadeus
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=20240518013341.1649-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+d7c7a495a5e466c031b6@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®