Commit 5291658d authored by Dan Carpenter's avatar Dan Carpenter Committed by Miklos Szeredi

fuse: fix fuse_file_lseek returning with lock held

This bug was found with smatch (http://repo.or.cz/w/smatch.git/).  If
we return directly the inode->i_mutex lock doesn't get released.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
CC: stable@kernel.org
parent 0d34fb8e
...@@ -1465,7 +1465,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) ...@@ -1465,7 +1465,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
case SEEK_END: case SEEK_END:
retval = fuse_update_attributes(inode, NULL, file, NULL); retval = fuse_update_attributes(inode, NULL, file, NULL);
if (retval) if (retval)
return retval; goto exit;
offset += i_size_read(inode); offset += i_size_read(inode);
break; break;
case SEEK_CUR: case SEEK_CUR:
...@@ -1479,6 +1479,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) ...@@ -1479,6 +1479,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
} }
retval = offset; retval = offset;
} }
exit:
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment