linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ataflop: unlock ataflop_probe_lock at atari_floppy_init()
@ 2021-10-16 13:25 Tetsuo Handa
  2021-10-16 22:56 ` Finn Thain
  2021-10-17  1:52 ` Michael Schmitz
  0 siblings, 2 replies; 10+ messages in thread
From: Tetsuo Handa @ 2021-10-16 13:25 UTC (permalink / raw)
  To: linux-block, linux-m68k, Christoph Hellwig, Luis Chamberlain

Commit bf9c0538e485b591 ("ataflop: use a separate gendisk for each media
format") introduced ataflop_probe_lock mutex, but forgot to unlock the
mutex when atari_floppy_init() (i.e. module loading) succeeded. If
ataflop_probe() is called, it will deadlock on ataflop_probe_lock mutex.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: bf9c0538e485b591 ("ataflop: use a separate gendisk for each media format")
---
To m68k users

  This patch suggests that nobody is testing this module using a real hardware.
  Can somebody test this module?
  Is current m68k hardware still supporting Atari floppy?
  If Atari floppy is no longer supported, do we still need this module?

To Christoph Hellwig and Luis Chamberlain

  If we move __register_blkdev() in atari_floppy_init() to the end of
  atari_floppy_init() and move unregister_blkdev() in atari_floppy_exit() to
  the beginning of atari_floppy_exit(), we can remove unregister_blkdev() from
  atari_floppy_init(), and I think we can also remove ataflop_probe_lock mutex
  because probe function and __exit function are serialized by major_names_lock
  mutex.

 drivers/block/ataflop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index a093644ac39f..39b42cb8d173 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -2072,7 +2072,8 @@ static int __init atari_floppy_init (void)
 	       UseTrackbuffer ? "" : "no ");
 	config_types();
 
-	return 0;
+	ret = 0;
+	goto out_unlock;
 
 err:
 	while (--i >= 0) {
-- 
2.18.4


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

end of thread, other threads:[~2021-10-21 16:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16 13:25 [PATCH] ataflop: unlock ataflop_probe_lock at atari_floppy_init() Tetsuo Handa
2021-10-16 22:56 ` Finn Thain
2021-10-17  1:52 ` Michael Schmitz
2021-10-17  2:09   ` [PATCH v2] ataflop: remove ataflop_probe_lock mutex Tetsuo Handa
2021-10-17 19:05     ` Michael Schmitz
2021-10-17 23:47       ` Michael Schmitz
2021-10-18  8:15         ` Michael Schmitz
2021-10-18 22:25     ` Michael Schmitz
2021-10-21 16:20     ` Luis Chamberlain
2021-10-21 16:21       ` Luis Chamberlain

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).