]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Mon, 24 Aug 2020 01:33:39 +0000 (21:33 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 24 Aug 2020 01:39:29 +0000 (21:39 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/asoc-intel-fix-memleak-in-sst_media_open.patch [new file with mode: 0644]
queue-4.9/ext4-fix-potential-negative-array-index-in-do_split.patch [new file with mode: 0644]
queue-4.9/i40e-set-rx_only-mode-for-unicast-promiscuous-on-vla.patch [new file with mode: 0644]
queue-4.9/net-dsa-b53-check-for-timeout.patch [new file with mode: 0644]
queue-4.9/net-fec-correct-the-error-path-for-regulator-disable.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/asoc-intel-fix-memleak-in-sst_media_open.patch b/queue-4.9/asoc-intel-fix-memleak-in-sst_media_open.patch
new file mode 100644 (file)
index 0000000..4ec5d94
--- /dev/null
@@ -0,0 +1,50 @@
+From 49a94321f1a84f7fe2e487ab3dee94ef316c03a6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Aug 2020 16:41:10 +0800
+Subject: ASoC: intel: Fix memleak in sst_media_open
+
+From: Dinghao Liu <dinghao.liu@zju.edu.cn>
+
+[ Upstream commit 062fa09f44f4fb3776a23184d5d296b0c8872eb9 ]
+
+When power_up_sst() fails, stream needs to be freed
+just like when try_module_get() fails. However, current
+code is returning directly and ends up leaking memory.
+
+Fixes: 0121327c1a68b ("ASoC: Intel: mfld-pcm: add control for powering up/down dsp")
+Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20200813084112.26205-1-dinghao.liu@zju.edu.cn
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/intel/atom/sst-mfld-platform-pcm.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+index e83e314a76a53..dc1b9a32c0575 100644
+--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
++++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+@@ -339,7 +339,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
+       ret_val = power_up_sst(stream);
+       if (ret_val < 0)
+-              return ret_val;
++              goto out_power_up;
+       /* Make sure, that the period size is always even */
+       snd_pcm_hw_constraint_step(substream->runtime, 0,
+@@ -348,8 +348,9 @@ static int sst_media_open(struct snd_pcm_substream *substream,
+       return snd_pcm_hw_constraint_integer(runtime,
+                        SNDRV_PCM_HW_PARAM_PERIODS);
+ out_ops:
+-      kfree(stream);
+       mutex_unlock(&sst_lock);
++out_power_up:
++      kfree(stream);
+       return ret_val;
+ }
+-- 
+2.25.1
+
diff --git a/queue-4.9/ext4-fix-potential-negative-array-index-in-do_split.patch b/queue-4.9/ext4-fix-potential-negative-array-index-in-do_split.patch
new file mode 100644 (file)
index 0000000..123d625
--- /dev/null
@@ -0,0 +1,68 @@
+From ca80b531e4cfe30355947029281169baaa9bdcb3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Jun 2020 14:19:04 -0500
+Subject: ext4: fix potential negative array index in do_split()
+
+From: Eric Sandeen <sandeen@redhat.com>
+
+[ Upstream commit 5872331b3d91820e14716632ebb56b1399b34fe1 ]
+
+If for any reason a directory passed to do_split() does not have enough
+active entries to exceed half the size of the block, we can end up
+iterating over all "count" entries without finding a split point.
+
+In this case, count == move, and split will be zero, and we will
+attempt a negative index into map[].
+
+Guard against this by detecting this case, and falling back to
+split-to-half-of-count instead; in this case we will still have
+plenty of space (> half blocksize) in each split block.
+
+Fixes: ef2b02d3e617 ("ext34: ensure do_split leaves enough free space in both blocks")
+Signed-off-by: Eric Sandeen <sandeen@redhat.com>
+Reviewed-by: Andreas Dilger <adilger@dilger.ca>
+Reviewed-by: Jan Kara <jack@suse.cz>
+Link: https://lore.kernel.org/r/f53e246b-647c-64bb-16ec-135383c70ad7@redhat.com
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ext4/namei.c | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
+index 2d918b43b536e..157dbbe235f90 100644
+--- a/fs/ext4/namei.c
++++ b/fs/ext4/namei.c
+@@ -1759,7 +1759,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
+                            blocksize, hinfo, map);
+       map -= count;
+       dx_sort_map(map, count);
+-      /* Split the existing block in the middle, size-wise */
++      /* Ensure that neither split block is over half full */
+       size = 0;
+       move = 0;
+       for (i = count-1; i >= 0; i--) {
+@@ -1769,8 +1769,18 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
+               size += map[i].size;
+               move++;
+       }
+-      /* map index at which we will split */
+-      split = count - move;
++      /*
++       * map index at which we will split
++       *
++       * If the sum of active entries didn't exceed half the block size, just
++       * split it in half by count; each resulting block will have at least
++       * half the space free.
++       */
++      if (i > 0)
++              split = count - move;
++      else
++              split = count/2;
++
+       hash2 = map[split].hash;
+       continued = hash2 == map[split - 1].hash;
+       dxtrace(printk(KERN_INFO "Split block %lu at %x, %i/%i\n",
+-- 
+2.25.1
+
diff --git a/queue-4.9/i40e-set-rx_only-mode-for-unicast-promiscuous-on-vla.patch b/queue-4.9/i40e-set-rx_only-mode-for-unicast-promiscuous-on-vla.patch
new file mode 100644 (file)
index 0000000..7268129
--- /dev/null
@@ -0,0 +1,114 @@
+From 672f11da8fed01fc66cbc5628268c80b4ab675a3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Aug 2020 13:40:59 +0000
+Subject: i40e: Set RX_ONLY mode for unicast promiscuous on VLAN
+
+From: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
+
+[ Upstream commit 4bd5e02a2ed1575c2f65bd3c557a077dd399f0e8 ]
+
+Trusted VF with unicast promiscuous mode set, could listen to TX
+traffic of other VFs.
+Set unicast promiscuous mode to RX traffic, if VSI has port VLAN
+configured. Rename misleading I40E_AQC_SET_VSI_PROMISC_TX bit to
+I40E_AQC_SET_VSI_PROMISC_RX_ONLY. Aligned unicast promiscuous with
+VLAN to the one without VLAN.
+
+Fixes: 6c41a7606967 ("i40e: Add promiscuous on VLAN support")
+Fixes: 3b1200891b7f ("i40e: When in promisc mode apply promisc mode to Tx Traffic as well")
+Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
+Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
+Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
+Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/ethernet/intel/i40e/i40e_adminq_cmd.h |  2 +-
+ drivers/net/ethernet/intel/i40e/i40e_common.c | 35 ++++++++++++++-----
+ 2 files changed, 28 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
+index 67e396b2b3472..0e75c3a34fe7c 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
++++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
+@@ -1107,7 +1107,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes {
+ #define I40E_AQC_SET_VSI_PROMISC_BROADCAST    0x04
+ #define I40E_AQC_SET_VSI_DEFAULT              0x08
+ #define I40E_AQC_SET_VSI_PROMISC_VLAN         0x10
+-#define I40E_AQC_SET_VSI_PROMISC_TX           0x8000
++#define I40E_AQC_SET_VSI_PROMISC_RX_ONLY      0x8000
+       __le16  seid;
+ #define I40E_AQC_VSI_PROM_CMD_SEID_MASK               0x3FF
+       __le16  vlan_tag;
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
+index 2154a34c1dd80..09b47088dcc2b 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
+@@ -1922,6 +1922,21 @@ i40e_status i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
+       return status;
+ }
++/**
++ * i40e_is_aq_api_ver_ge
++ * @aq: pointer to AdminQ info containing HW API version to compare
++ * @maj: API major value
++ * @min: API minor value
++ *
++ * Assert whether current HW API version is greater/equal than provided.
++ **/
++static bool i40e_is_aq_api_ver_ge(struct i40e_adminq_info *aq, u16 maj,
++                                u16 min)
++{
++      return (aq->api_maj_ver > maj ||
++              (aq->api_maj_ver == maj && aq->api_min_ver >= min));
++}
++
+ /**
+  * i40e_aq_add_vsi
+  * @hw: pointer to the hw struct
+@@ -2047,18 +2062,16 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
+       if (set) {
+               flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
+-              if (rx_only_promisc &&
+-                  (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
+-                   (hw->aq.api_maj_ver > 1)))
+-                      flags |= I40E_AQC_SET_VSI_PROMISC_TX;
++              if (rx_only_promisc && i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
++                      flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
+       }
+       cmd->promiscuous_flags = cpu_to_le16(flags);
+       cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
+-      if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) ||
+-          (hw->aq.api_maj_ver > 1))
+-              cmd->valid_flags |= cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_TX);
++      if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
++              cmd->valid_flags |=
++                      cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
+       cmd->seid = cpu_to_le16(seid);
+       status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
+@@ -2155,11 +2168,17 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,
+       i40e_fill_default_direct_cmd_desc(&desc,
+                                         i40e_aqc_opc_set_vsi_promiscuous_modes);
+-      if (enable)
++      if (enable) {
+               flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
++              if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
++                      flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
++      }
+       cmd->promiscuous_flags = cpu_to_le16(flags);
+       cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
++      if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
++              cmd->valid_flags |=
++                      cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
+       cmd->seid = cpu_to_le16(seid);
+       cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID);
+-- 
+2.25.1
+
diff --git a/queue-4.9/net-dsa-b53-check-for-timeout.patch b/queue-4.9/net-dsa-b53-check-for-timeout.patch
new file mode 100644 (file)
index 0000000..67d5958
--- /dev/null
@@ -0,0 +1,51 @@
+From 920066a0f19b84e3e5eddea3fff2c11cc5045e0f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Aug 2020 06:56:00 -0700
+Subject: net: dsa: b53: check for timeout
+
+From: Tom Rix <trix@redhat.com>
+
+[ Upstream commit 774d977abfd024e6f73484544b9abe5a5cd62de7 ]
+
+clang static analysis reports this problem
+
+b53_common.c:1583:13: warning: The left expression of the compound
+  assignment is an uninitialized value. The computed value will
+  also be garbage
+        ent.port &= ~BIT(port);
+        ~~~~~~~~ ^
+
+ent is set by a successful call to b53_arl_read().  Unsuccessful
+calls are caught by an switch statement handling specific returns.
+b32_arl_read() calls b53_arl_op_wait() which fails with the
+unhandled -ETIMEDOUT.
+
+So add -ETIMEDOUT to the switch statement.  Because
+b53_arl_op_wait() already prints out a message, do not add another
+one.
+
+Fixes: 1da6df85c6fb ("net: dsa: b53: Implement ARL add/del/dump operations")
+Signed-off-by: Tom Rix <trix@redhat.com>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/dsa/b53/b53_common.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
+index 060f9b1769298..c387be5c926b7 100644
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1175,6 +1175,8 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
+               return ret;
+       switch (ret) {
++      case -ETIMEDOUT:
++              return ret;
+       case -ENOSPC:
+               dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n",
+                       addr, vid);
+-- 
+2.25.1
+
diff --git a/queue-4.9/net-fec-correct-the-error-path-for-regulator-disable.patch b/queue-4.9/net-fec-correct-the-error-path-for-regulator-disable.patch
new file mode 100644 (file)
index 0000000..fe603eb
--- /dev/null
@@ -0,0 +1,40 @@
+From 1fe5707b49cd3b18f81497dfe7a115667c31bdf0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Aug 2020 15:13:14 +0800
+Subject: net: fec: correct the error path for regulator disable in probe
+
+From: Fugang Duan <fugang.duan@nxp.com>
+
+[ Upstream commit c6165cf0dbb82ded90163dce3ac183fc7a913dc4 ]
+
+Correct the error path for regulator disable.
+
+Fixes: 9269e5560b26 ("net: fec: add phy-reset-gpios PROBE_DEFER check")
+Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/freescale/fec_main.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
+index 8df32398d3435..9b3ea0406e0d5 100644
+--- a/drivers/net/ethernet/freescale/fec_main.c
++++ b/drivers/net/ethernet/freescale/fec_main.c
+@@ -3505,11 +3505,11 @@ fec_probe(struct platform_device *pdev)
+ failed_irq:
+ failed_init:
+       fec_ptp_stop(pdev);
+-      if (fep->reg_phy)
+-              regulator_disable(fep->reg_phy);
+ failed_reset:
+       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
++      if (fep->reg_phy)
++              regulator_disable(fep->reg_phy);
+ failed_regulator:
+ failed_clk_ipg:
+       fec_enet_clk_enable(ndev, false);
+-- 
+2.25.1
+
index 9bae558a95ed5a9dce0dd1c9b4152b8243ef884b..40779637dc1371eaca08cc9f785f35689a071d36 100644 (file)
@@ -26,3 +26,8 @@ scsi-libfc-free-skb-in-fc_disc_gpn_id_resp-for-valid.patch
 virtio_ring-avoid-loop-when-vq-is-broken-in-virtqueu.patch
 xfs-fix-ubsan-null-ptr-deref-in-xfs_sysfs_init.patch
 alpha-fix-annotation-of-io-read-write-16-32-be.patch
+ext4-fix-potential-negative-array-index-in-do_split.patch
+i40e-set-rx_only-mode-for-unicast-promiscuous-on-vla.patch
+net-fec-correct-the-error-path-for-regulator-disable.patch
+asoc-intel-fix-memleak-in-sst_media_open.patch
+net-dsa-b53-check-for-timeout.patch