From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+40f42779048f7476e2e0@syzkaller.appspotmail.com
Cc: brauner@kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
viro@zeniv.linux.org.uk
Subject: [PATCH] mqueue: correct the type of ro to int
Date: Thu, 4 Dec 2025 21:16:22 +0800 [thread overview]
Message-ID: <tencent_369728EA76ED36CD98793A6D942C956C4C0A@qq.com> (raw)
In-Reply-To: <69315929.a70a0220.2ea503.00d8.GAE@google.com>
The ro variable, being of type bool, caused the -EROFS return value from
mnt_want_write() to be implicitly converted to 1. This prevented the file
from being correctly acquired, thus triggering the issue reported by
syzbot [1].
Changing the type of ro to int allows the system to correctly identify
the reason for the file open failure.
[1]
KASAN: null-ptr-deref in range [0x0000000000000040-0x0000000000000047]
Call Trace:
do_mq_open+0x5a0/0x770 ipc/mqueue.c:932
__do_sys_mq_open ipc/mqueue.c:945 [inline]
__se_sys_mq_open ipc/mqueue.c:938 [inline]
__x64_sys_mq_open+0x16a/0x1c0 ipc/mqueue.c:938
Fixes: f2573685bd0c ("ipc: convert do_mq_open() to FD_ADD()")
Reported-by: syzbot+40f42779048f7476e2e0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=40f42779048f7476e2e0
Tested-by: syzbot+40f42779048f7476e2e0@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
ipc/mqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 56e811f9e5fa..90664d26ec07 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -893,7 +893,7 @@ static int prepare_open(struct dentry *dentry, int oflag, int ro,
}
static struct file *mqueue_file_open(struct filename *name,
- struct vfsmount *mnt, int oflag, bool ro,
+ struct vfsmount *mnt, int oflag, int ro,
umode_t mode, struct mq_attr *attr)
{
struct dentry *dentry;
--
2.43.0
next prev parent reply other threads:[~2025-12-04 13:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 9:49 [syzbot] [fs?] general protection fault in fd_install syzbot
2025-12-04 13:16 ` Edward Adam Davis [this message]
2025-12-04 14:07 ` [PATCH] mqueue: correct the type of ro to int Jan Kara
2025-12-05 8:55 ` Christian Brauner
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_369728EA76ED36CD98793A6D942C956C4C0A@qq.com \
--to=eadavis@qq.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+40f42779048f7476e2e0@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).