From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "idryomov@gmail.com" <idryomov@gmail.com>,
"zenghongling@kylinos.cn" <zenghongling@kylinos.cn>,
"slava@dubeyko.com" <slava@dubeyko.com>,
Alex Markuze <amarkuze@redhat.com>,
"brauner@kernel.org" <brauner@kernel.org>
Cc: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"zhongling0719@126.com" <zhongling0719@126.com>
Subject: Re: [PATCH] ceph: fix potential ERR_PTR dereference in ceph_submit_write()
Date: Fri, 17 Apr 2026 17:48:06 +0000 [thread overview]
Message-ID: <494716d7aa3fe860d89e19866fa3b59755183de8.camel@ibm.com> (raw)
In-Reply-To: <20260417080609.51361-1-zenghongling@kylinos.cn>
On Fri, 2026-04-17 at 16:06 +0800, Hongling Zeng wrote:
> Fix smatch warning:
> fs/ceph/addr.c:1489 ceph_submit_write() error: 'req' dereferencing possible ERR_PTR()
>
> Add a check to ensure req is not an ERR_PTR before calling
> ceph_osdc_put_request().
>
> Fixes: 1551ec61dc55 ("ceph: improve error handling in writeback")
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
> fs/ceph/addr.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index fa4f25f99409..6091818674be 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -1468,7 +1468,8 @@ int ceph_submit_write(struct address_space *mapping,
> unlock_page(page);
> }
>
> - ceph_osdc_put_request(req);
> + if (!IS_ERR(req))
> + ceph_osdc_put_request(req);
> return -EIO;
> }
>
I don't think that this fix makes sense. We create and check the request here
[1]:
req = ceph_osdc_new_request(&fsc->client->osdc,
&ci->i_layout, vino,
offset, &len, 0, ceph_wbc->num_ops,
CEPH_OSD_OP_WRITE, CEPH_OSD_FLAG_WRITE,
ceph_wbc->snapc, ceph_wbc->truncate_seq,
ceph_wbc->truncate_size, false);
if (IS_ERR(req)) {
req = ceph_osdc_new_request(&fsc->client->osdc,
&ci->i_layout, vino,
offset, &len, 0,
min(ceph_wbc->num_ops,
CEPH_OSD_SLAB_OPS),
CEPH_OSD_OP_WRITE,
CEPH_OSD_FLAG_WRITE,
ceph_wbc->snapc,
ceph_wbc->truncate_seq,
ceph_wbc->truncate_size,
true);
BUG_ON(IS_ERR(req));
}
So, it should be the valid request pointer when we called
ceph_osdc_put_request(). Am I missing something?
Thanks,
Slava.
[1] https://elixir.bootlin.com/linux/v7.0/source/fs/ceph/addr.c#L1421
next prev parent reply other threads:[~2026-04-17 17:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 8:06 Hongling Zeng
2026-04-17 17:48 ` Viacheslav Dubeyko [this message]
2026-04-20 6:28 ` nana
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=494716d7aa3fe860d89e19866fa3b59755183de8.camel@ibm.com \
--to=slava.dubeyko@ibm.com \
--cc=amarkuze@redhat.com \
--cc=brauner@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=slava@dubeyko.com \
--cc=zenghongling@kylinos.cn \
--cc=zhongling0719@126.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®