]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Drop dm-delay-fix-a-race-between-delay_presuspend-and-del.patch
authorSasha Levin <sashal@kernel.org>
Wed, 29 Nov 2023 18:18:49 +0000 (13:18 -0500)
committerSasha Levin <sashal@kernel.org>
Wed, 29 Nov 2023 18:18:49 +0000 (13:18 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-6.1/dm-delay-fix-a-race-between-delay_presuspend-and-del.patch [deleted file]
queue-6.1/series
queue-6.6/dm-delay-fix-a-race-between-delay_presuspend-and-del.patch [deleted file]
queue-6.6/series

diff --git a/queue-6.1/dm-delay-fix-a-race-between-delay_presuspend-and-del.patch b/queue-6.1/dm-delay-fix-a-race-between-delay_presuspend-and-del.patch
deleted file mode 100644 (file)
index e1687f8..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-From ea477583c4ed283187470922a022b385462af2a2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 Nov 2023 18:21:14 +0100
-Subject: dm-delay: fix a race between delay_presuspend and delay_bio
-
-From: Mikulas Patocka <mpatocka@redhat.com>
-
-[ Upstream commit 6fc45b6ed921dc00dfb264dc08c7d67ee63d2656 ]
-
-In delay_presuspend, we set the atomic variable may_delay and then stop
-the timer and flush pending bios. The intention here is to prevent the
-delay target from re-arming the timer again.
-
-However, this test is racy. Suppose that one thread goes to delay_bio,
-sees that dc->may_delay is one and proceeds; now, another thread executes
-delay_presuspend, it sets dc->may_delay to zero, deletes the timer and
-flushes pending bios. Then, the first thread continues and adds the bio to
-delayed->list despite the fact that dc->may_delay is false.
-
-Fix this bug by changing may_delay's type from atomic_t to bool and
-only access it while holding the delayed_bios_lock mutex. Note that we
-don't have to grab the mutex in delay_resume because there are no bios
-in flight at this point.
-
-Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
-Cc: stable@vger.kernel.org
-Signed-off-by: Mike Snitzer <snitzer@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/md/dm-delay.c | 16 +++++++++++-----
- 1 file changed, 11 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
-index 358e870a03a56..5a8ece66ea696 100644
---- a/drivers/md/dm-delay.c
-+++ b/drivers/md/dm-delay.c
-@@ -32,7 +32,7 @@ struct delay_c {
-       struct work_struct flush_expired_bios;
-       struct list_head delayed_bios;
-       struct task_struct *worker;
--      atomic_t may_delay;
-+      bool may_delay;
-       struct delay_class read;
-       struct delay_class write;
-@@ -235,7 +235,7 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
-       ti->private = dc;
-       INIT_LIST_HEAD(&dc->delayed_bios);
--      atomic_set(&dc->may_delay, 1);
-+      dc->may_delay = true;
-       dc->argc = argc;
-       ret = delay_class_ctr(ti, &dc->read, argv);
-@@ -311,7 +311,7 @@ static int delay_bio(struct delay_c *dc, struct delay_class *c, struct bio *bio)
-       struct dm_delay_info *delayed;
-       unsigned long expires = 0;
--      if (!c->delay || !atomic_read(&dc->may_delay))
-+      if (!c->delay)
-               return DM_MAPIO_REMAPPED;
-       delayed = dm_per_bio_data(bio, sizeof(struct dm_delay_info));
-@@ -320,6 +320,10 @@ static int delay_bio(struct delay_c *dc, struct delay_class *c, struct bio *bio)
-       delayed->expires = expires = jiffies + msecs_to_jiffies(c->delay);
-       mutex_lock(&delayed_bios_lock);
-+      if (unlikely(!dc->may_delay)) {
-+              mutex_unlock(&delayed_bios_lock);
-+              return DM_MAPIO_REMAPPED;
-+      }
-       c->ops++;
-       list_add_tail(&delayed->list, &dc->delayed_bios);
-       mutex_unlock(&delayed_bios_lock);
-@@ -336,7 +340,9 @@ static void delay_presuspend(struct dm_target *ti)
- {
-       struct delay_c *dc = ti->private;
--      atomic_set(&dc->may_delay, 0);
-+      mutex_lock(&delayed_bios_lock);
-+      dc->may_delay = false;
-+      mutex_unlock(&delayed_bios_lock);
-       if (delay_is_fast(dc))
-               flush_delayed_bios_fast(dc, true);
-@@ -350,7 +356,7 @@ static void delay_resume(struct dm_target *ti)
- {
-       struct delay_c *dc = ti->private;
--      atomic_set(&dc->may_delay, 1);
-+      dc->may_delay = true;
- }
- static int delay_map(struct dm_target *ti, struct bio *bio)
--- 
-2.42.0
-
index 4821650be223e750e81f7188891609f82964415c..92765230aad09c2c3564cd9ef353400f46638d64 100644 (file)
@@ -36,7 +36,6 @@ cifs-distribute-channels-across-interfaces-based-on-.patch
 cifs-account-for-primary-channel-in-the-interface-li.patch
 cifs-fix-leak-of-iface-for-primary-channel.patch
 mips-kvm-fix-a-build-warning-about-variable-set-but-.patch
-dm-delay-fix-a-race-between-delay_presuspend-and-del.patch
 media-camss-split-power-domain-management.patch
 media-camss-convert-to-platform-remove-callback-retu.patch
 media-qcom-initialise-v4l2-async-notifier-later.patch
diff --git a/queue-6.6/dm-delay-fix-a-race-between-delay_presuspend-and-del.patch b/queue-6.6/dm-delay-fix-a-race-between-delay_presuspend-and-del.patch
deleted file mode 100644 (file)
index e096af9..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-From d153e17d9ead5f19f3a48488cf1f122dc3f5c2a4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 Nov 2023 18:21:14 +0100
-Subject: dm-delay: fix a race between delay_presuspend and delay_bio
-
-From: Mikulas Patocka <mpatocka@redhat.com>
-
-[ Upstream commit 6fc45b6ed921dc00dfb264dc08c7d67ee63d2656 ]
-
-In delay_presuspend, we set the atomic variable may_delay and then stop
-the timer and flush pending bios. The intention here is to prevent the
-delay target from re-arming the timer again.
-
-However, this test is racy. Suppose that one thread goes to delay_bio,
-sees that dc->may_delay is one and proceeds; now, another thread executes
-delay_presuspend, it sets dc->may_delay to zero, deletes the timer and
-flushes pending bios. Then, the first thread continues and adds the bio to
-delayed->list despite the fact that dc->may_delay is false.
-
-Fix this bug by changing may_delay's type from atomic_t to bool and
-only access it while holding the delayed_bios_lock mutex. Note that we
-don't have to grab the mutex in delay_resume because there are no bios
-in flight at this point.
-
-Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
-Cc: stable@vger.kernel.org
-Signed-off-by: Mike Snitzer <snitzer@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/md/dm-delay.c | 16 +++++++++++-----
- 1 file changed, 11 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
-index efd510984e259..2d6b900e4353c 100644
---- a/drivers/md/dm-delay.c
-+++ b/drivers/md/dm-delay.c
-@@ -33,7 +33,7 @@ struct delay_c {
-       struct work_struct flush_expired_bios;
-       struct list_head delayed_bios;
-       struct task_struct *worker;
--      atomic_t may_delay;
-+      bool may_delay;
-       struct delay_class read;
-       struct delay_class write;
-@@ -236,7 +236,7 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
-       ti->private = dc;
-       INIT_LIST_HEAD(&dc->delayed_bios);
--      atomic_set(&dc->may_delay, 1);
-+      dc->may_delay = true;
-       dc->argc = argc;
-       ret = delay_class_ctr(ti, &dc->read, argv);
-@@ -312,7 +312,7 @@ static int delay_bio(struct delay_c *dc, struct delay_class *c, struct bio *bio)
-       struct dm_delay_info *delayed;
-       unsigned long expires = 0;
--      if (!c->delay || !atomic_read(&dc->may_delay))
-+      if (!c->delay)
-               return DM_MAPIO_REMAPPED;
-       delayed = dm_per_bio_data(bio, sizeof(struct dm_delay_info));
-@@ -321,6 +321,10 @@ static int delay_bio(struct delay_c *dc, struct delay_class *c, struct bio *bio)
-       delayed->expires = expires = jiffies + msecs_to_jiffies(c->delay);
-       mutex_lock(&delayed_bios_lock);
-+      if (unlikely(!dc->may_delay)) {
-+              mutex_unlock(&delayed_bios_lock);
-+              return DM_MAPIO_REMAPPED;
-+      }
-       c->ops++;
-       list_add_tail(&delayed->list, &dc->delayed_bios);
-       mutex_unlock(&delayed_bios_lock);
-@@ -337,7 +341,9 @@ static void delay_presuspend(struct dm_target *ti)
- {
-       struct delay_c *dc = ti->private;
--      atomic_set(&dc->may_delay, 0);
-+      mutex_lock(&delayed_bios_lock);
-+      dc->may_delay = false;
-+      mutex_unlock(&delayed_bios_lock);
-       if (delay_is_fast(dc))
-               flush_delayed_bios_fast(dc, true);
-@@ -351,7 +357,7 @@ static void delay_resume(struct dm_target *ti)
- {
-       struct delay_c *dc = ti->private;
--      atomic_set(&dc->may_delay, 1);
-+      dc->may_delay = true;
- }
- static int delay_map(struct dm_target *ti, struct bio *bio)
--- 
-2.42.0
-
index abb5f6f37c5bddbd608ad83285a66061a2c6f6c4..2b902d41b2c428ab0da81d16db792ccbda350f20 100644 (file)
@@ -59,4 +59,3 @@ cifs-account-for-primary-channel-in-the-interface-li.patch
 cifs-fix-leak-of-iface-for-primary-channel.patch
 alsa-hda-asus-um5302la-added-quirks-for-cs35l41-1043.patch
 alsa-hda-realtek-add-quirks-for-asus-2024-zenbooks.patch
-dm-delay-fix-a-race-between-delay_presuspend-and-del.patch