]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop queue-5.10/ataflop-remove-ataflop_probe_lock-mutex.patch as it breaks the build
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 08:02:02 +0000 (09:02 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 08:02:02 +0000 (09:02 +0100)
queue-5.10/ataflop-fix-off-by-one-in-ataflop_probe.patch
queue-5.10/ataflop-remove-ataflop_probe_lock-mutex.patch [deleted file]
queue-5.10/series

index 9316fd19f053a466a18f50549211862642f4182a..7c9090ce565a7a2d9dc285cdcce3567a4c529825 100644 (file)
@@ -22,7 +22,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/drivers/block/ataflop.c
 +++ b/drivers/block/ataflop.c
-@@ -2021,7 +2021,10 @@ static void ataflop_probe(dev_t dev)
+@@ -2023,7 +2023,10 @@ static void ataflop_probe(dev_t dev)
        int drive = MINOR(dev) & 3;
        int type  = MINOR(dev) >> 2;
  
@@ -32,5 +32,5 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 +
 +      if (drive >= FD_MAX_UNITS || type >= NUM_DISK_MINORS)
                return;
+       mutex_lock(&ataflop_probe_lock);
        if (!unit[drive].disk[type]) {
-               if (ataflop_alloc_disk(drive, type) == 0) {
diff --git a/queue-5.10/ataflop-remove-ataflop_probe_lock-mutex.patch b/queue-5.10/ataflop-remove-ataflop_probe_lock-mutex.patch
deleted file mode 100644 (file)
index cf29d84..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-From 70607d1cbf7be81efa046e41cac66398049862f2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 3 Nov 2021 16:04:33 -0700
-Subject: ataflop: remove ataflop_probe_lock mutex
-
-From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
-
-[ Upstream commit 4ddb85d36613c45bde00d368bf9f357bd0708a0c ]
-
-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. This will
-result in double lock deadlock if ataflop_probe() is called. Also,
-unregister_blkdev() must not be called from atari_floppy_init() with
-ataflop_probe_lock held when atari_floppy_init() failed, for
-ataflop_probe() waits for ataflop_probe_lock with major_names_lock held
-(i.e. AB-BA deadlock).
-
-__register_blkdev() needs to be called last in order to avoid calling
-ataflop_probe() when atari_floppy_init() is about to fail, for memory for
-completing already-started ataflop_probe() safely will be released as soon
-as atari_floppy_init() released ataflop_probe_lock mutex.
-
-As with commit 8b52d8be86d72308 ("loop: reorder loop_exit"),
-unregister_blkdev() needs to be called first in order to avoid calling
-ataflop_alloc_disk() from ataflop_probe() after del_gendisk() from
-atari_floppy_exit().
-
-By relocating __register_blkdev() / unregister_blkdev() as explained above,
-we can remove ataflop_probe_lock mutex, for probe function and __exit
-function are serialized by major_names_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")
-Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
-Tested-by: Michael Schmitz <schmitzmic@gmail.com>
-Link: https://lore.kernel.org/r/20211103230437.1639990-11-mcgrof@kernel.org
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/block/ataflop.c | 47 +++++++++++++++++++++++------------------
- 1 file changed, 27 insertions(+), 20 deletions(-)
-
-diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
-index 2d3a66362dcf9..3a29f1992d971 100644
---- a/drivers/block/ataflop.c
-+++ b/drivers/block/ataflop.c
-@@ -2016,8 +2016,6 @@ static int ataflop_alloc_disk(unsigned int drive, unsigned int type)
-       return 0;
- }
--static DEFINE_MUTEX(ataflop_probe_lock);
--
- static void ataflop_probe(dev_t dev)
- {
-       int drive = MINOR(dev) & 3;
-@@ -2025,14 +2023,32 @@ static void ataflop_probe(dev_t dev)
-       if (drive >= FD_MAX_UNITS || type > NUM_DISK_MINORS)
-               return;
--      mutex_lock(&ataflop_probe_lock);
-       if (!unit[drive].disk[type]) {
-               if (ataflop_alloc_disk(drive, type) == 0) {
-                       add_disk(unit[drive].disk[type]);
-                       unit[drive].registered[type] = true;
-               }
-       }
--      mutex_unlock(&ataflop_probe_lock);
-+}
-+
-+static void atari_floppy_cleanup(void)
-+{
-+      int i;
-+      int type;
-+
-+      for (i = 0; i < FD_MAX_UNITS; i++) {
-+              for (type = 0; type < NUM_DISK_MINORS; type++) {
-+                      if (!unit[i].disk[type])
-+                              continue;
-+                      del_gendisk(unit[i].disk[type]);
-+                      blk_cleanup_queue(unit[i].disk[type]->queue);
-+                      put_disk(unit[i].disk[type]);
-+              }
-+              blk_mq_free_tag_set(&unit[i].tag_set);
-+      }
-+
-+      del_timer_sync(&fd_timer);
-+      atari_stram_free(DMABuffer);
- }
- static void atari_cleanup_floppy_disk(struct atari_floppy_struct *fs)
-@@ -2058,11 +2074,6 @@ static int __init atari_floppy_init (void)
-               /* Amiga, Mac, ... don't have Atari-compatible floppy :-) */
-               return -ENODEV;
--      mutex_lock(&ataflop_probe_lock);
--      ret = __register_blkdev(FLOPPY_MAJOR, "fd", ataflop_probe);
--      if (ret)
--              goto out_unlock;
--
-       for (i = 0; i < FD_MAX_UNITS; i++) {
-               memset(&unit[i].tag_set, 0, sizeof(unit[i].tag_set));
-               unit[i].tag_set.ops = &ataflop_mq_ops;
-@@ -2116,15 +2127,17 @@ static int __init atari_floppy_init (void)
-              UseTrackbuffer ? "" : "no ");
-       config_types();
--      return 0;
-+      ret = __register_blkdev(FLOPPY_MAJOR, "fd", ataflop_probe);
-+      if (ret) {
-+              printk(KERN_ERR "atari_floppy_init: cannot register block device\n");
-+              atari_floppy_cleanup();
-+      }
-+      return ret;
- err:
-       while (--i >= 0)
-               atari_cleanup_floppy_disk(&unit[i]);
--      unregister_blkdev(FLOPPY_MAJOR, "fd");
--out_unlock:
--      mutex_unlock(&ataflop_probe_lock);
-       return ret;
- }
-@@ -2169,14 +2182,8 @@ __setup("floppy=", atari_floppy_setup);
- static void __exit atari_floppy_exit(void)
- {
--      int i;
--
--      for (i = 0; i < FD_MAX_UNITS; i++)
--              atari_cleanup_floppy_disk(&unit[i]);
-       unregister_blkdev(FLOPPY_MAJOR, "fd");
--
--      del_timer_sync(&fd_timer);
--      atari_stram_free( DMABuffer );
-+      atari_floppy_cleanup();
- }
- module_init(atari_floppy_init)
--- 
-2.33.0
-
index fd0de9320c99ed345c068aa5b338036abfed50aa..0e3632880f5fab32a1910eba7e175575e1ca9a40 100644 (file)
@@ -509,7 +509,6 @@ drm-nouveau-svm-fix-refcount-leak-bug-and-missing-ch.patch
 block-ataflop-use-the-blk_cleanup_disk-helper.patch
 block-ataflop-add-registration-bool-before-calling-d.patch
 block-ataflop-provide-a-helper-for-cleanup-up-an-ata.patch
-ataflop-remove-ataflop_probe_lock-mutex.patch
 net-phy-fix-duplex-out-of-sync-problem-while-changin.patch
 bonding-fix-a-use-after-free-problem-when-bond_sysfs.patch
 mfd-core-add-missing-of_node_put-for-loop-iteration.patch