5.15.3-rc1 review
Subsystems (15)
Greg Kroah-Hartman
maintainerPATCH 320/917 selftests/bpf: Fix strobemeta selftest regression
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 0133c20480b14820d43c37c0e9502da4bffcad3a ]
After most recent nightly Clang update strobemeta selftests started failing with the following error (relevant portion of assembly included):
1624: (85) call bpf_probe_read_user_str#114
1625: (bf) r1 = r0
1626: (18) r2 = 0xfffffffe
1628: (5f) r1 &= r2
1629: (55) if r1 != 0x0 goto pc+7
1630: (07) r9 += 104
1631: (6b) *(u16 *)(r9 +0) = r0
1632: (67) r0 <<= 32
1633: (77) r0 >>= 32
1634: (79) r1 = *(u64 *)(r10 -456)
1635: (0f) r1 += r0
1636: (7b) *(u64 *)(r10 -456) = r1
1637: (79) r1 = *(u64 *)(r10 -368)
1638: (c5) if r1 s< 0x1 goto pc+778
1639: (bf) r6 = r8
1640: (0f) r6 += r7
1641: (b4) w1 = 0
1642: (6b) *(u16 *)(r6 +108) = r1
1643: (79) r3 = *(u64 *)(r10 -352)
1644: (79) r9 = *(u64 *)(r10 -456)
1645: (bf) r1 = r9
1646: (b4) w2 = 1
1647: (85) call bpf_probe_read_user_str#114
R1 unbounded memory access, make sure to bounds check any such access
In the above code r0 and r1 are implicitly related. Clang knows that, but verifier isn't able to infer this relationship.
Yonghong Song narrowed down this "regression" in code generation to a recent Clang optimization change ([0]), which for BPF target generates code pattern that BPF verifier can't handle and loses track of register boundaries.
This patch works around the issue by adding an BPF assembly-based helper that helps to prove to the verifier that upper bound of the register is a given constant by controlling the exact share of generated BPF instruction sequence. This fixes the immediate issue for strobemeta selftest.
[0] https://github.com/llvm/llvm-project/commit/acabad9ff6bf13e00305d9d8621ee8eafc1f8b08
--- tools/testing/selftests/bpf/progs/strobemeta.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/testing/selftests/bpf/progs/strobemeta.h +11 -0
@@ -10,6 +10,14 @@#include <linux/types.h> #include <bpf/bpf_helpers.h> +#define bpf_clamp_umax (VAR ,UMAX ) \ + asm volatile ( \ + "if %0 <= %[max] goto +1\n" \ + "%0 = %[max]\n" \ + : "+r"(VAR) \ + : [max]"i"(UMAX) \ + ) +typedef uint32_t pid_t ;struct task_struct {};
@@ -413,6 +421,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.tag);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->tag_len = len; payload += len; }
@@ -430,6 +439,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.entries[i].key);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->key_lens[i] = len; payload += len; }
@@ -437,6 +447,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.entries[i].val);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->val_lens[i] = len; payload += len; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 338/917 crypto: sm4 - Do not change section of ck and sbox
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 4a7e1e5fc294687a8941fa3eeb4a7e8539ca5e2f ]
When building with clang and GNU as, there is a warning about ignored changed section attributes:
/tmp/sm4-c916c8.s: Assembler messages:/tmp/sm4-c916c8.s:677: Warning: ignoring changed section attributes for .data..cacheline_aligned
"static const" places the data in .rodata but __cacheline_aligned has the section attribute to place it in .data..cacheline_aligned, in addition to the aligned attribute.
To keep the alignment but avoid attempting to change sections, use the ____cacheline_aligned attribute, which is just the aligned attribute.
--- lib/crypto/sm4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/crypto/sm4.c +2 -2
@@ -15,7 +15,7 @@ static const u32 fk[4] = {0xa3b1bac6 ,0x56aa3350 ,0x677d9197 ,0xb27022dc }; -static const u32 __cacheline_aligned ck[32] = { +static const u32 ____cacheline_aligned ck[32 ] = {0x00070e15 ,0x1c232a31 ,0x383f464d ,0x545b6269 ,0x70777e85 ,0x8c939aa1 ,0xa8afb6bd ,0xc4cbd2d9 , 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
@@ -26,7 +26,7 @@ static const u32 __cacheline_aligned ck[32] = {0x10171e25 ,0x2c333a41 ,0x484f565d ,0x646b7279 }; -static const u8 __cacheline_aligned sbox[256] = { +static const u8 ____cacheline_aligned sbox[256 ] = {0xd6 ,0x90 ,0xe9 ,0xfe ,0xcc ,0xe1 ,0x3d ,0xb7 ,0x16 ,0xb6 ,0x14 ,0xc2 ,0x28 ,0xfb ,0x2c ,0x05 , 0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 340/917 lockdep: Let lock_is_held_type() detect recursive read as read
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 2507003a1d10917c9158077bf6030719d02c941e ]
lock_is_held_type(, 1) detects acquired read locks. It only recognized locks acquired with lock_acquire_shared(). Read locks acquired with lock_acquire_shared_recursive() are not recognized because a `2' is stored as the read value.
Rework the check to additionally recognise lock's read value one and two as a read held lock.
--- kernel/locking/lockdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/lockdep.c +1 -1
@@ -5366,7 +5366,7 @@ int __lock_is_held(const struct lockdep_map *lock, int read)struct held_lock *hlock = curr->held_locks + i;if (match_held_lock (hlock, lock)) { -if (read ==-1 || hlock->read == read) +if (read ==-1 || !!hlock->read == read)return LOCK_STATE_HELD ;return LOCK_STATE_NOT_HELD ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 339/917 virtio-gpu: fix possible memory allocation failure
In reply to Greg Kroah-HartmanFrom: liuyuntao <[email protected]>
[ Upstream commit 5bd4f20de8acad37dbb3154feb34dbc36d506c02 ]
When kmem_cache_zalloc in virtio_gpu_get_vbuf fails, it will return an error code. But none of its callers checks this error code, and a core dump will take place.
Considering many of its callers can't handle such error, I add a __GFP_NOFAIL flag when calling kmem_cache_zalloc to make sure it won't fail, and delete those unused error handlings.
--- drivers/gpu/drm/virtio/virtgpu_vq.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -7
@@ -91,9 +91,7 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev, {struct virtio_gpu_vbuffer *vbuf; - vbuf =kmem_cache_zalloc (vgdev->vbufs,GFP_KERNEL ); -if (!vbuf) -return ERR_PTR (-ENOMEM ); + vbuf =kmem_cache_zalloc (vgdev->vbufs,GFP_KERNEL | __GFP_NOFAIL);BUG_ON (size >MAX_INLINE_CMD_SIZE || size <sizeof (struct virtio_gpu_ctrl_hdr ));
@@ -147,10 +145,6 @@ static void *virtio_gpu_alloc_cmd_resp(struct virtio_gpu_device *vgdev, vbuf =virtio_gpu_get_vbuf (vgdev, cmd_size, resp_size, resp_buf, cb); -if (IS_ERR (vbuf)) { - *vbuffer_p =NULL ; -return ERR_CAST (vbuf); - } *vbuffer_p = vbuf;return (struct virtio_gpu_command *)vbuf->buf; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 352/917 crypto: caam - disable pkc for non-E SoCs
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit f20311cc9c58052e0b215013046cbf390937910c ]
On newer CAAM versions, not all accelerators are disabled if the SoC is a non-E variant. While the driver checks most of the modules for availability, there is one - PKHA - which sticks out. On non-E variants it is still reported as available, that is the number of instances is non-zero, but it has limited functionality. In particular it doesn't support encryption and decryption, but just signing and verifying. This is indicated by a bit in the PKHA_MISC field. Take this bit into account if we are checking for availability.
This will the following error:
[ 8.167817] caam_jr 8020000.jr: 20000b0f: CCB: desc idx 11: : Invalid CHA selected.
Tested on an NXP LS1028A (non-E) SoC.
--- drivers/crypto/caam/caampkc.c | 19 +++++++++++++++---- drivers/crypto/caam/regs.h | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/crypto/caam/caampkc.c +15 -4
@@ -1153,16 +1153,27 @@ static struct caam_akcipher_alg caam_rsa = {int caam_pkc_init (struct device *ctrldev) {struct caam_drv_private *priv =dev_get_drvdata (ctrldev); -u32 pk_inst; +u32 pk_inst, pkha;int err; init_done = false;/* Determine public key hardware accelerator presence. */ -if (priv->era <10 ) +if (priv->era <10 ) { pk_inst = (rd_reg32 (&priv->ctrl->perfmon.cha_num_ls) &CHA_ID_LS_PK_MASK ) >>CHA_ID_LS_PK_SHIFT ; -else - pk_inst =rd_reg32 (&priv->ctrl->vreg.pkha) &CHA_VER_NUM_MASK ; + }else { + pkha =rd_reg32 (&priv->ctrl->vreg.pkha); + pk_inst = pkha &CHA_VER_NUM_MASK ; + +/* +* Newer CAAMs support partially disabled functionality. If this is the +* case, the number is non-zero, but this bit is set to indicate that +* no encryption or decryption is supported. Only signing and verifying +* is supported. +*/ +if (pkha &CHA_VER_MISC_PKHA_NO_CRYPT ) + pk_inst =0 ; + }/* Do not register algorithms if PKHA is not present. */ if (!pk_inst)
drivers/crypto/caam/regs.h +3 -0
@@ -322,6 +322,9 @@ struct version_regs {/* CHA Miscellaneous Information - AESA_MISC specific */ #define CHA_VER_MISC_AES_GCM BIT(1 + CHA_VER_MISC_SHIFT) +/* CHA Miscellaneous Information - PKHA_MISC specific */ +#define CHA_VER_MISC_PKHA_NO_CRYPT BIT(7 + CHA_VER_MISC_SHIFT) +/* * caam_perfmon - Performance Monitor/Secure Memory Status/ * CAAM Global Status/Component Version IDs
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 354/917 Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 9a9023f314873241a43b5a2b96e9c0caaa958433 ]
The recently added H5_WAKEUP_DISABLE h5->flags flag gets checked in h5_btrtl_open(), but it gets set in h5_serdev_probe() *after* calling hci_uart_register_device() and thus after h5_btrtl_open() is called, set this flag earlier.
Also on devices where suspend/resume involves fully re-probing the HCI, runtime-pm suspend should not be used, make the runtime-pm setup conditional on the H5_WAKEUP_DISABLE flag too.
This fixes the HCI being removed and then re-added every 10 seconds because it was being reprobed as soon as it was runtime-suspended.
--- drivers/bluetooth/hci_h5.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/bluetooth/hci_h5.c +11 -9
@@ -848,6 +848,8 @@ static int h5_serdev_probe(struct serdev_device *serdev) h5->vnd = data->vnd; } +if (data->driver_info &H5_INFO_WAKEUP_DISABLE ) +set_bit (H5_WAKEUP_DISABLE , &h5->flags); h5->enable_gpio =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_LOW );if (IS_ERR (h5->enable_gpio))
@@ -862,9 +864,6 @@ static int h5_serdev_probe(struct serdev_device *serdev)if (err)return err; -if (data->driver_info &H5_INFO_WAKEUP_DISABLE ) -set_bit (H5_WAKEUP_DISABLE , &h5->flags); -return 0 ; }
@@ -964,11 +963,13 @@ static void h5_btrtl_open(struct h5 *h5)serdev_device_set_parity (h5->hu->serdev,SERDEV_PARITY_EVEN );serdev_device_set_baudrate (h5->hu->serdev,115200 ); -pm_runtime_set_active (&h5->hu->serdev->dev); -pm_runtime_use_autosuspend (&h5->hu->serdev->dev); -pm_runtime_set_autosuspend_delay (&h5->hu->serdev->dev, -SUSPEND_TIMEOUT_MS ); -pm_runtime_enable (&h5->hu->serdev->dev); +if (!test_bit (H5_WAKEUP_DISABLE , &h5->flags)) { +pm_runtime_set_active (&h5->hu->serdev->dev); +pm_runtime_use_autosuspend (&h5->hu->serdev->dev); +pm_runtime_set_autosuspend_delay (&h5->hu->serdev->dev, +SUSPEND_TIMEOUT_MS ); +pm_runtime_enable (&h5->hu->serdev->dev); + }/* The controller needs up to 500ms to wakeup */ gpiod_set_value_cansleep (h5->enable_gpio,1 );
@@ -978,7 +979,8 @@ static void h5_btrtl_open(struct h5 *h5)static void h5_btrtl_close (struct h5 *h5) { -pm_runtime_disable (&h5->hu->serdev->dev); +if (!test_bit (H5_WAKEUP_DISABLE , &h5->flags)) +pm_runtime_disable (&h5->hu->serdev->dev);gpiod_set_value_cansleep (h5->device_wake_gpio,0 );gpiod_set_value_cansleep (h5->enable_gpio,0 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 356/917 qed: Dont ignore devlink allocation failures
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e6a54d6f221301347aaf9d83bb1f23129325c1c5 ]
devlink is a software interface that doesn't depend on any hardware capabilities. The failure in SW means memory issues, wrong parameters, programmer error e.t.c.
Like any other such interface in the kernel, the returned status of devlink APIs should be checked and propagated further and not ignored.
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 12 +++++------- drivers/scsi/qedf/qedf_main.c | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_main.c +5 -7
@@ -1176,19 +1176,17 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, edev->devlink = qed_ops->common->devlink_register (cdev);if (IS_ERR (edev->devlink)) {DP_NOTICE (edev,"Cannot register devlink\n" ); + rc =PTR_ERR (edev->devlink); edev->devlink =NULL ; -/* Go on, we can live without devlink */ + goto err3; } }else {struct net_device *ndev =pci_get_drvdata (pdev); +struct qed_devlink *qdl; edev =netdev_priv (ndev); - -if (edev->devlink) { -struct qed_devlink *qdl =devlink_priv (edev->devlink); - - qdl->cdev = cdev; - } + qdl =devlink_priv (edev->devlink); + qdl->cdev = cdev; edev->cdev = cdev;memset (&edev->stats,0 ,sizeof (edev->stats));memcpy (&edev->dev_info, &dev_info,sizeof (dev_info));
drivers/scsi/qedf/qedf_main.c +2 -0
@@ -3416,7 +3416,9 @@ retry_probe: qedf->devlink = qed_ops->common->devlink_register (qedf->cdev);if (IS_ERR (qedf->devlink)) {QEDF_ERR (&qedf->dbg_ctx,"Cannot register devlink\n" ); + rc =PTR_ERR (qedf->devlink); qedf->devlink =NULL ; + goto err2; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 304/917 spi: bcm-qspi: Fix missing clk_disable_unprepare() on error in bcm_qspi_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ca9b8f56ec089d3a436050afefd17b7237301f47 ]
Fix the missing clk_disable_unprepare() before return from bcm_qspi_probe() in the error handling case.
--- drivers/spi/spi-bcm-qspi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-bcm-qspi.c +3 -2
@@ -1460,7 +1460,7 @@ int bcm_qspi_probe(struct platform_device *pdev, &qspi->dev_ids[val]);if (ret <0 ) {dev_err (&pdev->dev,"IRQ %s not found\n" , name); - goto qspi_probe_err; + goto qspi_unprepare_err; } qspi->dev_ids[val].dev = qspi;
@@ -1475,7 +1475,7 @@ int bcm_qspi_probe(struct platform_device *pdev,if (!num_ints) {dev_err (&pdev->dev,"no IRQs registered, cannot init driver\n" ); ret = -EINVAL ; - goto qspi_probe_err; + goto qspi_unprepare_err; }bcm_qspi_hw_init (qspi);
@@ -1499,6 +1499,7 @@ int bcm_qspi_probe(struct platform_device *pdev, qspi_reg_err:bcm_qspi_hw_uninit (qspi); +qspi_unprepare_err:clk_disable_unprepare (qspi->clk); qspi_probe_err:kfree (qspi->dev_ids);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 312/917 selftests/core: fix conflicting types compile error for close_range()
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
[ Upstream commit f35dcaa0a8a29188ed61083d153df1454cf89d08 ]
close_range() test type conflicts with close_range() library call in x86_64-linux-gnu/bits/unistd_ext.h. Fix it by changing the name to core_close_range().
gcc -g -I../../../../usr/include/ close_range_test.c -o ../tools/testing/selftests/core/close_range_test
In file included from close_range_test.c:16:
close_range_test.c:57:6: error: conflicting types for ‘close_range’; have ‘void(struct __test_metadata *)’
57 | TEST(close_range)
| ^~~~~~~~~~~
../kselftest_harness.h:181:21: note: in definition of macro ‘__TEST_IMPL’
181 | static void test_name(struct __test_metadata *_metadata); \
| ^~~~~~~~~
close_range_test.c:57:1: note: in expansion of macro ‘TEST’
57 | TEST(close_range)
| ^~~~
In file included from /usr/include/unistd.h:1204,
from close_range_test.c:13:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:56:12: note: previous declaration of ‘close_range’ with type ‘int(unsigned int, unsigned int, int)’
56 | extern int close_range (unsigned int __fd, unsigned int __max_fd,
| ^~~~~~~~~~~--- tools/testing/selftests/core/close_range_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/core/close_range_test.c +1 -1
@@ -54,7 +54,7 @@ static inline int sys_close_range(unsigned int fd, unsigned int max_fd,#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))#endif -TEST (close_range) +TEST (core_close_range) {int i, ret;int open_fds[101 ];
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 342/917 net: phylink: dont call netif_carrier_off() with NULL netdev
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit cbcca2e3961eac736566ac13ef0d0bf6f0b764ec ]
Dan Carpenter points out that we have a code path that permits a NULL netdev pointer to be passed to netif_carrier_off(), which will cause a kernel oops. In any case, we need to set pl->old_link_state to false to have the desired effect when there is no netdev present.
--- drivers/net/phy/phylink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/phy/phylink.c +4 -1
@@ -1333,7 +1333,10 @@ void phylink_suspend(struct phylink *pl, bool mac_wol)* but one would hope all packets have been sent. This * also means phylink_resolve() will do nothing. */ -netif_carrier_off (pl->netdev); +if (pl->netdev) +netif_carrier_off (pl->netdev); +else + pl->old_link_state = false;/* We do not call mac_link_down() here as we want the * link to remain up to receive the WoL packets.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 343/917 drm: bridge: it66121: Fix return value it66121_probe
In reply to Greg Kroah-HartmanFrom: Alex Bee <[email protected]>
[ Upstream commit f3bc07eba481942a246926c5b934199e7ccd567b ]
Currently it66121_probe returns -EPROBE_DEFER if the there is no remote endpoint found in the device tree which doesn't seem helpful, since this is not going to change later and it is never checked if the next bridge has been initialized yet. It will fail in that case later while doing drm_bridge_attach for the next bridge in it66121_bridge_attach.
Since the bindings documentation for it66121 bridge driver states there has to be a remote endpoint defined, its safe to return -EINVAL in that case.
This additonally adds a check, if the remote endpoint is enabled and returns -EPROBE_DEFER, if the remote bridge hasn't been initialized (yet).
--- drivers/gpu/drm/bridge/ite-it66121.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it66121.c +14 -2
@@ -918,11 +918,23 @@ static int it66121_probe(struct i2c_client *client,return -EINVAL ; ep =of_graph_get_remote_node (dev->of_node,1 ,-1 ); -if (!ep) -return -EPROBE_DEFER ; +if (!ep) { +dev_err (ctx->dev,"The endpoint is unconnected\n" ); +return -EINVAL ; + } + +if (!of_device_is_available (ep)) { +of_node_put (ep); +dev_err (ctx->dev,"The remote device is disabled\n" ); +return -ENODEV ; + } ctx->next_bridge =of_drm_find_bridge (ep);of_node_put (ep); +if (!ctx->next_bridge) { +dev_dbg (ctx->dev,"Next bridge not found, deferring probe\n" ); +return -EPROBE_DEFER ; + }if (!ctx->next_bridge)return -EPROBE_DEFER ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 347/917 wilc1000: fix possible memory leak in cfg_scan_result()
In reply to Greg Kroah-HartmanFrom: Ajay Singh <[email protected]>
[ Upstream commit 3c719fed0f3a5e95b1d164609ecc81c4191ade70 ]
When the BSS reference holds a valid reference, it is not freed. The 'if' condition is wrong. Instead of the 'if (bss)' check, the 'if (!bss)' check is used.
The issue is solved by removing the unnecessary 'if' check because cfg80211_put_bss() already performs the NULL validation.
--- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +1 -2
@@ -129,8 +129,7 @@ static void cfg_scan_result(enum scan_event scan_event, info->frame_len, (s32 )info->rssi *100 , GFP_KERNEL); -if (!bss) -cfg80211_put_bss (wiphy, bss); +cfg80211_put_bss (wiphy, bss); }else if (scan_event ==SCAN_EVENT_DONE ) {mutex_lock (&priv->scan_req_lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 351/917 drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
[ Upstream commit 6effad8abe0ba4db3d9c58ed585127858a990f35 ]
adev->rmmio is set to be NULL in amdgpu_device_unmap_mmio to prevent access after pci_remove, however, in SRIOV case, amdgpu_virt_release_full_gpu will still use adev->rmmio for access after amdgpu_device_unmap_mmio. The patch is to move such SRIOV calling earlier to fini_early stage.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -4
@@ -2745,6 +2745,11 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev) adev->ip_blocks[i].status.hw = false; } +if (amdgpu_sriov_vf (adev)) { +if (amdgpu_virt_release_full_gpu (adev, false)) +DRM_ERROR ("failed to release exclusive mode on fini\n" ); + } +return 0 ; }
@@ -2805,10 +2810,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)amdgpu_ras_fini (adev); -if (amdgpu_sriov_vf (adev)) -if (amdgpu_virt_release_full_gpu (adev, false)) -DRM_ERROR ("failed to release exclusive mode on fini\n" ); -return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 353/917 crypto: qat - power up 4xxx device
In reply to Greg Kroah-HartmanFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit ca605f97dae4bf070b7c584aec23c1c922e4d823 ]
After reset or boot, QAT 4xxx devices are inactive and require to be explicitly activated.
This is done by writing the DRV_ACTIVE bit in the PM_INTERRUPT register and polling the PM_INIT_STATE to make sure that the transaction has completed properly.
If this is not done, the driver will fail the initialization sequence reporting the following message:
[ 22.081193] 4xxx 0000:f7:00.0: enabling device (0140 -> 0142)
[ 22.720285] QAT: AE0 is inactive!!
[ 22.720287] QAT: failed to get device out of reset
[ 22.720288] 4xxx 0000:f7:00.0: qat_hal_clr_reset error
[ 22.720290] 4xxx 0000:f7:00.0: Failed to init the AEs
[ 22.720290] 4xxx 0000:f7:00.0: Failed to initialise Acceleration Engine
[ 22.720789] 4xxx 0000:f7:00.0: Resetting device qat_dev0
[ 22.825099] 4xxx: probe of 0000:f7:00.0 failed with error -14The patch also temporarily disables the power management source of interrupt, to avoid possible spurious interrupts as the power management feature is not fully supported.
The device init function has been added to adf_dev_init(), and not in the probe of 4xxx to make sure that the device is re-enabled in case of reset.
Note that the error code reported by hw_data->init_device() in adf_dev_init() has been shadowed for consistency with the other calls in the same function.
--- .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 31 +++++++++++++++++++ .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.h | 10 ++++++ .../crypto/qat/qat_common/adf_accel_devices.h | 1 + drivers/crypto/qat/qat_common/adf_init.c | 5 +++ 4 files changed, 47 insertions(+)
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c +31 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) /* Copyright(c) 2020 Intel Corporation */ +#include <linux/iopoll.h> #include <adf_accel_devices.h> #include <adf_common_drv.h> #include <adf_pf2vf_msg.h>
@@ -161,6 +162,35 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev)ADF_CSR_WR (addr,ADF_4XXX_SMIAPF_MASK_OFFSET ,0 ); } +static int adf_init_device (struct adf_accel_dev *accel_dev) +{ +void __iomem *addr; +u32 status; +u32 csr; +int ret; + + addr = (&GET_BARS (accel_dev)[ADF_4XXX_PMISC_BAR ])->virt_addr; + +/* Temporarily mask PM interrupt */ + csr =ADF_CSR_RD (addr,ADF_4XXX_ERRMSK2 ); + csr |=ADF_4XXX_PM_SOU ; +ADF_CSR_WR (addr,ADF_4XXX_ERRMSK2 , csr); + +/* Set DRV_ACTIVE bit to power up the device */ +ADF_CSR_WR (addr,ADF_4XXX_PM_INTERRUPT ,ADF_4XXX_PM_DRV_ACTIVE ); + +/* Poll status register to make sure the device is powered up */ + ret =read_poll_timeout (ADF_CSR_RD , status, + status &ADF_4XXX_PM_INIT_STATE , +ADF_4XXX_PM_POLL_DELAY_US , +ADF_4XXX_PM_POLL_TIMEOUT_US , true, addr, +ADF_4XXX_PM_STATUS ); +if (ret) +dev_err (&GET_DEV (accel_dev),"Failed to power up the device\n" ); + +return ret; +} +static int adf_enable_pf2vf_comms (struct adf_accel_dev *accel_dev) {return 0 ;
@@ -215,6 +245,7 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data) hw_data->exit_arb = adf_exit_arb; hw_data->get_arb_mapping = adf_get_arbiter_mapping; hw_data->enable_ints = adf_enable_ints; + hw_data->init_device = adf_init_device; hw_data->reset_device = adf_reset_flr; hw_data->admin_ae_mask =ADF_4XXX_ADMIN_AE_MASK ; hw_data->uof_get_num_objs = uof_get_num_objs;
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.h +10 -0
@@ -62,6 +62,16 @@#define ADF_4XXX_ADMINMSGLR_OFFSET (0x500578)#define ADF_4XXX_MAILBOX_BASE_OFFSET (0x600970) +/* Power management */ +#define ADF_4XXX_PM_POLL_DELAY_US 20 +#define ADF_4XXX_PM_POLL_TIMEOUT_US USEC_PER_SEC +#define ADF_4XXX_PM_STATUS (0x50A00C) +#define ADF_4XXX_PM_INTERRUPT (0x50A028) +#define ADF_4XXX_PM_DRV_ACTIVE BIT(20) +#define ADF_4XXX_PM_INIT_STATE BIT(21) +/* Power management source in ERRSOU2 and ERRMSK2 */ +#define ADF_4XXX_PM_SOU BIT(18) +/* Firmware Binaries */ #define ADF_4XXX_FW "qat_4xxx.bin"#define ADF_4XXX_MMP "qat_4xxx_mmp.bin"
drivers/crypto/qat/qat_common/adf_accel_devices.h +1 -0
@@ -166,6 +166,7 @@ struct adf_hw_device_data {int (*init_arb)(struct adf_accel_dev *accel_dev);void (*exit_arb)(struct adf_accel_dev *accel_dev);const u32 *(*get_arb_mapping)(void ); +int (*init_device)(struct adf_accel_dev *accel_dev);void (*disable_iov)(struct adf_accel_dev *accel_dev);void (*configure_iov_threads)(struct adf_accel_dev *accel_dev,bool enable);
drivers/crypto/qat/qat_common/adf_init.c +5 -0
@@ -79,6 +79,11 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)return -EFAULT ; } +if (hw_data->init_device && hw_data->init_device (accel_dev)) { +dev_err (&GET_DEV (accel_dev),"Failed to initialize device\n" ); +return -EFAULT ; + } +if (hw_data->init_admin_comms && hw_data->init_admin_comms (accel_dev)) {dev_err (&GET_DEV (accel_dev),"Failed initialize admin comms\n" );return -EFAULT ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 355/917 bnxt_en: Check devlink allocation and registration status
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e624c70e1131e145bd0510b8a700b5e2d112e377 ]
devlink is a software interface that doesn't depend on any hardware capabilities. The failure in SW means memory issues, wrong parameters, programmer error e.t.c.
Like any other such interface in the kernel, the returned status of devlink APIs should be checked and propagated further and not ignored.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++++- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 13 ++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 13 ------------- 3 files changed, 10 insertions(+), 21 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -1
@@ -13370,7 +13370,9 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) }bnxt_inv_fw_health_reg (bp); -bnxt_dl_register (bp); + rc =bnxt_dl_register (bp); +if (rc) + goto init_err_dl; rc =register_netdev (dev);if (rc)
@@ -13390,6 +13392,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) init_err_cleanup:bnxt_dl_unregister (bp); +init_err_dl:bnxt_shutdown_tc (bp);bnxt_clear_int_mode (bp);
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +6 -7
@@ -134,7 +134,7 @@ void bnxt_dl_fw_reporters_create(struct bnxt *bp) {struct bnxt_fw_health *health = bp->fw_health; -if (!bp->dl || !health) +if (!health)return ;if (!(bp->fw_cap &BNXT_FW_CAP_HOT_RESET ) || health->fw_reset_reporter)
@@ -188,7 +188,7 @@ void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all) {struct bnxt_fw_health *health = bp->fw_health; -if (!bp->dl || !health) +if (!health)return ; if ((all || !(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) &&
@@ -781,6 +781,7 @@ int bnxt_dl_register(struct bnxt *bp) {const struct devlink_ops *devlink_ops;struct devlink_port_attrs attrs = {}; +struct bnxt_dl *bp_dl;struct devlink *dl;int rc;
@@ -795,7 +796,9 @@ int bnxt_dl_register(struct bnxt *bp)return -ENOMEM ; } -bnxt_link_bp_to_dl (bp, dl); + bp->dl = dl; + bp_dl =devlink_priv (dl); + bp_dl->bp = bp;/* Add switchdev eswitch mode setting, if SRIOV supported */ if (pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV) &&
@@ -833,7 +836,6 @@ err_dl_port_unreg: err_dl_unreg:devlink_unregister (dl); err_dl_free: -bnxt_link_bp_to_dl (bp,NULL );devlink_free (dl);return rc; }
@@ -842,9 +844,6 @@ void bnxt_dl_unregister(struct bnxt *bp) {struct devlink *dl = bp->dl; -if (!dl) -return ; -if (BNXT_PF (bp)) {bnxt_dl_params_unregister (bp);devlink_port_unregister (&bp->dl_port);
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +0 -13
@@ -20,19 +20,6 @@ static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)return ((struct bnxt_dl *)devlink_priv (dl))->bp; } -/* To clear devlink pointer from bp, pass NULL dl */ -static inline void bnxt_link_bp_to_dl (struct bnxt *bp,struct devlink *dl) -{ - bp->dl = dl; - -/* add a back pointer in dl to bp */ -if (dl) { -struct bnxt_dl *bp_dl =devlink_priv (dl); - - bp_dl->bp = bp; - } -} -#define NVM_OFF_MSIX_VEC_PER_PF_MAX 108#define NVM_OFF_MSIX_VEC_PER_PF_MIN 114#define NVM_OFF_IGNORE_ARI 164
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 357/917 rxrpc: Fix _usecs_to_jiffies() by using usecs_to_jiffies()
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit acde891c243c1ed85b19d4d5042bdf00914f5739 ]
Directly using _usecs_to_jiffies() might be unsafe, so it's better to use usecs_to_jiffies() instead.
Because we can see that the result of _usecs_to_jiffies() could be larger than MAX_JIFFY_OFFSET values without the check of the input.
--- net/rxrpc/rtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/rtt.c +1 -1
@@ -22,7 +22,7 @@ static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer)static u32 __rxrpc_set_rto (const struct rxrpc_peer *peer) { -return _usecs_to_jiffies ((peer->srtt_us >>3 ) + peer->rttvar_us); +return usecs_to_jiffies ((peer->srtt_us >>3 ) + peer->rttvar_us); }static u32 rxrpc_bound_rto (u32 rto)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 358/917 mptcp: do not shrink snd_nxt when recovering
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 0d199e4363b482badcedba764e2aceab53a4a10a ]
When recovering after a link failure, snd_nxt should not be set to a lower value. Else, update of snd_nxt is broken because:
msk->snd_nxt += ret; (where ret is number of bytes sent)
assumes that snd_nxt always moves forward.
After reduction, its possible that snd_nxt update gets out of sync:
dfrag we just sent might have had a data sequence number even past recovery_snd_nxt.
This change factors the common msk state update to a helper and updates snd_nxt based on the current dfrag data sequence number.
The conditional is required for the recovery phase where we may re-transmit old dfrags that are before current snd_nxt.
After this change, snd_nxt only moves forward and covers all in-sequence data that was transmitted.
recovery_snd_nxt is retained to detect when recovery has completed.
--- net/mptcp/options.c | 8 +++----- net/mptcp/protocol.c | 43 +++++++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 17 deletions(-)
net/mptcp/options.c +3 -5
@@ -1019,11 +1019,9 @@ static void ack_update_msk(struct mptcp_sock *msk, old_snd_una = msk->snd_una; new_snd_una =mptcp_expand_seq (old_snd_una, mp_opt->data_ack, mp_opt->ack64); -/* ACK for data not even sent yet and even above recovery bound? Ignore.*/ -if (unlikely (after64 (new_snd_una, snd_nxt))) { -if (!msk->recovery ||after64 (new_snd_una, msk->recovery_snd_nxt)) - new_snd_una = old_snd_una; - } +/* ACK for data not even sent yet? Ignore.*/ +if (unlikely (after64 (new_snd_una, snd_nxt))) + new_snd_una = old_snd_una; new_wnd_end = new_snd_una +tcp_sk (ssk)->snd_wnd;
net/mptcp/protocol.c +31 -12
77 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 359/917 fortify: Fix dropped strcpy() compile-time write overflow check
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 072af0c638dc8a5c7db2edc4dddbd6d44bee3bdb ]
The implementation for intra-object overflow in str*-family functions accidentally dropped compile-time write overflow checking in strcpy(), leaving it entirely to run-time. Add back the intended check.
--- include/linux/fortify-string.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/fortify-string.h +4 -1
@@ -280,7 +280,10 @@ __FORTIFY_INLINE char *strcpy(char *p, const char *q)if (p_size == (size_t )-1 && q_size == (size_t )-1 )return __underlying_strcpy (p, q); size =strlen (q) +1 ; -/* test here to use the more stringent object size */ +/* Compile-time check for const size overflow. */ +if (__builtin_constant_p (size) && p_size < size) +__write_overflow (); +/* Run-time check for dynamic size overflow. */ if (p_size < size)fortify_panic (__func__);memcpy (p, q, size);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 361/917 cfg80211: always free wiphy specific regdomain
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit e53e9828a8d2c6545e01ff9711f1221f2fd199ce ]
In the (somewhat unlikely) event that we allocate a wiphy, then add a regdomain to it, and then fail registration, we leak the regdomain. Fix this by just always freeing it at the end, in the normal cases we'll free (and NULL) it during wiphy_unregister(). This happened when the wiphy settings were bad, and since they can be controlled by userspace with hwsim, syzbot was able to find this issue.
--- net/wireless/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/wireless/core.c +10 -0
@@ -1081,6 +1081,16 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)list_for_each_entry_safe (scan, tmp, &rdev->bss_list, list)cfg80211_put_bss (&rdev->wiphy, &scan->pub);mutex_destroy (&rdev->wiphy.mtx); + +/* +* The 'regd' can only be non-NULL if we never finished +* initializing the wiphy and thus never went through the +* unregister path - e.g. in failure scenarios. Thus, it +* cannot have been visible to anyone if non-NULL, so we +* can just free it here. +*/ +kfree (rcu_dereference_raw (rdev->wiphy.regd)); +kfree (rdev); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 373/917 drm/ttm: stop calling tt_swapin in vm_access
In reply to Greg Kroah-HartmanFrom: Matthew Auld <[email protected]>
[ Upstream commit f5d28856b89baab4232a9f841e565763fcebcdf9 ]
In commit:
commit 09ac4fcb3f255e9225967c75f5893325c116cdbe
Author: Felix Kuehling <[email protected]> Date: Thu Jul 13 17:01:16 2017 -0400
drm/ttm: Implement vm_operations_struct.access v2
we added the vm_access hook, where we also directly call tt_swapin for some reason. If something is swapped-out then the ttm_tt must also be unpopulated, and since access_kmap should also call tt_populate, if needed, then swapping-in will already be handled there.
If anything, calling tt_swapin directly here would likely always fail since the tt->pages won't yet be populated, or worse since the tt->pages array is never actually cleared in unpopulate this might lead to a nasty uaf.
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -5
@@ -519,11 +519,6 @@ int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,switch (bo->resource->mem_type) {case TTM_PL_SYSTEM : -if (unlikely (bo->ttm->page_flags &TTM_PAGE_FLAG_SWAPPED )) { - ret =ttm_tt_swapin (bo->ttm); -if (unlikely (ret !=0 )) -return ret; - } fallthrough;case TTM_PL_TT : ret =ttm_bo_vm_access_kmap (bo, offset, buf, len, write);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 379/917 media: cxd2880-spi: Fix a null pointer dereference on error handling path
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 11b982e950d2138e90bd120501df10a439006ff8 ]
Currently the null pointer check on dvb_spi->vcc_supply is inverted and this leads to only null values of the dvb_spi->vcc_supply being passed to the call of regulator_disable causing null pointer dereferences. Fix this by only calling regulator_disable if dvb_spi->vcc_supply is not null.
Addresses-Coverity: ("Dereference after null check")
--- drivers/media/spi/cxd2880-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/spi/cxd2880-spi.c +1 -1
@@ -618,7 +618,7 @@ fail_frontend: fail_attach:dvb_unregister_adapter (&dvb_spi->adapter); fail_adapter: -if (!dvb_spi->vcc_supply) +if (dvb_spi->vcc_supply)regulator_disable (dvb_spi->vcc_supply); fail_regulator:kfree (dvb_spi);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 395/917 scs: Release kasan vmalloc poison in scs_free process
In reply to Greg Kroah-HartmanFrom: Yee Lee <[email protected]>
[ Upstream commit 528a4ab45300fa6283556d9b48e26b45a8aa15c4 ]
Since scs allocation is moved to vmalloc region, the shadow stack is protected by kasan_posion_vmalloc. However, the vfree_atomic operation needs to access its context for scs_free process and causes kasan error as the dump info below.
This patch Adds kasan_unpoison_vmalloc() before vfree_atomic, which aligns to the prior flow as using kmem_cache. The vmalloc region will go back posioned in the following vumap() operations.
==================================================================
BUG: KASAN: vmalloc-out-of-bounds in llist_add_batch+0x60/0xd4
Write of size 8 at addr ffff8000100b9000 by task kthreadd/2
CPU: 0 PID: 2 Comm: kthreadd Not tainted 5.15.0-rc2-11681-g92477dd1faa6-dirty #1
Hardware name: linux,dummy-virt (DT)
Call trace:
dump_backtrace+0x0/0x43c
show_stack+0x1c/0x2c
dump_stack_lvl+0x68/0x84
print_address_description+0x80/0x394
kasan_report+0x180/0x1dc
__asan_report_store8_noabort+0x48/0x58
llist_add_batch+0x60/0xd4
vfree_atomic+0x60/0xe0
scs_free+0x1dc/0x1fc
scs_release+0xa4/0xd4
free_task+0x30/0xe4
__put_task_struct+0x1ec/0x2e0
delayed_put_task_struct+0x5c/0xa0
rcu_do_batch+0x62c/0x8a0
rcu_core+0x60c/0xc14
rcu_core_si+0x14/0x24
__do_softirq+0x19c/0x68c
irq_exit+0x118/0x2dc
handle_domain_irq+0xcc/0x134
gic_handle_irq+0x7c/0x1bc
call_on_irq_stack+0x40/0x70
do_interrupt_handler+0x78/0x9c
el1_interrupt+0x34/0x60
el1h_64_irq_handler+0x1c/0x2c
el1h_64_irq+0x78/0x7c
_raw_spin_unlock_irqrestore+0x40/0xcc
sched_fork+0x4f0/0xb00
copy_process+0xacc/0x3648
kernel_clone+0x168/0x534
kernel_thread+0x13c/0x1b0
kthreadd+0x2bc/0x400
ret_from_fork+0x10/0x20
Memory state around the buggy address:
ffff8000100b8f00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffff8000100b8f80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>ffff8000100b9000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
^
ffff8000100b9080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffff8000100b9100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================--- kernel/scs.c | 1 + 1 file changed, 1 insertion(+)
kernel/scs.c +1 -0
@@ -78,6 +78,7 @@ void scs_free(void *s)if (this_cpu_cmpxchg (scs_cache[i],0 , s) ==NULL )return ; +kasan_unpoison_vmalloc (s,SCS_SIZE );vfree_atomic (s); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 396/917 kprobes: Do not use local variable when creating debugfs file
In reply to Greg Kroah-HartmanFrom: Punit Agrawal <[email protected]>
[ Upstream commit 8f7262cd66699a4b02eb7549b35c81b2116aad95 ]
debugfs_create_file() takes a pointer argument that can be used during file operation callbacks (accessible via i_private in the inode structure). An obvious requirement is for the pointer to refer to valid memory when used.
When creating the debugfs file to dynamically enable / disable kprobes, a pointer to local variable is passed to debugfs_create_file(); which will go out of scope when the init function returns. The reason this hasn't triggered random memory corruption is because the pointer is not accessed during the debugfs file callbacks.
Since the enabled state is managed by the kprobes_all_disabled global variable, the local variable is not needed. Fix the incorrect (and unnecessary) usage of local variable during debugfs_file_create() by passing NULL instead.
--- kernel/kprobes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/kprobes.c +1 -2
@@ -2809,13 +2809,12 @@ static const struct file_operations fops_kp = {static int __init debugfs_kprobe_init (void ) {struct dentry *dir; -unsigned int value =1 ; dir =debugfs_create_dir ("kprobes" ,NULL );debugfs_create_file ("list" ,0400 , dir,NULL , &kprobes_fops); -debugfs_create_file ("enabled" ,0600 , dir, &value, &fops_kp); +debugfs_create_file ("enabled" ,0600 , dir,NULL , &fops_kp);debugfs_create_file ("blacklist" ,0400 , dir,NULL , &kprobe_blacklist_fops);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 404/917 x86/insn: Use get_unaligned() instead of memcpy()
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit f96b4675839b66168f5a07bf964dde6c2f1c4885 ]
Use get_unaligned() instead of memcpy() to access potentially unaligned memory, which, when accessed through a pointer, leads to undefined behavior. get_unaligned() describes much better what is happening there anyway even if memcpy() does the job.
In addition, since perf tool builds with -Werror, it would fire with:
util/intel-pt-decoder/../../../arch/x86/lib/insn.c: In function '__insn_get_emulate_prefix':
tools/include/../include/asm-generic/unaligned.h:10:15: error: packed attribute is unnecessary [-Werror=packed]
10 | const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \because -Werror=packed would complain if the packed attribute would have no effect on the layout of the structure.
In this case, that is intentional so disable the warning only for that compilation unit.
That part is Reported-by: Stephen Rothwell <[email protected]>
No functional changes.
--- arch/x86/lib/insn.c | 5 +++-- tools/arch/x86/lib/insn.c | 5 +++-- tools/include/asm-generic/unaligned.h | 23 +++++++++++++++++++++++ tools/perf/util/intel-pt-decoder/Build | 2 ++ 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tools/include/asm-generic/unaligned.h
arch/x86/lib/insn.c +3 -2
@@ -13,6 +13,7 @@#endif #include <asm/inat.h> /*__ignore_sync_check__ */ #include <asm/insn.h> /* __ignore_sync_check__ */ +#include <asm/unaligned.h> /* __ignore_sync_check__ */ #include <linux/errno.h> #include <linux/kconfig.h>
@@ -37,10 +38,10 @@ ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr)#define __get_next (t, insn) \ - ({ t r; memcpy(&r, insn->next_byte, sizeof(t)); insn->next_byte += sizeof(t); leXX_to_cpu(t, r); }) + ({ t r = get_unaligned((t *)(insn)->next_byte); (insn)->next_byte += sizeof(t); leXX_to_cpu(t, r); })#define __peek_nbyte_next (t, insn, n) \ - ({ t r; memcpy(&r, (insn)->next_byte + n, sizeof(t)); leXX_to_cpu(t, r); }) + ({ t r = get_unaligned((t *)(insn)->next_byte + n); leXX_to_cpu(t, r); })#define get_next (t, insn) \ ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
tools/arch/x86/lib/insn.c +3 -2
@@ -13,6 +13,7 @@#endif #include "../include/asm/inat.h" /* __ignore_sync_check__ */ #include "../include/asm/insn.h" /* __ignore_sync_check__ */ +#include "../include/asm-generic/unaligned.h" /* __ignore_sync_check__ */ #include <linux/errno.h> #include <linux/kconfig.h>
@@ -37,10 +38,10 @@ ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr)#define __get_next (t, insn) \ - ({ t r; memcpy(&r, insn->next_byte, sizeof(t)); insn->next_byte += sizeof(t); leXX_to_cpu(t, r); }) + ({ t r = get_unaligned((t *)(insn)->next_byte); (insn)->next_byte += sizeof(t); leXX_to_cpu(t, r); })#define __peek_nbyte_next (t, insn, n) \ - ({ t r; memcpy(&r, (insn)->next_byte + n, sizeof(t)); leXX_to_cpu(t, r); }) + ({ t r = get_unaligned((t *)(insn)->next_byte + n); leXX_to_cpu(t, r); })#define get_next (t, insn) \ ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
tools/include/asm-generic/unaligned.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copied from the kernel sources to tools/perf/: +*/ + +#ifndef __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H +#define __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H + +#define __get_unaligned_t (type, ptr) ({ \ + const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ + __pptr->x; \ +}) + +#define __put_unaligned_t (type, val, ptr) do { \ + struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ + __pptr->x = (val); \ +} while (0) + +#define get_unaligned (ptr) __get_unaligned_t(typeof(*(ptr)), (ptr)) +#define put_unaligned (val, ptr) __put_unaligned_t(typeof(*(ptr)), (val), (ptr)) + +#endif /* __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H */ +
tools/perf/util/intel-pt-decoder/Build +2 -0
@@ -18,3 +18,5 @@ CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder ifeq ($(CC_NO_CLANG), 1) CFLAGS_intel-pt-insn-decoder.o += -Wno-override-init endif + +CFLAGS_intel-pt-insn-decoder.o += -Wno-packed
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 407/917 rcu: Fix rcu_dynticks_curr_cpu_in_eqs() vs noinstr
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 74aece72f95f399dd29363669dc32a1344c8fab4 ]
vmlinux.o: warning: objtool: rcu_nmi_enter()+0x36: call to __kasan_check_read() leaves .noinstr.text section
noinstr cannot have atomic_*() functions in because they're explicitly annotated, use arch_atomic_*().
--- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
@@ -327,7 +327,7 @@ static void rcu_dynticks_eqs_online(void)*/ static __always_inline bool rcu_dynticks_curr_cpu_in_eqs(void) { -return !(atomic_read (this_cpu_ptr (&rcu_data.dynticks)) &0x1 ); +return !(arch_atomic_read (this_cpu_ptr (&rcu_data.dynticks)) &0x1 ); }/*
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 411/917 crypto: ccree - avoid out-of-range warnings from clang
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit cfd6fb45cfaf46fa9547421d8da387dc9c7997d4 ]
clang points out inconsistencies in the FIELD_PREP() invocation in this driver that result from the 'mask' being a 32-bit value:
drivers/crypto/ccree/cc_driver.c:117:18: error: result of comparison of constant 18446744073709551615 with expression of type 'u32' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
cache_params |= FIELD_PREP(mask, val);
^~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:3: note: expanded from macro 'FIELD_PREP'
__BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:52:28: note: expanded from macro '__BF_FIELD_CHECK'
BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This does not happen in other places that just pass a constant here.
Work around the warnings by widening the type of the temporary variable.
--- drivers/crypto/ccree/cc_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/ccree/cc_driver.c +2 -1
@@ -103,7 +103,8 @@ MODULE_DEVICE_TABLE(of, arm_ccree_dev_of_match);static void init_cc_cache_params (struct cc_drvdata *drvdata) {struct device *dev =drvdata_to_dev (drvdata); -u32 cache_params, ace_const, val, mask; +u32 cache_params, ace_const, val; +u64 mask;/* compute CC_AXIM_CACHE_PARAMS */ cache_params =cc_ioread (drvdata,CC_REG (AXIM_CACHE_PARAMS ));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 275/917 block: remove inaccurate requeue check
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 037057a5a979c7eeb2ee5d12cf4c24b805192c75 ]
This check is meant to catch cases where a requeue is attempted on a request that is still inserted. It's never really been useful to catch any misuse, and now it's actively wrong. Outside of that, this should not be a BUG_ON() to begin with.
Remove the check as it's now causing active harm, as requeue off the plug path will trigger it even though the request state is just fine.
--- block/blk-mq.c | 1 - 1 file changed, 1 deletion(-)
block/blk-mq.c +0 -1
@@ -763,7 +763,6 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list)/* this request will be re-inserted to io scheduler queue */ blk_mq_sched_requeue_request (rq); -BUG_ON (!list_empty (&rq->queuelist));blk_mq_add_to_requeue_list (rq, true, kick_requeue_list); }EXPORT_SYMBOL (blk_mq_requeue_request);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 360/917 mac80211: twt: dont use potentially unaligned pointer
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 7ff379ba2d4b7b205240e666601fe302207d73f8 ]
Since we're pointing into a frame, the pointer to the twt_agrt->req_type struct member is potentially not aligned properly. Open-code le16p_replace_bits() to avoid passing an unaligned pointer.
--- net/mac80211/s1g.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/mac80211/s1g.c +5 -3
@@ -104,9 +104,11 @@ ieee80211_s1g_rx_twt_setup(struct ieee80211_sub_if_data *sdata,/* broadcast TWT not supported yet */ if (twt->control &IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST ) { -le16p_replace_bits (&twt_agrt->req_type, -TWT_SETUP_CMD_REJECT , -IEEE80211_TWT_REQTYPE_SETUP_CMD ); + twt_agrt->req_type &= + ~cpu_to_le16 (IEEE80211_TWT_REQTYPE_SETUP_CMD ); + twt_agrt->req_type |= +le16_encode_bits (TWT_SETUP_CMD_REJECT , +IEEE80211_TWT_REQTYPE_SETUP_CMD ); goto out; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 377/917 media: em28xx: add missing em28xx_close_extension
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2c98b8a3458df03abdc6945bbef67ef91d181938 ]
If em28xx dev has ->dev_next pointer, we need to delete ->dev_next list node from em28xx_extension_devlist on disconnect to avoid UAF bugs and corrupted list bugs, since driver frees this pointer on disconnect.
--- drivers/media/usb/em28xx/em28xx-cards.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/usb/em28xx/em28xx-cards.c +4 -1
@@ -4139,8 +4139,11 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)em28xx_close_extension (dev); -if (dev->dev_next) +if (dev->dev_next) { +em28xx_close_extension (dev->dev_next);em28xx_release_resources (dev->dev_next); + } +em28xx_release_resources (dev);if (dev->dev_next) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 410/917 media: dvb-frontends: mn88443x: Handle errors of clk_prepare_enable()
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 69a10678e2fba3d182e78ea041f2d1b1a6058764 ]
mn88443x_cmn_power_on() did not handle possible errors of clk_prepare_enable() and always finished successfully so that its caller mn88443x_probe() did not care about failed preparing/enabling of clocks as well.
Add missed error handling in both mn88443x_cmn_power_on() and mn88443x_probe(). This required to change the return value of the former from "void" to "int".
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/dvb-frontends/mn88443x.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/mn88443x.c +15 -3
@@ -204,11 +204,18 @@ struct mn88443x_priv {struct regmap *regmap_t; }; -static void mn88443x_cmn_power_on (struct mn88443x_priv *chip) +static int mn88443x_cmn_power_on (struct mn88443x_priv *chip) { +struct device *dev = &chip->client_s->dev;struct regmap *r_t = chip->regmap_t; +int ret; -clk_prepare_enable (chip->mclk); + ret =clk_prepare_enable (chip->mclk); +if (ret) { +dev_err (dev,"Failed to prepare and enable mclk: %d\n" , + ret); +return ret; + }gpiod_set_value_cansleep (chip->reset_gpio,1 );usleep_range (100 ,1000 );
@@ -222,6 +229,8 @@ static void mn88443x_cmn_power_on(struct mn88443x_priv *chip) }else {regmap_write (r_t,HIZSET3 ,0x8f ); } + +return 0 ; }static void mn88443x_cmn_power_off (struct mn88443x_priv *chip)
@@ -738,7 +747,10 @@ static int mn88443x_probe(struct i2c_client *client, chip->fe.demodulator_priv = chip;i2c_set_clientdata (client, chip); -mn88443x_cmn_power_on (chip); + ret =mn88443x_cmn_power_on (chip); +if (ret) + goto err_i2c_t; +mn88443x_s_sleep (chip);mn88443x_t_sleep (chip);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 412/917 crypto: qat - detect PFVF collision after ACK
In reply to Greg Kroah-HartmanFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 9b768e8a3909ac1ab39ed44a3933716da7761a6f ]
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.
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +7 -0
@@ -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;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 414/917 hwrng: mtk - Force runtime pm ops for sleep ops
In reply to Greg Kroah-HartmanFrom: Markus Schneider-Pargmann <[email protected]>
[ Upstream commit b6f5f0c8f72d348b2d07b20d7b680ef13a7ffe98 ]
Currently mtk_rng_runtime_suspend/resume is called for both runtime pm and system sleep operations.
This is wrong as these should only be runtime ops as the name already suggests. Currently freezing the system will lead to a call to mtk_rng_runtime_suspend even if the device currently isn't active. This leads to a clock warning because it is disabled/unprepared although it isn't enabled/prepared currently.
This patch fixes this by only setting the runtime pm ops and forces to call the runtime pm ops from the system sleep ops as well if active but not otherwise.
--- drivers/char/hw_random/mtk-rng.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/char/hw_random/mtk-rng.c +7 -2
@@ -166,8 +166,13 @@ static int mtk_rng_runtime_resume(struct device *dev)return mtk_rng_init (&priv->rng); } -static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend, - mtk_rng_runtime_resume, NULL); +static const struct dev_pm_ops mtk_rng_pm_ops = { + SET_RUNTIME_PM_OPS(mtk_rng_runtime_suspend, + mtk_rng_runtime_resume, NULL) +SET_SYSTEM_SLEEP_PM_OPS (pm_runtime_force_suspend, + pm_runtime_force_resume) +}; +#define MTK_RNG_PM_OPS (&mtk_rng_pm_ops)#else /* CONFIG_PM */ #define MTK_RNG_PM_OPS NULL
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 418/917 gve: Recover from queue stall due to missed IRQ
In reply to Greg Kroah-HartmanFrom: John Fraker <[email protected]>
[ Upstream commit 87a7f321bb6a45e54b7d6c90d032ee5636a6ad97 ]
Don't always reset the driver on a TX timeout. Attempt to recover by kicking the queue in case an IRQ was missed.
--- drivers/net/ethernet/google/gve/gve.h | 4 +- drivers/net/ethernet/google/gve/gve_adminq.h | 1 + drivers/net/ethernet/google/gve/gve_main.c | 48 +++++++++++++++++++- 3 files changed, 51 insertions(+), 2 deletions(-)
drivers/net/ethernet/google/gve/gve.h +3 -1
@@ -30,7 +30,7 @@#define GVE_MIN_MSIX 3/* Numbers of gve tx/rx stats in stats report. */ -#define GVE_TX_STATS_REPORT_NUM 5 +#define GVE_TX_STATS_REPORT_NUM 6#define GVE_RX_STATS_REPORT_NUM 2/* Interval to schedule a stats report update, 20000ms. */
@@ -413,7 +413,9 @@ struct gve_tx_ring {u32 q_num____cacheline_aligned ;/* queue idx */ u32 stop_queue;/* count of queue stops */ u32 wake_queue;/* count of queue wakes */ +u32 queue_timeout;/* count of queue timeouts */ u32 ntfy_id;/* notification block index */ +u32 last_kick_msec;/* Last time the queue was kicked */ dma_addr_t bus;/* dma address of the descr ring */ dma_addr_t q_resources_bus;/* dma address of the queue resources */ dma_addr_t complq_bus_dqo;/* dma address of the dqo.compl_ring */
drivers/net/ethernet/google/gve/gve_adminq.h +1 -0
@@ -270,6 +270,7 @@ enum gve_stat_names {TX_LAST_COMPLETION_PROCESSED =5 ,RX_NEXT_EXPECTED_SEQUENCE =6 ,RX_BUFFERS_POSTED =7 , +TX_TIMEOUT_CNT =8 ,// stats from NIC RX_QUEUE_DROP_CNT =65 , RX_NO_BUFFERS_POSTED = 66,
drivers/net/ethernet/google/gve/gve_main.c +47 -1
68 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 426/917 hwmon: (pmbus/lm25066) Let compiler determine outer dimension of lm25066_coeff
In reply to Greg Kroah-HartmanFrom: Zev Weiss <[email protected]>
[ Upstream commit b7931a7b0e0df4d2a25fedd895ad32c746b77bc1 ]
Maintaining this manually is error prone (there are currently only five chips supported, not six); gcc can do it for us automatically.
--- drivers/hwmon/pmbus/lm25066.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/lm25066.c +1 -1
@@ -51,7 +51,7 @@ struct __coeff {#define PSC_CURRENT_IN_L (PSC_NUM_CLASSES)#define PSC_POWER_L (PSC_NUM_CLASSES + 1) -static struct __coeff lm25066_coeff[6 ][PSC_NUM_CLASSES +2 ] = { +static struct __coeff lm25066_coeff[][PSC_NUM_CLASSES +2 ] = { [lm25056] = { [PSC_VOLTAGE_IN ] = { .m =16296 ,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 439/917 drm/msm: unlock on error in get_sched_entity()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7425e8167507fe512d8ac0825acda4aebf0a7ca0 ]
Add a missing unlock on the error path if drm_sched_entity_init() fails.
--- drivers/gpu/drm/msm/msm_submitqueue.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/msm_submitqueue.c +1 -0
@@ -101,6 +101,7 @@ get_sched_entity(struct msm_file_private *ctx, struct msm_ringbuffer *ring, ret =drm_sched_entity_init (entity, sched_prio, &sched,1 ,NULL );if (ret) { +mutex_unlock (&entity_lock);kfree (entity);return ERR_PTR (ret); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 448/917 io-wq: Remove duplicate code in io_workqueue_create()
In reply to Greg Kroah-HartmanFrom: Bixuan Cui <[email protected]>
[ Upstream commit 71e1cef2d794338cc7b979d4c6144e1dc12718b5 ]
While task_work_add() in io_workqueue_create() is true, then duplicate code is executed:
-> clear_bit_unlock(0, &worker->create_state); -> io_worker_release(worker); -> atomic_dec(&acct->nr_running); -> io_worker_ref_put(wq); -> return false; -> clear_bit_unlock(0, &worker->create_state); // back to io_workqueue_create() -> io_worker_release(worker); -> kfree(worker);
The io_worker_release() and clear_bit_unlock() are executed twice.
--- fs/io-wq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/io-wq.c +4 -5
@@ -359,8 +359,10 @@ static bool io_queue_worker_create(struct io_worker *worker,init_task_work (&worker->create_work, func); worker->create_index = acct->index; -if (!task_work_add (wq->task, &worker->create_work,TWA_SIGNAL )) +if (!task_work_add (wq->task, &worker->create_work,TWA_SIGNAL )) { +clear_bit_unlock (0 , &worker->create_state);return true; + }clear_bit_unlock (0 , &worker->create_state); fail_release:io_worker_release (worker);
@@ -765,11 +767,8 @@ static void io_workqueue_create(struct work_struct *work) struct io_worker *worker = container_of(work, struct io_worker, work);struct io_wqe_acct *acct =io_wqe_get_acct (worker); -if (!io_queue_worker_create (worker, acct, create_worker_cont)) { -clear_bit_unlock (0 , &worker->create_state); -io_worker_release (worker); +if (!io_queue_worker_create (worker, acct, create_worker_cont))kfree (worker); - } }static bool create_io_worker (struct io_wq *wq,struct io_wqe *wqe,int index)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 451/917 platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit fd96e35ea7b95f1e216277805be89d66e4ae962d ]
A new warning in clang points out a use of bitwise OR with boolean expressions in this driver:
drivers/platform/x86/thinkpad_acpi.c:9061:11: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
else if ((strlencmp(cmd, "level disengaged") == 0) |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
||drivers/platform/x86/thinkpad_acpi.c:9061:11: note: cast one or both operands to int to silence this warning 1 error generated.
This should clearly be a logical OR so change it to fix the warning.
--- drivers/platform/x86/thinkpad_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +1 -1
@@ -9145,7 +9145,7 @@ static int fan_write_cmd_level(const char *cmd, int *rc)if (strlencmp (cmd,"level auto" ) ==0 ) level =TP_EC_FAN_AUTO ; -else if ((strlencmp (cmd,"level disengaged" ) ==0 ) | +else if ((strlencmp (cmd,"level disengaged" ) ==0 ) || (strlencmp (cmd,"level full-speed" ) ==0 )) level =TP_EC_FAN_FULLSPEED ;else if (sscanf (cmd,"level %d" , &level) !=1 )
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 457/917 mt76: mt7921: fix endianness in mt7921_mcu_tx_done_event
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit df040215c077de0c13aab12c222bd0360a0d3988 ]
Fix endianness in mt7921_mcu_tx_done_event event reported by the firmware.
--- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7921/mcu.h | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +2 -1
@@ -532,7 +532,8 @@ mt7921_mcu_tx_done_event(struct mt7921_dev *dev, struct sk_buff *skb) peer.g8 = !!(sta->vht_cap.cap &IEEE80211_VHT_CAP_SHORT_GI_80 ); peer.g16 = !!(sta->vht_cap.cap &IEEE80211_VHT_CAP_SHORT_GI_160 );mt7921_mcu_tx_rate_parse (mphy->mt76, &peer, - &msta->stats.tx_rate, event->tx_rate); + &msta->stats.tx_rate, +le16_to_cpu (event->tx_rate));spin_lock_bh (&dev->sta_poll_lock);break ;
drivers/net/wireless/mediatek/mt76/mt7921/mcu.h +5 -5
@@ -296,11 +296,11 @@ struct mt7921_txpwr_event {struct mt7921_mcu_tx_done_event {u8 pid;u8 status; -u16 seq; +__le16 seq;u8 wlan_idx;u8 tx_cnt; -u16 tx_rate; +__le16 tx_rate;u8 flag;u8 tid;
@@ -312,9 +312,9 @@ struct mt7921_mcu_tx_done_event {u8 reason;u8 rsv0[1 ]; -u32 delay; -u32 timestamp; -u32 applied_flag; +__le32 delay; +__le32 timestamp; +__le32 applied_flag;u8 txs[28 ];
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 458/917 mt76: mt7915: fix endianness warning in mt7915_mac_add_txs_skb
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 08b3c8da87aed4200dab00906f149d675ca90f23 ]
Fix the following sparse warning in mt7915_mac_add_txs_skb routine:
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1235:29:
warning: cast to restricted __le32drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1235:23:
warning: restricted __le32 degrades to integer
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1 -1
@@ -1232,7 +1232,7 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid, goto out; info =IEEE80211_SKB_CB (skb); -if (!(txs_data[0 ] &le32_to_cpu (MT_TXS0_ACK_ERROR_MASK ))) +if (!(txs_data[0 ] &cpu_to_le32 (MT_TXS0_ACK_ERROR_MASK ))) info->flags |=IEEE80211_TX_STAT_ACK ; info->status.ampdu_len =1 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 462/917 mt76: connac: fix mt76_connac_gtk_rekey_tlv usage
In reply to Greg Kroah-HartmanFrom: Leon Yen <[email protected]>
[ Upstream commit d741abeafa47a7331cd4fe526e44db4ad3da0f62 ]
The mistaken structure is introduced since we added the GTK rekey offload to mt7663. The patch fixes mt76_connac_gtk_rekey_tlv structure according to the MT7663 and MT7921 firmware we have submitted into linux-firmware.git.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +3 -3
@@ -844,14 +844,14 @@ struct mt76_connac_gtk_rekey_tlv {* 2: rekey update */ u8 keyid; -u8 pad[2 ]; +u8 option;/* 1: rekey data update without enabling offload */ +u8 pad[1 ];__le32 proto;/* WPA-RSN-WAPI-OPSN */ __le32 pairwise_cipher;__le32 group_cipher;__le32 key_mgmt;/* NONE-PSK-IEEE802.1X */ __le32 mgmt_group_cipher; -u8 option;/* 1: rekey data update without enabling offload */ -u8 reserverd[3 ]; +u8 reserverd[4 ]; } __packed;#define MT76_CONNAC_WOW_MASK_MAX_LEN 16
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 468/917 mt76: mt7915: fix bit fields for HT rate idx
In reply to Greg Kroah-HartmanFrom: Shayne Chen <[email protected]>
[ Upstream commit 47f1c08db7f3aaa2d13f8e56209375462ace7b8a ]
The bit fields of tx rate idx should be 6 bits, otherwise it might be incorrect in HT mode.
For VHT/HE rates, only 4 bits are actually used by rate idx, the other 2 bits are used for other functions.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.h +2 -1
@@ -272,7 +272,8 @@ enum tx_mcu_port_q_idx {#define MT_TX_RATE_MODE GENMASK(9, 6)#define MT_TX_RATE_SU_EXT_TONE BIT(5)#define MT_TX_RATE_DCM BIT(4) -#define MT_TX_RATE_IDX GENMASK(3, 0) +/* VHT/HE only use bits 0-3 */ +#define MT_TX_RATE_IDX GENMASK(5, 0)#define MT_TXP_MAX_BUF_NUM 6
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 469/917 mt76: mt7921: fix dma hang in rmmod
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit a23f80aa9c5e6ad4ec8df88037b7ffd4162b1ec4 ]
The dma would be broken after rmmod flow. There are two different cases causing this issue.
1. dma access without privilege.
2. hw access sequence borken by another context.
This patch handle both cases to avoid hw crash.
--- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/init.c +9 -0
@@ -251,8 +251,17 @@ int mt7921_register_device(struct mt7921_dev *dev)void mt7921_unregister_device (struct mt7921_dev *dev) { +int i; +struct mt76_connac_pm *pm = &dev->pm; +mt76_unregister_device (&dev->mt76); +mt76_for_each_q_rx (&dev->mt76, i) +napi_disable (&dev->mt76.napi[i]); +cancel_delayed_work_sync (&pm->ps_work); +cancel_work_sync (&pm->wake_work); +mt7921_tx_token_put (dev); +mt7921_mcu_drv_pmctrl (dev);mt7921_dma_cleanup (dev);mt7921_mcu_exit (dev);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 481/917 mt76: connac: fix possible NULL pointer dereference in mt76_connac_get_phy_mode_v2
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit b5f2ba8a4c794e8349c0e30036352b9f685164c4 ]
Fix the following NULL pointer dereference in mt76_connac_get_phy_mode_v2 routine triggered on mt7663s device when sta is NULL
[ 5.490700] mt7663s mmc0:0001:1: N9 Firmware Version: 3.1.1, Build Time: 20200604161656 [ 5.490815] mt7663s mmc0:0001:1: Region number: 0x4 [ 5.490868] mt7663s mmc0:0001:1: Parsing tailer Region: 0 [ 5.496251] mt7663s mmc0:0001:1: Region 0, override_addr = 0x00118000 [ 5.496419] mt7663s mmc0:0001:1: Parsing tailer Region: 1 [ 5.624027] mt7663s mmc0:0001:1: Parsing tailer Region: 2 [ 5.656999] mt7663s mmc0:0001:1: Parsing tailer Region: 3 [ 5.671876] mt7663s mmc0:0001:1: override_addr = 0x00118000, option = 3 [ 9.358658] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 9.358775] #PF: supervisor read access in kernel mode [ 9.358831] #PF: error_code(0x0000) - not-present page [ 9.358886] PGD 0 P4D 0 [ 9.358917] Oops: 0000 [#1] SMP [ 9.358960] CPU: 0 PID: 235 Comm: NetworkManager Not tainted 5.15.0-rc4-kvm-02151-g39e333d657f4-dirty #769 [ 9.359057] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-4.fc34 04/01/2014 [ 9.359150] RIP: 0010:mt76_connac_get_phy_mode_v2+0xc9/0x11c [ 9.359473] RAX: 0000000000000013 RBX: 0000000000000000 RCX: 0000000000000027 [ 9.359546] RDX: ffff8881f9c17358 RSI: 0000000000000001 RDI: ffff8881f9c17350 [ 9.359624] RBP: ffff88810bac1ed4 R08: ffffffff822a4a48 R09: 0000000000000003 [ 9.359697] R10: ffffffff82234a60 R11: ffffffff82234a60 R12: ffff88810bac1eec [ 9.359779] R13: 0000000000000000 R14: ffff88810bad1648 R15: ffff88810bac1eb8 [ 9.359859] FS: 00007f5f1e45bbc0(0000) GS:ffff8881f9c00000(0000) knlGS:0000000000000000 [ 9.359939] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9.360003] CR2: 0000000000000000 CR3: 0000000105d5d000 CR4: 00000000000006b0 [ 9.360083] Call Trace: [ 9.360116] mt76_connac_mcu_uni_add_bss.cold+0x21/0x250 [ 9.360175] ? schedule_preempt_disabled+0xa/0x10 [ 9.360232] ? __mutex_lock.constprop.0+0x2ab/0x460 [ 9.360286] mt7615_remove_interface+0x63/0x1d0 [ 9.360342] drv_remove_interface+0x32/0xe0 [ 9.360385] ieee80211_do_stop+0x5da/0x800 [ 9.360428] ? dev_reset_queue+0x30/0x90 [ 9.360472] ieee80211_stop+0x3b/0xb0 [ 9.360516] __dev_close_many+0x7a/0xd0 [ 9.360559] __dev_change_flags+0xd6/0x1f0 [ 9.360604] dev_change_flags+0x21/0x60 [ 9.360648] do_setlink+0x259/0xfb0 [ 9.360686] ? __nla_validate_parse+0x51/0xb80 [ 9.360742] __rtnl_newlink+0x5b3/0x960 [ 9.360785] ? inet6_fill_ifla6_attrs+0x41d/0x470 [ 9.360841] ? __kmalloc_track_caller+0x57/0x3c0 [ 9.360905] ? netlink_trim+0x8a/0xb0 [ 9.360949] ? skb_queue_tail+0x1b/0x50
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +2 -2
@@ -689,7 +689,7 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,if (ht_cap->ht_supported) mode |=PHY_TYPE_BIT_HT ; -if (he_cap->has_he) +if (he_cap && he_cap->has_he) mode |=PHY_TYPE_BIT_HE ; }else if (band ==NL80211_BAND_5GHZ ) { mode |=PHY_TYPE_BIT_OFDM ;
@@ -700,7 +700,7 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,if (vht_cap->vht_supported) mode |=PHY_TYPE_BIT_VHT ; -if (he_cap->has_he) +if (he_cap && he_cap->has_he) mode |=PHY_TYPE_BIT_HE ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 480/917 mt76: mt7615: fix monitor mode tear down crash
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit a6fdbdd1ac2996a58a84672ef37efb5cbb98fadf ]
[ 103.451600] CPU 3 Unable to handle kernel paging request at virtual address 00000003, epc == 8576591c, ra == 857659f0 [ 103.462226] Oops[#1]: [ 103.464499] CPU: 3 PID: 9247 Comm: ifconfig Tainted: G W 5.4.143 #0 [ 103.472031] $ 0 : 00000000 00000001 83be3854 00000000 [ 103.477239] $ 4 : 8102a374 8102a374 8102f0b0 00000200 [ 103.482444] $ 8 : 0000002d 000001e4 64373765 5d206337 [ 103.487647] $12 : 00000000 00000005 00000000 0006d1df [ 103.492853] $16 : 83be3848 853838a8 8743d600 00010000 [ 103.498059] $20 : 00000000 00000000 8553dec0 0000007f [ 103.503266] $24 : 00000003 80382084 [ 103.508472] $28 : 831d4000 831d5bc0 00000001 857659f0 [ 103.513678] Hi : 00000122 [ 103.516543] Lo : d1768000 [ 103.519452] epc : 8576591c mt7615_mcu_add_bss+0xd0/0x3c0 [mt7615_common] [ 103.526306] ra : 857659f0 mt7615_mcu_add_bss+0x1a4/0x3c0 [mt7615_common] [ 103.533232] Status: 11007c03 KERNEL EXL IE [ 103.537402] Cause : 40800008 (ExcCode 02) [ 103.541389] BadVA : 00000003 [ 103.544253] PrId : 0001992f (MIPS 1004Kc) [ 103.797086] Call Trace: [ 103.799562] [<8576591c>] mt7615_mcu_add_bss+0xd0/0x3c0 [mt7615_common] [ 103.806082] [<85760a14>] mt7615_remove_interface+0x74/0x1e0 [mt7615_common] [ 103.813280] [<85603fcc>] drv_remove_interface+0x2c/0xa0 [mac80211] [ 103.819612] [<8561a8e4>] ieee80211_del_virtual_monitor.part.22+0x74/0xe8 [mac80211] [ 103.827410] [<8561b7f0>] ieee80211_do_stop+0x4a4/0x8a0 [mac80211] [ 103.833671] [<8561bc00>] ieee80211_stop+0x14/0x24 [mac80211] [ 103.839405] [<8045a328>] __dev_close_many+0x9c/0x10c [ 103.844364] [<80463de4>] __dev_change_flags+0x16c/0x1e4 [ 103.849569] [<80463e84>] dev_change_flags+0x28/0x70 [ 103.854440] [<80521e54>] devinet_ioctl+0x280/0x774 [ 103.859222] [<80526248>] inet_ioctl+0xa4/0x1c8 [ 103.863674] [<80436830>] sock_ioctl+0x2d8/0x4bc [ 103.868201] [<801adbb4>] do_vfs_ioctl+0xb8/0x7c0 [ 103.872804] [<801ae30c>] ksys_ioctl+0x50/0xb4 [ 103.877156] [<80014598>] syscall_common+0x34/0x58
--- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +13 -5
@@ -808,7 +808,8 @@ mt7615_mcu_ctrl_pm_state(struct mt7615_dev *dev, int band, int state)static int mt7615_mcu_bss_basic_tlv (struct sk_buff *skb,struct ieee80211_vif *vif, -struct ieee80211_sta *sta,bool enable) +struct ieee80211_sta *sta,struct mt7615_phy *phy, +bool enable) {struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;u32 type = vif->p2p ?NETWORK_P2P :NETWORK_INFRA ;
@@ -821,6 +822,7 @@ mt7615_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,switch (vif->type) {case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_MONITOR :break ;case NL80211_IFTYPE_STATION :/* TODO: enable BSS_INFO_UAPSD & BSS_INFO_PM */
@@ -840,14 +842,19 @@ mt7615_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, } bss = (struct bss_info_basic *)tlv; -memcpy (bss->bssid, vif->bss_conf.bssid,ETH_ALEN ); - bss->bcn_interval =cpu_to_le16 (vif->bss_conf.beacon_int); bss->network_type =cpu_to_le32 (type); - bss->dtim_period = vif->bss_conf.dtim_period; bss->bmc_tx_wlan_idx = wlan_idx; bss->wmm_idx = mvif->mt76.wmm_idx; bss->active = enable; +if (vif->type !=NL80211_IFTYPE_MONITOR ) { +memcpy (bss->bssid, vif->bss_conf.bssid,ETH_ALEN ); + bss->bcn_interval =cpu_to_le16 (vif->bss_conf.beacon_int); + bss->dtim_period = vif->bss_conf.dtim_period; + }else { +memcpy (bss->bssid, phy->mt76->macaddr,ETH_ALEN ); + } +return 0 ; }
@@ -863,6 +870,7 @@ mt7615_mcu_bss_omac_tlv(struct sk_buff *skb, struct ieee80211_vif *vif) tlv =mt76_connac_mcu_add_tlv (skb,BSS_INFO_OMAC ,sizeof (*omac));switch (vif->type) { +case NL80211_IFTYPE_MONITOR :case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP :if (vif->p2p)
@@ -929,7 +937,7 @@ mt7615_mcu_add_bss(struct mt7615_phy *phy, struct ieee80211_vif *vif,if (enable)mt7615_mcu_bss_omac_tlv (skb, vif); -mt7615_mcu_bss_basic_tlv (skb, vif, sta, enable); +mt7615_mcu_bss_basic_tlv (skb, vif, sta, phy, enable);if (enable && mvif->mt76.omac_idx >=EXT_BSSID_START && mvif->mt76.omac_idx <REPEATER_BSSID_START )
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 447/917 mmc: mxs-mmc: disable regulator on error and in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ce5f6c2c9b0fcb4094f8e162cfd37fb4294204f7 ]
The 'reg_vmmc' regulator is enabled in the probe. It is never disabled. Neither in the error handling path of the probe nor in the remove function.
Register a devm_action to disable it when needed.
--- drivers/mmc/host/mxs-mmc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mmc/host/mxs-mmc.c +10 -0
@@ -552,6 +552,11 @@ static const struct of_device_id mxs_mmc_dt_ids[] = { };MODULE_DEVICE_TABLE (of, mxs_mmc_dt_ids); +static void mxs_mmc_regulator_disable (void *regulator) +{ +regulator_disable (regulator); +} +static int mxs_mmc_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node;
@@ -591,6 +596,11 @@ static int mxs_mmc_probe(struct platform_device *pdev) "Failed to enable vmmc regulator: %d\n", ret); goto out_mmc_free; } + + ret =devm_add_action_or_reset (&pdev->dev, mxs_mmc_regulator_disable, + reg_vmmc); +if (ret) + goto out_mmc_free; } ssp->clk =devm_clk_get (&pdev->dev,NULL );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 454/917 ACPI: PM: Turn off unused wakeup power resources
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 7a63296d6f579a02b2675b4b0fe5b1cd3235e8d3 ]
If an ACPI power resource is found to be "on" during the initialization of the list of wakeup power resources of a device, it is reference counted and its wakeup_enabled flag is set, which is problematic if the deivce in question is the only user of the given power resource, it is never runtime-suspended and it is not allowed to wake up the system from sleep, because in that case the given power resource will stay "on" until the system reboots and energy will be wasted.
It is better to simply turn off wakeup power resources that are "on" during the initialization unless their reference counters are not zero, because that may be the only opportunity to prevent them from staying in the "on" state all the time.
--- drivers/acpi/power.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/acpi/power.c +9 -10
@@ -615,20 +615,19 @@ int acpi_power_wakeup_list_init(struct list_head *list, int *system_level_p)list_for_each_entry (entry, list, node) {struct acpi_power_resource *resource = entry->resource; -int result;u8 state;mutex_lock (&resource->resource_lock); - result =acpi_power_get_state (resource, &state); -if (result) { -mutex_unlock (&resource->resource_lock); -return result; - } -if (state ==ACPI_POWER_RESOURCE_STATE_ON ) { - resource->ref_count++; - resource->wakeup_enabled = true; - } +/* +* Make sure that the power resource state and its reference +* counter value are consistent with each other. +*/ +if (!resource->ref_count && + !acpi_power_get_state (resource, &state) && + state ==ACPI_POWER_RESOURCE_STATE_ON ) +__acpi_power_off (resource); +if (system_level > resource->system_level) system_level = resource->system_level;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 456/917 drm/amdkfd: Fix an inappropriate error handling in allloc memory of gpu
In reply to Greg Kroah-HartmanFrom: Lang Yu <[email protected]>
[ Upstream commit 5aeeac6fa38fca450faed9770f75b1470c0e2073 ]
We should unreference a gem object instead of an amdgpu bo here.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1 -1
@@ -1503,7 +1503,7 @@ allocate_init_user_pages_failed:remove_kgd_mem_from_kfd_bo_list (*mem, avm->process_info);drm_vma_node_revoke (&gobj->vma_node, drm_priv); err_node_allow: -amdgpu_bo_unref (&bo); +drm_gem_object_put (gobj);/* Don't unreserve system mem limit twice */ goto err_reserve_limit; err_bo_create:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 485/917 mwifiex: Send DELBA requests according to spec
In reply to Greg Kroah-HartmanFrom: Jonas Dreßler <[email protected]>
[ Upstream commit cc8a8bc37466f79b24d972555237f3d591150602 ]
While looking at on-air packets using Wireshark, I noticed we're never setting the initiator bit when sending DELBA requests to the AP: While we set the bit on our del_ba_param_set bitmask, we forget to actually copy that bitmask over to the command struct, which means we never actually set the initiator bit.
Fix that and copy the bitmask over to the host_cmd_ds_11n_delba command struct.
--- drivers/net/wireless/marvell/mwifiex/11n.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/11n.c +3 -2
@@ -657,14 +657,15 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,uint16_t del_ba_param_set;memset (&delba,0 ,sizeof (delba)); - delba.del_ba_param_set =cpu_to_le16 (tid <<DELBA_TID_POS ); - del_ba_param_set =le16_to_cpu (delba.del_ba_param_set); + del_ba_param_set = tid <<DELBA_TID_POS ; +if (initiator) del_ba_param_set |=IEEE80211_DELBA_PARAM_INITIATOR_MASK ;else del_ba_param_set &= ~IEEE80211_DELBA_PARAM_INITIATOR_MASK ; + delba.del_ba_param_set =cpu_to_le16 (del_ba_param_set);memcpy (&delba.peer_mac_addr, peer_mac,ETH_ALEN );/* We don't wait for the response of this command */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 501/917 libbpf: Fix memory leak in btf__dedup()
In reply to Greg Kroah-HartmanFrom: Mauricio Vásquez <[email protected]>
[ Upstream commit 1000298c76830bc291358e98e8fa5baa3baa9b3a ]
Free btf_dedup if btf_ensure_modifiable() returns error.
--- tools/lib/bpf/btf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/lib/bpf/btf.c +4 -2
@@ -2914,8 +2914,10 @@ int btf__dedup(struct btf *btf, struct btf_ext *btf_ext,return libbpf_err (-EINVAL ); } -if (btf_ensure_modifiable (btf)) -return libbpf_err (-ENOMEM ); +if (btf_ensure_modifiable (btf)) { + err = -ENOMEM ; + goto done; + } err =btf_dedup_prep (d);if (err) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 498/917 crypto: tcrypt - fix skcipher multi-buffer tests for 1420B blocks
In reply to Greg Kroah-HartmanFrom: Horia Geantă <[email protected]>
[ Upstream commit 3ae88f676aa63366ffa9eebb8ae787c7e19f0c57 ]
Commit ad6d66bcac77e ("crypto: tcrypt - include 1420 byte blocks in aead and skcipher benchmarks") mentions:
Quoted 3 lines
power-of-2 block size. So let's add 1420 bytes explicitly, and round it up to the next blocksize multiple of the algo in question if it does not support 1420 byte blocks.
but misses updating skcipher multi-buffer tests.
Fix this by using the proper (rounded) input size.
--- crypto/tcrypt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
crypto/tcrypt.c +2 -3
@@ -1333,7 +1333,7 @@ static void test_mb_skcipher_speed(const char *algo, int enc, int secs,if (bs >XBUFSIZE *PAGE_SIZE ) {pr_err ("template (%u) too big for buffer (%lu)\n" , - *b_size,XBUFSIZE *PAGE_SIZE ); + bs,XBUFSIZE *PAGE_SIZE ); goto out; }
@@ -1386,8 +1386,7 @@ static void test_mb_skcipher_speed(const char *algo, int enc, int secs,memset (cur->xbuf[p],0xff , k);skcipher_request_set_crypt (cur->req, cur->sg, - cur->sg, *b_size, - iv); + cur->sg, bs, iv); }if (secs) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 500/917 KVM: selftests: Fix nested SVM tests when built with clang
In reply to Greg Kroah-HartmanFrom: Jim Mattson <[email protected]>
[ Upstream commit ed290e1c20da19fa100a3e0f421aa31b65984960 ]
Though gcc conveniently compiles a simple memset to "rep stos," clang prefers to call the libc version of memset. If a test is dynamically linked, the libc memset isn't available in L1 (nor is the PLT or the GOT, for that matter). Even if the test is statically linked, the libc memset may choose to use some CPU features, like AVX, which may not be enabled in L1. Note that __builtin_memset doesn't solve the problem, because (a) the compiler is free to call memset anyway, and (b) __builtin_memset may also choose to use features like AVX, which may not be available in L1.
To avoid a myriad of problems, use an explicit "rep stos" to clear the VMCB in generic_svm_setup(), which is called both from L0 and L1.
Message-Id: <[email protected]>
--- tools/testing/selftests/kvm/lib/x86_64/svm.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
tools/testing/selftests/kvm/lib/x86_64/svm.c +13 -1
@@ -54,6 +54,18 @@ static void vmcb_set_seg(struct vmcb_seg *seg, u16 selector, seg->base = base; } +/* +* Avoid using memset to clear the vmcb, since libc may not be +* available in L1 (and, even if it is, features that libc memset may +* want to use, like AVX, may not be enabled). +*/ +static void clear_vmcb (struct vmcb *vmcb) +{ +int n =sizeof (*vmcb) /sizeof (u32); + + asmvolatile ("rep stosl" :"+c" (n),"+D" (vmcb) :"a" (0 ) :"memory" ); +} +void generic_svm_setup (struct svm_test_data *svm,void *guest_rip,void *guest_rsp) {struct vmcb *vmcb = svm->vmcb;
@@ -70,7 +82,7 @@ void generic_svm_setup(struct svm_test_data *svm, void *guest_rip, void *guest_rwrmsr (MSR_EFER , efer |EFER_SVME );wrmsr (MSR_VM_HSAVE_PA , svm->save_area_gpa); -memset (vmcb,0 ,sizeof (*vmcb)); +clear_vmcb (vmcb); asmvolatile ("vmsave %0\n\t" : :"a" (vmcb_gpa) :"memory" );vmcb_set_seg (&save->es,get_es (),0 ,-1U , data_seg_attr);vmcb_set_seg (&save->cs,get_cs (),0 ,-1U , code_seg_attr);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 494/917 clocksource/drivers/timer-ti-dm: Select TIMER_OF
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit eda9a4f7af6ee47e9e131f20e4f8a41a97379293 ]
When building OMAP_DM_TIMER without TIMER_OF, there are orphan sections due to the use of TIMER_OF_DELCARE() without CONFIG_TIMER_OF. Select CONFIG_TIMER_OF when enaling OMAP_DM_TIMER:
arm-linux-gnueabi-ld: warning: orphan section __timer_of_table' from drivers/clocksource/timer-ti-dm-systimer.o' being placed in section `__timer_of_table'
--- drivers/clocksource/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/clocksource/Kconfig +1 -0
@@ -24,6 +24,7 @@ config I8253_LOCK config OMAP_DM_TIMER bool + select TIMER_OF config CLKBLD_I8253 def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 502/917 bpftool: Avoid leaking the JSON writer prepared for program metadata
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit e89ef634f81c9d90e1824ab183721f3b361472e6 ]
Bpftool creates a new JSON object for writing program metadata in plain text mode, regardless of metadata being present or not. Then this writer is freed if any metadata has been found and printed, but it leaks otherwise. We cannot destroy the object unconditionally, because the destructor prints an undesirable line break. Instead, make sure the writer is created only after we have found program metadata to print.
Found with valgrind.
--- tools/bpf/bpftool/prog.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
tools/bpf/bpftool/prog.c +9 -7
@@ -308,18 +308,12 @@ static void show_prog_metadata(int fd, __u32 num_maps)if (printed_header)jsonw_end_object (json_wtr); }else { -json_writer_t *btf_wtr =jsonw_new (stdout); +json_writer_t *btf_wtr;struct btf_dumper d = { .btf = btf, - .jw = btf_wtr, .is_plain_text = true, }; -if (!btf_wtr) { -p_err ("jsonw alloc failed" ); - goto out_free; - } -for (i =0 ; i < vlen; i++, vsi++) { t_var =btf__type_by_id (btf, vsi->type); name =btf__name_by_offset (btf, t_var->name_off);
@@ -329,6 +323,14 @@ static void show_prog_metadata(int fd, __u32 num_maps)if (!printed_header) {printf ("\tmetadata:" ); + + btf_wtr =jsonw_new (stdout); +if (!btf_wtr) { +p_err ("jsonw alloc failed" ); + goto out_free; + } + d.jw = btf_wtr, + printed_header = true; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 515/917 ARM: 9142/1: kasan: work around LPAE build warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit c2e6df3eaaf120cde5e7c3a70590dd82e427458a ]
pgd_page_vaddr() returns an 'unsigned long' address, causing a warning with the memcpy() call in kasan_init():
arch/arm/mm/kasan_init.c: In function 'kasan_init':include/asm-generic/pgtable-nop4d.h:44:50: error: passing argument 2 of '__memcpy' makes pointer from integer without a cast [-Werror=int-conversion]
44 | #define pgd_page_vaddr(pgd) ((unsigned long)(p4d_pgtable((p4d_t){ pgd })))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned intarch/arm/include/asm/string.h:58:45: note: in definition of macro 'memcpy'
58 | #define memcpy(dst, src, len) __memcpy(dst, src, len)
| ^~~arch/arm/mm/kasan_init.c:229:16: note: in expansion of macro 'pgd_page_vaddr'
229 | pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_START)),
| ^~~~~~~~~~~~~~
arch/arm/include/asm/string.h:21:47: note: expected 'const void *' but argument is of type 'long unsigned int'
21 | extern void *__memcpy(void *dest, const void *src, __kernel_size_t n);
| ~~~~~~~~~~~~^~~Avoid this by adding an explicit typecast.
--- arch/arm/mm/kasan_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/kasan_init.c +1 -1
@@ -226,7 +226,7 @@ void __init kasan_init(void)BUILD_BUG_ON (pgd_index (KASAN_SHADOW_START ) !=pgd_index (KASAN_SHADOW_END ));memcpy (tmp_pmd_table, -pgd_page_vaddr (*pgd_offset_k (KASAN_SHADOW_START )), + (void *)pgd_page_vaddr (*pgd_offset_k (KASAN_SHADOW_START )),sizeof (tmp_pmd_table));set_pgd (&tmp_pgd_table[pgd_index (KASAN_SHADOW_START )],__pgd (__pa (tmp_pmd_table) |PMD_TYPE_TABLE |L_PGD_SWAPPER ));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 516/917 ath10k: fix module load regression with iram-recovery feature
In reply to Greg Kroah-HartmanFrom: Abinaya Kalaiselvan <[email protected]>
[ Upstream commit 6f8c8bf4c7c9be1c42088689fd4370e06b46608a ]
Commit 9af7c32ceca8 ("ath10k: add target IRAM recovery feature support") introduced a new firmware feature flag ATH10K_FW_FEATURE_IRAM_RECOVERY. But this caused ath10k_pci module load to fail if ATH10K_FW_CRASH_DUMP_RAM_DATA bit was not enabled in the ath10k coredump_mask module parameter:
[ 2209.328190] ath10k_pci 0000:02:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafe [ 2209.434414] ath10k_pci 0000:02:00.0: kconfig debug 1 debugfs 1 tracing 1 dfs 1 testmode 1 [ 2209.547191] ath10k_pci 0000:02:00.0: firmware ver 10.4-3.9.0.2-00099 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps,peer-fixed-rate,iram-recovery crc32 cbade90a [ 2210.896485] ath10k_pci 0000:02:00.0: board_file api 1 bmi_id 0:1 crc32 a040efc2 [ 2213.603339] ath10k_pci 0000:02:00.0: failed to copy target iram contents: -12 [ 2213.839027] ath10k_pci 0000:02:00.0: could not init core (-12) [ 2213.933910] ath10k_pci 0000:02:00.0: could not probe fw (-12)
And by default coredump_mask does not have ATH10K_FW_CRASH_DUMP_RAM_DATA enabled so anyone using a firmware with iram-recovery feature would fail. To my knowledge only QCA9984 firmwares starting from release 10.4-3.9.0.2-00099 enabled the feature.
The reason for regression was that ath10k_core_copy_target_iram() used ath10k_coredump_get_mem_layout() to get the memory layout, but when ATH10K_FW_CRASH_DUMP_RAM_DATA was disabled it would get just NULL and bail out with an error.
While looking at all this I noticed another bug: if CONFIG_DEV_COREDUMP is disabled but the firmware has iram-recovery enabled the module load fails with similar error messages. I fixed that by returning 0 from ath10k_core_copy_target_iram() when _ath10k_coredump_get_mem_layout() returns NULL.
Tested-on: QCA9984 hw2.0 PCI 10.4-3.9.0.2-00139
--- drivers/net/wireless/ath/ath10k/core.c | 11 +++++++++-- drivers/net/wireless/ath/ath10k/coredump.c | 11 ++++++++--- drivers/net/wireless/ath/ath10k/coredump.h | 7 +++++++ 3 files changed, 24 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +9 -2
@@ -2690,9 +2690,16 @@ static int ath10k_core_copy_target_iram(struct ath10k *ar)int i, ret;u32 len, remaining_len; - hw_mem =ath10k_coredump_get_mem_layout (ar); +/* copy target iram feature must work also when +* ATH10K_FW_CRASH_DUMP_RAM_DATA is disabled, so +* _ath10k_coredump_get_mem_layout() to accomplist that +*/ + hw_mem =_ath10k_coredump_get_mem_layout (ar);if (!hw_mem) -return -ENOMEM ; +/* if CONFIG_DEV_COREDUMP is disabled we get NULL, then +* just silently disable the feature by doing nothing +*/ +return 0 ;for (i =0 ; i < hw_mem->region_table.size; i++) { tmp = &hw_mem->region_table.regions[i];
drivers/net/wireless/ath/ath10k/coredump.c +8 -3
@@ -1447,11 +1447,17 @@ static u32 ath10k_coredump_get_ramdump_size(struct ath10k *ar)const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout (struct ath10k *ar) { -int i; -if (!test_bit (ATH10K_FW_CRASH_DUMP_RAM_DATA , &ath10k_coredump_mask))return NULL ; +return _ath10k_coredump_get_mem_layout (ar); +} +EXPORT_SYMBOL (ath10k_coredump_get_mem_layout); + +const struct ath10k_hw_mem_layout *_ath10k_coredump_get_mem_layout (struct ath10k *ar) +{ +int i; +if (WARN_ON (ar->target_version ==0 ))return NULL ;
@@ -1464,7 +1470,6 @@ const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10kreturn NULL ; } -EXPORT_SYMBOL (ath10k_coredump_get_mem_layout);struct ath10k_fw_crash_data *ath10k_coredump_new (struct ath10k *ar) {
drivers/net/wireless/ath/ath10k/coredump.h +7 -0
@@ -176,6 +176,7 @@ int ath10k_coredump_register(struct ath10k *ar);void ath10k_coredump_unregister (struct ath10k *ar);void ath10k_coredump_destroy (struct ath10k *ar); +const struct ath10k_hw_mem_layout *_ath10k_coredump_get_mem_layout (struct ath10k *ar);const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout (struct ath10k *ar);#else /* CONFIG_DEV_COREDUMP */
@@ -214,6 +215,12 @@ ath10k_coredump_get_mem_layout(struct ath10k *ar)return NULL ; } +static inline const struct ath10k_hw_mem_layout * +_ath10k_coredump_get_mem_layout (struct ath10k *ar) +{ +return NULL ; +} +#endif /* CONFIG_DEV_COREDUMP */ #endif /* _COREDUMP_H_ */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 511/917 KVM: s390: pv: avoid double free of sida page
In reply to Greg Kroah-HartmanFrom: Claudio Imbrenda <[email protected]>
[ Upstream commit d4074324b07a94a1fca476d452dfbb3a4e7bf656 ]
If kvm_s390_pv_destroy_cpu is called more than once, we risk calling free_page on a random page, since the sidad field is aliased with the gbea, which is not guaranteed to be zero.
This can happen, for example, if userspace calls the KVM_PV_DISABLE IOCTL, and it fails, and then userspace calls the same IOCTL again. This scenario is only possible if KVM has some serious bug or if the hardware is broken.
The solution is to simply return successfully immediately if the vCPU was already non secure.
Message-Id: <[email protected]>
--- arch/s390/kvm/pv.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
arch/s390/kvm/pv.c +9 -10
@@ -16,18 +16,17 @@int kvm_s390_pv_destroy_cpu (struct kvm_vcpu *vcpu,u16 *rc,u16 *rrc) { -int cc =0 ; +int cc; -if (kvm_s390_pv_cpu_get_handle (vcpu)) { - cc =uv_cmd_nodata (kvm_s390_pv_cpu_get_handle (vcpu), -UVC_CMD_DESTROY_SEC_CPU , rc, rrc); +if (!kvm_s390_pv_cpu_get_handle (vcpu)) +return 0 ; + + cc =uv_cmd_nodata (kvm_s390_pv_cpu_get_handle (vcpu),UVC_CMD_DESTROY_SEC_CPU , rc, rrc); + +KVM_UV_EVENT (vcpu->kvm,3 ,"PROTVIRT DESTROY VCPU %d: rc %x rrc %x" , + vcpu->vcpu_id, *rc, *rrc); +WARN_ONCE (cc,"protvirt destroy cpu failed rc %x rrc %x" , *rc, *rrc); -KVM_UV_EVENT (vcpu->kvm,3 , -"PROTVIRT DESTROY VCPU %d: rc %x rrc %x" , - vcpu->vcpu_id, *rc, *rrc); -WARN_ONCE (cc,"protvirt destroy cpu failed rc %x rrc %x" , - *rc, *rrc); - }/* Intended memory leak for something that should never happen. */ if (!cc) free_pages(vcpu->arch.pv.stor_base,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 512/917 KVM: s390: pv: avoid stalls for kvm_s390_pv_init_vm
In reply to Greg Kroah-HartmanFrom: Claudio Imbrenda <[email protected]>
[ Upstream commit 1e2aa46de526a5adafe580bca4c25856bb06f09e ]
When the system is heavily overcommitted, kvm_s390_pv_init_vm might generate stall notifications.
Fix this by using uv_call_sched instead of just uv_call. This is ok because we are not holding spinlocks.
Message-Id: <[email protected]>
--- arch/s390/kvm/pv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kvm/pv.c +1 -1
@@ -195,7 +195,7 @@ int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16 *rrc) uvcb.conf_base_stor_origin = (u64 )kvm->arch.pv.stor_base; uvcb.conf_virt_stor_origin = (u64 )kvm->arch.pv.stor_var; - cc =uv_call (0 , (u64)&uvcb); + cc =uv_call_sched (0 , (u64)&uvcb); *rc = uvcb.header.rc; *rrc = uvcb.header.rrc; KVM_UV_EVENT(kvm, 3, "PROTVIRT CREATE VM: handle %llx len %llx rc %x rrc %x",
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 514/917 net: dsa: avoid refcount warnings when ->port_{fdb,mdb}_del returns error
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 232deb3f9567ce37d99b8616a6c07c1fc0436abf ]
At present, when either of ds->ops->port_fdb_del() or ds->ops->port_mdb_del() return a non-zero error code, we attempt to save the day and keep the data structure associated with that switchdev object, as the deletion procedure did not complete.
However, the way in which we do this is suspicious to the checker in lib/refcount.c, who thinks it is buggy to increment a refcount that became zero, and that this is indicative of a use-after-free.
--- net/dsa/switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/dsa/switch.c +2 -2
@@ -264,7 +264,7 @@ static int dsa_switch_do_mdb_del(struct dsa_switch *ds, int port, err = ds->ops->port_mdb_del (ds, port, mdb);if (err) { -refcount_inc (&a->refcount); +refcount_set (&a->refcount,1 );return err; }
@@ -329,7 +329,7 @@ static int dsa_switch_do_fdb_del(struct dsa_switch *ds, int port, err = ds->ops->port_fdb_del (ds, port, addr, vid);if (err) { -refcount_inc (&a->refcount); +refcount_set (&a->refcount,1 );return err; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 486/917 iwlwifi: mvm: reset PM state on unsuccessful resume
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 2f629a7772e2a7bdaff25178917a40073f79702c ]
If resume fails for some reason, we need to set the PM state back to normal so we're able to send commands during firmware reset, rather than failing all of them because we're in D3.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +4 -1
@@ -2336,7 +2336,6 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)iwl_fw_dbg_collect_desc (&mvm->fwrt, &iwl_dump_desc_assert, false,0 ); ret =1 ; - mvm->trans->system_pm_mode =IWL_PLAT_PM_MODE_DISABLED ; goto err; }
@@ -2385,6 +2384,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) } } +/* after the successful handshake, we're out of D3 */ mvm->trans->system_pm_mode =IWL_PLAT_PM_MODE_DISABLED ;/*
@@ -2455,6 +2455,9 @@ out:*/ set_bit (IWL_MVM_STATUS_HW_RESTART_REQUESTED , &mvm->status); +/* regardless of what happened, we're now out of D3 */ + mvm->trans->system_pm_mode =IWL_PLAT_PM_MODE_DISABLED ; +return 1 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 487/917 iwlwifi: pnvm: dont kmemdup() more than we have
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 0f892441d8c353144e3669b7991fa5fe0bd353e9 ]
We shouldn't kmemdup() more data than we have, that might cause the code to crash. Fix that by updating the length before the kmemdup.
--- drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +3 -4
@@ -284,16 +284,15 @@ int iwl_pnvm_load(struct iwl_trans *trans,/* First attempt to get the PNVM from BIOS */ package =iwl_uefi_get_pnvm (trans, &len);if (!IS_ERR_OR_NULL (package)) { +/* we need only the data */ + len -=sizeof (*package); data =kmemdup (package->data, len,GFP_KERNEL );/* free package regardless of whether kmemdup succeeded */ kfree (package); -if (data) { -/* we need only the data size */ - len -=sizeof (*package); +if (data) goto parse; - } }/* If it's not available, try from the filesystem */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 488/917 iwlwifi: pnvm: read EFI data only if long enough
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit e864a77f51d0d8113b49cf7d030bc9dc911c8176 ]
If the data we get from EFI is not even long enough for the package struct we expect then ignore it entirely.
--- drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +7 -3
@@ -284,9 +284,13 @@ int iwl_pnvm_load(struct iwl_trans *trans,/* First attempt to get the PNVM from BIOS */ package =iwl_uefi_get_pnvm (trans, &len);if (!IS_ERR_OR_NULL (package)) { -/* we need only the data */ - len -=sizeof (*package); - data =kmemdup (package->data, len,GFP_KERNEL ); +if (len >=sizeof (*package)) { +/* we need only the data */ + len -=sizeof (*package); + data =kmemdup (package->data, len,GFP_KERNEL ); + }else { + data =NULL ; + }/* free package regardless of whether kmemdup succeeded */ kfree (package);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 489/917 net: enetc: unmap DMA in enetc_send_cmd()
In reply to Greg Kroah-HartmanFrom: Tim Gardner <[email protected]>
[ Upstream commit cd4bc63de774eee95e9bac26a565cd80e0fca421 ]
Coverity complains of a possible dereference of a null return value.
5. returned_null: kzalloc returns NULL. [show details]
6. var_assigned: Assigning: si_data = NULL return value from kzalloc.
488 si_data = kzalloc(data_size, __GFP_DMA | GFP_KERNEL);
489 cbd.length = cpu_to_le16(data_size);
490
491 dma = dma_map_single(&priv->si->pdev->dev, si_data,
492 data_size, DMA_FROM_DEVICE);
While this kzalloc() is unlikely to fail, I did notice that the function returned without unmapping si_data.
Fix this by refactoring the error paths and checking for kzalloc() failure.
--- .../net/ethernet/freescale/enetc/enetc_qos.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_qos.c +11 -7
@@ -486,14 +486,16 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, data_size =sizeof (struct streamid_data ); si_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); +if (!si_data) +return -ENOMEM ; cbd.length =cpu_to_le16 (data_size); dma =dma_map_single (&priv->si->pdev->dev, si_data, data_size,DMA_FROM_DEVICE );if (dma_mapping_error (&priv->si->pdev->dev, dma)) {netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); -kfree (si_data); -return -ENOMEM ; + err = -ENOMEM ; + goto out; } cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma));
@@ -512,12 +514,10 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, err =enetc_send_cmd (priv->si, &cbd);if (err) -return -EINVAL ; + goto out; -if (!enable) { -kfree (si_data); -return 0 ; - } +if (!enable) + goto out;/* Enable the entry overwrite again incase space flushed by hardware */ memset (&cbd,0 ,sizeof (cbd));
@@ -560,6 +560,10 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, } err =enetc_send_cmd (priv->si, &cbd); +out: +if (!dma_mapping_error (&priv->si->pdev->dev, dma)) +dma_unmap_single (&priv->si->pdev->dev, dma, data_size,DMA_FROM_DEVICE ); +kfree (si_data);return err;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 490/917 phy: micrel: ksz8041nl: do not use power down mode
In reply to Greg Kroah-HartmanFrom: Stefan Agner <[email protected]>
[ Upstream commit 2641b62d2fab52648e34cdc6994b2eacde2d27c1 ]
Some Micrel KSZ8041NL PHY chips exhibit continuous RX errors after using the power down mode bit (0.11). If the PHY is taken out of power down mode in a certain temperature range, the PHY enters a weird state which leads to continuously reporting RX errors. In that state, the MAC is not able to receive or send any Ethernet frames and the activity LED is constantly blinking. Since Linux is using the suspend callback when the interface is taken down, ending up in that state can easily happen during a normal startup.
Micrel confirmed the issue in errata DS80000700A [*], caused by abnormal clock recovery when using power down mode. Even the latest revision (A4, Revision ID 0x1513) seems to suffer that problem, and according to the errata is not going to be fixed.
Remove the suspend/resume callback to avoid using the power down mode completely.
[*] https://ww1.microchip.com/downloads/en/DeviceDoc/80000700A.pdf
--- drivers/net/phy/micrel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/phy/micrel.c +3 -2
@@ -1593,8 +1593,9 @@ static struct phy_driver ksphy_driver[] = { .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, +/* No suspend/resume callbacks because of errata DS80000700A, +* receiver error following software power down. +*/ }, { .phy_id = PHY_ID_KSZ8041RNLI, .phy_id_mask = MICREL_PHY_ID_MASK,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 492/917 nvme-rdma: fix error code in nvme_rdma_setup_ctrl
In reply to Greg Kroah-HartmanFrom: Max Gurtovoy <[email protected]>
[ Upstream commit 09748122009aed7bfaa7acc33c10c083a4758322 ]
In case that icdoff is not zero or mandatory keyed sgls are not supported by the NVMe/RDMA target, we'll go to error flow but we'll return 0 to the caller. Fix it by returning an appropriate error code.
--- drivers/nvme/host/rdma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/rdma.c +2 -0
@@ -1095,11 +1095,13 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)return ret;if (ctrl->ctrl.icdoff) { + ret = -EOPNOTSUPP ;dev_err (ctrl->ctrl.device,"icdoff is not supported!\n" ); goto destroy_admin; }if (!(ctrl->ctrl.sgls & (1 <<2 ))) { + ret = -EOPNOTSUPP ;dev_err (ctrl->ctrl.device,"Mandatory keyed sgls are not supported!\n" ); goto destroy_admin;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 510/917 s390/uv: fully validate the VMA before calling follow_page()
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
[ Upstream commit 46c22ffd2772201662350bc7b94b9ea9d3ee5ac2 ]
We should not walk/touch page tables outside of VMA boundaries when holding only the mmap sem in read mode. Evil user space can modify the VMA layout just before this function runs and e.g., trigger races with page table removal code since commit dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap").
find_vma() does not check if the address is >= the VMA start address; use vma_lookup() instead.
--- arch/s390/kernel/uv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/uv.c +1 -1
@@ -212,7 +212,7 @@ again: uaddr =__gmap_translate (gmap, gaddr);if (IS_ERR_VALUE (uaddr)) goto out; - vma =find_vma (gmap->mm, uaddr); + vma =vma_lookup (gmap->mm, uaddr);if (!vma) goto out;/*
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 513/917 irq: mips: avoid nested irq_enter()
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit c65b52d02f6c1a06ddb20cba175ad49eccd6410d ]
As bcm6345_l1_irq_handle() is a chained irqchip handler, it will be invoked within the context of the root irqchip handler, which must have entered IRQ context already.
When bcm6345_l1_irq_handle() calls arch/mips's do_IRQ() , this will nest another call to irq_enter(), and the resulting nested increment to rcu_data.dynticks_nmi_nesting will cause rcu_is_cpu_rrupt_from_idle() to fail to identify wakeups from idle, resulting in failure to preempt, and RCU stalls.
Chained irqchip handlers must invoke IRQ handlers by way of thee core irqchip code, i.e. generic_handle_irq() or generic_handle_domain_irq() and should not call do_IRQ(), which is intended only for root irqchip handlers.
Fix bcm6345_l1_irq_handle() by calling generic_handle_irq() directly.
--- drivers/irqchip/irq-bcm6345-l1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-bcm6345-l1.c +1 -1
@@ -140,7 +140,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc)for_each_set_bit (hwirq, &pending,IRQS_PER_WORD ) { irq =irq_linear_revmap (intc->domain, base + hwirq);if (irq) -do_IRQ (irq); +generic_handle_irq (irq);else spurious_interrupt (); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 518/917 blk-cgroup: synchronize blkg creation against policy deactivation
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 0c9d338c8443b06da8e8d3bfce824c5ea6d3488f ]
Our test reports a null pointer dereference:
[ 168.534653] ================================================================== [ 168.535614] Disabling lock debugging due to kernel taint [ 168.536346] BUG: kernel NULL pointer dereference, address: 0000000000000008 [ 168.537274] #PF: supervisor read access in kernel mode [ 168.537964] #PF: error_code(0x0000) - not-present page [ 168.538667] PGD 0 P4D 0 [ 168.539025] Oops: 0000 [#1] PREEMPT SMP KASAN [ 168.539656] CPU: 13 PID: 759 Comm: bash Tainted: G B 5.15.0-rc2-next-202100 [ 168.540954] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_0738364 [ 168.542736] RIP: 0010:bfq_pd_init+0x88/0x1e0 [ 168.543318] Code: 98 00 00 00 e8 c9 e4 5b ff 4c 8b 65 00 49 8d 7c 24 08 e8 bb e4 5b ff 4d0 [ 168.545803] RSP: 0018:ffff88817095f9c0 EFLAGS: 00010002 [ 168.546497] RAX: 0000000000000001 RBX: ffff888101a1c000 RCX: 0000000000000000 [ 168.547438] RDX: 0000000000000003 RSI: 0000000000000002 RDI: ffff888106553428 [ 168.548402] RBP: ffff888106553400 R08: ffffffff961bcaf4 R09: 0000000000000001 [ 168.549365] R10: ffffffffa2e16c27 R11: fffffbfff45c2d84 R12: 0000000000000000 [ 168.550291] R13: ffff888101a1c098 R14: ffff88810c7a08c8 R15: ffffffffa55541a0 [ 168.551221] FS: 00007fac75227700(0000) GS:ffff88839ba80000(0000) knlGS:0000000000000000 [ 168.552278] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 168.553040] CR2: 0000000000000008 CR3: 0000000165ce7000 CR4: 00000000000006e0 [ 168.554000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 168.554929] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 168.555888] Call Trace: [ 168.556221] <TASK> [ 168.556510] blkg_create+0x1c0/0x8c0 [ 168.556989] blkg_conf_prep+0x574/0x650 [ 168.557502] ? stack_trace_save+0x99/0xd0 [ 168.558033] ? blkcg_conf_open_bdev+0x1b0/0x1b0 [ 168.558629] tg_set_conf.constprop.0+0xb9/0x280 [ 168.559231] ? kasan_set_track+0x29/0x40 [ 168.559758] ? kasan_set_free_info+0x30/0x60 [ 168.560344] ? tg_set_limit+0xae0/0xae0 [ 168.560853] ? do_sys_openat2+0x33b/0x640 [ 168.561383] ? do_sys_open+0xa2/0x100 [ 168.561877] ? __x64_sys_open+0x4e/0x60 [ 168.562383] ? __kasan_check_write+0x20/0x30 [ 168.562951] ? copyin+0x48/0x70 [ 168.563390] ? _copy_from_iter+0x234/0x9e0 [ 168.563948] tg_set_conf_u64+0x17/0x20 [ 168.564467] cgroup_file_write+0x1ad/0x380 [ 168.565014] ? cgroup_file_poll+0x80/0x80 [ 168.565568] ? __mutex_lock_slowpath+0x30/0x30 [ 168.566165] ? pgd_free+0x100/0x160 [ 168.566649] kernfs_fop_write_iter+0x21d/0x340 [ 168.567246] ? cgroup_file_poll+0x80/0x80 [ 168.567796] new_sync_write+0x29f/0x3c0 [ 168.568314] ? new_sync_read+0x410/0x410 [ 168.568840] ? __handle_mm_fault+0x1c97/0x2d80 [ 168.569425] ? copy_page_range+0x2b10/0x2b10 [ 168.570007] ? _raw_read_lock_bh+0xa0/0xa0 [ 168.570622] vfs_write+0x46e/0x630 [ 168.571091] ksys_write+0xcd/0x1e0 [ 168.571563] ? __x64_sys_read+0x60/0x60 [ 168.572081] ? __kasan_check_write+0x20/0x30 [ 168.572659] ? do_user_addr_fault+0x446/0xff0 [ 168.573264] __x64_sys_write+0x46/0x60 [ 168.573774] do_syscall_64+0x35/0x80 [ 168.574264] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 168.574960] RIP: 0033:0x7fac74915130 [ 168.575456] Code: 73 01 c3 48 8b 0d 58 ed 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 444 [ 168.577969] RSP: 002b:00007ffc3080e288 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 168.578986] RAX: ffffffffffffffda RBX: 0000000000000009 RCX: 00007fac74915130 [ 168.579937] RDX: 0000000000000009 RSI: 000056007669f080 RDI: 0000000000000001 [ 168.580884] RBP: 000056007669f080 R08: 000000000000000a R09: 00007fac75227700 [ 168.581841] R10: 000056007655c8f0 R11: 0000000000000246 R12: 0000000000000009 [ 168.582796] R13: 0000000000000001 R14: 00007fac74be55e0 R15: 00007fac74be08c0 [ 168.583757] </TASK> [ 168.584063] Modules linked in: [ 168.584494] CR2: 0000000000000008 [ 168.584964] ---[ end trace 2475611ad0f77a1a ]---
This is because blkg_alloc() is called from blkg_conf_prep() without holding 'q->queue_lock', and elevator is exited before blkg_create():
thread 1 thread 2blkg_conf_prep
spin_lock_irq(&q->queue_lock);
blkg_lookup_check -> return NULL
spin_unlock_irq(&q->queue_lock);
blkg_alloc
blkcg_policy_enabled -> true
pd = ->pd_alloc_fn
blkg->pd[i] = pd
blk_mq_exit_sched
bfq_exit_queue
blkcg_deactivate_policy
spin_lock_irq(&q->queue_lock);
__clear_bit(pol->plid, q->blkcg_pols);
spin_unlock_irq(&q->queue_lock);
q->elevator = NULL;
spin_lock_irq(&q->queue_lock);
blkg_create
if (blkg->pd[i])
->pd_init_fn -> q->elevator is NULL spin_unlock_irq(&q->queue_lock);
Because blkcg_deactivate_policy() requires queue to be frozen, we can grab q_usage_counter to synchoronize blkg_conf_prep() against blkcg_deactivate_policy().
--- block/blk-cgroup.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
block/blk-cgroup.c +10 -0
@@ -633,6 +633,14 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, q = bdev->bd_disk->queue; +/* +* blkcg_deactivate_policy() requires queue to be frozen, we can grab +* q_usage_counter to prevent concurrent with blkcg_deactivate_policy(). +*/ + ret =blk_queue_enter (q,0 ); +if (ret) +return ret; +rcu_read_lock ();spin_lock_irq (&q->queue_lock);
@@ -702,6 +710,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, goto success; } success: +blk_queue_exit (q); ctx->bdev = bdev; ctx->blkg = blkg; ctx->body = input;
@@ -714,6 +723,7 @@ fail_unlock:rcu_read_unlock (); fail:blkdev_put_no_open (bdev); +blk_queue_exit (q);/* * If queue was bypassing, we should retry. Do so after a * short msleep(). It isn't strictly necessary but queue
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 519/917 libbpf: Fix off-by-one bug in bpf_core_apply_relo()
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit de5d0dcef602de39070c31c7e56c58249c56ba37 ]
Fix instruction index validity check which has off-by-one error.
--- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
@@ -5138,7 +5138,7 @@ static int bpf_core_apply_relo(struct bpf_program *prog,* relocated, so it's enough to just subtract in-section offset */ insn_idx = insn_idx - prog->sec_insn_off; -if (insn_idx > prog->insns_cnt) +if (insn_idx >= prog->insns_cnt)return -EINVAL ; insn = &prog->insns[insn_idx];
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 521/917 tpm_tis_spi: Add missing SPI ID
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 7eba41fe8c7bb01ff3d4b757bd622375792bc720 ]
In commit c46ed2281bbe ("tpm_tis_spi: add missing SPI device ID entries") we added SPI IDs for all the DT aliases to handle the fact that we always use SPI modaliases to load modules even when probed via DT however the mentioned commit missed that the SPI and OF device ID entries did not match and were different and so DT nodes with compatible "tcg,tpm_tis-spi" will not match. Add an extra ID for tpm_tis-spi rather than just fix the existing one since what's currently there is going to be better for anyone actually using SPI IDs to instantiate.
--- drivers/char/tpm/tpm_tis_spi_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/tpm/tpm_tis_spi_main.c +1 -0
@@ -267,6 +267,7 @@ static const struct spi_device_id tpm_tis_spi_id[] = { { "st33htpm-spi", (unsigned long)tpm_tis_spi_probe }, { "slb9670", (unsigned long)tpm_tis_spi_probe }, { "tpm_tis_spi", (unsigned long)tpm_tis_spi_probe }, + { "tpm_tis-spi", (unsigned long)tpm_tis_spi_probe }, { "cr50", (unsigned long)cr50_spi_probe }, {} };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 530/917 KVM: s390: Fix handle_sske page fault handling
In reply to Greg Kroah-HartmanFrom: Janis Schoetterl-Glausch <[email protected]>
[ Upstream commit 85f517b29418158d3e6e90c3f0fc01b306d2f1a1 ]
If handle_sske cannot set the storage key, because there is no page table entry or no present large page entry, it calls fixup_user_fault.
However, currently, if the call succeeds, handle_sske returns -EAGAIN, without having set the storage key.
Instead, retry by continue'ing the loop without incrementing the address.
The same issue in handle_pfmf was fixed bya11bdb1a6b78 ("KVM: s390: Fix pfmf and conditional skey emulation").
--- arch/s390/kvm/priv.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kvm/priv.c +2 -0
@@ -397,6 +397,8 @@ static int handle_sske(struct kvm_vcpu *vcpu)mmap_read_unlock (current->mm);if (rc == -EFAULT )return kvm_s390_inject_program_int (vcpu,PGM_ADDRESSING ); +if (rc == -EAGAIN ) +continue ;if (rc <0 )return rc; start +=PAGE_SIZE ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 535/917 bpf: Avoid races in __bpf_prog_run() for 32bit arches
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit f941eadd8d6d4ee2f8c9aeab8e1da5e647533a7d ]
__bpf_prog_run() can run from non IRQ contexts, meaning it could be re entered if interrupted.
This calls for the irq safe variant of u64_stats_update_{begin|end}, or risk a deadlock.
This patch is a nop on 64bit arches, fortunately.
syzbot report:
WARNING: inconsistent lock state
5.12.0-rc3-syzkaller #0 Not tainted
--------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
udevd/4013 [HC0[0]:SC0[0]:HE1:SE1] takes:ff7c9dec (&(&pstats->syncp)->seq){+.?.}-{0:0}, at: sk_filter include/linux/filter.h:867 [inline] ff7c9dec (&(&pstats->syncp)->seq){+.?.}-{0:0}, at: do_one_broadcast net/netlink/af_netlink.c:1468 [inline] ff7c9dec (&(&pstats->syncp)->seq){+.?.}-{0:0}, at: netlink_broadcast_filtered+0x27c/0x4fc net/netlink/af_netlink.c:1520 {IN-SOFTIRQ-W} state was registered at:
lock_acquire.part.0+0xf0/0x41c kernel/locking/lockdep.c:5510 lock_acquire+0x6c/0x74 kernel/locking/lockdep.c:5483 do_write_seqcount_begin_nested include/linux/seqlock.h:520 [inline] do_write_seqcount_begin include/linux/seqlock.h:545 [inline] u64_stats_update_begin include/linux/u64_stats_sync.h:129 [inline] bpf_prog_run_pin_on_cpu include/linux/filter.h:624 [inline] bpf_prog_run_clear_cb+0x1bc/0x270 include/linux/filter.h:755 run_filter+0xa0/0x17c net/packet/af_packet.c:2031 packet_rcv+0xc0/0x3e0 net/packet/af_packet.c:2104 dev_queue_xmit_nit+0x2bc/0x39c net/core/dev.c:2387 xmit_one net/core/dev.c:3588 [inline] dev_hard_start_xmit+0x94/0x518 net/core/dev.c:3609 sch_direct_xmit+0x11c/0x1f0 net/sched/sch_generic.c:313 qdisc_restart net/sched/sch_generic.c:376 [inline] __qdisc_run+0x194/0x7f8 net/sched/sch_generic.c:384 qdisc_run include/net/pkt_sched.h:136 [inline] qdisc_run include/net/pkt_sched.h:128 [inline] __dev_xmit_skb net/core/dev.c:3795 [inline] __dev_queue_xmit+0x65c/0xf84 net/core/dev.c:4150 dev_queue_xmit+0x14/0x18 net/core/dev.c:4215 neigh_resolve_output net/core/neighbour.c:1491 [inline] neigh_resolve_output+0x170/0x228 net/core/neighbour.c:1471 neigh_output include/net/neighbour.h:510 [inline] ip6_finish_output2+0x2e4/0x9fc net/ipv6/ip6_output.c:117 __ip6_finish_output net/ipv6/ip6_output.c:182 [inline] __ip6_finish_output+0x164/0x3f8 net/ipv6/ip6_output.c:161 ip6_finish_output+0x2c/0xb0 net/ipv6/ip6_output.c:192 NF_HOOK_COND include/linux/netfilter.h:290 [inline] ip6_output+0x74/0x294 net/ipv6/ip6_output.c:215 dst_output include/net/dst.h:448 [inline] NF_HOOK include/linux/netfilter.h:301 [inline] NF_HOOK include/linux/netfilter.h:295 [inline] mld_sendpack+0x2a8/0x7e4 net/ipv6/mcast.c:1679 mld_send_cr net/ipv6/mcast.c:1975 [inline] mld_ifc_timer_expire+0x1e8/0x494 net/ipv6/mcast.c:2474 call_timer_fn+0xd0/0x570 kernel/time/timer.c:1431 expire_timers kernel/time/timer.c:1476 [inline] __run_timers kernel/time/timer.c:1745 [inline] run_timer_softirq+0x2e4/0x384 kernel/time/timer.c:1758 __do_softirq+0x204/0x7ac kernel/softirq.c:345 do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline] invoke_softirq kernel/softirq.c:228 [inline] __irq_exit_rcu+0x1d8/0x200 kernel/softirq.c:422 irq_exit+0x10/0x3c kernel/softirq.c:446 __handle_domain_irq+0xb4/0x120 kernel/irq/irqdesc.c:692 handle_domain_irq include/linux/irqdesc.h:176 [inline] gic_handle_irq+0x84/0xac drivers/irqchip/irq-gic.c:370 __irq_svc+0x5c/0x94 arch/arm/kernel/entry-armv.S:205 debug_smp_processor_id+0x0/0x24 lib/smp_processor_id.c:53 rcu_read_lock_held_common kernel/rcu/update.c:108 [inline] rcu_read_lock_sched_held+0x24/0x7c kernel/rcu/update.c:123 trace_lock_acquire+0x24c/0x278 include/trace/events/lock.h:13 lock_acquire+0x3c/0x74 kernel/locking/lockdep.c:5481 rcu_lock_acquire include/linux/rcupdate.h:267 [inline] rcu_read_lock include/linux/rcupdate.h:656 [inline] avc_has_perm_noaudit+0x6c/0x260 security/selinux/avc.c:1150 selinux_inode_permission+0x140/0x220 security/selinux/hooks.c:3141 security_inode_permission+0x44/0x60 security/security.c:1268 inode_permission.part.0+0x5c/0x13c fs/namei.c:521 inode_permission fs/namei.c:494 [inline] may_lookup fs/namei.c:1652 [inline] link_path_walk.part.0+0xd4/0x38c fs/namei.c:2208 link_path_walk fs/namei.c:2189 [inline] path_lookupat+0x3c/0x1b8 fs/namei.c:2419 filename_lookup+0xa8/0x1a4 fs/namei.c:2453 user_path_at_empty+0x74/0x90 fs/namei.c:2733 do_readlinkat+0x5c/0x12c fs/stat.c:417 __do_sys_readlink fs/stat.c:450 [inline] sys_readlink+0x24/0x28 fs/stat.c:447 ret_fast_syscall+0x0/0x2c arch/arm/mm/proc-v7.S:64 0x7eaa4974 irq event stamp: 298277 hardirqs last enabled at (298277): [<802000d0>] no_work_pending+0x4/0x34 hardirqs last disabled at (298276): [<8020c9b8>] do_work_pending+0x9c/0x648 arch/arm/kernel/signal.c:676 softirqs last enabled at (298216): [<8020167c>] __do_softirq+0x584/0x7ac kernel/softirq.c:372 softirqs last disabled at (298201): [<8024dff4>] do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline] softirqs last disabled at (298201): [<8024dff4>] invoke_softirq kernel/softirq.c:228 [inline] softirqs last disabled at (298201): [<8024dff4>] __irq_exit_rcu+0x1d8/0x200 kernel/softirq.c:422
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&(&pstats->syncp)->seq);
<Interrupt>
lock(&(&pstats->syncp)->seq);*** DEADLOCK ***
1 lock held by udevd/4013:
#0: 82b09c5c (rcu_read_lock){....}-{1:2}, at: sk_filter_trim_cap+0x54/0x434 net/core/filter.c:139
stack backtrace: CPU: 1 PID: 4013 Comm: udevd Not tainted 5.12.0-rc3-syzkaller #0 Hardware name: ARM-Versatile Express Backtrace: [<81802550>] (dump_backtrace) from [<818027c4>] (show_stack+0x18/0x1c arch/arm/kernel/traps.c:252) r7:00000080 r6:600d0093 r5:00000000 r4:82b58344
[<818027ac>] (show_stack) from [<81809e98>] (__dump_stack lib/dump_stack.c:79 [inline])
[<818027ac>] (show_stack) from [<81809e98>] (dump_stack+0xb8/0xe8 lib/dump_stack.c:120)
[<81809de0>] (dump_stack) from [<81804a00>] (print_usage_bug.part.0+0x228/0x230 kernel/locking/lockdep.c:3806)
r7:86bcb768 r6:81a0326c r5:830f96a8 r4:86bcb0c0
[<818047d8>] (print_usage_bug.part.0) from [<802bb1b8>] (print_usage_bug kernel/locking/lockdep.c:3776 [inline]) [<818047d8>] (print_usage_bug.part.0) from [<802bb1b8>] (valid_state kernel/locking/lockdep.c:3818 [inline]) [<818047d8>] (print_usage_bug.part.0) from [<802bb1b8>] (mark_lock_irq kernel/locking/lockdep.c:4021 [inline]) [<818047d8>] (print_usage_bug.part.0) from [<802bb1b8>] (mark_lock.part.0+0xc34/0x136c kernel/locking/lockdep.c:4478)
r10:83278fe8 r9:82c6d748 r8:00000000 r7:82c6d2d4 r6:00000004 r5:86bcb768
r4:00000006
[<802ba584>] (mark_lock.part.0) from [<802bc644>] (mark_lock kernel/locking/lockdep.c:4442 [inline]) [<802ba584>] (mark_lock.part.0) from [<802bc644>] (mark_usage kernel/locking/lockdep.c:4391 [inline]) [<802ba584>] (mark_lock.part.0) from [<802bc644>] (__lock_acquire+0x9bc/0x3318 kernel/locking/lockdep.c:4854)
r10:86bcb768 r9:86bcb0c0 r8:00000001 r7:00040000 r6:0000075a r5:830f96a8
r4:00000000
[<802bbc88>] (__lock_acquire) from [<802bfb90>] (lock_acquire.part.0+0xf0/0x41c kernel/locking/lockdep.c:5510)
r10:00000000 r9:600d0013 r8:00000000 r7:00000000 r6:828a2680 r5:828a2680
r4:861e5bc8
[<802bfaa0>] (lock_acquire.part.0) from [<802bff28>] (lock_acquire+0x6c/0x74 kernel/locking/lockdep.c:5483)
r10:8146137c r9:00000000 r8:00000001 r7:00000000 r6:00000000 r5:00000000
r4:ff7c9dec
[<802bfebc>] (lock_acquire) from [<81381eb4>] (do_write_seqcount_begin_nested include/linux/seqlock.h:520 [inline]) [<802bfebc>] (lock_acquire) from [<81381eb4>] (do_write_seqcount_begin include/linux/seqlock.h:545 [inline]) [<802bfebc>] (lock_acquire) from [<81381eb4>] (u64_stats_update_begin include/linux/u64_stats_sync.h:129 [inline]) [<802bfebc>] (lock_acquire) from [<81381eb4>] (__bpf_prog_run_save_cb include/linux/filter.h:727 [inline]) [<802bfebc>] (lock_acquire) from [<81381eb4>] (bpf_prog_run_save_cb include/linux/filter.h:741 [inline]) [<802bfebc>] (lock_acquire) from [<81381eb4>] (sk_filter_trim_cap+0x26c/0x434 net/core/filter.c:149)
r10:a4095dd0 r9:ff7c9dd0 r8:e44be000 r7:8146137c r6:00000001 r5:8611ba80
r4:00000000
[<81381c48>] (sk_filter_trim_cap) from [<8146137c>] (sk_filter include/linux/filter.h:867 [inline]) [<81381c48>] (sk_filter_trim_cap) from [<8146137c>] (do_one_broadcast net/netlink/af_netlink.c:1468 [inline]) [<81381c48>] (sk_filter_trim_cap) from [<8146137c>] (netlink_broadcast_filtered+0x27c/0x4fc net/netlink/af_netlink.c:1520)
r10:00000001 r9:833d6b1c r8:00000000 r7:8572f864 r6:8611ba80 r5:8698d800
r4:8572f800
[<81461100>] (netlink_broadcast_filtered) from [<81463e60>] (netlink_broadcast net/netlink/af_netlink.c:1544 [inline]) [<81461100>] (netlink_broadcast_filtered) from [<81463e60>] (netlink_sendmsg+0x3d0/0x478 net/netlink/af_netlink.c:1925)
r10:00000000 r9:00000002 r8:8698d800 r7:000000b7 r6:8611b900 r5:861e5f50
r4:86aa3000
[<81463a90>] (netlink_sendmsg) from [<81321f54>] (sock_sendmsg_nosec net/socket.c:654 [inline]) [<81463a90>] (netlink_sendmsg) from [<81321f54>] (sock_sendmsg+0x3c/0x4c net/socket.c:674)
r10:00000000 r9:861e5dd4 r8:00000000 r7:86570000 r6:00000000 r5:86570000
r4:861e5f50
[<81321f18>] (sock_sendmsg) from [<813234d0>] (____sys_sendmsg+0x230/0x29c net/socket.c:2350)
r5:00000040 r4:861e5f50
[<813232a0>] (____sys_sendmsg) from [<8132549c>] (___sys_sendmsg+0xac/0xe4 net/socket.c:2404)
r10:00000128 r9:861e4000 r8:00000000 r7:00000000 r6:86570000 r5:861e5f50
r4:00000000
[<813253f0>] (___sys_sendmsg) from [<81325684>] (__sys_sendmsg net/socket.c:2433 [inline]) [<813253f0>] (___sys_sendmsg) from [<81325684>] (__do_sys_sendmsg net/socket.c:2442 [inline]) [<813253f0>] (___sys_sendmsg) from [<81325684>] (sys_sendmsg+0x58/0xa0 net/socket.c:2440)
r8:80200224 r7:00000128 r6:00000000 r5:7eaa541c r4:86570000
[<8132562c>] (sys_sendmsg) from [<80200060>] (ret_fast_syscall+0x0/0x2c arch/arm/mm/proc-v7.S:64)
Exception stack(0x861e5fa8 to 0x861e5ff0)
5fa0: 00000000 00000000 0000000c 7eaa541c 00000000 00000000
5fc0: 00000000 00000000 76fbf840 00000128 00000000 0000008f 7eaa541c 000563f8 5fe0: 00056110 7eaa53e0 00036cec 76c9bf44
r6:76fbf840 r5:00000000 r4:00000000
--- include/linux/filter.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/linux/filter.h +3 -2
@@ -613,13 +613,14 @@ static __always_inline u32 __bpf_prog_run(const struct bpf_prog *prog,if (static_branch_unlikely (&bpf_stats_enabled_key)) {struct bpf_prog_stats *stats;u64 start =sched_clock (); +unsigned long flags; ret =dfunc (ctx, prog->insnsi, prog->bpf_func); stats =this_cpu_ptr (prog->stats); -u64_stats_update_begin (&stats->syncp); + flags =u64_stats_update_begin_irqsave (&stats->syncp); stats->cnt++; stats->nsecs +=sched_clock () - start; -u64_stats_update_end (&stats->syncp); +u64_stats_update_end_irqrestore (&stats->syncp, flags); }else { ret =dfunc (ctx, prog->insnsi, prog->bpf_func); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 536/917 bpf: Fixes possible race in update_prog_stats() for 32bit arches
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d979617aa84d96acca44c2f5778892b4565e322f ]
It seems update_prog_stats() suffers from same issue fixed in the prior patch:
As it can run while interrupts are enabled, it could be re-entered and the u64_stats syncp could be mangled.
--- kernel/bpf/trampoline.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/bpf/trampoline.c +4 -2
@@ -585,11 +585,13 @@ static void notrace update_prog_stats(struct bpf_prog *prog,* Hence check that 'start' is valid. */ start > NO_START_TIME) { +unsigned long flags; + stats =this_cpu_ptr (prog->stats); -u64_stats_update_begin (&stats->syncp); + flags =u64_stats_update_begin_irqsave (&stats->syncp); stats->cnt++; stats->nsecs +=sched_clock () - start; -u64_stats_update_end (&stats->syncp); +u64_stats_update_end_irqrestore (&stats->syncp, flags); } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 538/917 drm/amdgpu: fix a potential memory leak in amdgpu_device_fini_sw()
In reply to Greg Kroah-HartmanFrom: Lang Yu <[email protected]>
[ Upstream commit a5c5d8d50ecf5874be90a76e1557279ff8a30c9e ]
amdgpu_fence_driver_sw_fini() should be executed before amdgpu_device_ip_fini(), otherwise fence driver resource won't be properly freed as adev->rings have been tore down.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -3877,8 +3877,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)void amdgpu_device_fini_sw (struct amdgpu_device *adev) { -amdgpu_device_ip_fini (adev);amdgpu_fence_driver_sw_fini (adev); +amdgpu_device_ip_fini (adev);release_firmware (adev->firmware.gpu_info_fw); adev->firmware.gpu_info_fw =NULL ; adev->accel_working = false;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 539/917 drm/amdgpu/gmc6: fix DMA mask from 44 to 40 bits
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 403475be6d8b122c3e6b8a47e075926d7299e5ef ]
The DMA mask on SI parts is 40 bits not 44. Copy paste typo.
--- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -2
@@ -841,12 +841,12 @@ static int gmc_v6_0_sw_init(void *handle) adev->gmc.mc_mask =0xffffffffffULL ; - r =dma_set_mask_and_coherent (adev->dev,DMA_BIT_MASK (44 )); + r =dma_set_mask_and_coherent (adev->dev,DMA_BIT_MASK (40 ));if (r) {dev_warn (adev->dev,"No suitable DMA available.\n" );return r; } - adev->need_swiotlb =drm_need_swiotlb (44 ); + adev->need_swiotlb =drm_need_swiotlb (40 ); r =gmc_v6_0_init_microcode (adev);if (r) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 522/917 libbpf: Fix endianness detection in BPF_CORE_READ_BITFIELD_PROBED()
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 45f2bebc8079788f62f22d9e8b2819afb1789d7b ]
__BYTE_ORDER is supposed to be defined by a libc, and __BYTE_ORDER__ - by a compiler. bpf_core_read.h checks __BYTE_ORDER == __LITTLE_ENDIAN, which is true if neither are defined, leading to incorrect behavior on big-endian hosts if libc headers are not included, which is often the case.
--- tools/lib/bpf/bpf_core_read.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/bpf_core_read.h +1 -1
@@ -40,7 +40,7 @@ enum bpf_enum_value_kind {#define __CORE_RELO (src, field, info) \ __builtin_preserve_field_info((src)->field, BPF_FIELD_##info) -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__#define __CORE_BITFIELD_PROBE_READ (dst, src, fld) \ bpf_probe_read_kernel( \ (void *)dst, \
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 531/917 libertas_tf: Fix possible memory leak in probe and disconnect
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit d549107305b4634c81223a853701c06bcf657bc3 ]
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff88810a2ddc00 (size 512):
comm "kworker/6:1", pid 176, jiffies 4295009893 (age 757.220s) hex dump (first 32 bytes):
00 50 05 18 81 88 ff ff 00 00 00 00 00 00 00 00 .P..............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff8167939c>] slab_post_alloc_hook+0x9c/0x490
[<ffffffff8167f627>] kmem_cache_alloc_trace+0x1f7/0x470
[<ffffffffa02a1530>] if_usb_probe+0x60/0x37c [libertas_tf_usb]
[<ffffffffa022668a>] usb_probe_interface+0x1aa/0x3c0 [usbcore]
[<ffffffff82b59630>] really_probe+0x190/0x480
[<ffffffff82b59a19>] __driver_probe_device+0xf9/0x180
[<ffffffff82b59af3>] driver_probe_device+0x53/0x130
[<ffffffff82b5a075>] __device_attach_driver+0x105/0x130
[<ffffffff82b55949>] bus_for_each_drv+0x129/0x190
[<ffffffff82b593c9>] __device_attach+0x1c9/0x270
[<ffffffff82b5a250>] device_initial_probe+0x20/0x30
[<ffffffff82b579c2>] bus_probe_device+0x142/0x160
[<ffffffff82b52e49>] device_add+0x829/0x1300
[<ffffffffa02229b1>] usb_set_configuration+0xb01/0xcc0 [usbcore]
[<ffffffffa0235c4e>] usb_generic_driver_probe+0x6e/0x90 [usbcore]
[<ffffffffa022641f>] usb_probe_device+0x6f/0x130 [usbcore]cardp is missing being freed in the error handling path of the probe and the path of the disconnect, which will cause memory leak.
This patch adds the missing kfree().
--- drivers/net/wireless/marvell/libertas_tf/if_usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/libertas_tf/if_usb.c +2 -0
@@ -230,6 +230,7 @@ static int if_usb_probe(struct usb_interface *intf, dealloc:if_usb_free (cardp); +kfree (cardp); error:lbtf_deb_leave (LBTF_DEB_MAIN );return -ENOMEM ;
@@ -254,6 +255,7 @@ static void if_usb_disconnect(struct usb_interface *intf)/* Unlink and free urb */ if_usb_free (cardp); +kfree (cardp);usb_set_intfdata (intf,NULL );usb_put_dev (interface_to_usbdev (intf));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 532/917 libertas: Fix possible memory leak in probe and disconnect
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 9692151e2fe7a326bafe99836fd1f20a2cc3a049 ]
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff88812c7d7400 (size 512):
comm "kworker/6:1", pid 176, jiffies 4295003332 (age 822.830s) hex dump (first 32 bytes):
00 68 1e 04 81 88 ff ff 01 00 00 00 00 00 00 00 .h..............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff8167939c>] slab_post_alloc_hook+0x9c/0x490
[<ffffffff8167f627>] kmem_cache_alloc_trace+0x1f7/0x470
[<ffffffffa02c9873>] if_usb_probe+0x63/0x446 [usb8xxx]
[<ffffffffa022668a>] usb_probe_interface+0x1aa/0x3c0 [usbcore]
[<ffffffff82b59630>] really_probe+0x190/0x480
[<ffffffff82b59a19>] __driver_probe_device+0xf9/0x180
[<ffffffff82b59af3>] driver_probe_device+0x53/0x130
[<ffffffff82b5a075>] __device_attach_driver+0x105/0x130
[<ffffffff82b55949>] bus_for_each_drv+0x129/0x190
[<ffffffff82b593c9>] __device_attach+0x1c9/0x270
[<ffffffff82b5a250>] device_initial_probe+0x20/0x30
[<ffffffff82b579c2>] bus_probe_device+0x142/0x160
[<ffffffff82b52e49>] device_add+0x829/0x1300
[<ffffffffa02229b1>] usb_set_configuration+0xb01/0xcc0 [usbcore]
[<ffffffffa0235c4e>] usb_generic_driver_probe+0x6e/0x90 [usbcore]
[<ffffffffa022641f>] usb_probe_device+0x6f/0x130 [usbcore]cardp is missing being freed in the error handling path of the probe and the path of the disconnect, which will cause memory leak.
This patch adds the missing kfree().
--- drivers/net/wireless/marvell/libertas/if_usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/libertas/if_usb.c +2 -0
@@ -292,6 +292,7 @@ err_add_card:if_usb_reset_device (cardp); dealloc:if_usb_free (cardp); +kfree (cardp); error:return r;
@@ -316,6 +317,7 @@ static void if_usb_disconnect(struct usb_interface *intf)/* Unlink and free urb */ if_usb_free (cardp); +kfree (cardp);usb_set_intfdata (intf,NULL );usb_put_dev (interface_to_usbdev (intf));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 533/917 wcn36xx: add proper DMA memory barriers in rx path
In reply to Greg Kroah-HartmanFrom: Benjamin Li <[email protected]>
[ Upstream commit 9bfe38e064af5decba2ffce66a2958ab8b10eaa4 ]
This is essentially exactly following the dma_wmb()/dma_rmb() usage instructions in Documentation/memory-barriers.txt.
The theoretical races here are:
1. DXE (the DMA Transfer Engine in the Wi-Fi subsystem) seeing the dxe->ctrl & WCN36xx_DXE_CTRL_VLD write before the dxe->dst_addr_l write, thus performing DMA into the wrong address.
2. CPU reading dxe->dst_addr_l before DXE unsets dxe->ctrl & WCN36xx_DXE_CTRL_VLD. This should generally be harmless since DXE doesn't write dxe->dst_addr_l (no risk of freeing the wrong skb).
--- drivers/net/wireless/ath/wcn36xx/dxe.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/dxe.c +11 -1
@@ -606,6 +606,10 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn, dxe = ctl->desc;while (!(READ_ONCE (dxe->ctrl) & WCN36xx_DXE_CTRL_VLD)) { +/* do not read until we own DMA descriptor */ +dma_rmb (); + +/* read/modify DMA descriptor */ skb = ctl->skb; dma_addr = dxe->dst_addr_l; ret =wcn36xx_dxe_fill_skb (wcn->dev, ctl,GFP_ATOMIC );
@@ -616,9 +620,15 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,dma_unmap_single (wcn->dev, dma_addr,WCN36XX_PKT_SIZE ,DMA_FROM_DEVICE );wcn36xx_rx_skb (wcn, skb); - }/* else keep old skb not submitted and use it for rx DMA */ + } +/* else keep old skb not submitted and reuse it for rx DMA +* (dropping the packet that it contained) +*/ +/* flush descriptor changes before re-marking as valid */ +dma_wmb (); dxe->ctrl = ctrl; + ctl = ctl->next; dxe = ctl->desc; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 534/917 wcn36xx: Fix discarded frames due to wrong sequence number
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit 113f304dbc1627c6ec9d5329d839964095768980 ]
The firmware is offering features such as ARP offload, for which firmware crafts its own (QoS)packets without waking up the host. Point is that the sequence numbers generated by the firmware are not in sync with the host mac80211 layer and can cause packets such as firmware ARP reponses to be dropped by the AP (too old SN).
To fix this we need to let the firmware manages the sequence numbers by its own (except for QoS null frames). There is a SN counter for each QoS queue and one global/baseline counter for Non-QoS.
--- drivers/net/wireless/ath/wcn36xx/txrx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/wcn36xx/txrx.c +7 -2
@@ -344,8 +344,6 @@ static void wcn36xx_set_tx_pdu(struct wcn36xx_tx_bd *bd, bd->pdu.mpdu_header_off; bd->pdu.mpdu_len = len; bd->pdu.tid = tid; -/* Use seq number generated by mac80211 */ - bd->pdu.bd_ssn =WCN36XX_TXBD_SSN_FILL_HOST ; } static inline struct wcn36xx_vif *get_vif_by_addr(struct wcn36xx *wcn,
@@ -442,6 +440,9 @@ static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd, tid =ieee80211_get_tid (hdr);/* TID->QID is one-to-one mapping */ bd->queue_id = tid; + bd->pdu.bd_ssn =WCN36XX_TXBD_SSN_FILL_DPU_QOS ; + }else { + bd->pdu.bd_ssn =WCN36XX_TXBD_SSN_FILL_DPU_NON_QOS ; } if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT ||
@@ -453,6 +454,8 @@ static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd,/* Don't use a regular queue for null packet (no ampdu) */ bd->queue_id =WCN36XX_TX_U_WQ_ID ; bd->bd_rate =WCN36XX_BD_RATE_CTRL ; +if (ieee80211_is_qos_nullfunc (hdr->frame_control)) + bd->pdu.bd_ssn =WCN36XX_TXBD_SSN_FILL_HOST ; }if (bcast) {
@@ -512,6 +515,8 @@ static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd, bd->queue_id =WCN36XX_TX_U_WQ_ID ; *vif_priv = __vif_priv; + bd->pdu.bd_ssn =WCN36XX_TXBD_SSN_FILL_DPU_NON_QOS ; + wcn36xx_set_tx_pdu(bd, ieee80211_is_data_qos(hdr->frame_control) ? sizeof(struct ieee80211_qos_hdr) :
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 537/917 wcn36xx: Channel list update before hardware scan
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit d707f812bb0513ea0030d0c9fe2a456bae5a4583 ]
The channel scan list must be updated before triggering a hardware scan so that firmware takes into account the regulatory info for each single channel such as active/passive config, power, DFS, etc... Without this the firmware uses its own internal default channel configuration, which is not aligned with mac80211 regulatory rules, and misses several channels (e.g. 144).
--- drivers/net/wireless/ath/wcn36xx/hal.h | 32 ++++++++++ drivers/net/wireless/ath/wcn36xx/main.c | 1 + drivers/net/wireless/ath/wcn36xx/smd.c | 82 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 1 + 4 files changed, 116 insertions(+)
drivers/net/wireless/ath/wcn36xx/hal.h +32 -0
@@ -359,6 +359,8 @@ enum wcn36xx_hal_host_msg_type {WCN36XX_HAL_START_SCAN_OFFLOAD_RSP =205 ,WCN36XX_HAL_STOP_SCAN_OFFLOAD_REQ =206 ,WCN36XX_HAL_STOP_SCAN_OFFLOAD_RSP =207 , +WCN36XX_HAL_UPDATE_CHANNEL_LIST_REQ =208 , +WCN36XX_HAL_UPDATE_CHANNEL_LIST_RSP =209 ,WCN36XX_HAL_SCAN_OFFLOAD_IND =210 , WCN36XX_HAL_AVOID_FREQ_RANGE_IND = 233,
@@ -1353,6 +1355,36 @@ struct wcn36xx_hal_stop_scan_offload_rsp_msg {u32 status; } __packed; +#define WCN36XX_HAL_CHAN_REG1_MIN_PWR_MASK 0x000000ff +#define WCN36XX_HAL_CHAN_REG1_MAX_PWR_MASK 0x0000ff00 +#define WCN36XX_HAL_CHAN_REG1_REG_PWR_MASK 0x00ff0000 +#define WCN36XX_HAL_CHAN_REG1_CLASS_ID_MASK 0xff000000 +#define WCN36XX_HAL_CHAN_REG2_ANT_GAIN_MASK 0x000000ff +#define WCN36XX_HAL_CHAN_INFO_FLAG_PASSIVE BIT(7) +#define WCN36XX_HAL_CHAN_INFO_FLAG_DFS BIT(10) +#define WCN36XX_HAL_CHAN_INFO_FLAG_HT BIT(11) +#define WCN36XX_HAL_CHAN_INFO_FLAG_VHT BIT(12) +#define WCN36XX_HAL_CHAN_INFO_PHY_11A 0 +#define WCN36XX_HAL_CHAN_INFO_PHY_11BG 1 +#define WCN36XX_HAL_DEFAULT_ANT_GAIN 6 +#define WCN36XX_HAL_DEFAULT_MIN_POWER 6 + +struct wcn36xx_hal_channel_param { +u32 mhz; +u32 band_center_freq1; +u32 band_center_freq2; +u32 channel_info; +u32 reg_info_1; +u32 reg_info_2; +} __packed; + +struct wcn36xx_hal_update_channel_list_req_msg { +struct wcn36xx_hal_msg_header header; + +u8 num_channel; +struct wcn36xx_hal_channel_param channels[80 ]; +} __packed; +enum wcn36xx_hal_rate_index {HW_RATE_INDEX_1MBPS =0x82 ,HW_RATE_INDEX_2MBPS =0x84 ,
drivers/net/wireless/ath/wcn36xx/main.c +1 -0
@@ -671,6 +671,7 @@ static int wcn36xx_hw_scan(struct ieee80211_hw *hw,mutex_unlock (&wcn->scan_lock); +wcn36xx_smd_update_channel_list (wcn, &hw_req->req);return wcn36xx_smd_start_hw_scan (wcn, vif, &hw_req->req); }
drivers/net/wireless/ath/wcn36xx/smd.c +82 -0
100 lines not on this page · raw message
drivers/net/wireless/ath/wcn36xx/smd.h +1 -0
@@ -70,6 +70,7 @@ int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn, u8 *channels, size_t chaint wcn36xx_smd_start_hw_scan (struct wcn36xx *wcn,struct ieee80211_vif *vif,struct cfg80211_scan_request *req);int wcn36xx_smd_stop_hw_scan (struct wcn36xx *wcn); +int wcn36xx_smd_update_channel_list (struct wcn36xx *wcn,struct cfg80211_scan_request *req);int wcn36xx_smd_add_sta_self (struct wcn36xx *wcn,struct ieee80211_vif *vif);int wcn36xx_smd_delete_sta_self (struct wcn36xx *wcn,u8 *addr);int wcn36xx_smd_delete_sta (struct wcn36xx *wcn,u8 sta_index);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 540/917 selftests/bpf: Fix fd cleanup in sk_lookup test
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit c3fc706e94f5653def2783ffcd809a38676b7551 ]
Similar to the fix in commit:e31eec77e4ab ("bpf: selftests: Fix fd cleanup in get_branch_snapshot")
We use designated initializer to set fds to -1 without breaking on future changes to MAX_SERVER constant denoting the array size.
The particular close(0) occurs on non-reuseport tests, so it can be seen with -n 115/{2,3} but not 115/4. This can cause problems with future tests if they depend on BTF fd never being acquired as fd 0, breaking internal libbpf assumptions.
--- tools/testing/selftests/bpf/prog_tests/sk_lookup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/sk_lookup.c +2 -2
@@ -598,7 +598,7 @@ close:static void run_lookup_prog (const struct test *t) { -int server_fds[MAX_SERVERS ] = {-1 }; +int server_fds[] = { [0 ...MAX_SERVERS -1 ] =-1 };int client_fd, reuse_conn_fd =-1 ;struct bpf_link *lookup_link;int i, err;
@@ -1053,7 +1053,7 @@ static void run_sk_assign(struct test_sk_lookup *skel,struct bpf_program *lookup_prog, const char *remote_ip, const char *local_ip) { - int server_fds[MAX_SERVERS] = { -1 }; + int server_fds[] = { [0 ... MAX_SERVERS - 1] = -1 };struct bpf_sk_lookup ctx;__u64 server_cookie;int i, err;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 541/917 selftests/bpf: Fix memory leak in test_ima
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit efadf2ad17a2d5dc90bda4e6e8b2f96af4c62dae ]
The allocated ring buffer is never freed, do so in the cleanup path.
--- tools/testing/selftests/bpf/prog_tests/test_ima.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/test_ima.c +2 -1
@@ -43,7 +43,7 @@ static int process_sample(void *ctx, void *data, size_t len)void test_test_ima (void ) {char measured_dir_template[] ="/tmp/ima_measuredXXXXXX" ; -struct ring_buffer *ringbuf; +struct ring_buffer *ringbuf =NULL ;const char *measured_dir;char cmd[256 ];
@@ -85,5 +85,6 @@ close_clean: err =system (cmd);CHECK (err,"failed to run command" ,"%s, errno = %d\n" , cmd, errno); close_prog: +ring_buffer__free (ringbuf);ima__destroy (skel); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 542/917 sctp: allow IP fragmentation when PLPMTUD enters Error state
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 40171248bb8934537fec8fbaf718e57c8add187c ]
Currently when PLPMTUD enters Error state, transport pathmtu will be set to MIN_PLPMTU(512) while probe is continuing with BASE_PLPMTU(1200). It will cause pathmtu to stay in a very small value, even if the real pmtu is some value like 1000.
RFC8899 doesn't clearly say how to set the value in Error state. But one possibility could be keep using BASE_PLPMTU for the real pmtu, but allow to do IP fragmentation when it's in Error state.
As it says in rfc8899#section-5.4:
Some paths could be unable to sustain packets of the BASE_PLPMTU size. The Error State could be implemented to provide robustness to such paths. This allows fallback to a smaller than desired PLPMTU rather than suffer connectivity failure. This could utilize methods such as endpoint IP fragmentation to enable the PL sender to communicate using packets smaller than the BASE_PLPMTU.
This patch is to set pmtu to BASE_PLPMTU instead of MIN_PLPMTU for Error state in sctp_transport_pl_send/toobig(), and set packet ipfragok for non-probe packets when it's in Error state.
--- net/sctp/output.c | 13 ++++++++----- net/sctp/transport.c | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-)
net/sctp/output.c +8 -5
@@ -581,13 +581,16 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list); sk = chunk->skb->sk; -/* check gso */ if (packet->size > tp->pathmtu && !packet->ipfragok && !chunk->pmtu_probe) { -if (!sk_can_gso (sk)) { -pr_err_once ("Trying to GSO but underlying device doesn't support it." ); - goto out; +if (tp->pl.state ==SCTP_PL_ERROR ) {/* do IP fragmentation if in Error state */ + packet->ipfragok =1 ; + }else { +if (!sk_can_gso (sk)) {/* check gso */ +pr_err_once ("Trying to GSO but underlying device doesn't support it." ); + goto out; + } + gso =1 ; } - gso =1 ; }/* alloc head skb */
net/sctp/transport.c +2 -2
@@ -269,7 +269,7 @@ bool sctp_transport_pl_send(struct sctp_transport *t)if (t->pl.probe_size ==SCTP_BASE_PLPMTU ) {/* BASE_PLPMTU Confirmation Failed */ t->pl.state =SCTP_PL_ERROR ;/* Base -> Error */ - t->pl.pmtu =SCTP_MIN_PLPMTU ; + t->pl.pmtu =SCTP_BASE_PLPMTU ; t->pathmtu = t->pl.pmtu +sctp_transport_pl_hlen (t);sctp_assoc_sync_pmtu (t->asoc); }
@@ -366,7 +366,7 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)if (pmtu >=SCTP_MIN_PLPMTU && pmtu <SCTP_BASE_PLPMTU ) { t->pl.state =SCTP_PL_ERROR ;/* Base -> Error */ - t->pl.pmtu =SCTP_MIN_PLPMTU ; + t->pl.pmtu =SCTP_BASE_PLPMTU ; t->pathmtu = t->pl.pmtu +sctp_transport_pl_hlen (t); } }else if (t->pl.state ==SCTP_PL_SEARCH ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 543/917 sctp: reset probe_timer in sctp_transport_pl_update
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit c6ea04ea692fa0d8e7faeb133fcd28e3acf470a0 ]
sctp_transport_pl_update() is called when transport update its dst and pathmtu, instead of stopping the PLPMTUD probe timer, PLPMTUD should start over and reset the probe timer. Otherwise, the PLPMTUD service would stop.
--- include/net/sctp/sctp.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
include/net/sctp/sctp.h +1 -3
@@ -653,12 +653,10 @@ static inline void sctp_transport_pl_update(struct sctp_transport *t)if (t->pl.state ==SCTP_PL_DISABLED )return ; -if (del_timer (&t->probe_timer)) -sctp_transport_put (t); - t->pl.state =SCTP_PL_BASE ; t->pl.pmtu =SCTP_BASE_PLPMTU ; t->pl.probe_size =SCTP_BASE_PLPMTU ; +sctp_transport_reset_probe_timer (t); }static inline bool sctp_transport_pl_enabled (struct sctp_transport *t)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 545/917 sctp: return true only for pathmtu update in sctp_transport_pl_toobig
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 75cf662c64dd8543f56c329c69eba18141c8fd9f ]
sctp_transport_pl_toobig() supposes to return true only if there's pathmtu update, so that in sctp_icmp_frag_needed() it would call sctp_assoc_sync_pmtu() and sctp_retransmit(). This patch is to fix these return places in sctp_transport_pl_toobig().
--- net/sctp/transport.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/sctp/transport.c +4 -3
@@ -368,6 +368,7 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) t->pl.pmtu =SCTP_BASE_PLPMTU ; t->pathmtu = t->pl.pmtu +sctp_transport_pl_hlen (t); +return true; } }else if (t->pl.state ==SCTP_PL_SEARCH ) {if (pmtu >=SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -378,11 +379,10 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) t->pl.probe_high =0 ; t->pl.pmtu =SCTP_BASE_PLPMTU ; t->pathmtu = t->pl.pmtu +sctp_transport_pl_hlen (t); +return true; }else if (pmtu > t->pl.pmtu && pmtu < t->pl.probe_size) { t->pl.probe_size = pmtu; t->pl.probe_count =0 ; - -return false; } }else if (t->pl.state ==SCTP_PL_COMPLETE ) {if (pmtu >=SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -393,10 +393,11 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) t->pl.probe_high =0 ; t->pl.pmtu =SCTP_BASE_PLPMTU ; t->pathmtu = t->pl.pmtu +sctp_transport_pl_hlen (t); +return true; } } -return true; +return false; }bool sctp_transport_update_pmtu (struct sctp_transport *t,u32 pmtu)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 546/917 net: amd-xgbe: Toggle PLL settings during rate change
In reply to Greg Kroah-HartmanFrom: Shyam Sundar S K <[email protected]>
[ Upstream commit daf182d360e509a494db18666799f4e85d83dda0 ]
For each rate change command submission, the FW has to do a phy power off sequence internally. For this to happen correctly, the PLL re-initialization control setting has to be turned off before sending mailbox commands and re-enabled once the command submission is complete.
Without the PLL control setting, the link up takes longer time in a fixed phy configuration.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 8 ++++++++ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 20 +++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +8 -0
@@ -1331,6 +1331,10 @@#define MDIO_VEND2_PMA_CDR_CONTROL 0x8056#endif +#ifndef MDIO_VEND2_PMA_MISC_CTRL0 +#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090 +#endif +#ifndef MDIO_CTRL1_SPEED1G #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)#endif
@@ -1389,6 +1393,10 @@#define XGBE_PMA_RX_RST_0_RESET_ON 0x10#define XGBE_PMA_RX_RST_0_RESET_OFF 0x00 +#define XGBE_PMA_PLL_CTRL_MASK BIT(15) +#define XGBE_PMA_PLL_CTRL_ENABLE BIT(15) +#define XGBE_PMA_PLL_CTRL_DISABLE 0x0000 +/* Bit setting and getting macros * The get macro will extract the current bit field value from within * the variable
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +19 -1
@@ -1977,12 +1977,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) } } +static void xgbe_phy_pll_ctrl (struct xgbe_prv_data *pdata,bool enable) +{ +XMDIO_WRITE_BITS (pdata,MDIO_MMD_PMAPMD ,MDIO_VEND2_PMA_MISC_CTRL0 , +XGBE_PMA_PLL_CTRL_MASK , + enable ?XGBE_PMA_PLL_CTRL_ENABLE + :XGBE_PMA_PLL_CTRL_DISABLE ); + +/* Wait for command to complete */ +usleep_range (100 ,200 ); +} +static void xgbe_phy_perform_ratechange (struct xgbe_prv_data *pdata,unsigned int cmd,unsigned int sub_cmd) {unsigned int s0 =0 ;unsigned int wait; +/* Disable PLL re-initialization during FW command processing */ +xgbe_phy_pll_ctrl (pdata, false); +/* Log if a previous command did not complete */ if (XP_IOREAD_BITS (pdata,XP_DRIVER_INT_RO ,STATUS )) { netif_dbg(pdata, link, pdata->netdev,
@@ -2003,7 +2017,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, wait =XGBE_RATECHANGE_COUNT ;while (wait--) {if (!XP_IOREAD_BITS (pdata,XP_DRIVER_INT_RO ,STATUS )) -return ; + goto reenable_pll;usleep_range (1000 ,2000 ); }
@@ -2013,6 +2027,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,/* Reset on error */ xgbe_phy_rx_reset (pdata); + +reenable_pll: +/* Enable PLL re-initialization */ +xgbe_phy_pll_ctrl (pdata, true); }static void xgbe_phy_rrc (struct xgbe_prv_data *pdata)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 547/917 ipmi: kcs_bmc: Fix a memory leak in the error handling path of kcs_bmc_serio_add_device()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit f281d010b87454e72475b668ad66e34961f744e0 ]
In the unlikely event where 'devm_kzalloc()' fails and 'kzalloc()' succeeds, 'port' would be leaking.
Test each allocation separately to avoid the leak.
Message-Id: <ecbfa15e94e64f4b878ecab1541ea46c74807670.1631048724.git.christophe.jaillet@wanadoo.fr>
--- drivers/char/ipmi/kcs_bmc_serio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/ipmi/kcs_bmc_serio.c +3 -1
@@ -73,10 +73,12 @@ static int kcs_bmc_serio_add_device(struct kcs_bmc_device *kcs_bmc)struct serio *port; priv =devm_kzalloc (kcs_bmc->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ;/* Use kzalloc() as the allocation is cleaned up with kfree() via serio_unregister_port() */ port =kzalloc (sizeof (*port),GFP_KERNEL ); -if (!(priv && port)) +if (!port)return -ENOMEM ; port->id.type =SERIO_8042 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 548/917 nfp: fix NULL pointer access when scheduling dim work
In reply to Greg Kroah-HartmanFrom: Yinjun Zhang <[email protected]>
[ Upstream commit f8d384a640dd32aaf0a05fec137ccbf0e986b09f ]
Each rx/tx ring has a related dim work, when rx/tx ring number is decreased by ethtool -L, the corresponding rx_ring or tx_ring is assigned NULL, while its related work is not destroyed. When scheduled, the work will access NULL pointer.
--- drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/netronome/nfp/nfp_net_common.c +2 -2
@@ -2067,7 +2067,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget)if (napi_complete_done (napi, pkts_polled))nfp_net_irq_unmask (r_vec->nfp_net, r_vec->irq_entry); -if (r_vec->nfp_net->rx_coalesce_adapt_on) { +if (r_vec->nfp_net->rx_coalesce_adapt_on && r_vec->rx_ring) {struct dim_sample dim_sample = {};unsigned int start;u64 pkts, bytes;
@@ -2082,7 +2082,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget)net_dim (&r_vec->rx_dim, dim_sample); } -if (r_vec->nfp_net->tx_coalesce_adapt_on) { +if (r_vec->nfp_net->tx_coalesce_adapt_on && r_vec->tx_ring) {struct dim_sample dim_sample = {};unsigned int start;u64 pkts, bytes;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 549/917 nfp: fix potential deadlock when canceling dim work
In reply to Greg Kroah-HartmanFrom: Yinjun Zhang <[email protected]>
[ Upstream commit 17e712c6a1bade9dac02a7bf2b464746faa7e9a0 ]
When port is linked down, the process which has acquired rtnl_lock will wait for the in-progress dim work to finish, and the work also acquires rtnl_lock, which may cause deadlock.
Currently IRQ_MOD registers can be configured by ethtool -C and dim work, and which will take effect depends on the execution order, rtnl_lock is useless here, so remove them.
--- drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/ethernet/netronome/nfp/nfp_net_common.c +0 -4
@@ -3016,10 +3016,8 @@ static void nfp_net_rx_dim_work(struct work_struct *work)/* copy RX interrupt coalesce parameters */ value = (moder.pkts <<16 ) | (factor * moder.usec); -rtnl_lock ();nn_writel (nn,NFP_NET_CFG_RXR_IRQ_MOD (r_vec->rx_ring->idx), value); (void )nfp_net_reconfig (nn,NFP_NET_CFG_UPDATE_IRQMOD ); -rtnl_unlock (); dim->state =DIM_START_MEASURE ; }
@@ -3047,10 +3045,8 @@ static void nfp_net_tx_dim_work(struct work_struct *work)/* copy TX interrupt coalesce parameters */ value = (moder.pkts <<16 ) | (factor * moder.usec); -rtnl_lock ();nn_writel (nn,NFP_NET_CFG_TXR_IRQ_MOD (r_vec->tx_ring->idx), value); (void )nfp_net_reconfig (nn,NFP_NET_CFG_UPDATE_IRQMOD ); -rtnl_unlock (); dim->state =DIM_START_MEASURE ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 550/917 net: phylink: avoid mvneta warning when setting pause parameters
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit fd8d9731bcdfb22d28e45bce789bcb211c868c78 ]
mvneta does not support asymetric pause modes, and it flags this by the lack of AsymPause in the supported field. When setting pause modes, we check that pause->rx_pause == pause->tx_pause, but only when pause autoneg is enabled. When pause autoneg is disabled, we still allow pause->rx_pause != pause->tx_pause, which is incorrect when the MAC does not support asymetric pause, and causes mvneta to issue a warning.
Fix this by removing the test for pause->autoneg, so we always check that pause->rx_pause == pause->tx_pause for network devices that do not support AsymPause.
--- drivers/net/phy/phylink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phylink.c +1 -1
@@ -1727,7 +1727,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,return -EOPNOTSUPP ;if (!phylink_test (pl->supported, Asym_Pause) && - !pause->autoneg && pause->rx_pause != pause->tx_pause) + pause->rx_pause != pause->tx_pause)return -EINVAL ; pause_state =0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 552/917 selftests: net: bridge: update IGMP/MLD membership interval value
In reply to Greg Kroah-HartmanFrom: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 34d7ecb3d4f772eb00ce1f7195ae30886ddf4d2e ]
When I fixed IGMPv3/MLDv2 to use the bridge's multicast_membership_interval value which is chosen by user-space instead of calculating it based on multicast_query_interval and multicast_query_response_interval I forgot to update the selftests relying on that behaviour. Now we have to manually set the expected GMI value to perform the tests correctly and get proper results (similar to IGMPv2 behaviour).
--- .../testing/selftests/net/forwarding/bridge_igmp.sh | 12 +++++++++--- tools/testing/selftests/net/forwarding/bridge_mld.sh | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-)
tools/testing/selftests/net/forwarding/bridge_igmp.sh +9 -3
@@ -482,10 +482,15 @@ v3exc_timeout_test() local X=("192.0.2.20" "192.0.2.30") # GMI should be 3 seconds - ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100 + ip link set dev br0 type bridge mcast_query_interval 100 \ + mcast_query_response_interval 100 \ + mcast_membership_interval 300 v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP - ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500 + ip link set dev br0 type bridge mcast_query_interval 500 \ + mcast_query_response_interval 500 \ + mcast_membership_interval 1500 + $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q sleep 3 bridge -j -d -s mdb show dev br0 \
@@ -517,7 +522,8 @@ v3exc_timeout_test() log_test "IGMPv3 group $TEST_GROUP exclude timeout" ip link set dev br0 type bridge mcast_query_interval 12500 \ - mcast_query_response_interval 1000 + mcast_query_response_interval 1000 \ + mcast_membership_interval 26000 v3cleanup $swp1 $TEST_GROUP }
tools/testing/selftests/net/forwarding/bridge_mld.sh +9 -3
@@ -479,10 +479,15 @@ mldv2exc_timeout_test() local X=("2001:db8:1::20" "2001:db8:1::30") # GMI should be 3 seconds - ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100 + ip link set dev br0 type bridge mcast_query_interval 100 \ + mcast_query_response_interval 100 \ + mcast_membership_interval 300 mldv2exclude_prepare $h1 - ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500 + ip link set dev br0 type bridge mcast_query_interval 500 \ + mcast_query_response_interval 500 \ + mcast_membership_interval 1500 + $MZ $h1 -c 1 $MZPKT_ALLOW2 -q sleep 3 bridge -j -d -s mdb show dev br0 \
@@ -514,7 +519,8 @@ mldv2exc_timeout_test() log_test "MLDv2 group $TEST_GROUP exclude timeout" ip link set dev br0 type bridge mcast_query_interval 12500 \ - mcast_query_response_interval 1000 + mcast_query_response_interval 1000 \ + mcast_membership_interval 26000 mldv2cleanup $swp1 }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 523/917 tcp: dont free a FIN sk_buff in tcp_remove_empty_skb()
In reply to Greg Kroah-HartmanFrom: Jon Maxwell <[email protected]>
[ Upstream commit cf12e6f9124629b18a6182deefc0315f0a73a199 ]
v1: Implement a more general statement as recommended by Eric Dumazet. The sequence number will be advanced, so this check will fix the FIN case and other cases.
A customer reported sockets stuck in the CLOSING state. A Vmcore revealed that the write_queue was not empty as determined by tcp_write_queue_empty() but the sk_buff containing the FIN flag had been freed and the socket was zombied in that state. Corresponding pcaps show no FIN from the Linux kernel on the wire.
Some instrumentation was added to the kernel and it was found that there is a timing window where tcp_sendmsg() can run after tcp_send_fin().
tcp_sendmsg() will hit an error, for example:
1269 ▹ if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))↩
1270 ▹ ▹ goto do_error;↩
tcp_remove_empty_skb() will then free the FIN sk_buff as "skb->len == 0". The TCP socket is now wedged in the FIN-WAIT-1 state because the FIN is never sent.
If the other side sends a FIN packet the socket will transition to CLOSING and remain that way until the system is rebooted.
Fix this by checking for the FIN flag in the sk_buff and don't free it if that is the case. Testing confirmed that fixed the issue.
--- net/ipv4/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp.c +1 -1
@@ -952,7 +952,7 @@ int tcp_send_mss(struct sock *sk, int *size_goal, int flags)*/ void tcp_remove_empty_skb (struct sock *sk,struct sk_buff *skb) { -if (skb && !skb->len) { +if (skb &&TCP_SKB_CB (skb)->seq ==TCP_SKB_CB (skb)->end_seq) {tcp_unlink_write_queue (skb, sk);if (tcp_write_queue_empty (sk))tcp_chrono_stop (sk,TCP_CHRONO_BUSY );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 524/917 tracing: Fix missing trace_boot_init_histograms kstrdup NULL checks
In reply to Greg Kroah-HartmanFrom: Mathieu Desnoyers <[email protected]>
[ Upstream commit 3c20bd3af535d64771b193bb4dd41ed662c464ce ]
trace_boot_init_histograms misses NULL pointer checks for kstrdup failure.
--- kernel/trace/trace_boot.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/trace_boot.c +4 -0
@@ -430,6 +430,8 @@ trace_boot_init_histograms(struct trace_event_file *file,/* All digit started node should be instances. */ if (trace_boot_compose_hist_cmd (node, buf, size) ==0 ) { tmp =kstrdup (buf,GFP_KERNEL ); +if (!tmp) +return ;if (trigger_process_regex (file, buf) <0 )pr_err ("Failed to apply hist trigger: %s\n" , tmp);kfree (tmp);
@@ -439,6 +441,8 @@ trace_boot_init_histograms(struct trace_event_file *file,if (xbc_node_find_subkey (hnode,"keys" )) {if (trace_boot_compose_hist_cmd (hnode, buf, size) ==0 ) { tmp =kstrdup (buf,GFP_KERNEL ); +if (!tmp) +return ;if (trigger_process_regex (file, buf) <0 )pr_err ("Failed to apply hist trigger: %s\n" , tmp);kfree (tmp);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 525/917 cpufreq: intel_pstate: Fix cpu->pstate.turbo_freq initialization
In reply to Greg Kroah-HartmanFrom: Zhang Rui <[email protected]>
[ Upstream commit c72bcf0ab87a92634e58af62e89af0f40dfd0b88 ]
Fix a problem in active mode that cpu->pstate.turbo_freq is initialized only if HWP-to-frequency scaling factor is refined.
In passive mode, this problem is not exposed, because cpu->pstate.turbo_freq is set again, later in intel_cpufreq_cpu_init()->intel_pstate_get_hwp_cap().
--- drivers/cpufreq/intel_pstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/intel_pstate.c +2 -1
@@ -537,7 +537,8 @@ static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu)* scaling factor is too high, so recompute it to make the HWP_CAP * highest performance correspond to the maximum turbo frequency. */ -if (turbo_freq < cpu->pstate.turbo_pstate * scaling) { + cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * scaling; +if (turbo_freq < cpu->pstate.turbo_freq) { cpu->pstate.turbo_freq = turbo_freq; scaling =DIV_ROUND_UP (turbo_freq, cpu->pstate.turbo_pstate); cpu->pstate.scaling = scaling;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 526/917 spi: spi-rpc-if: Check return value of rpcif_sw_init()
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 0b0a281ed7001d4c4f4c47bdc84680c4997761ca ]
rpcif_sw_init() can fail so make sure we check the return value of it and on error exit rpcif_spi_probe() callback with error code.
--- drivers/spi/spi-rpc-if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-rpc-if.c +3 -1
@@ -139,7 +139,9 @@ static int rpcif_spi_probe(struct platform_device *pdev)return -ENOMEM ; rpc =spi_controller_get_devdata (ctlr); -rpcif_sw_init (rpc, parent); + error =rpcif_sw_init (rpc, parent); +if (error) +return error;platform_set_drvdata (pdev, ctlr);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 527/917 sched: Add wrapper for get_wchan() to keep task blocked
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 42a20f86dc19f9282d974df0ba4d226c865ab9dd ]
Having a stable wchan means the process must be blocked and for it to stay that way while performing stack unwinding.
--- arch/alpha/include/asm/processor.h | 2 +- arch/alpha/kernel/process.c | 5 ++--- arch/arc/include/asm/processor.h | 2 +- arch/arc/kernel/stacktrace.c | 4 ++-- arch/arm/include/asm/processor.h | 2 +- arch/arm/kernel/process.c | 4 +--- arch/arm64/include/asm/processor.h | 2 +- arch/arm64/kernel/process.c | 4 +--- arch/csky/include/asm/processor.h | 2 +- arch/csky/kernel/stacktrace.c | 5 ++--- arch/h8300/include/asm/processor.h | 2 +- arch/h8300/kernel/process.c | 5 +---- arch/hexagon/include/asm/processor.h | 2 +- arch/hexagon/kernel/process.c | 4 +--- arch/ia64/include/asm/processor.h | 2 +- arch/ia64/kernel/process.c | 5 +---- arch/m68k/include/asm/processor.h | 2 +- arch/m68k/kernel/process.c | 4 +--- arch/microblaze/include/asm/processor.h | 2 +- arch/microblaze/kernel/process.c | 2 +- arch/mips/include/asm/processor.h | 2 +- arch/mips/kernel/process.c | 8 +++----- arch/nds32/include/asm/processor.h | 2 +- arch/nds32/kernel/process.c | 7 +------ arch/nios2/include/asm/processor.h | 2 +- arch/nios2/kernel/process.c | 5 +---- arch/openrisc/include/asm/processor.h | 2 +- arch/openrisc/kernel/process.c | 2 +- arch/parisc/include/asm/processor.h | 2 +- arch/parisc/kernel/process.c | 5 +---- arch/powerpc/include/asm/processor.h | 2 +- arch/powerpc/kernel/process.c | 9 +++------ arch/riscv/include/asm/processor.h | 2 +- arch/riscv/kernel/stacktrace.c | 12 +++++------- arch/s390/include/asm/processor.h | 2 +- arch/s390/kernel/process.c | 4 ++-- arch/sh/include/asm/processor_32.h | 2 +- arch/sh/kernel/process_32.c | 5 +---- arch/sparc/include/asm/processor_32.h | 2 +- arch/sparc/include/asm/processor_64.h | 2 +- arch/sparc/kernel/process_32.c | 5 +---- arch/sparc/kernel/process_64.c | 5 +---- arch/um/include/asm/processor-generic.h | 2 +- arch/um/kernel/process.c | 5 +---- arch/x86/include/asm/processor.h | 2 +- arch/x86/kernel/process.c | 5 +---- arch/xtensa/include/asm/processor.h | 2 +- arch/xtensa/kernel/process.c | 5 +---- include/linux/sched.h | 1 + kernel/sched/core.c | 19 +++++++++++++++++++ 50 files changed, 80 insertions(+), 112 deletions(-)
arch/alpha/include/asm/processor.h +1 -1
@@ -42,7 +42,7 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long);struct task_struct ;extern void release_thread (struct task_struct *); -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define KSTK_EIP (tsk) (task_pt_regs(tsk)->pc)
arch/alpha/kernel/process.c +2 -3
@@ -376,12 +376,11 @@ thread_saved_pc(struct task_struct *t) }unsigned long -get_wchan (struct task_struct *p) +__get_wchan (struct task_struct *p) {unsigned long schedule_frame;unsigned long pc; -if (!p || p == current ||task_is_running (p)) -return 0 ; +/* * This one depends on the frame size of schedule(). Do a * "disass schedule" in gdb to find the frame size. Also, the
arch/arc/include/asm/processor.h +1 -1
@@ -70,7 +70,7 @@ struct task_struct;extern void start_thread (struct pt_regs * regs,unsigned long pc,unsigned long usp); -extern unsigned int get_wchan (struct task_struct *p); +extern unsigned int __get_wchan (struct task_struct *p);#endif /* !__ASSEMBLY__ */
arch/arc/kernel/stacktrace.c +2 -2
@@ -15,7 +15,7 @@* = specifics of data structs where trace is saved(CONFIG_STACKTRACE etc) * * vineetg: March 2009 -* -Implemented correct versions of thread_saved_pc() and get_wchan() +* -Implemented correct versions of thread_saved_pc() and __get_wchan() * * rajeshwarr: 2008 * -Initial implementation
@@ -248,7 +248,7 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl)* Of course just returning schedule( ) would be pointless so unwind until * the function is not in schedular code */ -unsigned int get_wchan (struct task_struct *tsk) +unsigned int __get_wchan (struct task_struct *tsk) {return arc_unwind_core (tsk,NULL , __get_first_nonsched,NULL ); }
arch/arm/include/asm/processor.h +1 -1
@@ -84,7 +84,7 @@ struct task_struct;/* Free all resources held by a thread. */ extern void release_thread (struct task_struct *); -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define task_pt_regs (p) \ ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
arch/arm/kernel/process.c +1 -3
@@ -276,13 +276,11 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,return 0 ; } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {struct stackframe frame;unsigned long stack_page;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; frame.fp =thread_saved_fp (p); frame.sp =thread_saved_sp (p);
arch/arm64/include/asm/processor.h +1 -1
@@ -257,7 +257,7 @@ struct task_struct;/* Free all resources held by a thread. */ extern void release_thread (struct task_struct *); -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);void update_sctlr_el1 (u64 sctlr);
arch/arm64/kernel/process.c +1 -3
@@ -528,13 +528,11 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,return last; } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {struct stackframe frame;unsigned long stack_page, ret =0 ;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; stack_page = (unsigned long )try_get_task_stack (p);if (!stack_page)
arch/csky/include/asm/processor.h +1 -1
@@ -81,7 +81,7 @@ static inline void release_thread(struct task_struct *dead_task)extern int kernel_thread (int (*fn)(void *),void *arg,unsigned long flags); -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define KSTK_EIP (tsk) (task_pt_regs(tsk)->pc)#define KSTK_ESP (tsk) (task_pt_regs(tsk)->usp)
arch/csky/kernel/stacktrace.c +2 -3
@@ -111,12 +111,11 @@ static bool save_wchan(unsigned long pc, void *arg)return false; } -unsigned long get_wchan (struct task_struct *task) +unsigned long __get_wchan (struct task_struct *task) {unsigned long pc =0 ; -if (likely (task && task != current && !task_is_running (task))) -walk_stackframe (task,NULL , save_wchan, &pc); +walk_stackframe (task,NULL , save_wchan, &pc);return pc; }
arch/h8300/include/asm/processor.h +1 -1
@@ -105,7 +105,7 @@ static inline void release_thread(struct task_struct *dead_task) { } -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define KSTK_EIP (tsk) \ ({ \
arch/h8300/kernel/process.c +1 -4
@@ -128,15 +128,12 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,return 0 ; } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long fp, pc;unsigned long stack_page;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; - stack_page = (unsigned long )p; fp = ((struct pt_regs *)p->thread.ksp)->er6; do {
arch/hexagon/include/asm/processor.h +1 -1
@@ -64,7 +64,7 @@ struct thread_struct {extern void release_thread (struct task_struct *dead_task);/* Get wait channel for task P. */ -extern unsigned long get_wchan (struct task_struct *p); +extern unsigned long __get_wchan (struct task_struct *p);/* The following stuff is pretty HEXAGON specific. */
arch/hexagon/kernel/process.c +1 -3
@@ -130,13 +130,11 @@ void flush_thread(void)* is an identification of the point at which the scheduler * was invoked by a blocked thread. */ -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long fp, pc;unsigned long stack_page;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; stack_page = (unsigned long )task_stack_page (p); fp = ((struct hexagon_switch_stack *)p->thread.switch_sp)->fp;
arch/ia64/include/asm/processor.h +1 -1
@@ -330,7 +330,7 @@ struct task_struct;#define release_thread (dead_task)/* Get wait channel for task P. */ -extern unsigned long get_wchan (struct task_struct *p); +extern unsigned long __get_wchan (struct task_struct *p);/* Return instruction pointer of blocked task TSK. */ #define KSTK_EIP (tsk) \
arch/ia64/kernel/process.c +1 -4
@@ -523,15 +523,12 @@ exit_thread (struct task_struct *tsk) }unsigned long -get_wchan (struct task_struct *p) +__get_wchan (struct task_struct *p) {struct unw_frame_info info;unsigned long ip;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; -/* * Note: p may not be a blocked task (it could be current or * another process running on some other CPU. Rather than
arch/m68k/include/asm/processor.h +1 -1
@@ -150,7 +150,7 @@ static inline void release_thread(struct task_struct *dead_task) { } -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define KSTK_EIP (tsk) \ ({ \
arch/m68k/kernel/process.c +1 -3
@@ -263,13 +263,11 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) }EXPORT_SYMBOL (dump_fpu); -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long fp, pc;unsigned long stack_page;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; stack_page = (unsigned long )task_stack_page (p); fp = ((struct switch_stack *)p->thread.ksp)->a6;
arch/microblaze/include/asm/processor.h +1 -1
@@ -68,7 +68,7 @@ static inline void release_thread(struct task_struct *dead_task) { } -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);/* The size allocated for kernel stacks. This _must_ be a power of two! */ # define KERNEL_STACK_SIZE 0x2000
arch/microblaze/kernel/process.c +1 -1
@@ -112,7 +112,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,return 0 ; } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {/* TBD (used by procfs) */ return 0 ;
arch/mips/include/asm/processor.h +1 -1
@@ -369,7 +369,7 @@ static inline void flush_thread(void) { } -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define __KSTK_TOS (tsk) ((unsigned long)task_stack_page(tsk) + \ THREAD_SIZE - 32 - sizeof(struct pt_regs))
arch/mips/kernel/process.c +3 -5
@@ -511,7 +511,7 @@ static int __init frame_info_init(void)/* * Without schedule() frame info, result given by -* thread_saved_pc() and get_wchan() are not reliable. +* thread_saved_pc() and __get_wchan() are not reliable. */ if (schedule_mfi.pc_offset <0 )printk ("Can't analyze schedule() prologue at %p\n" , schedule);
@@ -652,9 +652,9 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,#endif /* -* get_wchan - a maintenance nightmare^W^Wpain in the ass ... +* __get_wchan - a maintenance nightmare^W^Wpain in the ass ... */ -unsigned long get_wchan (struct task_struct *task) +unsigned long __get_wchan (struct task_struct *task) {unsigned long pc =0 ;#ifdef CONFIG_KALLSYMS
@@ -662,8 +662,6 @@ unsigned long get_wchan(struct task_struct *task)unsigned long ra =0 ;#endif -if (!task || task == current ||task_is_running (task)) - goto out;if (!task_stack_page (task)) goto out;
arch/nds32/include/asm/processor.h +1 -1
@@ -83,7 +83,7 @@ extern struct task_struct *last_task_used_math;/* Prepare to copy thread state - unlazy all lazy status */ #define prepare_to_copy (tsk) do { } while (0) -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define cpu_relax () barrier()
arch/nds32/kernel/process.c +1 -6
@@ -233,15 +233,12 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpu)EXPORT_SYMBOL (dump_fpu); -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long fp, lr;unsigned long stack_start, stack_end;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; -if (IS_ENABLED (CONFIG_FRAME_POINTER )) { stack_start = (unsigned long )end_of_stack (p); stack_end = (unsigned long )task_stack_page (p) +THREAD_SIZE ;
@@ -258,5 +255,3 @@ unsigned long get_wchan(struct task_struct *p) }return 0 ; } - -EXPORT_SYMBOL (get_wchan);
arch/nios2/include/asm/processor.h +1 -1
@@ -69,7 +69,7 @@ static inline void release_thread(struct task_struct *dead_task) { } -extern unsigned long get_wchan (struct task_struct *p); +extern unsigned long __get_wchan (struct task_struct *p);#define task_pt_regs (p) \ ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
arch/nios2/kernel/process.c +1 -4
@@ -217,15 +217,12 @@ void dump(struct pt_regs *fp)pr_emerg ("\n\n" ); } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long fp, pc;unsigned long stack_page;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; - stack_page = (unsigned long )p; fp = ((struct switch_stack *)p->thread.ksp)->fp;/* ;dgt2 */ do {
arch/openrisc/include/asm/processor.h +1 -1
@@ -73,7 +73,7 @@ struct thread_struct {void start_thread (struct pt_regs *regs,unsigned long nip,unsigned long sp);void release_thread (struct task_struct *); -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define cpu_relax () barrier()
arch/openrisc/kernel/process.c +1 -1
@@ -263,7 +263,7 @@ void dump_elf_thread(elf_greg_t *dest, struct pt_regs* regs) dest[35 ] =0 ; } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {/* TODO */
arch/parisc/include/asm/processor.h +1 -1
@@ -273,7 +273,7 @@ struct mm_struct;/* Free all resources held by a thread. */ extern void release_thread (struct task_struct *); -extern unsigned long get_wchan (struct task_struct *p); +extern unsigned long __get_wchan (struct task_struct *p);#define KSTK_EIP (tsk) ((tsk)->thread.regs.iaoq[0])#define KSTK_ESP (tsk) ((tsk)->thread.regs.gr[30])
arch/parisc/kernel/process.c +1 -4
@@ -240,15 +240,12 @@ copy_thread(unsigned long clone_flags, unsigned long usp, }unsigned long -get_wchan (struct task_struct *p) +__get_wchan (struct task_struct *p) {struct unwind_frame_info info;unsigned long ip;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; -/* * These bracket the sleeping functions.. */
arch/powerpc/include/asm/processor.h +1 -1
@@ -300,7 +300,7 @@ struct thread_struct {#define task_pt_regs (tsk) ((tsk)->thread.regs) -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define KSTK_EIP (tsk) ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)#define KSTK_ESP (tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0)
arch/powerpc/kernel/process.c +3 -6
@@ -2111,14 +2111,11 @@ int validate_sp(unsigned long sp, struct task_struct *p,EXPORT_SYMBOL (validate_sp); -static unsigned long __get_wchan (struct task_struct *p) +static unsigned long ___get_wchan (struct task_struct *p) {unsigned long ip, sp;int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; - sp = p->thread.ksp;if (!validate_sp (sp, p,STACK_FRAME_OVERHEAD ))return 0 ;
@@ -2137,14 +2134,14 @@ static unsigned long __get_wchan(struct task_struct *p)return 0 ; } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long ret;if (!try_get_task_stack (p))return 0 ; - ret =__get_wchan (p); + ret =___get_wchan (p);put_task_stack (p);
arch/riscv/include/asm/processor.h +1 -1
@@ -66,7 +66,7 @@ static inline void release_thread(struct task_struct *dead_task) { } -extern unsigned long get_wchan (struct task_struct *p); +extern unsigned long __get_wchan (struct task_struct *p);static inline void wait_for_interrupt (void )
arch/riscv/kernel/stacktrace.c +5 -7
@@ -128,16 +128,14 @@ static bool save_wchan(void *arg, unsigned long pc)return true; } -unsigned long get_wchan (struct task_struct *task) +unsigned long __get_wchan (struct task_struct *task) {unsigned long pc =0 ; -if (likely (task && task != current && !task_is_running (task))) { -if (!try_get_task_stack (task)) -return 0 ; -walk_stackframe (task,NULL , save_wchan, &pc); -put_task_stack (task); - } +if (!try_get_task_stack (task)) +return 0 ; +walk_stackframe (task,NULL , save_wchan, &pc); +put_task_stack (task);return pc; }
arch/s390/include/asm/processor.h +1 -1
@@ -192,7 +192,7 @@ static inline void release_thread(struct task_struct *tsk) { }void guarded_storage_release (struct task_struct *tsk);void gs_load_bc_cb (struct pt_regs *regs); -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);#define task_pt_regs (tsk) ((struct pt_regs *) \ (task_stack_page(tsk) + THREAD_SIZE) - 1)#define KSTK_EIP (tsk) (task_pt_regs(tsk)->psw.addr)
arch/s390/kernel/process.c +2 -2
@@ -181,12 +181,12 @@ void execve_tail(void) asmvolatile ("sfpc %0" : :"d" (0 )); } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {struct unwind_state state;unsigned long ip =0 ; -if (!p || p == current ||task_is_running (p) || !task_stack_page (p)) +if (!task_stack_page (p))return 0 ;if (!try_get_task_stack (p))
arch/sh/include/asm/processor_32.h +1 -1
@@ -180,7 +180,7 @@ static inline void show_code(struct pt_regs *regs) }#endif -extern unsigned long get_wchan (struct task_struct *p); +extern unsigned long __get_wchan (struct task_struct *p);#define KSTK_EIP (tsk) (task_pt_regs(tsk)->pc)#define KSTK_ESP (tsk) (task_pt_regs(tsk)->regs[15])
arch/sh/kernel/process_32.c +1 -4
@@ -182,13 +182,10 @@ __switch_to(struct task_struct *prev, struct task_struct *next)return prev; } -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long pc; -if (!p || p == current ||task_is_running (p)) -return 0 ; -/* * The same comment as on the Alpha applies here, too ... */
arch/sparc/include/asm/processor_32.h +1 -1
@@ -89,7 +89,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,/* Free all resources held by a thread. */ #define release_thread (tsk) do { } while(0) -unsigned long get_wchan (struct task_struct *); +unsigned long __get_wchan (struct task_struct *);#define task_pt_regs (tsk) ((tsk)->thread.kregs)#define KSTK_EIP (tsk) ((tsk)->thread.kregs->pc)
arch/sparc/include/asm/processor_64.h +1 -1
@@ -183,7 +183,7 @@ do { \/* Free all resources held by a thread. */ #define release_thread (tsk) do { } while (0) -unsigned long get_wchan (struct task_struct *task); +unsigned long __get_wchan (struct task_struct *task);#define task_pt_regs (tsk) (task_thread_info(tsk)->kregs)#define KSTK_EIP (tsk) (task_pt_regs(tsk)->tpc)
arch/sparc/kernel/process_32.c +1 -4
@@ -365,7 +365,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,return 0 ; } -unsigned long get_wchan (struct task_struct *task) +unsigned long __get_wchan (struct task_struct *task) {unsigned long pc, fp, bias =0 ;unsigned long task_base = (unsigned long ) task;
@@ -373,9 +373,6 @@ unsigned long get_wchan(struct task_struct *task)struct reg_window32 *rw;int count =0 ; -if (!task || task == current ||task_is_running (task)) - goto out; - fp =task_thread_info (task)->ksp + bias; do { /* Bogus frame pointer? */
arch/sparc/kernel/process_64.c +1 -4
@@ -663,7 +663,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)return 0 ; } -unsigned long get_wchan (struct task_struct *task) +unsigned long __get_wchan (struct task_struct *task) {unsigned long pc, fp, bias =0 ;struct thread_info *tp;
@@ -671,9 +671,6 @@ unsigned long get_wchan(struct task_struct *task)unsigned long ret =0 ;int count =0 ; -if (!task || task == current ||task_is_running (task)) - goto out; - tp =task_thread_info (task); bias =STACK_BIAS ; fp =task_thread_info (task)->ksp + bias;
arch/um/include/asm/processor-generic.h +1 -1
@@ -106,6 +106,6 @@ extern struct cpuinfo_um boot_cpu_data;#define cache_line_size () (boot_cpu_data.cache_alignment)#define KSTK_REG (tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf) -extern unsigned long get_wchan (struct task_struct *p); +extern unsigned long __get_wchan (struct task_struct *p);#endif
arch/um/kernel/process.c +1 -4
@@ -364,14 +364,11 @@ unsigned long arch_align_stack(unsigned long sp) }#endif -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long stack_page, sp, ip;bool seen_sched =0 ; -if ((p ==NULL ) || (p == current) ||task_is_running (p)) -return 0 ; - stack_page = (unsigned long )task_stack_page (p);/* Bail if the process has no kernel stack for some reason */ if (stack_page ==0 )
arch/x86/include/asm/processor.h +1 -1
@@ -590,7 +590,7 @@ static inline void load_sp0(unsigned long sp0)/* Free all resources held by a thread. */ extern void release_thread (struct task_struct *); -unsigned long get_wchan (struct task_struct *p); +unsigned long __get_wchan (struct task_struct *p);/* * Generic CPUID function
arch/x86/kernel/process.c +1 -4
@@ -943,13 +943,10 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)* because the task might wake up and we might look at a stack * changing under us. */ -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long entry =0 ; -if (p == current ||task_is_running (p)) -return 0 ; -stack_trace_save_tsk (p, &entry,1 ,0 );return entry; }
arch/xtensa/include/asm/processor.h +1 -1
@@ -215,7 +215,7 @@ struct mm_struct;/* Free all resources held by a thread. */ #define release_thread (thread) do { } while(0) -extern unsigned long get_wchan (struct task_struct *p); +extern unsigned long __get_wchan (struct task_struct *p);#define KSTK_EIP (tsk) (task_pt_regs(tsk)->pc)#define KSTK_ESP (tsk) (task_pt_regs(tsk)->areg[1])
arch/xtensa/kernel/process.c +1 -4
@@ -298,15 +298,12 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,* These bracket the sleeping functions.. */ -unsigned long get_wchan (struct task_struct *p) +unsigned long __get_wchan (struct task_struct *p) {unsigned long sp, pc;unsigned long stack_page = (unsigned long )task_stack_page (p);int count =0 ; -if (!p || p == current ||task_is_running (p)) -return 0 ; - sp = p->thread.sp; pc =MAKE_PC_FROM_RA (p->thread.ra, p->thread.sp);
include/linux/sched.h +1 -0
@@ -2137,6 +2137,7 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)#endif /* CONFIG_SMP */ extern bool sched_task_on_rq (struct task_struct *p); +extern unsigned long get_wchan (struct task_struct *p);/* * In order to reduce various lock holder preemption latencies provide an
kernel/sched/core.c +19 -0
@@ -1962,6 +1962,25 @@ bool sched_task_on_rq(struct task_struct *p)return task_on_rq_queued (p); } +unsigned long get_wchan (struct task_struct *p) +{ +unsigned long ip =0 ; +unsigned int state; + +if (!p || p == current) +return 0 ; + +/* Only get wchan if task is blocked and we can keep it that way. */ +raw_spin_lock_irq (&p->pi_lock); + state =READ_ONCE (p->__state); +smp_rmb ();/* see try_to_wake_up() */ +if (state !=TASK_RUNNING && state !=TASK_WAKING && !p->on_rq) + ip =__get_wchan (p); +raw_spin_unlock_irq (&p->pi_lock); + +return ip; +} +static inline void enqueue_task (struct rq *rq,struct task_struct *p,int flags) {if (!(flags &ENQUEUE_NOCLOCK ))
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 528/917 x86: Fix __get_wchan() for !STACKTRACE
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 5d1ceb3969b6b2e47e2df6d17790a7c5a20fcbb4 ]
Use asm/unwind.h to implement wchan, since we cannot always rely on STACKTRACE=y.
--- arch/x86/kernel/process.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
arch/x86/kernel/process.c +14 -3
@@ -43,6 +43,7 @@#include <asm/io_bitmap.h> #include <asm/proto.h> #include <asm/frame.h> +#include <asm/unwind.h> #include "process.h"
@@ -945,10 +946,20 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)*/ unsigned long __get_wchan (struct task_struct *p) { -unsigned long entry =0 ; +struct unwind_state state; +unsigned long addr =0 ; -stack_trace_save_tsk (p, &entry,1 ,0 ); -return entry; +for (unwind_start (&state, p,NULL ,NULL ); !unwind_done (&state); +unwind_next_frame (&state)) { + addr =unwind_get_return_address (&state); +if (!addr) +break ; +if (in_sched_functions (addr)) +continue ; +break ; + } + +return addr; } long do_arch_prctl_common(struct task_struct *task, int option,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 529/917 samples/kretprobes: Fix return value if register_kretprobe() failed
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit f76fbbbb5061fe14824ba5807c44bd7400a6b4e1 ]
Use the actual return value instead of always -1 if register_kretprobe() failed.
E.g. without this patch:
# insmod samples/kprobes/kretprobe_example.ko func=no_such_func insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Operation not permitted
With this patch:
# insmod samples/kprobes/kretprobe_example.ko func=no_such_func insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Unknown symbol in module
--- samples/kprobes/kretprobe_example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/kprobes/kretprobe_example.c +1 -1
@@ -86,7 +86,7 @@ static int __init kretprobe_init(void) ret =register_kretprobe (&my_kretprobe);if (ret <0 ) {pr_err ("register_kretprobe failed, returned %d\n" , ret); -return -1 ; +return ret; }pr_info ("Planted return probe at %s: %p\n" , my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 544/917 sctp: subtract sctphdr len in sctp_transport_pl_hlen
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit cc4665ca646c96181a7c00198aa72c59e0c576e8 ]
sctp_transport_pl_hlen() is called to calculate the outer header length for PL. However, as the Figure in rfc8899#section-4.4:
Any additional
headers .--- MPS -----.
| | |
v v v
+------------------------------+
| IP | ** | PL | protocol data |
+------------------------------+ <----- PLPMTU ----->
<---------- PMTU -------------->Outer header are IP + Any additional headers, which doesn't include Packetization Layer itself header, namely sctphdr, whereas sctphdr is counted by __sctp_mtu_payload().
The incorrect calculation caused the link pathmtu to be set larger than expected by t->pl.pmtu + sctp_transport_pl_hlen(). This patch is to fix it by subtracting sctphdr len in sctp_transport_pl_hlen().
--- include/net/sctp/sctp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/net/sctp/sctp.h +2 -1
@@ -626,7 +626,8 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize)static inline int sctp_transport_pl_hlen (struct sctp_transport *t) { -return __sctp_mtu_payload (sctp_sk (t->asoc->base.sk), t,0 ,0 ); +return __sctp_mtu_payload (sctp_sk (t->asoc->base.sk), t,0 ,0 ) - +sizeof (struct sctphdr ); }static inline void sctp_transport_pl_reset (struct sctp_transport *t)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 551/917 net: bridge: fix uninitialized variables when BRIDGE_CFM is disabled
In reply to Greg Kroah-HartmanFrom: Ivan Vecera <[email protected]>
[ Upstream commit 829e050eea69c7442441b714b6f5b339b5b8c367 ]
Function br_get_link_af_size_filtered() calls br_cfm_{,peer}_mep_count() that return a count. When BRIDGE_CFM is not enabled these functions simply return -EOPNOTSUPP but do not modify count parameter and calling function then works with uninitialized variables. Modify these inline functions to return zero in count parameter.
--- net/bridge/br_private.h | 2 ++ 1 file changed, 2 insertions(+)
net/bridge/br_private.h +2 -0
@@ -1911,11 +1911,13 @@ static inline int br_cfm_status_fill_info(struct sk_buff *skb,static inline int br_cfm_mep_count (struct net_bridge *br,u32 *count) { + *count =0 ;return -EOPNOTSUPP ; }static inline int br_cfm_peer_mep_count (struct net_bridge *br,u32 *count) { + *count =0 ;return -EOPNOTSUPP ; }#endif
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 553/917 crypto: pcrypt - Delay write to padata->info
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
[ Upstream commit 68b6dea802cea0dbdd8bd7ccc60716b5a32a5d8a ]
These three events can race when pcrypt is used multiple times in a template ("pcrypt(pcrypt(...))"):
1. [taskA] The caller makes the crypto request via crypto_aead_encrypt() 2. [kworkerB] padata serializes the inner pcrypt request 3. [kworkerC] padata serializes the outer pcrypt request
3 might finish before the call to crypto_aead_encrypt() returns in 1, resulting in two possible issues.
First, a use-after-free of the crypto request's memory when, for example, taskA writes to the outer pcrypt request's padata->info in pcrypt_aead_enc() after kworkerC completes the request.
Second, the outer pcrypt request overwrites the inner pcrypt request's return code with -EINPROGRESS, making a successful request appear to fail. For instance, kworkerB writes the outer pcrypt request's padata->info in pcrypt_aead_done() and then taskA overwrites it in pcrypt_aead_enc().
Avoid both situations by delaying the write of padata->info until after the inner crypto request's return code is checked. This prevents the use-after-free by not touching the crypto request's memory after the next-inner crypto request is made, and stops padata->info from being overwritten.
--- crypto/pcrypt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
crypto/pcrypt.c +8 -4
@@ -78,12 +78,14 @@ static void pcrypt_aead_enc(struct padata_priv *padata) {struct pcrypt_request *preq =pcrypt_padata_request (padata);struct aead_request *req =pcrypt_request_ctx (preq); +int ret; - padata->info =crypto_aead_encrypt (req); + ret =crypto_aead_encrypt (req); -if (padata->info == -EINPROGRESS ) +if (ret == -EINPROGRESS )return ; + padata->info = ret;padata_do_serial (padata); }
@@ -123,12 +125,14 @@ static void pcrypt_aead_dec(struct padata_priv *padata) {struct pcrypt_request *preq =pcrypt_padata_request (padata);struct aead_request *req =pcrypt_request_ctx (preq); +int ret; - padata->info =crypto_aead_decrypt (req); + ret =crypto_aead_decrypt (req); -if (padata->info == -EINPROGRESS ) +if (ret == -EINPROGRESS )return ; + padata->info = ret;padata_do_serial (padata); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 554/917 selftests/bpf: Fix fclose/pclose mismatch in test_progs
In reply to Greg Kroah-HartmanFrom: Andrea Righi <[email protected]>
[ Upstream commit f48ad69097fe79d1de13c4d8fef556d4c11c5e68 ]
Make sure to use pclose() to properly close the pipe opened by popen().
--- tools/testing/selftests/bpf/test_progs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/test_progs.c +2 -2
@@ -370,7 +370,7 @@ int extract_build_id(char *build_id, size_t size)if (getline (&line, &len, fp) ==-1 ) goto err; -fclose (fp); +pclose (fp);if (len > size) len = size;
@@ -379,7 +379,7 @@ int extract_build_id(char *build_id, size_t size)free (line);return 0 ; err: -fclose (fp); +pclose (fp);return -1 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 555/917 udp6: allow SO_MARK ctrl msg to affect routing
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 42dcfd850e514b229d616a53dec06d0f2533217c ]
Commit c6af0c227a22 ("ip: support SO_MARK cmsg") added propagation of SO_MARK from cmsg to skb->mark. For IPv4 and raw sockets the mark also affects route lookup, but in case of IPv6 the flow info is initialized before cmsg is parsed.
--- net/ipv6/udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/udp.c +1 -1
@@ -1435,7 +1435,6 @@ do_udp_sendmsg:if (!fl6.flowi6_oif) fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; - fl6.flowi6_mark = ipc6.sockc.mark; fl6.flowi6_uid = sk->sk_uid;if (msg->msg_controllen) {
@@ -1471,6 +1470,7 @@ do_udp_sendmsg: ipc6.opt = opt; fl6.flowi6_proto = sk->sk_protocol; + fl6.flowi6_mark = ipc6.sockc.mark; fl6.daddr = *daddr;if (ipv6_addr_any (&fl6.saddr) && !ipv6_addr_any (&np->saddr)) fl6.saddr = np->saddr;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 557/917 ibmvnic: Process crqs after enabling interrupts
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 6e20d00158f31f7631d68b86996b7e951c4451c8 ]
Soon after registering a CRQ it is possible that we get a fail over or maybe a CRQ_INIT from the VIOS while interrupts were disabled.
Look for any such CRQs after enabling interrupts.
Otherwise we can intermittently fail to bring up ibmvnic adapters during boot, specially in kexec/kdump kernels.
--- drivers/net/ethernet/ibm/ibmvnic.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/ibm/ibmvnic.c +3 -0
@@ -5412,6 +5412,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter) crq->cur =0 ;spin_lock_init (&crq->lock); +/* process any CRQs that were queued before we enabled interrupts */ +tasklet_schedule (&adapter->tasklet); +return retrc; req_irq_failed:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 566/917 staging: r8188eu: fix memory leak in rtw_set_key
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 393db0f6827f96054a769ba3a38aa382d137d3c7 ]
Before returning with an error we should free allocated buffers, since they are not assigned to anywhere.
--- drivers/staging/r8188eu/core/rtw_mlme.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/r8188eu/core/rtw_mlme.c +2 -0
@@ -1722,6 +1722,8 @@ int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv, in psetkeyparm->grpkey =1 ;break ;default : +kfree (psetkeyparm); +kfree (pcmd); res = _FAIL; goto exit; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 567/917 arm64: dts: meson: sm1: add Ethernet PHY reset line for ODROID-C4/HC4
In reply to Greg Kroah-HartmanFrom: Dongjin Kim <[email protected]>
[ Upstream commit 9d02214f8332d5dbbcce3d6c5c915e54d43a0c46 ]
This patch is to fix an issue that the ethernet link doesn't come up when using ip link set down/up:
[ 11.428114] meson8b-dwmac ff3f0000.ethernet eth0: Link is Down [ 14.428595] meson8b-dwmac ff3f0000.ethernet eth0: PHY [0.0:00] driver [RTL8211F Gigabit Ethernet] (irq=31) [ 14.428610] meson8b-dwmac ff3f0000.ethernet: Failed to reset the dma [ 14.428974] meson8b-dwmac ff3f0000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed [ 14.711185] meson8b-dwmac ff3f0000.ethernet eth0: stmmac_open: Hw setup failed
This fix refers to two commits applied for ODROID-N2 (G12B).
commit 658e4129bb81 ("arm64: dts: meson: g12b: odroid-n2: add the Ethernet PHY reset line")
commit 1c7412530d5d0 ("arm64: dts: meson: g12b: odroid-n2: fix PHY deassert timing requirements")--- arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi +4 -0
@@ -263,6 +263,10 @@ reg = <0>; max-speed = <1000>; + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; + interrupt-parent = <&gpio_intc>; /* MAC_INTR on GPIOZ_14 */ interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 568/917 iio: st_sensors: disable regulators after device unregistration
In reply to Greg Kroah-HartmanFrom: Alexandru Ardelean <[email protected]>
[ Upstream commit 9f0b3e0cc0c88618aa9e5cecef747b1337ae0a5d ]
Up until commit ea7e586bdd331 ("iio: st_sensors: move regulator retrieveal to core") only the ST pressure driver seems to have had any regulator disable. After that commit, the regulator handling was moved into the common st_sensors logic.
In all instances of this regulator handling, the regulators were disabled before unregistering the IIO device.
This can cause issues where the device would be powered down and still be available to userspace, allowing it to send invalid/garbage data.
This change moves the st_sensors_power_disable() after the common probe functions. These common probe functions also handle unregistering the IIO device.
--- drivers/iio/accel/st_accel_i2c.c | 4 ++-- drivers/iio/accel/st_accel_spi.c | 4 ++-- drivers/iio/gyro/st_gyro_i2c.c | 4 ++-- drivers/iio/gyro/st_gyro_spi.c | 4 ++-- drivers/iio/magnetometer/st_magn_i2c.c | 4 ++-- drivers/iio/magnetometer/st_magn_spi.c | 4 ++-- drivers/iio/pressure/st_pressure_i2c.c | 4 ++-- drivers/iio/pressure/st_pressure_spi.c | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-)
drivers/iio/accel/st_accel_i2c.c +2 -2
@@ -193,10 +193,10 @@ static int st_accel_i2c_remove(struct i2c_client *client) {struct iio_dev *indio_dev =i2c_get_clientdata (client); -st_sensors_power_disable (indio_dev); -st_accel_common_remove (indio_dev); +st_sensors_power_disable (indio_dev); +return 0 ; }
drivers/iio/accel/st_accel_spi.c +2 -2
@@ -143,10 +143,10 @@ static int st_accel_spi_remove(struct spi_device *spi) {struct iio_dev *indio_dev =spi_get_drvdata (spi); -st_sensors_power_disable (indio_dev); -st_accel_common_remove (indio_dev); +st_sensors_power_disable (indio_dev); +return 0 ; }
drivers/iio/gyro/st_gyro_i2c.c +2 -2
@@ -106,10 +106,10 @@ static int st_gyro_i2c_remove(struct i2c_client *client) {struct iio_dev *indio_dev =i2c_get_clientdata (client); -st_sensors_power_disable (indio_dev); -st_gyro_common_remove (indio_dev); +st_sensors_power_disable (indio_dev); +return 0 ; }
drivers/iio/gyro/st_gyro_spi.c +2 -2
@@ -110,10 +110,10 @@ static int st_gyro_spi_remove(struct spi_device *spi) {struct iio_dev *indio_dev =spi_get_drvdata (spi); -st_sensors_power_disable (indio_dev); -st_gyro_common_remove (indio_dev); +st_sensors_power_disable (indio_dev); +return 0 ; }
drivers/iio/magnetometer/st_magn_i2c.c +2 -2
@@ -102,10 +102,10 @@ static int st_magn_i2c_remove(struct i2c_client *client) {struct iio_dev *indio_dev =i2c_get_clientdata (client); -st_sensors_power_disable (indio_dev); -st_magn_common_remove (indio_dev); +st_sensors_power_disable (indio_dev); +return 0 ; }
drivers/iio/magnetometer/st_magn_spi.c +2 -2
@@ -96,10 +96,10 @@ static int st_magn_spi_remove(struct spi_device *spi) {struct iio_dev *indio_dev =spi_get_drvdata (spi); -st_sensors_power_disable (indio_dev); -st_magn_common_remove (indio_dev); +st_sensors_power_disable (indio_dev); +return 0 ; }
drivers/iio/pressure/st_pressure_i2c.c +2 -2
@@ -119,10 +119,10 @@ static int st_press_i2c_remove(struct i2c_client *client) {struct iio_dev *indio_dev =i2c_get_clientdata (client); -st_sensors_power_disable (indio_dev); -st_press_common_remove (indio_dev); +st_sensors_power_disable (indio_dev); +return 0 ; }
drivers/iio/pressure/st_pressure_spi.c +2 -2
@@ -102,10 +102,10 @@ static int st_press_spi_remove(struct spi_device *spi) {struct iio_dev *indio_dev =spi_get_drvdata (spi); -st_sensors_power_disable (indio_dev); -st_press_common_remove (indio_dev); +st_sensors_power_disable (indio_dev); +return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 581/917 arm64: dts: ti: k3-j721e-main: Fix "bus-range" upto 256 bus number for PCIe
In reply to Greg Kroah-HartmanFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 5f46633565b1c1e1840a927676065d72b442dac4 ]
commit 4e5833884f66 ("arm64: dts: ti: k3-j721e-main: Add PCIe device tree nodes") restricted PCIe bus numbers from 0 to 15 (due to SMMU restriction in J721E). However since SMMU is not enabled, allow the full supported bus numbers from 0 to 255.
--- arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +4 -4
@@ -610,7 +610,7 @@ clock-names = "fck"; #address-cells = <3>; #size-cells = <2>; - bus-range = <0x0 0xf>; + bus-range = <0x0 0xff>; vendor-id = <0x104c>; device-id = <0xb00d>; msi-map = <0x0 &gic_its 0x0 0x10000>;
@@ -658,7 +658,7 @@ clock-names = "fck"; #address-cells = <3>; #size-cells = <2>; - bus-range = <0x0 0xf>; + bus-range = <0x0 0xff>; vendor-id = <0x104c>; device-id = <0xb00d>; msi-map = <0x0 &gic_its 0x10000 0x10000>;
@@ -706,7 +706,7 @@ clock-names = "fck"; #address-cells = <3>; #size-cells = <2>; - bus-range = <0x0 0xf>; + bus-range = <0x0 0xff>; vendor-id = <0x104c>; device-id = <0xb00d>; msi-map = <0x0 &gic_its 0x20000 0x10000>;
@@ -754,7 +754,7 @@ clock-names = "fck"; #address-cells = <3>; #size-cells = <2>; - bus-range = <0x0 0xf>; + bus-range = <0x0 0xff>; vendor-id = <0x104c>; device-id = <0xb00d>; msi-map = <0x0 &gic_its 0x30000 0x10000>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 586/917 arm64: dts: meson-sm1: Fix the pwm regulator supply properties
In reply to Greg Kroah-HartmanFrom: Anand Moon <[email protected]>
[ Upstream commit 0b26fa8a02c2834f1fa8a206a285b9f84c4ad764 ]
After enabling CONFIG_REGULATOR_DEBUG=y we observe below debug logs. Changes help link VDDCPU pwm regulator to 12V regulator supply instead of dummy regulator.
[ 11.602281] pwm-regulator regulator-vddcpu: Looking up pwm-supply property
in node /regulator-vddcpu failed
[ 11.602344] VDDCPU: supplied by regulator-dummy
[ 11.602365] regulator-dummy: could not add device link regulator.11: -ENOENT
[ 11.602548] VDDCPU: 721 <--> 1022 mV at 1022 mV, enabled--- arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi | 2 +- arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts +1 -1
@@ -173,7 +173,7 @@ regulator-min-microvolt = <690000>; regulator-max-microvolt = <1050000>; - vin-supply = <&dc_in>; + pwm-supply = <&dc_in>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts +1 -1
@@ -24,7 +24,7 @@ regulator-min-microvolt = <690000>; regulator-max-microvolt = <1050000>; - vin-supply = <&vsys_3v3>; + pwm-supply = <&vsys_3v3>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi +1 -1
@@ -116,7 +116,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&main_12v>; + pwm-supply = <&main_12v>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts +1 -1
@@ -185,7 +185,7 @@ regulator-min-microvolt = <690000>; regulator-max-microvolt = <1050000>; - vin-supply = <&dc_in>; + pwm-supply = <&dc_in>; pwms = <&pwm_AO_cd 1 1500 0>; pwm-dutycycle-range = <100 0>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 556/917 ibmvnic: dont stop queue in xmit
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 8878e46fcfd46b19964bd90e13b25dd94cbfc9be ]
If adapter's resetting bit is on, discard the packet but don't stop the transmit queue - instead leave that to the reset code. With this change, it is possible that we may get several calls to ibmvnic_xmit() that simply discard packets and return.
But if we stop the queue here, we might end up doing so just after __ibmvnic_open() started the queues (during a hard/soft reset) and before the ->resetting bit was cleared. If that happens, there will be no one to restart queue and transmissions will be blocked indefinitely.
This can cause a TIMEOUT reset and with auto priority failover enabled, an unnecessary FAILOVER reset to less favored backing device and then a FAILOVER back to the most favored backing device. If we hit the window repeatedly, we can get stuck in a loop of TIMEOUT, FAILOVER, FAILOVER resets leaving the adapter unusable for extended periods of time.
--- drivers/net/ethernet/ibm/ibmvnic.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -2
@@ -1724,8 +1724,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) ind_bufp = &tx_scrq->ind_buf;if (test_bit (0 , &adapter->resetting)) { -if (!netif_subqueue_stopped (netdev, skb)) -netif_stop_subqueue (netdev, queue_num);dev_kfree_skb_any (skb); tx_send_failed++;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 560/917 skmsg: Lose offset info in sk_psock_skb_ingress
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 7303524e04af49a47991e19f895c3b8cdc3796c7 ]
If sockmap enable strparser, there are lose offset info in sk_psock_skb_ingress(). If the length determined by parse_msg function is not skb->len, the skb will be converted to sk_msg multiple times, and userspace app will get the data multiple times.
Fix this by get the offset and length from strp_msg. And as Cong suggested, add one bit in skb->_sk_redir to distinguish enable or disable strparser.
--- include/linux/skmsg.h | 18 ++++++++++++++++-- net/core/skmsg.c | 43 +++++++++++++++++++++++++++++++++---------- 2 files changed, 49 insertions(+), 12 deletions(-)
include/linux/skmsg.h +16 -2
@@ -509,8 +509,22 @@ static inline bool sk_psock_strp_enabled(struct sk_psock *psock)#if IS_ENABLED (CONFIG_NET_SOCK_MSG ) -/* We only have one bit so far. */ -#define BPF_F_PTR_MASK ~(BPF_F_INGRESS) +#define BPF_F_STRPARSER (1UL << 1) + +/* We only have two bits so far. */ +#define BPF_F_PTR_MASK ~(BPF_F_INGRESS | BPF_F_STRPARSER) + +static inline bool skb_bpf_strparser (const struct sk_buff *skb) +{ +unsigned long sk_redir = skb->_sk_redir; + +return sk_redir &BPF_F_STRPARSER ; +} + +static inline void skb_bpf_set_strparser (struct sk_buff *skb) +{ + skb->_sk_redir |=BPF_F_STRPARSER ; +}static inline bool skb_bpf_ingress (const struct sk_buff *skb) {
net/core/skmsg.c +33 -10
131 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 561/917 cgroup: Fix rootcg cpu.stat guest double counting
In reply to Greg Kroah-HartmanFrom: Dan Schatzberg <[email protected]>
[ Upstream commit 81c49d39aea8a10e6d05d3aa1cb65ceb721e19b0 ]
In account_guest_time in kernel/sched/cputime.c guest time is attributed to both CPUTIME_NICE and CPUTIME_USER in addition to CPUTIME_GUEST_NICE and CPUTIME_GUEST respectively. Therefore, adding both to calculate usage results in double counting any guest time at the rootcg.
--- kernel/cgroup/rstat.c | 2 -- 1 file changed, 2 deletions(-)
kernel/cgroup/rstat.c +0 -2
@@ -433,8 +433,6 @@ static void root_cgroup_cputime(struct task_cputime *cputime) cputime->sum_exec_runtime += user; cputime->sum_exec_runtime += sys; cputime->sum_exec_runtime += cpustat[CPUTIME_STEAL ]; - cputime->sum_exec_runtime += cpustat[CPUTIME_GUEST ]; - cputime->sum_exec_runtime += cpustat[CPUTIME_GUEST_NICE ]; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 562/917 bpf: Fix propagation of bounds from 64-bit min/max into 32-bit and var_off.
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit b9979db8340154526d9ab38a1883d6f6ba9b6d47 ]
Before this fix:
166: (b5) if r2 <= 0x1 goto pc+22
from 166 to 189: R2=invP(id=1,umax_value=1,var_off=(0x0; 0xffffffff))
After this fix:
166: (b5) if r2 <= 0x1 goto pc+22
from 166 to 189: R2=invP(id=1,umax_value=1,var_off=(0x0; 0x1))
While processing BPF_JLE the reg_set_min_max() would set true_reg->umax_value = 1 and call __reg_combine_64_into_32(true_reg).
Without the fix it would not pass the condition:
if (__reg64_bound_u32(reg->umin_value) && __reg64_bound_u32(reg->umax_value))
since umin_value == 0 at this point.
Before commit 10bf4e83167c the umin was incorrectly ingored.
The commit 10bf4e83167c fixed the correctness issue, but pessimized propagation of 64-bit min max into 32-bit min max and corresponding var_off.
--- kernel/bpf/verifier.c | 2 +- tools/testing/selftests/bpf/verifier/array_access.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +1 -1
@@ -1411,7 +1411,7 @@ static bool __reg64_bound_s32(s64 a)static bool __reg64_bound_u32 (u64 a) { -return a >U32_MIN && a <U32_MAX ; +return a >=U32_MIN && a <=U32_MAX ; }static void __reg_combine_64_into_32 (struct bpf_reg_state *reg)
tools/testing/selftests/bpf/verifier/array_access.c +1 -1
@@ -186,7 +186,7 @@ }, .fixup_map_hash_48b = { 3 }, .errstr_unpriv = "R0 leaks addr", - .errstr = "R0 unbounded memory access", + .errstr = "invalid access to map value, value_size=48 off=44 size=8", .result_unpriv = REJECT, .result = REJECT, .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 584/917 arm64: dts: meson-g12a: Fix the pwm regulator supply properties
In reply to Greg Kroah-HartmanFrom: Anand Moon <[email protected]>
[ Upstream commit 085675117ecf5e02c4220698fd549024ec64ad2c ]
After enabling CONFIG_REGULATOR_DEBUG=y we observe below debug logs. Changes help link VDDCPU pwm regulator to 12V regulator supply instead of dummy regulator.
[ 11.602281] pwm-regulator regulator-vddcpu: Looking up pwm-supply property
in node /regulator-vddcpu failed
[ 11.602344] VDDCPU: supplied by regulator-dummy
[ 11.602365] regulator-dummy: could not add device link regulator.11: -ENOENT
[ 11.602548] VDDCPU: 721 <--> 1022 mV at 1022 mV, enabled--- arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +1 -1
@@ -139,7 +139,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&dc_in>; + pwm-supply = <&dc_in>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts +1 -1
@@ -139,7 +139,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&main_12v>; + pwm-supply = <&main_12v>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts +1 -1
@@ -139,7 +139,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&dc_in>; + pwm-supply = <&dc_in>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 589/917 arm64: dts: qcom: sc7180: Base dynamic CPU power coefficients in reality
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit 82ea7d411d43f60dce878252558e926f957109f0 ]
The sc7180's dynamic-power-coefficient violates the device tree bindings. The bindings (arm/cpus.yaml) say that the units for the dynamic-power-coefficient are supposed to be "uW/MHz/V^2". The ones for sc7180 aren't this. Qualcomm arbitrarily picked 100 for the "little" CPUs and then picked a number for the big CPU based on this.
At the time, there was a giant dicussion about this. Apparently Qualcomm Engineers were instructed not to share the actual numbers here. As part of the discussion, I pointed out [1] that these numbers shouldn't really be secret since once a device is shipping anyone can just run a script and produce them. This patch is the result of running the script I posted in that discussion on sc7180-trogdor-coachz, which is currently available for purchase by consumers.
[1] https://lore.kernel.org/r/CAD=FV=U1FP0e3_AVHpauUUZtD-5X3XCwh5aT9fH_8S_FFML2Uw@mail.gmail.com/
I ran the script four times, measuring little, big, little, big. I used the 64-bit version of dhrystone 2.2 in my test. I got these results:
576 kHz, 596 mV, 20 mW, 88 Cx
768 kHz, 596 mV, 32 mW, 122 Cx
1017 kHz, 660 mV, 45 mW, 97 Cx
1248 kHz, 720 mV, 87 mW, 139 Cx
1324 kHz, 756 mV, 109 mW, 148 Cx
1516 kHz, 828 mV, 150 mW, 148 Cx
1612 kHz, 884 mV, 182 mW, 147 Cx
1708 kHz, 884 mV, 192 mW, 146 Cx
1804 kHz, 884 mV, 207 mW, 149 Cx
Your dynamic-power-coefficient for cpu 0: 132
825 kHz, 596 mV, 142 mW, 401 Cx
979 kHz, 628 mV, 183 mW, 427 Cx
1113 kHz, 656 mV, 224 mW, 433 Cx
1267 kHz, 688 mV, 282 mW, 449 Cx
1555 kHz, 812 mV, 475 mW, 450 Cx
1708 kHz, 828 mV, 566 mW, 478 Cx
1843 kHz, 884 mV, 692 mW, 476 Cx
1900 kHz, 884 mV, 722 mW, 482 Cx
1996 kHz, 916 mV, 814 mW, 482 Cx
2112 kHz, 916 mV, 862 mW, 483 Cx
2208 kHz, 916 mV, 962 mW, 521 Cx
2323 kHz, 940 mV, 1060 mW, 517 Cx
2400 kHz, 956 mV, 1133 mW, 518 Cx
Your dynamic-power-coefficient for cpu 6: 471
576 kHz, 596 mV, 26 mW, 103 Cx
768 kHz, 596 mV, 40 mW, 147 Cx
1017 kHz, 660 mV, 54 mW, 114 Cx
1248 kHz, 720 mV, 97 mW, 151 Cx
1324 kHz, 756 mV, 113 mW, 150 Cx
1516 kHz, 828 mV, 154 mW, 148 Cx
1612 kHz, 884 mV, 194 mW, 155 Cx
1708 kHz, 884 mV, 203 mW, 152 Cx
1804 kHz, 884 mV, 219 mW, 155 Cx
Your dynamic-power-coefficient for cpu 0: 142
825 kHz, 596 mV, 148 mW, 530 Cx
979 kHz, 628 mV, 189 mW, 475 Cx
1113 kHz, 656 mV, 230 mW, 461 Cx
1267 kHz, 688 mV, 287 mW, 466 Cx
1555 kHz, 812 mV, 469 mW, 445 Cx
1708 kHz, 828 mV, 567 mW, 480 Cx
1843 kHz, 884 mV, 699 mW, 482 Cx
1900 kHz, 884 mV, 719 mW, 480 Cx
1996 kHz, 916 mV, 814 mW, 484 Cx
2112 kHz, 916 mV, 861 mW, 483 Cx
2208 kHz, 916 mV, 963 mW, 522 Cx
2323 kHz, 940 mV, 1063 mW, 520 Cx
2400 kHz, 956 mV, 1135 mW, 519 Cx
Your dynamic-power-coefficient for cpu 6: 489
As you can see, the calculations aren't perfectly consistent but roughly you could say about 480 for big and 137 for little.
The ratio between these numbers isn't quite the same as the ratio between the two numbers that Qualcomm used. Perhaps this is because Qualcomm measured something slightly different than the 64-bit version of dhrystone 2.2 or perhaps it's because they fudged these numbers a bit (and fudged the capacity-dmips-mhz). As per discussion [2], let's use the numbers I came up with and also un-fudge capacity-dmips-mhz. While unfudging capacity-dmips-mhz, let's scale it so that bigs are 1024 which seems to be the common practice.
In general these numbers don't need to be perfectly exact. In fact, they can't be since the CPU power depends a lot on what's being run on the CPU and the big/little CPUs are each more or less efficient in different operations. Historically running the 32-bit vs. 64-bit versions of dhrystone produced notably different numbers, though I didn't test this time.
We also need to scale all of the sustainable-power numbers by the same amount. I scale ones related to the big CPUs by the adjustment I made to the big dynamic-power-coefficient and the ones related to the little CPUs by the adjustment I made to the little dynamic-power-coefficient.
[2] https://lore.kernel.org/r/[email protected]/
--- .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 2 +- .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi | 8 +-- arch/arm64/boot/dts/qcom/sc7180.dtsi | 52 +++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-)
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +1 -1
@@ -33,7 +33,7 @@ ap_h1_spi: &spi0 {}; polling-delay = <0>; thermal-sensors = <&pm6150_adc_tm 1>; - sustainable-power = <814>; + sustainable-power = <965>; trips { skin_temp_alert0: trip-point0 {
arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi +4 -4
@@ -44,7 +44,7 @@ ap_h1_spi: &spi0 {}; }; &cpu6_thermal { - sustainable-power = <948>; + sustainable-power = <1124>; }; &cpu7_alert0 {
@@ -56,7 +56,7 @@ ap_h1_spi: &spi0 {}; }; &cpu7_thermal { - sustainable-power = <948>; + sustainable-power = <1124>; }; &cpu8_alert0 {
@@ -68,7 +68,7 @@ ap_h1_spi: &spi0 {}; }; &cpu8_thermal { - sustainable-power = <948>; + sustainable-power = <1124>; }; &cpu9_alert0 {
@@ -80,7 +80,7 @@ ap_h1_spi: &spi0 {}; }; &cpu9_thermal { - sustainable-power = <948>; + sustainable-power = <1124>; }; &gpio_keys {
arch/arm64/boot/dts/qcom/sc7180.dtsi +26 -26
160 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 590/917 soc: qcom: llcc: Disable MMUHWT retention
In reply to Greg Kroah-HartmanFrom: Naina Mehta <[email protected]>
[ Upstream commit 3a461009e195c3c17f6af73da310b886991309fd ]
Disable MMUHWT retention for SC7280 as done for other platforms to avoid more power burn.
--- drivers/soc/qcom/llcc-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/llcc-qcom.c +1 -1
@@ -115,7 +115,7 @@ static const struct llcc_slice_config sc7280_data[] = { { LLCC_CMPT, 10, 768, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0}, { LLCC_GPUHTW, 11, 256, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0}, { LLCC_GPU, 12, 512, 1, 0, 0x3f, 0x0, 0, 0, 0, 1, 0, 0}, - { LLCC_MMUHWT, 13, 256, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 1, 0}, + { LLCC_MMUHWT, 13, 256, 1, 1, 0x3f, 0x0, 0, 0, 0, 0, 1, 0}, { LLCC_MDMPNG, 21, 768, 0, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0}, { LLCC_WLHW, 24, 256, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0}, { LLCC_MODPE, 29, 64, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0},
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 592/917 scsi: dc395: Fix error case unwinding
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit cbd9a3347c757383f3d2b50cf7cfd03eb479c481 ]
dc395x_init_one()->adapter_init() might fail. In this case, the acb is already cleaned up by adapter_init(), no need to do that in adapter_uninit(acb) again.
[ 1.252251] dc395x: adapter init failed [ 1.254900] RIP: 0010:adapter_uninit+0x94/0x170 [dc395x] [ 1.260307] Call Trace: [ 1.260442] dc395x_init_one.cold+0x72a/0x9bb [dc395x]
--- drivers/scsi/dc395x.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/dc395x.c +1 -0
@@ -4618,6 +4618,7 @@ static int dc395x_init_one(struct pci_dev *dev, const struct pci_device_id *id)/* initialise the adapter and everything we need */ if (adapter_init (acb, io_port_base, io_port_len, irq)) {dprintkl (KERN_INFO ,"adapter init failed\n" ); + acb =NULL ; goto fail; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 602/917 iommu/dma: Fix arch_sync_dma for map
In reply to Greg Kroah-HartmanFrom: David Stevens <[email protected]>
[ Upstream commit 06e620345d544e559b2961cb5a676ec9c80c8950 ]
When calling arch_sync_dma, we need to pass it the memory that's actually being used for dma. When using swiotlb bounce buffers, this is the bounce buffer. Move arch_sync_dma into the __iommu_dma_map_swiotlb helper, so it can use the bounce buffer address if necessary.
Now that iommu_dma_map_sg delegates to a function which takes care of architectural syncing in the untrusted device case, the call to iommu_dma_sync_sg_for_device can be moved so it only occurs for trusted devices. Doing the sync for untrusted devices before mapping never really worked, since it needs to be able to target swiotlb buffers.
This also moves the architectural sync to before the call to __iommu_dma_map, to guarantee that untrusted devices can't see stale data they shouldn't see.
--- drivers/iommu/dma-iommu.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/iommu/dma-iommu.c +7 -9
@@ -593,6 +593,9 @@ static dma_addr_t __iommu_dma_map_swiotlb(struct device *dev, phys_addr_t phys,memset (padding_start,0 , padding_size); } +if (!coherent && !(attrs &DMA_ATTR_SKIP_CPU_SYNC )) +arch_sync_dma_for_device (phys, org_size, dir); + iova =__iommu_dma_map (dev, phys, aligned_size, prot, dma_mask);if (iova ==DMA_MAPPING_ERROR &&is_swiotlb_buffer (dev, phys))swiotlb_tbl_unmap_single (dev, phys, org_size, dir, attrs);
@@ -860,14 +863,9 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, {phys_addr_t phys =page_to_phys (page) + offset;bool coherent =dev_is_dma_coherent (dev); -dma_addr_t dma_handle; - dma_handle =__iommu_dma_map_swiotlb (dev, phys, size,dma_get_mask (dev), +return __iommu_dma_map_swiotlb (dev, phys, size,dma_get_mask (dev), coherent, dir, attrs); -if (!coherent && !(attrs &DMA_ATTR_SKIP_CPU_SYNC ) && - dma_handle !=DMA_MAPPING_ERROR ) -arch_sync_dma_for_device (phys, size, dir); -return dma_handle; } static void iommu_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
@@ -1012,12 +1010,12 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg, goto out; } -if (!(attrs &DMA_ATTR_SKIP_CPU_SYNC )) -iommu_dma_sync_sg_for_device (dev, sg, nents, dir); -if (dev_is_untrusted (dev))return iommu_dma_map_sg_swiotlb (dev, sg, nents, dir, attrs); +if (!(attrs &DMA_ATTR_SKIP_CPU_SYNC )) +iommu_dma_sync_sg_for_device (dev, sg, nents, dir); +/* * Work out how much IOVA space we need, and align the segments to * IOVA granules for the IOMMU driver to handle. With some clever
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 603/917 ALSA: hda: Reduce udelay() at SKL+ position reporting
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 46243b85b0ec5d2cee7545e5ce18c015ce91957e ]
The position reporting on Intel Skylake and later chips via azx_get_pos_skl() contains a udelay(20) call for the capture streams. A call for this alone doesn't sound too harmful. However, as the pointer PCM ops is one of the hottest path in the PCM operations -- especially for the timer-scheduled operations like PulseAudio -- such a delay hogs CPU usage significantly in the total performance.
The code there was taken from the original code in ASoC SST Skylake driver blindly. The udelay() is a workaround for the case where the reported position is behind the period boundary at the timing triggered from interrupts; applications often expect that the full data is available for the whole period when returned (and also that's the definition of the ALSA PCM period).
OTOH, HD-audio (legacy) driver has already some workarounds for the delayed position reporting due to its relatively large FIFO, such as the BDL position adjustment and the delayed period-elapsed call in the work. That said, the udelay() is almost superfluous for HD-audio driver unlike SST, and we can drop the udelay().
Though, the current code doesn't guarantee the full period readiness as mentioned in the above, but rather it checks the wallclock and detects the unexpected jump. That's one missing piece, and the drop of udelay() needs a bit more sanity checks for the delayed handling.
This patch implements those: the drop of udelay() call in azx_get_pos_skl() and the more proper check of hwptr in azx_position_ok(). The latter change is applied only for the case where the stream is running in the normal mode without no_period_wakeup flag. When no_period_wakeup is set, it essentially ignores the period handling and rather concentrates only on the current position; which implies that we don't need to care about the period boundary at all.
--- sound/pci/hda/hda_intel.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
sound/pci/hda/hda_intel.c +23 -5
@@ -638,13 +638,17 @@ static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev)* the update-IRQ timing. The IRQ is issued before actually the * data is processed. So, we need to process it afterwords in a * workqueue. +* +* Returns 1 if OK to proceed, 0 for delay handling, -1 for skipping update */ static int azx_position_ok (struct azx *chip,struct azx_dev *azx_dev) {struct snd_pcm_substream *substream = azx_dev->core.substream; +struct snd_pcm_runtime *runtime = substream->runtime;int stream = substream->stream;u32 wallclk;unsigned int pos; +snd_pcm_uframes_t hwptr, target; wallclk =azx_readl (chip,WALLCLK ) - azx_dev->core.start_wallclk;if (wallclk < (azx_dev->core.period_wallclk *2 ) /3 )
@@ -681,6 +685,24 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)/* NG - it's below the first next period boundary */ return chip->bdl_pos_adj ?0 :-1 ; azx_dev->core.start_wallclk += wallclk; + +if (azx_dev->core.no_period_wakeup) +return 1 ;/* OK, no need to check period boundary */ + +if (runtime->hw_ptr_base != runtime->hw_ptr_interrupt) +return 1 ;/* OK, already in hwptr updating process */ + +/* check whether the period gets really elapsed */ + pos =bytes_to_frames (runtime, pos); + hwptr = runtime->hw_ptr_base + pos; +if (hwptr < runtime->status->hw_ptr) + hwptr += runtime->buffer_size; + target = runtime->hw_ptr_interrupt + runtime->period_size; +if (hwptr < target) { +/* too early wakeup, process it later */ +return chip->bdl_pos_adj ?0 :-1 ; + } +return 1 ;/* OK, it's fine */ }
@@ -875,11 +897,7 @@ static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev)if (azx_dev->core.substream->stream ==SNDRV_PCM_STREAM_PLAYBACK )return azx_skl_get_dpib_pos (chip, azx_dev); -/* For capture, we need to read posbuf, but it requires a delay -* for the possible boundary overlap; the read of DPIB fetches the -* actual posbuf -*/ -udelay (20 ); +/* read of DPIB fetches the actual posbuf */ azx_skl_get_dpib_pos (chip, azx_dev);return azx_get_pos_posbuf (chip, azx_dev); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 605/917 ALSA: usb-audio: Fix possible race at sync of urb completions
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 86a42ad07905110f82648853c0ea3434b4eab173 ]
USB-audio driver tries to sync with the clear of all pending URBs in wait_clear_urbs(), and it waits for all bits in active_mask getting cleared. This works fine for the normal operations, but when a stream is managed in the implicit feedback mode, there is still a very thin race window: namely, in snd_complete_usb(), the active_mask bit for the current URB is once cleared before re-submitted in queue_pending_output_urbs(). If wait_clear_urbs() is called during that period, it may pass the test and go forward even though there may be a still pending URB.
For covering it, this patch adds a new counter to each endpoint to keep the number of in-flight URBs, and changes wait_clear_urbs() checking this number instead. The counter is decremented at the end of URB complete, hence the reference is kept as long as the URB complete is in process.
--- sound/usb/card.h | 1 + sound/usb/endpoint.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-)
sound/usb/card.h +1 -0
@@ -97,6 +97,7 @@ struct snd_usb_endpoint {unsigned int nominal_queue_size;/* total buffer sizes in URBs */ unsigned long active_mask;/* bitmask of active urbs */ unsigned long unlink_mask;/* bitmask of unlinked urbs */ +atomic_t submitted_urbs;/* currently submitted urbs */ char *syncbuf;/* sync buffer for all sync URBs */ dma_addr_t sync_dma;/* DMA address of syncbuf */
sound/usb/endpoint.c +6 -1
@@ -451,6 +451,7 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep) }set_bit (ctx->index, &ep->active_mask); +atomic_inc (&ep->submitted_urbs); } }
@@ -488,6 +489,7 @@ static void snd_complete_urb(struct urb *urb)clear_bit (ctx->index, &ep->active_mask);spin_unlock_irqrestore (&ep->lock, flags);queue_pending_output_urbs (ep); +atomic_dec (&ep->submitted_urbs);/* decrement at last */ return ; }
@@ -513,6 +515,7 @@ static void snd_complete_urb(struct urb *urb) exit_clear:clear_bit (ctx->index, &ep->active_mask); +atomic_dec (&ep->submitted_urbs); }/*
@@ -596,6 +599,7 @@ int snd_usb_add_endpoint(struct snd_usb_audio *chip, int ep_num, int type) ep->type = type; ep->ep_num = ep_num;INIT_LIST_HEAD (&ep->ready_playback_urbs); +atomic_set (&ep->submitted_urbs,0 ); is_playback = ((ep_num &USB_ENDPOINT_DIR_MASK ) ==USB_DIR_OUT ); ep_num &=USB_ENDPOINT_NUMBER_MASK ;
@@ -859,7 +863,7 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)return 0 ; do { - alive = bitmap_weight(&ep->active_mask, ep->nurbs); + alive = atomic_read(&ep->submitted_urbs); if (!alive) break;
@@ -1420,6 +1424,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) goto __error; }set_bit (i, &ep->active_mask); +atomic_inc (&ep->submitted_urbs); } usb_audio_dbg(ep->chip, "%d URBs submitted for EP 0x%x\n",
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 607/917 power: reset: at91-reset: check properly the return value of devm_of_iomap
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit f558c8072c3461b65c12c0068b108f78cebc8246 ]
devm_of_iomap() returns error code or valid pointer. Check its return value with IS_ERR().
--- drivers/power/reset/at91-reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/reset/at91-reset.c +2 -2
@@ -193,7 +193,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)return -ENOMEM ; reset->rstc_base =devm_of_iomap (&pdev->dev, pdev->dev.of_node,0 ,NULL ); -if (!reset->rstc_base) { +if (IS_ERR (reset->rstc_base)) {dev_err (&pdev->dev,"Could not map reset controller address\n" );return -ENODEV ; }
@@ -203,7 +203,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)for_each_matching_node_and_match (np, at91_ramc_of_match, &match) { reset->ramc_lpr = (u32 )match->data; reset->ramc_base[idx] =devm_of_iomap (&pdev->dev, np,0 ,NULL ); -if (!reset->ramc_base[idx]) { +if (IS_ERR (reset->ramc_base[idx])) {dev_err (&pdev->dev,"Could not map ram controller address\n" );of_node_put (np);return -ENODEV ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 610/917 scsi: megaraid_sas: Fix concurrent access to ISR between IRQ polling and real interrupt
In reply to Greg Kroah-HartmanFrom: Sumit Saxena <[email protected]>
[ Upstream commit e7dcc514a49e74051b869697d5ab0370f6301d57 ]
IRQ polling thread calls ISR after enable_irq() to handle any missed I/O completion. The atomic flag "in_used" was added to have the synchronization between the IRQ polling thread and the interrupt context. There is a bug around it leading to a race condition.
Below is the sequence:
- IRQ polling thread accesses ISR, fetches the reply descriptor.
- Real interrupt arrives and pre-empts polling thread (enable_irq() is already called).
- Interrupt context picks the same reply descriptor as fetched by polling thread, processes it, and exits.
- Polling thread resumes and processes the descriptor which is already processed by interrupt thread leads to kernel crash.
Setting the "in_used" flag before fetching the reply descriptor ensures synchronized access to ISR.
--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +7 -4
@@ -3530,6 +3530,9 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,if (atomic_read (&instance->adprecovery) ==MEGASAS_HW_CRITICAL_ERROR )return IRQ_HANDLED ; +if (irq_context && !atomic_add_unless (&irq_context->in_used,1 ,1 )) +return 0 ; + desc = fusion->reply_frames_desc[MSIxIndex] + fusion->last_reply_idx[MSIxIndex];
@@ -3540,11 +3543,11 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex, reply_descript_type = reply_desc->ReplyFlags &MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK ; -if (reply_descript_type ==MPI2_RPY_DESCRIPT_FLAGS_UNUSED ) +if (reply_descript_type ==MPI2_RPY_DESCRIPT_FLAGS_UNUSED ) { +if (irq_context) +atomic_dec (&irq_context->in_used);return IRQ_NONE ; - -if (irq_context && !atomic_add_unless (&irq_context->in_used,1 ,1 )) -return 0 ; + } num_completed =0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 593/917 MIPS: loongson64: make CPU_LOONGSON64 depends on MIPS_FP_SUPPORT
In reply to Greg Kroah-HartmanFrom: Jackie Liu <[email protected]>
[ Upstream commit 7f3b3c2bfa9c93ab9b5595543496f570983dc330 ]
mach/loongson64 fails to build when the FPU support is disabled:
arch/mips/loongson64/cop2-ex.c:45:15: error: implicit declaration of function ‘__is_fpu_owner’; did you mean ‘is_fpu_owner’? [-Werror=implicit-function-declaration] arch/mips/loongson64/cop2-ex.c:98:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:99:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:131:43: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:137:38: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:203:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:219:30: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:283:38: error: ‘struct thread_struct’ has no member named ‘fpu’arch/mips/loongson64/cop2-ex.c:301:38: error: ‘struct thread_struct’ has no member named ‘fpu’
--- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/mips/Kconfig +1 -0
@@ -1379,6 +1379,7 @@ config CPU_LOONGSON64 select MIPS_ASID_BITS_VARIABLE select MIPS_PGD_C0_CONTEXT select MIPS_L1_CACHE_SHIFT_6 + select MIPS_FP_SUPPORT select GPIOLIB select SWIOTLB select HAVE_KVM
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 601/917 iommu/dma: Fix sync_sg with swiotlb
In reply to Greg Kroah-HartmanFrom: David Stevens <[email protected]>
[ Upstream commit 08ae5d4a1ae96b72222e7b02d072bb997ff29dac ]
The is_swiotlb_buffer function takes the physical address of the swiotlb buffer, not the physical address of the original buffer. The sglist contains the physical addresses of the original buffer, so for the sync_sg functions to work properly when a bounce buffer might have been used, we need to use iommu_iova_to_phys to look up the physical address. This is what sync_single does, so call that function on each sglist segment.
The previous code mostly worked because swiotlb does the transfer on map and unmap. However, any callers which use DMA_ATTR_SKIP_CPU_SYNC with sglists or which call sync_sg would not have had anything copied to the bounce buffer.
--- drivers/iommu/dma-iommu.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-)
drivers/iommu/dma-iommu.c +13 -20
@@ -828,17 +828,13 @@ static void iommu_dma_sync_sg_for_cpu(struct device *dev,struct scatterlist *sg;int i; -if (dev_is_dma_coherent (dev) && !dev_is_untrusted (dev)) -return ; - -for_each_sg (sgl, sg, nelems, i) { -if (!dev_is_dma_coherent (dev)) +if (dev_is_untrusted (dev)) +for_each_sg (sgl, sg, nelems, i) +iommu_dma_sync_single_for_cpu (dev,sg_dma_address (sg), + sg->length, dir); +else if (!dev_is_dma_coherent (dev)) +for_each_sg (sgl, sg, nelems, i)arch_sync_dma_for_cpu (sg_phys (sg), sg->length, dir); - -if (is_swiotlb_buffer (dev,sg_phys (sg))) -swiotlb_sync_single_for_cpu (dev,sg_phys (sg), - sg->length, dir); - } } static void iommu_dma_sync_sg_for_device(struct device *dev,
@@ -848,17 +844,14 @@ static void iommu_dma_sync_sg_for_device(struct device *dev,struct scatterlist *sg;int i; -if (dev_is_dma_coherent (dev) && !dev_is_untrusted (dev)) -return ; - -for_each_sg (sgl, sg, nelems, i) { -if (is_swiotlb_buffer (dev,sg_phys (sg))) -swiotlb_sync_single_for_device (dev,sg_phys (sg), - sg->length, dir); - -if (!dev_is_dma_coherent (dev)) +if (dev_is_untrusted (dev)) +for_each_sg (sgl, sg, nelems, i) +iommu_dma_sync_single_for_device (dev, +sg_dma_address (sg), + sg->length, dir); +else if (!dev_is_dma_coherent (dev)) +for_each_sg (sgl, sg, nelems, i)arch_sync_dma_for_device (sg_phys (sg), sg->length, dir); - } } static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 606/917 soundwire: debugfs: use controller id and link_id for debugfs
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 75eac387a2539aa6c6bbee3affa23435f2096396 ]
link_id can be zero and if we have multiple controller instances in a system like Qualcomm debugfs will end-up with duplicate namespace resulting in incorrect debugfs entries.
Using bus-id and link-id combination should give a unique debugfs directory entry and should fix below warning too.
"debugfs: Directory 'master-0' with parent 'soundwire' already present!"
--- drivers/soundwire/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/debugfs.c +1 -1
@@ -19,7 +19,7 @@ void sdw_bus_debugfs_init(struct sdw_bus *bus)return ;/* create the debugfs master-N */ -snprintf (name,sizeof (name),"master-%d" , bus->link_id); +snprintf (name,sizeof (name),"master-%d-%d" , bus->id, bus->link_id); bus->debugfs =debugfs_create_dir (name, sdw_debugfs_root); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 608/917 scsi: ufs: core: Fix ufshcd_probe_hba() prototype to match the definition
In reply to Greg Kroah-HartmanFrom: Bean Huo <[email protected]>
[ Upstream commit 68444d73d6a5864ede12df6366bd6602e022ae5b ]
Since commit 568dd9959611 ("scsi: ufs: Rename the second ufshcd_probe_hba() argument"), the second ufshcd_probe_hba() argument has been changed to init_dev_params.
--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -223,7 +223,7 @@ static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd);static int ufshcd_clear_tm_cmd (struct ufs_hba *hba,int tag);static void ufshcd_hba_exit (struct ufs_hba *hba);static int ufshcd_clear_ua_wluns (struct ufs_hba *hba); -static int ufshcd_probe_hba (struct ufs_hba *hba,bool async); +static int ufshcd_probe_hba (struct ufs_hba *hba,bool init_dev_params);static int ufshcd_setup_clocks (struct ufs_hba *hba,bool on);static int ufshcd_uic_hibern8_enter (struct ufs_hba *hba);static inline void ufshcd_add_delay_before_dme_cmd (struct ufs_hba *hba);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 612/917 driver core: Fix possible memory leak in device_link_add()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit df0a18149474c7e6b21f6367fbc6bc8d0f192444 ]
I got memory leak as follows:
unreferenced object 0xffff88801f0b2200 (size 64):
comm "i2c-lis2hh12-21", pid 5455, jiffies 4294944606 (age 15.224s) hex dump (first 32 bytes):
72 65 67 75 6c 61 74 6f 72 3a 72 65 67 75 6c 61 regulator:regula
74 6f 72 2e 30 2d 2d 69 32 63 3a 31 2d 30 30 31 tor.0--i2c:1-001
backtrace:
[<00000000bf5b0c3b>] __kmalloc_track_caller+0x19f/0x3a0
[<0000000050da42d9>] kvasprintf+0xb5/0x150
[<000000004bbbed13>] kvasprintf_const+0x60/0x190
[<00000000cdac7480>] kobject_set_name_vargs+0x56/0x150
[<00000000bf83f8e8>] dev_set_name+0xc0/0x100
[<00000000cc1cf7e3>] device_link_add+0x6b4/0x17c0
[<000000009db9faed>] _regulator_get+0x297/0x680
[<00000000845e7f2b>] _devm_regulator_get+0x5b/0xe0
[<000000003958ee25>] st_sensors_power_enable+0x71/0x1b0 [st_sensors]
[<000000005f450f52>] st_accel_i2c_probe+0xd9/0x150 [st_accel_i2c]
[<00000000b5f2ab33>] i2c_device_probe+0x4d8/0xbe0
[<0000000070fb977b>] really_probe+0x299/0xc30
[<0000000088e226ce>] __driver_probe_device+0x357/0x500
[<00000000c21dda32>] driver_probe_device+0x4e/0x140
[<000000004e650441>] __device_attach_driver+0x257/0x340
[<00000000cf1891b8>] bus_for_each_drv+0x166/0x1e0When device_register() returns an error, the name allocated in dev_set_name() will be leaked, the put_device() should be used instead of kfree() to give up the device reference, then the name will be freed in kobject_cleanup() and the references of consumer and supplier will be decreased in device_link_release_fn().
--- drivers/base/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/base/core.c +1 -3
@@ -821,9 +821,7 @@ struct device_link *device_link_add(struct device *consumer,dev_bus_name (supplier),dev_name (supplier), dev_bus_name(consumer), dev_name(consumer));if (device_register (&link->link_dev)) { -put_device (consumer); -put_device (supplier); -kfree (link); +put_device (&link->link_dev); link =NULL ; goto out; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 613/917 arm: dts: omap3-gta04a4: accelerometer irq fix
In reply to Greg Kroah-HartmanFrom: Andreas Kemnade <[email protected]>
[ Upstream commit 884ea75d79a36faf3731ad9d6b9c29f58697638d ]
Fix typo in pinctrl. It did only work because the bootloader seems to have initialized it.
--- arch/arm/boot/dts/omap3-gta04.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/omap3-gta04.dtsi +1 -1
@@ -515,7 +515,7 @@ compatible = "bosch,bma180"; reg = <0x41>; pinctrl-names = "default"; - pintcrl-0 = <&bma180_pins>; + pinctrl-0 = <&bma180_pins>; interrupt-parent = <&gpio4>; interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; /* GPIO_115 */ };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 517/917 block: ataflop: more blk-mq refactoring fixes
In reply to Greg Kroah-HartmanFrom: Michael Schmitz <[email protected]>
[ Upstream commit d28e4dff085c5a87025c9a0a85fb798bd8e9ca17 ]
As it turns out, my earlier patch in commit 86d46fdaa12a (block:
ataflop: fix breakage introduced at blk-mq refactoring) was incomplete. This patch fixes any remaining issues found during more testing and code review.
Requests exceeding 4 k are handled in 4k segments but __blk_mq_end_request() is never called on these (still sectors outstanding on the request). With redo_fd_request() removed, there is no provision to kick off processing of the next segment, causing requests exceeding 4k to hang. (By setting /sys/block/fd0/queue/max_sectors_k <= 4 as workaround, this behaviour can be avoided).
Instead of reintroducing redo_fd_request(), requeue the remainder of the request by calling blk_mq_requeue_request() on incomplete requests (i.e. when blk_update_request() still returns true), and rely on the block layer to queue the residual as new request.
Both error handling and formatting needs to release the ST-DMA lock, so call finish_fdc() on these (this was previously handled by redo_fd_request()). finish_fdc() may be called legitimately without the ST-DMA lock held - make sure we only release the lock if we actually held it. In a similar way, early exit due to errors in ataflop_queue_rq() must release the lock.
After minor errors, fd_error sets up to recalibrate the drive but never re-runs the current operation (another task handled by redo_fd_request() before). Call do_fd_action() to get the next steps (seek, retry read/write) underway.
--- drivers/block/ataflop.c | 45 +++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-)
drivers/block/ataflop.c +39 -6
@@ -456,10 +456,20 @@ static DEFINE_TIMER(fd_timer, check_change);static void fd_end_request_cur (blk_status_t err) { +DPRINT (("fd_end_request_cur(), bytes %d of %d\n" , +blk_rq_cur_bytes (fd_request), +blk_rq_bytes (fd_request))); +if (!blk_update_request (fd_request, err,blk_rq_cur_bytes (fd_request))) { +DPRINT (("calling __blk_mq_end_request()\n" ));__blk_mq_end_request (fd_request, err); fd_request =NULL ; + }else { +/* requeue rest of request */ +DPRINT (("calling blk_mq_requeue_request()\n" )); +blk_mq_requeue_request (fd_request, true); + fd_request =NULL ; } }
@@ -697,12 +707,21 @@ static void fd_error( void )if (fd_request->error_count >=MAX_ERRORS ) {printk (KERN_ERR "fd%d: too many errors.\n" , SelectedDrive );fd_end_request_cur (BLK_STS_IOERR ); +finish_fdc (); +return ; }else if (fd_request->error_count ==RECALIBRATE_ERRORS ) {printk (KERN_WARNING "fd%d: recalibrating\n" , SelectedDrive );if (SelectedDrive !=-1 )SUD .track =-1 ; } +/* need to re-run request to recalibrate */ +atari_disable_irq (IRQ_MFP_FDC ); + +setup_req_params ( SelectedDrive ); +do_fd_action ( SelectedDrive ); + +atari_enable_irq (IRQ_MFP_FDC ); }
@@ -729,8 +748,10 @@ static int do_format(int drive, int type, struct atari_format_descr *desc)if (type) { type--;if (type >=NUM_DISK_MINORS || - minor2disktype[type].drive_types > DriveType) + minor2disktype[type].drive_types > DriveType) { +finish_fdc ();return -EINVAL ; + } } q = unit[drive].disk[type]->queue;
@@ -748,6 +769,7 @@ static int do_format(int drive, int type, struct atari_format_descr *desc) }if (!UDT || desc->track >=UDT ->blocks/UDT ->spt/2 || desc->head >=2 ) { +finish_fdc (); ret = -EINVAL ; goto out; }
@@ -788,6 +810,7 @@ static int do_format(int drive, int type, struct atari_format_descr *desc)wait_for_completion (&format_wait); +finish_fdc (); ret = FormatError ? -EIO :0 ; out:blk_mq_unquiesce_queue (q);
@@ -822,6 +845,7 @@ static void do_fd_action( int drive )else {/* all sectors finished */ fd_end_request_cur (BLK_STS_OK ); +finish_fdc ();return ; } }
@@ -1225,8 +1249,8 @@ static void fd_rwsec_done1(int status) }else {/* all sectors finished */ -finish_fdc ();fd_end_request_cur (BLK_STS_OK ); +finish_fdc (); }return ;
@@ -1348,7 +1372,7 @@ static void fd_times_out(struct timer_list *unused)static void finish_fdc (void ) { -if (!NeedSeek) { +if (!NeedSeek || !stdma_is_locked_by (floppy_irq)) {finish_fdc_done (0 ); }else {
@@ -1383,7 +1407,8 @@ static void finish_fdc_done( int dummy )start_motor_off_timer ();local_irq_save (flags); -stdma_release (); +if (stdma_is_locked_by (floppy_irq)) +stdma_release ();local_irq_restore (flags);DPRINT (("finish_fdc() finished\n" ));
@@ -1480,7 +1505,9 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,int drive = floppy - unit;int type = floppy->type; -DPRINT (("Queue request: drive %d type %d last %d\n" , drive, type, bd->last)); +DPRINT (("Queue request: drive %d type %d sectors %d of %d last %d\n" , + drive, type,blk_rq_cur_sectors (bd->rq), +blk_rq_sectors (bd->rq), bd->last));spin_lock_irq (&ataflop_lock);if (fd_request) {
@@ -1502,6 +1529,7 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,/* drive not connected */ printk (KERN_ERR "Unknown Device: fd%d\n" , drive );fd_end_request_cur (BLK_STS_IOERR ); +stdma_release (); goto out; }
@@ -1518,11 +1546,13 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,if (--type >=NUM_DISK_MINORS ) {printk (KERN_WARNING "fd%d: invalid disk format" , drive );fd_end_request_cur (BLK_STS_IOERR ); +stdma_release (); goto out; }if (minor2disktype[type].drive_types > DriveType) {printk (KERN_WARNING "fd%d: unsupported disk format" , drive );fd_end_request_cur (BLK_STS_IOERR ); +stdma_release (); goto out; } type = minor2disktype[type].index;
@@ -1623,6 +1653,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode,/* what if type > 0 here? Overwrite specified entry ? */ if (type) {/* refuse to re-set a predefined type for now */ +finish_fdc ();return -EINVAL ; }
@@ -1690,8 +1721,10 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode,/* sanity check */ if (setprm.track != dtp->blocks/dtp->spt/2 || - setprm.head !=2 ) + setprm.head !=2 ) { +finish_fdc ();return -EINVAL ; + }UDT = dtp;set_capacity (disk,UDT ->blocks);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 559/917 selftests: mptcp: fix proto type in link_failure tests
In reply to Greg Kroah-HartmanFrom: Geliang Tang <[email protected]>
[ Upstream commit 7c909a98042ce403c8497c5d6ff94dd53bdd2131 ]
In listener_ns, we should pass srv_proto argument to mptcp_connect command, not cl_proto.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
@@ -297,7 +297,7 @@ do_transfer() if [ "$test_link_fail" -eq 2 ];then timeout ${timeout_test} \ ip netns exec ${listener_ns} \ - $mptcp_connect -t ${timeout_poll} -l -p $port -s ${cl_proto} \ + $mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ ${local_addr} < "$sinfail" > "$sout" & else timeout ${timeout_test} \
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 563/917 bpf: Fix propagation of signed bounds from 64-bit min/max into 32-bit.
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit 388e2c0b978339dee9b0a81a2e546f8979e021e2 ]
Similar to unsigned bounds propagation fix signed bounds. The 'Fixes' tag is a hint. There is no security bug here. The verifier was too conservative.
--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -1406,7 +1406,7 @@ static void __reg_combine_32_into_64(struct bpf_reg_state *reg)static bool __reg64_bound_s32 (s64 a) { -return a >S32_MIN && a <S32_MAX ; +return a >=S32_MIN && a <=S32_MAX ; }static bool __reg64_bound_u32 (u64 a)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 564/917 of: unittest: fix EXPECT text for gpio hog errors
In reply to Greg Kroah-HartmanFrom: Frank Rowand <[email protected]>
[ Upstream commit e85860e5bc077865a04f0a88d0b0335d3200484a ]
The console message text for gpio hog errors does not match what unittest expects.
--- drivers/of/unittest.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/of/unittest.c +8 -8
@@ -1688,19 +1688,19 @@ static void __init of_unittest_overlay_gpio(void)*/ EXPECT_BEGIN (KERN_INFO , -"GPIO line <<int>> (line-B-input) hogged as input\n" ); +"gpio-<<int>> (line-B-input): hogged as input\n" );EXPECT_BEGIN (KERN_INFO , -"GPIO line <<int>> (line-A-input) hogged as input\n" ); +"gpio-<<int>> (line-A-input): hogged as input\n" ); ret =platform_driver_register (&unittest_gpio_driver);if (unittest (ret ==0 ,"could not register unittest gpio driver\n" ))return ;EXPECT_END (KERN_INFO , -"GPIO line <<int>> (line-A-input) hogged as input\n" ); +"gpio-<<int>> (line-A-input): hogged as input\n" );EXPECT_END (KERN_INFO , -"GPIO line <<int>> (line-B-input) hogged as input\n" ); +"gpio-<<int>> (line-B-input): hogged as input\n" );unittest (probe_pass_count +2 == unittest_gpio_probe_pass_count,"unittest_gpio_probe() failed or not called\n" );
@@ -1727,7 +1727,7 @@ static void __init of_unittest_overlay_gpio(void) chip_request_count = unittest_gpio_chip_request_count;EXPECT_BEGIN (KERN_INFO , -"GPIO line <<int>> (line-D-input) hogged as input\n" ); +"gpio-<<int>> (line-D-input): hogged as input\n" );/* overlay_gpio_03 contains gpio node and child gpio hog node */
@@ -1735,7 +1735,7 @@ static void __init of_unittest_overlay_gpio(void) "Adding overlay 'overlay_gpio_03' failed\n");EXPECT_END (KERN_INFO , -"GPIO line <<int>> (line-D-input) hogged as input\n" ); +"gpio-<<int>> (line-D-input): hogged as input\n" );unittest (probe_pass_count +1 == unittest_gpio_probe_pass_count,"unittest_gpio_probe() failed or not called\n" );
@@ -1774,7 +1774,7 @@ static void __init of_unittest_overlay_gpio(void)*/ EXPECT_BEGIN (KERN_INFO , -"GPIO line <<int>> (line-C-input) hogged as input\n" ); +"gpio-<<int>> (line-C-input): hogged as input\n" );/* overlay_gpio_04b contains child gpio hog node */
@@ -1782,7 +1782,7 @@ static void __init of_unittest_overlay_gpio(void) "Adding overlay 'overlay_gpio_04b' failed\n");EXPECT_END (KERN_INFO , -"GPIO line <<int>> (line-C-input) hogged as input\n" ); +"gpio-<<int>> (line-C-input): hogged as input\n" ); unittest(chip_request_count + 1 == unittest_gpio_chip_request_count, "unittest_gpio_chip_request() called %d times (expected 1 time)\n",
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 565/917 cpufreq: Fix parameter in parse_perf_domain()
In reply to Greg Kroah-HartmanFrom: Hector.Yuan <[email protected]>
[ Upstream commit 4a08e3271c55f8b5d56906a8aa5bd041911cf897 ]
Pass cpu to parse_perf_domain() instead of pcpu.
--- include/linux/cpufreq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/cpufreq.h +1 -1
@@ -1041,7 +1041,7 @@ static inline int of_perf_domain_get_sharing_cpumask(int pcpu, const char *list_if (cpu == pcpu)continue ; - ret =parse_perf_domain (pcpu, list_name, cell_name); + ret =parse_perf_domain (cpu, list_name, cell_name);if (ret <0 )continue ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 580/917 arm64: dts: ti: k3-j721e-main: Fix "max-virtual-functions" in PCIe EP nodes
In reply to Greg Kroah-HartmanFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 9af3ef954975c383eeb667aee207d9ce6fbef8c4 ]
commit 4e5833884f66 ("arm64: dts: ti: k3-j721e-main: Add PCIe device tree nodes") added "max-virtual-functions" to have 16 bit values. Fix "max-virtual-functions" in PCIe endpoint (EP) nodes to have 8 bit values instead of 16.
--- arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +4 -4
@@ -636,7 +636,7 @@ clocks = <&k3_clks 239 1>; clock-names = "fck"; max-functions = /bits/ 8 <6>; - max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>; + max-virtual-functions = /bits/ 8 <4 4 4 4 0 0>; dma-coherent; };
@@ -684,7 +684,7 @@ clocks = <&k3_clks 240 1>; clock-names = "fck"; max-functions = /bits/ 8 <6>; - max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>; + max-virtual-functions = /bits/ 8 <4 4 4 4 0 0>; dma-coherent; };
@@ -732,7 +732,7 @@ clocks = <&k3_clks 241 1>; clock-names = "fck"; max-functions = /bits/ 8 <6>; - max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>; + max-virtual-functions = /bits/ 8 <4 4 4 4 0 0>; dma-coherent; };
@@ -780,7 +780,7 @@ clocks = <&k3_clks 242 1>; clock-names = "fck"; max-functions = /bits/ 8 <6>; - max-virtual-functions = /bits/ 16 <4 4 4 4 0 0>; + max-virtual-functions = /bits/ 8 <4 4 4 4 0 0>; dma-coherent; #address-cells = <2>; #size-cells = <2>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 585/917 arm64: dts: meson-g12b: Fix the pwm regulator supply properties
In reply to Greg Kroah-HartmanFrom: Anand Moon <[email protected]>
[ Upstream commit 62183863f708c2464769e0d477c8ce9f3d326feb ]
After enabling CONFIG_REGULATOR_DEBUG=y we observer below debug logs. Changes help link VDDCP_A and VDDCPU_B pwm regulator to 12V regulator supply instead of dummy regulator.
[ 4.147196] VDDCPU_A: will resolve supply early: pwm [ 4.147216] pwm-regulator regulator-vddcpu-a: Looking up pwm-supply from device tree [ 4.147227] pwm-regulator regulator-vddcpu-a: Looking up pwm-supply property in node /regulator-vddcpu-a failed [ 4.147258] VDDCPU_A: supplied by regulator-dummy [ 4.147288] regulator-dummy: could not add device link regulator.12: -ENOENT [ 4.147353] VDDCPU_A: 721 <--> 1022 mV at 871 mV, enabled [ 4.152014] VDDCPU_B: will resolve supply early: pwm [ 4.152035] pwm-regulator regulator-vddcpu-b: Looking up pwm-supply from device tree [ 4.152047] pwm-regulator regulator-vddcpu-b: Looking up pwm-supply property in node /regulator-vddcpu-b failed [ 4.152079] VDDCPU_B: supplied by regulator-dummy [ 4.152108] regulator-dummy: could not add device link regulator.13: -ENOENT
--- arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi | 4 ++-- arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 4 ++-- arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +2 -2
@@ -18,7 +18,7 @@ regulator-min-microvolt = <690000>; regulator-max-microvolt = <1050000>; - vin-supply = <&dc_in>; + pwm-supply = <&dc_in>; pwms = <&pwm_ab 0 1250 0>; pwm-dutycycle-range = <100 0>;
@@ -37,7 +37,7 @@ regulator-min-microvolt = <690000>; regulator-max-microvolt = <1050000>; - vin-supply = <&vsys_3v3>; + pwm-supply = <&vsys_3v3>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +2 -2
@@ -130,7 +130,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&main_12v>; + pwm-supply = <&main_12v>; pwms = <&pwm_ab 0 1250 0>; pwm-dutycycle-range = <100 0>;
@@ -149,7 +149,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&main_12v>; + pwm-supply = <&main_12v>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +2 -2
@@ -96,7 +96,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&main_12v>; + pwm-supply = <&main_12v>; pwms = <&pwm_ab 0 1250 0>; pwm-dutycycle-range = <100 0>;
@@ -115,7 +115,7 @@ regulator-min-microvolt = <721000>; regulator-max-microvolt = <1022000>; - vin-supply = <&main_12v>; + pwm-supply = <&main_12v>; pwms = <&pwm_AO_cd 1 1250 0>; pwm-dutycycle-range = <100 0>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 587/917 bus: ti-sysc: Fix timekeeping_suspended warning on resume
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit b3e9431854e8f305385d5de225441c0477b936cb ]
On resume we can get a warning at kernel/time/timekeeping.c:824 for timekeeping_suspended.
Let's fix this by adding separate functions for sysc_poll_reset_sysstatus() and sysc_poll_reset_sysconfig() and have the new functions handle also timekeeping_suspended.
If iopoll at some point supports timekeeping_suspended, we can just drop the custom handling from these functions.
--- drivers/bus/ti-sysc.c | 65 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 12 deletions(-)
drivers/bus/ti-sysc.c +53 -12
@@ -17,6 +17,7 @@#include <linux/of_platform.h> #include <linux/slab.h> #include <linux/sys_soc.h> +#include <linux/timekeeping.h> #include <linux/iopoll.h> #include <linux/platform_data/ti-sysc.h>
@@ -223,37 +224,77 @@ static u32 sysc_read_sysstatus(struct sysc *ddata)return sysc_read (ddata, offset); } -/* Poll on reset status */ -static int sysc_wait_softreset (struct sysc *ddata) +static int sysc_poll_reset_sysstatus (struct sysc *ddata) { -u32 sysc_mask, syss_done, rstval; -int syss_offset, error =0 ; - -if (ddata->cap->regbits->srst_shift <0 ) -return 0 ; - - syss_offset = ddata->offsets[SYSC_SYSSTATUS ]; - sysc_mask =BIT (ddata->cap->regbits->srst_shift); +int error, retries; +u32 syss_done, rstval;if (ddata->cfg.quirks &SYSS_QUIRK_RESETDONE_INVERTED ) syss_done =0 ;else syss_done = ddata->cfg.syss_mask; -if (syss_offset >=0 ) { +if (likely (!timekeeping_suspended)) { error =readx_poll_timeout_atomic (sysc_read_sysstatus, ddata, rstval, (rstval & ddata->cfg.syss_mask) == syss_done,100 ,MAX_MODULE_SOFTRESET_WAIT ); + }else { + retries =MAX_MODULE_SOFTRESET_WAIT ; +while (retries--) { + rstval =sysc_read_sysstatus (ddata); +if ((rstval & ddata->cfg.syss_mask) == syss_done) +return 0 ; +udelay (2 );/* Account for udelay flakeyness */ + } + error = -ETIMEDOUT ; + } - }else if (ddata->cfg.quirks &SYSC_QUIRK_RESET_STATUS ) { +return error; +} + +static int sysc_poll_reset_sysconfig (struct sysc *ddata) +{ +int error, retries; +u32 sysc_mask, rstval; + + sysc_mask =BIT (ddata->cap->regbits->srst_shift); + +if (likely (!timekeeping_suspended)) { error =readx_poll_timeout_atomic (sysc_read_sysconfig, ddata, rstval, !(rstval & sysc_mask),100 ,MAX_MODULE_SOFTRESET_WAIT ); + }else { + retries =MAX_MODULE_SOFTRESET_WAIT ; +while (retries--) { + rstval =sysc_read_sysconfig (ddata); +if (!(rstval & sysc_mask)) +return 0 ; +udelay (2 );/* Account for udelay flakeyness */ + } + error = -ETIMEDOUT ; }return error; } +/* Poll on reset status */ +static int sysc_wait_softreset (struct sysc *ddata) +{ +int syss_offset, error =0 ; + +if (ddata->cap->regbits->srst_shift <0 ) +return 0 ; + + syss_offset = ddata->offsets[SYSC_SYSSTATUS ]; + +if (syss_offset >=0 ) + error =sysc_poll_reset_sysstatus (ddata); +else if (ddata->cfg.quirks &SYSC_QUIRK_RESET_STATUS ) + error =sysc_poll_reset_sysconfig (ddata); + +return error; +} +static int sysc_add_named_clock_from_child (struct sysc *ddata,const char *name,const char *optfck_name)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 588/917 ARM: dts: at91: tse850: the emac<->phy interface is rmii
In reply to Greg Kroah-HartmanFrom: Peter Rosin <[email protected]>
[ Upstream commit dcdbc335a91a26e022a803e1a6b837266989c032 ]
This went unnoticed until commit 7897b071ac3b ("net: macb: convert to phylink") which tickled the problem. The sama5d3 emac has never been capable of rgmii, and it all just happened to work before that commit.
--- arch/arm/boot/dts/at91-tse850-3.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/at91-tse850-3.dts +1 -1
@@ -262,7 +262,7 @@ &macb1 { status = "okay"; - phy-mode = "rgmii"; + phy-mode = "rmii"; #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 604/917 ALSA: hda: Use position buffer for SKL+ again
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit c4ca3871e21fa085096316f5f8d9975cf3dfde1d ]
The commit f87e7f25893d ("ALSA: hda - Improved position reporting on SKL+") changed the PCM position report for SKL+ chips to use DPIB, but according to Pierre, DPIB is no best choice for the accurate position reports and it often reports too early. The recommended method is rather the classical position buffer.
This patch makes the PCM position reporting on SKL+ back to the position buffer again.
--- sound/pci/hda/hda_intel.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-)
sound/pci/hda/hda_intel.c +1 -22
@@ -881,27 +881,6 @@ static int azx_get_delay_from_fifo(struct azx *chip, struct azx_dev *azx_dev,return substream->runtime->delay; } -static unsigned int azx_skl_get_dpib_pos (struct azx *chip, -struct azx_dev *azx_dev) -{ -return _snd_hdac_chip_readl (azx_bus (chip), -AZX_REG_VS_SDXDPIB_XBASE + - (AZX_REG_VS_SDXDPIB_XINTERVAL * - azx_dev->core.index)); -} - -/* get the current DMA position with correction on SKL+ chips */ -static unsigned int azx_get_pos_skl (struct azx *chip,struct azx_dev *azx_dev) -{ -/* DPIB register gives a more accurate position for playback */ -if (azx_dev->core.substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) -return azx_skl_get_dpib_pos (chip, azx_dev); - -/* read of DPIB fetches the actual posbuf */ -azx_skl_get_dpib_pos (chip, azx_dev); -return azx_get_pos_posbuf (chip, azx_dev); -} -static void __azx_shutdown_chip (struct azx *chip,bool skip_link_reset) {azx_stop_chip (chip);
@@ -1591,7 +1570,7 @@ static void assign_position_fix(struct azx *chip, int fix) [POS_FIX_POSBUF] = azx_get_pos_posbuf, [POS_FIX_VIACOMBO] = azx_via_get_position, [POS_FIX_COMBO] = azx_get_pos_lpib, - [POS_FIX_SKL] = azx_get_pos_skl, + [POS_FIX_SKL] = azx_get_pos_posbuf, [POS_FIX_FIFO] = azx_get_pos_fifo, };
Signature · 1 line
2.33.0