Skip to content

Commit

Permalink
xfs: eliminate lockdep false positives in xfs_attr_shortform_list
Browse files Browse the repository at this point in the history
xfs_attr_shortform_list() only called from a non-transactional context, it
hold ilock before alloc memory and maybe trapped in memory reclaim. Since
commit 204fae3("xfs: clean up remaining GFP_NOFS users") removed
GFP_NOFS flag, lockdep warning will be report as [1]. Eliminate lockdep
false positives by use __GFP_NOLOCKDEP to alloc memory
in xfs_attr_shortform_list().

[1] https://lore.kernel.org/linux-xfs/000000000000e33add0616358204@google.com/

Reported-by: syzbot+4248e91deb3db78358a2@syzkaller.appspotmail.com
Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
  • Loading branch information
Long Li authored and Carlos Maiolino committed Nov 22, 2024
1 parent 28eb75e commit 45f69d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/xfs/xfs_attr_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ xfs_attr_shortform_list(
* It didn't all fit, so we have to sort everything on hashval.
*/
sbsize = sf->count * sizeof(*sbuf);
sbp = sbuf = kmalloc(sbsize, GFP_KERNEL | __GFP_NOFAIL);
sbp = sbuf = kmalloc(sbsize,
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);

/*
* Scan the attribute list for the rest of the entries, storing
Expand Down

0 comments on commit 45f69d0

Please sign in to comment.