lkml.org 
[lkml]   [2024]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH 07/11] fs/ntfs3: Check 'folio' pointer for NULL
    From
    It can be NULL if bmap is called.

    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    ---
     fs/ntfs3/inode.c | 17 +++++++++++------
     1 file changed, 11 insertions(+), 6 deletions(-)

    diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
    index 85a10d4a74c4..94177c1dd818 100644
    --- a/fs/ntfs3/inode.c
    +++ b/fs/ntfs3/inode.c
    @@ -570,13 +570,18 @@ static noinline int ntfs_get_block_vbo(struct
    inode *inode, u64 vbo,
         clear_buffer_uptodate(bh);

         if (is_resident(ni)) {
    -        ni_lock(ni);
    -        err = attr_data_read_resident(ni, &folio->page);
    -        ni_unlock(ni);
    -
    -        if (!err)
    -            set_buffer_uptodate(bh);
    +        bh->b_blocknr = RESIDENT_LCN;
             bh->b_size = block_size;
    +        if (!folio) {
    +            err = 0;
    +        } else {
    +            ni_lock(ni);
    +            err = attr_data_read_resident(ni, &folio->page);
    +            ni_unlock(ni);
    +
    +            if (!err)
    +                set_buffer_uptodate(bh);
    +        }
             return err;
         }

    --
    2.34.1

    \
     
     \ /
      Last update: 2024-05-27 16:43    [W:2.995 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site