]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
xen/scsiback: correct frontend counting
authorJuergen Gross <jgross@suse.com>
Mon, 8 Feb 2016 14:30:18 +0000 (15:30 +0100)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 6 Apr 2016 09:24:13 +0000 (10:24 +0100)
BugLink: http://bugs.launchpad.net/bugs/1553179
commit f285aa8db7cc4432c1a03f8b55ff34fe96317c11 upstream.

When adding a new frontend to xen-scsiback don't decrement the number
of active frontends in case of no error. Doing so results in a failure
when trying to remove the xen-pvscsi nexus even if no domain is using
it.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/xen/xen-scsiback.c

index ad4eb1024d1ffb7663db4e770fdd4c5c2663e821..51387d75c7bf1202556cf919042bc0b055bc6a27 100644 (file)
@@ -939,12 +939,12 @@ out:
        spin_unlock_irqrestore(&info->v2p_lock, flags);
 
 out_free:
-       mutex_lock(&tpg->tv_tpg_mutex);
-       tpg->tv_tpg_fe_count--;
-       mutex_unlock(&tpg->tv_tpg_mutex);
-
-       if (err)
+       if (err) {
+               mutex_lock(&tpg->tv_tpg_mutex);
+               tpg->tv_tpg_fe_count--;
+               mutex_unlock(&tpg->tv_tpg_mutex);
                kfree(new);
+       }
 
        return err;
 }