From: Jeff Layton <jlayton@kernel.org>
To: xiubli@redhat.com
Cc: idryomov@gmail.com, vshankar@redhat.com, ceph-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] ceph: fix a NULL pointer dereference in ceph_handle_caps()
Date: Wed, 02 Mar 2022 09:06:57 -0500 [thread overview]
Message-ID: <18af03fd35eadc2fb34ef2df62194785f073a956.camel@kernel.org> (raw)
In-Reply-To: <20220302085402.64740-3-xiubli@redhat.com>
On Wed, 2022-03-02 at 16:54 +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
>
> The ceph_find_inode() may will fail and return NULL.
>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
> fs/ceph/caps.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index 0b36020207fd..0762b55fdbcb 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -4303,7 +4303,6 @@ void ceph_handle_caps(struct ceph_mds_session *session,
>
> /* lookup ino */
> inode = ceph_find_inode(mdsc->fsc->sb, vino);
> - ci = ceph_inode(inode);
> dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino,
> vino.snap, inode);
>
> @@ -4333,6 +4332,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
> }
> goto flush_cap_releases;
> }
> + ci = ceph_inode(inode);
>
> /* these will work even if we don't have a cap yet */
> switch (op) {
I don't think this is an actual bug. We're just assigning "ci" here and
that doesn't involve a dereference of inode. If "inode" is NULL, then ci
will be close to NULL, but it doesn't get used in that case.
Assigning this lower in the function is fine though, and it discourages
anyone trying to use ci when they shouldn't, so you can add my ack, but
maybe fix the patch description since there is no dereference here.
Acked-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2022-03-02 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 8:54 [PATCH 0/2] ceph: misc fixes xiubli
2022-03-02 8:54 ` [PATCH 1/2] ceph: fix inode reference leakage in ceph_get_snapdir() xiubli
2022-03-02 13:39 ` Jeff Layton
2022-03-02 8:54 ` [PATCH 2/2] ceph: fix a NULL pointer dereference in ceph_handle_caps() xiubli
2022-03-02 14:06 ` Jeff Layton [this message]
2022-03-03 1:08 ` Xiubo Li
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=18af03fd35eadc2fb34ef2df62194785f073a956.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=vshankar@redhat.com \
--cc=xiubli@redhat.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