From: Lizhi Xu <lizhi.xu@windriver.com>
To: <syzbot+23bc20037854bb335d59@syzkaller.appspotmail.com>
Cc: <axboe@kernel.dk>, <brauner@kernel.org>,
<dave.kleikamp@oracle.com>, <hare@suse.de>, <hch@lst.de>,
<jack@suse.cz>, <jfs-discussion@lists.sourceforge.net>,
<johannes.thumshirn@wdc.com>, <linux-fsdevel@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <shaggy@kernel.org>,
<syzkaller-bugs@googlegroups.com>
Subject: [PATCH] jfs: fix log->bdev_handle null ptr deref in lbmStartIO
Date: Mon, 9 Oct 2023 17:45:57 +0800 [thread overview]
Message-ID: <20231009094557.1398920-1-lizhi.xu@windriver.com> (raw)
In-Reply-To: <0000000000005239cf060727d3f6@google.com>
When sbi->flag is JFS_NOINTEGRITY in lmLogOpen(), log->bdev_handle can't
be inited, so it value will be NULL.
Therefore, add the "log ->no_integrity=1" judgment in lbmStartIO() to avoid such
problems.
Reported-and-tested-by: syzbot+23bc20037854bb335d59@syzkaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
---
fs/jfs/jfs_logmgr.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index c911d838b8ec..c41a76164f84 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -2110,10 +2110,14 @@ static void lbmStartIO(struct lbuf * bp)
{
struct bio *bio;
struct jfs_log *log = bp->l_log;
+ struct block_device *bdev = NULL;
jfs_info("lbmStartIO");
- bio = bio_alloc(log->bdev_handle->bdev, 1, REQ_OP_WRITE | REQ_SYNC,
+ if (!log->no_integrity)
+ bdev = log->bdev_handle->bdev;
+
+ bio = bio_alloc(bdev, 1, REQ_OP_WRITE | REQ_SYNC,
GFP_NOFS);
bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9);
__bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset);
--
2.25.1
next prev parent reply other threads:[~2023-10-09 9:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-07 22:24 [syzbot] [jfs?] general protection fault in lbmStartIO syzbot
2023-10-09 9:45 ` Lizhi Xu [this message]
2023-10-09 10:08 ` [PATCH] jfs: fix log->bdev_handle null ptr deref " Jan Kara
2023-10-09 13:55 ` Christian Brauner
2023-10-09 13:54 ` 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=20231009094557.1398920-1-lizhi.xu@windriver.com \
--to=lizhi.xu@windriver.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=dave.kleikamp@oracle.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=syzbot+23bc20037854bb335d59@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;
as well as URLs for NNTP newsgroup(s).