Re: [PATCH v3 1/3] ext4: fix setattr project check upon fssetxattr ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> 在 2018年9月16日,下午8:20,Theodore Y. Ts'o <tytso@xxxxxxx> 写道:
> 
> On Sun, Sep 16, 2018 at 04:02:52AM +0000, Wang Shilong wrote:
>> 
>> 
>>> 在 2018年9月16日,上午11:55,Theodore Y. Ts'o <tytso@xxxxxxx> 写道:
>>> 
>>> On Wed, Sep 12, 2018 at 08:57:16AM +0900, Wang Shilong wrote:
>>>> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
>>>> index a7074115d6f6..f81102bd3203 100644
>>>> --- a/fs/ext4/ioctl.c
>>>> +++ b/fs/ext4/ioctl.c
>>>> @@ -339,19 +339,14 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
>>>> 	if (projid_eq(kprojid, EXT4_I(inode)->i_projid))
>>>> 		return 0;
>>>> 
>>>> -	err = mnt_want_write_file(filp);
>>>> -	if (err)
>>>> -		return err;
>>>> -
>>> 
>>> A huge part of this patch is dropping the calls to
>>> mnt_want_write_file() and mnt_drop_write_file().  What's the
>>> justification for doing this?  The use of mnt_want_write_file() looks
>>> necessary to me…
>> 
>> Hi Ted,
>> 
>>     mnt_want_write_file() and inode_lock is held before this function called now.
>> Since both ioctl_set_flags and ext4_set_project() need call them.
> 
> I don't see any place in this patch where mnt_want_write_file() is
> being called.  What am I missing?  And if there is a dependent patch
> to this first patch in the patch series, please include it in this
> patch series....  or least point it out after the --- list.

Sorry, I might not explain it clearly, here is current codes after applying patch:

039                 err = mnt_want_write_file(filp);          ———————>called here, this is originally there for ext4_ioctl_setflags()
1040                 if (err)
1041                         return err;
1042 
1043                 inode_lock(inode);
1044                 err = ext4_ioctl_setattr_check_projid(inode, &fa);
1045                 if (err)
1046                         goto out;
1047                 flags = (ei->i_flags & ~EXT4_FL_XFLAG_VISIBLE) |
1048                          (flags & EXT4_FL_XFLAG_VISIBLE);
1049                 err = ext4_ioctl_setflags(inode, flags);
1050                 if (err)
1051                         goto out;
1052                 err = ext4_ioctl_setproject(filp, fa.fsx_projid);
1053 out:
1054                 inode_unlock(inode);
1055                 mnt_drop_write_file(filp);          ————————>dropped here.
1056                 return err; 
1057         }

Thanks,
Shilong

> 
> Thanks,
> 
> 						- Ted





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux