Re: [f2fs-dev] [PATCH] f2fs: fix error handling on device alias check in rename and unlink

Chao Yu via Linux-f2fs-devel <[email protected]>
Newsgroups net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 8/21/26 23:26, Jaegeuk Kim via Linux-f2fs-devel wrote:
> On 08/21, Daeho Jeong wrote:
>> From: Daeho Jeong <[email protected]>
>>
>> In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
>> encountering a device aliasing file bypasses the cleanup path.
>>
>> Fix this by setting err to -EPERM and jumping to the proper cleanup
>> labels (out_dir and out) instead of returning immediately.
>>
>> Fixes: a737e409a3d6 ("f2fs: support dynamic reserve/release for device aliasing")
>> Cc: [email protected]
> 
> Applied without Fixes and stable, since the original patch has not been
> upstreamed.

Jaegeuk, if we don't plan to merge them, we'd better keep the Fixes and stable
line, otherwise, once the two patches be upstreamed, we may missed to backport
the fix one due to the missing lines?

Thanks,

> 
>> Reported-by: Christophe JAILLET <[email protected]>
>> Signed-off-by: Daeho Jeong <[email protected]>
>> Reviewed-by: Chao Yu <[email protected]>
>> ---
>>   fs/f2fs/namei.c | 12 ++++++++----
>>   1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
>> index 784f636244e1..b9b15c5d28de 100644
>> --- a/fs/f2fs/namei.c
>> +++ b/fs/f2fs/namei.c
>> @@ -571,8 +571,10 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
>>   
>>   	trace_f2fs_unlink_enter(dir, dentry);
>>   
>> -	if (IS_DEVICE_ALIASING(inode))
>> -		return -EPERM;
>> +	if (IS_DEVICE_ALIASING(inode)) {
>> +		err = -EPERM;
>> +		goto out;
>> +	}
>>   
>>   	if (unlikely(f2fs_cp_error(sbi))) {
>>   		err = -EIO;
>> @@ -1025,8 +1027,10 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>>   	}
>>   
>>   	if (new_inode) {
>> -		if (IS_DEVICE_ALIASING(new_inode))
>> -			return -EPERM;
>> +		if (IS_DEVICE_ALIASING(new_inode)) {
>> +			err = -EPERM;
>> +			goto out_dir;
>> +		}
>>   
>>   		err = -ENOTEMPTY;
>>   		if (old_is_dir && !f2fs_empty_dir(new_inode))
>> -- 
>> 2.55.0.766.g2966f0265a-goog
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.