misc: mic/scif: re-take a lock on error path
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 13 Oct 2015 12:52:06 +0000 (15:52 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 Oct 2015 04:49:48 +0000 (21:49 -0700)
The caller expects that we take this lock again before returning
otherwise it you get double unlocks and races.

Fixes: ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mic/scif/scif_rma.c

index e2889967036acf5ffdd0b3499d35770b044d927c..980ef13b4cf68194e3d9bb8a40134eb8796250ce 100644 (file)
@@ -680,6 +680,7 @@ int scif_unregister_window(struct scif_window *window)
                        }
                } else {
                        /* Return ENXIO since unregistration is in progress */
+                       mutex_lock(&ep->rma_info.rma_lock);
                        return -ENXIO;
                }
 retry: