From 30e0b6f79d2fc2d54dc62cac9dd5d9c218df9ba4 Mon Sep 17 00:00:00 2001 From: Denis Kirjanov Date: Nov 10 2021 13:22:30 +0000 Subject: Merge branch 'users/oneukum/SLE12-SP5/for-next' into SLE12-SP5 Pull usb and crypto fixes from Oliver Neukum --- diff --git a/patches.suse/USB-iowarrior-fix-control-message-timeouts.patch b/patches.suse/USB-iowarrior-fix-control-message-timeouts.patch new file mode 100644 index 0000000..252b3fc --- /dev/null +++ b/patches.suse/USB-iowarrior-fix-control-message-timeouts.patch @@ -0,0 +1,60 @@ +From 79a4479a17b83310deb0b1a2a274fe5be12d2318 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 25 Oct 2021 13:51:59 +0200 +Subject: [PATCH] USB: iowarrior: fix control-message timeouts +Git-commit: 79a4479a17b83310deb0b1a2a274fe5be12d2318 +References: git-fixes +Patch-mainline: v5.16-rc1 + +USB control-message timeouts are specified in milliseconds and should +specifically not vary with CONFIG_HZ. + +Use the common control-message timeout define for the five-second +timeout and drop the driver-specific one. + +Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.") +Cc: stable@vger.kernel.org # 2.6.21 +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20211025115159.4954-3-johan@kernel.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Oliver Neukum +--- + drivers/usb/misc/iowarrior.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c +index efbd317f2f25..988a8c02e7e2 100644 +--- a/drivers/usb/misc/iowarrior.c ++++ b/drivers/usb/misc/iowarrior.c +@@ -99,10 +99,6 @@ struct iowarrior { + /* globals */ + /*--------------*/ + +-/* +- * USB spec identifies 5 second timeouts. +- */ +-#define GET_TIMEOUT 5 + #define USB_REQ_GET_REPORT 0x01 + //#if 0 + static int usb_get_report(struct usb_device *dev, +@@ -114,7 +110,7 @@ static int usb_get_report(struct usb_device *dev, + USB_DIR_IN | USB_TYPE_CLASS | + USB_RECIP_INTERFACE, (type << 8) + id, + inter->desc.bInterfaceNumber, buf, size, +- GET_TIMEOUT*HZ); ++ USB_CTRL_GET_TIMEOUT); + } + //#endif + +@@ -129,7 +125,7 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type, + USB_TYPE_CLASS | USB_RECIP_INTERFACE, + (type << 8) + id, + intf->cur_altsetting->desc.bInterfaceNumber, buf, +- size, HZ); ++ size, 1000); + } + + /*---------------------*/ +-- +2.26.2 + diff --git a/patches.suse/USB-serial-keyspan-fix-memleak-on-probe-errors.patch b/patches.suse/USB-serial-keyspan-fix-memleak-on-probe-errors.patch new file mode 100644 index 0000000..3282a6a --- /dev/null +++ b/patches.suse/USB-serial-keyspan-fix-memleak-on-probe-errors.patch @@ -0,0 +1,102 @@ +From 910c996335c37552ee30fcb837375b808bb4f33b Mon Sep 17 00:00:00 2001 +From: Wang Hai +Date: Fri, 15 Oct 2021 16:55:43 +0800 +Subject: [PATCH] USB: serial: keyspan: fix memleak on probe errors +Git-commit: 910c996335c37552ee30fcb837375b808bb4f33b +References: git-fixes +Patch-mainline: v5.16-rc1 + +I got memory leak as follows when doing fault injection test: + +unreferenced object 0xffff888258228440 (size 64): + comm "kworker/7:2", pid 2005, jiffies 4294989509 (age 824.540s) + hex dump (first 32 bytes): + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [] slab_post_alloc_hook+0x9c/0x490 + [] kmem_cache_alloc_trace+0x1f7/0x470 + [] keyspan_port_probe+0xa4/0x5d0 [keyspan] + [] usb_serial_device_probe+0x97/0x1d0 [usbserial] + [] really_probe+0x167/0x460 + [] __driver_probe_device+0xf9/0x180 + [] driver_probe_device+0x53/0x130 + [] __device_attach_driver+0x105/0x130 + [] bus_for_each_drv+0x129/0x190 + [] __device_attach+0x1c9/0x270 + [] device_initial_probe+0x20/0x30 + [] bus_probe_device+0x142/0x160 + [] device_add+0x829/0x1300 + [] usb_serial_probe.cold+0xc9b/0x14ac [usbserial] + [] usb_probe_interface+0x1aa/0x3c0 [usbcore] + [] really_probe+0x167/0x460 + +If keyspan_port_probe() fails to allocate memory for an out_buffer[i] or +in_buffer[i], the previously allocated memory for out_buffer or +in_buffer needs to be freed on the error handling path, otherwise a +memory leak will result. + +Fixes: bad41a5bf177 ("USB: keyspan: fix port DMA-buffer allocations") +Reported-by: Hulk Robot +Signed-off-by: Wang Hai +Link: https://lore.kernel.org/r/20211015085543.1203011-1-wanghai38@huawei.com +Cc: stable@vger.kernel.org # 3.12 +Signed-off-by: Johan Hovold +Signed-off-by: Oliver Neukum +--- + drivers/usb/serial/keyspan.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c +index 87b89c99d517..1cfcd805f286 100644 +--- a/drivers/usb/serial/keyspan.c ++++ b/drivers/usb/serial/keyspan.c +@@ -2890,22 +2890,22 @@ static int keyspan_port_probe(struct usb_serial_port *port) + for (i = 0; i < ARRAY_SIZE(p_priv->in_buffer); ++i) { + p_priv->in_buffer[i] = kzalloc(IN_BUFLEN, GFP_KERNEL); + if (!p_priv->in_buffer[i]) +- goto err_in_buffer; ++ goto err_free_in_buffer; + } + + for (i = 0; i < ARRAY_SIZE(p_priv->out_buffer); ++i) { + p_priv->out_buffer[i] = kzalloc(OUT_BUFLEN, GFP_KERNEL); + if (!p_priv->out_buffer[i]) +- goto err_out_buffer; ++ goto err_free_out_buffer; + } + + p_priv->inack_buffer = kzalloc(INACK_BUFLEN, GFP_KERNEL); + if (!p_priv->inack_buffer) +- goto err_inack_buffer; ++ goto err_free_out_buffer; + + p_priv->outcont_buffer = kzalloc(OUTCONT_BUFLEN, GFP_KERNEL); + if (!p_priv->outcont_buffer) +- goto err_outcont_buffer; ++ goto err_free_inack_buffer; + + p_priv->device_details = d_details; + +@@ -2951,15 +2951,14 @@ static int keyspan_port_probe(struct usb_serial_port *port) + + return 0; + +-err_outcont_buffer: ++err_free_inack_buffer: + kfree(p_priv->inack_buffer); +-err_inack_buffer: ++err_free_out_buffer: + for (i = 0; i < ARRAY_SIZE(p_priv->out_buffer); ++i) + kfree(p_priv->out_buffer[i]); +-err_out_buffer: ++err_free_in_buffer: + for (i = 0; i < ARRAY_SIZE(p_priv->in_buffer); ++i) + kfree(p_priv->in_buffer[i]); +-err_in_buffer: + kfree(p_priv); + + return -ENOMEM; +-- +2.26.2 + diff --git a/patches.suse/crypto-qat-detect-PFVF-collision-after-ACK.patch b/patches.suse/crypto-qat-detect-PFVF-collision-after-ACK.patch new file mode 100644 index 0000000..bb39565 --- /dev/null +++ b/patches.suse/crypto-qat-detect-PFVF-collision-after-ACK.patch @@ -0,0 +1,45 @@ +From 9b768e8a3909ac1ab39ed44a3933716da7761a6f Mon Sep 17 00:00:00 2001 +From: Giovanni Cabiddu +Date: Tue, 28 Sep 2021 12:44:29 +0100 +Subject: [PATCH] crypto: qat - detect PFVF collision after ACK +Git-commit: 9b768e8a3909ac1ab39ed44a3933716da7761a6f +References: git-fixes +Patch-mainline: v5.16-rc1 + +Detect a PFVF collision between the local and the remote function by +checking if the message on the PFVF CSR has been overwritten. +This is done after the remote function confirms that the message has +been received, by clearing the interrupt bit, or the maximum number of +attempts (ADF_IOV_MSG_ACK_MAX_RETRY) to check the CSR has been exceeded. + +Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV") +Signed-off-by: Giovanni Cabiddu +Co-developed-by: Marco Chiappero +Signed-off-by: Marco Chiappero +Signed-off-by: Herbert Xu +Signed-off-by: Oliver Neukum +--- + drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +index 976b9ab7617c..789a4135e28c 100644 +--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c ++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +@@ -156,6 +156,13 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) + val = ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); + } while ((val & int_bit) && (count++ < ADF_IOV_MSG_ACK_MAX_RETRY)); + ++ if (val != msg) { ++ dev_dbg(&GET_DEV(accel_dev), ++ "Collision - PFVF CSR overwritten by remote function\n"); ++ ret = -EIO; ++ goto out; ++ } ++ + if (val & int_bit) { + dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); + val &= ~int_bit; +-- +2.26.2 + diff --git a/patches.suse/crypto-qat-disregard-spurious-PFVF-interrupts.patch b/patches.suse/crypto-qat-disregard-spurious-PFVF-interrupts.patch new file mode 100644 index 0000000..f059661 --- /dev/null +++ b/patches.suse/crypto-qat-disregard-spurious-PFVF-interrupts.patch @@ -0,0 +1,67 @@ +From 18fcba469ba5359c1de7e3fb16f7b9e8cd1b8e02 Mon Sep 17 00:00:00 2001 +From: Giovanni Cabiddu +Date: Tue, 28 Sep 2021 12:44:30 +0100 +Subject: [PATCH] crypto: qat - disregard spurious PFVF interrupts +Git-commit: 18fcba469ba5359c1de7e3fb16f7b9e8cd1b8e02 +References: git-fixes +Patch-mainline: v5.16-rc1 + +Upon receiving a PFVF message, check if the interrupt bit is set in the +message. If it is not, that means that the interrupt was probably +triggered by a collision. In this case, disregard the message and +re-enable the interrupts. + +Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV") +Signed-off-by: Giovanni Cabiddu +Reviewed-by: Marco Chiappero +Signed-off-by: Herbert Xu +Signed-off-by: Oliver Neukum +--- + drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 6 ++++++ + drivers/crypto/qat/qat_common/adf_vf_isr.c | 6 ++++++ + 2 files changed, 12 insertions(+) + +--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c ++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +@@ -251,6 +251,11 @@ void adf_vf2pf_req_hndl(struct adf_accel + + /* Read message from the VF */ + msg = ADF_CSR_RD(pmisc_addr, hw_data->get_pf2vf_offset(vf_nr)); ++ if (!(msg & ADF_VF2PF_INT)) { ++ dev_info(&GET_DEV(accel_dev), ++ "Spurious VF2PF interrupt, msg %X. Ignored\n", msg); ++ goto out; ++ } + + /* To ACK, clear the VF2PFINT bit */ + msg &= ~ADF_VF2PF_INT; +@@ -334,6 +339,7 @@ void adf_vf2pf_req_hndl(struct adf_accel + if (resp && adf_iov_putmsg(accel_dev, resp, vf_nr)) + dev_err(&GET_DEV(accel_dev), "Failed to send response to VF\n"); + ++out: + /* re-enable interrupt on PF from this VF */ + adf_enable_vf2pf_interrupts(accel_dev, (1 << vf_nr)); + return; +--- a/drivers/crypto/qat/qat_common/adf_vf_isr.c ++++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c +@@ -123,6 +123,11 @@ static void adf_pf2vf_bh_handler(void *d + + /* Read the message from PF */ + msg = ADF_CSR_RD(pmisc_bar_addr, hw_data->get_pf2vf_offset(0)); ++ if (!(msg & ADF_PF2VF_INT)) { ++ dev_info(&GET_DEV(accel_dev), ++ "Spurious PF2VF interrupt, msg %X. Ignored\n", msg); ++ goto out; ++ } + + if (!(msg & ADF_PF2VF_MSGORIGIN_SYSTEM)) + /* Ignore legacy non-system (non-kernel) PF2VF messages */ +@@ -171,6 +176,7 @@ static void adf_pf2vf_bh_handler(void *d + msg &= ~ADF_PF2VF_INT; + ADF_CSR_WR(pmisc_bar_addr, hw_data->get_pf2vf_offset(0), msg); + ++out: + /* Re-enable PF2VF interrupts */ + adf_enable_pf2vf_interrupts(accel_dev); + return; diff --git a/patches.suse/crypto-s5p-sss-Add-error-handling-in-s5p_aes_probe.patch b/patches.suse/crypto-s5p-sss-Add-error-handling-in-s5p_aes_probe.patch new file mode 100644 index 0000000..2def64f --- /dev/null +++ b/patches.suse/crypto-s5p-sss-Add-error-handling-in-s5p_aes_probe.patch @@ -0,0 +1,33 @@ +From a472cc0dde3eb057db71c80f102556eeced03805 Mon Sep 17 00:00:00 2001 +From: Tang Bin +Date: Thu, 21 Oct 2021 09:34:22 +0800 +Subject: [PATCH] crypto: s5p-sss - Add error handling in s5p_aes_probe() +Git-commit: a472cc0dde3eb057db71c80f102556eeced03805 +References: git-fixes +Patch-mainline: v5.16-rc1 + +The function s5p_aes_probe() does not perform sufficient error +checking after executing platform_get_resource(), thus fix it. + +Fixes: c2afad6c6105 ("crypto: s5p-sss - Add HASH support for Exynos") +Cc: +Signed-off-by: Tang Bin +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Herbert Xu +Signed-off-by: Oliver Neukum +--- + drivers/crypto/s5p-sss.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/crypto/s5p-sss.c ++++ b/drivers/crypto/s5p-sss.c +@@ -844,6 +844,9 @@ static int s5p_aes_probe(struct platform + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) ++ return -EINVAL; ++ + pdata->ioaddr = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(pdata->ioaddr)) + return PTR_ERR(pdata->ioaddr); diff --git a/series.conf b/series.conf index d881f96..50430bd 100644 --- a/series.conf +++ b/series.conf @@ -60249,7 +60249,12 @@ patches.suse/sctp-add-vtag-check-in-sctp_sf_violation.patch patches.suse/sctp-add-vtag-check-in-sctp_sf_do_8_5_1_E_sa.patch patches.suse/sctp-add-vtag-check-in-sctp_sf_ootb.patch + patches.suse/crypto-qat-detect-PFVF-collision-after-ACK.patch + patches.suse/crypto-qat-disregard-spurious-PFVF-interrupts.patch + patches.suse/crypto-s5p-sss-Add-error-handling-in-s5p_aes_probe.patch patches.suse/ibmvnic-delay-complete.patch + patches.suse/USB-iowarrior-fix-control-message-timeouts.patch + patches.suse/USB-serial-keyspan-fix-memleak-on-probe-errors.patch patches.suse/scsi-qla2xxx-Add-support-for-mailbox-passthru.patch patches.suse/scsi-qla2xxx-Display-16G-only-as-supported-speeds-fo.patch patches.suse/scsi-qla2xxx-Check-for-firmware-capability-before-cr.patch