f2fs: use lock_buffer when changing superblock
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 7 Dec 2015 18:18:54 +0000 (10:18 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 9 Dec 2015 17:53:18 +0000 (09:53 -0800)
When modifying sb contents, we need to use lock its buffer.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index a018ed327713ba3dfdf241ab34e9029e43e37a36..294e71576cec973ffed0c28ca3760e58df121504 100644 (file)
@@ -1591,14 +1591,18 @@ static int f2fs_ioc_get_encryption_pwsalt(struct file *filp, unsigned long arg)
                return err;
 
        /* update superblock with uuid */
+       lock_buffer(sbi->raw_super_buf);
        generate_random_uuid(sbi->raw_super->encrypt_pw_salt);
+       unlock_buffer(sbi->raw_super_buf);
 
        err = f2fs_commit_super(sbi, false);
 
        mnt_drop_write_file(filp);
        if (err) {
                /* undo new data */
+               lock_buffer(sbi->raw_super_buf);
                memset(sbi->raw_super->encrypt_pw_salt, 0, 16);
+               unlock_buffer(sbi->raw_super_buf);
                return err;
        }
 got_it: