Skip to content

Commit

Permalink
9p: fix error handling in v9fs_file_do_lock
Browse files Browse the repository at this point in the history
p9_client_lock_dotl() doesn't set status if p9_client_rpc() fails.
It can lead to 'default:' case in switch below and kernel crashes.

Let's bypass the switch if p9_client_lock_dotl() fails.

Signed-off-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Dominique Martinet <[email protected]>
Signed-off-by: Eric Van Hensbergen <[email protected]>
  • Loading branch information
kiryl authored and ericvh committed Mar 20, 2015
1 parent 9bfc52c commit ad80492
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/9p/vfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
for (;;) {
res = p9_client_lock_dotl(fid, &flock, &status);
if (res < 0)
break;
goto out_unlock;

if (status != P9_LOCK_BLOCKED)
break;
Expand All @@ -220,6 +220,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
BUG();
}

out_unlock:
/*
* incase server returned error for lock request, revert
* it locally
Expand Down

0 comments on commit ad80492

Please sign in to comment.