add patch fix-race-in-transient-ENOSPC-detection
[ext4-patch-queue.git] / fix-check-of-dqget-return-value-in-ext4_ioctl_setproject
blob6df489209b5feeddd70e31f5d98f11012f04a582
1 ext4: fix check of dqget() return value in ext4_ioctl_setproject()
3 From: Seth Forshee <seth.forshee@canonical.com>
5 A failed call to dqget() returns an ERR_PTR() and not null. Fix
6 the check in ext4_ioctl_setproject() to handle this correctly.
8 Fixes: 9b7365fc1c82 ("ext4: add FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support")
9 Cc: stable@vger.kernel.org # v4.5
10 Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 Reviewed-by: Jan Kara <jack@suse.cz>
13 ---
14  fs/ext4/ioctl.c | 2 +-
15  1 file changed, 1 insertion(+), 1 deletion(-)
17 diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
18 index 322f5bdbf76a..dd82cf1c4e39 100644
19 --- a/fs/ext4/ioctl.c
20 +++ b/fs/ext4/ioctl.c
21 @@ -365,7 +365,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
22                 struct dquot *transfer_to[MAXQUOTAS] = { };
24                 transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
25 -               if (transfer_to[PRJQUOTA]) {
26 +               if (!IS_ERR(transfer_to[PRJQUOTA])) {
27                         err = __dquot_transfer(inode, transfer_to);
28                         dqput(transfer_to[PRJQUOTA]);
29                         if (err)
30 -- 
31 1.9.1