From: Greg Kroah-Hartman Date: Mon, 17 Jun 2024 18:05:22 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v6.1.95~103 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d095b76f749a72c170ec4cbf3bed6fbfed346693;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: drivers-core-synchronize-really_probe-and-dev_uevent.patch iio-adc-ad9467-fix-scan-type-sign.patch iio-dac-ad5592r-fix-temperature-channel-scaling-value.patch iio-imu-inv_icm42600-delete-unneeded-update-watermark-call.patch --- diff --git a/queue-5.15/drivers-core-synchronize-really_probe-and-dev_uevent.patch b/queue-5.15/drivers-core-synchronize-really_probe-and-dev_uevent.patch new file mode 100644 index 00000000000..2d4ac746b00 --- /dev/null +++ b/queue-5.15/drivers-core-synchronize-really_probe-and-dev_uevent.patch @@ -0,0 +1,104 @@ +From c0a40097f0bc81deafc15f9195d1fb54595cd6d0 Mon Sep 17 00:00:00 2001 +From: Dirk Behme +Date: Mon, 13 May 2024 07:06:34 +0200 +Subject: drivers: core: synchronize really_probe() and dev_uevent() + +From: Dirk Behme + +commit c0a40097f0bc81deafc15f9195d1fb54595cd6d0 upstream. + +Synchronize the dev->driver usage in really_probe() and dev_uevent(). +These can run in different threads, what can result in the following +race condition for dev->driver uninitialization: + +Thread #1: +========== + +really_probe() { +... +probe_failed: +... +device_unbind_cleanup(dev) { + ... + dev->driver = NULL; // <= Failed probe sets dev->driver to NULL + ... + } +... +} + +Thread #2: +========== + +dev_uevent() { +... +if (dev->driver) + // If dev->driver is NULLed from really_probe() from here on, + // after above check, the system crashes + add_uevent_var(env, "DRIVER=%s", dev->driver->name); +... +} + +really_probe() holds the lock, already. So nothing needs to be done +there. dev_uevent() is called with lock held, often, too. But not +always. What implies that we can't add any locking in dev_uevent() +itself. So fix this race by adding the lock to the non-protected +path. This is the path where above race is observed: + + dev_uevent+0x235/0x380 + uevent_show+0x10c/0x1f0 <= Add lock here + dev_attr_show+0x3a/0xa0 + sysfs_kf_seq_show+0x17c/0x250 + kernfs_seq_show+0x7c/0x90 + seq_read_iter+0x2d7/0x940 + kernfs_fop_read_iter+0xc6/0x310 + vfs_read+0x5bc/0x6b0 + ksys_read+0xeb/0x1b0 + __x64_sys_read+0x42/0x50 + x64_sys_call+0x27ad/0x2d30 + do_syscall_64+0xcd/0x1d0 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +Similar cases are reported by syzkaller in + +https://syzkaller.appspot.com/bug?extid=ffa8143439596313a85a + +But these are regarding the *initialization* of dev->driver + +dev->driver = drv; + +As this switches dev->driver to non-NULL these reports can be considered +to be false-positives (which should be "fixed" by this commit, as well, +though). + +The same issue was reported and tried to be fixed back in 2015 in + +https://lore.kernel.org/lkml/1421259054-2574-1-git-send-email-a.sangwan@samsung.com/ + +already. + +Fixes: 239378f16aa1 ("Driver core: add uevent vars for devices of a class") +Cc: stable +Cc: syzbot+ffa8143439596313a85a@syzkaller.appspotmail.com +Cc: Ashish Sangwan +Cc: Namjae Jeon +Signed-off-by: Dirk Behme +Link: https://lore.kernel.org/r/20240513050634.3964461-1-dirk.behme@de.bosch.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/base/core.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -2404,8 +2404,11 @@ static ssize_t uevent_show(struct device + if (!env) + return -ENOMEM; + ++ /* Synchronize with really_probe() */ ++ device_lock(dev); + /* let the kset specific function add its keys */ + retval = kset->uevent_ops->uevent(kset, &dev->kobj, env); ++ device_unlock(dev); + if (retval) + goto out; + diff --git a/queue-5.15/iio-adc-ad9467-fix-scan-type-sign.patch b/queue-5.15/iio-adc-ad9467-fix-scan-type-sign.patch new file mode 100644 index 00000000000..fe188366cd3 --- /dev/null +++ b/queue-5.15/iio-adc-ad9467-fix-scan-type-sign.patch @@ -0,0 +1,41 @@ +From 8a01ef749b0a632f0e1f4ead0f08b3310d99fcb1 Mon Sep 17 00:00:00 2001 +From: David Lechner +Date: Fri, 3 May 2024 14:45:05 -0500 +Subject: iio: adc: ad9467: fix scan type sign + +From: David Lechner + +commit 8a01ef749b0a632f0e1f4ead0f08b3310d99fcb1 upstream. + +According to the IIO documentation, the sign in the scan type should be +lower case. The ad9467 driver was incorrectly using upper case. + +Fix by changing to lower case. + +Fixes: 4606d0f4b05f ("iio: adc: ad9467: add support for AD9434 high-speed ADC") +Fixes: ad6797120238 ("iio: adc: ad9467: add support AD9467 ADC") +Signed-off-by: David Lechner +Link: https://lore.kernel.org/r/20240503-ad9467-fix-scan-type-sign-v1-1-c7a1a066ebb9@baylibre.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/ad9467.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/iio/adc/ad9467.c ++++ b/drivers/iio/adc/ad9467.c +@@ -223,11 +223,11 @@ static void __ad9467_get_scale(struct ad + } + + static const struct iio_chan_spec ad9434_channels[] = { +- AD9467_CHAN(0, 0, 12, 'S'), ++ AD9467_CHAN(0, 0, 12, 's'), + }; + + static const struct iio_chan_spec ad9467_channels[] = { +- AD9467_CHAN(0, 0, 16, 'S'), ++ AD9467_CHAN(0, 0, 16, 's'), + }; + + static const struct ad9467_chip_info ad9467_chip_tbl[] = { diff --git a/queue-5.15/iio-dac-ad5592r-fix-temperature-channel-scaling-value.patch b/queue-5.15/iio-dac-ad5592r-fix-temperature-channel-scaling-value.patch new file mode 100644 index 00000000000..8eca9c32a81 --- /dev/null +++ b/queue-5.15/iio-dac-ad5592r-fix-temperature-channel-scaling-value.patch @@ -0,0 +1,66 @@ +From 279428df888319bf68f2686934897301a250bb84 Mon Sep 17 00:00:00 2001 +From: Marc Ferland +Date: Wed, 1 May 2024 11:05:54 -0400 +Subject: iio: dac: ad5592r: fix temperature channel scaling value + +From: Marc Ferland + +commit 279428df888319bf68f2686934897301a250bb84 upstream. + +The scale value for the temperature channel is (assuming Vref=2.5 and +the datasheet): + + 376.7897513 + +When calculating both val and val2 for the temperature scale we +use (3767897513/25) and multiply it by Vref (here I assume 2500mV) to +obtain: + + 2500 * (3767897513/25) ==> 376789751300 + +Finally we divide with remainder by 10^9 to get: + + val = 376 + val2 = 789751300 + +However, we return IIO_VAL_INT_PLUS_MICRO (should have been NANO) as +the scale type. So when converting the raw temperature value to the +'processed' temperature value we will get (assuming raw=810, +offset=-753): + + processed = (raw + offset) * scale_val + = (810 + -753) * 376 + = 21432 + + processed += div((raw + offset) * scale_val2, 10^6) + += div((810 + -753) * 789751300, 10^6) + += 45015 + ==> 66447 + ==> 66.4 Celcius + +instead of the expected 21.5 Celsius. + +Fix this issue by changing IIO_VAL_INT_PLUS_MICRO to +IIO_VAL_INT_PLUS_NANO. + +Fixes: 56ca9db862bf ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs") +Signed-off-by: Marc Ferland +Link: https://lore.kernel.org/r/20240501150554.1871390-1-marc.ferland@sonatest.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/dac/ad5592r-base.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/iio/dac/ad5592r-base.c ++++ b/drivers/iio/dac/ad5592r-base.c +@@ -411,7 +411,7 @@ static int ad5592r_read_raw(struct iio_d + s64 tmp = *val * (3767897513LL / 25LL); + *val = div_s64_rem(tmp, 1000000000LL, val2); + +- return IIO_VAL_INT_PLUS_MICRO; ++ return IIO_VAL_INT_PLUS_NANO; + } + + mutex_lock(&st->lock); diff --git a/queue-5.15/iio-imu-inv_icm42600-delete-unneeded-update-watermark-call.patch b/queue-5.15/iio-imu-inv_icm42600-delete-unneeded-update-watermark-call.patch new file mode 100644 index 00000000000..94c3faf7a07 --- /dev/null +++ b/queue-5.15/iio-imu-inv_icm42600-delete-unneeded-update-watermark-call.patch @@ -0,0 +1,49 @@ +From 245f3b149e6cc3ac6ee612cdb7042263bfc9e73c Mon Sep 17 00:00:00 2001 +From: Jean-Baptiste Maneyrol +Date: Mon, 27 May 2024 21:00:08 +0000 +Subject: iio: imu: inv_icm42600: delete unneeded update watermark call + +From: Jean-Baptiste Maneyrol + +commit 245f3b149e6cc3ac6ee612cdb7042263bfc9e73c upstream. + +Update watermark will be done inside the hwfifo_set_watermark callback +just after the update_scan_mode. It is useless to do it here. + +Fixes: 7f85e42a6c54 ("iio: imu: inv_icm42600: add buffer support in iio devices") +Cc: stable@vger.kernel.org +Signed-off-by: Jean-Baptiste Maneyrol +Link: https://lore.kernel.org/r/20240527210008.612932-1-inv.git-commit@tdk.com +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 4 ---- + drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 4 ---- + 2 files changed, 8 deletions(-) + +--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c ++++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c +@@ -128,10 +128,6 @@ static int inv_icm42600_accel_update_sca + /* update data FIFO write */ + inv_icm42600_timestamp_apply_odr(ts, 0, 0, 0); + ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en); +- if (ret) +- goto out_unlock; +- +- ret = inv_icm42600_buffer_update_watermark(st); + + out_unlock: + mutex_unlock(&st->lock); +--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c ++++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c +@@ -128,10 +128,6 @@ static int inv_icm42600_gyro_update_scan + /* update data FIFO write */ + inv_icm42600_timestamp_apply_odr(ts, 0, 0, 0); + ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en); +- if (ret) +- goto out_unlock; +- +- ret = inv_icm42600_buffer_update_watermark(st); + + out_unlock: + mutex_unlock(&st->lock); diff --git a/queue-5.15/series b/queue-5.15/series index 0614ae9b4e0..83649a5684d 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -134,3 +134,7 @@ net-stmmac-replace-priv-speed-with-the-porttransmitr.patch net-ipv6-fix-the-rt-cache-flush-via-sysctl-using-a-p.patch ionic-fix-use-after-netif_napi_del.patch af_unix-read-with-msg_peek-loops-if-the-first-unread.patch +iio-adc-ad9467-fix-scan-type-sign.patch +iio-dac-ad5592r-fix-temperature-channel-scaling-value.patch +iio-imu-inv_icm42600-delete-unneeded-update-watermark-call.patch +drivers-core-synchronize-really_probe-and-dev_uevent.patch