summary refs log tree commit diff
path: root/fs/ext4/balloc.c
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2022-01-04 15:35:17 +0100
committerTheodore Ts'o <tytso@mit.edu>2022-01-10 13:25:55 -0500
commit13b215a9e657808414a2159b0dec90f1c31ebe05 (patch)
tree4fa10dfd4de3113dcbb75cc0732b8885b88500d0 /fs/ext4/balloc.c
parent173b6e383d2a204c9921ffc1eca3b87aa2106c33 (diff)
downloadlinux-13b215a9e657808414a2159b0dec90f1c31ebe05.tar.gz
ext4: don't use kfree() on rcu protected pointer sbi->s_qf_names
During ext4 mount api rework the commit e6e268cb6822 ("ext4: move quota
configuration out of handle_mount_opt()") introduced a bug where we
would kfree(sbi->s_qf_names[i]) before assigning the new quota name in
ext4_apply_quota_options().

This is wrong because we're using kfree() on rcu prointer that could be
simultaneously accessed from ext4_show_quota_options() during remount.
Fix it by using rcu_replace_pointer() to replace the old qname with the
new one and then kfree_rcu() the old quota name.

Also use get_qf_name() instead of sbi->s_qf_names in strcmp() to silence
the sparse warning.

Fixes: e6e268cb6822 ("ext4: move quota configuration out of handle_mount_opt()")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Link: https://lore.kernel.org/r/20220104143518.134465-1-lczerner@redhat.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/balloc.c')
0 files changed, 0 insertions, 0 deletions