6.1.16-rc1 review
Subsystems (18)
Greg Kroah-Hartman
maintainerPATCH 150/885 selftests/xsk: print correct payload for packet dump
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 2d0b2ae2871ae6d42a9f0a4280e0fb5bff8d38b8 ]
Print the correct payload when the packet dump option is selected. The network to host conversion was forgotten and the payload was erronously declared to be an int instead of an unsigned int.
--- tools/testing/selftests/bpf/xskxceiver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/xskxceiver.c +2 -2
@@ -767,7 +767,7 @@ static void pkt_dump(void *pkt, u32 len)struct ethhdr *ethhdr;struct udphdr *udphdr;struct iphdr *iphdr; -int payload, i; +u32 payload, i; ethhdr = pkt; iphdr = pkt +sizeof (*ethhdr);
@@ -792,7 +792,7 @@ static void pkt_dump(void *pkt, u32 len)fprintf (stdout,"DEBUG>> L4: udp_hdr->src: %d\n" ,ntohs (udphdr->source));fprintf (stdout,"DEBUG>> L4: udp_hdr->dst: %d\n" ,ntohs (udphdr->dest));/*extract L5 frame */ - payload = *((uint32_t *)(pkt +PKT_HDR_SIZE )); + payload =ntohl (*((u32 *)(pkt +PKT_HDR_SIZE )));fprintf (stdout,"DEBUG>> L5: payload: %d\n" , payload);fprintf (stdout,"---------------------------------------\n" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 151/885 selftests/xsk: print correct error codes when exiting
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 085dcccfb7d3dc52ed708fc588587f319541bc83 ]
Print the correct error codes when exiting the test suite due to some terminal error. Some of these had a switched sign and some of them printed zero instead of errno.
--- tools/testing/selftests/bpf/xskxceiver.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tools/testing/selftests/bpf/xskxceiver.c +9 -9
@@ -350,7 +350,7 @@ static bool ifobj_zc_avail(struct ifobject *ifobject) umem =calloc (1 ,sizeof (struct xsk_umem_info ));if (!umem) {munmap (bufs, umem_sz); -exit_with_error (-ENOMEM ); +exit_with_error (ENOMEM ); } umem->frame_size =XSK_UMEM__DEFAULT_FRAME_SIZE ; ret =xsk_configure_umem (umem, bufs, umem_sz);
@@ -936,7 +936,7 @@ static int receive_pkts(struct test_spec *test, struct pollfd *fds)if (ifobj->use_poll) { ret =poll (fds,1 ,POLL_TMOUT );if (ret <0 ) -exit_with_error (-ret); +exit_with_error (errno);if (!ret) {if (!is_umem_valid (test->ifobj_tx))
@@ -963,7 +963,7 @@ static int receive_pkts(struct test_spec *test, struct pollfd *fds)if (xsk_ring_prod__needs_wakeup (&umem->fq)) { ret =poll (fds,1 ,POLL_TMOUT );if (ret <0 ) -exit_with_error (-ret); +exit_with_error (errno); } ret =xsk_ring_prod__reserve (&umem->fq, rcvd, &idx_fq); }
@@ -1014,7 +1014,7 @@ static int __send_pkts(struct ifobject *ifobject, u32 *pkt_nb, struct pollfd *fdif (timeout) {if (ret <0 ) {ksft_print_msg ("ERROR: [%s] Poll error %d\n" , - __func__, ret); + __func__, errno);return TEST_FAILURE ; }if (ret ==0 )
@@ -1023,7 +1023,7 @@ static int __send_pkts(struct ifobject *ifobject, u32 *pkt_nb, struct pollfd *fd }if (ret <=0 ) {ksft_print_msg ("ERROR: [%s] Poll error %d\n" , - __func__, ret); + __func__, errno);return TEST_FAILURE ; } }
@@ -1322,18 +1322,18 @@ static void thread_common_ops(struct test_spec *test, struct ifobject *ifobject)if (ifobject->xdp_flags &XDP_FLAGS_SKB_MODE ) {if (opts.attach_mode !=XDP_ATTACHED_SKB ) {ksft_print_msg ("ERROR: [%s] XDP prog not in SKB mode\n" ); -exit_with_error (-EINVAL ); +exit_with_error (EINVAL ); } }else if (ifobject->xdp_flags &XDP_FLAGS_DRV_MODE ) {if (opts.attach_mode !=XDP_ATTACHED_DRV ) {ksft_print_msg ("ERROR: [%s] XDP prog not in DRV mode\n" ); -exit_with_error (-EINVAL ); +exit_with_error (EINVAL ); } } ret =xsk_socket__update_xskmap (ifobject->xsk->xsk, ifobject->xsk_map_fd);if (ret) -exit_with_error (-ret); +exit_with_error (errno); }static void *worker_testapp_validate_tx (void *arg)
@@ -1540,7 +1540,7 @@ static void swap_xsk_resources(struct ifobject *ifobj_tx, struct ifobject *ifobj ret =xsk_socket__update_xskmap (ifobj_rx->xsk->xsk, ifobj_rx->xsk_map_fd);if (ret) -exit_with_error (-ret); +exit_with_error (errno); }static void testapp_bpf_res (struct test_spec *test)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 152/885 arm64/cpufeature: Fix field sign for DIT hwcap detection
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 50daf5b7c4ec4efcaf49a4128930f872bec7dbc0 ]
Since it was added our hwcap for DIT has specified that DIT is a signed field but this appears to be incorrect, the two values for the enumeration are:
0b0000 NI 0b0001 IMP
which look like a normal unsigned enumeration and the in-kernel DIT usage added by 01ab991fc0ee ("arm64: Enable data independent timing (DIT) in the kernel") detects the feature with an unsigned enum. Fix the hwcap to specify the field as unsigned.
--- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/cpufeature.c +1 -1
@@ -2756,7 +2756,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {HWCAP_CAP (SYS_ID_AA64PFR0_EL1 ,ID_AA64PFR0_EL1_FP_SHIFT ,4 ,FTR_SIGNED ,1 ,CAP_HWCAP ,KERNEL_HWCAP_FPHP ),HWCAP_CAP (SYS_ID_AA64PFR0_EL1 , ID_AA64PFR0_EL1_AdvSIMD_SHIFT,4 ,FTR_SIGNED ,0 ,CAP_HWCAP ,KERNEL_HWCAP_ASIMD ),HWCAP_CAP (SYS_ID_AA64PFR0_EL1 , ID_AA64PFR0_EL1_AdvSIMD_SHIFT,4 ,FTR_SIGNED ,1 ,CAP_HWCAP ,KERNEL_HWCAP_ASIMDHP ), -HWCAP_CAP (SYS_ID_AA64PFR0_EL1 ,ID_AA64PFR0_EL1_DIT_SHIFT ,4 ,FTR_SIGNED ,1 ,CAP_HWCAP ,KERNEL_HWCAP_DIT ), +HWCAP_CAP (SYS_ID_AA64PFR0_EL1 ,ID_AA64PFR0_EL1_DIT_SHIFT ,4 ,FTR_UNSIGNED ,1 ,CAP_HWCAP ,KERNEL_HWCAP_DIT ),HWCAP_CAP (SYS_ID_AA64ISAR1_EL1 ,ID_AA64ISAR1_EL1_DPB_SHIFT ,4 ,FTR_UNSIGNED ,1 ,CAP_HWCAP ,KERNEL_HWCAP_DCPOP ),HWCAP_CAP (SYS_ID_AA64ISAR1_EL1 ,ID_AA64ISAR1_EL1_DPB_SHIFT ,4 ,FTR_UNSIGNED ,2 ,CAP_HWCAP ,KERNEL_HWCAP_DCPODP ), HWCAP_CAP(SYS_ID_AA64ISAR1_EL1, ID_AA64ISAR1_EL1_JSCVT_SHIFT, 4, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_JSCVT),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 153/885 kselftest/arm64: Fix syscall-abi for systems without 128 bit SME
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 97ec597b26df774a257e3f8e97353fd1b4471615 ]
SME does not mandate any specific VL so we may not have 128 bit SME but the algorithm used for enumerating VLs assumes that we will. Add the required check to ensure that the algorithm terminates.
--- tools/testing/selftests/arm64/abi/syscall-abi.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/testing/selftests/arm64/abi/syscall-abi.c +8 -0
@@ -390,6 +390,10 @@ static void test_one_syscall(struct syscall_cfg *cfg) sme_vl &=PR_SME_VL_LEN_MASK ; +/* Found lowest VL */ +if (sve_vq_from_vl (sme_vl) > sme_vq) +break ; +if (sme_vq !=sve_vq_from_vl (sme_vl)) sme_vq =sve_vq_from_vl (sme_vl);
@@ -461,6 +465,10 @@ int sme_count_vls(void) vl &=PR_SME_VL_LEN_MASK ; +/* Found lowest VL */ +if (sve_vq_from_vl (vl) > vq) +break ; +if (vq !=sve_vq_from_vl (vl)) vq =sve_vq_from_vl (vl);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 154/885 workqueue: Protects wq_unbound_cpumask with wq_pool_attach_mutex
In reply to Greg Kroah-HartmanFrom: Lai Jiangshan <[email protected]>
[ Upstream commit 99c621ef243bda726fb8d982a274ded96570b410 ]
When unbind_workers() reads wq_unbound_cpumask to set the affinity of freshly-unbound kworkers, it only holds wq_pool_attach_mutex. This isn't sufficient as wq_unbound_cpumask is only protected by wq_pool_mutex.
Make wq_unbound_cpumask protected with wq_pool_attach_mutex and also remove the need of temporary saved_cpumask.
--- kernel/workqueue.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-)
kernel/workqueue.c +16 -25
@@ -326,7 +326,7 @@ static struct rcuwait manager_wait = __RCUWAIT_INITIALIZER(manager_wait);static LIST_HEAD (workqueues);/* PR: list of all workqueues */ static bool workqueue_freezing;/* PL: have wqs started freezing? */ -/* PL: allowable cpus for unbound wqs and work items */ +/* PL&A: allowable cpus for unbound wqs and work items */ static cpumask_var_t wq_unbound_cpumask;/* CPU where unbound work was last round robin scheduled from this CPU */
@@ -3952,7 +3952,8 @@ static void apply_wqattrs_cleanup(struct apply_wqattrs_ctx *ctx)/* allocate the attrs and pwqs for later installation */ static struct apply_wqattrs_ctx *apply_wqattrs_prepare (struct workqueue_struct *wq, -const struct workqueue_attrs *attrs) +const struct workqueue_attrs *attrs, +const cpumask_var_t unbound_cpumask) {struct apply_wqattrs_ctx *ctx;struct workqueue_attrs *new_attrs, *tmp_attrs;
@@ -3968,14 +3969,15 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, goto out_free;/* -* Calculate the attrs of the default pwq. +* Calculate the attrs of the default pwq with unbound_cpumask +* which is wq_unbound_cpumask or to set to wq_unbound_cpumask. * If the user configured cpumask doesn't overlap with the * wq_unbound_cpumask, we fallback to the wq_unbound_cpumask. */ copy_workqueue_attrs (new_attrs, attrs); -cpumask_and (new_attrs->cpumask, new_attrs->cpumask, wq_unbound_cpumask); +cpumask_and (new_attrs->cpumask, new_attrs->cpumask, unbound_cpumask);if (unlikely (cpumask_empty (new_attrs->cpumask))) -cpumask_copy (new_attrs->cpumask, wq_unbound_cpumask); +cpumask_copy (new_attrs->cpumask, unbound_cpumask);/* * We may create multiple pwqs with differing cpumasks. Make a
@@ -4072,7 +4074,7 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq, wq->flags &= ~__WQ_ORDERED; } - ctx =apply_wqattrs_prepare (wq, attrs); + ctx =apply_wqattrs_prepare (wq, attrs, wq_unbound_cpumask);if (!ctx)return -ENOMEM ;
@@ -5334,7 +5336,7 @@ void thaw_workqueues(void) }#endif /* CONFIG_FREEZER */ -static int workqueue_apply_unbound_cpumask (void ) +static int workqueue_apply_unbound_cpumask (const cpumask_var_t unbound_cpumask) {LIST_HEAD (ctxs);int ret =0 ;
@@ -5350,7 +5352,7 @@ static int workqueue_apply_unbound_cpumask(void)if (wq->flags & __WQ_ORDERED)continue ; - ctx =apply_wqattrs_prepare (wq, wq->unbound_attrs); + ctx =apply_wqattrs_prepare (wq, wq->unbound_attrs, unbound_cpumask);if (!ctx) { ret = -ENOMEM ;break ;
@@ -5365,6 +5367,11 @@ static int workqueue_apply_unbound_cpumask(void)apply_wqattrs_cleanup (ctx); } +if (!ret) { +mutex_lock (&wq_pool_attach_mutex); +cpumask_copy (wq_unbound_cpumask, unbound_cpumask); +mutex_unlock (&wq_pool_attach_mutex); + }return ret; }
@@ -5383,7 +5390,6 @@ static int workqueue_apply_unbound_cpumask(void)int workqueue_set_unbound_cpumask (cpumask_var_t cpumask) {int ret = -EINVAL ; -cpumask_var_t saved_cpumask;/* * Not excluding isolated cpus on purpose.
@@ -5397,23 +5403,8 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask) goto out_unlock; } -if (!zalloc_cpumask_var (&saved_cpumask,GFP_KERNEL )) { - ret = -ENOMEM ; - goto out_unlock; - } - -/* save the old wq_unbound_cpumask. */ -cpumask_copy (saved_cpumask, wq_unbound_cpumask); - -/* update wq_unbound_cpumask at first and apply it to wqs. */ -cpumask_copy (wq_unbound_cpumask, cpumask); - ret =workqueue_apply_unbound_cpumask (); - -/* restore the wq_unbound_cpumask when failed. */ -if (ret <0 ) -cpumask_copy (wq_unbound_cpumask, saved_cpumask); + ret =workqueue_apply_unbound_cpumask (cpumask); -free_cpumask_var (saved_cpumask); out_unlock:apply_wqattrs_unlock (); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 155/885 s390/early: fix sclp_early_sccb variable lifetime
In reply to Greg Kroah-HartmanFrom: Alexander Gordeev <[email protected]>
[ Upstream commit 639886b71ddef085a0e7bb1f225b8ae3eda5c06f ]
Commit ada1da31ce34 ("s390/sclp: sort out physical vs virtual pointers usage") fixed the notion of virtual address for sclp_early_sccb pointer. However, it did not take into account that kasan_early_init() can also output messages and sclp_early_sccb should be adjusted by the time kasan_early_init() is called.
Currently it is not a problem, since virtual and physical addresses on s390 are the same. Nevertheless, should they ever differ, this would cause an invalid pointer access.
--- arch/s390/kernel/early.c | 1 - arch/s390/kernel/head64.S | 1 + drivers/s390/char/sclp_early.c | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/early.c +0 -1
@@ -288,7 +288,6 @@ static void __init sort_amode31_extable(void)void __init startup_init (void ) { -sclp_early_adjust_va ();reset_tod_clock ();check_image_bootable ();time_early_init ();
arch/s390/kernel/head64.S +1 -0
@@ -25,6 +25,7 @@ ENTRY(startup_continue) larl %r14,init_task stg %r14,__LC_CURRENT larl %r15,init_thread_union+THREAD_SIZE-STACK_FRAME_OVERHEAD-__PT_SIZE + brasl %r14,sclp_early_adjust_va # allow sclp_early_printk #ifdef CONFIG_KASAN brasl %r14,kasan_early_init #endif
drivers/s390/char/sclp_early.c +1 -1
@@ -161,7 +161,7 @@ static void __init sclp_early_console_detect(struct init_sccb *sccb) sclp.has_linemode =1 ; } -void __init sclp_early_adjust_va (void ) +void __init __no_sanitize_address sclp_early_adjust_va(void) { sclp_early_sccb =__va ((unsigned long )sclp_early_sccb); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 156/885 s390/vfio-ap: fix an error handling path in vfio_ap_mdev_probe_queue()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 08866d34c7099e981918d34aab5d6a437436628f ]
The commit in Fixes: has switch the order of a sysfs_create_group() and a kzalloc().
It correctly removed the now useless kfree() but forgot to add a sysfs_remove_group() in case of (unlikely) memory allocation failure.
Add it now.
--- drivers/s390/crypto/vfio_ap_ops.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/s390/crypto/vfio_ap_ops.c +8 -2
@@ -1844,8 +1844,10 @@ int vfio_ap_mdev_probe_queue(struct ap_device *apdev)return ret; q =kzalloc (sizeof (*q),GFP_KERNEL ); -if (!q) -return -ENOMEM ; +if (!q) { + ret = -ENOMEM ; + goto err_remove_group; + } q->apqn =to_ap_queue (&apdev->device)->qid; q->saved_isc =VFIO_AP_ISC_INVALID ;
@@ -1863,6 +1865,10 @@ int vfio_ap_mdev_probe_queue(struct ap_device *apdev)release_update_locks_for_mdev (matrix_mdev);return 0 ; + +err_remove_group: +sysfs_remove_group (&apdev->device.kobj, &vfio_queue_attr_group); +return ret; }void vfio_ap_mdev_remove_queue (struct ap_device *apdev)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 157/885 x86/signal: Fix the value returned by strict_sas_size()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ef6dfc4b238a435ab552207ec09e4a82b6426d31 ]
Functions used with __setup() return 1 when the argument has been successfully parsed.
Reverse the returned value so that 1 is returned when kstrtobool() is successful (i.e. returns 0).
My understanding of these __setup() functions is that returning 1 or 0 does not change much anyway - so this is more of a cleanup than a functional fix.
I spot it and found it spurious while looking at something else. Even if the output is not perfect, you'll get the idea with:
$ git grep -B2 -A10 retu.*kstrtobool | grep __setup -B10
--- arch/x86/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/signal.c +1 -1
@@ -923,7 +923,7 @@ static bool strict_sigaltstack_size __ro_after_init = false;static int __init strict_sas_size (char *arg) { -return kstrtobool (arg, &strict_sigaltstack_size); +return kstrtobool (arg, &strict_sigaltstack_size) ==0 ; }__setup ("strict_sas_size" , strict_sas_size);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 158/885 thermal/drivers/tsens: Drop msm8976-specific defines
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 3bf0ea99e2e32b0335106b86d84404cc85bcd113 ]
Drop msm8976-specific defines, which duplicate generic ones.
--- drivers/thermal/qcom/tsens-v1.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/thermal/qcom/tsens-v1.c +2 -7
@@ -78,11 +78,6 @@#define MSM8976_CAL_SEL_MASK 0x3 -#define MSM8976_CAL_DEGC_PT1 30 -#define MSM8976_CAL_DEGC_PT2 120 -#define MSM8976_SLOPE_FACTOR 1000 -#define MSM8976_SLOPE_DEFAULT 3200 -/* eeprom layout data for qcs404/405 (v1) */ #define BASE0_MASK 0x000007f8#define BASE1_MASK 0x0007f800
@@ -160,8 +155,8 @@ static void compute_intercept_slope_8976(struct tsens_priv *priv, priv->sensor[10 ].slope =3286 ;for (i =0 ; i < priv->num_sensors; i++) { - priv->sensor[i].offset = (p1[i] *MSM8976_SLOPE_FACTOR ) - - (MSM8976_CAL_DEGC_PT1 * + priv->sensor[i].offset = (p1[i] *SLOPE_FACTOR ) - + (CAL_DEGC_PT1 * priv->sensor[i].slope); } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 159/885 thermal/drivers/tsens: Sort out msm8976 vs msm8956 data
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit a7d3006be5ca7b04e4b84b5ceaae55a700e511bd ]
Tsens driver mentions that msm8976 data should be used for both msm8976 and msm8956 SoCs. This is not quite correct, as according to the vendor kernels, msm8976 should use standard slope values (3200), while msm8956 really uses the slope values found in the driver.
Add separate compatibility string for msm8956, move slope value overrides to the corresponding init function and use the standard compute_intercept_slope() function for both platforms.
--- drivers/thermal/qcom/tsens-v1.c | 56 ++++++++++++++++++--------------- drivers/thermal/qcom/tsens.c | 3 ++ drivers/thermal/qcom/tsens.h | 2 +- 3 files changed, 34 insertions(+), 27 deletions(-)
drivers/thermal/qcom/tsens-v1.c +30 -26
@@ -137,30 +137,6 @@#define CAL_SEL_MASK 7#define CAL_SEL_SHIFT 0 -static void compute_intercept_slope_8976 (struct tsens_priv *priv, -u32 *p1,u32 *p2,u32 mode) -{ -int i; - - priv->sensor[0 ].slope =3313 ; - priv->sensor[1 ].slope =3275 ; - priv->sensor[2 ].slope =3320 ; - priv->sensor[3 ].slope =3246 ; - priv->sensor[4 ].slope =3279 ; - priv->sensor[5 ].slope =3257 ; - priv->sensor[6 ].slope =3234 ; - priv->sensor[7 ].slope =3269 ; - priv->sensor[8 ].slope =3255 ; - priv->sensor[9 ].slope =3239 ; - priv->sensor[10 ].slope =3286 ; - -for (i =0 ; i < priv->num_sensors; i++) { - priv->sensor[i].offset = (p1[i] *SLOPE_FACTOR ) - - (CAL_DEGC_PT1 * - priv->sensor[i].slope); - } -} -static int calibrate_v1 (struct tsens_priv *priv) {u32 base0 =0 , base1 =0 ;
@@ -286,7 +262,7 @@ static int calibrate_8976(struct tsens_priv *priv)break ; } -compute_intercept_slope_8976 (priv, p1, p2, mode); +compute_intercept_slope (priv, p1, p2, mode);kfree (qfprom_cdata);return 0 ;
@@ -357,6 +333,22 @@ static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = { [TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0), }; +static int __init init_8956 (struct tsens_priv *priv) { + priv->sensor[0 ].slope =3313 ; + priv->sensor[1 ].slope =3275 ; + priv->sensor[2 ].slope =3320 ; + priv->sensor[3 ].slope =3246 ; + priv->sensor[4 ].slope =3279 ; + priv->sensor[5 ].slope =3257 ; + priv->sensor[6 ].slope =3234 ; + priv->sensor[7 ].slope =3269 ; + priv->sensor[8 ].slope =3255 ; + priv->sensor[9 ].slope =3239 ; + priv->sensor[10 ].slope =3286 ; + +return init_common (priv); +} +static const struct tsens_ops ops_generic_v1 = { .init = init_common, .calibrate = calibrate_v1,
@@ -369,13 +361,25 @@ struct tsens_plat_data data_tsens_v1 = { .fields = tsens_v1_regfields, }; +static const struct tsens_ops ops_8956 = { + .init = init_8956, + .calibrate = calibrate_8976, + .get_temp = get_temp_tsens_valid, +}; + +struct tsens_plat_data data_8956 = { + .num_sensors =11 , + .ops = &ops_8956, + .feat = &tsens_v1_feat, + .fields = tsens_v1_regfields, +}; +static const struct tsens_ops ops_8976 = { .init = init_common, .calibrate = calibrate_8976, .get_temp = get_temp_tsens_valid, }; -/* Valid for both MSM8956 and MSM8976. */ struct tsens_plat_data data_8976 = { .num_sensors =11 , .ops = &ops_8976,
drivers/thermal/qcom/tsens.c +3 -0
@@ -968,6 +968,9 @@ static const struct of_device_id tsens_table[] = { }, { .compatible = "qcom,msm8939-tsens", .data = &data_8939, + }, { + .compatible = "qcom,msm8956-tsens", + .data = &data_8956, }, { .compatible = "qcom,msm8960-tsens", .data = &data_8960,
drivers/thermal/qcom/tsens.h +1 -1
@@ -588,7 +588,7 @@ extern struct tsens_plat_data data_8960;extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607;/* TSENS v1 targets */ -extern struct tsens_plat_data data_tsens_v1, data_8976; +extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;/* TSENS v2 targets */ extern struct tsens_plat_data data_8996, data_tsens_v2;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 160/885 thermal/drivers/tsens: fix slope values for msm8939
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 5aec3b035e0cbf3f042c2a03d654e5ad6748feb7 ]
According to the vendor kernels (msm-3.10, 3.14 and 3.18), msm8939 uses non-standard slope values for calibrating the sensors. Fill them accordingly.
--- drivers/thermal/qcom/tsens-v0_1.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/thermal/qcom/tsens-v0_1.c +16 -1
@@ -534,6 +534,21 @@ static int calibrate_9607(struct tsens_priv *priv)return 0 ; } +static int __init init_8939 (struct tsens_priv *priv) { + priv->sensor[0 ].slope =2911 ; + priv->sensor[1 ].slope =2789 ; + priv->sensor[2 ].slope =2906 ; + priv->sensor[3 ].slope =2763 ; + priv->sensor[4 ].slope =2922 ; + priv->sensor[5 ].slope =2867 ; + priv->sensor[6 ].slope =2833 ; + priv->sensor[7 ].slope =2838 ; + priv->sensor[8 ].slope =2840 ; + priv->sensor[9 ].slope =2852 ; + +return init_common (priv); +} +/* v0.1: 8916, 8939, 8974, 9607 */ static struct tsens_features tsens_v0_1_feat = {
@@ -596,7 +611,7 @@ struct tsens_plat_data data_8916 = { };static const struct tsens_ops ops_8939 = { - .init = init_common, + .init = init_8939, .calibrate = calibrate_8939, .get_temp = get_temp_common, };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 161/885 thermal/drivers/tsens: limit num_sensors to 9 for msm8939
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 903238a33c116edf5f64f7a3fd246e6169cccfa6 ]
On msm8939 last (hwid=10) sensor was added in the hw revision 3.0. Calibration data for it was placed outside of the main calibration data blob, so it is not accessible by the current blob-parsing code.
Moreover data for the sensor's p2 is not contiguous in the fuses. This makes it hard to use nvmem_cell API to parse calibration data in a generic way.
Since the sensor doesn't seem to be actually used by the existing hardware, disable the sensor for now.
--- drivers/thermal/qcom/tsens-v0_1.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/thermal/qcom/tsens-v0_1.c +4 -9
@@ -285,7 +285,7 @@ static int calibrate_8939(struct tsens_priv *priv)u32 p1[10 ], p2[10 ];int mode =0 ;u32 *qfprom_cdata; -u32 cdata[6 ]; +u32 cdata[4 ]; qfprom_cdata = (u32 *)qfprom_read (priv->dev,"calib" );if (IS_ERR (qfprom_cdata))
@@ -296,8 +296,6 @@ static int calibrate_8939(struct tsens_priv *priv) cdata[1 ] = qfprom_cdata[13 ]; cdata[2 ] = qfprom_cdata[0 ]; cdata[3 ] = qfprom_cdata[1 ]; - cdata[4 ] = qfprom_cdata[22 ]; - cdata[5 ] = qfprom_cdata[21 ]; mode = (cdata[0 ] &MSM8939_CAL_SEL_MASK ) >>MSM8939_CAL_SEL_SHIFT ;dev_dbg (priv->dev,"calibration mode is %d\n" , mode);
@@ -314,8 +312,6 @@ static int calibrate_8939(struct tsens_priv *priv) p2[6 ] = (cdata[2 ] &MSM8939_S6_P2_MASK ) >>MSM8939_S6_P2_SHIFT ; p2[7 ] = (cdata[3 ] &MSM8939_S7_P2_MASK ) >>MSM8939_S7_P2_SHIFT ; p2[8 ] = (cdata[3 ] &MSM8939_S8_P2_MASK ) >>MSM8939_S8_P2_SHIFT ; - p2[9 ] = (cdata[4 ] &MSM8939_S9_P2_MASK_0_4 ) >>MSM8939_S9_P2_SHIFT_0_4 ; - p2[9 ] |= ((cdata[5 ] &MSM8939_S9_P2_MASK_5 ) >>MSM8939_S9_P2_SHIFT_5 ) <<5 ;for (i =0 ; i < priv->num_sensors; i++) p2[i] = (base1 + p2[i]) <<2 ; fallthrough;
@@ -331,7 +327,6 @@ static int calibrate_8939(struct tsens_priv *priv) p1[6 ] = (cdata[2 ] &MSM8939_S6_P1_MASK ) >>MSM8939_S6_P1_SHIFT ; p1[7 ] = (cdata[3 ] &MSM8939_S7_P1_MASK ) >>MSM8939_S7_P1_SHIFT ; p1[8 ] = (cdata[3 ] &MSM8939_S8_P1_MASK ) >>MSM8939_S8_P1_SHIFT ; - p1[9 ] = (cdata[4 ] &MSM8939_S9_P1_MASK ) >>MSM8939_S9_P1_SHIFT ;for (i =0 ; i < priv->num_sensors; i++) p1[i] = ((base0) + p1[i]) <<2 ;break ;
@@ -544,7 +539,7 @@ static int __init init_8939(struct tsens_priv *priv) { priv->sensor[6 ].slope =2833 ; priv->sensor[7 ].slope =2838 ; priv->sensor[8 ].slope =2840 ; - priv->sensor[9 ].slope =2852 ; +/* priv->sensor[9].slope = 2852; */ return init_common (priv); }
@@ -617,9 +612,9 @@ static const struct tsens_ops ops_8939 = { };struct tsens_plat_data data_8939 = { - .num_sensors =10 , + .num_sensors =9 , .ops = &ops_8939, - .hw_ids = (unsigned int []){0 ,1 ,2 ,3 ,5 ,6 ,7 ,8 ,9 ,10 }, + .hw_ids = (unsigned int []){0 ,1 ,2 ,3 ,5 ,6 ,7 ,8 ,9 ,/* 10 */ }, .feat = &tsens_v0_1_feat, .fields = tsens_v0_1_regfields,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 162/885 wifi: rtw89: fix potential leak in rtw89_append_probe_req_ie()
In reply to Greg Kroah-HartmanFrom: Zong-Zhe Yang <[email protected]>
[ Upstream commit 4a0e218cc9c42d1903ade8b5a371dcf48cf918c5 ]
Do kfree_skb(new) before goto out to prevent potential leak.
--- drivers/net/wireless/realtek/rtw89/fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/fw.c +3 -1
@@ -2525,8 +2525,10 @@ static int rtw89_append_probe_req_ie(struct rtw89_dev *rtwdev,list_add_tail (&info->list, &scan_info->pkt_list[band]); ret =rtw89_fw_h2c_add_pkt_offload (rtwdev, &info->id, new); -if (ret) +if (ret) { +kfree_skb (new); goto out; + }kfree_skb (new); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 163/885 wifi: rtw89: Add missing check for alloc_workqueue
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit ed9e6166eb0984b718facb7ca59296098cc3aa64 ]
Add check for the return value of alloc_workqueue since it may return NULL pointer.
Moreover, add destroy_workqueue when rtw89_load_firmware fails.
--- drivers/net/wireless/realtek/rtw89/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/realtek/rtw89/core.c +3 -0
@@ -3047,6 +3047,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)INIT_DELAYED_WORK (&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);INIT_DELAYED_WORK (&rtwdev->forbid_ba_work, rtw89_forbid_ba_work); rtwdev->txq_wq =alloc_workqueue ("rtw89_tx_wq" ,WQ_UNBOUND |WQ_HIGHPRI ,0 ); +if (!rtwdev->txq_wq) +return -ENOMEM ;spin_lock_init (&rtwdev->ba_lock);spin_lock_init (&rtwdev->rpwm_lock);mutex_init (&rtwdev->mutex);
@@ -3070,6 +3072,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev) ret =rtw89_load_firmware (rtwdev);if (ret) {rtw89_warn (rtwdev,"no firmware loaded\n" ); +destroy_workqueue (rtwdev->txq_wq);return ret; }rtw89_ser_init (rtwdev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 164/885 wifi: rtl8xxxu: Fix memory leaks with RTL8723BU, RTL8192EU
In reply to Greg Kroah-HartmanFrom: Bitterblue Smith <[email protected]>
[ Upstream commit b39f662ce1648db0b9de32e6a849b098480793cb ]
The wifi + bluetooth combo chip RTL8723BU can leak memory (especially?) when it's connected to a bluetooth audio device. The busy bluetooth traffic generates lots of C2H (card to host) messages, which are not freed correctly.
To fix this, move the dev_kfree_skb() call in rtl8xxxu_c2hcmd_callback() inside the loop where skb_dequeue() is called.
The RTL8192EU leaks memory because the C2H messages are added to the queue and left there forever. (This was fine in the past because it probably wasn't sending any C2H messages until commit e542e66b7c2e ("wifi: rtl8xxxu: gen2: Turn on the rate control"). Since that commit it sends a C2H message when the TX rate changes.)
To fix this, delete the check for rf_paths > 1 and the goto. Let the function process the C2H messages from RTL8192EU like the ones from the other chips.
Theoretically the RTL8188FU could also leak like RTL8723BU, but it most likely doesn't send C2H messages frequently enough.
This change was tested with RTL8723BU by Erhard F. I tested it with RTL8188FU and RTL8192EU.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +2 -6
@@ -5547,9 +5547,6 @@ static void rtl8xxxu_c2hcmd_callback(struct work_struct *work) btcoex = &priv->bt_coex; rarpt = &priv->ra_report; -if (priv->rf_paths >1 ) - goto out; -while (!skb_queue_empty (&priv->c2hcmd_queue)) { skb =skb_dequeue (&priv->c2hcmd_queue);
@@ -5601,10 +5598,9 @@ static void rtl8xxxu_c2hcmd_callback(struct work_struct *work)default :break ; } - } -out: -dev_kfree_skb (skb); +dev_kfree_skb (skb); + } } static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 165/885 wifi: orinoco: check return value of hermes_write_wordrec()
In reply to Greg Kroah-HartmanFrom: Alexey Kodanev <[email protected]>
[ Upstream commit 1e346cbb096a5351a637ec1992beffbf330547f0 ]
There is currently no return check for writing an authentication type (HERMES_AUTH_SHARED_KEY or HERMES_AUTH_OPEN). It looks like it was accidentally skipped.
This patch adds a return check similar to the other checks in __orinoco_hw_setup_enc() for hermes_write_wordrec().
Detected using the static analysis tool - Svace.
--- drivers/net/wireless/intersil/orinoco/hw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/intersil/orinoco/hw.c +2 -0
@@ -931,6 +931,8 @@ int __orinoco_hw_setup_enc(struct orinoco_private *priv) err =hermes_write_wordrec (hw,USER_BAP ,HERMES_RID_CNFAUTHENTICATION_AGERE , auth_flag); +if (err) +return err; } err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNFWEPENABLED_AGERE,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 166/885 thermal/drivers/imx_sc_thermal: Drop empty platform remove function
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 5011a110295d25418f5918a6af7bfcdb00dd4e34 ]
A remove callback just returning 0 is equivalent to no remove callback at all. So drop the useless function.
Stable-dep-of: 4b26b7c9cdef ("thermal/drivers/imx_sc_thermal: Fix the loop condition")
--- drivers/thermal/imx_sc_thermal.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/thermal/imx_sc_thermal.c +0 -6
@@ -127,11 +127,6 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)return 0 ; } -static int imx_sc_thermal_remove (struct platform_device *pdev) -{ -return 0 ; -} -static int imx_sc_sensors[] = {IMX_SC_R_SYSTEM ,IMX_SC_R_PMIC_0 ,-1 };static const struct of_device_id imx_sc_thermal_table[] = {
@@ -142,7 +137,6 @@ MODULE_DEVICE_TABLE(of, imx_sc_thermal_table);static struct platform_driver imx_sc_thermal_driver = { .probe = imx_sc_thermal_probe, - .remove = imx_sc_thermal_remove, .driver = { .name ="imx-sc-thermal" , .of_match_table = imx_sc_thermal_table,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 167/885 thermal/drivers/imx_sc_thermal: Fix the loop condition
In reply to Greg Kroah-HartmanFrom: Viorel Suman <[email protected]>
[ Upstream commit 4b26b7c9cdefdcb478047c30901d2379ef9e50fc ]
The minimal resource ID is 0: IMX_SC_R_AP_0=0, so fix the loop condition. Aside of this - constify the array.
--- drivers/thermal/imx_sc_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/imx_sc_thermal.c +2 -2
@@ -88,7 +88,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)if (!resource_id)return -EINVAL ; -for (i =0 ; resource_id[i] >0 ; i++) { +for (i =0 ; resource_id[i] >=0 ; i++) { sensor =devm_kzalloc (&pdev->dev,sizeof (*sensor),GFP_KERNEL );if (!sensor)
@@ -127,7 +127,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)return 0 ; } -static int imx_sc_sensors[] = {IMX_SC_R_SYSTEM ,IMX_SC_R_PMIC_0 ,-1 }; +static const int imx_sc_sensors[] = {IMX_SC_R_SYSTEM ,IMX_SC_R_PMIC_0 ,-1 };static const struct of_device_id imx_sc_thermal_table[] = { { .compatible ="fsl,imx-sc-thermal" , .data = imx_sc_sensors },
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 168/885 wifi: ath9k: htc_hst: free skb in ath9k_htc_rx_msg() if there is no callback function
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 9b25e3985477ac3f02eca5fc1e0cc6850a3f7e69 ]
It is stated that ath9k_htc_rx_msg() either frees the provided skb or passes its management to another callback function. However, the skb is not freed in case there is no another callback function, and Syzkaller was able to cause a memory leak. Also minor comment fix.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/htc_hst.c +3 -1
@@ -391,7 +391,7 @@ static void ath9k_htc_fw_panic_report(struct htc_target *htc_handle,* HTC Messages are handled directly here and the obtained SKB * is freed. * -* Service messages (Data, WMI) passed to the corresponding +* Service messages (Data, WMI) are passed to the corresponding * endpoint RX handlers, which have to free the SKB. */ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
@@ -478,6 +478,8 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,if (endpoint->ep_callbacks.rx) endpoint->ep_callbacks.rx (endpoint->ep_callbacks.priv, skb, epid); +else + goto invalid; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 169/885 wifi: ath9k: hif_usb: clean up skbs if ath9k_hif_usb_rx_stream() fails
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 0af54343a76263a12dbae7fafb64eb47c4a6ad38 ]
Syzkaller detected a memory leak of skbs in ath9k_hif_usb_rx_stream(). While processing skbs in ath9k_hif_usb_rx_stream(), the already allocated skbs in skb_pool are not freed if ath9k_hif_usb_rx_stream() fails. If we have an incorrect pkt_len or pkt_tag, the input skb is considered invalid and dropped. All the associated packets already in skb_pool should be dropped and freed. Added a comment describing this issue.
The patch also makes remain_skb NULL after being processed so that it cannot be referenced after potential free. The initialization of hif_dev fields which are associated with remain_skb (rx_remain_len, rx_transfer_len and rx_pad_len) is moved after a new remain_skb is allocated.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 31 +++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +22 -9
@@ -561,11 +561,11 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,memcpy (ptr, skb->data, rx_remain_len); rx_pkt_len += rx_remain_len; - hif_dev->rx_remain_len =0 ;skb_put (remain_skb, rx_pkt_len); skb_pool[pool_index++] = remain_skb; - + hif_dev->remain_skb =NULL ; + hif_dev->rx_remain_len =0 ; }else { index = rx_remain_len; }
@@ -584,16 +584,21 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, pkt_len =get_unaligned_le16 (ptr + index); pkt_tag =get_unaligned_le16 (ptr + index +2 ); +/* It is supposed that if we have an invalid pkt_tag or +* pkt_len then the whole input SKB is considered invalid +* and dropped; the associated packets already in skb_pool +* are dropped, too. +*/ if (pkt_tag !=ATH_USB_RX_STREAM_MODE_TAG ) {RX_STAT_INC (hif_dev, skb_dropped); -return ; + goto invalid_pkt; }if (pkt_len >2 *MAX_RX_BUF_SIZE ) {dev_err (&hif_dev->udev->dev,"ath9k_htc: invalid pkt_len (%x)\n" , pkt_len);RX_STAT_INC (hif_dev, skb_dropped); -return ; + goto invalid_pkt; } pad_len =4 - (pkt_len &0x3 );
@@ -605,11 +610,6 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,if (index >MAX_RX_BUF_SIZE ) {spin_lock (&hif_dev->rx_lock); - hif_dev->rx_remain_len = index -MAX_RX_BUF_SIZE ; - hif_dev->rx_transfer_len = -MAX_RX_BUF_SIZE - chk_idx -4 ; - hif_dev->rx_pad_len = pad_len; - nskb =__dev_alloc_skb (pkt_len +32 ,GFP_ATOMIC );if (!nskb) { dev_err(&hif_dev->udev->dev,
@@ -617,6 +617,12 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,spin_unlock (&hif_dev->rx_lock); goto err; } + + hif_dev->rx_remain_len = index -MAX_RX_BUF_SIZE ; + hif_dev->rx_transfer_len = +MAX_RX_BUF_SIZE - chk_idx -4 ; + hif_dev->rx_pad_len = pad_len; +skb_reserve (nskb,32 );RX_STAT_INC (hif_dev, skb_allocated);
@@ -654,6 +660,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, skb_pool[i]->len, USB_WLAN_RX_PIPE);RX_STAT_INC (hif_dev, skb_completed); } +return ; +invalid_pkt: +for (i =0 ; i < pool_index; i++) { +dev_kfree_skb_any (skb_pool[i]); +RX_STAT_INC (hif_dev, skb_dropped); + } +return ; }static void ath9k_hif_usb_rx_cb (struct urb *urb)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 170/885 wifi: ath9k: Fix potential stack-out-of-bounds write in ath9k_wmi_rsp_callback()
In reply to Greg Kroah-HartmanFrom: Minsuk Kang <[email protected]>
[ Upstream commit 8a2f35b9830692f7a616f2f627f943bc748af13a ]
Fix a stack-out-of-bounds write that occurs in a WMI response callback function that is called after a timeout occurs in ath9k_wmi_cmd(). The callback writes to wmi->cmd_rsp_buf, a stack-allocated buffer that could no longer be valid when a timeout occurs. Set wmi->last_seq_id to 0 when a timeout occurred.
Found by a modified version of syzkaller.
BUG: KASAN: stack-out-of-bounds in ath9k_wmi_ctrl_rx Write of size 4 Call Trace: memcpy ath9k_wmi_ctrl_rx ath9k_htc_rx_msg ath9k_hif_usb_reg_in_cb __usb_hcd_giveback_urb usb_hcd_giveback_urb dummy_timer call_timer_fn run_timer_softirq __do_softirq irq_exit_rcu sysvec_apic_timer_interrupt
--- drivers/net/wireless/ath/ath9k/wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath9k/wmi.c +1 -0
@@ -341,6 +341,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,if (!time_left) {ath_dbg (common,WMI ,"Timeout waiting for WMI command: %s\n" ,wmi_cmd_to_name (cmd_id)); + wmi->last_seq_id =0 ;mutex_unlock (&wmi->op_mutex);return -ETIMEDOUT ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 171/885 wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit ed3f83b3459a67a3ab9d806490ac304b567b1c2d ]
crypto_alloc_shash() allocates resources, which should be released by crypto_free_shash(). When ath11k_peer_find() fails, there has memory leak. Add missing crypto_free_shash() to fix this.
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath11k/dp_rx.c +1 -0
@@ -3126,6 +3126,7 @@ int ath11k_peer_rx_frag_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_idif (!peer) {ath11k_warn (ab,"failed to find the peer to set up fragment info\n" );spin_unlock_bh (&ab->base_lock); +crypto_free_shash (tfm);return -ENOENT ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 172/885 wifi: cfg80211: Fix extended KCK key length check in nl80211_set_rekey_data()
In reply to Greg Kroah-HartmanFrom: Shivani Baranwal <[email protected]>
[ Upstream commit df4969ca135b9b3b2c38c07514aaa775112ac835 ]
The extended KCK key length check wrongly using the KEK key attribute for validation. Due to this GTK rekey offload is failing when the KCK key length is 24 bytes even though the driver advertising WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK flag. Use correct attribute to fix the same.
--- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/nl80211.c +1 -1
@@ -13808,7 +13808,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)return -ERANGE ;if (nla_len (tb[NL80211_REKEY_DATA_KCK ]) !=NL80211_KCK_LEN && !(rdev->wiphy.flags &WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK && -nla_len (tb[NL80211_REKEY_DATA_KEK ]) ==NL80211_KCK_EXT_LEN )) +nla_len (tb[NL80211_REKEY_DATA_KCK ]) ==NL80211_KCK_EXT_LEN ))return -ERANGE ; rekey_data.kek =nla_data (tb[NL80211_REKEY_DATA_KEK ]);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 173/885 ACPI: battery: Fix missing NUL-termination with large strings
In reply to Greg Kroah-HartmanFrom: Armin Wolf <[email protected]>
[ Upstream commit f2ac14b5f197e4a2dec51e5ceaa56682ff1592bc ]
When encountering a string bigger than the destination buffer (32 bytes), the string is not properly NUL-terminated, causing buffer overreads later.
This for example happens on the Inspiron 3505, where the battery model name is larger than 32 bytes, which leads to sysfs showing the model name together with the serial number string (which is NUL-terminated and thus prevents worse).
Fix this by using strscpy() which ensures that the result is always NUL-terminated.
--- drivers/acpi/battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/battery.c +1 -1
@@ -440,7 +440,7 @@ static int extract_package(struct acpi_battery *battery,if (element->type ==ACPI_TYPE_STRING || element->type ==ACPI_TYPE_BUFFER ) -strncpy (ptr, element->string.pointer,32 ); +strscpy (ptr, element->string.pointer,32 );else if (element->type ==ACPI_TYPE_INTEGER ) {strncpy (ptr, (u8 *)&element->integer.value,sizeof (u64));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 174/885 selftests/bpf: Fix build errors if CONFIG_NF_CONNTRACK=m
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 92afc5329a5b23d876b215b783d200352d5aaea6 ]
If CONFIG_NF_CONNTRACK=m, there are no definitions of NF_NAT_MANIP_SRC and NF_NAT_MANIP_DST in vmlinux.h, build test_bpf_nf.c failed.
$ make -C tools/testing/selftests/bpf/
CLNG-BPF [test_maps] test_bpf_nf.bpf.oprogs/test_bpf_nf.c:160:42: error: use of undeclared identifier 'NF_NAT_MANIP_SRC'
bpf_ct_set_nat_info(ct, &saddr, sport, NF_NAT_MANIP_SRC);
^
progs/test_bpf_nf.c:163:42: error: use of undeclared identifier 'NF_NAT_MANIP_DST'
bpf_ct_set_nat_info(ct, &daddr, dport, NF_NAT_MANIP_DST);
^2 errors generated.
Copy the definitions in include/net/netfilter/nf_nat.h to test_bpf_nf.c, in order to avoid redefinitions if CONFIG_NF_CONNTRACK=y, rename them with ___local suffix. This is similar with commit 1058b6a78db2 ("selftests/bpf:
Do not fail build if CONFIG_NF_CONNTRACK=m/n").
--- tools/testing/selftests/bpf/progs/test_bpf_nf.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/progs/test_bpf_nf.c +8 -3
@@ -34,6 +34,11 @@ __be16 dport = 0;int test_exist_lookup = -ENOENT ;u32 test_exist_lookup_mark =0 ; +enum nf_nat_manip_type___local { + NF_NAT_MANIP_SRC___local, + NF_NAT_MANIP_DST___local +}; +struct nf_conn ;struct bpf_ct_opts___local {
@@ -58,7 +63,7 @@ int bpf_ct_change_timeout(struct nf_conn *, u32) __ksym; int bpf_ct_set_status(struct nf_conn *, u32) __ksym; int bpf_ct_change_status(struct nf_conn *, u32) __ksym; int bpf_ct_set_nat_info(struct nf_conn *, union nf_inet_addr *, - int port, enum nf_nat_manip_type) __ksym; + int port, enum nf_nat_manip_type___local) __ksym; static __always_inline void nf_ct_test(struct nf_conn *(*lookup_fn)(void *, struct bpf_sock_tuple *, u32,
@@ -157,10 +162,10 @@ nf_ct_test(struct nf_conn *(*lookup_fn)(void *, struct bpf_sock_tuple *, u32,/* snat */ saddr.ip =bpf_get_prandom_u32 (); -bpf_ct_set_nat_info (ct, &saddr, sport,NF_NAT_MANIP_SRC ); +bpf_ct_set_nat_info (ct, &saddr, sport, NF_NAT_MANIP_SRC___local);/* dnat */ daddr.ip =bpf_get_prandom_u32 (); -bpf_ct_set_nat_info (ct, &daddr, dport,NF_NAT_MANIP_DST ); +bpf_ct_set_nat_info (ct, &daddr, dport, NF_NAT_MANIP_DST___local); ct_ins =bpf_ct_insert_entry (ct);if (ct_ins) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 175/885 crypto: ccp - Failure on re-initialization due to duplicate sysfs filename
In reply to Greg Kroah-HartmanFrom: Koba Ko <[email protected]>
[ Upstream commit 299bf602b3f92f1456aef59c6413591fb02e762a ]
The following warning appears during the CCP module re-initialization:
[ 140.965403] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:07.1/0000:03:00.2/dma/dma0chan0' [ 140.975736] CPU: 0 PID: 388 Comm: kworker/0:2 Kdump: loaded Not tainted 6.2.0-0.rc2.18.eln124.x86_64 #1 [ 140.985185] Hardware name: HPE ProLiant DL325 Gen10/ProLiant DL325 Gen10, BIOS A41 07/17/2020 [ 140.993761] Workqueue: events work_for_cpu_fn [ 140.998151] Call Trace: [ 141.000613] <TASK> [ 141.002726] dump_stack_lvl+0x33/0x46 [ 141.006415] sysfs_warn_dup.cold+0x17/0x23 [ 141.010542] sysfs_create_dir_ns+0xba/0xd0 [ 141.014670] kobject_add_internal+0xba/0x260 [ 141.018970] kobject_add+0x81/0xb0 [ 141.022395] device_add+0xdc/0x7e0 [ 141.025822] ? complete_all+0x20/0x90 [ 141.029510] __dma_async_device_channel_register+0xc9/0x130 [ 141.035119] dma_async_device_register+0x19e/0x3b0 [ 141.039943] ccp_dmaengine_register+0x334/0x3f0 [ccp] [ 141.045042] ccp5_init+0x662/0x6a0 [ccp] [ 141.049000] ? devm_kmalloc+0x40/0xd0 [ 141.052688] ccp_dev_init+0xbb/0xf0 [ccp] [ 141.056732] ? __pci_set_master+0x56/0xd0 [ 141.060768] sp_init+0x70/0x90 [ccp] [ 141.064377] sp_pci_probe+0x186/0x1b0 [ccp] [ 141.068596] local_pci_probe+0x41/0x80 [ 141.072374] work_for_cpu_fn+0x16/0x20 [ 141.076145] process_one_work+0x1c8/0x380 [ 141.080181] worker_thread+0x1ab/0x380 [ 141.083953] ? __pfx_worker_thread+0x10/0x10 [ 141.088250] kthread+0xda/0x100 [ 141.091413] ? __pfx_kthread+0x10/0x10 [ 141.095185] ret_from_fork+0x2c/0x50 [ 141.098788] </TASK> [ 141.100996] kobject_add_internal failed for dma0chan0 with -EEXIST, don't try to register things with the same name in the same directory. [ 141.113703] ccp 0000:03:00.2: ccp initialization failed
The /dma/dma0chan0 sysfs file is not removed since dma_chan object has been released in ccp_dma_release() before releasing dma device. A correct procedure would be: release dma channels first => unregister dma device => release ccp dma object.
--- drivers/crypto/ccp/ccp-dmaengine.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/crypto/ccp/ccp-dmaengine.c +17 -4
@@ -642,14 +642,26 @@ static void ccp_dma_release(struct ccp_device *ccp) chan = ccp->ccp_dma_chan + i; dma_chan = &chan->dma_chan; -if (dma_chan->client_count) -dma_release_channel (dma_chan); -tasklet_kill (&chan->cleanup_tasklet);list_del_rcu (&dma_chan->device_node); } } +static void ccp_dma_release_channels (struct ccp_device *ccp) +{ +struct ccp_dma_chan *chan; +struct dma_chan *dma_chan; +unsigned int i; + +for (i =0 ; i < ccp->cmd_q_count; i++) { + chan = ccp->ccp_dma_chan + i; + dma_chan = &chan->dma_chan; + +if (dma_chan->client_count) +dma_release_channel (dma_chan); + } +} +int ccp_dmaengine_register (struct ccp_device *ccp) {struct ccp_dma_chan *chan;
@@ -770,8 +782,9 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp)if (!dmaengine)return ; -ccp_dma_release (ccp); +ccp_dma_release_channels (ccp);dma_async_device_unregister (dma_dev); +ccp_dma_release (ccp);kmem_cache_destroy (ccp->dma_desc_cache);kmem_cache_destroy (ccp->dma_cmd_cache);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 176/885 crypto: essiv - Handle EBUSY correctly
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit b5a772adf45a32c68bef28e60621f12617161556 ]
As it is essiv only handles the special return value of EINPROGERSS, which means that in all other cases it will free data related to the request.
However, as the caller of essiv may specify MAY_BACKLOG, we also need to expect EBUSY and treat it in the same way. Otherwise backlogged requests will trigger a use-after-free.
--- crypto/essiv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
crypto/essiv.c +6 -1
@@ -171,7 +171,12 @@ static void essiv_aead_done(struct crypto_async_request *areq, int err)struct aead_request *req = areq->data;struct essiv_aead_request_ctx *rctx =aead_request_ctx (req); +if (err == -EINPROGRESS ) + goto out; +kfree (rctx->assoc); + +out:aead_request_complete (req, err); }
@@ -247,7 +252,7 @@ static int essiv_aead_crypt(struct aead_request *req, bool enc) err = enc ?crypto_aead_encrypt (subreq) :crypto_aead_decrypt (subreq); -if (rctx->assoc && err != -EINPROGRESS ) +if (rctx->assoc && err != -EINPROGRESS && err != -EBUSY )kfree (rctx->assoc);return err; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 177/885 crypto: seqiv - Handle EBUSY correctly
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 32e62025e5e52fbe4812ef044759de7010b15dbc ]
As it is seqiv only handles the special return value of EINPROGERSS, which means that in all other cases it will free data related to the request.
However, as the caller of seqiv may specify MAY_BACKLOG, we also need to expect EBUSY and treat it in the same way. Otherwise backlogged requests will trigger a use-after-free.
--- crypto/seqiv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/seqiv.c +1 -1
@@ -23,7 +23,7 @@ static void seqiv_aead_encrypt_complete2(struct aead_request *req, int err)struct aead_request *subreq =aead_request_ctx (req);struct crypto_aead *geniv; -if (err == -EINPROGRESS ) +if (err == -EINPROGRESS || err == -EBUSY )return ;if (err)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 178/885 powercap: fix possible name leak in powercap_register_zone()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 1b6599f741a4525ca761ecde46e5885ff1e6ba58 ]
In the error path after calling dev_set_name(), the device name is leaked. To fix this, calling dev_set_name() before device_register(), and call put_device() if it returns error.
All the resources is released in powercap_release(), so it can return from powercap_register_zone() directly.
--- drivers/powercap/powercap_sys.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/powercap/powercap_sys.c +9 -5
@@ -529,9 +529,6 @@ struct powercap_zone *powercap_register_zone( power_zone->name =kstrdup (name,GFP_KERNEL );if (!power_zone->name) goto err_name_alloc; -dev_set_name (&power_zone->dev,"%s:%x" , -dev_name (power_zone->dev.parent), - power_zone->id); power_zone->constraints =kcalloc (nr_constraints,sizeof (*power_zone->constraints),GFP_KERNEL );
@@ -554,9 +551,16 @@ struct powercap_zone *powercap_register_zone( power_zone->dev_attr_groups[0 ] = &power_zone->dev_zone_attr_group; power_zone->dev_attr_groups[1 ] =NULL ; power_zone->dev.groups = power_zone->dev_attr_groups; +dev_set_name (&power_zone->dev,"%s:%x" , +dev_name (power_zone->dev.parent), + power_zone->id); result =device_register (&power_zone->dev); -if (result) - goto err_dev_ret; +if (result) { +put_device (&power_zone->dev); +mutex_unlock (&control_type->lock); + +return ERR_PTR (result); + } control_type->nr_zones++;mutex_unlock (&control_type->lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 179/885 x86/microcode: Add a parameter to microcode_check() to store CPU capabilities
In reply to Greg Kroah-HartmanFrom: Ashok Raj <[email protected]>
[ Upstream commit ab31c74455c64e69342ddab21fd9426fcbfefde7 ]
Add a parameter to store CPU capabilities before performing a microcode update so that CPU capabilities can be compared before and after update.
[ bp: Massage. ]
Stable-dep-of: c0dd9245aa9e ("x86/microcode: Check CPU capabilities after late microcode update correctly")
--- arch/x86/include/asm/processor.h | 2 +- arch/x86/kernel/cpu/common.c | 21 +++++++++++++-------- arch/x86/kernel/cpu/microcode/core.c | 3 ++- 3 files changed, 16 insertions(+), 10 deletions(-)
arch/x86/include/asm/processor.h +1 -1
@@ -835,7 +835,7 @@ bool xen_set_default_idle(void);#endif void __noreturn stop_this_cpu (void *dummy); -void microcode_check (void ); +void microcode_check (struct cpuinfo_x86 *prev_info);enum l1tf_mitigations {L1TF_MITIGATION_OFF ,
arch/x86/kernel/cpu/common.c +13 -8
@@ -2311,30 +2311,35 @@ void cpu_init_secondary(void)#endif #ifdef CONFIG_MICROCODE_LATE_LOADING -/* +/** +* microcode_check() - Check if any CPU capabilities changed after an update. +* @prev_info: CPU capabilities stored before an update. +* * The microcode loader calls this upon late microcode load to recheck features, * only when microcode has been updated. Caller holds microcode_mutex and CPU * hotplug lock. +* +* Return: None */ -void microcode_check (void ) +void microcode_check (struct cpuinfo_x86 *prev_info) { -struct cpuinfo_x86 info; -perf_check_microcode ();/* Reload CPUID max function as it might've changed. */ - info.cpuid_level =cpuid_eax (0 ); + prev_info->cpuid_level =cpuid_eax (0 );/* * Copy all capability leafs to pick up the synthetic ones so that * memcmp() below doesn't fail on that. The ones coming from CPUID will * get overwritten in get_cpu_cap(). */ -memcpy (&info.x86_capability, &boot_cpu_data.x86_capability,sizeof (info.x86_capability)); +memcpy (&prev_info->x86_capability, &boot_cpu_data.x86_capability, +sizeof (prev_info->x86_capability)); -get_cpu_cap (&info); +get_cpu_cap (prev_info); -if (!memcmp (&info.x86_capability, &boot_cpu_data.x86_capability,sizeof (info.x86_capability))) +if (!memcmp (&prev_info->x86_capability, &boot_cpu_data.x86_capability, +sizeof (prev_info->x86_capability)))return ;pr_warn ("x86/CPU: CPU features have changed after loading microcode, but might not take effect.\n" );
arch/x86/kernel/cpu/microcode/core.c +2 -1
@@ -492,6 +492,7 @@ static int __reload_late(void *info)static int microcode_reload_late (void ) {int old = boot_cpu_data.microcode, ret; +struct cpuinfo_x86 prev_info;pr_err ("Attempting late microcode loading - it is dangerous and taints the kernel.\n" );pr_err ("You should switch to early loading, if possible.\n" );
@@ -501,7 +502,7 @@ static int microcode_reload_late(void) ret =stop_machine_cpuslocked (__reload_late,NULL , cpu_online_mask);if (ret ==0 ) -microcode_check (); +microcode_check (&prev_info);pr_info ("Reload completed, microcode revision: 0x%x -> 0x%x\n" , old, boot_cpu_data.microcode);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 180/885 x86/microcode: Check CPU capabilities after late microcode update correctly
In reply to Greg Kroah-HartmanFrom: Ashok Raj <[email protected]>
[ Upstream commit c0dd9245aa9e25a697181f6085692272c9ec61bc ]
The kernel caches each CPU's feature bits at boot in an x86_capability[] structure. However, the capabilities in the BSP's copy can be turned off as a result of certain command line parameters or configuration restrictions, for example the SGX bit. This can cause a mismatch when comparing the values before and after the microcode update.
Another example is X86_FEATURE_SRBDS_CTRL which gets added only after microcode update:
# --- cpuid.before 2023-01-21 14:54:15.652000747 +0100 # +++ cpuid.after 2023-01-21 14:54:26.632001024 +0100 # @@ -10,7 +10,7 @@ CPU: # 0x00000004 0x04: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000 # 0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x11142120 # 0x00000006 0x00: eax=0x000027f7 ebx=0x00000002 ecx=0x00000001 edx=0x00000000 # - 0x00000007 0x00: eax=0x00000000 ebx=0x029c6fbf ecx=0x40000000 edx=0xbc002400 # + 0x00000007 0x00: eax=0x00000000 ebx=0x029c6fbf ecx=0x40000000 edx=0xbc002e00
^^^
and which proves for a gazillionth time that late loading is a bad bad idea.
microcode_check() is called after an update to report any previously cached CPUID bits which might have changed due to the update.
Therefore, store the cached CPU caps before the update and compare them with the CPU caps after the microcode update has succeeded.
Thus, the comparison is done between the CPUID *hardware* bits before and after the upgrade instead of using the cached, possibly runtime modified values in BSP's boot_cpu_data copy.
As a result, false warnings about CPUID bits changes are avoided.
[ bp:
- Massage.
- Add SRBDS_CTRL example.
- Add kernel-doc.
- Incorporate forgotten review feedback from dhansen. ]
--- arch/x86/include/asm/processor.h | 1 + arch/x86/kernel/cpu/common.c | 36 ++++++++++++++++++---------- arch/x86/kernel/cpu/microcode/core.c | 6 +++++ 3 files changed, 30 insertions(+), 13 deletions(-)
arch/x86/include/asm/processor.h +1 -0
@@ -836,6 +836,7 @@ bool xen_set_default_idle(void);void __noreturn stop_this_cpu (void *dummy);void microcode_check (struct cpuinfo_x86 *prev_info); +void store_cpu_caps (struct cpuinfo_x86 *info);enum l1tf_mitigations {L1TF_MITIGATION_OFF ,
arch/x86/kernel/cpu/common.c +23 -13
@@ -2311,6 +2311,25 @@ void cpu_init_secondary(void)#endif #ifdef CONFIG_MICROCODE_LATE_LOADING +/** +* store_cpu_caps() - Store a snapshot of CPU capabilities +* @curr_info: Pointer where to store it +* +* Returns: None +*/ +void store_cpu_caps (struct cpuinfo_x86 *curr_info) +{ +/* Reload CPUID max function as it might've changed. */ + curr_info->cpuid_level =cpuid_eax (0 ); + +/* Copy all capability leafs and pick up the synthetic ones. */ +memcpy (&curr_info->x86_capability, &boot_cpu_data.x86_capability, +sizeof (curr_info->x86_capability)); + +/* Get the hardware CPUID leafs */ +get_cpu_cap (curr_info); +} +/** * microcode_check() - Check if any CPU capabilities changed after an update. * @prev_info: CPU capabilities stored before an update.
@@ -2323,22 +2342,13 @@ void cpu_init_secondary(void)*/ void microcode_check (struct cpuinfo_x86 *prev_info) { -perf_check_microcode (); - -/* Reload CPUID max function as it might've changed. */ - prev_info->cpuid_level =cpuid_eax (0 ); +struct cpuinfo_x86 curr_info; -/* -* Copy all capability leafs to pick up the synthetic ones so that -* memcmp() below doesn't fail on that. The ones coming from CPUID will -* get overwritten in get_cpu_cap(). -*/ -memcpy (&prev_info->x86_capability, &boot_cpu_data.x86_capability, -sizeof (prev_info->x86_capability)); +perf_check_microcode (); -get_cpu_cap (prev_info); +store_cpu_caps (&curr_info); -if (!memcmp (&prev_info->x86_capability, &boot_cpu_data.x86_capability, +if (!memcmp (&prev_info->x86_capability, &curr_info.x86_capability,sizeof (prev_info->x86_capability)))return ;
arch/x86/kernel/cpu/microcode/core.c +6 -0
@@ -500,6 +500,12 @@ static int microcode_reload_late(void)atomic_set (&late_cpus_in,0 );atomic_set (&late_cpus_out,0 ); +/* +* Take a snapshot before the microcode update in order to compare and +* check whether any bits changed after an update. +*/ +store_cpu_caps (&prev_info); + ret =stop_machine_cpuslocked (__reload_late,NULL , cpu_online_mask);if (ret ==0 )microcode_check (&prev_info);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 181/885 x86/microcode: Adjust late loading result reporting message
In reply to Greg Kroah-HartmanFrom: Ashok Raj <[email protected]>
[ Upstream commit 6eab3abac7043226e5375e9ead0c7607ced6767b ]
During late microcode loading, the "Reload completed" message is issued unconditionally, regardless of success or failure.
Adjust the message to report the result of the update.
[ bp: Massage. ]
--- arch/x86/kernel/cpu/microcode/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/microcode/core.c +7 -4
@@ -507,11 +507,14 @@ static int microcode_reload_late(void)store_cpu_caps (&prev_info); ret =stop_machine_cpuslocked (__reload_late,NULL , cpu_online_mask); -if (ret ==0 ) +if (!ret) { +pr_info ("Reload succeeded, microcode revision: 0x%x -> 0x%x\n" , + old, boot_cpu_data.microcode);microcode_check (&prev_info); - -pr_info ("Reload completed, microcode revision: 0x%x -> 0x%x\n" , - old, boot_cpu_data.microcode); + }else { +pr_info ("Reload failed, current microcode revision: 0x%x\n" , + boot_cpu_data.microcode); + }return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 182/885 selftests/bpf: Use consistent build-id type for liburandom_read.so
In reply to Greg Kroah-HartmanFrom: Artem Savkov <[email protected]>
[ Upstream commit 61fc5e66f755db24d27ba37ce1ee4873def1a074 ]
lld produces "fast" style build-ids by default, which is inconsistent with ld's "sha1" style. Explicitly specify build-id style to be "sha1" when linking liburandom_read.so the same way it is already done for urandom_read.
Stable-dep-of: 2514a31241e1 ("selftests/bpf: Fix vmtest static compilation error")
--- tools/testing/selftests/bpf/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/Makefile +4 -3
@@ -182,14 +182,15 @@ endif $(OUTPUT)/liburandom_read.so: urandom_read_lib1.c urandom_read_lib2.c $(call msg,LIB,,$@) $(Q)$(CLANG) $(filter-out -static,$(CFLAGS) $(LDFLAGS)) $^ $(LDLIBS) \ - -fuse-ld=$(LLD) -Wl,-znoseparate-code -fPIC -shared -o $@ + -fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \ + -fPIC -shared -o $@ $(OUTPUT)/urandom_read: urandom_read.c urandom_read_aux.c $(OUTPUT)/liburandom_read.so $(call msg,BINARY,,$@) $(Q)$(CLANG) $(filter-out -static,$(CFLAGS) $(LDFLAGS)) $(filter %.c,$^) \ liburandom_read.so $(LDLIBS) \ - -fuse-ld=$(LLD) -Wl,-znoseparate-code \ - -Wl,-rpath=. -Wl,--build-id=sha1 -o $@ + -fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \ + -Wl,-rpath=. -o $@ $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c $(call msg,SIGN-FILE,,$@)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 183/885 selftests/bpf: Fix vmtest static compilation error
In reply to Greg Kroah-HartmanFrom: Daniel T. Lee <[email protected]>
[ Upstream commit 2514a31241e1e9067d379e0fbdb60e4bc2bf4659 ]
As stated in README.rst, in order to resolve errors with linker errors, 'LDLIBS=-static' should be used. Most problems will be solved by this option, but in the case of urandom_read, this won't fix the problem. So the Makefile is currently implemented to strip the 'static' option when compiling the urandom_read. However, stripping this static option isn't configured properly on $(LDLIBS) correctly, which is now causing errors on static compilation.
# LDLIBS=-static ./vmtest.sh
ld.lld: error: attempted static link of dynamic object liburandom_read.so
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:190: /linux/tools/testing/selftests/bpf/urandom_read] Error 1
make: *** Waiting for unfinished jobs....
This commit fixes this problem by configuring the strip with $(LDLIBS).
--- tools/testing/selftests/bpf/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +3 -2
@@ -181,14 +181,15 @@ endif # do not fail. Static builds leave urandom_read relying on system-wide shared libraries. $(OUTPUT)/liburandom_read.so: urandom_read_lib1.c urandom_read_lib2.c $(call msg,LIB,,$@) - $(Q)$(CLANG) $(filter-out -static,$(CFLAGS) $(LDFLAGS)) $^ $(LDLIBS) \ + $(Q)$(CLANG) $(filter-out -static,$(CFLAGS) $(LDFLAGS)) \ + $^ $(filter-out -static,$(LDLIBS)) \ -fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \ -fPIC -shared -o $@ $(OUTPUT)/urandom_read: urandom_read.c urandom_read_aux.c $(OUTPUT)/liburandom_read.so $(call msg,BINARY,,$@) $(Q)$(CLANG) $(filter-out -static,$(CFLAGS) $(LDFLAGS)) $(filter %.c,$^) \ - liburandom_read.so $(LDLIBS) \ + liburandom_read.so $(filter-out -static,$(LDLIBS)) \ -fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \ -Wl,-rpath=. -o $@
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 184/885 crypto: xts - Handle EBUSY correctly
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 51c082514c2dedf2711c99d93c196cc4eedceb40 ]
As it is xts only handles the special return value of EINPROGRESS, which means that in all other cases it will free data related to the request.
However, as the caller of xts may specify MAY_BACKLOG, we also need to expect EBUSY and treat it in the same way. Otherwise backlogged requests will trigger a use-after-free.
--- crypto/xts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
crypto/xts.c +4 -4
@@ -203,12 +203,12 @@ static void xts_encrypt_done(struct crypto_async_request *areq, int err)if (!err) {struct xts_request_ctx *rctx =skcipher_request_ctx (req); - rctx->subreq.base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP ; + rctx->subreq.base.flags &=CRYPTO_TFM_REQ_MAY_BACKLOG ; err =xts_xor_tweak_post (req, true);if (!err &&unlikely (req->cryptlen %XTS_BLOCK_SIZE )) { err =xts_cts_final (req, crypto_skcipher_encrypt); -if (err == -EINPROGRESS ) +if (err == -EINPROGRESS || err == -EBUSY )return ; } }
@@ -223,12 +223,12 @@ static void xts_decrypt_done(struct crypto_async_request *areq, int err)if (!err) {struct xts_request_ctx *rctx =skcipher_request_ctx (req); - rctx->subreq.base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP ; + rctx->subreq.base.flags &=CRYPTO_TFM_REQ_MAY_BACKLOG ; err =xts_xor_tweak_post (req, false);if (!err &&unlikely (req->cryptlen %XTS_BLOCK_SIZE )) { err =xts_cts_final (req, crypto_skcipher_decrypt); -if (err == -EINPROGRESS ) +if (err == -EINPROGRESS || err == -EBUSY )return ; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 185/885 leds: led-class: Add missing put_device() to led_put()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 445110941eb94709216363f9d807d2508e64abd7 ]
led_put() is used to "undo" a successful of_led_get() call, of_led_get() uses class_find_device_by_of_node() which returns a reference to the device which must be free-ed with put_device() when the caller is done with it.
Add a put_device() call to led_put() to free the reference returned by class_find_device_by_of_node().
And also add a put_device() in the error-exit case of try_module_get() failing.
--- drivers/leds/led-class.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/leds/led-class.c +4 -1
@@ -241,8 +241,10 @@ struct led_classdev *of_led_get(struct device_node *np, int index) led_cdev =dev_get_drvdata (led_dev); -if (!try_module_get (led_cdev->dev->parent->driver->owner)) +if (!try_module_get (led_cdev->dev->parent->driver->owner)) { +put_device (led_cdev->dev);return ERR_PTR (-ENODEV ); + }return led_cdev; }
@@ -255,6 +257,7 @@ EXPORT_SYMBOL_GPL(of_led_get);void led_put (struct led_classdev *led_cdev) {module_put (led_cdev->dev->parent->driver->owner); +put_device (led_cdev->dev); }EXPORT_SYMBOL_GPL (led_put);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 186/885 s390/bpf: Add expoline to tail calls
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit bb4ef8fc3d193ed8d5583fb47cbeff5d8fb8302f ]
All the indirect jumps in the eBPF JIT already use expolines, except for the tail call one.
--- arch/s390/net/bpf_jit_comp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/s390/net/bpf_jit_comp.c +10 -2
@@ -1393,8 +1393,16 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,/* lg %r1,bpf_func(%r1) */ EMIT6_DISP_LH (0xe3000000 ,0x0004 ,REG_1 ,REG_1 ,REG_0 , offsetof(struct bpf_prog , bpf_func)); -/* bc 0xf,tail_call_start(%r1) */ -_EMIT4 (0x47f01000 + jit->tail_call_start); +if (nospec_uses_trampoline ()) { + jit->seen |=SEEN_FUNC ; +/* aghi %r1,tail_call_start */ +EMIT4_IMM (0xa70b0000 ,REG_1 , jit->tail_call_start); +/* brcl 0xf,__s390_indirect_jump_r1 */ +EMIT6_PCREL_RILC (0xc0040000 ,0xf , jit->r1_thunk_ip); + }else { +/* bc 0xf,tail_call_start(%r1) */ +_EMIT4 (0x47f01000 + jit->tail_call_start); + }/* out: */ if (jit->prg_buf) { *(u16 *)(jit->prg_buf + patch_1_clrj + 2) =
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 187/885 wifi: iwlwifi: mei: fix compilation errors in rfkill()
In reply to Greg Kroah-HartmanFrom: Gregory Greenman <[email protected]>
[ Upstream commit 9cbd5a8abca904441e36861e3a92961bec41d13f ]
The rfkill() callback was invoked with wrong parameters. It was missed since MEI is defined now as depending on BROKEN. Fix that.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +3 -3
@@ -784,7 +784,7 @@ static void iwl_mei_handle_amt_state(struct mei_cl_device *cldev,if (mei->amt_enabled)iwl_mei_set_init_conf (mei);else if (iwl_mei_cache.ops) - iwl_mei_cache.ops->rfkill (iwl_mei_cache.priv, false, false); + iwl_mei_cache.ops->rfkill (iwl_mei_cache.priv, false);schedule_work (&mei->netdev_work);
@@ -825,7 +825,7 @@ static void iwl_mei_handle_csme_taking_ownership(struct mei_cl_device *cldev,*/ mei->csme_taking_ownership = true; - iwl_mei_cache.ops->rfkill (iwl_mei_cache.priv, true, true); + iwl_mei_cache.ops->rfkill (iwl_mei_cache.priv, true); }else {iwl_mei_send_sap_msg (cldev,SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED );
@@ -1695,7 +1695,7 @@ int iwl_mei_register(void *priv, const struct iwl_mei_ops *ops)if (mei->amt_enabled)iwl_mei_send_sap_msg (mei->cldev,SAP_MSG_NOTIF_WIFIDR_UP ); - ops->rfkill (priv, mei->link_prot_state, false); + ops->rfkill (priv, mei->link_prot_state); } } ret =0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 188/885 kselftest/arm64: Fix enumeration of systems without 128 bit SME
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 5f389238534ac8ca4ee3ab12eeb89d3984d303a1 ]
The current signal handling tests for SME do not account for the fact that unlike SVE all SME vector lengths are optional so we can't guarantee that we will encounter the minimum possible VL, they will hang enumerating VLs on such systems. Abort enumeration when we find the lowest VL.
--- tools/testing/selftests/arm64/signal/testcases/ssve_regs.c | 4 ++++ tools/testing/selftests/arm64/signal/testcases/za_regs.c | 4 ++++ 2 files changed, 8 insertions(+)
tools/testing/selftests/arm64/signal/testcases/ssve_regs.c +4 -0
@@ -34,6 +34,10 @@ static bool sme_get_vls(struct tdescr *td) vl &=PR_SME_VL_LEN_MASK ; +/* Did we find the lowest supported VL? */ +if (vq <sve_vq_from_vl (vl)) +break ; +/* Skip missing VLs */ vq =sve_vq_from_vl (vl);
tools/testing/selftests/arm64/signal/testcases/za_regs.c +4 -0
@@ -34,6 +34,10 @@ static bool sme_get_vls(struct tdescr *td) vl &=PR_SME_VL_LEN_MASK ; +/* Did we find the lowest supported VL? */ +if (vq <sve_vq_from_vl (vl)) +break ; +/* Skip missing VLs */ vq =sve_vq_from_vl (vl);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 189/885 can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 9be8c5583581244d8a77e41afa16b8b0a5ddabc0 ]
Each Global Acceptance Filter List Configuration Register (GAFLCFG) contains two fields, and stores the number of channel rules for one channel pair.
As R-Car V3U and later can have more than 2 channels, the field selection should be based on the LSB (even or odd) of the channel number, instead of on the full channel number.
--- drivers/net/can/rcar/rcar_canfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/rcar/rcar_canfd.c +2 -2
@@ -98,10 +98,10 @@ enum rcanfd_chip_id {/* RSCFDnCFDGAFLCFG0 / RSCFDnGAFLCFG0 */ #define RCANFD_GAFLCFG_SETRNC (gpriv, n, x) \ (((x) & reg_v3u(gpriv, 0x1ff, 0xff)) << \ - (reg_v3u(gpriv, 16, 24) - (n) * reg_v3u(gpriv, 16, 8))) + (reg_v3u(gpriv, 16, 24) - ((n) & 1) * reg_v3u(gpriv, 16, 8)))#define RCANFD_GAFLCFG_GETRNC (gpriv, n, x) \ - (((x) >> (reg_v3u(gpriv, 16, 24) - (n) * reg_v3u(gpriv, 16, 8))) & \ + (((x) >> (reg_v3u(gpriv, 16, 24) - ((n) & 1) * reg_v3u(gpriv, 16, 8))) & \ reg_v3u(gpriv, 0x1ff, 0xff))/* RSCFDnCFDGAFLECTR / RSCFDnGAFLECTR */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 190/885 selftests/bpf: Initialize tc in xdp_synproxy
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 354bb4a0e0b6be8f55bacbe7f08c94b4741f5658 ]
xdp_synproxy/xdp fails in CI with:
Error: bpf_tc_hook_create: File exists
The XDP version of the test should not be calling bpf_tc_hook_create(); the reason it's happening anyway is that if we don't specify --tc on the command line, tc variable remains uninitialized.
--- tools/testing/selftests/bpf/xdp_synproxy.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/xdp_synproxy.c +1 -0
@@ -116,6 +116,7 @@ static void parse_options(int argc, char *argv[], unsigned int *ifindex, __u32 * *tcpipopts =0 ; *ports =NULL ; *single = false; + *tc = false;while (true) {int opt;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 191/885 crypto: ccp - Flush the SEV-ES TMR memory before giving it to firmware
In reply to Greg Kroah-HartmanFrom: Tom Lendacky <[email protected]>
[ Upstream commit 46a334a98f585ef78d51d8f5736596887bdd7f54 ]
Perform a cache flush on the SEV-ES TMR memory after allocation to prevent any possibility of the firmware encountering an error should dirty cache lines be present. Use clflush_cache_range() to flush the SEV-ES TMR memory.
--- drivers/crypto/ccp/sev-dev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/crypto/ccp/sev-dev.c +5 -1
@@ -26,6 +26,7 @@#include <linux/fs_struct.h> #include <asm/smp.h> +#include <asm/cacheflush.h> #include "psp-dev.h" #include "sev-dev.h"
@@ -1334,7 +1335,10 @@ void sev_pci_init(void)/* Obtain the TMR memory area for SEV-ES use */ sev_es_tmr =sev_fw_alloc (SEV_ES_TMR_SIZE ); -if (!sev_es_tmr) +if (sev_es_tmr) +/* Must flush the cache before giving it to the firmware */ +clflush_cache_range (sev_es_tmr,SEV_ES_TMR_SIZE ); +else dev_warn (sev->dev,"SEV: TMR allocation failed, SEV-ES support unavailable\n" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 192/885 bpftool: profile online CPUs instead of possible
In reply to Greg Kroah-HartmanFrom: Tonghao Zhang <[email protected]>
[ Upstream commit 377c16fa3f3c60d21e4b05314c8be034ce37f2eb ]
The number of online cpu may be not equal to possible cpu. "bpftool prog profile" can not create pmu event on possible but on online cpu.
$ dmidecode -s system-product-name PowerEdge R620 $ cat /sys/devices/system/cpu/possible 0-47 $ cat /sys/devices/system/cpu/online 0-31
Disable cpu dynamically:
$ echo 0 > /sys/devices/system/cpu/cpuX/online
If one cpu is offline, perf_event_open will return ENODEV. To fix this issue:
* check value returned and skip offline cpu.
* close pmu_fd immediately on error path, avoid fd leaking.
--- tools/bpf/bpftool/prog.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-)
tools/bpf/bpftool/prog.c +30 -8
@@ -2166,10 +2166,38 @@ static void profile_close_perf_events(struct profiler_bpf *obj) profile_perf_event_cnt =0 ; } +static int profile_open_perf_event (int mid,int cpu,int map_fd) +{ +int pmu_fd; + + pmu_fd =syscall (__NR_perf_event_open, &metrics[mid].attr, +-1 /*pid*/ , cpu,-1 /*group_fd*/ ,0 ); +if (pmu_fd <0 ) { +if (errno ==ENODEV ) { +p_info ("cpu %d may be offline, skip %s profiling." , + cpu, metrics[mid].name); + profile_perf_event_cnt++; +return 0 ; + } +return -1 ; + } + +if (bpf_map_update_elem (map_fd, + &profile_perf_event_cnt, + &pmu_fd,BPF_ANY ) || +ioctl (pmu_fd,PERF_EVENT_IOC_ENABLE ,0 )) { +close (pmu_fd); +return -1 ; + } + + profile_perf_events[profile_perf_event_cnt++] = pmu_fd; +return 0 ; +} +static int profile_open_perf_events (struct profiler_bpf *obj) {unsigned int cpu, m; -int map_fd, pmu_fd; +int map_fd; profile_perf_events =calloc (sizeof (int ), obj->rodata->num_cpu * obj->rodata->num_metric);
@@ -2188,17 +2216,11 @@ static int profile_open_perf_events(struct profiler_bpf *obj)if (!metrics[m].selected)continue ;for (cpu =0 ; cpu < obj->rodata->num_cpu; cpu++) { - pmu_fd =syscall (__NR_perf_event_open, &metrics[m].attr, --1 /*pid*/ , cpu,-1 /*group_fd*/ ,0 ); -if (pmu_fd <0 || -bpf_map_update_elem (map_fd, &profile_perf_event_cnt, - &pmu_fd,BPF_ANY ) || -ioctl (pmu_fd,PERF_EVENT_IOC_ENABLE ,0 )) { +if (profile_open_perf_event (m, cpu, map_fd)) {p_err ("failed to create event %s on cpu %d" , metrics[m].name, cpu);return -1 ; } - profile_perf_events[profile_perf_event_cnt++] = pmu_fd; } }return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 193/885 wifi: mt76: mt7915: call mt7915_mcu_set_thermal_throttling() only after init_work
In reply to Greg Kroah-HartmanFrom: Howard Hsu <[email protected]>
[ Upstream commit 7d12b38ab6f6b77198cd3a66db19587bbdd3308c ]
Enable thermal management by default shall not be executed during mcu init. This causes thermal configuration being reset to the firmware default settings.
--- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 +-- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/init.c +1 -2
@@ -200,8 +200,7 @@ static int mt7915_thermal_init(struct mt7915_phy *phy) phy->throttle_temp[0 ] =110 ; phy->throttle_temp[1 ] =120 ; -return mt7915_mcu_set_thermal_throttling (phy, -MT7915_THERMAL_THROTTLE_MAX ); +return 0 ; } static void mt7915_led_set_config(struct led_classdev *led_cdev,
drivers/net/wireless/mediatek/mt76/mt7915/main.c +6 -0
@@ -57,6 +57,12 @@ static int mt7915_start(struct ieee80211_hw *hw)mt7915_mac_enable_nf (dev,1 ); } + ret =mt7915_mcu_set_thermal_throttling (phy, +MT7915_THERMAL_THROTTLE_MAX ); + +if (ret) + goto out; + ret =mt76_connac_mcu_set_rts_thresh (&dev->mt76,0x92b , phy != &dev->phy);if (ret)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 194/885 wifi: mt76: mt7915: fix memory leak in mt7915_mcu_exit
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 49bd78282e79ad177d14f37f4049f0605bf92dad ]
Always purge mcu skb queues in mt7915_mcu_exit routine even if mt7915_firmware_state fails.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +2 -1
@@ -2299,13 +2299,14 @@ void mt7915_mcu_exit(struct mt7915_dev *dev)__mt76_mcu_restart (&dev->mt76);if (mt7915_firmware_state (dev, false)) {dev_err (dev->mt76.dev,"Failed to exit mcu\n" ); -return ; + goto out; }mt76_wr (dev,MT_TOP_LPCR_HOST_BAND (0 ),MT_TOP_LPCR_HOST_FW_OWN );if (dev->hif2)mt76_wr (dev,MT_TOP_LPCR_HOST_BAND (1 ),MT_TOP_LPCR_HOST_FW_OWN ); +out:skb_queue_purge (&dev->mt76.mcu.res_q); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 195/885 wifi: mt76: mt7915: fix WED TxS reporting
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit 0d7084e209a9e2c924cb0d6e7f1f978db2a54127 ]
The previous commit forgot to remove a leftover check.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +0 -3
@@ -997,9 +997,6 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)u16 wcidx;u8 pid; -if (le32_get_bits (txs_data[0 ],MT_TXS0_TXS_FORMAT ) >1 ) -return ; - wcidx =le32_get_bits (txs_data[2 ],MT_TXS2_WCID ); pid =le32_get_bits (txs_data[3 ],MT_TXS3_PID );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 196/885 wifi: mt76: add memory barrier to SDIO queue kick
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit 5f54237ad798f41cb6a503271aa9ca47188cfb9b ]
Ensure the entry has been fully updated before SDIO bus worker access it. This patch would fix potential memory risk in both mt7663s and mt7921s.
--- drivers/net/wireless/mediatek/mt76/sdio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/mediatek/mt76/sdio.c +4 -0
@@ -562,6 +562,10 @@ mt76s_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q, q->entry[q->head].buf_sz = len; q->entry[q->head].skb = skb; + +/* ensure the entry fully updated before bus access */ +smp_wmb (); + q->head = (q->head +1 ) % q->ndesc; q->queued++;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 197/885 wifi: mt76: mt7921: fix error code of return in mt7921_acpi_read
In reply to Greg Kroah-HartmanFrom: Aaron Ma <[email protected]>
[ Upstream commit 888d89034f9eaeab9b5b75f13dbe35376c7dd471 ]
Kernel NULL pointer dereference when ACPI SAR table isn't implemented well. Fix the error code of return to mark the ACPI SAR table as invalid.
[ 5.077128] mt7921e 0000:06:00.0: sar cnt = 0 [ 5.077381] BUG: kernel NULL pointer dereference, address: 0000000000000004 [ 5.077630] #PF: supervisor read access in kernel mode [ 5.077883] #PF: error_code(0x0000) - not-present page [ 5.078138] PGD 0 P4D 0 [ 5.078398] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 5.079202] RIP: 0010:mt7921_init_acpi_sar+0x106/0x220 [mt7921_common] ... [ 5.080786] Call Trace: [ 5.080786] <TASK> [ 5.080786] mt7921_register_device+0x37d/0x490 [mt7921_common] [ 5.080786] mt7921_pci_probe.part.0+0x2ee/0x310 [mt7921e] [ 5.080786] mt7921_pci_probe+0x52/0x70 [mt7921e] [ 5.080786] local_pci_probe+0x47/0x90 [ 5.080786] pci_call_probe+0x55/0x190 [ 5.080786] pci_device_probe+0x84/0x120
--- drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c +5 -2
@@ -33,14 +33,17 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len) sar_root->package.elements[0].type != ACPI_TYPE_INTEGER) {dev_err (mdev->dev,"sar cnt = %d\n" , sar_root->package.count); + ret = -EINVAL ; goto free; }if (!*tbl) { *tbl =devm_kzalloc (mdev->dev, sar_root->package.count,GFP_KERNEL ); -if (!*tbl) +if (!*tbl) { + ret = -ENOMEM ; goto free; + } }if (len) *len = sar_root->package.count;
@@ -52,9 +55,9 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len)break ; *(*tbl + i) = (u8 )sar_unit->integer.value; } -free: ret = (i == sar_root->package.count) ?0 : -EINVAL ; +free:kfree (sar_root);return ret;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 198/885 net/mlx5: Enhance debug print in page allocation failure
In reply to Greg Kroah-HartmanFrom: Jack Morgenstein <[email protected]>
[ Upstream commit 7eef93003e5d20e1a6a6e59e12d914b5431cbda2 ]
Provide more details to aid debugging.
--- drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +2 -1
@@ -219,7 +219,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr, u32 function) n =find_first_bit (&fp->bitmask,8 *sizeof (fp->bitmask));if (n >=MLX5_NUM_4K_IN_PAGE ) { -mlx5_core_warn (dev,"alloc 4k bug\n" ); +mlx5_core_warn (dev,"alloc 4k bug: fw page = 0x%llx, n = %u, bitmask: %lu, max num of 4K pages: %d\n" , + fp->addr, n, fp->bitmask,MLX5_NUM_4K_IN_PAGE );return -ENOENT ; }clear_bit (n, &fp->bitmask);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 199/885 irqchip: Fix refcount leak in platform_irqchip_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6caa5a2b78f5f53c433d3a3781e53325da22f0ac ]
of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/irqchip/irqchip.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/irqchip/irqchip.c +6 -2
@@ -38,8 +38,10 @@ int platform_irqchip_probe(struct platform_device *pdev)struct device_node *par_np =of_irq_find_parent (np);of_irq_init_cb_t irq_init_cb =of_device_get_match_data (&pdev->dev); -if (!irq_init_cb) +if (!irq_init_cb) { +of_node_put (par_np);return -EINVAL ; + }if (par_np == np) par_np =NULL ;
@@ -52,8 +54,10 @@ int platform_irqchip_probe(struct platform_device *pdev)* interrupt controller. The actual initialization callback of this * interrupt controller can check for specific domains as necessary. */ -if (par_np && !irq_find_matching_host (par_np,DOMAIN_BUS_ANY )) +if (par_np && !irq_find_matching_host (par_np,DOMAIN_BUS_ANY )) { +of_node_put (par_np);return -EPROBE_DEFER ; + }return irq_init_cb (np, par_np); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 200/885 irqchip/alpine-msi: Fix refcount leak in alpine_msix_init_domains
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 071d068b89e95d1b078aa6bbcb9d0961b77d6aa1 ]
of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/irqchip/irq-alpine-msi.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-alpine-msi.c +1 -0
@@ -199,6 +199,7 @@ static int alpine_msix_init_domains(struct alpine_msix_data *priv, } gic_domain =irq_find_host (gic_node); +of_node_put (gic_node);if (!gic_domain) {pr_err ("Failed to find the GIC domain\n" );return -ENXIO ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 201/885 irqchip/irq-mvebu-gicp: Fix refcount leak in mvebu_gicp_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9419e700021a393f67be36abd0c4f3acc6139041 ]
of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/irqchip/irq-mvebu-gicp.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-mvebu-gicp.c +1 -0
@@ -221,6 +221,7 @@ static int mvebu_gicp_probe(struct platform_device *pdev) } parent_domain =irq_find_host (irq_parent_dn); +of_node_put (irq_parent_dn);if (!parent_domain) {dev_err (&pdev->dev,"failed to find parent IRQ domain\n" );return -ENODEV ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 202/885 irqchip/ti-sci: Fix refcount leak in ti_sci_intr_irq_domain_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 02298b7bae12936ca313975b02e7f98b06670d37 ]
of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/irqchip/irq-ti-sci-intr.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-ti-sci-intr.c +1 -0
@@ -236,6 +236,7 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev) } parent_domain =irq_find_host (parent_node); +of_node_put (parent_node);if (!parent_domain) {dev_err (dev,"Failed to find IRQ parent domain\n" );return -ENODEV ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 203/885 s390/mem_detect: fix detect_memory() error handling
In reply to Greg Kroah-HartmanFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 3400c35a4090704e6c465449616ab7e67a9209e7 ]
Currently if for some reason sclp_early_read_info() fails, sclp_early_get_memsize() will not set max_physmem_end and it will stay uninitialized. Any garbage value other than 0 will lead to detect_memory() taking wrong path or returning a garbage value as max_physmem_end. To avoid that simply initialize max_physmem_end.
--- arch/s390/boot/mem_detect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/boot/mem_detect.c +1 -1
@@ -165,7 +165,7 @@ static void search_mem_end(void)unsigned long detect_memory (void ) { -unsigned long max_physmem_end; +unsigned long max_physmem_end =0 ;sclp_early_get_memsize (&max_physmem_end);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 204/885 s390/vmem: fix empty page tables cleanup under KASAN
In reply to Greg Kroah-HartmanFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 108303b0a2d27cb14eed565e33e64ad9eefe5d7e ]
Commit b9ff81003cf1 ("s390/vmem: cleanup empty page tables") introduced empty page tables cleanup in vmem code, but when the kernel is built with KASAN enabled the code has no effect due to wrong KASAN shadow memory intersection condition, which effectively ignores any memory range below KASAN shadow. Fix intersection condition to make code work as anticipated.
--- arch/s390/mm/vmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/s390/mm/vmem.c +3 -3
@@ -297,7 +297,7 @@ static void try_free_pmd_table(pud_t *pud, unsigned long start)if (end >VMALLOC_START )return ;#ifdef CONFIG_KASAN -if (start <KASAN_SHADOW_END &&KASAN_SHADOW_START > end) +if (start <KASAN_SHADOW_END && end >KASAN_SHADOW_START )return ;#endif pmd =pmd_offset (pud, start);
@@ -372,7 +372,7 @@ static void try_free_pud_table(p4d_t *p4d, unsigned long start)if (end >VMALLOC_START )return ;#ifdef CONFIG_KASAN -if (start <KASAN_SHADOW_END &&KASAN_SHADOW_START > end) +if (start <KASAN_SHADOW_END && end >KASAN_SHADOW_START )return ;#endif
@@ -426,7 +426,7 @@ static void try_free_p4d_table(pgd_t *pgd, unsigned long start)if (end >VMALLOC_START )return ;#ifdef CONFIG_KASAN -if (start <KASAN_SHADOW_END &&KASAN_SHADOW_START > end) +if (start <KASAN_SHADOW_END && end >KASAN_SHADOW_START )return ;#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 205/885 s390/boot: cleanup decompressor header files
In reply to Greg Kroah-HartmanFrom: Alexander Gordeev <[email protected]>
[ Upstream commit 9c3205b2b062420c26b33924b910880889acf832 ]
Move declarations to appropriate header files. Instead of cryptic casting directly assign struct vmlinux_info type to _vmlinux_info linker script variable - wich it actually is.
Stable-dep-of: 22476f47b6b7 ("s390/boot: fix mem_detect extended area allocation")
--- arch/s390/boot/boot.h | 24 ++++++++++++++++++++++-- arch/s390/boot/decompressor.c | 1 + arch/s390/boot/decompressor.h | 26 -------------------------- 3 files changed, 23 insertions(+), 28 deletions(-)
arch/s390/boot/boot.h +22 -2
@@ -8,10 +8,26 @@#ifndef __ASSEMBLY__ +struct vmlinux_info { +unsigned long default_lma; +void (*entry)(void ); +unsigned long image_size;/* does not include .bss */ +unsigned long bss_size;/* uncompressed image .bss size */ +unsigned long bootdata_off; +unsigned long bootdata_size; +unsigned long bootdata_preserved_off; +unsigned long bootdata_preserved_size; +unsigned long dynsym_start; +unsigned long rela_dyn_start; +unsigned long rela_dyn_end; +unsigned long amode31_size; +}; +void startup_kernel (void );unsigned long detect_memory (void );bool is_ipl_block_dump (void );void store_ipl_parmblock (void ); +unsigned long read_ipl_report (unsigned long safe_offset);void setup_boot_command_line (void );void parse_boot_command_line (void );void verify_facilities (void );
@@ -20,6 +36,7 @@ void sclp_early_setup_buffer(void);void print_pgm_check_info (void );unsigned long get_random_base (unsigned long safe_addr); void __printf(1, 2) decompressor_printk(const char *fmt, ...); +void error(char *m); /* Symbols defined by linker scripts */ extern const char kernel_version[];
@@ -31,8 +48,11 @@ extern char __boot_data_start[], __boot_data_end[];extern char __boot_data_preserved_start[], __boot_data_preserved_end[];extern char _decompressor_syms_start[], _decompressor_syms_end[];extern char _stack_start[], _stack_end[]; - -unsigned long read_ipl_report (unsigned long safe_offset); +extern char _end[]; +extern unsigned char _compressed_start[]; +extern unsigned char _compressed_end[]; +extern struct vmlinux_info _vmlinux_info; +#define vmlinux _vmlinux_info#endif /* __ASSEMBLY__ */ #endif /* BOOT_BOOT_H */
arch/s390/boot/decompressor.c +1 -0
@@ -11,6 +11,7 @@#include <linux/string.h> #include <asm/page.h> #include "decompressor.h" +#include "boot.h" /* * gzip declarations
arch/s390/boot/decompressor.h +0 -26
@@ -2,37 +2,11 @@#ifndef BOOT_COMPRESSED_DECOMPRESSOR_H #define BOOT_COMPRESSED_DECOMPRESSOR_H -#include <linux/stddef.h> -#ifdef CONFIG_KERNEL_UNCOMPRESSED static inline void *decompress_kernel (void ) {return NULL ; }#else void *decompress_kernel (void );#endif unsigned long mem_safe_offset (void ); -void error (char *m); - -struct vmlinux_info { -unsigned long default_lma; -void (*entry)(void ); -unsigned long image_size;/* does not include .bss */ -unsigned long bss_size;/* uncompressed image .bss size */ -unsigned long bootdata_off; -unsigned long bootdata_size; -unsigned long bootdata_preserved_off; -unsigned long bootdata_preserved_size; -unsigned long dynsym_start; -unsigned long rela_dyn_start; -unsigned long rela_dyn_end; -unsigned long amode31_size; -}; - -/* Symbols defined by linker scripts */ -extern char _end[]; -extern unsigned char _compressed_start[]; -extern unsigned char _compressed_end[]; -extern char _vmlinux_info[]; - -#define vmlinux (*(struct vmlinux_info *)_vmlinux_info)#endif /* BOOT_COMPRESSED_DECOMPRESSOR_H */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 206/885 s390/mem_detect: rely on diag260() if sclp_early_get_memsize() fails
In reply to Greg Kroah-HartmanFrom: Vasily Gorbik <[email protected]>
[ Upstream commit eb33f9eb304a4c18beb5ba6362eaa5c4beaf40d8 ]
In case sclp_early_get_memsize() fails but diag260() succeeds make sure some sane value is returned. This error scenario is highly unlikely, but this change makes system able to boot in such case.
Stable-dep-of: 22476f47b6b7 ("s390/boot: fix mem_detect extended area allocation")
--- arch/s390/boot/mem_detect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/boot/mem_detect.c +1 -1
@@ -176,7 +176,7 @@ unsigned long detect_memory(void)if (!diag260 ()) { mem_detect.info_source =MEM_DETECT_DIAG260 ; -return max_physmem_end; +return max_physmem_end ?:get_mem_detect_end (); }if (max_physmem_end) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 207/885 s390/boot: fix mem_detect extended area allocation
In reply to Greg Kroah-HartmanFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 22476f47b6b7fb7d066c71f67ebc11892adb0849 ]
Allocation of mem_detect extended area was not considered neither in commit 9641b8cc733f ("s390/ipl: read IPL report at early boot") nor in commit b2d24b97b2a9 ("s390/kernel: add support for kernel address space layout randomization (KASLR)"). As a result mem_detect extended theoretically may overlap with ipl report or randomized kernel image position. But as mem_detect code will allocate extended area only upon exceeding 255 online regions (which should alternate with offline memory regions) it is not seen in practice.
To make sure mem_detect extended area does not overlap with ipl report or randomized kernel position extend usage of "safe_addr". Make initrd handling and mem_detect extended area allocation code move it further right and make KASLR takes in into consideration as well.
--- arch/s390/boot/boot.h | 4 +-- arch/s390/boot/kaslr.c | 6 ----- arch/s390/boot/mem_detect.c | 52 ++++++++++++------------------------- arch/s390/boot/startup.c | 21 ++++++++------- 4 files changed, 31 insertions(+), 52 deletions(-)
arch/s390/boot/boot.h +2 -2
@@ -24,10 +24,10 @@ struct vmlinux_info { };void startup_kernel (void ); -unsigned long detect_memory (void ); +unsigned long detect_memory (unsigned long *safe_addr);bool is_ipl_block_dump (void );void store_ipl_parmblock (void ); -unsigned long read_ipl_report (unsigned long safe_offset); +unsigned long read_ipl_report (unsigned long safe_addr);void setup_boot_command_line (void );void parse_boot_command_line (void );void verify_facilities (void );
arch/s390/boot/kaslr.c +0 -6
@@ -174,7 +174,6 @@ unsigned long get_random_base(unsigned long safe_addr) {unsigned long memory_limit =get_mem_detect_end ();unsigned long base_pos, max_pos, kernel_size; -unsigned long kasan_needs;int i; memory_limit =min (memory_limit, ident_map_size);
@@ -186,12 +185,7 @@ unsigned long get_random_base(unsigned long safe_addr)*/ memory_limit -=kasan_estimate_memory_needs (memory_limit); -if (IS_ENABLED (CONFIG_BLK_DEV_INITRD ) && initrd_data.start && initrd_data.size) { -if (safe_addr < initrd_data.start + initrd_data.size) - safe_addr = initrd_data.start + initrd_data.size; - } safe_addr =ALIGN (safe_addr,THREAD_SIZE ); - kernel_size = vmlinux.image_size + vmlinux.bss_size;if (safe_addr + kernel_size > memory_limit)return 0 ;
arch/s390/boot/mem_detect.c +17 -35
86 lines not on this page · raw message
arch/s390/boot/startup.c +12 -9
@@ -57,16 +57,17 @@ unsigned long mem_safe_offset(void) }#endif -static void rescue_initrd (unsigned long addr) +static unsigned long rescue_initrd (unsigned long safe_addr) {if (!IS_ENABLED (CONFIG_BLK_DEV_INITRD )) -return ; +return safe_addr;if (!initrd_data.start || !initrd_data.size) -return ; -if (addr <= initrd_data.start) -return ; -memmove ((void *)addr, (void *)initrd_data.start, initrd_data.size); - initrd_data.start = addr; +return safe_addr; +if (initrd_data.start < safe_addr) { +memmove ((void *)safe_addr, (void *)initrd_data.start, initrd_data.size); + initrd_data.start = safe_addr; + } +return initrd_data.start + initrd_data.size; }static void copy_bootdata (void )
@@ -250,6 +251,7 @@ static unsigned long reserve_amode31(unsigned long safe_addr)void startup_kernel (void ) { +unsigned long max_physmem_end;unsigned long random_lma;unsigned long safe_addr;void *img;
@@ -265,12 +267,13 @@ void startup_kernel(void) safe_addr =reserve_amode31 (safe_addr); safe_addr =read_ipl_report (safe_addr);uv_query_info (); -rescue_initrd (safe_addr); + safe_addr =rescue_initrd (safe_addr);sclp_early_read_info ();setup_boot_command_line ();parse_boot_command_line ();sanitize_prot_virt_host (); -setup_ident_map_size (detect_memory ()); + max_physmem_end =detect_memory (&safe_addr); +setup_ident_map_size (max_physmem_end);setup_vmalloc_size ();setup_kernel_memory_layout ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 208/885 net: add sock_init_data_uid()
In reply to Greg Kroah-HartmanFrom: Pietro Borrello <[email protected]>
[ Upstream commit 584f3742890e966d2f0a1f3c418c9ead70b2d99e ]
Add sock_init_data_uid() to explicitly initialize the socket uid. To initialise the socket uid, sock_init_data() assumes a the struct socket* sock is always embedded in a struct socket_alloc, used to access the corresponding inode uid. This may not be true. Examples are sockets created in tun_chr_open() and tap_open().
--- include/net/sock.h | 7 ++++++- net/core/sock.c | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-)
include/net/sock.h +6 -1
@@ -1952,7 +1952,12 @@ void sk_common_release(struct sock *sk);* Default socket callbacks and setup code */ -/* Initialise core socket variables */ +/* Initialise core socket variables using an explicit uid. */ +void sock_init_data_uid (struct socket *sock,struct sock *sk,kuid_t uid); + +/* Initialise core socket variables. +* Assumes struct socket *sock is embedded in a struct socket_alloc. +*/ void sock_init_data (struct socket *sock,struct sock *sk);/*
net/core/sock.c +12 -3
@@ -3359,7 +3359,7 @@ void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer) }EXPORT_SYMBOL (sk_stop_timer_sync); -void sock_init_data (struct socket *sock,struct sock *sk) +void sock_init_data_uid (struct socket *sock,struct sock *sk,kuid_t uid) {sk_init_common (sk); sk->sk_send_head =NULL ;
@@ -3378,11 +3378,10 @@ void sock_init_data(struct socket *sock, struct sock *sk) sk->sk_type = sock->type;RCU_INIT_POINTER (sk->sk_wq, &sock->wq); sock->sk = sk; - sk->sk_uid =SOCK_INODE (sock)->i_uid; }else {RCU_INIT_POINTER (sk->sk_wq,NULL ); - sk->sk_uid =make_kuid (sock_net (sk)->user_ns,0 ); } + sk->sk_uid = uid;rwlock_init (&sk->sk_callback_lock);if (sk->sk_kern_sock)
@@ -3440,6 +3439,16 @@ void sock_init_data(struct socket *sock, struct sock *sk)refcount_set (&sk->sk_refcnt,1 );atomic_set (&sk->sk_drops,0 ); } +EXPORT_SYMBOL (sock_init_data_uid); + +void sock_init_data (struct socket *sock,struct sock *sk) +{ +kuid_t uid = sock ? +SOCK_INODE (sock)->i_uid : +make_kuid (sock_net (sk)->user_ns,0 ); + +sock_init_data_uid (sock, sk, uid); +}EXPORT_SYMBOL (sock_init_data);void lock_sock_nested (struct sock *sk,int subclass)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 209/885 tun: tun_chr_open(): correctly initialize socket uid
In reply to Greg Kroah-HartmanFrom: Pietro Borrello <[email protected]>
[ Upstream commit a096ccca6e503a5c575717ff8a36ace27510ab0a ]
sock_init_data() assumes that the struct socket passed in input is contained in a struct socket_alloc allocated with sock_alloc(). However, tun_chr_open() passes a struct socket embedded in a struct tun_file allocated with sk_alloc().
This causes a type confusion when issuing a container_of() with SOCK_INODE() in sock_init_data() which results in assigning a wrong sk_uid to the struct sock in input.
On default configuration, the type confused field overlaps with the high 4 bytes of struct tun_struct __rcu *tun of struct tun_file, NULL at the time of call, which makes the uid of all tun sockets 0, i.e., the root one.
Fix the assignment by using sock_init_data_uid().
--- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/tun.c +1 -1
@@ -3449,7 +3449,7 @@ static int tun_chr_open(struct inode *inode, struct file * file) tfile->socket.file = file; tfile->socket.ops = &tun_socket_ops; -sock_init_data (&tfile->socket, &tfile->sk); +sock_init_data_uid (&tfile->socket, &tfile->sk, inode->i_uid); tfile->sk.sk_write_space = tun_sock_write_space; tfile->sk.sk_sndbuf =INT_MAX ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 210/885 tap: tap_open(): correctly initialize socket uid
In reply to Greg Kroah-HartmanFrom: Pietro Borrello <[email protected]>
[ Upstream commit 66b2c338adce580dfce2199591e65e2bab889cff ]
sock_init_data() assumes that the struct socket passed in input is contained in a struct socket_alloc allocated with sock_alloc(). However, tap_open() passes a struct socket embedded in a struct tap_queue allocated with sk_alloc().
This causes a type confusion when issuing a container_of() with SOCK_INODE() in sock_init_data() which results in assigning a wrong sk_uid to the struct sock in input.
On default configuration, the type confused field overlaps with padding bytes between int vnet_hdr_sz and struct tap_dev __rcu *tap in struct tap_queue, which makes the uid of all tap sockets 0, i.e., the root one.
Fix the assignment by using sock_init_data_uid().
--- drivers/net/tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/tap.c +1 -1
@@ -533,7 +533,7 @@ static int tap_open(struct inode *inode, struct file *file) q->sock.state =SS_CONNECTED ; q->sock.file = file; q->sock.ops = &tap_socket_ops; -sock_init_data (&q->sock, &q->sk); +sock_init_data_uid (&q->sock, &q->sk, inode->i_uid); q->sk.sk_write_space = tap_sock_write_space; q->sk.sk_destruct = tap_sock_destruct; q->flags =IFF_VNET_HDR |IFF_NO_PI |IFF_TAP ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 211/885 OPP: fix error checking in opp_migrate_dentry()
In reply to Greg Kroah-HartmanFrom: Qi Zheng <[email protected]>
[ Upstream commit eca4c0eea53432ec4b711b2a8ad282cbad231b4f ]
Since commit ff9fb72bc077 ("debugfs: return error values, not NULL") changed return value of debugfs_rename() in error cases from %NULL to %ERR_PTR(-ERROR), we should also check error values instead of NULL.
--- drivers/opp/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/debugfs.c +1 -1
@@ -235,7 +235,7 @@ static void opp_migrate_dentry(struct opp_device *opp_dev, dentry =debugfs_rename (rootdir, opp_dev->dentry, rootdir, opp_table->dentry_name); -if (!dentry) { +if (IS_ERR (dentry)) {dev_err (dev,"%s: Failed to rename link from: %s to %s\n" , __func__,dev_name (opp_dev->dev),dev_name (dev));return ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 212/885 cpufreq: davinci: Fix clk use after free
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 5d8f384a9b4fc50f6a18405f1c08e5a87a77b5b3 ]
The remove function first frees the clks and only then calls cpufreq_unregister_driver(). If one of the cpufreq callbacks is called just before cpufreq_unregister_driver() is run, the freed clks might be used.
--- drivers/cpufreq/davinci-cpufreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/cpufreq/davinci-cpufreq.c +3 -1
@@ -133,12 +133,14 @@ static int __init davinci_cpufreq_probe(struct platform_device *pdev) static int __exit davinci_cpufreq_remove(struct platform_device *pdev) { +cpufreq_unregister_driver (&davinci_driver); +clk_put (cpufreq.armclk);if (cpufreq.asyncclk)clk_put (cpufreq.asyncclk); -return cpufreq_unregister_driver (&davinci_driver); +return 0 ; }static struct platform_driver davinci_cpufreq_driver = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 213/885 Bluetooth: hci_conn: Refactor hci_bind_bis() since it always succeeds
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit a00a29b0eeea6caaaf9edc3dd284f81b072ee343 ]
The compiler thinks "conn" might be NULL after a call to hci_bind_bis(), which cannot happen. Avoid any confusion by just making it not return a value since it cannot fail. Fixes the warnings seen with GCC 13:
In function 'arch_atomic_dec_and_test',
inlined from 'atomic_dec_and_test' at ../include/linux/atomic/atomic-instrumented.h:576:9,
inlined from 'hci_conn_drop' at ../include/net/bluetooth/hci_core.h:1391:6,
inlined from 'hci_connect_bis' at ../net/bluetooth/hci_conn.c:2124:3:
../arch/x86/include/asm/rmwcc.h:37:9: warning: array subscript 0 is outside array bounds of 'atomic_t[0]' [-Warray-bounds=]
37 | asm volatile (fullop CC_SET(cc) \
| ^~~...
In function 'hci_connect_bis':
cc1: note: source object is likely at address zero
--- net/bluetooth/hci_conn.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
net/bluetooth/hci_conn.c +3 -9
@@ -1983,16 +1983,14 @@ static void hci_iso_qos_setup(struct hci_dev *hdev, struct hci_conn *conn, qos->latency = conn->le_conn_latency; } -static struct hci_conn *hci_bind_bis (struct hci_conn *conn, -struct bt_iso_qos *qos) +static void hci_bind_bis (struct hci_conn *conn, +struct bt_iso_qos *qos) {/* Update LINK PHYs according to QoS preference */ conn->le_tx_phy = qos->out.phy; conn->le_tx_phy = qos->out.phy; conn->iso_qos = *qos; conn->state =BT_BOUND ; - -return conn; }static int create_big_sync (struct hci_dev *hdev,void *data)
@@ -2128,11 +2126,7 @@ struct hci_conn *hci_connect_bis(struct hci_dev *hdev, bdaddr_t *dst,if (IS_ERR (conn))return conn; - conn =hci_bind_bis (conn, qos); -if (!conn) { -hci_conn_drop (conn); -return ERR_PTR (-ENOMEM ); - } +hci_bind_bis (conn, qos);/* Add Basic Announcement into Peridic Adv Data if BASE is set */ if (base_len && base) {
Signature · 1 line
2.39.2
RE: [6.1,213/885] Bluetooth: hci_conn: Refactor hci_bind_bis() since it always succeeds
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: net/bluetooth/hci_conn.c:1983
error: net/bluetooth/hci_conn.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
Greg Kroah-Hartman
maintainerPATCH 214/885 Bluetooth: L2CAP: Fix potential user-after-free
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit df5703348813235874d851934e957c3723d71644 ]
This fixes all instances of which requires to allocate a buffer calling alloc_skb which may release the chan lock and reacquire later which makes it possible that the chan is disconnected in the meantime.
--- net/bluetooth/l2cap_core.c | 24 ------------------------ net/bluetooth/l2cap_sock.c | 8 ++++++++ 2 files changed, 8 insertions(+), 24 deletions(-)
net/bluetooth/l2cap_core.c +0 -24
@@ -2683,14 +2683,6 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)if (IS_ERR (skb))return PTR_ERR (skb); -/* Channel lock is released before requesting new skb and then -* reacquired thus we need to recheck channel state. -*/ -if (chan->state !=BT_CONNECTED ) { -kfree_skb (skb); -return -ENOTCONN ; - } -l2cap_do_send (chan, skb);return len; }
@@ -2735,14 +2727,6 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)if (IS_ERR (skb))return PTR_ERR (skb); -/* Channel lock is released before requesting new skb and then -* reacquired thus we need to recheck channel state. -*/ -if (chan->state !=BT_CONNECTED ) { -kfree_skb (skb); -return -ENOTCONN ; - } -l2cap_do_send (chan, skb); err = len;break ;
@@ -2763,14 +2747,6 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)*/ err =l2cap_segment_sdu (chan, &seg_queue, msg, len); -/* The channel could have been closed while segmenting, -* check that it is still connected. -*/ -if (chan->state !=BT_CONNECTED ) { -__skb_queue_purge (&seg_queue); - err = -ENOTCONN ; - } -if (err)break ;
net/bluetooth/l2cap_sock.c +8 -0
@@ -1624,6 +1624,14 @@ static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan,if (!skb)return ERR_PTR (err); +/* Channel lock is released before requesting new skb and then +* reacquired thus we need to recheck channel state. +*/ +if (chan->state !=BT_CONNECTED ) { +kfree_skb (skb); +return ERR_PTR (-ENOTCONN ); + } + skb->priority = sk->sk_priority;bt_cb (skb)->l2cap.chan = chan;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 215/885 Bluetooth: hci_qca: get wakeup status from serdev device handle
In reply to Greg Kroah-HartmanFrom: Zhengping Jiang <[email protected]>
[ Upstream commit 03b0093f7b310493bc944a20f725228cfe0d3fea ]
Bluetooth controller attached via the UART is handled by the serdev driver. Get the wakeup status from the device handle through serdev, instead of the parent path.
--- drivers/bluetooth/hci_qca.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_qca.c +4 -3
@@ -1582,10 +1582,11 @@ static bool qca_wakeup(struct hci_dev *hdev)struct hci_uart *hu =hci_get_drvdata (hdev);bool wakeup; -/* UART driver handles the interrupt from BT SoC.So we need to use -* device handle of UART driver to get the status of device may wakeup. +/* BT SoC attached through the serial bus is handled by the serdev driver. +* So we need to use the device handle of the serdev driver to get the +* status of device may wakeup. */ - wakeup =device_may_wakeup (hu->serdev->ctrl->dev.parent); + wakeup =device_may_wakeup (&hu->serdev->ctrl->dev);bt_dev_dbg (hu->hdev,"wakeup status : %d" , wakeup);return wakeup;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 216/885 net: ipa: generic command param fix
In reply to Greg Kroah-HartmanFrom: Alex Elder <[email protected]>
[ Upstream commit 2df181f09c961377a55510a864216d48d787fe49 ]
Starting at IPA v4.11, the GSI_GENERIC_COMMAND GSI register got a new PARAMS field. The code that encodes a value into that field sets it unconditionally, which is wrong.
We currently only provide 0 as the field's value, so this error has no real effect. Still, it's a bug, so let's fix it.
Fix an (unrelated) incorrect comment as well. Fields in the ERROR_LOG GSI register actually *are* defined for IPA versions prior to v3.5.1.
--- drivers/net/ipa/gsi.c | 3 ++- drivers/net/ipa/gsi_reg.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ipa/gsi.c +2 -1
@@ -1666,7 +1666,8 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id, val =u32_encode_bits (opcode,GENERIC_OPCODE_FMASK ); val |=u32_encode_bits (channel_id,GENERIC_CHID_FMASK ); val |=u32_encode_bits (GSI_EE_MODEM ,GENERIC_EE_FMASK ); - val |=u32_encode_bits (params,GENERIC_PARAMS_FMASK ); +if (gsi->version >=IPA_VERSION_4_11 ) + val |=u32_encode_bits (params,GENERIC_PARAMS_FMASK ); timeout = !gsi_command (gsi,GSI_GENERIC_CMD_OFFSET , val);
drivers/net/ipa/gsi_reg.h +0 -1
@@ -372,7 +372,6 @@ enum gsi_general_id {#define GSI_ERROR_LOG_OFFSET \ (0x0001f200 + 0x4000 * GSI_EE_AP) -/* Fields below are present for IPA v3.5.1 and above */ #define ERR_ARG3_FMASK GENMASK(3, 0)#define ERR_ARG2_FMASK GENMASK(7, 4)#define ERR_ARG1_FMASK GENMASK(11, 8)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 217/885 s390: vfio-ap: tighten the NIB validity check
In reply to Greg Kroah-HartmanFrom: Halil Pasic <[email protected]>
[ Upstream commit a64a6d23874c574d30a9816124b2dc37467f3811 ]
The NIB is architecturally invalid if the address designates a storage location that is not installed or if it is zero.
--- drivers/s390/crypto/vfio_ap_ops.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/s390/crypto/vfio_ap_ops.c +2 -0
@@ -349,6 +349,8 @@ static int vfio_ap_validate_nib(struct kvm_vcpu *vcpu, dma_addr_t *nib) { *nib = vcpu->run->s.regs.gprs[2 ]; +if (!*nib) +return -EINVAL ;if (kvm_is_error_hva (gfn_to_hva (vcpu->kvm, *nib >>PAGE_SHIFT )))return -EINVAL ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 218/885 s390/ap: fix status returned by ap_aqic()
In reply to Greg Kroah-HartmanFrom: Halil Pasic <[email protected]>
[ Upstream commit 394740d7645ea767795074287769dd26dbd4d782 ]
There function ap_aqic() tries to grab the status from the wrong part of the register. Thus we always end up with zeros. Which is wrong, among others, because we detect failures via status.response_code.
--- arch/s390/include/asm/ap.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/s390/include/asm/ap.h +5 -2
@@ -239,7 +239,10 @@ static inline struct ap_queue_status ap_aqic(ap_qid_t qid,union {unsigned long value;struct ap_qirq_ctrl qirqctrl; -struct ap_queue_status status; +struct { +u32 _pad; +struct ap_queue_status status; + }; } reg1;unsigned long reg2 = pa_ind;
@@ -253,7 +256,7 @@ static inline struct ap_queue_status ap_aqic(ap_qid_t qid," lgr %[reg1],1\n" /* gr1 (status) into reg1 */ : [reg1] "+&d" (reg1) : [reg0] "d" (reg0), [reg2] "d" (reg2) - : "cc", "0", "1", "2"); + : "cc", "memory", "0", "1", "2");return reg1.status; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 219/885 s390/ap: fix status returned by ap_qact()
In reply to Greg Kroah-HartmanFrom: Halil Pasic <[email protected]>
[ Upstream commit a2522c80f074c35254974fec39fffe8b8d75befe ]
Since commit 159491f3b509 ("s390/ap: rework assembler functions to use unions for in/out register variables") the function ap_qact() tries to grab the status from the wrong part of the register. Thus we always end up with zeros. Which is wrong, among others, because we detect failures via status.response_code.
--- arch/s390/include/asm/ap.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/s390/include/asm/ap.h +4 -1
@@ -293,7 +293,10 @@ static inline struct ap_queue_status ap_qact(ap_qid_t qid, int ifbit,unsigned long reg0 = qid | (5UL <<24 ) | ((ifbit &0x01 ) <<22 );union {unsigned long value; -struct ap_queue_status status; +struct { +u32 _pad; +struct ap_queue_status status; + }; } reg1;unsigned long reg2;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 220/885 libbpf: Fix alen calculation in libbpf_nla_dump_errormsg()
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 17bcd27a08a21397698edf143084d7c87ce17946 ]
The code assumes that everything that comes after nlmsgerr are nlattrs. When calculating their size, it does not account for the initial nlmsghdr. This may lead to accessing uninitialized memory.
--- tools/lib/bpf/nlattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/nlattr.c +1 -1
@@ -178,7 +178,7 @@ int libbpf_nla_dump_errormsg(struct nlmsghdr *nlh) hlen +=nlmsg_len (&err->msg); attr = (struct nlattr *) ((void *) err + hlen); - alen = nlh->nlmsg_len - hlen; + alen = (void *)nlh + nlh->nlmsg_len - (void *)attr;if (libbpf_nla_parse (tb,NLMSGERR_ATTR_MAX , attr, alen, extack_policy) !=0 ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 221/885 xen/grant-dma-iommu: Implement a dummy probe_device() callback
In reply to Greg Kroah-HartmanFrom: Oleksandr Tyshchenko <[email protected]>
[ Upstream commit 2062f9fb6445451b189595e295765c69f43bc12e ]
Update stub IOMMU driver (which main purpose is to reuse generic IOMMU device-tree bindings by Xen grant DMA-mapping layer on Arm) according to the recent changes done in the following
commit 57365a04c921 ("iommu: Move bus setup to IOMMU device registration").
With probe_device() callback being called during IOMMU device registration, the uninitialized callback just leads to the "kernel NULL pointer dereference" issue during boot. Fix that by adding a dummy callback.
Looks like the release_device() callback is not mandatory to be implemented as IOMMU framework makes sure that callback is initialized before dereferencing.
--- drivers/xen/grant-dma-iommu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/xen/grant-dma-iommu.c +9 -2
@@ -16,8 +16,15 @@ struct grant_dma_iommu_device {struct iommu_device iommu; }; -/* Nothing is really needed here */ -static const struct iommu_ops grant_dma_iommu_ops; +static struct iommu_device *grant_dma_iommu_probe_device (struct device *dev) +{ +return ERR_PTR (-ENODEV ); +} + +/* Nothing is really needed here except a dummy probe_device callback */ +static const struct iommu_ops grant_dma_iommu_ops = { + .probe_device = grant_dma_iommu_probe_device, +};static const struct of_device_id grant_dma_iommu_of_match[] = { { .compatible ="xen,grant-dma" },
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 222/885 rds: rds_rm_zerocopy_callback() correct order for list_add_tail()
In reply to Greg Kroah-HartmanFrom: Pietro Borrello <[email protected]>
[ Upstream commit 68762148d1b011d47bc2ceed7321739b5aea1e63 ]
rds_rm_zerocopy_callback() uses list_add_tail() with swapped arguments. This links the list head with the new entry, losing the references to the remaining part of the list.
--- net/rds/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/message.c +1 -1
@@ -118,7 +118,7 @@ static void rds_rm_zerocopy_callback(struct rds_sock *rs, ck = &info->zcookies;memset (ck,0 ,sizeof (*ck));WARN_ON (!rds_zcookie_add (info, cookie)); -list_add_tail (&q->zcookie_head, &info->rs_zcookie_next); +list_add_tail (&info->rs_zcookie_next, &q->zcookie_head);spin_unlock_irqrestore (&q->lock, flags);/* caller invokes rds_wake_sk_sleep() */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 223/885 crypto: rsa-pkcs1pad - Use akcipher_request_complete
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 564cabc0ca0bdfa8f0fc1ae74b24d0a7554522c5 ]
Use the akcipher_request_complete helper instead of calling the completion function directly. In fact the previous code was buggy in that EINPROGRESS was never passed back to the original caller.
--- crypto/rsa-pkcs1pad.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-)
crypto/rsa-pkcs1pad.c +15 -19
@@ -214,16 +214,14 @@ static void pkcs1pad_encrypt_sign_complete_cb( struct crypto_async_request *child_async_req, int err) {struct akcipher_request *req = child_async_req->data; -struct crypto_async_request async_req;if (err == -EINPROGRESS ) -return ; + goto out; + + err =pkcs1pad_encrypt_sign_complete (req, err); - async_req.data = req->base.data; - async_req.tfm =crypto_akcipher_tfm (crypto_akcipher_reqtfm (req)); - async_req.flags = child_async_req->flags; - req->base.complete (&async_req, -pkcs1pad_encrypt_sign_complete (req, err)); +out: +akcipher_request_complete (req, err); }static int pkcs1pad_encrypt (struct akcipher_request *req)
@@ -332,15 +330,14 @@ static void pkcs1pad_decrypt_complete_cb( struct crypto_async_request *child_async_req, int err) {struct akcipher_request *req = child_async_req->data; -struct crypto_async_request async_req;if (err == -EINPROGRESS ) -return ; + goto out; + + err =pkcs1pad_decrypt_complete (req, err); - async_req.data = req->base.data; - async_req.tfm =crypto_akcipher_tfm (crypto_akcipher_reqtfm (req)); - async_req.flags = child_async_req->flags; - req->base.complete (&async_req,pkcs1pad_decrypt_complete (req, err)); +out: +akcipher_request_complete (req, err); }static int pkcs1pad_decrypt (struct akcipher_request *req)
@@ -513,15 +510,14 @@ static void pkcs1pad_verify_complete_cb( struct crypto_async_request *child_async_req, int err) {struct akcipher_request *req = child_async_req->data; -struct crypto_async_request async_req;if (err == -EINPROGRESS ) -return ; + goto out; - async_req.data = req->base.data; - async_req.tfm =crypto_akcipher_tfm (crypto_akcipher_reqtfm (req)); - async_req.flags = child_async_req->flags; - req->base.complete (&async_req,pkcs1pad_verify_complete (req, err)); + err =pkcs1pad_verify_complete (req, err); + +out: +akcipher_request_complete (req, err); }/*
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 224/885 m68k: /proc/hardware should depend on PROC_FS
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 1e5b5df65af99013b4d31607ddb3ca5731dbe44d ]
When CONFIG_PROC_FS is not set, there is a build error for an unused function. Make PROC_HARDWARE depend on PROC_FS to prevent this error.
In file included from ../arch/m68k/kernel/setup.c:3:../arch/m68k/kernel/setup_mm.c:477:12: error: 'hardware_proc_show' defined but not used [-Werror=unused-function]
477 | static int hardware_proc_show(struct seq_file *m, void *v)
| ^~~~~~~~~~~~~~~~~~
--- arch/m68k/Kconfig.devices | 1 + 1 file changed, 1 insertion(+)
arch/m68k/Kconfig.devices +1 -0
@@ -19,6 +19,7 @@ config HEARTBEAT # We have a dedicated heartbeat LED. :-) config PROC_HARDWARE bool "/proc/hardware support" + depends on PROC_FS help Say Y here to support the /proc/hardware file, which gives you access to information about the machine you're running on,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 225/885 RISC-V: time: initialize hrtimer based broadcast clock event device
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit 8b3b8fbb4896984b5564789a42240e4b3caddb61 ]
Similarly to commit 022eb8ae8b5e ("ARM: 8938/1: kernel: initialize broadcast hrtimer based clock event device"), RISC-V needs to initiate hrtimer based broadcast clock event device before C3STOP can be used. Otherwise, the introduction of C3STOP for the RISC-V arch timer in commit 232ccac1bd9b ("clocksource/drivers/riscv: Events are stopped during CPU suspend") leaves us without any broadcast timer registered. This prevents the kernel from entering oneshot mode, which breaks timer behaviour, for example clock_nanosleep().
A test app that sleeps each cpu for 6, 5, 4, 3 ms respectively, HZ=250 & C3STOP enabled, the sleep times are rounded up to the next jiffy:
== CPU: 1 == == CPU: 2 == == CPU: 3 == == CPU: 4 == Mean: 7.974992 Mean: 7.976534 Mean: 7.962591 Mean: 3.952179
Std Dev: 0.154374 Std Dev: 0.156082 Std Dev: 0.171018 Std Dev: 0.076193
Hi: 9.472000 Hi: 10.495000 Hi: 8.864000 Hi: 4.736000
Lo: 6.087000 Lo: 6.380000 Lo: 4.872000 Lo: 3.403000
Samples: 521 Samples: 521 Samples: 521 Samples: 521
--- arch/riscv/kernel/time.c | 3 +++ 1 file changed, 3 insertions(+)
arch/riscv/kernel/time.c +3 -0
@@ -5,6 +5,7 @@*/ #include <linux/of_clk.h> +#include <linux/clockchips.h> #include <linux/clocksource.h> #include <linux/delay.h> #include <asm/sbi.h>
@@ -29,6 +30,8 @@ void __init time_init(void)of_clk_init (NULL );timer_probe (); + +tick_setup_hrtimer_broadcast (); }void clocksource_arch_init (struct clocksource *cs)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 226/885 clocksource/drivers/riscv: Patch riscv_clock_next_event() jump before first use
In reply to Greg Kroah-HartmanFrom: Matt Evans <[email protected]>
[ Upstream commit 225b9596cb0227c1c1b1e4a836dad43595c3e61a ]
A static key is used to select between SBI and Sstc timer usage in riscv_clock_next_event(), but currently the direction is resolved after cpuhp_setup_state() is called (which sets the next event). The first event will therefore fall through the sbi_set_timer() path; this breaks Sstc-only systems. So, apply the jump patching before first use.
--- drivers/clocksource/timer-riscv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clocksource/timer-riscv.c +5 -5
@@ -177,6 +177,11 @@ static int __init riscv_timer_init_dt(struct device_node *n)return error; } +if (riscv_isa_extension_available (NULL ,SSTC )) { +pr_info ("Timer interrupt in S-mode is available via sstc extension\n" ); +static_branch_enable (&riscv_sstc_available); + } + error =cpuhp_setup_state (CPUHP_AP_RISCV_TIMER_STARTING ,"clockevents/riscv/timer:starting" , riscv_timer_starting_cpu, riscv_timer_dying_cpu);
@@ -184,11 +189,6 @@ static int __init riscv_timer_init_dt(struct device_node *n)pr_err ("cpu hp setup state failed for RISCV timer [%d]\n" , error); -if (riscv_isa_extension_available (NULL ,SSTC )) { -pr_info ("Timer interrupt in S-mode is available via sstc extension\n" ); -static_branch_enable (&riscv_sstc_available); - } -return error; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 227/885 wifi: iwl3945: Add missing check for create_singlethread_workqueue
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 1fdeb8b9f29dfd64805bb49475ac7566a3cb06cb ]
Add the check for the return value of the create_singlethread_workqueue in order to avoid NULL pointer dereference.
--- drivers/net/wireless/intel/iwlegacy/3945-mac.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlegacy/3945-mac.c +12 -4
@@ -3378,10 +3378,12 @@ static DEVICE_ATTR(dump_errors, 0200, NULL, il3945_dump_error_log);* *****************************************************************************/ -static void +static int il3945_setup_deferred_work (struct il_priv *il) { il->workqueue =create_singlethread_workqueue (DRV_NAME ); +if (!il->workqueue) +return -ENOMEM ;init_waitqueue_head (&il->wait_command_queue);
@@ -3398,6 +3400,8 @@ il3945_setup_deferred_work(struct il_priv *il)timer_setup (&il->watchdog, il_bg_watchdog,0 );tasklet_setup (&il->irq_tasklet, il3945_irq_tasklet); + +return 0 ; } static void
@@ -3717,7 +3721,10 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }il_set_rxon_channel (il, &il->bands[NL80211_BAND_2GHZ ].channels[5 ]); -il3945_setup_deferred_work (il); + err =il3945_setup_deferred_work (il); +if (err) + goto out_remove_sysfs; +il3945_setup_handlers (il);il_power_initialize (il);
@@ -3729,7 +3736,7 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err =il3945_setup_mac (il);if (err) - goto out_remove_sysfs; + goto out_destroy_workqueue;il_dbgfs_register (il,DRV_NAME );
@@ -3738,9 +3745,10 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return 0 ; -out_remove_sysfs: +out_destroy_workqueue:destroy_workqueue (il->workqueue); il->workqueue =NULL ; +out_remove_sysfs:sysfs_remove_group (&pdev->dev.kobj, &il3945_attribute_group); out_release_irq:free_irq (il->pci_dev->irq, il);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 228/885 wifi: iwl4965: Add missing check for create_singlethread_workqueue()
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 26e6775f75517ad6844fe5b79bc5f3fa8c22ee61 ]
Add the check for the return value of the create_singlethread_workqueue() in order to avoid NULL pointer dereference.
--- drivers/net/wireless/intel/iwlegacy/4965-mac.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlegacy/4965-mac.c +10 -2
@@ -6211,10 +6211,12 @@ il4965_bg_txpower_work(struct work_struct *work)mutex_unlock (&il->mutex); } -static void +static int il4965_setup_deferred_work (struct il_priv *il) { il->workqueue =create_singlethread_workqueue (DRV_NAME ); +if (!il->workqueue) +return -ENOMEM ;init_waitqueue_head (&il->wait_command_queue);
@@ -6233,6 +6235,8 @@ il4965_setup_deferred_work(struct il_priv *il)timer_setup (&il->watchdog, il_bg_watchdog,0 );tasklet_setup (&il->irq_tasklet, il4965_irq_tasklet); + +return 0 ; } static void
@@ -6617,7 +6621,10 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_disable_msi; } -il4965_setup_deferred_work (il); + err =il4965_setup_deferred_work (il); +if (err) + goto out_free_irq; +il4965_setup_handlers (il);/*********************************************
@@ -6655,6 +6662,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) out_destroy_workqueue:destroy_workqueue (il->workqueue); il->workqueue =NULL ; +out_free_irq:free_irq (il->pci_dev->irq, il); out_disable_msi:pci_disable_msi (il->pci_dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 229/885 wifi: mwifiex: fix loop iterator in mwifiex_update_ampdu_txwinsize()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3cfb7df24cee0f5fdc4cc5d3176cab9aadfcb430 ]
This code re-uses "i" to be the iterator for both the inside and outside loops. It means the outside loop will exit earlier than intended.
--- drivers/net/wireless/marvell/mwifiex/11n.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/11n.c +3 -3
@@ -878,7 +878,7 @@ mwifiex_send_delba_txbastream_tbl(struct mwifiex_private *priv, u8 tid)*/ void mwifiex_update_ampdu_txwinsize (struct mwifiex_adapter *adapter) { -u8 i; +u8 i, j;u32 tx_win_size;struct mwifiex_private *priv;
@@ -909,8 +909,8 @@ void mwifiex_update_ampdu_txwinsize(struct mwifiex_adapter *adapter)if (tx_win_size != priv->add_ba_param.tx_win_size) {if (!priv->media_connected)continue ; -for (i =0 ; i <MAX_NUM_TID ; i++) -mwifiex_send_delba_txbastream_tbl (priv, i); +for (j =0 ; j <MAX_NUM_TID ; j++) +mwifiex_send_delba_txbastream_tbl (priv, j); } } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 230/885 selftests/bpf: Fix out-of-srctree build
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 0b0757244754ea1d0721195c824770f5576e119e ]
Building BPF selftests out of srctree fails with:
make: *** No rule to make target '/linux-build//ima_setup.sh', needed by 'ima_setup.sh'. Stop.
The culprit is the rule that defines convenient shorthands like "make test_progs", which builds $(OUTPUT)/test_progs. These shorthands make sense only for binaries that are built though; scripts that live in the source tree do not end up in $(OUTPUT).
Therefore drop $(TEST_PROGS) and $(TEST_PROGS_EXTENDED) from the rule.
The issue exists for a while, but it became a problem only after commit d68ae4982cb7 ("selftests/bpf: Install all required files to run selftests"), which added dependencies on these scripts.
--- tools/testing/selftests/bpf/Makefile | 2 -- 1 file changed, 2 deletions(-)
tools/testing/selftests/bpf/Makefile +0 -2
@@ -149,8 +149,6 @@ endif # NOTE: Semicolon at the end is critical to override lib.mk's default static # rule for binaries. $(notdir $(TEST_GEN_PROGS) \ - $(TEST_PROGS) \ - $(TEST_PROGS_EXTENDED) \ $(TEST_GEN_PROGS_EXTENDED) \ $(TEST_CUSTOM_PROGS)): %: $(OUTPUT)/% ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 231/885 ACPI: resource: Add IRQ overrides for MAINGEAR Vector Pro 2 models
In reply to Greg Kroah-HartmanFrom: Adam Niederer <[email protected]>
[ Upstream commit cb18703c179713056bd7e3bdfc2260ab4e8658f0 ]
Fix a regression introduced by commit 9946e39fe8d0 ("ACPI: resource: skip IRQ override on AMD Zen platforms") on MAINGEAR Vector Pro 2 systems, which causes the built-in keyboard to not work. This restores the functionality by adding an IRQ override.
No other IRQs were being overridden before, so this should be all that is needed for these systems. I have personally tested this on the 15" model (MG-VCP2-15A3070T), and I have confirmation that the issue is present on the 17" model (MG-VCP2-17A3070T).
--- drivers/acpi/resource.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/acpi/resource.c +19 -0
@@ -478,6 +478,24 @@ static const struct dmi_system_id schenker_gm_rg[] = { { } }; +static const struct dmi_system_id maingear_laptop[] = { + { + .ident ="MAINGEAR Vector Pro 2 15" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Micro Electronics Inc" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"MG-VCP2-15A3070T" ), + } + }, + { + .ident ="MAINGEAR Vector Pro 2 17" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Micro Electronics Inc" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"MG-VCP2-17A3070T" ), + }, + }, + { } +}; +struct irq_override_cmp {const struct dmi_system_id *system;unsigned char irq;
@@ -493,6 +511,7 @@ static const struct irq_override_cmp override_table[] = { { lenovo_laptop, 6, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true }, { lenovo_laptop, 10, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true }, { schenker_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true }, + { maingear_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true }, }; static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 232/885 ACPI: resource: Do IRQ override on all TongFang GMxRGxx
In reply to Greg Kroah-HartmanFrom: Werner Sembach <[email protected]>
[ Upstream commit 17bb7046e7ce038a73ee97eaa804e0300c5199e2 ]
Apply commit 7592b79ba4a9 ("ACPI: resource: do IRQ override on XMG Core 15") override for all vendors using this mainboard.
--- drivers/acpi/resource.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/acpi/resource.c +3 -4
@@ -467,11 +467,10 @@ static const struct dmi_system_id lenovo_laptop[] = { { } }; -static const struct dmi_system_id schenker_gm_rg[] = { +static const struct dmi_system_id tongfang_gm_rg[] = { { - .ident ="XMG CORE 15 (M22)" , + .ident ="TongFang GMxRGxx/XMG CORE 15 (M22)/TUXEDO Stellaris 15 Gen4 AMD" , .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"SchenkerTechnologiesGmbH" ),DMI_MATCH (DMI_BOARD_NAME ,"GMxRGxx" ), }, },
@@ -510,7 +509,7 @@ static const struct irq_override_cmp override_table[] = { { asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false }, { lenovo_laptop, 6, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true }, { lenovo_laptop, 10, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true }, - { schenker_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true }, + { tongfang_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true }, { maingear_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true }, };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 233/885 crypto: octeontx2 - Fix objects shared between several modules
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 72bc4e71dbeedee0a446bcbc37c9bb25449072b7 ]
cn10k_cpt.o, otx2_cptlf.o and otx2_cpt_mbox_common.o are linked into both rvu_cptpf and rvu_cptvf modules:
Quoted 6 lines
scripts/Makefile.build:252:./drivers/crypto/marvell/octeontx2/Makefile:
cn10k_cpt.o is added to multiple modules:rvu_cptpfrvu_cptvfscripts/Makefile.build:252:./drivers/crypto/marvell/octeontx2/Makefile:
otx2_cptlf.o is added to multiple modules:rvu_cptpfrvu_cptvfscripts/Makefile.build:252:./drivers/crypto/marvell/octeontx2/Makefile:
otx2_cpt_mbox_common.o is added to multiple modules:rvu_cptpfrvu_cptvf
Despite they're build under the same Kconfig option (CONFIG_CRYPTO_DEV_OCTEONTX2_CPT), it's better do link the common code into a standalone module and export the shared functions. Under certain circumstances, this can lead to the same situation as fixed by commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects"). Plus, those three common object files are relatively big to duplicate them several times.
Introduce the new module, rvu_cptcommon, to provide the common functions to both modules.
--- drivers/crypto/marvell/octeontx2/Makefile | 11 +++++------ drivers/crypto/marvell/octeontx2/cn10k_cpt.c | 9 +++++++-- drivers/crypto/marvell/octeontx2/cn10k_cpt.h | 2 -- drivers/crypto/marvell/octeontx2/otx2_cpt_common.h | 2 -- .../marvell/octeontx2/otx2_cpt_mbox_common.c | 14 ++++++++++++-- drivers/crypto/marvell/octeontx2/otx2_cptlf.c | 11 +++++++++++ drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 2 ++ drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c | 2 ++ 8 files changed, 39 insertions(+), 14 deletions(-)
drivers/crypto/marvell/octeontx2/Makefile +5 -6
@@ -1,11 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_CRYPTO_DEV_OCTEONTX2_CPT) += rvu_cptpf.o rvu_cptvf.o +obj-$(CONFIG_CRYPTO_DEV_OCTEONTX2_CPT) += rvu_cptcommon.o rvu_cptpf.o rvu_cptvf.o +rvu_cptcommon-objs := cn10k_cpt.o otx2_cptlf.o otx2_cpt_mbox_common.o rvu_cptpf-objs := otx2_cptpf_main.o otx2_cptpf_mbox.o \ - otx2_cpt_mbox_common.o otx2_cptpf_ucode.o otx2_cptlf.o \ - cn10k_cpt.o otx2_cpt_devlink.o -rvu_cptvf-objs := otx2_cptvf_main.o otx2_cptvf_mbox.o otx2_cptlf.o \ - otx2_cpt_mbox_common.o otx2_cptvf_reqmgr.o \ - otx2_cptvf_algs.o cn10k_cpt.o + otx2_cptpf_ucode.o otx2_cpt_devlink.o +rvu_cptvf-objs := otx2_cptvf_main.o otx2_cptvf_mbox.o \ + otx2_cptvf_reqmgr.o otx2_cptvf_algs.o ccflags-y += -I$(srctree)/drivers/net/ethernet/marvell/octeontx2/af
drivers/crypto/marvell/octeontx2/cn10k_cpt.c +7 -2
@@ -7,6 +7,9 @@#include "otx2_cptlf.h" #include "cn10k_cpt.h" +static void cn10k_cpt_send_cmd (union otx2_cpt_inst_s *cptinst,u32 insts_num, +struct otx2_cptlf_info *lf); +static struct cpt_hw_ops otx2_hw_ops = { .send_cmd = otx2_cpt_send_cmd, .cpt_get_compcode = otx2_cpt_get_compcode,
@@ -19,8 +22,8 @@ static struct cpt_hw_ops cn10k_hw_ops = { .cpt_get_uc_compcode = cn10k_cpt_get_uc_compcode, }; -void cn10k_cpt_send_cmd (union otx2_cpt_inst_s *cptinst,u32 insts_num, -struct otx2_cptlf_info *lf) +static void cn10k_cpt_send_cmd (union otx2_cpt_inst_s *cptinst,u32 insts_num, +struct otx2_cptlf_info *lf) {void __iomem *lmtline = lf->lmtline;u64 val = (lf->slot &0x7FF );
@@ -68,6 +71,7 @@ int cn10k_cptpf_lmtst_init(struct otx2_cptpf_dev *cptpf)return 0 ; } +EXPORT_SYMBOL_NS_GPL (cn10k_cptpf_lmtst_init,CRYPTO_DEV_OCTEONTX2_CPT );int cn10k_cptvf_lmtst_init (struct otx2_cptvf_dev *cptvf) {
@@ -91,3 +95,4 @@ int cn10k_cptvf_lmtst_init(struct otx2_cptvf_dev *cptvf)return 0 ; } +EXPORT_SYMBOL_NS_GPL (cn10k_cptvf_lmtst_init,CRYPTO_DEV_OCTEONTX2_CPT );
drivers/crypto/marvell/octeontx2/cn10k_cpt.h +0 -2
@@ -28,8 +28,6 @@ static inline u8 otx2_cpt_get_uc_compcode(union otx2_cpt_res_s *result)return ((struct cn9k_cpt_res_s *)result)->uc_compcode; } -void cn10k_cpt_send_cmd (union otx2_cpt_inst_s *cptinst,u32 insts_num, -struct otx2_cptlf_info *lf);int cn10k_cptpf_lmtst_init (struct otx2_cptpf_dev *cptpf);int cn10k_cptvf_lmtst_init (struct otx2_cptvf_dev *cptvf);
drivers/crypto/marvell/octeontx2/otx2_cpt_common.h +0 -2
@@ -145,8 +145,6 @@ int otx2_cpt_send_mbox_msg(struct otx2_mbox *mbox, struct pci_dev *pdev);int otx2_cpt_send_af_reg_requests (struct otx2_mbox *mbox,struct pci_dev *pdev); -int otx2_cpt_add_read_af_reg (struct otx2_mbox *mbox,struct pci_dev *pdev, -u64 reg,u64 *val,int blkaddr);int otx2_cpt_add_write_af_reg (struct otx2_mbox *mbox,struct pci_dev *pdev,u64 reg,u64 val,int blkaddr); int otx2_cpt_read_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,
drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c +12 -2
@@ -19,6 +19,7 @@ int otx2_cpt_send_mbox_msg(struct otx2_mbox *mbox, struct pci_dev *pdev) }return ret; } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_send_mbox_msg,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cpt_send_ready_msg (struct otx2_mbox *mbox,struct pci_dev *pdev) {
@@ -36,14 +37,17 @@ int otx2_cpt_send_ready_msg(struct otx2_mbox *mbox, struct pci_dev *pdev)return otx2_cpt_send_mbox_msg (mbox, pdev); } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_send_ready_msg,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cpt_send_af_reg_requests (struct otx2_mbox *mbox,struct pci_dev *pdev) {return otx2_cpt_send_mbox_msg (mbox, pdev); } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_send_af_reg_requests,CRYPTO_DEV_OCTEONTX2_CPT ); -int otx2_cpt_add_read_af_reg (struct otx2_mbox *mbox,struct pci_dev *pdev, -u64 reg,u64 *val,int blkaddr) +static int otx2_cpt_add_read_af_reg (struct otx2_mbox *mbox, +struct pci_dev *pdev,u64 reg, +u64 *val,int blkaddr) {struct cpt_rd_wr_reg_msg *reg_msg;
@@ -91,6 +95,7 @@ int otx2_cpt_add_write_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,return 0 ; } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_add_write_af_reg,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cpt_read_af_reg (struct otx2_mbox *mbox,struct pci_dev *pdev,u64 reg,u64 *val,int blkaddr)
@@ -103,6 +108,7 @@ int otx2_cpt_read_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,return otx2_cpt_send_mbox_msg (mbox, pdev); } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_read_af_reg,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cpt_write_af_reg (struct otx2_mbox *mbox,struct pci_dev *pdev,u64 reg,u64 val,int blkaddr)
@@ -115,6 +121,7 @@ int otx2_cpt_write_af_reg(struct otx2_mbox *mbox, struct pci_dev *pdev,return otx2_cpt_send_mbox_msg (mbox, pdev); } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_write_af_reg,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cpt_attach_rscrs_msg (struct otx2_cptlfs_info *lfs) {
@@ -170,6 +177,7 @@ int otx2_cpt_detach_rsrcs_msg(struct otx2_cptlfs_info *lfs)return ret; } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_detach_rsrcs_msg,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cpt_msix_offset_msg (struct otx2_cptlfs_info *lfs) {
@@ -202,6 +210,7 @@ int otx2_cpt_msix_offset_msg(struct otx2_cptlfs_info *lfs) }return ret; } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_msix_offset_msg,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cpt_sync_mbox_msg (struct otx2_mbox *mbox) {
@@ -216,3 +225,4 @@ int otx2_cpt_sync_mbox_msg(struct otx2_mbox *mbox)return otx2_mbox_check_rsp_msgs (mbox,0 ); } +EXPORT_SYMBOL_NS_GPL (otx2_cpt_sync_mbox_msg,CRYPTO_DEV_OCTEONTX2_CPT );
drivers/crypto/marvell/octeontx2/otx2_cptlf.c +11 -0
@@ -274,6 +274,8 @@ void otx2_cptlf_unregister_interrupts(struct otx2_cptlfs_info *lfs) }cptlf_disable_intrs (lfs); } +EXPORT_SYMBOL_NS_GPL (otx2_cptlf_unregister_interrupts, +CRYPTO_DEV_OCTEONTX2_CPT ); static int cptlf_do_register_interrrupts(struct otx2_cptlfs_info *lfs, int lf_num, int irq_offset,
@@ -321,6 +323,7 @@ int otx2_cptlf_register_interrupts(struct otx2_cptlfs_info *lfs)otx2_cptlf_unregister_interrupts (lfs);return ret; } +EXPORT_SYMBOL_NS_GPL (otx2_cptlf_register_interrupts,CRYPTO_DEV_OCTEONTX2_CPT );void otx2_cptlf_free_irqs_affinity (struct otx2_cptlfs_info *lfs) {
@@ -334,6 +337,7 @@ void otx2_cptlf_free_irqs_affinity(struct otx2_cptlfs_info *lfs)free_cpumask_var (lfs->lf[slot].affinity_mask); } } +EXPORT_SYMBOL_NS_GPL (otx2_cptlf_free_irqs_affinity,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cptlf_set_irqs_affinity (struct otx2_cptlfs_info *lfs) {
@@ -366,6 +370,7 @@ int otx2_cptlf_set_irqs_affinity(struct otx2_cptlfs_info *lfs)otx2_cptlf_free_irqs_affinity (lfs);return ret; } +EXPORT_SYMBOL_NS_GPL (otx2_cptlf_set_irqs_affinity,CRYPTO_DEV_OCTEONTX2_CPT );int otx2_cptlf_init (struct otx2_cptlfs_info *lfs,u8 eng_grp_mask,int pri,int lfs_num)
@@ -422,6 +427,7 @@ int otx2_cptlf_init(struct otx2_cptlfs_info *lfs, u8 eng_grp_mask, int pri, lfs->lfs_num =0 ;return ret; } +EXPORT_SYMBOL_NS_GPL (otx2_cptlf_init,CRYPTO_DEV_OCTEONTX2_CPT );void otx2_cptlf_shutdown (struct otx2_cptlfs_info *lfs) {
@@ -431,3 +437,8 @@ void otx2_cptlf_shutdown(struct otx2_cptlfs_info *lfs)/* Send request to detach LFs */ otx2_cpt_detach_rsrcs_msg (lfs); } +EXPORT_SYMBOL_NS_GPL (otx2_cptlf_shutdown,CRYPTO_DEV_OCTEONTX2_CPT ); + +MODULE_AUTHOR ("Marvell" ); +MODULE_DESCRIPTION ("Marvell RVU CPT Common module" ); +MODULE_LICENSE ("GPL" );
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +2 -0
@@ -831,6 +831,8 @@ static struct pci_driver otx2_cpt_pci_driver = {module_pci_driver (otx2_cpt_pci_driver); +MODULE_IMPORT_NS (CRYPTO_DEV_OCTEONTX2_CPT ); +MODULE_AUTHOR ("Marvell" );MODULE_DESCRIPTION (OTX2_CPT_DRV_STRING );MODULE_LICENSE ("GPL v2" );
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c +2 -0
@@ -429,6 +429,8 @@ static struct pci_driver otx2_cptvf_pci_driver = {module_pci_driver (otx2_cptvf_pci_driver); +MODULE_IMPORT_NS (CRYPTO_DEV_OCTEONTX2_CPT ); +MODULE_AUTHOR ("Marvell" );MODULE_DESCRIPTION ("Marvell RVU CPT Virtual Function Driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 234/885 crypto: crypto4xx - Call dma_unmap_page when done
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit bcdda4301bdc4955d45f7e1ffefb6207967b067e ]
In crypto4xx_cipher_done, we should be unmapping the dst page, not mapping it.
This was flagged by a sparse warning about the unused addr variable. While we're at it, also fix a sparse warning regarding the unused ctx variable in crypto4xx_ahash_done (by actually using it).
--- drivers/crypto/amcc/crypto4xx_core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/crypto/amcc/crypto4xx_core.c +4 -6
@@ -522,7 +522,6 @@ static void crypto4xx_cipher_done(struct crypto4xx_device *dev, {struct skcipher_request *req;struct scatterlist *dst; -dma_addr_t addr; req =skcipher_request_cast (pd_uinfo->async_req);
@@ -531,8 +530,8 @@ static void crypto4xx_cipher_done(struct crypto4xx_device *dev, req->cryptlen, req->dst); }else { dst = pd_uinfo->dest_va; - addr =dma_map_page (dev->core_dev->device,sg_page (dst), - dst->offset, dst->length,DMA_FROM_DEVICE ); +dma_unmap_page (dev->core_dev->device, pd->dest, dst->length, +DMA_FROM_DEVICE ); }if (pd_uinfo->sa_va->sa_command_0.bf.save_iv ==SA_SAVE_IV ) {
@@ -557,10 +556,9 @@ static void crypto4xx_ahash_done(struct crypto4xx_device *dev,struct ahash_request *ahash_req; ahash_req =ahash_request_cast (pd_uinfo->async_req); - ctx =crypto_tfm_ctx (ahash_req->base.tfm); + ctx =crypto_ahash_ctx (crypto_ahash_reqtfm (ahash_req)); -crypto4xx_copy_digest_to_dst (ahash_req->result, pd_uinfo, -crypto_tfm_ctx (ahash_req->base.tfm)); +crypto4xx_copy_digest_to_dst (ahash_req->result, pd_uinfo, ctx);crypto4xx_ret_sg_desc (dev, pd_uinfo);if (pd_uinfo->state &PD_ENTRY_BUSY )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 235/885 wifi: mac80211: move color collision detection report in a delayed work
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 9288188438d85e22c23cfd6657ee8a801babc83c ]
Move color collision report in a dedicated delayed work and do not run it in interrupt context in order to rate-limit the number of events reported to userspace. Moreover grab wdev mutex in ieee80211_color_collision_detection_work routine since it is required by cfg80211_obss_color_collision_notify().
--- net/mac80211/cfg.c | 26 +++++++++++++++++++++++++- net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/link.c | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +25 -1
@@ -4623,6 +4623,20 @@ void ieee80211_color_change_finalize_work(struct work_struct *work)sdata_unlock (sdata); } +void ieee80211_color_collision_detection_work (struct work_struct *work) +{ +struct delayed_work *delayed_work =to_delayed_work (work); +struct ieee80211_link_data *link = + container_of(delayed_work, struct ieee80211_link_data, + color_collision_detect_work); +struct ieee80211_sub_if_data *sdata = link->sdata; + +sdata_lock (sdata); +cfg80211_obss_color_collision_notify (sdata->dev, link->color_bitmap, +GFP_KERNEL ); +sdata_unlock (sdata); +} +void ieee80211_color_change_finish (struct ieee80211_vif *vif) {struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif);
@@ -4637,11 +4651,21 @@ ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif, u64 color_bitmap, gfp_t gfp) {struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); +struct ieee80211_link_data *link = &sdata->deflink;if (sdata->vif.bss_conf.color_change_active || sdata->vif.bss_conf.csa_active)return ; -cfg80211_obss_color_collision_notify (sdata->dev, color_bitmap, gfp); +if (delayed_work_pending (&link->color_collision_detect_work)) +return ; + + link->color_bitmap = color_bitmap; +/* queue the color collision detection event every 500 ms in order to +* avoid sending too much netlink messages to userspace. +*/ +ieee80211_queue_delayed_work (&sdata->local->hw, + &link->color_collision_detect_work, +msecs_to_jiffies (500 )); }EXPORT_SYMBOL_GPL (ieeee80211_obss_color_collision_notify);
net/mac80211/ieee80211_i.h +3 -0
@@ -972,6 +972,8 @@ struct ieee80211_link_data {struct cfg80211_chan_def csa_chandef;struct work_struct color_change_finalize_work; +struct delayed_work color_collision_detect_work; +u64 color_bitmap;/* context reservation -- protected with chanctx_mtx */ struct ieee80211_chanctx *reserved_chanctx;
@@ -1916,6 +1918,7 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,/* color change handling */ void ieee80211_color_change_finalize_work (struct work_struct *work); +void ieee80211_color_collision_detection_work (struct work_struct *work);/* interface handling */ #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
net/mac80211/link.c +3 -0
@@ -39,6 +39,8 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata, ieee80211_csa_finalize_work);INIT_WORK (&link->color_change_finalize_work, ieee80211_color_change_finalize_work); +INIT_DELAYED_WORK (&link->color_collision_detect_work, + ieee80211_color_collision_detection_work);INIT_LIST_HEAD (&link->assigned_chanctx_list);INIT_LIST_HEAD (&link->reserved_chanctx_list); INIT_DELAYED_WORK(&link->dfs_cac_timer_work,
@@ -66,6 +68,7 @@ void ieee80211_link_stop(struct ieee80211_link_data *link)if (link->sdata->vif.type ==NL80211_IFTYPE_STATION )ieee80211_mgd_stop_link (link); +cancel_delayed_work_sync (&link->color_collision_detect_work);ieee80211_link_release_channel (link); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 236/885 wifi: mac80211: make rate u32 in sta_set_rate_info_rx()
In reply to Greg Kroah-HartmanFrom: Shayne Chen <[email protected]>
[ Upstream commit 59336e07b287d91dc4ec265e07724e8f7e3d0209 ]
The value of last_rate in ieee80211_sta_rx_stats is degraded from u32 to u16 after being assigned to rate variable, which causes information loss in STA_STATS_FIELD_TYPE and later bitfields.
--- net/mac80211/sta_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/sta_info.c +1 -1
@@ -2380,7 +2380,7 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u32 rate,static int sta_set_rate_info_rx (struct sta_info *sta,struct rate_info *rinfo) { -u16 rate =READ_ONCE (sta_get_last_rx_stats (sta)->last_rate); +u32 rate =READ_ONCE (sta_get_last_rx_stats (sta)->last_rate);if (rate ==STA_STATS_RATE_INVALID )return -EINVAL ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 237/885 wifi: mac80211: fix non-MLO station association
In reply to Greg Kroah-HartmanFrom: Karthikeyan Periyasamy <[email protected]>
[ Upstream commit aaacf1740f2f95e0c5449ff3bbcff252d69cf952 ]
Non-MLO station frames are dropped in Rx path due to the condition check in ieee80211_rx_is_valid_sta_link_id(). In multi-link AP scenario, non-MLO stations try to connect in any of the valid links in the ML AP, where the station valid_links and link_id params are valid in the ieee80211_sta object. But ieee80211_rx_is_valid_sta_link_id() always return false for the non-MLO stations by the assumption taken is valid_links and link_id are not valid in non-MLO stations object (ieee80211_sta), this assumption is wrong. Due to this assumption, non-MLO station frames are dropped which leads to failure in association.
Fix it by removing the condition check and allow the link validation check for the non-MLO stations.
--- net/mac80211/rx.c | 3 --- 1 file changed, 3 deletions(-)
net/mac80211/rx.c +0 -3
@@ -4073,9 +4073,6 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)static bool ieee80211_rx_is_valid_sta_link_id (struct ieee80211_sta *sta,u8 link_id) { -if (!sta->mlo) -return false; -return !!(sta->valid_links &BIT (link_id)); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 238/885 wifi: mac80211: Dont translate MLD addresses for multicast
In reply to Greg Kroah-HartmanFrom: Andrei Otcheretianski <[email protected]>
[ Upstream commit daf8fb4295dccc032515cdc1bd3873370063542b ]
MLD address translation should be done only for individually addressed frames. Otherwise, AAD calculation would be wrong and the decryption would fail.
--- net/mac80211/rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/rx.c +2 -1
@@ -4861,7 +4861,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, hdr = (struct ieee80211_hdr *)rx->skb->data; } -if (unlikely (rx->sta && rx->sta->sta.mlo)) { +if (unlikely (rx->sta && rx->sta->sta.mlo) && +is_unicast_ether_addr (hdr->addr1)) {/* translate to MLD addresses */ if (ether_addr_equal (link->conf->addr, hdr->addr1))ether_addr_copy (hdr->addr1, rx->sdata->vif.addr);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 239/885 wifi: mac80211: avoid u32_encode_bits() warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 1d8d4af4347420d657be448f8be4c39c558f3b5d ]
gcc-9 triggers a false-postive warning in ieee80211_mlo_multicast_tx() for u32_encode_bits(ffs(links) - 1, ...), since ffs() can return zero on an empty bitmask, and the negative argument to u32_encode_bits() is then out of range:
In file included from include/linux/ieee80211.h:21,
from include/net/cfg80211.h:23,
from net/mac80211/tx.c:23:
In function 'u32_encode_bits',
inlined from 'ieee80211_mlo_multicast_tx' at net/mac80211/tx.c:4437:17,
inlined from 'ieee80211_subif_start_xmit' at net/mac80211/tx.c:4485:3:
include/linux/bitfield.h:177:3: error: call to '__field_overflow' declared with attribute error: value doesn't fit into mask
177 | __field_overflow(); \
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:197:2: note: in expansion of macro '____MAKE_OP'
197 | ____MAKE_OP(u##size,u##size,,)
| ^~~~~~~~~~~
include/linux/bitfield.h:200:1: note: in expansion of macro '__MAKE_OP'
200 | __MAKE_OP(32)
| ^~~~~~~~~Newer compiler versions do not cause problems with the zero argument because they do not consider this a __builtin_constant_p(). It's also harmless since the hweight16() check already guarantees that this cannot be 0.
Replace the ffs() with an equivalent find_first_bit() check that matches the later for_each_set_bit() style and avoids the warning.
--- net/mac80211/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tx.c +1 -1
@@ -4395,7 +4395,7 @@ static void ieee80211_mlo_multicast_tx(struct net_device *dev,u32 ctrl_flags =IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX ;if (hweight16 (links) ==1 ) { - ctrl_flags |=u32_encode_bits (ffs (links) -1 , + ctrl_flags |=u32_encode_bits (find_first_bit (&links,16 ) -1 ,IEEE80211_TX_CTRL_MLO_LINK ); __ieee80211_subif_start_xmit(skb, sdata->dev, 0, ctrl_flags,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 240/885 wifi: mac80211: fix off-by-one link setting
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit cf08e29db760b144bde51e2444f3430c75763e26 ]
The convention for find_first_bit() is 0-based, while ffs() is 1-based, so this is now off-by-one. I cannot reproduce the gcc-9 problem, but since the -1 is now removed, I'm hoping it will still avoid the original issue.
--- net/mac80211/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tx.c +1 -1
@@ -4395,7 +4395,7 @@ static void ieee80211_mlo_multicast_tx(struct net_device *dev,u32 ctrl_flags =IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX ;if (hweight16 (links) ==1 ) { - ctrl_flags |=u32_encode_bits (find_first_bit (&links,16 ) -1 , + ctrl_flags |=u32_encode_bits (__ffs (links),IEEE80211_TX_CTRL_MLO_LINK ); __ieee80211_subif_start_xmit(skb, sdata->dev, 0, ctrl_flags,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 241/885 tools/lib/thermal: Fix thermal_sampling_exit()
In reply to Greg Kroah-HartmanFrom: Vincent Guittot <[email protected]>
[ Upstream commit a29cbd76aaf63f5493e962aa2fbaadcdc4615143 ]
thermal_sampling_init() suscribes to THERMAL_GENL_SAMPLING_GROUP_NAME group so thermal_sampling_exit() should unsubscribe from the same group.
--- tools/lib/thermal/sampling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/thermal/sampling.c +1 -1
@@ -54,7 +54,7 @@ int thermal_sampling_fd(struct thermal_handler *th)thermal_error_t thermal_sampling_exit (struct thermal_handler *th) {if (nl_unsubscribe_thermal (th->sk_sampling, th->cb_sampling, -THERMAL_GENL_EVENT_GROUP_NAME )) +THERMAL_GENL_SAMPLING_GROUP_NAME ))return THERMAL_ERROR ;nl_thermal_disconnect (th->sk_sampling, th->cb_sampling);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 242/885 thermal/drivers/hisi: Drop second sensor hi3660
In reply to Greg Kroah-HartmanFrom: Yongqin Liu <[email protected]>
[ Upstream commit 15cc25829a97c3957e520e971868aacc84341317 ]
The commit 74c8e6bffbe1 ("driver core: Add __alloc_size hint to devm allocators") exposes a panic "BRK handler: Fatal exception" on the hi3660_thermal_probe funciton.
This is because the function allocates memory for only one sensors array entry, but tries to fill up a second one.
Fix this by removing the unneeded second access.
--- drivers/thermal/hisi_thermal.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/thermal/hisi_thermal.c +0 -4
@@ -427,10 +427,6 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data) data->sensor[0 ].irq_name ="tsensor_a73" ; data->sensor[0 ].data = data; - data->sensor[1 ].id =HI3660_LITTLE_SENSOR ; - data->sensor[1 ].irq_name ="tsensor_a53" ; - data->sensor[1 ].data = data; -return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 243/885 selftests/bpf: Fix map_kptr test.
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit 62d101d5f422cde39b269f7eb4cbbe2f1e26f9d4 ]
The compiler is optimizing out majority of unref_ptr read/writes, so the test wasn't testing much. For example, one could delete '__kptr' tag from 'struct prog_test_ref_kfunc __kptr *unref_ptr;' and the test would still "pass".
Convert it to volatile stores. Confirmed by comparing bpf asm before/after.
--- tools/testing/selftests/bpf/progs/map_kptr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
tools/testing/selftests/bpf/progs/map_kptr.c +7 -5
@@ -62,21 +62,23 @@ extern struct prog_test_ref_kfunc * bpf_kfunc_call_test_kptr_get(struct prog_test_ref_kfunc **p, int a, int b) __ksym; extern void bpf_kfunc_call_test_release(struct prog_test_ref_kfunc *p) __ksym; +#define WRITE_ONCE (x, val) ((*(volatile typeof(x) *) &(x)) = (val)) +static void test_kptr_unref (struct map_value *v) {struct prog_test_ref_kfunc *p; p = v->unref_ptr;/* store untrusted_ptr_or_null_ */ - v->unref_ptr = p; +WRITE_ONCE (v->unref_ptr, p);if (!p)return ;if (p->a + p->b >100 )return ;/* store untrusted_ptr_ */ - v->unref_ptr = p; +WRITE_ONCE (v->unref_ptr, p);/* store NULL */ - v->unref_ptr =NULL ; +WRITE_ONCE (v->unref_ptr,NULL ); }static void test_kptr_ref (struct map_value *v)
@@ -85,7 +87,7 @@ static void test_kptr_ref(struct map_value *v) p = v->ref_ptr;/* store ptr_or_null_ */ - v->unref_ptr = p; +WRITE_ONCE (v->unref_ptr, p);if (!p)return ;if (p->a + p->b >100 )
@@ -99,7 +101,7 @@ static void test_kptr_ref(struct map_value *v)return ; }/* store ptr_ */ - v->unref_ptr = p; +WRITE_ONCE (v->unref_ptr, p);bpf_kfunc_call_test_release (p); p =bpf_kfunc_call_test_acquire (&(unsigned long ){0 });
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 244/885 wifi: mac80211: pass sta to ieee80211_rx_data_set_sta()
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 0d846bdc11101ac0ba4d89c2be359af08cb9379b ]
There's at least one case in ieee80211_rx_for_interface() where we might pass &((struct sta_info *)NULL)->sta to it only to then do container_of(), and then checking the result for NULL, but checking the result of container_of() for NULL looks really odd.
Fix this by just passing the struct sta_info * instead.
--- net/mac80211/rx.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
net/mac80211/rx.c +11 -15
@@ -4094,13 +4094,8 @@ static bool ieee80211_rx_data_set_link(struct ieee80211_rx_data *rx, }static bool ieee80211_rx_data_set_sta (struct ieee80211_rx_data *rx, -struct ieee80211_sta *pubsta, -int link_id) +struct sta_info *sta,int link_id) { -struct sta_info *sta; - - sta = container_of(pubsta, struct sta_info, sta); - rx->link_id = link_id; rx->sta = sta;
@@ -4138,7 +4133,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)if (sta->sta.valid_links) link_id =ffs (sta->sta.valid_links) -1 ; -if (!ieee80211_rx_data_set_sta (&rx, &sta->sta, link_id)) +if (!ieee80211_rx_data_set_sta (&rx, sta, link_id))return ; tid_agg_rx =rcu_dereference (sta->ampdu_mlme.tid_rx[tid]);
@@ -4184,7 +4179,7 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid, sta = container_of(pubsta, struct sta_info, sta); -if (!ieee80211_rx_data_set_sta (&rx, pubsta,-1 )) +if (!ieee80211_rx_data_set_sta (&rx, sta,-1 ))return ;rcu_read_lock ();
@@ -4892,6 +4887,7 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw,struct ieee80211_rx_status *status =IEEE80211_SKB_RXCB (skb);struct ieee80211_fast_rx *fast_rx;struct ieee80211_rx_data rx; +struct sta_info *sta;int link_id =-1 ;memset (&rx,0 ,sizeof (rx));
@@ -4919,7 +4915,8 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw,* link_id is used only for stats purpose and updating the stats on * the deflink is fine? */ -if (!ieee80211_rx_data_set_sta (&rx, pubsta, link_id)) + sta = container_of(pubsta, struct sta_info, sta); +if (!ieee80211_rx_data_set_sta (&rx, sta, link_id)) goto drop; fast_rx =rcu_dereference (rx.sta->fast_rx);
@@ -4959,7 +4956,7 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx, link_id = status->link_id; } -if (!ieee80211_rx_data_set_sta (rx, &sta->sta, link_id)) +if (!ieee80211_rx_data_set_sta (rx, sta, link_id))return false;return ieee80211_prepare_and_rx_handle (rx, skb, consume);
@@ -5026,7 +5023,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, link_id = status->link_id;if (pubsta) { -if (!ieee80211_rx_data_set_sta (&rx, pubsta, link_id)) + sta = container_of(pubsta, struct sta_info, sta); +if (!ieee80211_rx_data_set_sta (&rx, sta, link_id)) goto out;/*
@@ -5063,8 +5061,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, } rx.sdata = prev_sta->sdata; -if (!ieee80211_rx_data_set_sta (&rx, &prev_sta->sta, - link_id)) +if (!ieee80211_rx_data_set_sta (&rx, prev_sta, link_id)) goto out;if (!status->link_valid && prev_sta->sta.mlo)
@@ -5077,8 +5074,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,if (prev_sta) { rx.sdata = prev_sta->sdata; -if (!ieee80211_rx_data_set_sta (&rx, &prev_sta->sta, - link_id)) +if (!ieee80211_rx_data_set_sta (&rx, prev_sta, link_id)) goto out;if (!status->link_valid && prev_sta->sta.mlo)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 245/885 bpf: Zeroing allocated object from slab in bpf memory allocator
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 997849c4b969034e225153f41026657def66d286 ]
Currently the freed element in bpf memory allocator may be immediately reused, for htab map the reuse will reinitialize special fields in map value (e.g., bpf_spin_lock), but lookup procedure may still access these special fields, and it may lead to hard-lockup as shown below:
NMI backtrace for cpu 16
CPU: 16 PID: 2574 Comm: htab.bin Tainted: G L 6.1.0+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), RIP: 0010:queued_spin_lock_slowpath+0x283/0x2c0 ...... Call Trace: <TASK> copy_map_value_locked+0xb7/0x170 bpf_map_copy_value+0x113/0x3c0 __sys_bpf+0x1c67/0x2780 __x64_sys_bpf+0x1c/0x20 do_syscall_64+0x30/0x60 entry_SYSCALL_64_after_hwframe+0x46/0xb0 ...... </TASK>
For htab map, just like the preallocated case, these is no need to initialize these special fields in map value again once these fields have been initialized. For preallocated htab map, these fields are initialized through __GFP_ZERO in bpf_map_area_alloc(), so do the similar thing for non-preallocated htab in bpf memory allocator. And there is no need to use __GFP_ZERO for per-cpu bpf memory allocator, because __alloc_percpu_gfp() does it implicitly.
--- include/linux/bpf.h | 7 +++++++ kernel/bpf/hashtab.c | 4 ++-- kernel/bpf/memalloc.c | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-)
include/linux/bpf.h +7 -0
@@ -266,6 +266,13 @@ static inline bool map_value_has_kptrs(const struct bpf_map *map)return !IS_ERR_OR_NULL (map->kptr_off_tab); } +/* 'dst' must be a temporary buffer and should not point to memory that is being +* used in parallel by a bpf program or bpf syscall, otherwise the access from +* the bpf program or bpf syscall may be corrupted by the reinitialization, +* leading to weird problems. Even 'dst' is newly-allocated from bpf memory +* allocator, it is still possible for 'dst' to be used in parallel by a bpf +* program or bpf syscall. +*/ static inline void check_and_init_map_value (struct bpf_map *map,void *dst) {if (unlikely (map_value_has_spin_lock (map)))
kernel/bpf/hashtab.c +2 -2
@@ -1010,8 +1010,6 @@ static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key, l_new =ERR_PTR (-ENOMEM ); goto dec_count; } -check_and_init_map_value (&htab->map, - l_new->key +round_up (key_size,8 )); }memcpy (l_new->key, key, key_size);
@@ -1603,6 +1601,7 @@ static int __htab_map_lookup_and_delete_elem(struct bpf_map *map, void *key,else copy_map_value (map, value, l->key + roundup_key_size); +/* Zeroing special fields in the temp buffer */ check_and_init_map_value (map, value); }
@@ -1803,6 +1802,7 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map, true); elsecopy_map_value (map ,dst_val ,value ); +/* Zeroing special fields in the temp buffer */ check_and_init_map_value (map, dst_val); }if (do_delete) {
kernel/bpf/memalloc.c +1 -1
@@ -143,7 +143,7 @@ static void *__alloc(struct bpf_mem_cache *c, int node)return obj; } -return kmalloc_node (c->unit_size, flags, node); +return kmalloc_node (c->unit_size, flags | __GFP_ZERO, node); }static struct mem_cgroup *get_memcg (const struct bpf_mem_cache *c)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 246/885 selftests/bpf: Fix xdp_do_redirect on s390x
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 06c1865b0b0c7820ea53af2394dd7aff31100295 ]
s390x cache line size is 256 bytes, so skb_shared_info must be aligned on a much larger boundary than for x86. This makes the maximum packet size smaller.
Stable-dep-of: 6c20822fada1 ("bpf, test_run: fix &xdp_frame misplacement for LIVE_FRAMES")
--- tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c +4 -0
@@ -65,7 +65,11 @@ static int attach_tc_prog(struct bpf_tc_hook *hook, int fd)/* The maximum permissible size is: PAGE_SIZE - sizeof(struct xdp_page_head) - * sizeof(struct skb_shared_info) - XDP_PACKET_HEADROOM = 3368 bytes */ +#if defined(__s390x__) +#define MAX_PKT_SIZE 3176 +#else #define MAX_PKT_SIZE 3368 +#endif static void test_max_pkt_size (int fd) {char data[MAX_PKT_SIZE +1 ] = {};
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 247/885 can: esd_usb: Move mislocated storage of SJA1000_ECC_SEG bits in case of a bus error
In reply to Greg Kroah-HartmanFrom: Frank Jungclaus <[email protected]>
[ Upstream commit 118469f88180438ef43dee93d71f77c00e7b425d ]
Move the supply for cf->data[3] (bit stream position of CAN error), in case of a bus- or protocol-error, outside of the "switch (ecc & SJA1000_ECC_MASK){}"-statement, because this bit stream position is independent of the error type.
--- drivers/net/can/usb/esd_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/can/usb/esd_usb.c +3 -1
@@ -286,7 +286,6 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv, cf->data[2 ] |=CAN_ERR_PROT_STUFF ;break ;default : - cf->data[3 ] = ecc &SJA1000_ECC_SEG ;break ; }
@@ -294,6 +293,9 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,if (!(ecc &SJA1000_ECC_DIR )) cf->data[2 ] |=CAN_ERR_PROT_TX ; +/* Bit stream position in CAN frame as the error was detected */ + cf->data[3 ] = ecc &SJA1000_ECC_SEG ; +if (priv->can.state ==CAN_STATE_ERROR_WARNING || priv->can.state ==CAN_STATE_ERROR_PASSIVE ) { cf->data[1] = (txerr > rxerr) ?
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 248/885 can: esd_usb: Make use of can_change_state() and relocate checking skb for NULL
In reply to Greg Kroah-HartmanFrom: Frank Jungclaus <[email protected]>
[ Upstream commit 9684b000a86299b5968fef8ffbf1484def37452a ]
Start a rework initiated by Vincents remarks "You should not report the greatest of txerr and rxerr but the one which actually increased."
[1] and "As far as I understand, those flags should be set only when the threshold is reached" [2] .
Therefore make use of can_change_state() to (among others) set the flags CAN_ERR_CRTL_[RT]X_WARNING and CAN_ERR_CRTL_[RT]X_PASSIVE, maintain CAN statistic counters for error_warning, error_passive and bus_off.
Relocate testing alloc_can_err_skb() for NULL to the end of esd_usb_rx_event(), to have things like can_bus_off(), can_change_state() working even in out of memory conditions.
--- drivers/net/can/usb/esd_usb.c | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-)
drivers/net/can/usb/esd_usb.c +25 -25
@@ -239,41 +239,42 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv, msg->msg.rx.dlc, state, ecc, rxerr, txerr); skb =alloc_can_err_skb (priv->netdev, &cf); -if (skb ==NULL ) { - stats->rx_dropped++; -return ; - }if (state != priv->old_state) { +enum can_state tx_state, rx_state; +enum can_state new_state =CAN_STATE_ERROR_ACTIVE ; + priv->old_state = state;switch (state &ESD_BUSSTATE_MASK ) {case ESD_BUSSTATE_BUSOFF : - priv->can.state =CAN_STATE_BUS_OFF ; - cf->can_id |=CAN_ERR_BUSOFF ; - priv->can.can_stats.bus_off++; + new_state =CAN_STATE_BUS_OFF ;can_bus_off (priv->netdev);break ;case ESD_BUSSTATE_WARN : - priv->can.state =CAN_STATE_ERROR_WARNING ; - priv->can.can_stats.error_warning++; + new_state =CAN_STATE_ERROR_WARNING ;break ;case ESD_BUSSTATE_ERRPASSIVE : - priv->can.state =CAN_STATE_ERROR_PASSIVE ; - priv->can.can_stats.error_passive++; + new_state =CAN_STATE_ERROR_PASSIVE ;break ;default : - priv->can.state =CAN_STATE_ERROR_ACTIVE ; + new_state =CAN_STATE_ERROR_ACTIVE ; txerr =0 ; rxerr =0 ;break ; } - }else { + +if (new_state != priv->can.state) { + tx_state = (txerr >= rxerr) ? new_state :0 ; + rx_state = (txerr <= rxerr) ? new_state :0 ; +can_change_state (priv->netdev, cf, + tx_state, rx_state); + } + }else if (skb) { priv->can.can_stats.bus_error++; stats->rx_errors++; - cf->can_id |=CAN_ERR_PROT |CAN_ERR_BUSERROR | -CAN_ERR_CNT ; + cf->can_id |=CAN_ERR_PROT |CAN_ERR_BUSERROR ;switch (ecc &SJA1000_ECC_MASK ) {case SJA1000_ECC_BIT :
@@ -295,21 +296,20 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,/* Bit stream position in CAN frame as the error was detected */ cf->data[3 ] = ecc &SJA1000_ECC_SEG ; - -if (priv->can.state ==CAN_STATE_ERROR_WARNING || - priv->can.state ==CAN_STATE_ERROR_PASSIVE ) { - cf->data[1 ] = (txerr > rxerr) ? -CAN_ERR_CRTL_TX_PASSIVE : -CAN_ERR_CRTL_RX_PASSIVE ; - } - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; } priv->bec.txerr = txerr; priv->bec.rxerr = rxerr; -netif_rx (skb); +if (skb) { + cf->can_id |=CAN_ERR_CNT ; + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; + +netif_rx (skb); + }else { + stats->rx_dropped++; + } } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 249/885 xsk: check IFF_UP earlier in Tx path
In reply to Greg Kroah-HartmanFrom: Maciej Fijalkowski <[email protected]>
[ Upstream commit 1596dae2f17ec5c6e8c8f0e3fec78c5ae55c1e0b ]
Xsk Tx can be triggered via either sendmsg() or poll() syscalls. These two paths share a call to common function xsk_xmit() which has two sanity checks within. A pseudo code example to show the two paths:
__xsk_sendmsg() : xsk_poll():
if (unlikely(!xsk_is_bound(xs))) if (unlikely(!xsk_is_bound(xs)))
return -ENXIO; return mask;
if (unlikely(need_wait)) (...)
return -EOPNOTSUPP; xsk_xmit()
mark napi id
(...)xsk_xmit()
xsk_xmit():
if (unlikely(!(xs->dev->flags & IFF_UP)))
return -ENETDOWN; if (unlikely(!xs->tx)) return -ENOBUFS;
As it can be observed above, in sendmsg() napi id can be marked on interface that was not brought up and this causes a NULL ptr dereference:
[31757.505631] BUG: kernel NULL pointer dereference, address: 0000000000000018 [31757.512710] #PF: supervisor read access in kernel mode [31757.517936] #PF: error_code(0x0000) - not-present page [31757.523149] PGD 0 P4D 0 [31757.525726] Oops: 0000 [#1] PREEMPT SMP NOPTI [31757.530154] CPU: 26 PID: 95641 Comm: xdpsock Not tainted 6.2.0-rc5+ #40 [31757.536871] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0008.031920191559 03/19/2019 [31757.547457] RIP: 0010:xsk_sendmsg+0xde/0x180 [31757.551799] Code: 00 75 a2 48 8b 00 a8 04 75 9b 84 d2 74 69 8b 85 14 01 00 00 85 c0 75 1b 48 8b 85 28 03 00 00 48 8b 80 98 00 00 00 48 8b 40 20 <8b> 40 18 89 85 14 01 00 00 8b bd 14 01 00 00 81 ff 00 01 00 00 0f [31757.570840] RSP: 0018:ffffc90034f27dc0 EFLAGS: 00010246 [31757.576143] RAX: 0000000000000000 RBX: ffffc90034f27e18 RCX: 0000000000000000 [31757.583389] RDX: 0000000000000001 RSI: ffffc90034f27e18 RDI: ffff88984cf3c100 [31757.590631] RBP: ffff88984714a800 R08: ffff88984714a800 R09: 0000000000000000 [31757.597877] R10: 0000000000000001 R11: 0000000000000000 R12: 00000000fffffffa [31757.605123] R13: 0000000000000000 R14: 0000000000000003 R15: 0000000000000000 [31757.612364] FS: 00007fb4c5931180(0000) GS:ffff88afdfa00000(0000) knlGS:0000000000000000 [31757.620571] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [31757.626406] CR2: 0000000000000018 CR3: 000000184b41c003 CR4: 00000000007706e0 [31757.633648] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [31757.640894] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [31757.648139] PKRU: 55555554 [31757.650894] Call Trace: [31757.653385] <TASK> [31757.655524] sock_sendmsg+0x8f/0xa0 [31757.659077] ? sockfd_lookup_light+0x12/0x70 [31757.663416] __sys_sendto+0xfc/0x170 [31757.667051] ? do_sched_setscheduler+0xdb/0x1b0 [31757.671658] __x64_sys_sendto+0x20/0x30 [31757.675557] do_syscall_64+0x38/0x90 [31757.679197] entry_SYSCALL_64_after_hwframe+0x72/0xdc [31757.687969] Code: 8e f6 ff 44 8b 4c 24 2c 4c 8b 44 24 20 41 89 c4 44 8b 54 24 28 48 8b 54 24 18 b8 2c 00 00 00 48 8b 74 24 10 8b 7c 24 08 0f 05 <48> 3d 00 f0 ff ff 77 3a 44 89 e7 48 89 44 24 08 e8 b5 8e f6 ff 48 [31757.707007] RSP: 002b:00007ffd49c73c70 EFLAGS: 00000293 ORIG_RAX: 000000000000002c [31757.714694] RAX: ffffffffffffffda RBX: 000055a996565380 RCX: 00007fb4c5727c16 [31757.721939] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 [31757.729184] RBP: 0000000000000040 R08: 0000000000000000 R09: 0000000000000000 [31757.736429] R10: 0000000000000040 R11: 0000000000000293 R12: 0000000000000000 [31757.743673] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [31757.754940] </TASK>
To fix this, let's make xsk_xmit a function that will be responsible for generic Tx, where RCU is handled accordingly and pull out sanity checks and xs->zc handling. Populate sanity checks to __xsk_sendmsg() and xsk_poll().
--- net/xdp/xsk.c | 59 ++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 26 deletions(-)
net/xdp/xsk.c +33 -26
@@ -511,7 +511,7 @@ static struct sk_buff *xsk_build_skb(struct xdp_sock *xs,return skb; } -static int xsk_generic_xmit (struct sock *sk) +static int __xsk_generic_xmit (struct sock *sk) {struct xdp_sock *xs =xdp_sk (sk);u32 max_batch =TX_BATCH_SIZE ;
@@ -594,22 +594,13 @@ static int xsk_generic_xmit(struct sock *sk)return err; } -static int xsk_xmit (struct sock *sk) +static int xsk_generic_xmit (struct sock *sk) { -struct xdp_sock *xs =xdp_sk (sk);int ret; -if (unlikely (!(xs->dev->flags &IFF_UP ))) -return -ENETDOWN ; -if (unlikely (!xs->tx)) -return -ENOBUFS ; - -if (xs->zc) -return xsk_wakeup (xs,XDP_WAKEUP_TX ); -/* Drop the RCU lock since the SKB path might sleep. */ rcu_read_unlock (); - ret =xsk_generic_xmit (sk); + ret =__xsk_generic_xmit (sk);/* Reaquire RCU lock before going into common code. */ rcu_read_lock ();
@@ -627,17 +618,31 @@ static bool xsk_no_wakeup(struct sock *sk)#endif } +static int xsk_check_common (struct xdp_sock *xs) +{ +if (unlikely (!xsk_is_bound (xs))) +return -ENXIO ; +if (unlikely (!(xs->dev->flags &IFF_UP ))) +return -ENETDOWN ; + +return 0 ; +} +static int __xsk_sendmsg (struct socket *sock,struct msghdr *m,size_t total_len) {bool need_wait = !(m->msg_flags &MSG_DONTWAIT );struct sock *sk = sock->sk;struct xdp_sock *xs =xdp_sk (sk);struct xsk_buff_pool *pool; +int err; -if (unlikely (!xsk_is_bound (xs))) -return -ENXIO ; + err =xsk_check_common (xs); +if (err) +return err;if (unlikely (need_wait))return -EOPNOTSUPP ; +if (unlikely (!xs->tx)) +return -ENOBUFS ;if (sk_can_busy_loop (sk)) {if (xs->zc)
@@ -649,8 +654,11 @@ static int __xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_lenreturn 0 ; pool = xs->pool; -if (pool->cached_need_wakeup &XDP_WAKEUP_TX ) -return xsk_xmit (sk); +if (pool->cached_need_wakeup &XDP_WAKEUP_TX ) { +if (xs->zc) +return xsk_wakeup (xs,XDP_WAKEUP_TX ); +return xsk_generic_xmit (sk); + }return 0 ; }
@@ -670,11 +678,11 @@ static int __xsk_recvmsg(struct socket *sock, struct msghdr *m, size_t len, intbool need_wait = !(flags &MSG_DONTWAIT );struct sock *sk = sock->sk;struct xdp_sock *xs =xdp_sk (sk); +int err; -if (unlikely (!xsk_is_bound (xs))) -return -ENXIO ; -if (unlikely (!(xs->dev->flags &IFF_UP ))) -return -ENETDOWN ; + err =xsk_check_common (xs); +if (err) +return err;if (unlikely (!xs->rx))return -ENOBUFS ;if (unlikely (need_wait))
@@ -713,21 +721,20 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,sock_poll_wait (file, sock, wait);rcu_read_lock (); -if (unlikely (!xsk_is_bound (xs))) { -rcu_read_unlock (); -return mask; - } +if (xsk_check_common (xs)) + goto skip_tx; pool = xs->pool;if (pool->cached_need_wakeup) {if (xs->zc)xsk_wakeup (xs, pool->cached_need_wakeup); -else +else if (xs->tx)/* Poll needs to drive Tx also in copy mode */ -xsk_xmit (sk); +xsk_generic_xmit (sk); } +skip_tx:if (xs->rx && !xskq_prod_is_empty (xs->rx)) mask |=EPOLLIN |EPOLLRDNORM ;if (xs->tx &&xsk_tx_writeable (xs))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 250/885 LoongArch, bpf: Use 4 instructions for function address in JIT
In reply to Greg Kroah-HartmanFrom: Hengqi Chen <[email protected]>
[ Upstream commit 64f50f6575721ef03d001e907455cbe3baa2a5b1 ]
This patch fixes the following issue of function calls in JIT, like:
[ 29.346981] multi-func JIT bug 105 != 103
The issus can be reproduced by running the "inline simple bpf_loop call" verifier test.
This is because we are emiting 2-4 instructions for 64-bit immediate moves. During the first pass of JIT, the placeholder address is zero, emiting two instructions for it. In the extra pass, the function address is in XKVRANGE, emiting four instructions for it. This change the instruction index in JIT context. Let's always use 4 instructions for function address in JIT. So that the instruction sequences don't change between the first pass and the extra pass for function calls.
--- arch/loongarch/net/bpf_jit.c | 2 +- arch/loongarch/net/bpf_jit.h | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
arch/loongarch/net/bpf_jit.c +1 -1
@@ -782,7 +782,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool extif (ret <0 )return ret; -move_imm (ctx, t1, func_addr, is32); +move_addr (ctx, t1, func_addr);emit_insn (ctx, jirl, t1,LOONGARCH_GPR_RA ,0 );move_reg (ctx, regmap[BPF_REG_0 ],LOONGARCH_GPR_A0 );break ;
arch/loongarch/net/bpf_jit.h +21 -0
@@ -80,6 +80,27 @@ static inline void emit_sext_32(struct jit_ctx *ctx, enum loongarch_gpr reg, booemit_insn (ctx, addiw, reg, reg,0 ); } +static inline void move_addr (struct jit_ctx *ctx,enum loongarch_gpr rd,u64 addr) +{ +u64 imm_11_0, imm_31_12, imm_51_32, imm_63_52; + +/* lu12iw rd, imm_31_12 */ + imm_31_12 = (addr >>12 ) &0xfffff ; +emit_insn (ctx, lu12iw, rd, imm_31_12); + +/* ori rd, rd, imm_11_0 */ + imm_11_0 = addr &0xfff ; +emit_insn (ctx, ori, rd, rd, imm_11_0); + +/* lu32id rd, imm_51_32 */ + imm_51_32 = (addr >>32 ) &0xfffff ; +emit_insn (ctx, lu32id, rd, imm_51_32); + +/* lu52id rd, rd, imm_63_52 */ + imm_63_52 = (addr >>52 ) &0xfff ; +emit_insn (ctx, lu52id, rd, rd, imm_63_52); +} +static inline void move_imm (struct jit_ctx *ctx,enum loongarch_gpr rd,long imm,bool is32) {long imm_11_0, imm_31_12, imm_51_32, imm_63_52, imm_51_0, imm_51_31;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 251/885 bpf: Fix global subprog context argument resolution logic
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit d384dce281ed1b504fae2e279507827638d56fa3 ]
KPROBE program's user-facing context type is defined as typedef bpf_user_pt_regs_t. This leads to a problem when trying to passing kprobe/uprobe/usdt context argument into global subprog, as kernel always strip away mods and typedefs of user-supplied type, but takes expected type from bpf_ctx_convert as is, which causes mismatch.
Current way to work around this is to define a fake struct with the same name as expected typedef:
struct bpf_user_pt_regs_t {};
__noinline my_global_subprog(struct bpf_user_pt_regs_t *ctx) { ... }
This patch fixes the issue by resolving expected type, if it's not a struct. It still leaves the above work-around working for backwards compatibility.
--- kernel/bpf/btf.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
kernel/bpf/btf.c +11 -2
@@ -5131,6 +5131,7 @@ btf_get_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf,if (!ctx_struct)/* should not happen */ return NULL ; +again: ctx_tname =btf_name_by_offset (btf_vmlinux, ctx_struct->name_off);if (!ctx_tname) {/* should not happen */
@@ -5144,8 +5145,16 @@ btf_get_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf,* int socket_filter_bpf_prog(struct __sk_buff *skb) * { // no fields of skb are ever used } */ -if (strcmp (ctx_tname, tname)) -return NULL ; +if (strcmp (ctx_tname, tname)) { +/* bpf_user_pt_regs_t is a typedef, so resolve it to +* underlying struct and check name again +*/ +if (!btf_type_is_modifier (ctx_struct)) +return NULL ; +while (btf_type_is_modifier (ctx_struct)) + ctx_struct =btf_type_by_id (btf_vmlinux, ctx_struct->type); + goto again; + }return ctx_type; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 252/885 irqchip/irq-brcmstb-l2: Set IRQ_LEVEL for level triggered interrupts
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 94debe03e8afa1267f95a9001786a6aa506b9ff3 ]
When support for the level triggered interrupt controller flavor was added with c0ca7262088e, we forgot to update the flags to be set to contain IRQ_LEVEL. While the flow handler is correct, the output from /proc/interrupts does not show such interrupts as being level triggered when they are, correct that.
--- drivers/irqchip/irq-brcmstb-l2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/irqchip/irq-brcmstb-l2.c +5 -1
@@ -161,6 +161,7 @@ static int __init brcmstb_l2_intc_of_init(struct device_node *np, *init_params) {unsigned int clr =IRQ_NOREQUEST |IRQ_NOPROBE |IRQ_NOAUTOEN ; +unsigned int set =0 ;struct brcmstb_l2_intc_data *data;struct irq_chip_type *ct;int ret;
@@ -208,9 +209,12 @@ static int __init brcmstb_l2_intc_of_init(struct device_node *np,if (IS_ENABLED (CONFIG_MIPS ) &&IS_ENABLED (CONFIG_CPU_BIG_ENDIAN )) flags |=IRQ_GC_BE_IO ; +if (init_params->handler == handle_level_irq) + set |=IRQ_LEVEL ; +/* Allocate a single Generic IRQ chip for this node */ ret =irq_alloc_domain_generic_chips (data->domain,32 ,1 , - np->full_name, init_params->handler, clr,0 , flags); + np->full_name, init_params->handler, clr, set, flags);if (ret) {pr_err ("failed to allocate generic irq chip\n" ); goto out_free_domain;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 253/885 irqchip/irq-bcm7120-l2: Set IRQ_LEVEL for level triggered interrupts
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 13a157b38ca5b4f9eed81442b8821db293755961 ]
When support for the interrupt controller was added with a5042de2688d, we forgot to update the flags to be set to contain IRQ_LEVEL. While the flow handler is correct, the output from /proc/interrupts does not show such interrupts as being level triggered when they are, correct that.
--- drivers/irqchip/irq-bcm7120-l2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/irq-bcm7120-l2.c +2 -1
@@ -279,7 +279,8 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, flags |=IRQ_GC_BE_IO ; ret =irq_alloc_domain_generic_chips (data->domain,IRQS_PER_WORD ,1 , - dn->full_name, handle_level_irq, clr,0 , flags); + dn->full_name, handle_level_irq, clr, +IRQ_LEVEL , flags);if (ret) {pr_err ("failed to allocate generic irq chip\n" ); goto out_free_domain;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 254/885 net/smc: fix potential panic dues to unprotected smc_llc_srv_add_link()
In reply to Greg Kroah-HartmanFrom: D. Wythe <[email protected]>
[ Upstream commit e40b801b3603a8f90b46acbacdea3505c27f01c0 ]
There is a certain chance to trigger the following panic:
PID: 5900 TASK: ffff88c1c8af4100 CPU: 1 COMMAND: "kworker/1:48"
#0 [ffff9456c1cc79a0] machine_kexec at ffffffff870665b7 #1 [ffff9456c1cc79f0] __crash_kexec at ffffffff871b4c7a #2 [ffff9456c1cc7ab0] crash_kexec at ffffffff871b5b60 #3 [ffff9456c1cc7ac0] oops_end at ffffffff87026ce7 #4 [ffff9456c1cc7ae0] page_fault_oops at ffffffff87075715 #5 [ffff9456c1cc7b58] exc_page_fault at ffffffff87ad0654 #6 [ffff9456c1cc7b80] asm_exc_page_fault at ffffffff87c00b62
[exception RIP: ib_alloc_mr+19]
RIP: ffffffffc0c9cce3 RSP: ffff9456c1cc7c38 RFLAGS: 00010202
RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000004
RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffff88c1ea281d00 R8: 000000020a34ffff R9: ffff88c1350bbb20
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: 0000000000000010 R14: ffff88c1ab040a50 R15: ffff88c1ea281d00
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #7 [ffff9456c1cc7c60] smc_ib_get_memory_region at ffffffffc0aff6df [smc] #8 [ffff9456c1cc7c88] smcr_buf_map_link at ffffffffc0b0278c [smc] #9 [ffff9456c1cc7ce0] __smc_buf_create at ffffffffc0b03586 [smc]
The reason here is that when the server tries to create a second link, smc_llc_srv_add_link() has no protection and may add a new link to link group. This breaks the security environment protected by llc_conf_mutex.
--- net/smc/af_smc.c | 2 ++ 1 file changed, 2 insertions(+)
net/smc/af_smc.c +2 -0
@@ -1826,8 +1826,10 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc)smc_llc_link_active (link);smcr_lgr_set_type (link->lgr,SMC_LGR_SINGLE ); +mutex_lock (&link->lgr->llc_conf_mutex);/* initial contact - try to establish second link */ smc_llc_srv_add_link (link,NULL ); +mutex_unlock (&link->lgr->llc_conf_mutex);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 255/885 net/smc: fix application data exception
In reply to Greg Kroah-HartmanFrom: D. Wythe <[email protected]>
[ Upstream commit 475f9ff63ee8c296aa46c6e9e9ad9bdd301c6bdf ]
There is a certain probability that following
exceptions will occur in the wrk benchmark test:
Running 10s test @ http://11.213.45.6:80
8 threads and 64 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.72ms 13.94ms 245.33ms 94.17%
Req/Sec 1.96k 713.67 5.41k 75.16% 155262 requests in 10.10s, 23.10MB read
Non-2xx or 3xx responses: 3
We will find that the error is HTTP 400 error, which is a serious exception in our test, which means the application data was corrupted.
Consider the following scenarios:
CPU0 CPU1
buf_desc->used = 0;
cmpxchg(buf_desc->used, 0, 1)
deal_with(buf_desc)memset(buf_desc->cpu_addr,0);
This will cause the data received by a victim connection to be cleared, thus triggering an HTTP 400 error in the server.
This patch exchange the order between clear used and memset, add barrier to ensure memory consistency.
--- net/smc/smc_core.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
net/smc/smc_core.c +8 -9
@@ -1120,8 +1120,9 @@ static void smcr_buf_unuse(struct smc_buf_desc *buf_desc, bool is_rmb,smc_buf_free (lgr, is_rmb, buf_desc); }else { - buf_desc->used =0 ; -memset (buf_desc->cpu_addr,0 , buf_desc->len); +/* memzero_explicit provides potential memory barrier semantics */ +memzero_explicit (buf_desc->cpu_addr, buf_desc->len); +WRITE_ONCE (buf_desc->used,0 ); } }
@@ -1132,19 +1133,17 @@ static void smc_buf_unuse(struct smc_connection *conn,if (!lgr->is_smcd && conn->sndbuf_desc->is_vm) {smcr_buf_unuse (conn->sndbuf_desc, false, lgr); }else { - conn->sndbuf_desc->used =0 ; -memset (conn->sndbuf_desc->cpu_addr,0 , - conn->sndbuf_desc->len); +memzero_explicit (conn->sndbuf_desc->cpu_addr, conn->sndbuf_desc->len); +WRITE_ONCE (conn->sndbuf_desc->used,0 ); } }if (conn->rmb_desc) {if (!lgr->is_smcd) {smcr_buf_unuse (conn->rmb_desc, true, lgr); }else { - conn->rmb_desc->used =0 ; -memset (conn->rmb_desc->cpu_addr,0 , - conn->rmb_desc->len + -sizeof (struct smcd_cdc_msg )); +memzero_explicit (conn->rmb_desc->cpu_addr, + conn->rmb_desc->len +sizeof (struct smcd_cdc_msg )); +WRITE_ONCE (conn->rmb_desc->used,0 ); } } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 256/885 selftests/net: Interpret UDP_GRO cmsg data as an int value
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit 436864095a95fcc611c20c44a111985fa9848730 ]
Data passed to user-space with a (SOL_UDP, UDP_GRO) cmsg carries an int (see udp_cmsg_recv), not a u16 value, as strace confirms:
recvmsg(8, {msg_name=...,
msg_iov=[{iov_base="\0\0..."..., iov_len=96000}],
msg_iovlen=1,
msg_control=[{cmsg_len=20, <-- sizeof(cmsghdr) + 4
cmsg_level=SOL_UDP,
cmsg_type=0x68}], <-- UDP_GRO
msg_controllen=24,
msg_flags=0}, 0) = 11200Interpreting the data as an u16 value won't work on big-endian platforms. Since it is too late to back out of this API decision [1], fix the test.
[1]: https://lore.kernel.org/netdev/[email protected]/
--- tools/testing/selftests/net/udpgso_bench_rx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/testing/selftests/net/udpgso_bench_rx.c +2 -4
@@ -214,11 +214,10 @@ static void do_verify_udp(const char *data, int len)static int recv_msg (int fd,char *buf,int len,int *gso_size) { -char control[CMSG_SPACE (sizeof (uint16_t ))] = {0 }; +char control[CMSG_SPACE (sizeof (int ))] = {0 };struct msghdr msg = {0 };struct iovec iov = {0 };struct cmsghdr *cmsg; -uint16_t *gsosizeptr;int ret; iov.iov_base = buf;
@@ -237,8 +236,7 @@ static int recv_msg(int fd, char *buf, int len, int *gso_size) cmsg = CMSG_NXTHDR(&msg, cmsg)) {if (cmsg->cmsg_level ==SOL_UDP && cmsg->cmsg_type ==UDP_GRO ) { - gsosizeptr = (uint16_t *)CMSG_DATA (cmsg); - *gso_size = *gsosizeptr; + *gso_size = *(int *)CMSG_DATA (cmsg);break ; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 257/885 l2tp: Avoid possible recursive deadlock in l2tp_tunnel_register()
In reply to Greg Kroah-HartmanFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit 9ca5e7ecab064f1f47da07f7c1ddf40e4bc0e5ac ]
When a file descriptor of pppol2tp socket is passed as file descriptor of UDP socket, a recursive deadlock occurs in l2tp_tunnel_register(). This situation is reproduced by the following program:
int main(void)
{
int sock;
struct sockaddr_pppol2tp addr;
sock = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP);
if (sock < 0) {
perror("socket");
return 1;
}
addr.sa_family = AF_PPPOX;
addr.sa_protocol = PX_PROTO_OL2TP;
addr.pppol2tp.pid = 0;
addr.pppol2tp.fd = sock;
addr.pppol2tp.addr.sin_family = PF_INET;
addr.pppol2tp.addr.sin_port = htons(0);
addr.pppol2tp.addr.sin_addr.s_addr = inet_addr("192.168.0.1");
addr.pppol2tp.s_tunnel = 1;
addr.pppol2tp.s_session = 0;
addr.pppol2tp.d_tunnel = 0;
addr.pppol2tp.d_session = 0;
if (connect(sock, (const struct sockaddr *)&addr, sizeof(addr)) < 0) {
perror("connect");
return 1;
}
return 0;
}This program causes the following lockdep warning:
============================================
WARNING: possible recursive locking detected 6.2.0-rc5-00205-gc96618275234 #56 Not tainted
--------------------------------------------
repro/8607 is trying to acquire lock:
ffff8880213c8130 (sk_lock-AF_PPPOX){+.+.}-{0:0}, at: l2tp_tunnel_register+0x2b7/0x11c0
but task is already holding lock:
ffff8880213c8130 (sk_lock-AF_PPPOX){+.+.}-{0:0}, at: pppol2tp_connect+0xa82/0x1a30
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(sk_lock-AF_PPPOX);
lock(sk_lock-AF_PPPOX);
*** DEADLOCK ***
May be due to missing lock nesting notation
1 lock held by repro/8607:
#0: ffff8880213c8130 (sk_lock-AF_PPPOX){+.+.}-{0:0}, at: pppol2tp_connect+0xa82/0x1a30
stack backtrace: CPU: 0 PID: 8607 Comm: repro Not tainted 6.2.0-rc5-00205-gc96618275234 #56 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x100/0x178 __lock_acquire.cold+0x119/0x3b9 ? lockdep_hardirqs_on_prepare+0x410/0x410 lock_acquire+0x1e0/0x610 ? l2tp_tunnel_register+0x2b7/0x11c0 ? lock_downgrade+0x710/0x710 ? __fget_files+0x283/0x3e0 lock_sock_nested+0x3a/0xf0 ? l2tp_tunnel_register+0x2b7/0x11c0 l2tp_tunnel_register+0x2b7/0x11c0 ? sprintf+0xc4/0x100 ? l2tp_tunnel_del_work+0x6b0/0x6b0 ? debug_object_deactivate+0x320/0x320 ? lockdep_init_map_type+0x16d/0x7a0 ? lockdep_init_map_type+0x16d/0x7a0 ? l2tp_tunnel_create+0x2bf/0x4b0 ? l2tp_tunnel_create+0x3c6/0x4b0 pppol2tp_connect+0x14e1/0x1a30 ? pppol2tp_put_sk+0xd0/0xd0 ? aa_sk_perm+0x2b7/0xa80 ? aa_af_perm+0x260/0x260 ? bpf_lsm_socket_connect+0x9/0x10 ? pppol2tp_put_sk+0xd0/0xd0 __sys_connect_file+0x14f/0x190 __sys_connect+0x133/0x160 ? __sys_connect_file+0x190/0x190 ? lockdep_hardirqs_on+0x7d/0x100 ? ktime_get_coarse_real_ts64+0x1b7/0x200 ? ktime_get_coarse_real_ts64+0x147/0x200 ? __audit_syscall_entry+0x396/0x500 __x64_sys_connect+0x72/0xb0 do_syscall_64+0x38/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd
This patch fixes the issue by getting/creating the tunnel before locking the pppol2tp socket.
--- net/l2tp/l2tp_ppp.c | 125 ++++++++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 58 deletions(-)
net/l2tp/l2tp_ppp.c +67 -58
@@ -650,54 +650,22 @@ static int pppol2tp_tunnel_mtu(const struct l2tp_tunnel *tunnel)return mtu -PPPOL2TP_HEADER_OVERHEAD ; } -/* connect() handler. Attach a PPPoX socket to a tunnel UDP socket -*/ -static int pppol2tp_connect (struct socket *sock,struct sockaddr *uservaddr, -int sockaddr_len,int flags) +static struct l2tp_tunnel *pppol2tp_tunnel_get (struct net *net, +const struct l2tp_connect_info *info, +bool *new_tunnel) { -struct sock *sk = sock->sk; -struct pppox_sock *po =pppox_sk (sk); -struct l2tp_session *session =NULL ; -struct l2tp_connect_info info;struct l2tp_tunnel *tunnel; -struct pppol2tp_session *ps; -struct l2tp_session_cfg cfg = {0 , }; -bool drop_refcnt = false; -bool drop_tunnel = false; -bool new_session = false; -bool new_tunnel = false;int error; - error =pppol2tp_sockaddr_get_info (uservaddr, sockaddr_len, &info); -if (error <0 ) -return error; + *new_tunnel = false; -lock_sock (sk); - -/* Check for already bound sockets */ - error = -EBUSY ; -if (sk->sk_state &PPPOX_CONNECTED ) - goto end; - -/* We don't supporting rebinding anyway */ - error = -EALREADY ; -if (sk->sk_user_data) - goto end;/* socket is already attached */ - -/* Don't bind if tunnel_id is 0 */ - error = -EINVAL ; -if (!info.tunnel_id) - goto end; - - tunnel =l2tp_tunnel_get (sock_net (sk), info.tunnel_id); -if (tunnel) - drop_tunnel = true; + tunnel =l2tp_tunnel_get (net, info->tunnel_id);/* Special case: create tunnel context if session_id and * peer_session_id is 0. Otherwise look up tunnel using supplied * tunnel id. */ -if (!info.session_id && !info.peer_session_id) { +if (!info->session_id && !info->peer_session_id) {if (!tunnel) {struct l2tp_tunnel_cfg tcfg = { .encap = L2TP_ENCAPTYPE_UDP,
@@ -706,40 +674,82 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,/* Prevent l2tp_tunnel_register() from trying to set up * a kernel socket. */ -if (info.fd <0 ) { - error = -EBADF ; - goto end; - } +if (info->fd <0 ) +return ERR_PTR (-EBADF ); - error =l2tp_tunnel_create (info.fd, - info.version, - info.tunnel_id, - info.peer_tunnel_id, &tcfg, + error =l2tp_tunnel_create (info->fd, + info->version, + info->tunnel_id, + info->peer_tunnel_id, &tcfg, &tunnel);if (error <0 ) - goto end; +return ERR_PTR (error);l2tp_tunnel_inc_refcount (tunnel); - error =l2tp_tunnel_register (tunnel,sock_net (sk), - &tcfg); + error =l2tp_tunnel_register (tunnel, net, &tcfg);if (error <0 ) {kfree (tunnel); - goto end; +return ERR_PTR (error); } - drop_tunnel = true; - new_tunnel = true; + + *new_tunnel = true; } }else {/* Error if we can't find the tunnel */ - error = -ENOENT ;if (!tunnel) - goto end; +return ERR_PTR (-ENOENT );/* Error if socket is not prepped */ -if (!tunnel->sock) - goto end; +if (!tunnel->sock) { +l2tp_tunnel_dec_refcount (tunnel); +return ERR_PTR (-ENOENT ); + } } +return tunnel; +} + +/* connect() handler. Attach a PPPoX socket to a tunnel UDP socket +*/ +static int pppol2tp_connect (struct socket *sock,struct sockaddr *uservaddr, +int sockaddr_len,int flags) +{ +struct sock *sk = sock->sk; +struct pppox_sock *po =pppox_sk (sk); +struct l2tp_session *session =NULL ; +struct l2tp_connect_info info; +struct l2tp_tunnel *tunnel; +struct pppol2tp_session *ps; +struct l2tp_session_cfg cfg = {0 , }; +bool drop_refcnt = false; +bool new_session = false; +bool new_tunnel = false; +int error; + + error =pppol2tp_sockaddr_get_info (uservaddr, sockaddr_len, &info); +if (error <0 ) +return error; + +/* Don't bind if tunnel_id is 0 */ +if (!info.tunnel_id) +return -EINVAL ; + + tunnel =pppol2tp_tunnel_get (sock_net (sk), &info, &new_tunnel); +if (IS_ERR (tunnel)) +return PTR_ERR (tunnel); + +lock_sock (sk); + +/* Check for already bound sockets */ + error = -EBUSY ; +if (sk->sk_state &PPPOX_CONNECTED ) + goto end; + +/* We don't supporting rebinding anyway */ + error = -EALREADY ; +if (sk->sk_user_data) + goto end;/* socket is already attached */ +if (tunnel->peer_tunnel_id ==0 ) tunnel->peer_tunnel_id = info.peer_tunnel_id;
@@ -840,8 +850,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, }if (drop_refcnt)l2tp_session_dec_refcount (session); -if (drop_tunnel) -l2tp_tunnel_dec_refcount (tunnel); +l2tp_tunnel_dec_refcount (tunnel);release_sock (sk);return error;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 258/885 net: bcmgenet: fix MoCA LED control
In reply to Greg Kroah-HartmanFrom: Doug Berger <[email protected]>
[ Upstream commit a7515af9fb8f0890fe540b108def4a86b9e8330a ]
When the bcmgenet_mii_config() code was refactored it was missed that the LED control for the MoCA interface got overwritten by the port_ctrl value. Its previous programming is restored here.
--- drivers/net/ethernet/broadcom/genet/bcmmii.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmmii.c +2 -9
@@ -169,15 +169,6 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable)static void bcmgenet_moca_phy_setup (struct bcmgenet_priv *priv) { -u32 reg; - -if (!GENET_IS_V5 (priv)) { -/* Speed settings are set in bcmgenet_mii_setup() */ - reg =bcmgenet_sys_readl (priv,SYS_PORT_CTRL ); - reg |=LED_ACT_SOURCE_MAC ; -bcmgenet_sys_writel (priv, reg,SYS_PORT_CTRL ); - } -if (priv->hw_params->flags &GENET_HAS_MOCA_LINK_DET )fixed_phy_set_link_update (priv->dev->phydev, bcmgenet_fixed_phy_link_update);
@@ -210,6 +201,8 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)if (!phy_name) { phy_name ="MoCA" ; +if (!GENET_IS_V5 (priv)) + port_ctrl |=LED_ACT_SOURCE_MAC ;bcmgenet_moca_phy_setup (priv); }break ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 259/885 net: lan966x: Fix possible deadlock inside PTP
In reply to Greg Kroah-HartmanFrom: Horatiu Vultur <[email protected]>
[ Upstream commit 3a70e0d4c9d74cb00f7c0ec022f5599f9f7ba07d ]
When doing timestamping in lan966x and having PROVE_LOCKING enabled the following warning is shown.
========================================================
WARNING: possible irq lock inversion dependency detected
6.2.0-rc7-01749-gc54e1f7f7e36 #2786 Tainted: G N
--------------------------------------------------------
swapper/0/0 just changed the state of lock:c2609f50 (_xmit_ETHER#2){+.-.}-{2:2}, at: sch_direct_xmit+0x16c/0x2e8 but this lock took another, SOFTIRQ-unsafe lock in the past:
(&lan966x->ptp_ts_id_lock){+.+.}-{2:2}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&lan966x->ptp_ts_id_lock);
local_irq_disable();
lock(_xmit_ETHER#2);
lock(&lan966x->ptp_ts_id_lock);
<Interrupt>
lock(_xmit_ETHER#2);*** DEADLOCK ***
5 locks held by swapper/0/0:
#0: c1001e18 ((&ndev->rs_timer)){+.-.}-{0:0}, at: call_timer_fn+0x0/0x33c
#1: c105e7c4 (rcu_read_lock){....}-{1:2}, at: ndisc_send_skb+0x134/0x81c
#2: c105e7d8 (rcu_read_lock_bh){....}-{1:2}, at: ip6_finish_output2+0x17c/0xc64
#3: c105e7d8 (rcu_read_lock_bh){....}-{1:2}, at: __dev_queue_xmit+0x4c/0x1224
#4: c3056174 (dev->qdisc_tx_busylock ?: &qdisc_tx_busylock){+...}-{2:2}, at: __dev_queue_xmit+0x354/0x1224
the shortest dependencies between 2nd lock and 1st lock:
-> (&lan966x->ptp_ts_id_lock){+.+.}-{2:2} {
HARDIRQ-ON-W at:
lock_acquire.part.0+0xb0/0x248
_raw_spin_lock+0x38/0x48
lan966x_ptp_irq_handler+0x164/0x2a8
irq_thread_fn+0x1c/0x78
irq_thread+0x130/0x278
kthread+0xec/0x110
ret_from_fork+0x14/0x28
SOFTIRQ-ON-W at:
lock_acquire.part.0+0xb0/0x248
_raw_spin_lock+0x38/0x48
lan966x_ptp_irq_handler+0x164/0x2a8
irq_thread_fn+0x1c/0x78
irq_thread+0x130/0x278
kthread+0xec/0x110
ret_from_fork+0x14/0x28
INITIAL USE at:
lock_acquire.part.0+0xb0/0x248
_raw_spin_lock_irqsave+0x4c/0x68
lan966x_ptp_txtstamp_request+0x128/0x1cc
lan966x_port_xmit+0x224/0x43c
dev_hard_start_xmit+0xa8/0x2f0
sch_direct_xmit+0x108/0x2e8
__dev_queue_xmit+0x41c/0x1224
packet_sendmsg+0xdb4/0x134c
__sys_sendto+0xd0/0x154
sys_send+0x18/0x20
ret_fast_syscall+0x0/0x1c
}
... key at: [<c174ba0c>] __key.2+0x0/0x8
... acquired at:
_raw_spin_lock_irqsave+0x4c/0x68
lan966x_ptp_txtstamp_request+0x128/0x1cc
lan966x_port_xmit+0x224/0x43c
dev_hard_start_xmit+0xa8/0x2f0
sch_direct_xmit+0x108/0x2e8
__dev_queue_xmit+0x41c/0x1224
packet_sendmsg+0xdb4/0x134c
__sys_sendto+0xd0/0x154
sys_send+0x18/0x20
ret_fast_syscall+0x0/0x1c-> (_xmit_ETHER#2){+.-.}-{2:2} {
HARDIRQ-ON-W at:
lock_acquire.part.0+0xb0/0x248
_raw_spin_lock+0x38/0x48
netif_freeze_queues+0x38/0x68
dev_deactivate_many+0xac/0x388
dev_deactivate+0x38/0x6c
linkwatch_do_dev+0x70/0x8c
__linkwatch_run_queue+0xd4/0x1e8
linkwatch_event+0x24/0x34
process_one_work+0x284/0x744
worker_thread+0x28/0x4bc
kthread+0xec/0x110
ret_from_fork+0x14/0x28
IN-SOFTIRQ-W at:
lock_acquire.part.0+0xb0/0x248
_raw_spin_lock+0x38/0x48
sch_direct_xmit+0x16c/0x2e8
__dev_queue_xmit+0x41c/0x1224
ip6_finish_output2+0x5f4/0xc64
ndisc_send_skb+0x4cc/0x81c
addrconf_rs_timer+0xb0/0x2f8
call_timer_fn+0xb4/0x33c
expire_timers+0xb4/0x10c
run_timer_softirq+0xf8/0x2a8
__do_softirq+0xd4/0x5fc
__irq_exit_rcu+0x138/0x17c
irq_exit+0x8/0x28
__irq_svc+0x90/0xbc
arch_cpu_idle+0x30/0x3c
default_idle_call+0x44/0xac
do_idle+0xc8/0x138
cpu_startup_entry+0x18/0x1c
rest_init+0xcc/0x168
arch_post_acpi_subsys_init+0x0/0x8
INITIAL USE at:
lock_acquire.part.0+0xb0/0x248
_raw_spin_lock+0x38/0x48
netif_freeze_queues+0x38/0x68
dev_deactivate_many+0xac/0x388
dev_deactivate+0x38/0x6c
linkwatch_do_dev+0x70/0x8c
__linkwatch_run_queue+0xd4/0x1e8
linkwatch_event+0x24/0x34
process_one_work+0x284/0x744
worker_thread+0x28/0x4bc
kthread+0xec/0x110
ret_from_fork+0x14/0x28
}
... key at: [<c175974c>] netdev_xmit_lock_key+0x8/0x1c8
... acquired at:
__lock_acquire+0x978/0x2978
lock_acquire.part.0+0xb0/0x248
_raw_spin_lock+0x38/0x48
sch_direct_xmit+0x16c/0x2e8
__dev_queue_xmit+0x41c/0x1224
ip6_finish_output2+0x5f4/0xc64
ndisc_send_skb+0x4cc/0x81c
addrconf_rs_timer+0xb0/0x2f8
call_timer_fn+0xb4/0x33c
expire_timers+0xb4/0x10c
run_timer_softirq+0xf8/0x2a8
__do_softirq+0xd4/0x5fc
__irq_exit_rcu+0x138/0x17c
irq_exit+0x8/0x28
__irq_svc+0x90/0xbc
arch_cpu_idle+0x30/0x3c
default_idle_call+0x44/0xac
do_idle+0xc8/0x138
cpu_startup_entry+0x18/0x1c
rest_init+0xcc/0x168
arch_post_acpi_subsys_init+0x0/0x8
stack backtrace:
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G N 6.2.0-rc7-01749-gc54e1f7f7e36 #2786
Hardware name: Generic DT based system
unwind_backtrace from show_stack+0x10/0x14
show_stack from dump_stack_lvl+0x58/0x70
dump_stack_lvl from mark_lock.part.0+0x59c/0x93c
mark_lock.part.0 from __lock_acquire+0x978/0x2978
__lock_acquire from lock_acquire.part.0+0xb0/0x248
lock_acquire.part.0 from _raw_spin_lock+0x38/0x48
_raw_spin_lock from sch_direct_xmit+0x16c/0x2e8
sch_direct_xmit from __dev_queue_xmit+0x41c/0x1224
__dev_queue_xmit from ip6_finish_output2+0x5f4/0xc64
ip6_finish_output2 from ndisc_send_skb+0x4cc/0x81c
ndisc_send_skb from addrconf_rs_timer+0xb0/0x2f8
addrconf_rs_timer from call_timer_fn+0xb4/0x33c
call_timer_fn from expire_timers+0xb4/0x10c
expire_timers from run_timer_softirq+0xf8/0x2a8
run_timer_softirq from __do_softirq+0xd4/0x5fc
__do_softirq from __irq_exit_rcu+0x138/0x17c
__irq_exit_rcu from irq_exit+0x8/0x28
irq_exit from __irq_svc+0x90/0xbc
Exception stack(0xc1001f20 to 0xc1001f68)1f20: ffffffff ffffffff 00000001 c011f840 c100e000 c100e000 c1009314 c1009370 1f40: c10f0c1a c0d5e564 c0f5da8c 00000000 00000000 c1001f70 c010f0bc c010f0c0 1f60: 600f0013 ffffffff
__irq_svc from arch_cpu_idle+0x30/0x3c
arch_cpu_idle from default_idle_call+0x44/0xac
default_idle_call from do_idle+0xc8/0x138
do_idle from cpu_startup_entry+0x18/0x1c
cpu_startup_entry from rest_init+0xcc/0x168
rest_init from arch_post_acpi_subsys_init+0x0/0x8
Fix this by using spin_lock_irqsave/spin_lock_irqrestore also inside lan966x_ptp_irq_handler.
--- drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c +2 -2
@@ -304,9 +304,9 @@ irqreturn_t lan966x_ptp_irq_handler(int irq, void *args)if (WARN_ON (!skb_match))continue ; -spin_lock (&lan966x->ptp_ts_id_lock); +spin_lock_irqsave (&lan966x->ptp_ts_id_lock, flags); lan966x->ptp_skbs--; -spin_unlock (&lan966x->ptp_ts_id_lock); +spin_unlock_irqrestore (&lan966x->ptp_ts_id_lock, flags);/* Get the h/w timestamp */ lan966x_get_hwtimestamp (lan966x, &ts, delay);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 260/885 net/mlx4_en: Introduce flexible array to silence overflow warning
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit f8f185e39b4de91bc5235e5be0d829bea69d9b06 ]
The call "skb_copy_from_linear_data(skb, inl + 1, spc)" triggers a FORTIFY memcpy() warning on ppc64 platform:
In function ‘fortify_memcpy_chk’,
inlined from ‘skb_copy_from_linear_data’ at ./include/linux/skbuff.h:4029:2, inlined from ‘build_inline_wqe’ at drivers/net/ethernet/mellanox/mlx4/en_tx.c:722:4, inlined from ‘mlx4_en_xmit’ at drivers/net/ethernet/mellanox/mlx4/en_tx.c:1066:3:./include/linux/fortify-string.h:513:25: error: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
513 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Same behaviour on x86 you can get if you use "__always_inline" instead of "inline" for skb_copy_from_linear_data() in skbuff.h
The call here copies data into inlined tx destricptor, which has 104 bytes (MAX_INLINE) space for data payload. In this case "spc" is known in compile-time but the destination is used with hidden knowledge (real structure of destination is different from that the compiler can see). That cause the fortify warning because compiler can check bounds, but the real bounds are different. "spc" can't be bigger than 64 bytes (MLX4_INLINE_ALIGN), so the data can always fit into inlined tx descriptor. The fact that "inl" points into inlined tx descriptor is determined earlier in mlx4_en_xmit().
Avoid confusing the compiler with "inl + 1" constructions to get to past the inl header by introducing a flexible array "data" to the struct so that the compiler can see that we are not dealing with an array of inl structs, but rather, arbitrary data following the structure. There are no changes to the structure layout reported by pahole, and the resulting machine code is actually smaller.
--- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 22 +++++++++++----------- include/linux/mlx4/qp.h | 1 + 2 files changed, 12 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_tx.c +11 -11
@@ -697,32 +697,32 @@ static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc, inl->byte_count =cpu_to_be32 (1 <<31 | skb->len); }else { inl->byte_count =cpu_to_be32 (1 <<31 |MIN_PKT_LEN ); -memset (((void *)(inl +1 )) + skb->len,0 , +memset (inl->data + skb->len,0 ,MIN_PKT_LEN - skb->len); } -skb_copy_from_linear_data (skb, inl +1 , hlen); +skb_copy_from_linear_data (skb, inl->data, hlen);if (shinfo->nr_frags) -memcpy (((void *)(inl +1 )) + hlen, fragptr, +memcpy (inl->data + hlen, fragptr,skb_frag_size (&shinfo->frags[0 ])); }else { inl->byte_count =cpu_to_be32 (1 <<31 | spc);if (hlen <= spc) { -skb_copy_from_linear_data (skb, inl +1 , hlen); +skb_copy_from_linear_data (skb, inl->data, hlen);if (hlen < spc) { -memcpy (((void *)(inl +1 )) + hlen, +memcpy (inl->data + hlen, fragptr, spc - hlen); fragptr += spc - hlen; } - inl = (void *) (inl +1 ) + spc; -memcpy (((void *)(inl +1 )), fragptr, skb->len - spc); + inl = (void *)inl->data + spc; +memcpy (inl->data, fragptr, skb->len - spc); }else { -skb_copy_from_linear_data (skb, inl +1 , spc); - inl = (void *) (inl +1 ) + spc; -skb_copy_from_linear_data_offset (skb, spc, inl +1 , +skb_copy_from_linear_data (skb, inl->data, spc); + inl = (void *)inl->data + spc; +skb_copy_from_linear_data_offset (skb, spc, inl->data, hlen - spc);if (shinfo->nr_frags) -memcpy (((void *)(inl +1 )) + hlen - spc, +memcpy (inl->data + hlen - spc, fragptr,skb_frag_size (&shinfo->frags[0 ])); }
include/linux/mlx4/qp.h +1 -0
@@ -446,6 +446,7 @@ enum {struct mlx4_wqe_inline_seg {__be32 byte_count; +__u8 data[]; };enum mlx4_update_qp_attr {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 261/885 selftest: fib_tests: Always cleanup before exit
In reply to Greg Kroah-HartmanFrom: Roxana Nicolescu <[email protected]>
[ Upstream commit b60417a9f2b890a8094477b2204d4f73c535725e ]
Usage of set -e before executing a command causes immediate exit on failure, without cleanup up the resources allocated at setup. This can affect the next tests that use the same resources, leading to a chain of failures.
A simple fix is to always call cleanup function when the script exists. This approach is already used by other existing tests.
--- tools/testing/selftests/net/fib_tests.sh | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/net/fib_tests.sh +2 -0
@@ -2065,6 +2065,8 @@ EOF ################################################################################ # main +trap cleanup EXIT + while getopts :t:pPhv o do case $o in
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 262/885 sefltests: netdevsim: wait for devlink instance after netns removal
In reply to Greg Kroah-HartmanFrom: Jiri Pirko <[email protected]>
[ Upstream commit f922c7b1c1c45740d329bf248936fdb78c0cff6e ]
When devlink instance is put into network namespace and that network namespace gets deleted, devlink instance is moved back into init_ns. This is done as a part of cleanup_net() routine. Since cleanup_net() is called asynchronously from workqueue, there is no guarantee that the devlink instance move is done after "ip netns del" returns.
So fix this race by making sure that the devlink instance is present before any other operation.
--- .../selftests/drivers/net/netdevsim/devlink.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tools/testing/selftests/drivers/net/netdevsim/devlink.sh +18 -0
@@ -17,6 +17,18 @@ SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV_NAME/net/ DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV_NAME/ DL_HANDLE=netdevsim/$DEV_NAME +wait_for_devlink() +{ + "$@" | grep -q $DL_HANDLE +} + +devlink_wait() +{ + local timeout=$1 + + busywait "$timeout" wait_for_devlink devlink dev +} + fw_flash_test() { RET=0
@@ -256,6 +268,9 @@ netns_reload_test() ip netns del testns2 ip netns del testns1 + # Wait until netns async cleanup is done. + devlink_wait 2000 + log_test "netns reload test" }
@@ -348,6 +363,9 @@ resource_test() ip netns del testns2 ip netns del testns1 + # Wait until netns async cleanup is done. + devlink_wait 2000 + log_test "resource test" }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 263/885 drm: Fix potential null-ptr-deref due to drmm_mode_config_init()
In reply to Greg Kroah-HartmanFrom: Shang XiaoJing <[email protected]>
[ Upstream commit 834c23e4f798dcdc8af251b3c428ceef94741991 ]
drmm_mode_config_init() will call drm_mode_create_standard_properties() and won't check the ret value. When drm_mode_create_standard_properties() failed due to alloc, property will be a NULL pointer and may causes the null-ptr-deref. Fix the null-ptr-deref by adding the ret value check.
Found null-ptr-deref while testing insert module bochs:
general protection fault, probably for non-canonical address
0xdffffc000000000c: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000060-0x0000000000000067]
CPU: 3 PID: 249 Comm: modprobe Not tainted 6.1.0-rc1+ #364
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
RIP: 0010:drm_object_attach_property+0x73/0x3c0 [drm]
Call Trace:
<TASK>
__drm_connector_init+0xb6c/0x1100 [drm]
bochs_pci_probe.cold.11+0x4cb/0x7fe [bochs]
pci_device_probe+0x17d/0x340
really_probe+0x1db/0x5d0
__driver_probe_device+0x1e7/0x250
driver_probe_device+0x4a/0x120
__driver_attach+0xcd/0x2c0
bus_for_each_dev+0x11a/0x1b0
bus_add_driver+0x3d7/0x500
driver_register+0x18e/0x320
do_one_initcall+0xc4/0x3e0
do_init_module+0x1b4/0x630
load_module+0x5dca/0x7230
__do_sys_finit_module+0x100/0x170
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7ff65af9f839--- drivers/gpu/drm/drm_mode_config.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_mode_config.c +7 -1
@@ -399,6 +399,8 @@ static void drm_mode_config_init_release(struct drm_device *dev, void *ptr)*/ int drmm_mode_config_init (struct drm_device *dev) { +int ret; +mutex_init (&dev->mode_config.mutex);drm_modeset_lock_init (&dev->mode_config.connection_mutex);mutex_init (&dev->mode_config.idr_mutex);
@@ -420,7 +422,11 @@ int drmm_mode_config_init(struct drm_device *dev)init_llist_head (&dev->mode_config.connector_free_list);INIT_WORK (&dev->mode_config.connector_free_work, drm_connector_free_work_fn); -drm_mode_create_standard_properties (dev); + ret =drm_mode_create_standard_properties (dev); +if (ret) { +drm_mode_config_cleanup (dev); +return ret; + }/* Just to be sure */ dev->mode_config.num_fb =0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 264/885 drm/fourcc: Add missing big-endian XRGB1555 and RGB565 formats
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 6fb6c979ca628583d4d0c59a0f8ff977e581ecc0 ]
As of commit eae06120f1974e1a ("drm: refuse ADDFB2 ioctl for broken bigendian drivers"), drivers must set the quirk_addfb_prefer_host_byte_order quirk to make the drm_mode_addfb() compat code work correctly on big-endian machines.
While that works fine for big-endian XRGB8888 and ARGB8888, which are mapped to the existing little-endian BGRX8888 and BGRA8888 formats, it does not work for big-endian XRGB1555 and RGB565, as the latter are not listed in the format database.
Fix this by adding the missing formats. Limit this to big-endian platforms, as there is currently no need to support these formats on little-endian platforms.
--- drivers/gpu/drm/drm_fourcc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/drm_fourcc.c +4 -0
@@ -190,6 +190,10 @@ const struct drm_format_info *__drm_format_info(u32 format) { .format = DRM_FORMAT_BGRA5551, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true }, { .format = DRM_FORMAT_RGB565, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, { .format = DRM_FORMAT_BGR565, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, +#ifdef __BIG_ENDIAN + { .format = DRM_FORMAT_XRGB1555 | DRM_FORMAT_BIG_ENDIAN, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, + { .format = DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 }, +#endif { .format = DRM_FORMAT_RGB888, .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 }, { .format = DRM_FORMAT_BGR888, .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 }, { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 265/885 drm/bridge: ti-sn65dsi83: Fix delay after reset deassert to match spec
In reply to Greg Kroah-HartmanFrom: Frieder Schrempf <[email protected]>
[ Upstream commit 4b03d5e0d3e86ee492d54254927d020dc0fe8acf ]
The datasheet specifies a delay of 10 milliseconds, but the current driver only waits for 1 ms. Fix this to make sure the initialization sequence meets the spec.
--- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ti-sn65dsi83.c +1 -1
@@ -346,7 +346,7 @@ static void sn65dsi83_atomic_enable(struct drm_bridge *bridge,/* Deassert reset */ gpiod_set_value_cansleep (ctx->enable_gpio,1 ); -usleep_range (1000 ,1100 ); +usleep_range (10000 ,11000 );/* Get the LVDS format from the bridge state. */ bridge_state =drm_atomic_get_new_bridge_state (state, bridge);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 266/885 drm: mxsfb: DRM_IMX_LCDIF should depend on ARCH_MXC
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 10ef5f2992006720318b9886961820155b3750fd ]
The Freescale/NXP i.MX LCDIFv3 LCD controller is only present on Freescale/NXP i.MX SoCs. Hence add a dependency on ARCH_MXC, to prevent asking the user about this driver when configuring a kernel without Freescale/NXP i.MX support.
--- drivers/gpu/drm/mxsfb/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/mxsfb/Kconfig +1 -0
@@ -24,6 +24,7 @@ config DRM_IMX_LCDIF tristate "i.MX LCDIFv3 LCD controller" depends on DRM && OF depends on COMMON_CLK + depends on ARCH_MXC || COMPILE_TEST select DRM_MXS select DRM_KMS_HELPER select DRM_GEM_DMA_HELPER
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 267/885 drm: mxsfb: DRM_MXSFB should depend on ARCH_MXS || ARCH_MXC
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 7783cc67862f9166c901bfa0f80b717aa8d354dd ]
Freescale/NXP i.MX LCDIF and eLCDIF LCD controllers are only present on Freescale/NXP i.MX SoCs. Hence add a dependency on ARCH_MXS || ARCH_MXC, to prevent asking the user about this driver when configuring a kernel without Freescale/NXP i.MX support.
--- drivers/gpu/drm/mxsfb/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/mxsfb/Kconfig +1 -0
@@ -8,6 +8,7 @@ config DRM_MXSFB tristate "i.MX (e)LCDIF LCD controller" depends on DRM && OF depends on COMMON_CLK + depends on ARCH_MXS || ARCH_MXC || COMPILE_TEST select DRM_MXS select DRM_KMS_HELPER select DRM_GEM_DMA_HELPER
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 268/885 drm/bridge: megachips: Fix error handling in i2c_register_driver()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit 4ecff954c370b82bce45bdca2846c5c5563e8a8a ]
A problem about insmod megachips-stdpxxxx-ge-b850v3-fw.ko failed is triggered with the following log given:
[ 4497.981497] Error: Driver 'stdp4028-ge-b850v3-fw' is already registered, aborting...
insmod: ERROR: could not insert module megachips-stdpxxxx-ge-b850v3-fw.ko: Device or resource busy
The reason is that stdpxxxx_ge_b850v3_init() returns i2c_add_driver() directly without checking its return value, if i2c_add_driver() failed, it returns without calling i2c_del_driver() on the previous i2c driver, resulting the megachips-stdpxxxx-ge-b850v3-fw can never be installed later.
A simple call graph is shown as below:
stdpxxxx_ge_b850v3_init()
i2c_add_driver(&stdp4028_ge_b850v3_fw_driver)
i2c_add_driver(&stdp2690_ge_b850v3_fw_driver)
i2c_register_driver()
driver_register()
bus_add_driver()
priv = kzalloc(...) # OOM happened
# return without delete stdp4028_ge_b850v3_fw_driver
Fix by calling i2c_del_driver() on stdp4028_ge_b850v3_fw_driver when i2c_add_driver() returns error.
--- drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +5 -1
@@ -440,7 +440,11 @@ static int __init stdpxxxx_ge_b850v3_init(void)if (ret)return ret; -return i2c_add_driver (&stdp2690_ge_b850v3_fw_driver); + ret =i2c_add_driver (&stdp2690_ge_b850v3_fw_driver); +if (ret) +i2c_del_driver (&stdp4028_ge_b850v3_fw_driver); + +return ret; }module_init (stdpxxxx_ge_b850v3_init);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 269/885 drm/vkms: Fix memory leak in vkms_init()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit 0d0b368b9d104b437e1f4850ae94bdb9a3601e89 ]
A memory leak was reported after the vkms module install failed.
unreferenced object 0xffff88810bc28520 (size 16):
comm "modprobe", pid 9662, jiffies 4298009455 (age 42.590s) hex dump (first 16 bytes):
01 01 00 64 81 88 ff ff 00 00 dc 0a 81 88 ff ff ...d............
backtrace:
[<00000000e7561ff8>] kmalloc_trace+0x27/0x60
[<000000000b1954a0>] 0xffffffffc45200a9
[<00000000abbf1da0>] do_one_initcall+0xd0/0x4f0
[<000000001505ee87>] do_init_module+0x1a4/0x680
[<00000000958079ad>] load_module+0x6249/0x7110
[<00000000117e4696>] __do_sys_finit_module+0x140/0x200
[<00000000f74b12d2>] do_syscall_64+0x35/0x80
[<000000008fc6fcde>] entry_SYSCALL_64_after_hwframe+0x46/0xb0The reason is that the vkms_init() returns without checking the return value of vkms_create(), and if the vkms_create() failed, the config allocated at the beginning of vkms_init() is leaked.
vkms_init()
config = kmalloc(...) # config allocated
...
return vkms_create() # vkms_create failed and config is leaked
Fix this problem by checking return value of vkms_create() and free the config if error happened.
--- drivers/gpu/drm/vkms/vkms_drv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_drv.c +6 -1
@@ -218,6 +218,7 @@ static int vkms_create(struct vkms_config *config)static int __init vkms_init (void ) { +int ret;struct vkms_config *config; config =kmalloc (sizeof (*config),GFP_KERNEL );
@@ -230,7 +231,11 @@ static int __init vkms_init(void) config->writeback = enable_writeback; config->overlay = enable_overlay; -return vkms_create (config); + ret =vkms_create (config); +if (ret) +kfree (config); + +return ret; }static void vkms_destroy (struct vkms_config *config)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 270/885 drm/vkms: Fix null-ptr-deref in vkms_release()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit 2fe2a8f40c21161ffe7653cc234e7934db5b7cc5 ]
A null-ptr-deref is triggered when it tries to destroy the workqueue in vkms->output.composer_workq in vkms_release().
KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f] CPU: 5 PID: 17193 Comm: modprobe Not tainted 6.0.0-11331-gd465bff130bf #24 RIP: 0010:destroy_workqueue+0x2f/0x710 ... Call Trace: <TASK> ? vkms_config_debugfs_init+0x50/0x50 [vkms] __devm_drm_dev_alloc+0x15a/0x1c0 [drm] vkms_init+0x245/0x1000 [vkms] do_one_initcall+0xd0/0x4f0 do_init_module+0x1a4/0x680 load_module+0x6249/0x7110 __do_sys_finit_module+0x140/0x200 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0
The reason is that an OOM happened which triggers the destroy of the workqueue, however, the workqueue is alloced in the later process, thus a null-ptr-deref happened. A simple call graph is shown as below:
vkms_init()
vkms_create()
devm_drm_dev_alloc()
__devm_drm_dev_alloc()
devm_drm_dev_init()
devm_add_action_or_reset()
devm_add_action() # an error happened
devm_drm_dev_init_release()
drm_dev_put()
kref_put()
drm_dev_release()
vkms_release()
destroy_workqueue() # null-ptr-deref happened
vkms_modeset_init()
vkms_output_init()
vkms_crtc_init() # where the workqueue get allocatedFix this by checking if composer_workq is NULL before passing it to the destroy_workqueue() in vkms_release().
--- drivers/gpu/drm/vkms/vkms_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_drv.c +2 -1
@@ -57,7 +57,8 @@ static void vkms_release(struct drm_device *dev) {struct vkms_device *vkms =drm_device_to_vkms_device (dev); -destroy_workqueue (vkms->output.composer_workq); +if (vkms->output.composer_workq) +destroy_workqueue (vkms->output.composer_workq); }static void vkms_atomic_commit_tail (struct drm_atomic_state *old_state)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 271/885 drm/vc4: dpi: Fix format mapping for RGB565
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit 0870d86eac8a9abd89a0be1b719d5dc5bac936f0 ]
The mapping is incorrect for RGB565_1X16 as it should be DPI_FORMAT_18BIT_666_RGB_1 instead of DPI_FORMAT_18BIT_666_RGB_3.
--- drivers/gpu/drm/vc4/vc4_dpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_dpi.c +1 -1
@@ -179,7 +179,7 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) DPI_FORMAT);break ;case MEDIA_BUS_FMT_RGB565_1X16 : - dpi_c |=VC4_SET_FIELD (DPI_FORMAT_16BIT_565_RGB_3 , + dpi_c |=VC4_SET_FIELD (DPI_FORMAT_16BIT_565_RGB_1 ,DPI_FORMAT );break ;default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 272/885 drm: tidss: Fix pixel format definition
In reply to Greg Kroah-HartmanFrom: Randolph Sapp <[email protected]>
[ Upstream commit 2df0433b18f2735a49d2c3a968b40fa2881137c0 ]
There was a long-standing bug from a typo that created 2 ARGB1555 and ABGR1555 pixel format entries. Weston 10 has a sanity check that alerted me to this issue.
According to the Supported Pixel Data formats table we have the later entries should have been for Alpha-X instead.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +2 -2
@@ -1858,8 +1858,8 @@ static const struct { { DRM_FORMAT_XBGR4444, 0x21, }, { DRM_FORMAT_RGBX4444, 0x22, }, - { DRM_FORMAT_ARGB1555, 0x25, }, - { DRM_FORMAT_ABGR1555, 0x26, }, + { DRM_FORMAT_XRGB1555, 0x25, }, + { DRM_FORMAT_XBGR1555, 0x26, }, { DRM_FORMAT_XRGB8888, 0x27, }, { DRM_FORMAT_XBGR8888, 0x28, },
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 273/885 gpu: ipu-v3: common: Add of_node_put() for reference returned by of_graph_get_port_by_id()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 9afdf98cfdfa2ba8ec068cf08c5fcdc1ed8daf3f ]
In ipu_add_client_devices(), we need to call of_node_put() for reference returned by of_graph_get_port_by_id() in fail path.
--- drivers/gpu/ipu-v3/ipu-common.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/ipu-v3/ipu-common.c +1 -0
@@ -1165,6 +1165,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) pdev =platform_device_alloc (reg->name, id++);if (!pdev) { ret = -ENOMEM ; +of_node_put (of_node); goto err_register; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 274/885 drm/vc4: drop all currently held locks if deadlock happens
In reply to Greg Kroah-HartmanFrom: Maíra Canal <[email protected]>
[ Upstream commit 479d4f0be4237ba33bc9432787aeb62c90e30f95 ]
If vc4_hdmi_reset_link() returns -EDEADLK, it means that a deadlock happened in the locking context. This situation should be addressed by dropping all currently held locks and block until the contended lock becomes available. Currently, vc4 is not dealing with the deadlock properly, producing the following output when PROVE_LOCKING is enabled:
[ 825.612809] ------------[ cut here ]------------ [ 825.612852] WARNING: CPU: 1 PID: 116 at drivers/gpu/drm/drm_modeset_lock.c:276 drm_modeset_drop_locks+0x60/0x68 [drm] [ 825.613458] Modules linked in: 8021q mrp garp stp llc
raspberrypi_cpufreq brcmfmac brcmutil crct10dif_ce hci_uart cfg80211 btqca btbcm bluetooth vc4 raspberrypi_hwmon snd_soc_hdmi_codec cec clk_raspberrypi ecdh_generic drm_display_helper ecc rfkill drm_dma_helper drm_kms_helper pwm_bcm2835 bcm2835_thermal bcm2835_rng rng_core i2c_bcm2835 drm fuse ip_tables x_tables ipv6
[ 825.613735] CPU: 1 PID: 116 Comm: kworker/1:2 Tainted: G W 6.1.0-rc6-01399-g941aae326315 #3 [ 825.613759] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT) [ 825.613777] Workqueue: events output_poll_execute [drm_kms_helper] [ 825.614038] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 825.614063] pc : drm_modeset_drop_locks+0x60/0x68 [drm] [ 825.614603] lr : drm_helper_probe_detect+0x120/0x1b4 [drm_kms_helper] [ 825.614829] sp : ffff800008313bf0 [ 825.614844] x29: ffff800008313bf0 x28: ffffcd7778b8b000 x27: 0000000000000000 [ 825.614883] x26: 0000000000000001 x25: 0000000000000001 x24: ffff677cc35c2758 [ 825.614920] x23: ffffcd7707d01430 x22: ffffcd7707c3edc7 x21: 0000000000000001 [ 825.614958] x20: 0000000000000000 x19: ffff800008313c10 x18: 000000000000b6d3 [ 825.614995] x17: ffffcd777835e214 x16: ffffcd7777cef870 x15: fffff81000000000 [ 825.615033] x14: 0000000000000000 x13: 0000000000000099 x12: 0000000000000002 [ 825.615070] x11: 72917988020af800 x10: 72917988020af800 x9 : 72917988020af800 [ 825.615108] x8 : ffff677cc665e0a8 x7 : d00a8c180000110c x6 : ffffcd77774c0054 [ 825.615145] x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000 [ 825.615181] x2 : ffff677cc55e1880 x1 : ffffcd7777cef8ec x0 : ffff800008313c10 [ 825.615219] Call trace: [ 825.615232] drm_modeset_drop_locks+0x60/0x68 [drm] [ 825.615773] drm_helper_probe_detect+0x120/0x1b4 [drm_kms_helper] [ 825.616003] output_poll_execute+0xe4/0x224 [drm_kms_helper] [ 825.616233] process_one_work+0x2b4/0x618 [ 825.616264] worker_thread+0x24c/0x464 [ 825.616288] kthread+0xec/0x110 [ 825.616310] ret_from_fork+0x10/0x20 [ 825.616335] irq event stamp: 7634 [ 825.616349] hardirqs last enabled at (7633): [<ffffcd777831ee90>] _raw_spin_unlock_irq+0x3c/0x78 [ 825.616384] hardirqs last disabled at (7634): [<ffffcd7778315a78>] __schedule+0x134/0x9f0 [ 825.616411] softirqs last enabled at (7630): [<ffffcd7707aacea0>] local_bh_enable+0x4/0x30 [ipv6] [ 825.617019] softirqs last disabled at (7618): [<ffffcd7707aace70>] local_bh_disable+0x4/0x30 [ipv6] [ 825.617586] ---[ end trace 0000000000000000 ]---
Therefore, deal with the deadlock as suggested by [1], using the function drm_modeset_backoff().
[1] https://docs.kernel.org/gpu/drm-kms.html?highlight=kms#kms-locking
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +10 -1
@@ -402,6 +402,7 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, {struct drm_connector *connector = &vc4_hdmi->connector;struct edid *edid; +int ret;/* * NOTE: This function should really be called with
@@ -430,7 +431,15 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,cec_s_phys_addr_from_edid (vc4_hdmi->cec_adap, edid);kfree (edid); -vc4_hdmi_reset_link (connector, ctx); +for (;;) { + ret =vc4_hdmi_reset_link (connector, ctx); +if (ret == -EDEADLK ) { +drm_modeset_backoff (ctx); +continue ; + } + +break ; + } } static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 275/885 hwmon: (ftsteutates) Fix scaling of measurements
In reply to Greg Kroah-HartmanFrom: Armin Wolf <[email protected]>
[ Upstream commit ca8fd8c16a8b77dfcf7f6ce52d2c863220693a78 ]
A user complained that the ftsteutates driver was displaying bogus values since its introduction. This happens because the sensor measurements need to be scaled in order to produce meaningful results:
- the fan speed needs to be multiplied by 60 since its in RPS
- the temperature is in degrees celsius and needs an offset of 64
- the voltage is in 1/256 of 3.3V
The offical datasheet says the voltage needs to be divided by 256, but this is likely an off-by-one-error, since even the BIOS devides by 255 (otherwise 3.3V could not be measured).
The voltage channels additionally need a board-specific multiplier, however this can be done by the driver since its board-specific.
The reason the missing scaling of measurements is the way Fujitsu used this driver when it was still out-of-tree. Back then, all scaling was done in userspace by libsensors, even the generic one.
Tested on a Fujitsu DS3401-B1.
--- Documentation/hwmon/ftsteutates.rst | 4 ++++ drivers/hwmon/ftsteutates.c | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-)
Documentation/hwmon/ftsteutates.rst +4 -0
@@ -22,6 +22,10 @@ enhancements. It can monitor up to 4 voltages, 16 temperatures and 8 fans. It also contains an integrated watchdog which is currently implemented in this driver. +The 4 voltages require a board-specific multiplier, since the BMC can +only measure voltages up to 3.3V and thus relies on voltage dividers. +Consult your motherboard manual for details. + To clear a temperature or fan alarm, execute the following command with the correct path to the alarm file::
drivers/hwmon/ftsteutates.c +13 -6
@@ -12,6 +12,7 @@#include <linux/i2c.h> #include <linux/init.h> #include <linux/jiffies.h> +#include <linux/math.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/slab.h>
@@ -347,13 +348,15 @@ static ssize_t in_value_show(struct device *dev, {struct fts_data *data =dev_get_drvdata (dev);int index =to_sensor_dev_attr (devattr)->index; -int err; +int value, err; err =fts_update_device (data);if (err <0 )return err; -return sprintf (buf,"%u\n" , data->volt[index]); + value =DIV_ROUND_CLOSEST (data->volt[index] *3300 ,255 ); + +return sprintf (buf,"%d\n" , value); } static ssize_t temp_value_show(struct device *dev,
@@ -361,13 +364,15 @@ static ssize_t temp_value_show(struct device *dev, {struct fts_data *data =dev_get_drvdata (dev);int index =to_sensor_dev_attr (devattr)->index; -int err; +int value, err; err =fts_update_device (data);if (err <0 )return err; -return sprintf (buf,"%u\n" , data->temp_input[index]); + value = (data->temp_input[index] -64 ) *1000 ; + +return sprintf (buf,"%d\n" , value); } static ssize_t temp_fault_show(struct device *dev,
@@ -436,13 +441,15 @@ static ssize_t fan_value_show(struct device *dev, {struct fts_data *data =dev_get_drvdata (dev);int index =to_sensor_dev_attr (devattr)->index; -int err; +int value, err; err =fts_update_device (data);if (err <0 )return err; -return sprintf (buf,"%u\n" , data->fan_input[index]); + value = data->fan_input[index] *60 ; + +return sprintf (buf,"%d\n" , value); } static ssize_t fan_source_show(struct device *dev,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 276/885 drm/msm/dpu: check for null return of devm_kzalloc() in dpu_writeback_init()
In reply to Greg Kroah-HartmanFrom: Hui Tang <[email protected]>
[ Upstream commit 21e9a838f505178e109ccb3bf19d7808eb0326f4 ]
Because of the possilble failure of devm_kzalloc(), dpu_wb_conn might be NULL and will cause null pointer dereference later.
Therefore, it might be better to check it and directly return -ENOMEM.
Patchwork: https://patchwork.freedesktop.org/patch/512277/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c +2 -0
@@ -70,6 +70,8 @@ int dpu_writeback_init(struct drm_device *dev, struct drm_encoder *enc,int rc =0 ; dpu_wb_conn =devm_kzalloc (dev->dev,sizeof (*dpu_wb_conn),GFP_KERNEL ); +if (!dpu_wb_conn) +return -ENOMEM ;drm_connector_helper_add (&dpu_wb_conn->base.base, &dpu_wb_conn_helper_funcs);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 277/885 drm/msm/hdmi: Add missing check for alloc_ordered_workqueue
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit afe4cb96153a0d8003e4e4ebd91b5c543e10df84 ]
Add check for the return value of alloc_ordered_workqueue as it may return NULL pointer and cause NULL pointer dereference in hdmi_hdcp.c and hdmi_hpd.c.
Patchwork: https://patchwork.freedesktop.org/patch/517211/
--- drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/hdmi/hdmi.c +4 -0
@@ -255,6 +255,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)devm_pm_runtime_enable (&pdev->dev); hdmi->workq =alloc_ordered_workqueue ("msm_hdmi" ,0 ); +if (!hdmi->workq) { + ret = -ENOMEM ; + goto fail; + } hdmi->i2c =msm_hdmi_i2c_init (hdmi);if (IS_ERR (hdmi->i2c)) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 278/885 pinctrl: qcom: pinctrl-msm8976: Correct function names for wcss pins
In reply to Greg Kroah-HartmanFrom: Adam Skladowski <[email protected]>
[ Upstream commit a7cc0e2685082a0d79baec02df184dfa83cbfac3 ]
Adjust names of function for wcss pins, also fix third gpio in bt group.
--- drivers/pinctrl/qcom/pinctrl-msm8976.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/qcom/pinctrl-msm8976.c +4 -4
@@ -733,7 +733,7 @@ static const char * const codec_int2_groups[] = { "gpio74", };static const char *const wcss_bt_groups[] = { -"gpio39" ,"gpio47" ,"gpio88" , +"gpio39" ,"gpio47" ,"gpio48" , };static const char *const sdc3_groups[] = {"gpio39" ,"gpio40" ,"gpio41" ,
@@ -958,9 +958,9 @@ static const struct msm_pingroup msm8976_groups[] = {PINGROUP (37 ,NA ,NA ,NA , qdss_tracedata_b,NA ,NA ,NA ,NA ,NA ),PINGROUP (38 ,NA ,NA ,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b,NA ),PINGROUP (39 , wcss_bt, sdc3,NA , qdss_tracedata_a,NA ,NA ,NA ,NA ,NA ), -PINGROUP (40 , wcss_wlan, sdc3,NA , qdss_tracedata_a,NA ,NA ,NA ,NA ,NA ), -PINGROUP (41 , wcss_wlan, sdc3,NA , qdss_tracedata_a,NA ,NA ,NA ,NA ,NA ), -PINGROUP (42 , wcss_wlan, sdc3,NA , qdss_tracedata_a,NA ,NA ,NA ,NA ,NA ), +PINGROUP (40 , wcss_wlan2, sdc3,NA , qdss_tracedata_a,NA ,NA ,NA ,NA ,NA ), +PINGROUP (41 , wcss_wlan1, sdc3,NA , qdss_tracedata_a,NA ,NA ,NA ,NA ,NA ), +PINGROUP (42 , wcss_wlan0, sdc3,NA , qdss_tracedata_a,NA ,NA ,NA ,NA ,NA ),PINGROUP (43 , wcss_wlan, sdc3,NA ,NA , qdss_tracedata_a,NA ,NA ,NA ,NA ),PINGROUP (44 , wcss_wlan, sdc3,NA ,NA ,NA ,NA ,NA ,NA ,NA ), PINGROUP(45, wcss_fm, NA, qdss_tracectl_a, NA, NA, NA, NA, NA, NA),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 279/885 pinctrl: stm32: Fix refcount leak in stm32_pctrl_get_irq_domain
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit dcef18c8ac40aa85bb339f64c1dd31dd458b06fb ]
of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -0
@@ -1380,6 +1380,7 @@ static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pdereturn ERR_PTR (-ENXIO ); domain =irq_find_host (parent); +of_node_put (parent);if (!domain)/* domain not registered yet */ return ERR_PTR (-EPROBE_DEFER );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 280/885 pinctrl: rockchip: Fix refcount leak in rockchip_pinctrl_parse_groups
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit c818ae563bf99457f02e8170aabd6b174f629f65 ]
of_find_node_by_phandle() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore.
Add missing of_node_put() to avoid refcount leak.
--- drivers/pinctrl/pinctrl-rockchip.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/pinctrl-rockchip.c +1 -0
@@ -3045,6 +3045,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np, np_config =of_find_node_by_phandle (be32_to_cpup (phandle)); ret =pinconf_generic_parse_dt_config (np_config,NULL , &grp->data[j].configs, &grp->data[j].nconfigs); +of_node_put (np_config);if (ret)return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 281/885 drm/vc4: hvs: Set AXI panic modes
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit df993fced230daa8452892406f3180c93ebf7e7b ]
The HVS can change AXI request mode based on how full the COB FIFOs are.
Until now the vc4 driver has been relying on the firmware to have set these to sensible values.
With HVS channel 2 now being used for live video, change the panic mode for all channels to be explicitly set by the driver, and the same for all channels.
--- drivers/gpu/drm/vc4/vc4_hvs.c | 11 +++++++++++ drivers/gpu/drm/vc4/vc4_regs.h | 6 ++++++ 2 files changed, 17 insertions(+)
drivers/gpu/drm/vc4/vc4_hvs.c +11 -0
@@ -884,6 +884,17 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)SCALER_DISPCTRL_DSPEISLUR (2 ) | SCALER_DISPCTRL_SCLEIRQ); +/* Set AXI panic mode. +* VC4 panics when < 2 lines in FIFO. +* VC5 panics when less than 1 line in the FIFO. +*/ + dispctrl &= ~(SCALER_DISPCTRL_PANIC0_MASK | +SCALER_DISPCTRL_PANIC1_MASK | +SCALER_DISPCTRL_PANIC2_MASK ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC0 ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC1 ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC2 ); +HVS_WRITE (SCALER_DISPCTRL , dispctrl); ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
drivers/gpu/drm/vc4/vc4_regs.h +6 -0
@@ -220,6 +220,12 @@#define SCALER_DISPCTRL 0x00000000/* Global register for clock gating the HVS */ # define SCALER_DISPCTRL_ENABLE BIT(31) +# define SCALER_DISPCTRL_PANIC0_MASK VC4_MASK(25, 24) +# define SCALER_DISPCTRL_PANIC0_SHIFT 24 +# define SCALER_DISPCTRL_PANIC1_MASK VC4_MASK(27, 26) +# define SCALER_DISPCTRL_PANIC1_SHIFT 26 +# define SCALER_DISPCTRL_PANIC2_MASK VC4_MASK(29, 28) +# define SCALER_DISPCTRL_PANIC2_SHIFT 28# define SCALER_DISPCTRL_DSP3_MUX_MASK VC4_MASK(19, 18)# define SCALER_DISPCTRL_DSP3_MUX_SHIFT 18
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 282/885 drm/vc4: hvs: SCALER_DISPBKGND_AUTOHS is only valid on HVS4
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit 982ee94486863a41c6af9f2ab3f6681f72bc5c48 ]
The bit used for SCALER_DISPBKGND_AUTOHS in SCALER_DISPBKGNDX has been repurposed on HVS5 to configure whether a display can win back-to-back arbitration wins for the COB.
This is not desirable, therefore only select this bit on HVS4, and explicitly clear it on HVS5.
--- drivers/gpu/drm/vc4/vc4_hvs.c | 10 ++++++---- drivers/gpu/drm/vc4/vc4_regs.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_hvs.c +6 -4
@@ -368,28 +368,30 @@ static int vc4_hvs_init_channel(struct vc4_hvs *hvs, struct drm_crtc *crtc,* mode. */ dispctrl =SCALER_DISPCTRLX_ENABLE ; + dispbkgndx =HVS_READ (SCALER_DISPBKGNDX (chan)); -if (!vc4->is_vc5) +if (!vc4->is_vc5) { dispctrl |=VC4_SET_FIELD (mode->hdisplay,SCALER_DISPCTRLX_WIDTH ) |VC4_SET_FIELD (mode->vdisplay,SCALER_DISPCTRLX_HEIGHT ) | (oneshot ?SCALER_DISPCTRLX_ONESHOT :0 ); -else + dispbkgndx |=SCALER_DISPBKGND_AUTOHS ; + }else { dispctrl |=VC4_SET_FIELD (mode->hdisplay,SCALER5_DISPCTRLX_WIDTH ) |VC4_SET_FIELD (mode->vdisplay,SCALER5_DISPCTRLX_HEIGHT ) | (oneshot ?SCALER5_DISPCTRLX_ONESHOT :0 ); + dispbkgndx &= ~SCALER5_DISPBKGND_BCK2BCK ; + }HVS_WRITE (SCALER_DISPCTRLX (chan), dispctrl); - dispbkgndx =HVS_READ (SCALER_DISPBKGNDX (chan)); dispbkgndx &= ~SCALER_DISPBKGND_GAMMA ; dispbkgndx &= ~SCALER_DISPBKGND_INTERLACE ;HVS_WRITE (SCALER_DISPBKGNDX (chan), dispbkgndx | -SCALER_DISPBKGND_AUTOHS | ((!vc4->is_vc5) ?SCALER_DISPBKGND_GAMMA :0 ) | (interlace ?SCALER_DISPBKGND_INTERLACE :0 ));
drivers/gpu/drm/vc4/vc4_regs.h +1 -0
@@ -366,6 +366,7 @@#define SCALER_DISPBKGND0 0x00000044# define SCALER_DISPBKGND_AUTOHS BIT(31) +# define SCALER5_DISPBKGND_BCK2BCK BIT(31)# define SCALER_DISPBKGND_INTERLACE BIT(30)# define SCALER_DISPBKGND_GAMMA BIT(29)# define SCALER_DISPBKGND_TESTMODE_MASK VC4_MASK(28, 25)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 283/885 drm/vc4: hvs: Correct interrupt masking bit assignment for HVS5
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit 87551ec650bb87d35f1b29bba6a2430896e08da0 ]
HVS5 has moved the interrupt enable bits around within the DISPCTRL register, therefore the configuration has to be updated to account for this.
--- drivers/gpu/drm/vc4/vc4_hvs.c | 52 +++++++++++++++++++++++----------- drivers/gpu/drm/vc4/vc4_regs.h | 10 +++++-- 2 files changed, 44 insertions(+), 18 deletions(-)
drivers/gpu/drm/vc4/vc4_hvs.c +36 -16
@@ -658,7 +658,8 @@ void vc4_hvs_mask_underrun(struct vc4_hvs *hvs, int channel)return ; dispctrl =HVS_READ (SCALER_DISPCTRL ); - dispctrl &= ~SCALER_DISPCTRL_DSPEISLUR (channel); + dispctrl &= ~(hvs->vc4->is_vc5 ?SCALER5_DISPCTRL_DSPEISLUR (channel) : +SCALER_DISPCTRL_DSPEISLUR (channel));HVS_WRITE (SCALER_DISPCTRL , dispctrl);
@@ -675,7 +676,8 @@ void vc4_hvs_unmask_underrun(struct vc4_hvs *hvs, int channel)return ; dispctrl =HVS_READ (SCALER_DISPCTRL ); - dispctrl |=SCALER_DISPCTRL_DSPEISLUR (channel); + dispctrl |= (hvs->vc4->is_vc5 ?SCALER5_DISPCTRL_DSPEISLUR (channel) : +SCALER_DISPCTRL_DSPEISLUR (channel));HVS_WRITE (SCALER_DISPSTAT ,SCALER_DISPSTAT_EUFLOW (channel));
@@ -701,6 +703,7 @@ static irqreturn_t vc4_hvs_irq_handler(int irq, void *data)int channel;u32 control;u32 status; +u32 dspeislur;/* * NOTE: We don't need to protect the register access using
@@ -717,9 +720,11 @@ static irqreturn_t vc4_hvs_irq_handler(int irq, void *data) control =HVS_READ (SCALER_DISPCTRL );for (channel =0 ; channel <SCALER_CHANNELS_COUNT ; channel++) { + dspeislur = vc4->is_vc5 ?SCALER5_DISPCTRL_DSPEISLUR (channel) : +SCALER_DISPCTRL_DSPEISLUR (channel);/* Interrupt masking is not always honored, so check it here. */ if (status &SCALER_DISPSTAT_EUFLOW (channel) && - control &SCALER_DISPCTRL_DSPEISLUR (channel)) { + control & dspeislur) {vc4_hvs_mask_underrun (hvs, channel);vc4_hvs_report_underrun (dev);
@@ -872,19 +877,34 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)SCALER_DISPCTRL_DISPEIRQ (1 ) |SCALER_DISPCTRL_DISPEIRQ (2 ); - dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | -SCALER_DISPCTRL_SLVWREIRQ | -SCALER_DISPCTRL_SLVRDEIRQ | -SCALER_DISPCTRL_DSPEIEOF (0 ) | -SCALER_DISPCTRL_DSPEIEOF (1 ) | -SCALER_DISPCTRL_DSPEIEOF (2 ) | -SCALER_DISPCTRL_DSPEIEOLN (0 ) | -SCALER_DISPCTRL_DSPEIEOLN (1 ) | -SCALER_DISPCTRL_DSPEIEOLN (2 ) | -SCALER_DISPCTRL_DSPEISLUR (0 ) | -SCALER_DISPCTRL_DSPEISLUR (1 ) | -SCALER_DISPCTRL_DSPEISLUR (2 ) | -SCALER_DISPCTRL_SCLEIRQ ); +if (!vc4->is_vc5) + dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | +SCALER_DISPCTRL_SLVWREIRQ | +SCALER_DISPCTRL_SLVRDEIRQ | +SCALER_DISPCTRL_DSPEIEOF (0 ) | +SCALER_DISPCTRL_DSPEIEOF (1 ) | +SCALER_DISPCTRL_DSPEIEOF (2 ) | +SCALER_DISPCTRL_DSPEIEOLN (0 ) | +SCALER_DISPCTRL_DSPEIEOLN (1 ) | +SCALER_DISPCTRL_DSPEIEOLN (2 ) | +SCALER_DISPCTRL_DSPEISLUR (0 ) | +SCALER_DISPCTRL_DSPEISLUR (1 ) | +SCALER_DISPCTRL_DSPEISLUR (2 ) | +SCALER_DISPCTRL_SCLEIRQ ); +else + dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | +SCALER5_DISPCTRL_SLVEIRQ | +SCALER5_DISPCTRL_DSPEIEOF (0 ) | +SCALER5_DISPCTRL_DSPEIEOF (1 ) | +SCALER5_DISPCTRL_DSPEIEOF (2 ) | +SCALER5_DISPCTRL_DSPEIEOLN (0 ) | +SCALER5_DISPCTRL_DSPEIEOLN (1 ) | +SCALER5_DISPCTRL_DSPEIEOLN (2 ) | +SCALER5_DISPCTRL_DSPEISLUR (0 ) | +SCALER5_DISPCTRL_DSPEISLUR (1 ) | +SCALER5_DISPCTRL_DSPEISLUR (2 ) | +SCALER_DISPCTRL_SCLEIRQ ); +/* Set AXI panic mode. * VC4 panics when < 2 lines in FIFO.
drivers/gpu/drm/vc4/vc4_regs.h +8 -2
@@ -234,15 +234,21 @@* always enabled. */ # define SCALER_DISPCTRL_DSPEISLUR (x) BIT(13 + (x)) +# define SCALER5_DISPCTRL_DSPEISLUR (x) BIT(9 + ((x) * 4))/* Enables Display 0 end-of-line-N contribution to * SCALER_DISPSTAT_IRQDISP0 */ # define SCALER_DISPCTRL_DSPEIEOLN (x) BIT(8 + ((x) * 2)) +# define SCALER5_DISPCTRL_DSPEIEOLN (x) BIT(8 + ((x) * 4))/* Enables Display 0 EOF contribution to SCALER_DISPSTAT_IRQDISP0 */ # define SCALER_DISPCTRL_DSPEIEOF (x) BIT(7 + ((x) * 2)) +# define SCALER5_DISPCTRL_DSPEIEOF (x) BIT(7 + ((x) * 4)) -# define SCALER_DISPCTRL_SLVRDEIRQ BIT(6) -# define SCALER_DISPCTRL_SLVWREIRQ BIT(5) +# define SCALER5_DISPCTRL_DSPEIVST (x) BIT(6 + ((x) * 4)) + +# define SCALER_DISPCTRL_SLVRDEIRQ BIT(6)/* HVS4 only */ +# define SCALER_DISPCTRL_SLVWREIRQ BIT(5)/* HVS4 only */ +# define SCALER5_DISPCTRL_SLVEIRQ BIT(5)# define SCALER_DISPCTRL_DMAEIRQ BIT(4)/* Enables interrupt generation on the enabled EOF/EOLN/EISLUR * bits and short frames..
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 284/885 drm/vc4: hvs: Fix colour order for xRGB1555 on HVS5
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit 902973dc1a049c0d7bf0c222b8f2b3876f01b4a2 ]
Same as the xRGB8888 formats, HVS5 has managed to swap the colour channels for the xRGB1555 formats as well. Add the relevant config for pixel_order_hvs5.
--- drivers/gpu/drm/vc4/vc4_plane.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/vc4/vc4_plane.c +2 -0
@@ -75,11 +75,13 @@ static const struct hvs_format { .drm = DRM_FORMAT_ARGB1555, .hvs = HVS_PIXEL_FORMAT_RGBA5551, .pixel_order = HVS_PIXEL_ORDER_ABGR, + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, }, { .drm = DRM_FORMAT_XRGB1555, .hvs = HVS_PIXEL_FORMAT_RGBA5551, .pixel_order = HVS_PIXEL_ORDER_ABGR, + .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB, }, { .drm = DRM_FORMAT_RGB888,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 285/885 drm/vc4: hdmi: Correct interlaced timings again
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit 771d6539f27bd55f43d8a95d53a7eeaaffa2681c ]
The back porch timings were correct, only the sync offset was wrong. Correct timing is now reported for 1080i and 576i, but the h offset is incorrect for 480i for non-obvious reasons.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +3 -2
@@ -1306,11 +1306,12 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL));u32 vertb = (VC4_SET_FIELD (mode->htotal >> (2 - pixel_rep),VC5_HDMI_VERTB_VSPO ) | -VC4_SET_FIELD (mode->crtc_vtotal - mode->crtc_vsync_end, +VC4_SET_FIELD (mode->crtc_vtotal - mode->crtc_vsync_end + + interlaced,VC4_HDMI_VERTB_VBP ));u32 vertb_even = (VC4_SET_FIELD (0 ,VC5_HDMI_VERTB_VSPO ) |VC4_SET_FIELD (mode->crtc_vtotal - - mode->crtc_vsync_end - interlaced, + mode->crtc_vsync_end,VC4_HDMI_VERTB_VBP ));unsigned long flags;unsigned char gcp;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 286/885 drm/msm: clean event_thread->worker in case of an error
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit c79bb6b92defdcb834ceeeed9c1cf591beb1b71a ]
If worker creation fails, nullify the event_thread->worker, so that msm_drm_uninit() doesn't try accessing invalid memory location. While we are at it, remove duplicate assignment to the ret variable.
Patchwork: https://patchwork.freedesktop.org/patch/490106/
--- drivers/gpu/drm/msm/msm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -494,7 +494,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)if (IS_ERR (priv->event_thread[i].worker)) { ret =PTR_ERR (priv->event_thread[i].worker);DRM_DEV_ERROR (dev,"failed to create crtc_event kthread\n" ); - ret =PTR_ERR (priv->event_thread[i].worker); + priv->event_thread[i].worker =NULL ; goto err_msm_uninit; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 287/885 drm/panel-edp: fix name for IVO product id 854b
In reply to Greg Kroah-HartmanFrom: Abel Vesa <[email protected]>
[ Upstream commit 9cce08cadc6ce8670280d0a042cf0b6d2987d9f9 ]
The actual name is R133NW4K-R0.
--- drivers/gpu/drm/panel/panel-edp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-edp.c +1 -1
@@ -1889,7 +1889,7 @@ static const struct edp_panel_entry edp_panels[] = {EDP_PANEL_ENTRY ('C' ,'M' ,'N' ,0x1247 , &delay_200_500_e80_d50,"N120ACA-EA1" ),EDP_PANEL_ENTRY ('I' ,'V' ,'O' ,0x057d , &delay_200_500_e200,"R140NWF5 RH" ), -EDP_PANEL_ENTRY ('I' ,'V' ,'O' ,0x854b , &delay_200_500_p2e100,"M133NW4J-R3" ), +EDP_PANEL_ENTRY ('I' ,'V' ,'O' ,0x854b , &delay_200_500_p2e100,"R133NW4K-R0" ),EDP_PANEL_ENTRY ('K' ,'D' ,'B' ,0x0624 , &kingdisplay_kd116n21_30nv_a010.delay,"116N21-30NV-A010" ), EDP_PANEL_ENTRY('K', 'D', 'B', 0x1120, &delay_200_500_e80_d50, "116N29-30NK-C007"),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 288/885 scsi: qla2xxx: Fix exchange oversubscription
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 41e5afe51f75f2858f5563145348f6c26d307b8f ]
In large environment, it is possible to experience command timeout and escalation of path recovery. Currently the driver does not track the number of exchanges/commands sent to FW. If there is a delay for commands at the head of the queue, then this will create back pressure for commands at the back of the queue.
Check for exchange availability before command submission.
--- drivers/scsi/qla2xxx/qla_def.h | 6 +++- drivers/scsi/qla2xxx/qla_edif.c | 7 +++-- drivers/scsi/qla2xxx/qla_init.c | 13 ++++++++ drivers/scsi/qla2xxx/qla_inline.h | 52 +++++++++++++++++++++---------- drivers/scsi/qla2xxx/qla_iocb.c | 28 ++++++++++------- drivers/scsi/qla2xxx/qla_isr.c | 3 +- drivers/scsi/qla2xxx/qla_nvme.c | 15 ++++++++- 7 files changed, 88 insertions(+), 36 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +5 -1
@@ -660,7 +660,7 @@ enum {struct iocb_resource {u8 res_type; -u8 pad; +u8 exch_cnt;u16 iocb_cnt; };
@@ -3721,6 +3721,10 @@ struct qla_fw_resources {u16 iocbs_limit;u16 iocbs_qp_limit;u16 iocbs_used; +u16 exch_total; +u16 exch_limit; +u16 exch_used; +u16 pad; };#define QLA_IOCB_PCT_LIMIT 95
drivers/scsi/qla2xxx/qla_edif.c +4 -3
@@ -2989,9 +2989,10 @@ qla28xx_start_scsi_edif(srb_t *sp) tot_dsds = nseg; req_cnt =qla24xx_calc_iocbs (vha, tot_dsds); - sp->iores.res_type =RESOURCE_INI ; + sp->iores.res_type =RESOURCE_IOCB |RESOURCE_EXCH ; + sp->iores.exch_cnt =1 ; sp->iores.iocb_cnt = req_cnt; -if (qla_get_iocbs (sp->qpair, &sp->iores)) +if (qla_get_fw_resources (sp->qpair, &sp->iores)) goto queuing_error;if (req->cnt < (req_cnt +2 )) {
@@ -3185,7 +3186,7 @@ qla28xx_start_scsi_edif(srb_t *sp)mempool_free (sp->u.scmd.ct6_ctx, ha->ctx_mempool); sp->u.scmd.ct6_ctx =NULL ; } -qla_put_iocbs (sp->qpair, &sp->iores); +qla_put_fw_resources (sp->qpair, &sp->iores);spin_unlock_irqrestore (lock, flags);return QLA_FUNCTION_FAILED ;
drivers/scsi/qla2xxx/qla_init.c +13 -0
@@ -128,12 +128,14 @@ static void qla24xx_abort_iocb_timeout(void *data) sp->cmd_sp)) { qpair->req->outstanding_cmds[handle] =NULL ; cmdsp_found =1 ; +qla_put_fw_resources (qpair, &sp->cmd_sp->iores); }/* removing the abort */ if (qpair->req->outstanding_cmds[handle] == sp) { qpair->req->outstanding_cmds[handle] =NULL ; sp_found =1 ; +qla_put_fw_resources (qpair, &sp->iores);break ; } }
@@ -2000,6 +2002,7 @@ qla2x00_tmf_iocb_timeout(void *data)for (h =1 ; h < sp->qpair->req->num_outstanding_cmds; h++) {if (sp->qpair->req->outstanding_cmds[h] == sp) { sp->qpair->req->outstanding_cmds[h] =NULL ; +qla_put_fw_resources (sp->qpair, &sp->iores);break ; } }
@@ -3943,6 +3946,12 @@ void qla_init_iocb_limit(scsi_qla_host_t *vha) ha->base_qpair->fwres.iocbs_limit = limit; ha->base_qpair->fwres.iocbs_qp_limit = limit / num_qps; ha->base_qpair->fwres.iocbs_used =0 ; + + ha->base_qpair->fwres.exch_total = ha->orig_fw_xcb_count; + ha->base_qpair->fwres.exch_limit = (ha->orig_fw_xcb_count * +QLA_IOCB_PCT_LIMIT ) /100 ; + ha->base_qpair->fwres.exch_used =0 ; +for (i =0 ; i < ha->max_qpairs; i++) {if (ha->queue_pair_map[i]) { ha->queue_pair_map[i]->fwres.iocbs_total =
@@ -3951,6 +3960,10 @@ void qla_init_iocb_limit(scsi_qla_host_t *vha) ha->queue_pair_map[i]->fwres.iocbs_qp_limit = limit / num_qps; ha->queue_pair_map[i]->fwres.iocbs_used =0 ; + ha->queue_pair_map[i]->fwres.exch_total = ha->orig_fw_xcb_count; + ha->queue_pair_map[i]->fwres.exch_limit = + (ha->orig_fw_xcb_count *QLA_IOCB_PCT_LIMIT ) /100 ; + ha->queue_pair_map[i]->fwres.exch_used =0 ; } } }
drivers/scsi/qla2xxx/qla_inline.h +35 -17
88 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_iocb.c +16 -12
@@ -1589,9 +1589,10 @@ qla24xx_start_scsi(srb_t *sp) tot_dsds = nseg; req_cnt =qla24xx_calc_iocbs (vha, tot_dsds); - sp->iores.res_type =RESOURCE_INI ; + sp->iores.res_type =RESOURCE_IOCB |RESOURCE_EXCH ; + sp->iores.exch_cnt =1 ; sp->iores.iocb_cnt = req_cnt; -if (qla_get_iocbs (sp->qpair, &sp->iores)) +if (qla_get_fw_resources (sp->qpair, &sp->iores)) goto queuing_error;if (req->cnt < (req_cnt +2 )) {
@@ -1678,7 +1679,7 @@ qla24xx_start_scsi(srb_t *sp)if (tot_dsds)scsi_dma_unmap (cmd); -qla_put_iocbs (sp->qpair, &sp->iores); +qla_put_fw_resources (sp->qpair, &sp->iores);spin_unlock_irqrestore (&ha->hardware_lock, flags);return QLA_FUNCTION_FAILED ;
@@ -1793,9 +1794,10 @@ qla24xx_dif_start_scsi(srb_t *sp) tot_prot_dsds = nseg; tot_dsds += nseg; - sp->iores.res_type =RESOURCE_INI ; + sp->iores.res_type =RESOURCE_IOCB |RESOURCE_EXCH ; + sp->iores.exch_cnt =1 ; sp->iores.iocb_cnt =qla24xx_calc_iocbs (vha, tot_dsds); -if (qla_get_iocbs (sp->qpair, &sp->iores)) +if (qla_get_fw_resources (sp->qpair, &sp->iores)) goto queuing_error;if (req->cnt < (req_cnt +2 )) {
@@ -1883,7 +1885,7 @@ qla24xx_dif_start_scsi(srb_t *sp) }/* Cleanup will be performed by the caller (queuecommand) */ -qla_put_iocbs (sp->qpair, &sp->iores); +qla_put_fw_resources (sp->qpair, &sp->iores);spin_unlock_irqrestore (&ha->hardware_lock, flags);return QLA_FUNCTION_FAILED ;
@@ -1952,9 +1954,10 @@ qla2xxx_start_scsi_mq(srb_t *sp) tot_dsds = nseg; req_cnt =qla24xx_calc_iocbs (vha, tot_dsds); - sp->iores.res_type =RESOURCE_INI ; + sp->iores.res_type =RESOURCE_IOCB |RESOURCE_EXCH ; + sp->iores.exch_cnt =1 ; sp->iores.iocb_cnt = req_cnt; -if (qla_get_iocbs (sp->qpair, &sp->iores)) +if (qla_get_fw_resources (sp->qpair, &sp->iores)) goto queuing_error;if (req->cnt < (req_cnt +2 )) {
@@ -2041,7 +2044,7 @@ qla2xxx_start_scsi_mq(srb_t *sp)if (tot_dsds)scsi_dma_unmap (cmd); -qla_put_iocbs (sp->qpair, &sp->iores); +qla_put_fw_resources (sp->qpair, &sp->iores);spin_unlock_irqrestore (&qpair->qp_lock, flags);return QLA_FUNCTION_FAILED ;
@@ -2171,9 +2174,10 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp) tot_prot_dsds = nseg; tot_dsds += nseg; - sp->iores.res_type =RESOURCE_INI ; + sp->iores.res_type =RESOURCE_IOCB |RESOURCE_EXCH ; + sp->iores.exch_cnt =1 ; sp->iores.iocb_cnt =qla24xx_calc_iocbs (vha, tot_dsds); -if (qla_get_iocbs (sp->qpair, &sp->iores)) +if (qla_get_fw_resources (sp->qpair, &sp->iores)) goto queuing_error;if (req->cnt < (req_cnt +2 )) {
@@ -2260,7 +2264,7 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp) }/* Cleanup will be performed by the caller (queuecommand) */ -qla_put_iocbs (sp->qpair, &sp->iores); +qla_put_fw_resources (sp->qpair, &sp->iores);spin_unlock_irqrestore (&qpair->qp_lock, flags);return QLA_FUNCTION_FAILED ;
drivers/scsi/qla2xxx/qla_isr.c +1 -2
@@ -3197,7 +3197,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) }return ; } -qla_put_iocbs (sp->qpair, &sp->iores); +qla_put_fw_resources (sp->qpair, &sp->iores);if (sp->cmd_type !=TYPE_SRB ) { req->outstanding_cmds[handle] =NULL ;
@@ -3618,7 +3618,6 @@ qla2x00_error_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, sts_entry_t *pkt)default : sp =qla2x00_get_sp_from_handle (vha, func, req, pkt);if (sp) { -qla_put_iocbs (sp->qpair, &sp->iores); sp->done (sp, res);return 0 ; }
drivers/scsi/qla2xxx/qla_nvme.c +14 -1
@@ -445,13 +445,24 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp) goto queuing_error; } req_cnt =qla24xx_calc_iocbs (vha, tot_dsds); + + sp->iores.res_type =RESOURCE_IOCB |RESOURCE_EXCH ; + sp->iores.exch_cnt =1 ; + sp->iores.iocb_cnt = req_cnt; +if (qla_get_fw_resources (sp->qpair, &sp->iores)) { + rval = -EBUSY ; + goto queuing_error; + } +if (req->cnt < (req_cnt +2 )) {if (IS_SHADOW_REG_CAPABLE (ha)) { cnt = *req->out_ptr; }else { cnt =rd_reg_dword_relaxed (req->req_q_out); -if (qla2x00_check_reg16_for_disconnect (vha, cnt)) +if (qla2x00_check_reg16_for_disconnect (vha, cnt)) { + rval = -EBUSY ; goto queuing_error; + } }if (req->ring_index < cnt)
@@ -600,6 +611,8 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp)qla24xx_process_response_queue (vha, rsp); queuing_error: +if (rval) +qla_put_fw_resources (sp->qpair, &sp->iores);spin_unlock_irqrestore (&qpair->qp_lock, flags);return rval;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 289/885 scsi: qla2xxx: Fix exchange oversubscription for management commands
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 5f63a163ed2f12c34dd4ae9b2757962ec7bb86e5 ]
Add resource checking for management (non-I/O) commands.
--- drivers/scsi/qla2xxx/qla_dfs.c | 10 ++++- drivers/scsi/qla2xxx/qla_inline.h | 5 ++- drivers/scsi/qla2xxx/qla_iocb.c | 67 +++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_isr.c | 1 + 4 files changed, 80 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_dfs.c +8 -2
@@ -235,7 +235,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)uint16_t mb[MAX_IOCB_MB_REG ];int rc;struct qla_hw_data *ha = vha->hw; -u16 iocbs_used, i; +u16 iocbs_used, i, exch_used; rc =qla24xx_res_count_wait (vha, mb,SIZEOF_IOCB_MB_REG );if (rc !=QLA_SUCCESS ) {
@@ -263,13 +263,19 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)if (ql2xenforce_iocb_limit) {/* lock is not require. It's an estimate. */ iocbs_used = ha->base_qpair->fwres.iocbs_used; + exch_used = ha->base_qpair->fwres.exch_used;for (i =0 ; i < ha->max_qpairs; i++) { -if (ha->queue_pair_map[i]) +if (ha->queue_pair_map[i]) { iocbs_used += ha->queue_pair_map[i]->fwres.iocbs_used; + exch_used += ha->queue_pair_map[i]->fwres.exch_used; + } }seq_printf (s,"Driver: estimate iocb used [%d] high water limit [%d]\n" , iocbs_used, ha->base_qpair->fwres.iocbs_limit); + +seq_printf (s,"estimate exchange used[%d] high water limit [%d] n" , + exch_used, ha->base_qpair->fwres.exch_limit); }return 0 ;
drivers/scsi/qla2xxx/qla_inline.h +4 -1
@@ -380,7 +380,7 @@ qla2xxx_get_fc4_priority(struct scsi_qla_host *vha)enum {RESOURCE_NONE , -RESOURCE_IOCB =BIT_0 , +RESOURCE_IOCB =BIT_0 ,RESOURCE_EXCH =BIT_1 ,/* exchange */ RESOURCE_FORCE =BIT_2 , };
@@ -396,6 +396,8 @@ qla_get_fw_resources(struct qla_qpair *qp, struct iocb_resource *iores) iores->res_type =RESOURCE_NONE ;return 0 ; } +if (iores->res_type &RESOURCE_FORCE ) + goto force;if ((iores->iocb_cnt + qp->fwres.iocbs_used) >= qp->fwres.iocbs_qp_limit) {/* no need to acquire qpair lock. It's just rough calculation */
@@ -423,6 +425,7 @@ qla_get_fw_resources(struct qla_qpair *qp, struct iocb_resource *iores)return -ENOSPC ; } } +force: qp->fwres.iocbs_used += iores->iocb_cnt; qp->fwres.exch_used += iores->exch_cnt;return 0 ;
drivers/scsi/qla2xxx/qla_iocb.c +67 -0
85 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_isr.c +1 -0
@@ -3112,6 +3112,7 @@ qla25xx_process_bidir_status_iocb(scsi_qla_host_t *vha, void *pkt, } bsg_reply->reply_payload_rcv_len =0 ; +qla_put_fw_resources (sp->qpair, &sp->iores); done:/* Return the vendor specific reply to API */ bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] = rval;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 290/885 scsi: qla2xxx: edif: Fix clang warning
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 2f5fab1b6c3a8efc93ba52c28539c45a8d0142ad ]
clang warning:
drivers/scsi/qla2xxx/qla_edif_bsg.h:93:12: warning: field remote_pid within 'struct app_pinfo_req' is less aligned than 'port_id_t' and is usually due to 'struct app_pinfo_req' being packed, which can lead to unaligned accesses [-Wunaligned-access]
port_id_t remote_pid; ^
2 warnings generated.
Remove u32 field in remote_pid to silence warning.
--- drivers/scsi/qla2xxx/qla_edif.c | 4 +++- drivers/scsi/qla2xxx/qla_edif_bsg.h | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_edif.c +3 -1
@@ -925,7 +925,9 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)if (!(fcport->flags &FCF_FCSP_DEVICE ))continue ; - tdid = app_req.remote_pid; + tdid.b.domain = app_req.remote_pid.domain; + tdid.b.area = app_req.remote_pid.area; + tdid.b.al_pa = app_req.remote_pid.al_pa;ql_dbg (ql_dbg_edif, vha,0x2058 ,"APP request entry - portid=%06x.\n" , tdid.b24);
drivers/scsi/qla2xxx/qla_edif_bsg.h +14 -1
@@ -89,7 +89,20 @@ struct app_plogi_reply {struct app_pinfo_req {struct app_id app_info;uint8_t num_ports; -port_id_t remote_pid; +struct { +#ifdef __BIG_ENDIAN +uint8_t domain; +uint8_t area; +uint8_t al_pa; +#elif defined(__LITTLE_ENDIAN) +uint8_t al_pa; +uint8_t area; +uint8_t domain; +#else +#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!" +#endif +uint8_t rsvd_1; + } remote_pid;uint8_t version;uint8_t pad[VND_CMD_PAD_SIZE ];uint8_t reserved[VND_CMD_APP_RESERVED_SIZE ];
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 291/885 ASoC: fsl_sai: initialize is_dsp_mode flag
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit a23924b7dd7b748fff8e305e1daf590fed2af21b ]
Initialize is_dsp_mode flag in the beginning of function fsl_sai_set_dai_fmt_tr().
When the DAIFMT is DAIFMT_DSP_B the first time, is_dsp_mode is true, then the second time DAIFMT is DAIFMT_I2S, is_dsp_mode still true, which is a wrong state. So need to initialize is_dsp_mode flag every time.
--- sound/soc/fsl/fsl_sai.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/fsl_sai.c +1 -0
@@ -281,6 +281,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, val_cr4 |=FSL_SAI_CR4_MF ; sai->is_pdm_mode = false; + sai->is_dsp_mode = false;/* DAI mode */ switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 292/885 drm/bridge: tc358767: Set default CLRSIPO count
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 01338bb82fed40a6a234c2b36a92367c8671adf0 ]
The current CLRSIPO count is still marginal and does not work with high DSI clock rates in burst mode. Increase it further to allow the DSI link to work at up to 1Gbps lane speed. This returns the counts to defaults as provided by datasheet.
--- drivers/gpu/drm/bridge/tc358767.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/tc358767.c +4 -4
@@ -1264,10 +1264,10 @@ static int tc_dsi_rx_enable(struct tc_data *tc)u32 value;int ret; -regmap_write (tc->regmap,PPI_D0S_CLRSIPOCOUNT ,5 ); -regmap_write (tc->regmap,PPI_D1S_CLRSIPOCOUNT ,5 ); -regmap_write (tc->regmap,PPI_D2S_CLRSIPOCOUNT ,5 ); -regmap_write (tc->regmap,PPI_D3S_CLRSIPOCOUNT ,5 ); +regmap_write (tc->regmap,PPI_D0S_CLRSIPOCOUNT ,25 ); +regmap_write (tc->regmap,PPI_D1S_CLRSIPOCOUNT ,25 ); +regmap_write (tc->regmap,PPI_D2S_CLRSIPOCOUNT ,25 ); +regmap_write (tc->regmap,PPI_D3S_CLRSIPOCOUNT ,25 );regmap_write (tc->regmap,PPI_D0S_ATMR ,0 );regmap_write (tc->regmap,PPI_D1S_ATMR ,0 );regmap_write (tc->regmap,PPI_TX_RX_TA ,TTA_GET |TTA_SURE );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 293/885 drm/msm/adreno: Fix null ptr access in adreno_gpu_cleanup()
In reply to Greg Kroah-HartmanFrom: Akhil P Oommen <[email protected]>
[ Upstream commit dbeedbcb268d055d8895aceca427f897e12c2b50 ]
Fix the below kernel panic due to null pointer access:
[ 18.504431] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000048 [ 18.513464] Mem abort info: [ 18.516346] ESR = 0x0000000096000005 [ 18.520204] EC = 0x25: DABT (current EL), IL = 32 bits [ 18.525706] SET = 0, FnV = 0 [ 18.528878] EA = 0, S1PTW = 0 [ 18.532117] FSC = 0x05: level 1 translation fault [ 18.537138] Data abort info: [ 18.540110] ISV = 0, ISS = 0x00000005 [ 18.544060] CM = 0, WnR = 0 [ 18.547109] user pgtable: 4k pages, 39-bit VAs, pgdp=0000000112826000 [ 18.553738] [0000000000000048] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 [ 18.562690] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP **Snip** [ 18.696758] Call trace: [ 18.699278] adreno_gpu_cleanup+0x30/0x88 [ 18.703396] a6xx_destroy+0xc0/0x130 [ 18.707066] a6xx_gpu_init+0x308/0x424 [ 18.710921] adreno_bind+0x178/0x288 [ 18.714590] component_bind_all+0xe0/0x214 [ 18.718797] msm_drm_bind+0x1d4/0x614 [ 18.722566] try_to_bring_up_aggregate_device+0x16c/0x1b8 [ 18.728105] __component_add+0xa0/0x158 [ 18.732048] component_add+0x20/0x2c [ 18.735719] adreno_probe+0x40/0xc0 [ 18.739300] platform_probe+0xb4/0xd4 [ 18.743068] really_probe+0xfc/0x284 [ 18.746738] __driver_probe_device+0xc0/0xec [ 18.751129] driver_probe_device+0x48/0x110 [ 18.755421] __device_attach_driver+0xa8/0xd0 [ 18.759900] bus_for_each_drv+0x90/0xdc [ 18.763843] __device_attach+0xfc/0x174 [ 18.767786] device_initial_probe+0x20/0x2c [ 18.772090] bus_probe_device+0x40/0xa0 [ 18.776032] deferred_probe_work_func+0x94/0xd0 [ 18.780686] process_one_work+0x190/0x3d0 [ 18.784805] worker_thread+0x280/0x3d4 [ 18.788659] kthread+0x104/0x1c0 [ 18.791981] ret_from_fork+0x10/0x20 [ 18.795654] Code: f9400408 aa0003f3 aa1f03f4 91142015 (f9402516) [ 18.801913] ---[ end trace 0000000000000000 ]--- [ 18.809039] Kernel panic - not syncing: Oops: Fatal exception
Patchwork: https://patchwork.freedesktop.org/patch/515605/
--- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +2 -2
@@ -1082,13 +1082,13 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,void adreno_gpu_cleanup (struct adreno_gpu *adreno_gpu) {struct msm_gpu *gpu = &adreno_gpu->base; -struct msm_drm_private *priv = gpu->dev->dev_private; +struct msm_drm_private *priv = gpu->dev ? gpu->dev->dev_private :NULL ;unsigned int i;for (i =0 ; i <ARRAY_SIZE (adreno_gpu->info->fw); i++)release_firmware (adreno_gpu->fw[i]); -if (pm_runtime_enabled (&priv->gpu_pdev->dev)) +if (priv &&pm_runtime_enabled (&priv->gpu_pdev->dev))pm_runtime_disable (&priv->gpu_pdev->dev);msm_gpu_cleanup (&adreno_gpu->base);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 294/885 ALSA: hda/ca0132: minor fix for allocation size
In reply to Greg Kroah-HartmanFrom: Alexey V. Vissarionov <[email protected]>
[ Upstream commit 3ee0fe7fa39b14d1cea455b7041f2df933bd97d2 ]
Although the "dma_chan" pointer occupies more or equal space compared to "*dma_chan", the allocation size should use the size of variable itself.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/pci/hda/patch_ca0132.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_ca0132.c +1 -1
@@ -2455,7 +2455,7 @@ static int dspio_set_uint_param(struct hda_codec *codec, int mod_id,static int dspio_alloc_dma_chan (struct hda_codec *codec,unsigned int *dma_chan) {int status =0 ; -unsigned int size =sizeof (dma_chan); +unsigned int size =sizeof (*dma_chan);codec_dbg (codec," dspio_alloc_dma_chan() -- begin\n" ); status = dspio_scp(codec, MASTERCONTROL, 0x20,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 295/885 drm/amdgpu: Use the sched from entity for amdgpu_cs trace
In reply to Greg Kroah-HartmanFrom: Leo Liu <[email protected]>
[ Upstream commit cf22ef78f22ce4df4757472c5dbd33c430c5b659 ]
The problem is that base sched hasn't been assigned yet at this moment, causing something like "ring=0" all the time from trace.
mpv:cs0-3473 [002] ..... 129.047431: amdgpu_cs: ring=0, dw=48, fences=0 mpv:cs0-3473 [002] ..... 129.089125: amdgpu_cs: ring=0, dw=48, fences=0 mpv:cs0-3473 [002] ..... 129.130987: amdgpu_cs: ring=0, dw=48, fences=0 mpv:cs0-3473 [002] ..... 129.172478: amdgpu_cs: ring=0, dw=48, fences=0
--- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +2 -2
@@ -153,10 +153,10 @@ TRACE_EVENT(amdgpu_cs,TP_fast_assign ( __entry->bo_list = p->bo_list; - __entry->ring =to_amdgpu_ring (job->base.sched)->idx; + __entry->ring =to_amdgpu_ring (job->base.entity->rq->sched)->idx; __entry->dw = ib->length_dw; __entry->fences =amdgpu_fence_count_emitted ( -to_amdgpu_ring (job->base.sched)); +to_amdgpu_ring (job->base.entity->rq->sched)); ), TP_printk("bo_list=%p, ring=%u, dw=%u, fences=%u", __entry->bo_list, __entry->ring, __entry->dw,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 296/885 drm/msm/gem: Add check for kmalloc
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit d839f0811a31322c087a859c2b181e2383daa7be ]
Add the check for the return value of kmalloc in order to avoid NULL pointer dereference in copy_from_user.
Patchwork: https://patchwork.freedesktop.org/patch/514678/
--- drivers/gpu/drm/msm/msm_gem_submit.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/msm_gem_submit.c +4 -0
@@ -209,6 +209,10 @@ static int submit_lookup_cmds(struct msm_gem_submit *submit, goto out; } submit->cmd[i].relocs =kmalloc (sz,GFP_KERNEL ); +if (!submit->cmd[i].relocs) { + ret = -ENOMEM ; + goto out; + } ret =copy_from_user (submit->cmd[i].relocs, userptr, sz);if (ret) { ret = -EFAULT ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 297/885 drm/msm/dpu: Disallow unallocated resources to be returned
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit abc40122d9a69f56c04efb5a7485795f5ac799d1 ]
In the event that the topology requests resources that have not been created by the system (because they are typically not represented in dpu_mdss_cfg ^1), the resource(s) in global_state (in this case DSC blocks, until their allocation/assignment is being sanity-checked in "drm/msm/dpu: Reject topologies for which no DSC blocks are available") remain NULL but will still be returned out of dpu_rm_get_assigned_resources, where the caller expects to get an array containing num_blks valid pointers (but instead gets these NULLs).
To prevent this from happening, where null-pointer dereferences typically result in a hard-to-debug platform lockup, num_blks shouldn't increase past NULL blocks and will print an error and break instead. After all, max_blks represents the static size of the maximum number of blocks whereas the actual amount varies per platform.
^1: which can happen after a git rebase ended up moving additions to _dpu_cfg to a different struct which has the same patch context.
Patchwork: https://patchwork.freedesktop.org/patch/517636/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +5 -0
@@ -660,6 +660,11 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, blks_size, enc_id);break ; } +if (!hw_blks[i]) { +DPU_ERROR ("Allocated resource %d unavailable to assign to enc %d\n" , + type, enc_id); +break ; + } blks[num_blks++] = hw_blks[i]; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 298/885 drm/bridge: lt9611: fix sleep mode setup
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit ae2d329f104b75a0a78dcaded29fe6283289cdf9 ]
On atomic_post_disable the bridge goes to the low power state. However the code disables too much of the chip, so the HPD event is not being detected and delivered to the host. Reduce the power saving in order to get the HPD event.
--- drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611.c +2 -3
@@ -448,12 +448,11 @@ static void lt9611_sleep_setup(struct lt9611 *lt9611) { 0x8023, 0x01 }, { 0x8157, 0x03 }, /* set addr pin as output */ { 0x8149, 0x0b }, - { 0x8151, 0x30 }, /* disable IRQ */ + { 0x8102, 0x48 }, /* MIPI Rx power down */ { 0x8123, 0x80 }, { 0x8130, 0x00 }, - { 0x8100, 0x01 }, /* bandgap power down */ - { 0x8101, 0x00 }, /* system clk power down */ + { 0x8011, 0x0a }, }; regmap_multi_reg_write(lt9611->regmap,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 299/885 drm/bridge: lt9611: fix HPD reenablement
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit a7790f6bd38f3642b60ae3504a2c749135b89451 ]
The driver will reset the bridge in the atomic_pre_enable(). However this will also drop the HPD interrupt state. Instead of resetting the bridge, properly wake it up. This fixes the HPD interrupt delivery after the disable/enable cycle.
--- drivers/gpu/drm/bridge/lontium-lt9611.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611.c +8 -2
@@ -856,12 +856,18 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,static void lt9611_bridge_pre_enable (struct drm_bridge *bridge) {struct lt9611 *lt9611 =bridge_to_lt9611 (bridge); +static const struct reg_sequence reg_cfg[] = { + {0x8102 ,0x12 }, + {0x8123 ,0x40 }, + {0x8130 ,0xea }, + {0x8011 ,0xfa }, + };if (!lt9611->sleep)return ; -lt9611_reset (lt9611); -regmap_write (lt9611->regmap,0x80ee ,0x01 ); +regmap_multi_reg_write (lt9611->regmap, + reg_cfg,ARRAY_SIZE (reg_cfg)); lt9611->sleep = false; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 300/885 drm/bridge: lt9611: fix polarity programming
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 0b157efa384ea417304b1da284ee2f603c607fc3 ]
Fix programming of hsync and vsync polarities
--- drivers/gpu/drm/bridge/lontium-lt9611.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611.c +12 -5
@@ -207,7 +207,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod/* stage 2 */ { 0x834a, 0x40 }, - { 0x831d, 0x10 },/* MK limit */ { 0x832d, 0x38 },
@@ -222,11 +221,19 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod { 0x8325, 0x00 }, { 0x832a, 0x01 }, { 0x834a, 0x10 }, - { 0x831d, 0x10 }, - { 0x8326, 0x37 }, }; +u8 pol =0x10 ; -regmap_multi_reg_write (lt9611->regmap, reg_cfg,ARRAY_SIZE (reg_cfg)); +if (mode->flags &DRM_MODE_FLAG_NHSYNC ) + pol |=0x2 ; +if (mode->flags &DRM_MODE_FLAG_NVSYNC ) + pol |=0x1 ; +regmap_write (lt9611->regmap,0x831d , pol); + +if (mode->hdisplay ==3840 ) +regmap_multi_reg_write (lt9611->regmap, reg_cfg2,ARRAY_SIZE (reg_cfg2)); +else +regmap_multi_reg_write (lt9611->regmap, reg_cfg,ARRAY_SIZE (reg_cfg));switch (mode->hdisplay) {case 640 :
@@ -236,7 +243,7 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_modregmap_write (lt9611->regmap,0x8326 ,0x37 );break ;case 3840 : -regmap_multi_reg_write (lt9611->regmap, reg_cfg2,ARRAY_SIZE (reg_cfg2)); +regmap_write (lt9611->regmap,0x8326 ,0x37 );break ; }
Signature · 1 line
2.39.2