Commit 71f2cc64 authored by Luis Henriques's avatar Luis Henriques Committed by Ilya Dryomov
Browse files

ceph: quota: fix null pointer dereference in quota check

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)

Fixes: b7a29217

 ("ceph: quota: support for ceph.quota.max_files")
Reported-by: default avatarDan Carpenter <>
Signed-off-by: default avatarLuis Henriques <>
Reviewed-by: default avatar"Yan, Zheng" <>
Signed-off-by: default avatarIlya Dryomov <>
parent c2c6d3ce
...@@ -237,7 +237,8 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, ...@@ -237,7 +237,8 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
ceph_put_snap_realm(mdsc, realm); ceph_put_snap_realm(mdsc, realm);
realm = next; realm = next;
} }
ceph_put_snap_realm(mdsc, realm); if (realm)
ceph_put_snap_realm(mdsc, realm);
up_read(&mdsc->snap_rwsem); up_read(&mdsc->snap_rwsem);
return exceeded; return exceeded;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment