HPFS: Restrict uid and gid to 16-bit values
authorMikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Sun, 8 May 2011 18:44:00 +0000 (20:44 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 9 May 2011 16:04:24 +0000 (09:04 -0700)
Restrict uid and gid to 16-bit values.

HPFS stores only 2 bytes in the EAs.

Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/hpfs/inode.c

index d093ce7494125da107ca8660b8a029145304992c..bc61bb4fd38daff4c93cd674f80f600634707306 100644 (file)
@@ -261,6 +261,10 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
        hpfs_lock(inode->i_sb);
        if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root)
                goto out_unlock;
+       if ((attr->ia_valid & ATTR_UID) && attr->ia_uid >= 0x10000)
+               goto out_unlock;
+       if ((attr->ia_valid & ATTR_GID) && attr->ia_gid >= 0x10000)
+               goto out_unlock;
        if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size)
                goto out_unlock;