]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vfs: ftruncate check IS_APPEND() on real upper inode
authorAmir Goldstein <amir73il@gmail.com>
Sat, 8 Apr 2017 11:49:06 +0000 (14:49 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 20 Apr 2017 14:37:26 +0000 (16:37 +0200)
ftruncate an overlayfs inode was checking IS_APPEND() on
overlay inode, but overlay inode does not have the S_APPEND flag.

Check IS_APPEND() on real upper inode instead.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/open.c

index 949cef29c3bba9395efd2e461d2078d0a9a9b47c..993a91d20cc7b19f86e471f17ff1ab457dcc1717 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -193,7 +193,8 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
                goto out_putf;
 
        error = -EPERM;
-       if (IS_APPEND(inode))
+       /* Check IS_APPEND on real upper inode */
+       if (IS_APPEND(file_inode(f.file)))
                goto out_putf;
 
        sb_start_write(inode->i_sb);