From: Luis Henriques <lhenriques@suse.com>
To: "Yan, Zheng" <zyan@redhat.com>, Sage Weil <sage@redhat.com>,
Ilya Dryomov <idryomov@gmail.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
Luis Henriques <lhenriques@suse.com>
Subject: [PATCH] ceph: quota: fix null pointer dereference in quota check
Date: Mon, 5 Nov 2018 11:00:52 +0000 [thread overview]
Message-ID: <20181105110052.31759-1-lhenriques@suse.com> (raw)
In-Reply-To: <20181101065318.2cylxol6d444nzeu@kili.mountain>
This patch fixes a possible null pointer dereference in
check_quota_exceeded, detected by the static checker smatch, with the
following warning:
fs/ceph/quota.c:240 check_quota_exceeded()
error: we previously assumed 'realm' could be null (see line 188)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lkml.kernel.org/n/20181101065318.2cylxol6d444nzeu@kili.mountain
Fixes: b7a2921765cf ("ceph: quota: support for ceph.quota.max_files")
Signed-off-by: Luis Henriques <lhenriques@suse.com>
---
fs/ceph/quota.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c
index 32d4f13784ba..03f4d24db8fe 100644
--- a/fs/ceph/quota.c
+++ b/fs/ceph/quota.c
@@ -237,7 +237,8 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
ceph_put_snap_realm(mdsc, realm);
realm = next;
}
- ceph_put_snap_realm(mdsc, realm);
+ if (realm)
+ ceph_put_snap_realm(mdsc, realm);
up_read(&mdsc->snap_rwsem);
return exceeded;
next parent reply other threads:[~2018-11-05 11:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181101065318.2cylxol6d444nzeu@kili.mountain>
2018-11-05 11:00 ` Luis Henriques [this message]
2018-11-06 13:00 ` Yan, Zheng
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=20181105110052.31759-1-lhenriques@suse.com \
--to=lhenriques@suse.com \
--cc=ceph-devel@vger.kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sage@redhat.com \
--cc=zyan@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
all inboxes | Powered by JetHome®