All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jeff Layton <jlayton@kernel.org>,
	Ceph Development <ceph-devel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ceph: Fix an Oops in error handling
Date: Tue, 2 Feb 2021 13:35:35 +0100	[thread overview]
Message-ID: <CAOi1vP_GSHBFwDeuAatpTbuJM90ootzZ31-oK1FKKM93JOmf_g@mail.gmail.com> (raw)
In-Reply-To: <YBjne8A1gn0mvQtT@mwanda>

On Tue, Feb 2, 2021 at 6:47 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The "req" pointer is an error pointer and not NULL so this check needs
> to be fixed.
>
> Fixes: 1cf7fdf52d5a ("ceph: convert readpage to fscache read helper")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  fs/ceph/addr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 5eec6f66fe52..fb0238a4d34f 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -273,7 +273,7 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)
>         if (err)
>                 iput(inode);
>  out:
> -       if (req)
> +       if (!IS_ERR_OR_NULL(req))
>                 ceph_osdc_put_request(req);
>         if (err)
>                 netfs_subreq_terminated(subreq, err);

Hi Dan,

I think a better fix would be to set req to NULL in the offending
IS_ERR branch since ceph_osdc_new_request() never returns NULL or
use two separate goto labels.

While at it, the initialization of req and the check on req before
calling ceph_osdc_put_request() are redundant.

Thanks,

                Ilya

WARNING: multiple messages have this Message-ID (diff)
From: Ilya Dryomov <idryomov@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jeff Layton <jlayton@kernel.org>,
	Ceph Development <ceph-devel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ceph: Fix an Oops in error handling
Date: Tue, 02 Feb 2021 12:35:35 +0000	[thread overview]
Message-ID: <CAOi1vP_GSHBFwDeuAatpTbuJM90ootzZ31-oK1FKKM93JOmf_g@mail.gmail.com> (raw)
In-Reply-To: <YBjne8A1gn0mvQtT@mwanda>

On Tue, Feb 2, 2021 at 6:47 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The "req" pointer is an error pointer and not NULL so this check needs
> to be fixed.
>
> Fixes: 1cf7fdf52d5a ("ceph: convert readpage to fscache read helper")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  fs/ceph/addr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 5eec6f66fe52..fb0238a4d34f 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -273,7 +273,7 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)
>         if (err)
>                 iput(inode);
>  out:
> -       if (req)
> +       if (!IS_ERR_OR_NULL(req))
>                 ceph_osdc_put_request(req);
>         if (err)
>                 netfs_subreq_terminated(subreq, err);

Hi Dan,

I think a better fix would be to set req to NULL in the offending
IS_ERR branch since ceph_osdc_new_request() never returns NULL or
use two separate goto labels.

While at it, the initialization of req and the check on req before
calling ceph_osdc_put_request() are redundant.

Thanks,

                Ilya

  reply	other threads:[~2021-02-02 12:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  5:47 [PATCH] ceph: Fix an Oops in error handling Dan Carpenter
2021-02-02  5:47 ` Dan Carpenter
2021-02-02 12:35 ` Ilya Dryomov [this message]
2021-02-02 12:35   ` Ilya Dryomov
2021-02-02 12:37 ` Jeff Layton
2021-02-02 12:37   ` Jeff Layton
2021-02-02 14:19   ` Dan Carpenter
2021-02-02 14:19     ` Dan Carpenter
2021-02-02 13:10 [PATCH] ceph: fix an oops in error handling in ceph_netfs_issue_op Jeff Layton
2021-02-02 13:10 ` Jeff Layton
2021-02-02 14:20 ` Dan Carpenter
2021-02-02 14:20   ` Dan Carpenter

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=CAOi1vP_GSHBFwDeuAatpTbuJM90ootzZ31-oK1FKKM93JOmf_g@mail.gmail.com \
    --to=idryomov@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.