From: Sasha Levin Date: Mon, 13 Jul 2020 03:22:00 +0000 (-0400) Subject: Fixes for 4.4 X-Git-Tag: v5.7.9~37^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62665cfcb661a65518d1c1dcbebbb67d762ae6b8;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.4 Signed-off-by: Sasha Levin --- diff --git a/queue-4.4/alsa-compress-fix-partial_drain-completion-state.patch b/queue-4.4/alsa-compress-fix-partial_drain-completion-state.patch new file mode 100644 index 00000000000..ef81add6e3f --- /dev/null +++ b/queue-4.4/alsa-compress-fix-partial_drain-completion-state.patch @@ -0,0 +1,90 @@ +From 4207a8e99f400a4524ea914a39d89fc23bf03994 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Jun 2020 19:17:37 +0530 +Subject: ALSA: compress: fix partial_drain completion state + +From: Vinod Koul + +[ Upstream commit f79a732a8325dfbd570d87f1435019d7e5501c6d ] + +On partial_drain completion we should be in SNDRV_PCM_STATE_RUNNING +state, so set that for partially draining streams in +snd_compr_drain_notify() and use a flag for partially draining streams + +While at it, add locks for stream state change in +snd_compr_drain_notify() as well. + +Fixes: f44f2a5417b2 ("ALSA: compress: fix drain calls blocking other compress functions (v6)") +Reviewed-by: Srinivas Kandagatla +Tested-by: Srinivas Kandagatla +Reviewed-by: Charles Keepax +Tested-by: Charles Keepax +Signed-off-by: Vinod Koul +Link: https://lore.kernel.org/r/20200629134737.105993-4-vkoul@kernel.org +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + include/sound/compress_driver.h | 10 +++++++++- + sound/core/compress_offload.c | 4 ++++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h +index a5c6e6da3d3d4..57872c8f11512 100644 +--- a/include/sound/compress_driver.h ++++ b/include/sound/compress_driver.h +@@ -71,6 +71,7 @@ struct snd_compr_runtime { + * @direction: stream direction, playback/recording + * @metadata_set: metadata set flag, true when set + * @next_track: has userspace signal next track transition, true when set ++ * @partial_drain: undergoing partial_drain for stream, true when set + * @private_data: pointer to DSP private data + */ + struct snd_compr_stream { +@@ -81,6 +82,7 @@ struct snd_compr_stream { + enum snd_compr_direction direction; + bool metadata_set; + bool next_track; ++ bool partial_drain; + void *private_data; + }; + +@@ -178,7 +180,13 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) + if (snd_BUG_ON(!stream)) + return; + +- stream->runtime->state = SNDRV_PCM_STATE_SETUP; ++ /* for partial_drain case we are back to running state on success */ ++ if (stream->partial_drain) { ++ stream->runtime->state = SNDRV_PCM_STATE_RUNNING; ++ stream->partial_drain = false; /* clear this flag as well */ ++ } else { ++ stream->runtime->state = SNDRV_PCM_STATE_SETUP; ++ } + + wake_up(&stream->runtime->sleep); + } +diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c +index 07f5017cbea2a..e788c7e1929bd 100644 +--- a/sound/core/compress_offload.c ++++ b/sound/core/compress_offload.c +@@ -699,6 +699,9 @@ static int snd_compr_stop(struct snd_compr_stream *stream) + + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); + if (!retval) { ++ /* clear flags and stop any drain wait */ ++ stream->partial_drain = false; ++ stream->metadata_set = false; + snd_compr_drain_notify(stream); + stream->runtime->total_bytes_available = 0; + stream->runtime->total_bytes_transferred = 0; +@@ -809,6 +812,7 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) + if (stream->next_track == false) + return -EPERM; + ++ stream->partial_drain = true; + retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN); + if (retval) { + pr_debug("Partial drain returned failure\n"); +-- +2.25.1 + diff --git a/queue-4.4/arm64-kgdb-fix-single-step-exception-handling-oops.patch b/queue-4.4/arm64-kgdb-fix-single-step-exception-handling-oops.patch new file mode 100644 index 00000000000..d59568014c2 --- /dev/null +++ b/queue-4.4/arm64-kgdb-fix-single-step-exception-handling-oops.patch @@ -0,0 +1,115 @@ +From 6e9f71783d83a7d374290f663ef36349ada7f729 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 10 May 2020 05:41:56 +0800 +Subject: arm64: kgdb: Fix single-step exception handling oops + +From: Wei Li + +[ Upstream commit 8523c006264df65aac7d77284cc69aac46a6f842 ] + +After entering kdb due to breakpoint, when we execute 'ss' or 'go' (will +delay installing breakpoints, do single-step first), it won't work +correctly, and it will enter kdb due to oops. + +It's because the reason gotten in kdb_stub() is not as expected, and it +seems that the ex_vector for single-step should be 0, like what arch +powerpc/sh/parisc has implemented. + +Before the patch: +Entering kdb (current=0xffff8000119e2dc0, pid 0) on processor 0 due to Keyboard Entry +[0]kdb> bp printk +Instruction(i) BP #0 at 0xffff8000101486cc (printk) + is enabled addr at ffff8000101486cc, hardtype=0 installed=0 + +[0]kdb> g + +/ # echo h > /proc/sysrq-trigger + +Entering kdb (current=0xffff0000fa878040, pid 266) on processor 3 due to Breakpoint @ 0xffff8000101486cc +[3]kdb> ss + +Entering kdb (current=0xffff0000fa878040, pid 266) on processor 3 Oops: (null) +due to oops @ 0xffff800010082ab8 +CPU: 3 PID: 266 Comm: sh Not tainted 5.7.0-rc4-13839-gf0e5ad491718 #6 +Hardware name: linux,dummy-virt (DT) +pstate: 00000085 (nzcv daIf -PAN -UAO) +pc : el1_irq+0x78/0x180 +lr : __handle_sysrq+0x80/0x190 +sp : ffff800015003bf0 +x29: ffff800015003d20 x28: ffff0000fa878040 +x27: 0000000000000000 x26: ffff80001126b1f0 +x25: ffff800011b6a0d8 x24: 0000000000000000 +x23: 0000000080200005 x22: ffff8000101486cc +x21: ffff800015003d30 x20: 0000ffffffffffff +x19: ffff8000119f2000 x18: 0000000000000000 +x17: 0000000000000000 x16: 0000000000000000 +x15: 0000000000000000 x14: 0000000000000000 +x13: 0000000000000000 x12: 0000000000000000 +x11: 0000000000000000 x10: 0000000000000000 +x9 : 0000000000000000 x8 : ffff800015003e50 +x7 : 0000000000000002 x6 : 00000000380b9990 +x5 : ffff8000106e99e8 x4 : ffff0000fadd83c0 +x3 : 0000ffffffffffff x2 : ffff800011b6a0d8 +x1 : ffff800011b6a000 x0 : ffff80001130c9d8 +Call trace: + el1_irq+0x78/0x180 + printk+0x0/0x84 + write_sysrq_trigger+0xb0/0x118 + proc_reg_write+0xb4/0xe0 + __vfs_write+0x18/0x40 + vfs_write+0xb0/0x1b8 + ksys_write+0x64/0xf0 + __arm64_sys_write+0x14/0x20 + el0_svc_common.constprop.2+0xb0/0x168 + do_el0_svc+0x20/0x98 + el0_sync_handler+0xec/0x1a8 + el0_sync+0x140/0x180 + +[3]kdb> + +After the patch: +Entering kdb (current=0xffff8000119e2dc0, pid 0) on processor 0 due to Keyboard Entry +[0]kdb> bp printk +Instruction(i) BP #0 at 0xffff8000101486cc (printk) + is enabled addr at ffff8000101486cc, hardtype=0 installed=0 + +[0]kdb> g + +/ # echo h > /proc/sysrq-trigger + +Entering kdb (current=0xffff0000fa852bc0, pid 268) on processor 0 due to Breakpoint @ 0xffff8000101486cc +[0]kdb> g + +Entering kdb (current=0xffff0000fa852bc0, pid 268) on processor 0 due to Breakpoint @ 0xffff8000101486cc +[0]kdb> ss + +Entering kdb (current=0xffff0000fa852bc0, pid 268) on processor 0 due to SS trap @ 0xffff800010082ab8 +[0]kdb> + +Fixes: 44679a4f142b ("arm64: KGDB: Add step debugging support") +Signed-off-by: Wei Li +Tested-by: Douglas Anderson +Reviewed-by: Douglas Anderson +Link: https://lore.kernel.org/r/20200509214159.19680-2-liwei391@huawei.com +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + arch/arm64/kernel/kgdb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c +index f72743dc070d9..606c21760f23e 100644 +--- a/arch/arm64/kernel/kgdb.c ++++ b/arch/arm64/kernel/kgdb.c +@@ -238,7 +238,7 @@ static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned int esr) + if (user_mode(regs)) + return DBG_HOOK_ERROR; + +- kgdb_handle_exception(1, SIGTRAP, 0, regs); ++ kgdb_handle_exception(0, SIGTRAP, 0, regs); + return DBG_HOOK_HANDLED; + } + +-- +2.25.1 + diff --git a/queue-4.4/net-cxgb4-fix-return-error-value-in-t4_prep_fw.patch b/queue-4.4/net-cxgb4-fix-return-error-value-in-t4_prep_fw.patch new file mode 100644 index 00000000000..887b6e48fb3 --- /dev/null +++ b/queue-4.4/net-cxgb4-fix-return-error-value-in-t4_prep_fw.patch @@ -0,0 +1,58 @@ +From ca77eeb450593a0dd933a2ab93c0cc4359441cbc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Jun 2020 18:49:51 +0800 +Subject: net: cxgb4: fix return error value in t4_prep_fw + +From: Li Heng + +[ Upstream commit 8a259e6b73ad8181b0b2ef338b35043433db1075 ] + +t4_prep_fw goto bye tag with positive return value when something +bad happened and which can not free resource in adap_init0. +so fix it to return negative value. + +Fixes: 16e47624e76b ("cxgb4: Add new scheme to update T4/T5 firmware") +Reported-by: Hulk Robot +Signed-off-by: Li Heng +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +index fd6492fd3dc07..9d07fa318ac3d 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +@@ -3093,7 +3093,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, + drv_fw = &fw_info->fw_hdr; + + /* Read the header of the firmware on the card */ +- ret = -t4_read_flash(adap, FLASH_FW_START, ++ ret = t4_read_flash(adap, FLASH_FW_START, + sizeof(*card_fw) / sizeof(uint32_t), + (uint32_t *)card_fw, 1); + if (ret == 0) { +@@ -3122,8 +3122,8 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, + should_install_fs_fw(adap, card_fw_usable, + be32_to_cpu(fs_fw->fw_ver), + be32_to_cpu(card_fw->fw_ver))) { +- ret = -t4_fw_upgrade(adap, adap->mbox, fw_data, +- fw_size, 0); ++ ret = t4_fw_upgrade(adap, adap->mbox, fw_data, ++ fw_size, 0); + if (ret != 0) { + dev_err(adap->pdev_dev, + "failed to install firmware: %d\n", ret); +@@ -3154,7 +3154,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, + FW_HDR_FW_VER_MICRO_G(c), FW_HDR_FW_VER_BUILD_G(c), + FW_HDR_FW_VER_MAJOR_G(k), FW_HDR_FW_VER_MINOR_G(k), + FW_HDR_FW_VER_MICRO_G(k), FW_HDR_FW_VER_BUILD_G(k)); +- ret = EINVAL; ++ ret = -EINVAL; + goto bye; + } + +-- +2.25.1 + diff --git a/queue-4.4/series b/queue-4.4/series index 72d6e38f8d2..212f2173841 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -2,3 +2,8 @@ kvm-s390-reduce-number-of-io-pins-to-1.patch spi-spidev-fix-a-race-between-spidev_release-and-spi.patch spi-spidev-fix-a-potential-use-after-free-in-spidev_.patch scsi-mptscsih-fix-read-sense-data-size.patch +net-cxgb4-fix-return-error-value-in-t4_prep_fw.patch +smsc95xx-check-return-value-of-smsc95xx_reset.patch +smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch +alsa-compress-fix-partial_drain-completion-state.patch +arm64-kgdb-fix-single-step-exception-handling-oops.patch diff --git a/queue-4.4/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch b/queue-4.4/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch new file mode 100644 index 00000000000..638d1a7581b --- /dev/null +++ b/queue-4.4/smsc95xx-avoid-memory-leak-in-smsc95xx_bind.patch @@ -0,0 +1,39 @@ +From 457725ff9b441fd7a74a34ae48f8f136204bf2c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jul 2020 10:39:35 +0200 +Subject: smsc95xx: avoid memory leak in smsc95xx_bind + +From: Andre Edich + +[ Upstream commit 3ed58f96a70b85ef646d5427258f677f1395b62f ] + +In a case where the ID_REV register read is failed, the memory for a +private data structure has to be freed before returning error from the +function smsc95xx_bind. + +Fixes: bbd9f9ee69242 ("smsc95xx: add wol support for more frame types") +Signed-off-by: Andre Edich +Signed-off-by: Parthiban Veerasooran +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/smsc95xx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 8037a2e51a789..e4299852974e3 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -1142,7 +1142,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + /* detect device revision as different features may be available */ + ret = smsc95xx_read_reg(dev, ID_REV, &val); + if (ret < 0) +- return ret; ++ goto free_pdata; ++ + val >>= 16; + + if ((val == ID_REV_CHIP_ID_9500A_) || (val == ID_REV_CHIP_ID_9530_) || +-- +2.25.1 + diff --git a/queue-4.4/smsc95xx-check-return-value-of-smsc95xx_reset.patch b/queue-4.4/smsc95xx-check-return-value-of-smsc95xx_reset.patch new file mode 100644 index 00000000000..5517aeec2e6 --- /dev/null +++ b/queue-4.4/smsc95xx-check-return-value-of-smsc95xx_reset.patch @@ -0,0 +1,48 @@ +From 8779623a07f8f34ccd27e11fa7ddac7ebc96f51c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jul 2020 10:39:34 +0200 +Subject: smsc95xx: check return value of smsc95xx_reset + +From: Andre Edich + +[ Upstream commit 7c8b1e855f94f88a0c569be6309fc8d5c8844cd1 ] + +The return value of the function smsc95xx_reset() must be checked +to avoid returning false success from the function smsc95xx_bind(). + +Fixes: 2f7ca802bdae2 ("net: Add SMSC LAN9500 USB2.0 10/100 ethernet adapter driver") +Signed-off-by: Andre Edich +Signed-off-by: Parthiban Veerasooran +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/smsc95xx.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index b6b8aec73b280..8037a2e51a789 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -1136,6 +1136,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + + /* Init all registers */ + ret = smsc95xx_reset(dev); ++ if (ret) ++ goto free_pdata; + + /* detect device revision as different features may be available */ + ret = smsc95xx_read_reg(dev, ID_REV, &val); +@@ -1157,6 +1159,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) + dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; + dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; + return 0; ++ ++free_pdata: ++ kfree(pdata); ++ return ret; + } + + static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) +-- +2.25.1 +