]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Mon, 23 Dec 2019 22:28:57 +0000 (17:28 -0500)
committerSasha Levin <sashal@kernel.org>
Mon, 23 Dec 2019 22:28:57 +0000 (17:28 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.14/btrfs-abort-transaction-after-failed-inode-updates-i.patch [new file with mode: 0644]
queue-4.14/btrfs-return-error-pointer-from-alloc_test_extent_bu.patch [new file with mode: 0644]
queue-4.14/s390-ftrace-fix-endless-recursion-in-function_graph-.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/usb-xhci-fix-build-warning-seen-with-config_pm-n.patch [new file with mode: 0644]

diff --git a/queue-4.14/btrfs-abort-transaction-after-failed-inode-updates-i.patch b/queue-4.14/btrfs-abort-transaction-after-failed-inode-updates-i.patch
new file mode 100644 (file)
index 0000000..6c4c67a
--- /dev/null
@@ -0,0 +1,51 @@
+From c3aec84974b49ff6dc954610d47e0c0dc89f0277 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 Dec 2019 09:37:15 -0500
+Subject: btrfs: abort transaction after failed inode updates in create_subvol
+
+From: Josef Bacik <josef@toxicpanda.com>
+
+[ Upstream commit c7e54b5102bf3614cadb9ca32d7be73bad6cecf0 ]
+
+We can just abort the transaction here, and in fact do that for every
+other failure in this function except these two cases.
+
+CC: stable@vger.kernel.org # 4.4+
+Reviewed-by: Filipe Manana <fdmanana@suse.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Josef Bacik <josef@toxicpanda.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/ioctl.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
+index dd3b4820ac30..e82b4f3f490c 100644
+--- a/fs/btrfs/ioctl.c
++++ b/fs/btrfs/ioctl.c
+@@ -580,12 +580,18 @@ static noinline int create_subvol(struct inode *dir,
+       btrfs_i_size_write(BTRFS_I(dir), dir->i_size + namelen * 2);
+       ret = btrfs_update_inode(trans, root, dir);
+-      BUG_ON(ret);
++      if (ret) {
++              btrfs_abort_transaction(trans, ret);
++              goto fail;
++      }
+       ret = btrfs_add_root_ref(trans, fs_info,
+                                objectid, root->root_key.objectid,
+                                btrfs_ino(BTRFS_I(dir)), index, name, namelen);
+-      BUG_ON(ret);
++      if (ret) {
++              btrfs_abort_transaction(trans, ret);
++              goto fail;
++      }
+       ret = btrfs_uuid_tree_add(trans, fs_info, root_item->uuid,
+                                 BTRFS_UUID_KEY_SUBVOL, objectid);
+-- 
+2.20.1
+
diff --git a/queue-4.14/btrfs-return-error-pointer-from-alloc_test_extent_bu.patch b/queue-4.14/btrfs-return-error-pointer-from-alloc_test_extent_bu.patch
new file mode 100644 (file)
index 0000000..95cf703
--- /dev/null
@@ -0,0 +1,84 @@
+From 92cbb410da2c486dd2ee869f18dc868c5a791a10 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Dec 2019 14:24:58 +0300
+Subject: btrfs: return error pointer from alloc_test_extent_buffer
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit b6293c821ea8fa2a631a2112cd86cd435effeb8b ]
+
+Callers of alloc_test_extent_buffer have not correctly interpreted the
+return value as error pointer, as alloc_test_extent_buffer should behave
+as alloc_extent_buffer. The self-tests were unaffected but
+btrfs_find_create_tree_block could call both functions and that would
+cause problems up in the call chain.
+
+Fixes: faa2dbf004e8 ("Btrfs: add sanity tests for new qgroup accounting code")
+CC: stable@vger.kernel.org # 4.4+
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.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/extent_io.c                   | 6 ++++--
+ fs/btrfs/tests/free-space-tree-tests.c | 6 +++---
+ fs/btrfs/tests/qgroup-tests.c          | 4 ++--
+ 3 files changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
+index 4cc534584665..fced434bbddc 100644
+--- a/fs/btrfs/extent_io.c
++++ b/fs/btrfs/extent_io.c
+@@ -4949,12 +4949,14 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
+               return eb;
+       eb = alloc_dummy_extent_buffer(fs_info, start);
+       if (!eb)
+-              return NULL;
++              return ERR_PTR(-ENOMEM);
+       eb->fs_info = fs_info;
+ again:
+       ret = radix_tree_preload(GFP_NOFS);
+-      if (ret)
++      if (ret) {
++              exists = ERR_PTR(ret);
+               goto free_eb;
++      }
+       spin_lock(&fs_info->buffer_lock);
+       ret = radix_tree_insert(&fs_info->buffer_radix,
+                               start >> PAGE_SHIFT, eb);
+diff --git a/fs/btrfs/tests/free-space-tree-tests.c b/fs/btrfs/tests/free-space-tree-tests.c
+index 8444a018cca2..f6c783e959b7 100644
+--- a/fs/btrfs/tests/free-space-tree-tests.c
++++ b/fs/btrfs/tests/free-space-tree-tests.c
+@@ -475,9 +475,9 @@ static int run_test(test_func_t test_func, int bitmaps, u32 sectorsize,
+       root->fs_info->tree_root = root;
+       root->node = alloc_test_extent_buffer(root->fs_info, nodesize);
+-      if (!root->node) {
+-              test_msg("Couldn't allocate dummy buffer\n");
+-              ret = -ENOMEM;
++      if (IS_ERR(root->node)) {
++              test_msg("couldn't allocate dummy buffer\n");
++              ret = PTR_ERR(root->node);
+               goto out;
+       }
+       btrfs_set_header_level(root->node, 0);
+diff --git a/fs/btrfs/tests/qgroup-tests.c b/fs/btrfs/tests/qgroup-tests.c
+index 578fd045e859..eb72cf280546 100644
+--- a/fs/btrfs/tests/qgroup-tests.c
++++ b/fs/btrfs/tests/qgroup-tests.c
+@@ -487,9 +487,9 @@ int btrfs_test_qgroups(u32 sectorsize, u32 nodesize)
+        * *cough*backref walking code*cough*
+        */
+       root->node = alloc_test_extent_buffer(root->fs_info, nodesize);
+-      if (!root->node) {
++      if (IS_ERR(root->node)) {
+               test_msg("Couldn't allocate dummy buffer\n");
+-              ret = -ENOMEM;
++              ret = PTR_ERR(root->node);
+               goto out;
+       }
+       btrfs_set_header_level(root->node, 0);
+-- 
+2.20.1
+
diff --git a/queue-4.14/s390-ftrace-fix-endless-recursion-in-function_graph-.patch b/queue-4.14/s390-ftrace-fix-endless-recursion-in-function_graph-.patch
new file mode 100644 (file)
index 0000000..1477d1a
--- /dev/null
@@ -0,0 +1,55 @@
+From 4dae230f93ca49cee4aed0d4415c277b787da3bd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Dec 2019 09:03:12 +0100
+Subject: s390/ftrace: fix endless recursion in function_graph tracer
+
+From: Sven Schnelle <svens@linux.ibm.com>
+
+[ Upstream commit 6feeee8efc53035c3195b02068b58ae947538aa4 ]
+
+The following sequence triggers a kernel stack overflow on s390x:
+
+mount -t tracefs tracefs /sys/kernel/tracing
+cd /sys/kernel/tracing
+echo function_graph > current_tracer
+[crash]
+
+This is because preempt_count_{add,sub} are in the list of traced
+functions, which can be demonstrated by:
+
+echo preempt_count_add >set_ftrace_filter
+echo function_graph > current_tracer
+[crash]
+
+The stack overflow happens because get_tod_clock_monotonic() gets called
+by ftrace but itself calls preempt_{disable,enable}(), which leads to a
+endless recursion. Fix this by using preempt_{disable,enable}_notrace().
+
+Fixes: 011620688a71 ("s390/time: ensure get_clock_monotonic() returns monotonic values")
+Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
+Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/include/asm/timex.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
+index 0f12a3f91282..2dc9eb4e1acc 100644
+--- a/arch/s390/include/asm/timex.h
++++ b/arch/s390/include/asm/timex.h
+@@ -195,9 +195,9 @@ static inline unsigned long long get_tod_clock_monotonic(void)
+ {
+       unsigned long long tod;
+-      preempt_disable();
++      preempt_disable_notrace();
+       tod = get_tod_clock() - *(unsigned long long *) &tod_clock_base[1];
+-      preempt_enable();
++      preempt_enable_notrace();
+       return tod;
+ }
+-- 
+2.20.1
+
index 84609e3236cf0130a0537a5990da90062a7e5ccd..8bb80b5ea029028045960fac51fb7c25b7a2286a 100644 (file)
@@ -130,3 +130,7 @@ btrfs-don-t-prematurely-free-work-in-reada_start_mac.patch
 btrfs-don-t-prematurely-free-work-in-scrub_missing_r.patch
 revert-mmc-sdhci-fix-incorrect-switch-to-hs-mode.patch
 mmc-mediatek-fix-cmd_ta-to-2-for-mt8173-hs200-hs400-mode.patch
+usb-xhci-fix-build-warning-seen-with-config_pm-n.patch
+s390-ftrace-fix-endless-recursion-in-function_graph-.patch
+btrfs-return-error-pointer-from-alloc_test_extent_bu.patch
+btrfs-abort-transaction-after-failed-inode-updates-i.patch
diff --git a/queue-4.14/usb-xhci-fix-build-warning-seen-with-config_pm-n.patch b/queue-4.14/usb-xhci-fix-build-warning-seen-with-config_pm-n.patch
new file mode 100644 (file)
index 0000000..66c2056
--- /dev/null
@@ -0,0 +1,49 @@
+From 0e9ea91683a222c7e9bfd25d9b4fb0ded25c55ca Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 17 Dec 2019 17:19:11 -0800
+Subject: usb: xhci: Fix build warning seen with CONFIG_PM=n
+
+From: Guenter Roeck <linux@roeck-us.net>
+
+[ Upstream commit 6056a0f8ede27b296d10ef46f7f677cc9d715371 ]
+
+The following build warning is seen if CONFIG_PM is disabled.
+
+drivers/usb/host/xhci-pci.c:498:13: warning:
+       unused function 'xhci_pci_shutdown'
+
+Fixes: f2c710f7dca8 ("usb: xhci: only set D3hot for pci device")
+Cc: Henry Lin <henryl@nvidia.com>
+Cc: stable@vger.kernel.org     # all stable releases with f2c710f7dca8
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Link: https://lore.kernel.org/r/20191218011911.6907-1-linux@roeck-us.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/host/xhci-pci.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
+index 021a2d320acc..09f228279c01 100644
+--- a/drivers/usb/host/xhci-pci.c
++++ b/drivers/usb/host/xhci-pci.c
+@@ -497,7 +497,6 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
+       retval = xhci_resume(xhci, hibernated);
+       return retval;
+ }
+-#endif /* CONFIG_PM */
+ static void xhci_pci_shutdown(struct usb_hcd *hcd)
+ {
+@@ -510,6 +509,7 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)
+       if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
+               pci_set_power_state(pdev, PCI_D3hot);
+ }
++#endif /* CONFIG_PM */
+ /*-------------------------------------------------------------------------*/
+-- 
+2.20.1
+