tmem: properly drop lock on error path in do_tmem_op()
authorJan Beulich <jbeulich@suse.com>
Tue, 11 Sep 2012 12:18:26 +0000 (14:18 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Sep 2012 12:18:26 +0000 (14:18 +0200)
Reported-by: Tim Deegan <tim@xen.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
xen/common/tmem.c

index 6385cd1fcb67fb72fed4ced6cf7016f11ea4b5b6..164c91f41175c8a551fd4dc3062aa80f466739a8 100644 (file)
@@ -2659,13 +2659,19 @@ EXPORT long do_tmem_op(tmem_cli_op_t uops)
     if ( client != NULL && tmh_client_is_dying(client) )
     {
         rc = -ENODEV;
-        goto out;
+        if ( tmh_lock_all )
+            goto out;
+ simple_error:
+        errored_tmem_ops++;
+        return rc;
     }
 
     if ( unlikely(tmh_get_tmemop_from_client(&op, uops) != 0) )
     {
         printk("tmem: can't get tmem struct from %s\n",client_str);
         rc = -EFAULT;
+        if ( !tmh_lock_all )
+            goto simple_error;
         goto out;
     }