]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fixes for 4.19
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.19/btrfs-return-error-pointer-from-alloc_test_extent_bu.patch [new file with mode: 0644]
queue-4.19/drm-amdgpu-fix-uninitialized-variable-pasid_mapping_.patch [new file with mode: 0644]
queue-4.19/s390-ftrace-fix-endless-recursion-in-function_graph-.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/usb-xhci-fix-build-warning-seen-with-config_pm-n.patch [new file with mode: 0644]

diff --git a/queue-4.19/btrfs-return-error-pointer-from-alloc_test_extent_bu.patch b/queue-4.19/btrfs-return-error-pointer-from-alloc_test_extent_bu.patch
new file mode 100644 (file)
index 0000000..aa81f17
--- /dev/null
@@ -0,0 +1,83 @@
+From 9608b4c7988092c7d240c2728d6f909d5ef93f8f 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 | 4 ++--
+ fs/btrfs/tests/qgroup-tests.c          | 4 ++--
+ 3 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
+index 88fc5a0c573f..fed44390c049 100644
+--- a/fs/btrfs/extent_io.c
++++ b/fs/btrfs/extent_io.c
+@@ -4888,12 +4888,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 89346da890cf..de8fef91ac48 100644
+--- a/fs/btrfs/tests/free-space-tree-tests.c
++++ b/fs/btrfs/tests/free-space-tree-tests.c
+@@ -462,9 +462,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) {
++      if (IS_ERR(root->node)) {
+               test_err("couldn't allocate dummy buffer");
+-              ret = -ENOMEM;
++              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 412b910b04cc..d07dd26194b1 100644
+--- a/fs/btrfs/tests/qgroup-tests.c
++++ b/fs/btrfs/tests/qgroup-tests.c
+@@ -484,9 +484,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_err("couldn't allocate dummy buffer");
+-              ret = -ENOMEM;
++              ret = PTR_ERR(root->node);
+               goto out;
+       }
+       btrfs_set_header_level(root->node, 0);
+-- 
+2.20.1
+
diff --git a/queue-4.19/drm-amdgpu-fix-uninitialized-variable-pasid_mapping_.patch b/queue-4.19/drm-amdgpu-fix-uninitialized-variable-pasid_mapping_.patch
new file mode 100644 (file)
index 0000000..a73e163
--- /dev/null
@@ -0,0 +1,43 @@
+From 154fcb594e79df7e179414dfcfb2ca057f1590e3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Oct 2019 22:52:27 +0100
+Subject: drm/amdgpu: fix uninitialized variable pasid_mapping_needed
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit 17cf678a33c6196a3df4531fe5aec91384c9eeb5 ]
+
+The boolean variable pasid_mapping_needed is not initialized and
+there are code paths that do not assign it any value before it is
+is read later.  Fix this by initializing pasid_mapping_needed to
+false.
+
+Addresses-Coverity: ("Uninitialized scalar variable")
+Fixes: 6817bf283b2b ("drm/amdgpu: grab the id mgr lock while accessing passid_mapping")
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+index 69fb90d9c485..f67c332b16a4 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+@@ -701,7 +701,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_
+               id->oa_size != job->oa_size);
+       bool vm_flush_needed = job->vm_needs_flush;
+       struct dma_fence *fence = NULL;
+-      bool pasid_mapping_needed;
++      bool pasid_mapping_needed = false;
+       unsigned patch_offset = 0;
+       int r;
+-- 
+2.20.1
+
diff --git a/queue-4.19/s390-ftrace-fix-endless-recursion-in-function_graph-.patch b/queue-4.19/s390-ftrace-fix-endless-recursion-in-function_graph-.patch
new file mode 100644 (file)
index 0000000..157b8d8
--- /dev/null
@@ -0,0 +1,55 @@
+From d6a49036ebdfc95629bf463cf2f448a72f0ec60e 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 7a393908faec18e418db36fa4a04f972c4217592..51f10b70a0c74e7bc0081884f0583d2ce3818763 100644 (file)
@@ -180,3 +180,7 @@ 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
 can-kvaser_usb-kvaser_usb_leaf-fix-some-info-leaks-to-usb-devices.patch
+usb-xhci-fix-build-warning-seen-with-config_pm-n.patch
+drm-amdgpu-fix-uninitialized-variable-pasid_mapping_.patch
+s390-ftrace-fix-endless-recursion-in-function_graph-.patch
+btrfs-return-error-pointer-from-alloc_test_extent_bu.patch
diff --git a/queue-4.19/usb-xhci-fix-build-warning-seen-with-config_pm-n.patch b/queue-4.19/usb-xhci-fix-build-warning-seen-with-config_pm-n.patch
new file mode 100644 (file)
index 0000000..b9efb9e
--- /dev/null
@@ -0,0 +1,49 @@
+From f597ef26235bcc18df41bd8b12cd495c864d7ba1 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 74aeaa61f5c6..075c49cfe60f 100644
+--- a/drivers/usb/host/xhci-pci.c
++++ b/drivers/usb/host/xhci-pci.c
+@@ -493,7 +493,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)
+ {
+@@ -506,6 +505,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
+