From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Wengang Wang <wen.gang.wang@oracle.com>,
ryan.ding@oracle.com, Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>,
Sunil Mushran <sunil.mushran@oracle.com>,
ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org, Mark Fasheh <mark@fasheh.com>
Subject: Re: [PATCH] ocfs2: fix uninitialized variable in ocfs2_dio_wr_get_block()
Date: Wed, 1 Dec 2021 10:24:58 +0800 [thread overview]
Message-ID: <92d4d393-9734-9f7e-4440-20429bdac14f@linux.alibaba.com> (raw)
In-Reply-To: <20211130104043.GB5827@kili>
On 11/30/21 6:40 PM, Dan Carpenter wrote:
> The callers assume that "*fsdata" is set on the success path, but
> that's not necessarily true on this path.
>
In ocfs2_page_mkwrite(), since in this case no target page locked, it
will finally return VM_FAULT_NOPAGE (better VM_FAULT_RETRY?) and throw
to handle_mm_fault(). So no problem as comments described.
But things seems changed since append direct io path started to use
write_[begin/end]. In this path, the target page is expected as NULL.
This needs more discussion.
Thanks,
Joseph
> Fixes: 5cffff9e2986 ("ocfs2: Fix ocfs2_page_mkwrite()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Please review this one EXTRA CAREFULLY. It's from static analysis and
> the truth is I'm not 100% sure it's correct. I'm also not sure that
> it's a complete fix.
>
> Especially, please review how this is called from ocfs2_write_begin()
> to make sure that this doesn't break anything.
>
>
> fs/ocfs2/aops.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index 68d11c295dd3..a74a370f16f0 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -1813,6 +1813,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
> if (ret == -EAGAIN) {
> BUG_ON(wc->w_target_page);
> ret = 0;
> + *fsdata = wc;
> goto out_quota;
> }
>
>
next prev parent reply other threads:[~2021-12-01 2:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 10:40 [PATCH] ocfs2: fix uninitialized variable in ocfs2_dio_wr_get_block() Dan Carpenter
2021-12-01 2:24 ` Joseph Qi [this message]
2021-12-06 6:03 ` Joseph Qi
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=92d4d393-9734-9f7e-4440-20429bdac14f@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=dan.carpenter@oracle.com \
--cc=jlbec@evilplan.org \
--cc=junxiao.bi@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=ryan.ding@oracle.com \
--cc=sunil.mushran@oracle.com \
--cc=wen.gang.wang@oracle.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