From: Greg Kroah-Hartman Date: Sun, 13 Jun 2021 13:10:05 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v4.4.273~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f4116e9124b6bfa872db81f0c18c938311edfaec;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: perf-fix-data-race-between-pin_count-increment-decrement.patch regulator-core-resolve-supply-for-boot-on-always-on-regulators.patch regulator-max77620-use-device_set_of_node_from_dev.patch --- diff --git a/queue-4.14/perf-fix-data-race-between-pin_count-increment-decrement.patch b/queue-4.14/perf-fix-data-race-between-pin_count-increment-decrement.patch new file mode 100644 index 00000000000..10559d3cb0e --- /dev/null +++ b/queue-4.14/perf-fix-data-race-between-pin_count-increment-decrement.patch @@ -0,0 +1,48 @@ +From 6c605f8371159432ec61cbb1488dcf7ad24ad19a Mon Sep 17 00:00:00 2001 +From: Marco Elver +Date: Thu, 27 May 2021 12:47:11 +0200 +Subject: perf: Fix data race between pin_count increment/decrement + +From: Marco Elver + +commit 6c605f8371159432ec61cbb1488dcf7ad24ad19a upstream. + +KCSAN reports a data race between increment and decrement of pin_count: + + write to 0xffff888237c2d4e0 of 4 bytes by task 15740 on cpu 1: + find_get_context kernel/events/core.c:4617 + __do_sys_perf_event_open kernel/events/core.c:12097 [inline] + __se_sys_perf_event_open kernel/events/core.c:11933 + ... + read to 0xffff888237c2d4e0 of 4 bytes by task 15743 on cpu 0: + perf_unpin_context kernel/events/core.c:1525 [inline] + __do_sys_perf_event_open kernel/events/core.c:12328 [inline] + __se_sys_perf_event_open kernel/events/core.c:11933 + ... + +Because neither read-modify-write here is atomic, this can lead to one +of the operations being lost, resulting in an inconsistent pin_count. +Fix it by adding the missing locking in the CPU-event case. + +Fixes: fe4b04fa31a6 ("perf: Cure task_oncpu_function_call() races") +Reported-by: syzbot+142c9018f5962db69c7e@syzkaller.appspotmail.com +Signed-off-by: Marco Elver +Signed-off-by: Peter Zijlstra (Intel) +Link: https://lkml.kernel.org/r/20210527104711.2671610-1-elver@google.com +Signed-off-by: Greg Kroah-Hartman +--- + kernel/events/core.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -3918,7 +3918,9 @@ find_get_context(struct pmu *pmu, struct + cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu); + ctx = &cpuctx->ctx; + get_ctx(ctx); ++ raw_spin_lock_irqsave(&ctx->lock, flags); + ++ctx->pin_count; ++ raw_spin_unlock_irqrestore(&ctx->lock, flags); + + return ctx; + } diff --git a/queue-4.14/regulator-core-resolve-supply-for-boot-on-always-on-regulators.patch b/queue-4.14/regulator-core-resolve-supply-for-boot-on-always-on-regulators.patch new file mode 100644 index 00000000000..45015357bfc --- /dev/null +++ b/queue-4.14/regulator-core-resolve-supply-for-boot-on-always-on-regulators.patch @@ -0,0 +1,38 @@ +From 98e48cd9283dbac0e1445ee780889f10b3d1db6a Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov +Date: Thu, 20 May 2021 01:12:23 +0300 +Subject: regulator: core: resolve supply for boot-on/always-on regulators + +From: Dmitry Baryshkov + +commit 98e48cd9283dbac0e1445ee780889f10b3d1db6a upstream. + +For the boot-on/always-on regulators the set_machine_constrainst() is +called before resolving rdev->supply. Thus the code would try to enable +rdev before enabling supplying regulator. Enforce resolving supply +regulator before enabling rdev. + +Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20210519221224.2868496-1-dmitry.baryshkov@linaro.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + drivers/regulator/core.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/regulator/core.c ++++ b/drivers/regulator/core.c +@@ -1081,6 +1081,12 @@ static int set_machine_constraints(struc + * and we have control then make sure it is enabled. + */ + if (rdev->constraints->always_on || rdev->constraints->boot_on) { ++ /* If we want to enable this regulator, make sure that we know ++ * the supplying regulator. ++ */ ++ if (rdev->supply_name && !rdev->supply) ++ return -EPROBE_DEFER; ++ + ret = _regulator_do_enable(rdev); + if (ret < 0 && ret != -EINVAL) { + rdev_err(rdev, "failed to enable\n"); diff --git a/queue-4.14/regulator-max77620-use-device_set_of_node_from_dev.patch b/queue-4.14/regulator-max77620-use-device_set_of_node_from_dev.patch new file mode 100644 index 00000000000..9ddb179fb85 --- /dev/null +++ b/queue-4.14/regulator-max77620-use-device_set_of_node_from_dev.patch @@ -0,0 +1,40 @@ +From 6f55c5dd1118b3076d11d9cb17f5c5f4bc3a1162 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Mon, 24 May 2021 01:42:42 +0300 +Subject: regulator: max77620: Use device_set_of_node_from_dev() + +From: Dmitry Osipenko + +commit 6f55c5dd1118b3076d11d9cb17f5c5f4bc3a1162 upstream. + +The MAX77620 driver fails to re-probe on deferred probe because driver +core tries to claim resources that are already claimed by the PINCTRL +device. Use device_set_of_node_from_dev() helper which marks OF node as +reused, skipping erroneous execution of pinctrl_bind_pins() for the PMIC +device on the re-probe. + +Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator") +Signed-off-by: Dmitry Osipenko +Link: https://lore.kernel.org/r/20210523224243.13219-2-digetx@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + drivers/regulator/max77620-regulator.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/regulator/max77620-regulator.c ++++ b/drivers/regulator/max77620-regulator.c +@@ -792,6 +792,13 @@ static int max77620_regulator_probe(stru + config.dev = dev; + config.driver_data = pmic; + ++ /* ++ * Set of_node_reuse flag to prevent driver core from attempting to ++ * claim any pinmux resources already claimed by the parent device. ++ * Otherwise PMIC driver will fail to re-probe. ++ */ ++ device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); ++ + for (id = 0; id < MAX77620_NUM_REGS; id++) { + struct regulator_dev *rdev; + struct regulator_desc *rdesc; diff --git a/queue-4.14/series b/queue-4.14/series index f258e91ee87..a54da38232d 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -34,3 +34,6 @@ usb-serial-quatech2-fix-control-request-directions.patch usb-gadget-eem-fix-wrong-eem-header-operation.patch usb-fix-various-gadgets-null-ptr-deref-on-10gbps-cabling.patch usb-fix-various-gadget-panics-on-10gbps-cabling.patch +regulator-core-resolve-supply-for-boot-on-always-on-regulators.patch +regulator-max77620-use-device_set_of_node_from_dev.patch +perf-fix-data-race-between-pin_count-increment-decrement.patch