kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] misc: mic/scif: re-take a lock on error path
@ 2015-10-13 12:52 Dan Carpenter
  2015-10-13 16:20 ` Sudeep Dutt
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-10-13 12:52 UTC (permalink / raw)
  To: Nikhil Rao; +Cc: Greg Kroah-Hartman, Sudeep Dutt, linux-kernel, kernel-janitors

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>

diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c
index e288996..980ef13 100644
--- a/drivers/misc/mic/scif/scif_rma.c
+++ b/drivers/misc/mic/scif/scif_rma.c
@@ -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:

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] misc: mic/scif: re-take a lock on error path
  2015-10-13 12:52 [patch] misc: mic/scif: re-take a lock on error path Dan Carpenter
@ 2015-10-13 16:20 ` Sudeep Dutt
  0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Dutt @ 2015-10-13 16:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sudeep Dutt, Nikhil Rao, Greg Kroah-Hartman, linux-kernel,
	kernel-janitors

On Tue, 2015-10-13 at 15:52 +0300, Dan Carpenter wrote:
> The caller expects that we take this lock again before returning
> otherwise it you get double unlocks and races.
> 

Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>

Thanks for the fix!

> Fixes: ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c
> index e288996..980ef13 100644
> --- a/drivers/misc/mic/scif/scif_rma.c
> +++ b/drivers/misc/mic/scif/scif_rma.c
> @@ -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:



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-13 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 12:52 [patch] misc: mic/scif: re-take a lock on error path Dan Carpenter
2015-10-13 16:20 ` Sudeep Dutt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).