From: Greg Kroah-Hartman Date: Fri, 28 Oct 2016 15:58:02 +0000 (-0400) Subject: 4.8-stable patches X-Git-Tag: v4.4.29~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11d2796a24157dedcf6a905f449cca3ed63643bd;p=thirdparty%2Fkernel%2Fstable-queue.git 4.8-stable patches added patches: rt2x00usb-fix-error-return-code.patch scsi-cxlflash-remove-the-device-cleanly-in-the-system-shutdown-path.patch --- diff --git a/queue-4.8/rt2x00usb-fix-error-return-code.patch b/queue-4.8/rt2x00usb-fix-error-return-code.patch new file mode 100644 index 00000000000..620b2a7ad34 --- /dev/null +++ b/queue-4.8/rt2x00usb-fix-error-return-code.patch @@ -0,0 +1,37 @@ +From 410280bac6224e066f4cf0b87db08f0418a135b6 Mon Sep 17 00:00:00 2001 +From: Christophe Jaillet +Date: Thu, 11 Aug 2016 16:38:54 +0200 +Subject: rt2x00usb: Fix error return code + +From: Christophe Jaillet + +commit 410280bac6224e066f4cf0b87db08f0418a135b6 upstream. + +We know that 'retval = 0' because it has been tested a few lines above. +So, if 'devm_kmalloc' fails, 0 will be returned instead of an error code. +Return -ENOMEM instead. + +Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB") +Signed-off-by: Christophe JAILLET +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +@@ -831,8 +831,10 @@ int rt2x00usb_probe(struct usb_interface + rt2x00dev->anchor = devm_kmalloc(&usb_dev->dev, + sizeof(struct usb_anchor), + GFP_KERNEL); +- if (!rt2x00dev->anchor) ++ if (!rt2x00dev->anchor) { ++ retval = -ENOMEM; + goto exit_free_reg; ++ } + + init_usb_anchor(rt2x00dev->anchor); + return 0; diff --git a/queue-4.8/scsi-cxlflash-remove-the-device-cleanly-in-the-system-shutdown-path.patch b/queue-4.8/scsi-cxlflash-remove-the-device-cleanly-in-the-system-shutdown-path.patch new file mode 100644 index 00000000000..a29bf7cc1b2 --- /dev/null +++ b/queue-4.8/scsi-cxlflash-remove-the-device-cleanly-in-the-system-shutdown-path.patch @@ -0,0 +1,80 @@ +From babf985d1e1b0677cb264acd01319d2b9c8f4327 Mon Sep 17 00:00:00 2001 +From: Uma Krishnan +Date: Fri, 2 Sep 2016 15:39:16 -0500 +Subject: scsi: cxlflash: Remove the device cleanly in the system shutdown path + +From: Uma Krishnan + +commit babf985d1e1b0677cb264acd01319d2b9c8f4327 upstream. + +Commit 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash +cards") was recently introduced to notify the AFU when a system is going +down. Due to the position of the cxlflash driver in the device stack, +cxlflash devices are _always_ removed during a reboot/shutdown. This can +lead to a crash if the cxlflash shutdown hook is invoked _after_ the +shutdown hook for the owning virtual PHB. Furthermore, the current +implementation of shutdown/remove hooks for cxlflash are not tolerant to +being invoked when the device is not enabled. This can also lead to a +crash in situations where the remove hook is invoked after the device +has been removed via the vPHBs shutdown hook. An example of this +scenario would be an EEH reset failure while a reboot/shutdown is in +progress. + +To solve both problems, the shutdown hook for cxlflash is updated to +simply remove the device. This path already includes the AFU +notification and thus this solution will continue to perform the +original intent. At the same time, the remove hook is updated to protect +against being called when the device is not enabled. + +Fixes: 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash +cards") +Signed-off-by: Uma Krishnan +Acked-by: Matthew R. Ochs +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/cxlflash/main.c | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +--- a/drivers/scsi/cxlflash/main.c ++++ b/drivers/scsi/cxlflash/main.c +@@ -823,17 +823,6 @@ static void notify_shutdown(struct cxlfl + } + + /** +- * cxlflash_shutdown() - shutdown handler +- * @pdev: PCI device associated with the host. +- */ +-static void cxlflash_shutdown(struct pci_dev *pdev) +-{ +- struct cxlflash_cfg *cfg = pci_get_drvdata(pdev); +- +- notify_shutdown(cfg, false); +-} +- +-/** + * cxlflash_remove() - PCI entry point to tear down host + * @pdev: PCI device associated with the host. + * +@@ -844,6 +833,11 @@ static void cxlflash_remove(struct pci_d + struct cxlflash_cfg *cfg = pci_get_drvdata(pdev); + ulong lock_flags; + ++ if (!pci_is_enabled(pdev)) { ++ pr_debug("%s: Device is disabled\n", __func__); ++ return; ++ } ++ + /* If a Task Management Function is active, wait for it to complete + * before continuing with remove. + */ +@@ -2685,7 +2679,7 @@ static struct pci_driver cxlflash_driver + .id_table = cxlflash_pci_table, + .probe = cxlflash_probe, + .remove = cxlflash_remove, +- .shutdown = cxlflash_shutdown, ++ .shutdown = cxlflash_remove, + .err_handler = &cxlflash_err_handler, + }; + diff --git a/queue-4.8/series b/queue-4.8/series index 5cef7878f54..ba058361906 100644 --- a/queue-4.8/series +++ b/queue-4.8/series @@ -37,3 +37,5 @@ drm-i915-allow-dp-to-work-w-o-edid.patch drm-i915-just-clear-the-mmiodebug-before-a-register-access.patch drm-i915-unalias-obj-phys_handle-and-obj-userptr.patch posix_acl-clear-sgid-bit-when-setting-file-permissions.patch +rt2x00usb-fix-error-return-code.patch +scsi-cxlflash-remove-the-device-cleanly-in-the-system-shutdown-path.patch