]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
ext4: fix check of dqget() return value in ext4_ioctl_setproject()
authorSeth Forshee <seth.forshee@canonical.com>
Thu, 5 May 2016 14:52:38 +0000 (10:52 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 5 May 2016 14:52:38 +0000 (10:52 -0400)
A failed call to dqget() returns an ERR_PTR() and not null. Fix
the check in ext4_ioctl_setproject() to handle this correctly.

Fixes: 9b7365fc1c82 ("ext4: add FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support")
Cc: stable@vger.kernel.org # v4.5
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
fs/ext4/ioctl.c

index eae5917c534e51b2fddf7bcebfa1293ed76a2841..0acf8cacb2bee112b082f624de267a053b3fd4dd 100644 (file)
@@ -365,7 +365,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
                struct dquot *transfer_to[MAXQUOTAS] = { };
 
                transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
-               if (transfer_to[PRJQUOTA]) {
+               if (!IS_ERR(transfer_to[PRJQUOTA])) {
                        err = __dquot_transfer(inode, transfer_to);
                        dqput(transfer_to[PRJQUOTA]);
                        if (err)