lkml.org 
[lkml]   [2020]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5] f2fs: fix potential .flags overflow on 32bit architecture
From
Date
On 2020/3/23 23:10, Jaegeuk Kim wrote:
> On 03/23, Joe Perches wrote:
>> On Mon, 2020-03-23 at 11:18 +0800, Chao Yu wrote:
>>> f2fs_inode_info.flags is unsigned long variable, it has 32 bits
>>> in 32bit architecture, since we introduced FI_MMAP_FILE flag
>>> when we support data compression, we may access memory cross
>>> the border of .flags field, corrupting .i_sem field, result in
>>> below deadlock.
>> []
>>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
>> []
>>> @@ -362,7 +362,7 @@ static int do_read_inode(struct inode *inode)
>>> fi->i_flags = le32_to_cpu(ri->i_flags);
>>> if (S_ISREG(inode->i_mode))
>>> fi->i_flags &= ~F2FS_PROJINHERIT_FL;
>>> - fi->flags = 0;
>>> + bitmap_zero(fi->flags, BITS_TO_LONGS(FI_MAX));
>>
>> Sorry, I misled you here, this should be
>>
>> bitmap_zero(fi->flags, FI_MAX);

Oh, I missed to check that as well. :(

>
> Thanks, I applied this directly in the f2fs tree.

Thanks for the help.

Thanks,

> .
>

\
 
 \ /
  Last update: 2020-03-24 07:15    [W:0.141 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site