9p: fix error handling in v9fs_file_do_lock
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Mon, 29 Dec 2014 13:00:18 +0000 (15:00 +0200)
committerEric Van Hensbergen <ericvh@gmail.com>
Fri, 20 Mar 2015 14:34:41 +0000 (07:34 -0700)
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 <kirill.shutemov@linux.intel.com>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
fs/9p/vfs_file.c

index b40133796b8734d32cf5376b12d1e01672af85db..8d29e1e03dfa1d2fe75c7814458cdab2654131dc 100644 (file)
@@ -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;
@@ -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