summaryrefslogtreecommitdiff
path: root/fs/ext2
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-10-09 17:46:40 +0300
committerJan Kara <jack@suse.cz>2017-10-11 12:43:24 +0300
commit8af634ff9e5c0fd5daff37c9759cd6594345b372 (patch)
tree73eb5cd075500af516a0609abcd14957934578d7 /fs/ext2
parent088519572ca8bd6ab354d74bf7c88f413ed0e0be (diff)
downloadlinux-8af634ff9e5c0fd5daff37c9759cd6594345b372.tar.xz
ext2: Fix possible sleep in atomic during mount option parsing
match_int() used in mount option parsing can allocate memory using GFP_KERNEL and thus sleep. Avoid parsing mount options with sbi->s_lock held. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/super.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 05eae20d133f..e2b6be03e69b 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1321,20 +1321,20 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
int err;
sync_filesystem(sb);
- spin_lock(&sbi->s_lock);
+ spin_lock(&sbi->s_lock);
new_opts.s_mount_opt = sbi->s_mount_opt;
new_opts.s_resuid = sbi->s_resuid;
new_opts.s_resgid = sbi->s_resgid;
+ spin_unlock(&sbi->s_lock);
/*
* Allow the "check" option to be passed as a remount option.
*/
- if (!parse_options(data, sb, &new_opts)) {
- spin_unlock(&sbi->s_lock);
+ if (!parse_options(data, sb, &new_opts))
return -EINVAL;
- }
+ spin_lock(&sbi->s_lock);
es = sbi->s_es;
if ((sbi->s_mount_opt ^ new_opts.s_mount_opt) & EXT2_MOUNT_DAX) {
ext2_msg(sb, KERN_WARNING, "warning: refusing change of "