]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.15
authorSasha Levin <sashal@kernel.org>
Fri, 14 Jul 2023 20:53:32 +0000 (16:53 -0400)
committerSasha Levin <sashal@kernel.org>
Fri, 14 Jul 2023 20:53:32 +0000 (16:53 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch [new file with mode: 0644]
queue-5.15/extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch b/queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch
new file mode 100644 (file)
index 0000000..b5c166c
--- /dev/null
@@ -0,0 +1,72 @@
+From 0d68eefaee4ab5908c73b86de4a9ec369ea322d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Jun 2023 11:27:41 +0100
+Subject: btrfs: do not BUG_ON() on tree mod log failure at balance_level()
+
+From: Filipe Manana <fdmanana@suse.com>
+
+[ Upstream commit 39020d8abc7ec62c4de9b260e3d10d4a1c2478ce ]
+
+At balance_level(), instead of doing a BUG_ON() in case we fail to record
+tree mod log operations, do a transaction abort and return the error to
+the callers. There's really no need for the BUG_ON() as we can release
+all resources in this context, and we have to abort because other future
+tree searches that use the tree mod log (btrfs_search_old_slot()) may get
+inconsistent results if other operations modify the tree after that
+failure and before the tree mod log based search.
+
+CC: stable@vger.kernel.org # 5.4+
+Reviewed-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/ctree.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
+index 1a19354382b2b..8b57d691cfae8 100644
+--- a/fs/btrfs/ctree.c
++++ b/fs/btrfs/ctree.c
+@@ -912,7 +912,12 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
+               }
+               ret = btrfs_tree_mod_log_insert_root(root->node, child, true);
+-              BUG_ON(ret < 0);
++              if (ret < 0) {
++                      btrfs_tree_unlock(child);
++                      free_extent_buffer(child);
++                      btrfs_abort_transaction(trans, ret);
++                      goto enospc;
++              }
+               rcu_assign_pointer(root->node, child);
+               add_root_to_dirty_list(root);
+@@ -994,7 +999,10 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
+                       btrfs_node_key(right, &right_key, 0);
+                       ret = btrfs_tree_mod_log_insert_key(parent, pslot + 1,
+                                       BTRFS_MOD_LOG_KEY_REPLACE, GFP_NOFS);
+-                      BUG_ON(ret < 0);
++                      if (ret < 0) {
++                              btrfs_abort_transaction(trans, ret);
++                              goto enospc;
++                      }
+                       btrfs_set_node_key(parent, &right_key, pslot + 1);
+                       btrfs_mark_buffer_dirty(parent);
+               }
+@@ -1040,7 +1048,10 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
+               btrfs_node_key(mid, &mid_key, 0);
+               ret = btrfs_tree_mod_log_insert_key(parent, pslot,
+                               BTRFS_MOD_LOG_KEY_REPLACE, GFP_NOFS);
+-              BUG_ON(ret < 0);
++              if (ret < 0) {
++                      btrfs_abort_transaction(trans, ret);
++                      goto enospc;
++              }
+               btrfs_set_node_key(parent, &mid_key, pslot);
+               btrfs_mark_buffer_dirty(parent);
+       }
+-- 
+2.39.2
+
diff --git a/queue-5.15/extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch b/queue-5.15/extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch
new file mode 100644 (file)
index 0000000..0f9d823
--- /dev/null
@@ -0,0 +1,49 @@
+From 8c7bf4c669c4466fd6a8e777eecdbdd795cfdf66 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Nov 2022 23:35:44 +0100
+Subject: extcon: usbc-tusb320: Convert to i2c's .probe_new()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+
+[ Upstream commit 5313121b22fd11db0d14f305c110168b8176efdc ]
+
+The probe function doesn't make use of the i2c_device_id * parameter so it
+can be trivially converted.
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
+Stable-dep-of: 3adbaa30d973 ("extcon: usbc-tusb320: Unregister typec port on driver removal")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/extcon/extcon-usbc-tusb320.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
+index 9dfa545427ca1..b408ce989c223 100644
+--- a/drivers/extcon/extcon-usbc-tusb320.c
++++ b/drivers/extcon/extcon-usbc-tusb320.c
+@@ -428,8 +428,7 @@ static int tusb320_typec_probe(struct i2c_client *client,
+       return 0;
+ }
+-static int tusb320_probe(struct i2c_client *client,
+-                       const struct i2c_device_id *id)
++static int tusb320_probe(struct i2c_client *client)
+ {
+       struct tusb320_priv *priv;
+       const void *match_data;
+@@ -502,7 +501,7 @@ static const struct of_device_id tusb320_extcon_dt_match[] = {
+ MODULE_DEVICE_TABLE(of, tusb320_extcon_dt_match);
+ static struct i2c_driver tusb320_extcon_driver = {
+-      .probe          = tusb320_probe,
++      .probe_new      = tusb320_probe,
+       .driver         = {
+               .name   = "extcon-tusb320",
+               .of_match_table = tusb320_extcon_dt_match,
+-- 
+2.39.2
+
index b208184f0c59d6efc1f4c207829c7b034ea68469..357e4a3a3b4cfcece654c708ef7f8afa28ed05d7 100644 (file)
@@ -346,3 +346,5 @@ sh-dma-fix-dma-channel-offset-calculation.patch
 apparmor-fix-missing-error-check-for-rhashtable_inse.patch
 i2c-xiic-defer-xiic_wakeup-and-__xiic_start_xfer-in-.patch
 i2c-xiic-don-t-try-to-handle-more-interrupt-events-a.patch
+extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch
+btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch