mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiubo Li <xiubli@redhat.com>
To: Wenchao Hao <haowenchao2@huawei.com>,
	Ilya Dryomov <idryomov@gmail.com>,
	Jeff Layton <jlayton@kernel.org>,
	ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: louhongxiang@huawei.com
Subject: Re: [PATCH] ceph: quota: Fix invalid pointer access in
Date: Wed, 15 Nov 2023 08:35:50 +0800	[thread overview]
Message-ID: <af8549c8-a468-6505-6dd1-3589fc76be8e@redhat.com> (raw)
In-Reply-To: <20231114153108.1932884-1-haowenchao2@huawei.com>


On 11/14/23 23:31, Wenchao Hao wrote:
> This issue is reported by smatch, get_quota_realm() might return
> ERR_PTR, so we should using IS_ERR_OR_NULL here to check the return
> value.
>
> Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
> ---
>   fs/ceph/quota.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c
> index 9d36c3532de1..c4b2929c6a83 100644
> --- a/fs/ceph/quota.c
> +++ b/fs/ceph/quota.c
> @@ -495,7 +495,7 @@ bool ceph_quota_update_statfs(struct ceph_fs_client *fsc, struct kstatfs *buf)
>   	realm = get_quota_realm(mdsc, d_inode(fsc->sb->s_root),
>   				QUOTA_GET_MAX_BYTES, true);
>   	up_read(&mdsc->snap_rwsem);
> -	if (!realm)
> +	if (IS_ERR_OR_NULL(realm))
>   		return false;
>   
>   	spin_lock(&realm->inodes_with_caps_lock);

Good catch.

Reviewed-by: Xiubo Li <xiubli@redhat.com>

We should CC the stable mail list.

Thanks

- Xiubo


  reply	other threads:[~2023-11-15  0:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 15:31 Wenchao Hao
2023-11-15  0:35 ` Xiubo Li [this message]
2023-11-15 12:32   ` Ilya Dryomov
2023-11-15 13:17     ` Xiubo Li
2023-11-15 13:25       ` Ilya Dryomov
2023-11-15 13:34         ` Xiubo Li
2023-11-16  2:54           ` Wenchao Hao
2023-11-16  3:06             ` Xiubo Li
2023-11-16  7:09               ` Wenchao Hao
2023-11-17  6:14                 ` Xiubo Li
2023-11-17  8:53                   ` Wenchao Hao
2023-11-20  0:34                     ` Xiubo Li
2023-11-15 11:19 ` Luis Henriques
2023-11-15 11:25   ` 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=af8549c8-a468-6505-6dd1-3589fc76be8e@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=haowenchao2@huawei.com \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louhongxiang@huawei.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®