* [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks
@ 2023-09-08 18:20 Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 02/10] wifi: ath9k: fix printk specifier Sasha Levin
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Jiri Pirko, Ido Schimmel, Jakub Kicinski, David S . Miller,
Sasha Levin, edumazet, pabeni, jiri, jacob.e.keller,
michal.wilczynski, shayd, netdev
From: Jiri Pirko <jiri@nvidia.com>
[ Upstream commit 633d76ad01ad0321a1ace3e5cc4fed06753d7ac4 ]
The checks in question were introduced by:
commit 6b4db2e528f6 ("devlink: Fix use-after-free after a failed reload").
That fixed an issue of reload with mlxsw driver.
Back then, that was a valid fix, because there was a limitation
in place that prevented drivers from registering/unregistering params
when devlink instance was registered.
It was possible to do the fix differently by changing drivers to
register/unregister params in appropriate places making sure the ops
operate only on memory which is allocated and initialized. But that,
as a dependency, would require to remove the limitation mentioned above.
Eventually, this limitation was lifted by:
commit 1d18bb1a4ddd ("devlink: allow registering parameters after the instance")
Also, the alternative fix (which also fixed another issue) was done by:
commit 74cbc3c03c82 ("mlxsw: spectrum_acl_tcam: Move devlink param to TCAM code").
Therefore, the checks are no longer relevant. Each driver should make
sure to have the params registered only when the memory the ops
are working with is allocated and initialized.
So remove the checks.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/devlink.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index b4dabe5d89f72..5bd6330ab4275 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -2953,7 +2953,7 @@ static int devlink_param_get(struct devlink *devlink,
const struct devlink_param *param,
struct devlink_param_gset_ctx *ctx)
{
- if (!param->get || devlink->reload_failed)
+ if (!param->get)
return -EOPNOTSUPP;
return param->get(devlink, param->id, ctx);
}
@@ -2962,7 +2962,7 @@ static int devlink_param_set(struct devlink *devlink,
const struct devlink_param *param,
struct devlink_param_gset_ctx *ctx)
{
- if (!param->set || devlink->reload_failed)
+ if (!param->set)
return -EOPNOTSUPP;
return param->set(devlink, param->id, ctx);
}
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 02/10] wifi: ath9k: fix printk specifier
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 03/10] wifi: mwifiex: fix fortify warning Sasha Levin
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dongliang Mu, Toke Høiland-Jørgensen, Kalle Valo,
Sasha Levin, kvalo, linux-wireless
From: Dongliang Mu <dzm91@hust.edu.cn>
[ Upstream commit 061115fbfb2ce5870c9a004d68dc63138c07c782 ]
Smatch reports:
ath_pci_probe() warn: argument 4 to %lx specifier is cast from pointer
ath_ahb_probe() warn: argument 4 to %lx specifier is cast from pointer
Fix it by modifying %lx to %p in the printk format string.
Note that with this change, the pointer address will be printed as a
hashed value by default. This is appropriate because the kernel
should not leak kernel pointers to user space in an informational
message. If someone wants to see the real address for debugging
purposes, this can be achieved with the no_hash_pointers kernel option.
Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230723040403.296723-1-dzm91@hust.edu.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath9k/ahb.c | 4 ++--
drivers/net/wireless/ath/ath9k/pci.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index 63019c3de034d..26023e3b4b9df 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -136,8 +136,8 @@ static int ath_ahb_probe(struct platform_device *pdev)
ah = sc->sc_ah;
ath9k_hw_name(ah, hw_name, sizeof(hw_name));
- wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n",
- hw_name, (unsigned long)mem, irq);
+ wiphy_info(hw->wiphy, "%s mem=0x%p, irq=%d\n",
+ hw_name, mem, irq);
return 0;
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 92b2dd396436a..cb3318bd3cad2 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -993,8 +993,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
sc->sc_ah->msi_reg = 0;
ath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name));
- wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n",
- hw_name, (unsigned long)sc->mem, pdev->irq);
+ wiphy_info(hw->wiphy, "%s mem=0x%p, irq=%d\n",
+ hw_name, sc->mem, pdev->irq);
return 0;
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 03/10] wifi: mwifiex: fix fortify warning
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 02/10] wifi: ath9k: fix printk specifier Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 04/10] crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui() Sasha Levin
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Antipov, Brian Norris, Kalle Valo, Sasha Levin,
linux-wireless
From: Dmitry Antipov <dmantipov@yandex.ru>
[ Upstream commit dcce94b80a954a8968ff29fafcfb066d6197fa9a ]
When compiling with gcc 13.1 and CONFIG_FORTIFY_SOURCE=y,
I've noticed the following:
In function ‘fortify_memcpy_chk’,
inlined from ‘mwifiex_construct_tdls_action_frame’ at drivers/net/wireless/marvell/mwifiex/tdls.c:765:3,
inlined from ‘mwifiex_send_tdls_action_frame’ at drivers/net/wireless/marvell/mwifiex/tdls.c:856:6:
./include/linux/fortify-string.h:529:25: warning: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Wattribute-warning]
529 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The compiler actually complains on:
memmove(pos + ETH_ALEN, &mgmt->u.action.category,
sizeof(mgmt->u.action.u.tdls_discover_resp));
and it happens because the fortification logic interprets this
as an attempt to overread 1-byte 'u.action.category' member of
'struct ieee80211_mgmt'. To silence this warning, it's enough
to pass an address of 'u.action' itself instead of an address
of its first member.
This also fixes an improper usage of 'sizeof()'. Since 'skb' is
extended with 'sizeof(mgmt->u.action.u.tdls_discover_resp) + 1'
bytes (where 1 is actually 'sizeof(mgmt->u.action.category)'),
I assume that the same number of bytes should be copied.
Suggested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230629085115.180499-2-dmantipov@yandex.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/marvell/mwifiex/tdls.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c
index f8f282ce39bd4..17f8379351923 100644
--- a/drivers/net/wireless/marvell/mwifiex/tdls.c
+++ b/drivers/net/wireless/marvell/mwifiex/tdls.c
@@ -734,6 +734,7 @@ mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv,
int ret;
u16 capab;
struct ieee80211_ht_cap *ht_cap;
+ unsigned int extra;
u8 radio, *pos;
capab = priv->curr_bss_params.bss_descriptor.cap_info_bitmap;
@@ -752,7 +753,10 @@ mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv,
switch (action_code) {
case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
- skb_put(skb, sizeof(mgmt->u.action.u.tdls_discover_resp) + 1);
+ /* See the layout of 'struct ieee80211_mgmt'. */
+ extra = sizeof(mgmt->u.action.u.tdls_discover_resp) +
+ sizeof(mgmt->u.action.category);
+ skb_put(skb, extra);
mgmt->u.action.category = WLAN_CATEGORY_PUBLIC;
mgmt->u.action.u.tdls_discover_resp.action_code =
WLAN_PUB_ACTION_TDLS_DISCOVER_RES;
@@ -761,8 +765,7 @@ mwifiex_construct_tdls_action_frame(struct mwifiex_private *priv,
mgmt->u.action.u.tdls_discover_resp.capability =
cpu_to_le16(capab);
/* move back for addr4 */
- memmove(pos + ETH_ALEN, &mgmt->u.action.category,
- sizeof(mgmt->u.action.u.tdls_discover_resp));
+ memmove(pos + ETH_ALEN, &mgmt->u.action, extra);
/* init address 4 */
eth_broadcast_addr(pos);
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 04/10] crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui()
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 02/10] wifi: ath9k: fix printk specifier Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 03/10] wifi: mwifiex: fix fortify warning Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 05/10] tpm_tis: Resend command to recover from data transfer errors Sasha Levin
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Mark O'Donovan, Herbert Xu, Sasha Levin, zohar
From: Mark O'Donovan <shiftee@posteo.net>
[ Upstream commit 9e47a758b70167c9301d2b44d2569f86c7796f2d ]
During NVMeTCP Authentication a controller can trigger a kernel
oops by specifying the 8192 bit Diffie Hellman group and passing
a correctly sized, but zeroed Diffie Hellamn value.
mpi_cmp_ui() was detecting this if the second parameter was 0,
but 1 is passed from dh_is_pubkey_valid(). This causes the null
pointer u->d to be dereferenced towards the end of mpi_cmp_ui()
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
lib/mpi/mpi-cmp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/mpi/mpi-cmp.c b/lib/mpi/mpi-cmp.c
index d25e9e96c310f..ceaebe181cd70 100644
--- a/lib/mpi/mpi-cmp.c
+++ b/lib/mpi/mpi-cmp.c
@@ -25,8 +25,12 @@ int mpi_cmp_ui(MPI u, unsigned long v)
mpi_limb_t limb = v;
mpi_normalize(u);
- if (!u->nlimbs && !limb)
- return 0;
+ if (u->nlimbs == 0) {
+ if (v == 0)
+ return 0;
+ else
+ return -1;
+ }
if (u->sign)
return -1;
if (u->nlimbs > 1)
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 05/10] tpm_tis: Resend command to recover from data transfer errors
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
` (2 preceding siblings ...)
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 04/10] crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui() Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 06/10] mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450 Sasha Levin
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Alexander Steffen, Jarkko Sakkinen, Sasha Levin, peterhuewe,
linux-integrity
From: Alexander Steffen <Alexander.Steffen@infineon.com>
[ Upstream commit 280db21e153d8810ce3b93640c63ae922bcb9e8e ]
Similar to the transmission of TPM responses, also the transmission of TPM
commands may become corrupted. Instead of aborting when detecting such
issues, try resending the command again.
Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/char/tpm/tpm_tis_core.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index ef47d1d58ac3a..a084f732c1804 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -421,10 +421,17 @@ static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)
int rc;
u32 ordinal;
unsigned long dur;
-
- rc = tpm_tis_send_data(chip, buf, len);
- if (rc < 0)
- return rc;
+ unsigned int try;
+
+ for (try = 0; try < TPM_RETRY; try++) {
+ rc = tpm_tis_send_data(chip, buf, len);
+ if (rc >= 0)
+ /* Data transfer done successfully */
+ break;
+ else if (rc != -EIO)
+ /* Data transfer failed, not recoverable */
+ return rc;
+ }
/* go and do it */
rc = tpm_tis_write8(priv, TPM_STS(priv->locality), TPM_STS_GO);
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 06/10] mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
` (3 preceding siblings ...)
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 05/10] tpm_tis: Resend command to recover from data transfer errors Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 07/10] alx: fix OOB-read compiler warning Sasha Levin
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Giulio Benetti, Jim Reinhart, James Autry, Matthew Maron,
Haibo Chen, Adrian Hunter, Ulf Hansson, Sasha Levin, shawnguo,
linux-imx, linux-mmc, linux-arm-kernel
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
[ Upstream commit 5ae4b0d8875caa44946e579420c7fd5740d58653 ]
Errata ERR010450 only shows up if voltage is 1.8V, but if the device is
supplied by 3v3 the errata can be ignored. So let's check for if quirk
SDHCI_QUIRK2_NO_1_8_V is defined or not before limiting the frequency.
Cc: Jim Reinhart <jimr@tekvox.com>
Cc: James Autry <jautry@tekvox.com>
Cc: Matthew Maron <matthewm@tekvox.com>
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Acked-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20230811214853.8623-1-giulio.benetti@benettiengineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index b3f761eca8299..762288c6d30ce 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -153,8 +153,8 @@
#define ESDHC_FLAG_HS400 BIT(9)
/*
* The IP has errata ERR010450
- * uSDHC: Due to the I/O timing limit, for SDR mode, SD card clock can't
- * exceed 150MHz, for DDR mode, SD card clock can't exceed 45MHz.
+ * uSDHC: At 1.8V due to the I/O timing limit, for SDR mode, SD card
+ * clock can't exceed 150MHz, for DDR mode, SD card clock can't exceed 45MHz.
*/
#define ESDHC_FLAG_ERR010450 BIT(10)
/* The IP supports HS400ES mode */
@@ -777,7 +777,8 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
| ESDHC_CLOCK_MASK);
sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
- if (imx_data->socdata->flags & ESDHC_FLAG_ERR010450) {
+ if ((imx_data->socdata->flags & ESDHC_FLAG_ERR010450) &&
+ (!(host->quirks2 & SDHCI_QUIRK2_NO_1_8_V))) {
unsigned int max_clock;
max_clock = imx_data->is_ddr ? 45000000 : 150000000;
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 07/10] alx: fix OOB-read compiler warning
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
` (4 preceding siblings ...)
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 06/10] mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450 Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 08/10] wifi: mac80211_hwsim: drop short frames Sasha Levin
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: GONG, Ruiqi, GONG, Simon Horman, Paolo Abeni, Sasha Levin,
chris.snook, davem, edumazet, kuba, netdev
From: "GONG, Ruiqi" <gongruiqi1@huawei.com>
[ Upstream commit 3a198c95c95da10ad844cbeade2fe40bdf14c411 ]
The following message shows up when compiling with W=1:
In function ‘fortify_memcpy_chk’,
inlined from ‘alx_get_ethtool_stats’ at drivers/net/ethernet/atheros/alx/ethtool.c:297:2:
./include/linux/fortify-string.h:592:4: error: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Werror=attribute-warning]
592 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In order to get alx stats altogether, alx_get_ethtool_stats() reads
beyond hw->stats.rx_ok. Fix this warning by directly copying hw->stats,
and refactor the unnecessarily complicated BUILD_BUG_ON btw.
Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230821013218.1614265-1-gongruiqi@huaweicloud.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/atheros/alx/ethtool.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/atheros/alx/ethtool.c b/drivers/net/ethernet/atheros/alx/ethtool.c
index 2f4eabf652e80..51e5aa2c74b34 100644
--- a/drivers/net/ethernet/atheros/alx/ethtool.c
+++ b/drivers/net/ethernet/atheros/alx/ethtool.c
@@ -281,9 +281,8 @@ static void alx_get_ethtool_stats(struct net_device *netdev,
spin_lock(&alx->stats_lock);
alx_update_hw_stats(hw);
- BUILD_BUG_ON(sizeof(hw->stats) - offsetof(struct alx_hw_stats, rx_ok) <
- ALX_NUM_STATS * sizeof(u64));
- memcpy(data, &hw->stats.rx_ok, ALX_NUM_STATS * sizeof(u64));
+ BUILD_BUG_ON(sizeof(hw->stats) != ALX_NUM_STATS * sizeof(u64));
+ memcpy(data, &hw->stats, sizeof(hw->stats));
spin_unlock(&alx->stats_lock);
}
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 08/10] wifi: mac80211_hwsim: drop short frames
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
` (5 preceding siblings ...)
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 07/10] alx: fix OOB-read compiler warning Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 09/10] libbpf: Free btf_vmlinux when closing bpf_object Sasha Levin
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Johannes Berg, syzbot+b2645b5bf1512b81fa22, Jeff Johnson,
Sasha Levin, kvalo, linux-wireless
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit fba360a047d5eeeb9d4b7c3a9b1c8308980ce9a6 ]
While technically some control frames like ACK are shorter and
end after Address 1, such frames shouldn't be forwarded through
wmediumd or similar userspace, so require the full 3-address
header to avoid accessing invalid memory if shorter frames are
passed in.
Reported-by: syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mac80211_hwsim.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index f80b1d57d6c38..a21739b2f44e6 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -3367,14 +3367,15 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
frame_data_len = nla_len(info->attrs[HWSIM_ATTR_FRAME]);
frame_data = (void *)nla_data(info->attrs[HWSIM_ATTR_FRAME]);
+ if (frame_data_len < sizeof(struct ieee80211_hdr_3addr) ||
+ frame_data_len > IEEE80211_MAX_DATA_LEN)
+ goto err;
+
/* Allocate new skb here */
skb = alloc_skb(frame_data_len, GFP_KERNEL);
if (skb == NULL)
goto err;
- if (frame_data_len > IEEE80211_MAX_DATA_LEN)
- goto err;
-
/* Copy the data */
skb_put_data(skb, frame_data, frame_data_len);
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 09/10] libbpf: Free btf_vmlinux when closing bpf_object
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
` (6 preceding siblings ...)
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 08/10] wifi: mac80211_hwsim: drop short frames Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 10/10] Bluetooth: btusb: Fix quirks table naming Sasha Levin
2023-09-08 21:11 ` [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Jacob Keller
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hao Luo, Andrii Nakryiko, Sasha Levin, ast, daniel, bpf
From: Hao Luo <haoluo@google.com>
[ Upstream commit 29d67fdebc42af6466d1909c60fdd1ef4f3e5240 ]
I hit a memory leak when testing bpf_program__set_attach_target().
Basically, set_attach_target() may allocate btf_vmlinux, for example,
when setting attach target for bpf_iter programs. But btf_vmlinux
is freed only in bpf_object_load(), which means if we only open
bpf object but not load it, setting attach target may leak
btf_vmlinux.
So let's free btf_vmlinux in bpf_object__close() anyway.
Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230822193840.1509809-1-haoluo@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/lib/bpf/libbpf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index b8849812449c3..343018632d2d1 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -4202,6 +4202,7 @@ void bpf_object__close(struct bpf_object *obj)
bpf_object__elf_finish(obj);
bpf_object__unload(obj);
btf__free(obj->btf);
+ btf__free(obj->btf_vmlinux);
btf_ext__free(obj->btf_ext);
for (i = 0; i < obj->nr_maps; i++) {
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 5.4 10/10] Bluetooth: btusb: Fix quirks table naming
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
` (7 preceding siblings ...)
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 09/10] libbpf: Free btf_vmlinux when closing bpf_object Sasha Levin
@ 2023-09-08 18:20 ` Sasha Levin
2023-09-08 21:11 ` [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Jacob Keller
9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2023-09-08 18:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Bastien Nocera, Paul Menzel, Luiz Augusto von Dentz, Sasha Levin,
marcel, johan.hedberg, luiz.dentz, linux-bluetooth
From: Bastien Nocera <hadess@hadess.net>
[ Upstream commit d831e3612111d385e8629104af5429808ef26e25 ]
The quirks table was named "blacklist_table" which isn't a good
description for that table as devices detected using it weren't ignored
by the driver.
Rename the table to match what it actually does.
Signed-off-by: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btusb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 79f77315854f4..c766861b65573 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -170,7 +170,7 @@ static const struct usb_device_id btusb_table[] = {
MODULE_DEVICE_TABLE(usb, btusb_table);
-static const struct usb_device_id blacklist_table[] = {
+static const struct usb_device_id quirks_table[] = {
/* CSR BlueCore devices */
{ USB_DEVICE(0x0a12, 0x0001), .driver_info = BTUSB_CSR },
@@ -3620,7 +3620,7 @@ static int btusb_probe(struct usb_interface *intf,
if (!id->driver_info) {
const struct usb_device_id *match;
- match = usb_match_id(intf, blacklist_table);
+ match = usb_match_id(intf, quirks_table);
if (match)
id = match;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
` (8 preceding siblings ...)
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 10/10] Bluetooth: btusb: Fix quirks table naming Sasha Levin
@ 2023-09-08 21:11 ` Jacob Keller
9 siblings, 0 replies; 11+ messages in thread
From: Jacob Keller @ 2023-09-08 21:11 UTC (permalink / raw)
To: Sasha Levin, linux-kernel, stable
Cc: Jiri Pirko, Ido Schimmel, Jakub Kicinski, David S . Miller,
edumazet, pabeni, jiri, michal.wilczynski, shayd, netdev
On 9/8/2023 11:20 AM, Sasha Levin wrote:
> From: Jiri Pirko <jiri@nvidia.com>
>
> [ Upstream commit 633d76ad01ad0321a1ace3e5cc4fed06753d7ac4 ]
>
> The checks in question were introduced by:
> commit 6b4db2e528f6 ("devlink: Fix use-after-free after a failed reload").
> That fixed an issue of reload with mlxsw driver.
>
> Back then, that was a valid fix, because there was a limitation
> in place that prevented drivers from registering/unregistering params
> when devlink instance was registered.
>
> It was possible to do the fix differently by changing drivers to
> register/unregister params in appropriate places making sure the ops
> operate only on memory which is allocated and initialized. But that,
> as a dependency, would require to remove the limitation mentioned above.
>
> Eventually, this limitation was lifted by:
> commit 1d18bb1a4ddd ("devlink: allow registering parameters after the instance")
>
> Also, the alternative fix (which also fixed another issue) was done by:
> commit 74cbc3c03c82 ("mlxsw: spectrum_acl_tcam: Move devlink param to TCAM code").
>
> Therefore, the checks are no longer relevant. Each driver should make
> sure to have the params registered only when the memory the ops
> are working with is allocated and initialized.
>
> So remove the checks.
>
Hmmmm. Based on the description above this feels a bit odd to backport.
Are we sure that its safe to remove this limitation on older kernels?
Both mentioned commits are in v6.3 so they're not in any of the stable
trees by default.
Indeed grep over stable/linux-5.4.y shows nothing for either commit.
Thus, I am not convinced this is safe to backport. I didn't double check
every single stable branch but given that the mentioned dependencies are
in 6.3 and don't appear to have been fixes, it seems problematic for all
including 5.4, 5.10, 5.15, and 6.1. No driver in those trees is going to
be registering parameters early so I don't see the benefit of the patch.
Thus, it is my view this shouldn't be backported, at least not without
porting the relevant dependencies as well.
Thanks,
Jake
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> net/core/devlink.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/devlink.c b/net/core/devlink.c
> index b4dabe5d89f72..5bd6330ab4275 100644
> --- a/net/core/devlink.c
> +++ b/net/core/devlink.c
> @@ -2953,7 +2953,7 @@ static int devlink_param_get(struct devlink *devlink,
> const struct devlink_param *param,
> struct devlink_param_gset_ctx *ctx)
> {
> - if (!param->get || devlink->reload_failed)
> + if (!param->get)
> return -EOPNOTSUPP;
> return param->get(devlink, param->id, ctx);
> }
> @@ -2962,7 +2962,7 @@ static int devlink_param_set(struct devlink *devlink,
> const struct devlink_param *param,
> struct devlink_param_gset_ctx *ctx)
> {
> - if (!param->set || devlink->reload_failed)
> + if (!param->set)
> return -EOPNOTSUPP;
> return param->set(devlink, param->id, ctx);
> }
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-09-08 21:11 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-08 18:20 [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 02/10] wifi: ath9k: fix printk specifier Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 03/10] wifi: mwifiex: fix fortify warning Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 04/10] crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui() Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 05/10] tpm_tis: Resend command to recover from data transfer errors Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 06/10] mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450 Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 07/10] alx: fix OOB-read compiler warning Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 08/10] wifi: mac80211_hwsim: drop short frames Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 09/10] libbpf: Free btf_vmlinux when closing bpf_object Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.4 10/10] Bluetooth: btusb: Fix quirks table naming Sasha Levin
2023-09-08 21:11 ` [PATCH AUTOSEL 5.4 01/10] devlink: remove reload failed checks in params get/set callbacks Jacob Keller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).