* [PATCH] ceph: quota: fix null pointer dereference in quota check [not found] <20181101065318.2cylxol6d444nzeu@kili.mountain> @ 2018-11-05 11:00 ` Luis Henriques 2018-11-06 13:00 ` Yan, Zheng 0 siblings, 1 reply; 2+ messages in thread From: Luis Henriques @ 2018-11-05 11:00 UTC (permalink / raw) To: Yan, Zheng, Sage Weil, Ilya Dryomov Cc: Dan Carpenter, ceph-devel, linux-kernel, Luis Henriques 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; ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ceph: quota: fix null pointer dereference in quota check 2018-11-05 11:00 ` [PATCH] ceph: quota: fix null pointer dereference in quota check Luis Henriques @ 2018-11-06 13:00 ` Yan, Zheng 0 siblings, 0 replies; 2+ messages in thread From: Yan, Zheng @ 2018-11-06 13:00 UTC (permalink / raw) To: Luis Henriques Cc: Sage Weil, Ilya Dryomov, Dan Carpenter, ceph-devel, linux-kernel > On Nov 5, 2018, at 19:00, Luis Henriques <lhenriques@suse.com> wrote: > > 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; Applied, thanks. Yan, Zheng ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-06 13:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20181101065318.2cylxol6d444nzeu@kili.mountain>
2018-11-05 11:00 ` [PATCH] ceph: quota: fix null pointer dereference in quota check Luis Henriques
2018-11-06 13:00 ` Yan, Zheng
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®