All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: wilc1000: fix double mutex_unlock on failure path in wilc_wlan_cleanup()
@ 2015-12-04 22:04 Alexey Khoroshilov
  2015-12-18 22:50 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Khoroshilov @ 2015-12-04 22:04 UTC (permalink / raw)
  To: Johnny Kim, Austin Shin, Chris Park, Tony Cho, Glen Lee, Leo Kim
  Cc: Alexey Khoroshilov, Greg Kroah-Hartman, linux-wireless, devel,
	linux-kernel, ldv-project

If hif_read_reg() or hif_write_reg() fail in wilc_wlan_cleanup(),
it calls release_bus() and continues execution. But it leads to double
release_bus() call that means double unlock of g_linux_wlan->hif_cs mutex.

The patch adds return in case of failure.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/staging/wilc1000/wilc_wlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c02665747705..cd7f52a51173 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1703,12 +1703,14 @@ void wilc_wlan_cleanup(struct net_device *dev)
 	if (!ret) {
 		PRINT_ER("Error while reading reg\n");
 		release_bus(RELEASE_ALLOW_SLEEP);
+		return;
 	}
 	PRINT_ER("Writing ABORT reg\n");
 	ret = p->hif_func.hif_write_reg(WILC_GP_REG_0, (reg | ABORT_INT));
 	if (!ret) {
 		PRINT_ER("Error while writing reg\n");
 		release_bus(RELEASE_ALLOW_SLEEP);
+		return;
 	}
 	release_bus(RELEASE_ALLOW_SLEEP);
 	/**
-- 
1.9.1


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

end of thread, other threads:[~2016-02-03 23:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-04 22:04 [PATCH] staging: wilc1000: fix double mutex_unlock on failure path in wilc_wlan_cleanup() Alexey Khoroshilov
2015-12-18 22:50 ` Greg Kroah-Hartman
2015-12-20 21:46   ` Alexey Khoroshilov
2015-12-21 21:22     ` Greg Kroah-Hartman
2015-12-22 17:39       ` [PATCH v3] " Alexey Khoroshilov
2016-02-03 23:04         ` Greg Kroah-Hartman
2015-12-22  8:04     ` [PATCH] " Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.