Skip to contentSkip to conversation

misc: mic/scif: re-take a lock on error path

PATCH In review Dan Carpenter 2 participants 2 messages Oct 13, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: mic/scif: re-take a lock on error path

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')
drivers/misc/mic/scif/scif_rma.c +1 -0
index e288996..980ef13 100644
@@ -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:
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Dan Carpenter

The caller expects that we take this lock again before returning otherwise it you get double unlocks and races.

Thanks for the fix!

Quoted 15 lines
Fixes ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
drivers/misc/mic/scif/scif_rma.c +1 -0
index e288996..980ef13 100644
@@ -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: