From: "Sungjong Seo" <sj1557.seo@samsung.com>
To: <Yuezhang.Mo@sony.com>, <linkinjeon@kernel.org>
Cc: <sjdev.seo@gmail.com>, <linux-fsdevel@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <cpgs@samsung.com>,
<stable@vger.kernel.org>,
"'Yeongjin Gil'" <youngjin.gil@samsung.com>
Subject: RE: [PATCH] exfat: fix random stack corruption after get_block
Date: Fri, 21 Mar 2025 15:19:45 +0900 [thread overview]
Message-ID: <1296674576.21742538902983.JavaMail.epsvc@epcpadp1new> (raw)
In-Reply-To: <PUZPR04MB6316CA3B8281D08C2A85435A81D82@PUZPR04MB6316.apcprd04.prod.outlook.com>
Hi Yuezhang,
> Subject: Re: [PATCH] exfat: fix random stack corruption after get_block
>
> + /*
> + * No buffer_head is allocated.
> + * (1) bmap: It's enough to fill bh_result without
I/O.
> + * (2) read: The unwritten part should be filled
with 0
> + * If a folio does not have any buffers,
> + * let's returns -EAGAIN to fallback to
> + * per-bh IO like
block_read_full_folio().
> + */
> + if (!folio_buffers(bh_result->b_folio)) {
> + err = -EAGAIN;
> + goto done;
> + }
>
> bh_result is set as mapped by map_bh(), should we need to clear it if
> return an error?
I looked a little deeper into do_mpage_readpage() and
block_read_full_folio(), and from a security perspective, it seems that
unmap is necessary in all error situations. Otherwise, unwritten areas
may be exposed.
>
> +
> + BUG_ON(size > sb->s_blocksize);
>
> This check is equivalent to the following condition and is not necessary.
>
> } else if (iblock == valid_blks &&
> (ei->valid_size & (sb->s_blocksize - 1))) {
Yes, I think so, I'll remove it with v2.
Thanks
prev parent reply other threads:[~2025-03-21 6:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250320052646epcas1p384845fdc17bf572784c99ca81cd4c9dc@epcas1p3.samsung.com>
2025-03-20 5:26 ` [PATCH] exfat: fix random stack corruption after get_block Sungjong Seo
2025-03-20 8:16 ` Yuezhang.Mo
2025-03-21 6:19 ` Sungjong Seo [this message]
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=1296674576.21742538902983.JavaMail.epsvc@epcpadp1new \
--to=sj1557.seo@samsung.com \
--cc=Yuezhang.Mo@sony.com \
--cc=cpgs@samsung.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sjdev.seo@gmail.com \
--cc=stable@vger.kernel.org \
--cc=youngjin.gil@samsung.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).