There's a syzbot report that device name buffers passed to device
replace are not properly checked for string termination which could lead
to a read out of bounds in getname_kernel().
Add a helper that validates both source and target device name buffers.
For devid as the source initialize the buffer to empty string in case
something tries to read it later.
This was originally analyzed and fixed in a different way by Edward Adam
Davis (see links).
Link: https://lore.kernel.org/linux-btrfs/000000000000d1a1d1060cc9c5e7@google.com/
Link: https://lore.kernel.org/linux-btrfs/tencent_44CA0665C9836EF9EEC80CB9E7E206D…
CC: stable(a)vger.kernel.org # 4.19+
CC: Edward Adam Davis <eadavis(a)qq.com>
Reported-and-tested-by: syzbot+33f23b49ac24f986c9e8(a)syzkaller.appspotmail.com
Signed-off-by: David Sterba <dsterba(a)suse.com>
---
fs/btrfs/dev-replace.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 1502d664c892..79c4293ddf37 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -725,6 +725,23 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
return ret;
}
+static int btrfs_check_replace_dev_names(struct btrfs_ioctl_dev_replace_args *args)
+{
+ if (args->start.srcdevid == 0) {
+ if (memchr(args->start.srcdev_name, 0,
+ sizeof(args->start.srcdev_name)) == NULL)
+ return -ENAMETOOLONG;
+ } else {
+ args->start.srcdev_name[0] = 0;
+ }
+
+ if (memchr(args->start.tgtdev_name, 0,
+ sizeof(args->start.tgtdev_name)) == NULL)
+ return -ENAMETOOLONG;
+
+ return 0;
+}
+
int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
struct btrfs_ioctl_dev_replace_args *args)
{
@@ -737,10 +754,9 @@ int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
default:
return -EINVAL;
}
-
- if ((args->start.srcdevid == 0 && args->start.srcdev_name[0] == '\0') ||
- args->start.tgtdev_name[0] == '\0')
- return -EINVAL;
+ ret = btrfs_check_replace_dev_names(args);
+ if (ret < 0)
+ return ret;
ret = btrfs_dev_replace_start(fs_info, args->start.tgtdev_name,
args->start.srcdevid,
--
2.42.1
commit 38296afe3c6ee07319e01bb249aa4bb47c07b534 upstream.
Syzbot reported a hang issue in migrate_pages_batch() called by mbind()
and nilfs_lookup_dirty_data_buffers() called in the log writer of nilfs2.
While migrate_pages_batch() locks a folio and waits for the writeback to
complete, the log writer thread that should bring the writeback to
completion picks up the folio being written back in
nilfs_lookup_dirty_data_buffers() that it calls for subsequent log
creation and was trying to lock the folio. Thus causing a deadlock.
In the first place, it is unexpected that folios/pages in the middle of
writeback will be updated and become dirty. Nilfs2 adds a checksum to
verify the validity of the log being written and uses it for recovery at
mount, so data changes during writeback are suppressed. Since this is
broken, an unclean shutdown could potentially cause recovery to fail.
Investigation revealed that the root cause is that the wait for writeback
completion in nilfs_page_mkwrite() is conditional, and if the backing
device does not require stable writes, data may be modified without
waiting.
Fix these issues by making nilfs_page_mkwrite() wait for writeback to
finish regardless of the stable write requirement of the backing device.
Link: https://lkml.kernel.org/r/20240131145657.4209-1-konishi.ryusuke@gmail.com
Fixes: 1d1d1a767206 ("mm: only enforce stable page writes if the backing device requires it")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke(a)gmail.com>
Reported-by: syzbot+ee2ae68da3b22d04cd8d(a)syzkaller.appspotmail.com
Closes: https://lkml.kernel.org/r/00000000000047d819061004ad6c@google.com
Tested-by: Ryusuke Konishi <konishi.ryusuke(a)gmail.com>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
Please apply this patch to the stable trees indicated by the subject line
prefix.
This patch is tailored to account for page/folio conversion and an fs-wide
change around page_mkwrite, and is applicable as-is to all versions from
v3.9 (where the issue was introduced) to v6.5.
Also, all the builds and retests I did on each stable tree passed.
Thanks,
Ryusuke Konishi
fs/nilfs2/file.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
index a265d391ffe9..822e8d95d31e 100644
--- a/fs/nilfs2/file.c
+++ b/fs/nilfs2/file.c
@@ -105,7 +105,13 @@ static vm_fault_t nilfs_page_mkwrite(struct vm_fault *vmf)
nilfs_transaction_commit(inode->i_sb);
mapped:
- wait_for_stable_page(page);
+ /*
+ * Since checksumming including data blocks is performed to determine
+ * the validity of the log to be written and used for recovery, it is
+ * necessary to wait for writeback to finish here, regardless of the
+ * stable write requirement of the backing device.
+ */
+ wait_on_page_writeback(page);
out:
sb_end_pagefault(inode->i_sb);
return block_page_mkwrite_return(ret);
--
2.39.3
This is the start of the stable review cycle for the 6.1.78 release.
There are 64 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu, 15 Feb 2024 17:18:29 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.78-rc1…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.1.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 6.1.78-rc1
Jiri Wiesner <jwiesner(a)suse.de>
clocksource: Skip watchdog check for large watchdog intervals
Jens Axboe <axboe(a)kernel.dk>
block: treat poll queue enter similarly to timeouts
Sheng Yong <shengyong(a)oppo.com>
f2fs: add helper to check compression level
Mike Marciniszyn <mike.marciniszyn(a)intel.com>
RDMA/irdma: Fix support for 64k pages
Prathu Baronia <prathubaronia2011(a)gmail.com>
vhost: use kzalloc() instead of kmalloc() followed by memset()
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Revert "ASoC: amd: Add new dmi entries for acp5x platform"
Jens Axboe <axboe(a)kernel.dk>
io_uring/net: fix sr->len for IORING_OP_RECV with MSG_WAITALL and buffers
Hans de Goede <hdegoede(a)redhat.com>
Input: atkbd - skip ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID
Werner Sembach <wse(a)tuxedocomputers.com>
Input: i8042 - fix strange behavior of touchpad on Clevo NS70PU
Frederic Weisbecker <frederic(a)kernel.org>
hrtimer: Report offline hrtimer enqueue
Michal Pecio <michal.pecio(a)gmail.com>
xhci: handle isoc Babble and Buffer Overrun events properly
Mathias Nyman <mathias.nyman(a)linux.intel.com>
xhci: process isoc TD properly when there was a transaction error mid TD.
Prashanth K <quic_prashk(a)quicinc.com>
usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK
Prashanth K <quic_prashk(a)quicinc.com>
usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK
Leonard Dallmayr <leonard.dallmayr(a)mailbox.org>
USB: serial: cp210x: add ID for IMST iM871A-USB
Puliang Lu <puliang.lu(a)fibocom.com>
USB: serial: option: add Fibocom FM101-GL variant
JackBB Wu <wojackbb(a)gmail.com>
USB: serial: qcserial: add new usb-id for Dell Wireless DW5826e
Sean Young <sean(a)mess.org>
ALSA: usb-audio: add quirk for RODE NT-USB+
Julian Sikorski <belegdol+github(a)gmail.com>
ALSA: usb-audio: Add a quirk for Yamaha YIT-W12TX transmitter
Alexander Tsoy <alexander(a)tsoy.me>
ALSA: usb-audio: Add delay quirk for MOTU M Series 2nd revision
Francesco Dolcini <francesco.dolcini(a)toradex.com>
mtd: parsers: ofpart: add workaround for #size-cells 0
Alexander Aring <aahringo(a)redhat.com>
fs: dlm: don't put dlm_local_addrs on heap
Tejun Heo <tj(a)kernel.org>
blk-iocost: Fix an UBSAN shift-out-of-bounds warning
Ming Lei <ming.lei(a)redhat.com>
scsi: core: Move scsi_host_busy() out of host lock if it is for per-command
Dan Carpenter <dan.carpenter(a)linaro.org>
fs/ntfs3: Fix an NULL dereference bug
Florian Westphal <fw(a)strlen.de>
netfilter: nft_set_pipapo: remove scratch_aligned pointer
Florian Westphal <fw(a)strlen.de>
netfilter: nft_set_pipapo: add helper to release pcpu scratch area
Florian Westphal <fw(a)strlen.de>
netfilter: nft_set_pipapo: store index in scratch maps
Pablo Neira Ayuso <pablo(a)netfilter.org>
netfilter: nft_ct: reject direction for ct id
Srinivasan Shanmugam <srinivasan.shanmugam(a)amd.com>
drm/amd/display: Implement bounds check for stream encoder creation in DCN301
Pablo Neira Ayuso <pablo(a)netfilter.org>
netfilter: nft_compat: restrict match/target protocol to u16
Pablo Neira Ayuso <pablo(a)netfilter.org>
netfilter: nft_compat: reject unused compat flag
Pablo Neira Ayuso <pablo(a)netfilter.org>
netfilter: nft_compat: narrow down revision to unsigned 8-bits
Jakub Kicinski <kuba(a)kernel.org>
selftests: cmsg_ipv6: repeat the exact packet
Eric Dumazet <edumazet(a)google.com>
ppp_async: limit MRU to 64K
Kuniyuki Iwashima <kuniyu(a)amazon.com>
af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.
Shigeru Yoshida <syoshida(a)redhat.com>
tipc: Check the bearer type before calling tipc_udp_nl_bearer_add()
David Howells <dhowells(a)redhat.com>
rxrpc: Fix response to PING RESPONSE ACKs to a dead call
Dan Carpenter <dan.carpenter(a)linaro.org>
drm/i915/gvt: Fix uninitialized variable in handle_mmio()
Eric Dumazet <edumazet(a)google.com>
inet: read sk->sk_family once in inet_recv_error()
Zhang Rui <rui.zhang(a)intel.com>
hwmon: (coretemp) Fix bogus core_id to attr name mapping
Zhang Rui <rui.zhang(a)intel.com>
hwmon: (coretemp) Fix out-of-bounds memory access
Loic Prylli <lprylli(a)netflix.com>
hwmon: (aspeed-pwm-tacho) mutex for tach reading
Zhipeng Lu <alexious(a)zju.edu.cn>
octeontx2-pf: Fix a memleak otx2_sq_init
Zhipeng Lu <alexious(a)zju.edu.cn>
atm: idt77252: fix a memleak in open_card_ubr0
Antoine Tenart <atenart(a)kernel.org>
tunnels: fix out of bounds access when building IPv6 PMTU error
Paolo Abeni <pabeni(a)redhat.com>
selftests: net: avoid just another constant wait
Paolo Abeni <pabeni(a)redhat.com>
selftests: net: cut more slack for gro fwd tests.
Ivan Vecera <ivecera(a)redhat.com>
net: atlantic: Fix DMA mapping for PTP hwts ring
Eric Dumazet <edumazet(a)google.com>
netdevsim: avoid potential loop in nsim_dev_trap_report_work()
Johannes Berg <johannes.berg(a)intel.com>
wifi: mac80211: fix waiting for beacons logic
Furong Xu <0x1207(a)gmail.com>
net: stmmac: xgmac: fix handling of DPP safety error for DMA channels
Abhinav Kumar <quic_abhinavk(a)quicinc.com>
drm/msm/dpu: check for valid hw_pp in dpu_encoder_helper_phys_cleanup
Kuogee Hsieh <quic_khsieh(a)quicinc.com>
drm/msm/dp: return correct Colorimetry for DP_TEST_DYNAMIC_RANGE_CEA case
Kuogee Hsieh <quic_khsieh(a)quicinc.com>
drm/msms/dp: fixed link clock divider bits be over written in BPC unknown case
Shyam Prasad N <sprasad(a)microsoft.com>
cifs: failure to add channel on iface should bump up weight
Tony Lindgren <tony(a)atomide.com>
phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP
Frank Li <Frank.Li(a)nxp.com>
dmaengine: fix is_slave_direction() return false when DMA_DEV_TO_DEV
Yoshihiro Shimoda <yoshihiro.shimoda.uh(a)renesas.com>
phy: renesas: rcar-gen3-usb2: Fix returning wrong error code
Christophe JAILLET <christophe.jaillet(a)wanadoo.fr>
dmaengine: fsl-qdma: Fix a memory leak related to the queue command DMA
Christophe JAILLET <christophe.jaillet(a)wanadoo.fr>
dmaengine: fsl-qdma: Fix a memory leak related to the status queue DMA
Jai Luthra <j-luthra(a)ti.com>
dmaengine: ti: k3-udma: Report short packet errors
Guanhua Gao <guanhua.gao(a)nxp.com>
dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools
Baokun Li <libaokun1(a)huawei.com>
ext4: regenerate buddy after block freeing failed if under fc replay
-------------
Diffstat:
Makefile | 4 +-
block/blk-core.c | 11 ++-
block/blk-iocost.c | 7 ++
drivers/atm/idt77252.c | 2 +
drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c | 10 +-
drivers/dma/fsl-qdma.c | 27 ++----
drivers/dma/ti/k3-udma.c | 10 +-
.../drm/amd/display/dc/dcn301/dcn301_resource.c | 2 +-
drivers/gpu/drm/i915/gvt/handlers.c | 3 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 +-
drivers/gpu/drm/msm/dp/dp_ctrl.c | 5 -
drivers/gpu/drm/msm/dp/dp_link.c | 22 +++--
drivers/gpu/drm/msm/dp/dp_reg.h | 3 +
drivers/hwmon/aspeed-pwm-tacho.c | 7 ++
drivers/hwmon/coretemp.c | 40 ++++----
drivers/infiniband/hw/irdma/verbs.c | 2 +-
drivers/input/keyboard/atkbd.c | 13 ++-
drivers/input/serio/i8042-acpipnpio.h | 6 ++
drivers/mtd/parsers/ofpart_core.c | 19 ++++
drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 4 +-
drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 13 +++
drivers/net/ethernet/aquantia/atlantic/aq_ring.h | 1 +
.../ethernet/marvell/octeontx2/nic/otx2_common.c | 14 ++-
drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 3 +
.../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 57 ++++++++++-
drivers/net/netdevsim/dev.c | 8 +-
drivers/net/ppp/ppp_async.c | 4 +
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 4 -
drivers/phy/ti/phy-omap-usb2.c | 4 +-
drivers/scsi/scsi_error.c | 3 +-
drivers/scsi/scsi_lib.c | 4 +-
drivers/usb/dwc3/host.c | 4 +-
drivers/usb/host/xhci-plat.c | 3 +
drivers/usb/host/xhci-ring.c | 80 ++++++++++++---
drivers/usb/host/xhci.h | 1 +
drivers/usb/serial/cp210x.c | 1 +
drivers/usb/serial/option.c | 1 +
drivers/usb/serial/qcserial.c | 2 +
drivers/vhost/vhost.c | 5 +-
fs/dlm/lowcomms.c | 38 +++-----
fs/ext4/mballoc.c | 20 ++++
fs/f2fs/compress.c | 27 ++++++
fs/f2fs/f2fs.h | 2 +
fs/f2fs/super.c | 4 +-
fs/ntfs3/ntfs_fs.h | 2 +-
fs/smb/client/sess.c | 2 +
include/linux/dmaengine.h | 3 +-
include/linux/hrtimer.h | 4 +-
include/uapi/linux/netfilter/nf_tables.h | 2 +
io_uring/net.c | 1 +
kernel/time/clocksource.c | 25 ++++-
kernel/time/hrtimer.c | 3 +
net/ipv4/af_inet.c | 6 +-
net/ipv4/ip_tunnel_core.c | 2 +-
net/mac80211/mlme.c | 3 +-
net/netfilter/nft_compat.c | 17 +++-
net/netfilter/nft_ct.c | 3 +
net/netfilter/nft_set_pipapo.c | 108 ++++++++++-----------
net/netfilter/nft_set_pipapo.h | 18 +++-
net/netfilter/nft_set_pipapo_avx2.c | 17 ++--
net/rxrpc/conn_event.c | 8 ++
net/tipc/bearer.c | 6 ++
net/unix/garbage.c | 11 +++
sound/soc/amd/acp-config.c | 15 +--
sound/usb/quirks.c | 6 ++
tools/testing/selftests/net/cmsg_ipv6.sh | 4 +-
tools/testing/selftests/net/pmtu.sh | 18 +++-
tools/testing/selftests/net/udpgro_fwd.sh | 14 ++-
tools/testing/selftests/net/udpgso_bench_rx.c | 2 +-
70 files changed, 566 insertions(+), 239 deletions(-)
This is a note to let you know that I've just added the patch titled
iio: accel: bma400: Fix a compilation problem
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
From 4cb81840d8f29b66d9d05c6d7f360c9560f7e2f4 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <mario.limonciello(a)amd.com>
Date: Wed, 31 Jan 2024 16:52:46 -0600
Subject: iio: accel: bma400: Fix a compilation problem
The kernel fails when compiling without `CONFIG_REGMAP_I2C` but with
`CONFIG_BMA400`.
```
ld: drivers/iio/accel/bma400_i2c.o: in function `bma400_i2c_probe':
bma400_i2c.c:(.text+0x23): undefined reference to `__devm_regmap_init_i2c'
```
Link: https://download.01.org/0day-ci/archive/20240131/202401311634.FE5CBVwe-lkp@…
Fixes: 465c811f1f20 ("iio: accel: Add driver for the BMA400")
Fixes: 9bea10642396 ("iio: accel: bma400: add support for bma400 spi")
Signed-off-by: Mario Limonciello <mario.limonciello(a)amd.com>
Link: https://lore.kernel.org/r/20240131225246.14169-1-mario.limonciello@amd.com
Cc: <Stable(a)vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
---
drivers/iio/accel/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index 91adcac875a4..c9d7afe489e8 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -219,10 +219,12 @@ config BMA400
config BMA400_I2C
tristate
+ select REGMAP_I2C
depends on BMA400
config BMA400_SPI
tristate
+ select REGMAP_SPI
depends on BMA400
config BMC150_ACCEL
--
2.43.1
This is a note to let you know that I've just added the patch titled
iio: commom: st_sensors: ensure proper DMA alignment
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
From 862cf85fef85becc55a173387527adb4f076fab0 Mon Sep 17 00:00:00 2001
From: Nuno Sa <nuno.sa(a)analog.com>
Date: Wed, 31 Jan 2024 10:16:47 +0100
Subject: iio: commom: st_sensors: ensure proper DMA alignment
Aligning the buffer to the L1 cache is not sufficient in some platforms
as they might have larger cacheline sizes for caches after L1 and thus,
we can't guarantee DMA safety.
That was the whole reason to introduce IIO_DMA_MINALIGN in [1]. Do the same
for st_sensors common buffer.
While at it, moved the odr_lock before buffer_data as we definitely
don't want any other data to share a cacheline with the buffer.
[1]: https://lore.kernel.org/linux-iio/20220508175712.647246-2-jic23@kernel.org/
Fixes: e031d5f558f1 ("iio:st_sensors: remove buffer allocation at each buffer enable")
Signed-off-by: Nuno Sa <nuno.sa(a)analog.com>
Cc: <Stable(a)vger.kernel.org>
Link: https://lore.kernel.org/r/20240131-dev_dma_safety_stm-v2-1-580c07fae51b@ana…
Signed-off-by: Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
---
include/linux/iio/common/st_sensors.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 607c3a89a647..f9ae5cdd884f 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -258,9 +258,9 @@ struct st_sensor_data {
bool hw_irq_trigger;
s64 hw_timestamp;
- char buffer_data[ST_SENSORS_MAX_BUFFER_SIZE] ____cacheline_aligned;
-
struct mutex odr_lock;
+
+ char buffer_data[ST_SENSORS_MAX_BUFFER_SIZE] __aligned(IIO_DMA_MINALIGN);
};
#ifdef CONFIG_IIO_BUFFER
--
2.43.1
This is a note to let you know that I've just added the patch titled
iio: hid-sensor-als: Return 0 for HID_USAGE_SENSOR_TIME_TIMESTAMP
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
From 621c6257128149e45b36ffb973a01c3f3461b893 Mon Sep 17 00:00:00 2001
From: Srinivas Pandruvada <srinivas.pandruvada(a)linux.intel.com>
Date: Sun, 4 Feb 2024 04:56:17 -0800
Subject: iio: hid-sensor-als: Return 0 for HID_USAGE_SENSOR_TIME_TIMESTAMP
When als_capture_sample() is called with usage ID
HID_USAGE_SENSOR_TIME_TIMESTAMP, return 0. The HID sensor core ignores
the return value for capture_sample() callback, so return value doesn't
make difference. But correct the return value to return success instead
of -EINVAL.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada(a)linux.intel.com>
Link: https://lore.kernel.org/r/20240204125617.2635574-1-srinivas.pandruvada@linu…
Cc: <Stable(a)vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
---
drivers/iio/light/hid-sensor-als.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 5cd27f04b45e..b6c4bef2a7bb 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -226,6 +226,7 @@ static int als_capture_sample(struct hid_sensor_hub_device *hsdev,
case HID_USAGE_SENSOR_TIME_TIMESTAMP:
als_state->timestamp = hid_sensor_convert_timestamp(&als_state->common_attributes,
*(s64 *)raw_data);
+ ret = 0;
break;
default:
break;
--
2.43.1
This is a note to let you know that I've just added the patch titled
staging: iio: ad5933: fix type mismatch regression
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
From 6db053cd949fcd6254cea9f2cd5d39f7bd64379c Mon Sep 17 00:00:00 2001
From: David Schiller <david.schiller(a)jku.at>
Date: Mon, 22 Jan 2024 14:49:17 +0100
Subject: staging: iio: ad5933: fix type mismatch regression
Commit 4c3577db3e4f ("Staging: iio: impedance-analyzer: Fix sparse
warning") fixed a compiler warning, but introduced a bug that resulted
in one of the two 16 bit IIO channels always being zero (when both are
enabled).
This is because int is 32 bits wide on most architectures and in the
case of a little-endian machine the two most significant bytes would
occupy the buffer for the second channel as 'val' is being passed as a
void pointer to 'iio_push_to_buffers()'.
Fix by defining 'val' as u16. Tested working on ARM64.
Fixes: 4c3577db3e4f ("Staging: iio: impedance-analyzer: Fix sparse warning")
Signed-off-by: David Schiller <david.schiller(a)jku.at>
Link: https://lore.kernel.org/r/20240122134916.2137957-1-david.schiller@jku.at
Cc: <Stable(a)vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
---
drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index e748a5d04e97..9149d41fe65b 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -608,7 +608,7 @@ static void ad5933_work(struct work_struct *work)
struct ad5933_state, work.work);
struct iio_dev *indio_dev = i2c_get_clientdata(st->client);
__be16 buf[2];
- int val[2];
+ u16 val[2];
unsigned char status;
int ret;
--
2.43.1
This is a note to let you know that I've just added the patch titled
iio: adc: ad_sigma_delta: ensure proper DMA alignment
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
From 59598510be1d49e1cff7fd7593293bb8e1b2398b Mon Sep 17 00:00:00 2001
From: Nuno Sa <nuno.sa(a)analog.com>
Date: Wed, 17 Jan 2024 13:41:03 +0100
Subject: iio: adc: ad_sigma_delta: ensure proper DMA alignment
Aligning the buffer to the L1 cache is not sufficient in some platforms
as they might have larger cacheline sizes for caches after L1 and thus,
we can't guarantee DMA safety.
That was the whole reason to introduce IIO_DMA_MINALIGN in [1]. Do the same
for the sigma_delta ADCs.
[1]: https://lore.kernel.org/linux-iio/20220508175712.647246-2-jic23@kernel.org/
Fixes: 0fb6ee8d0b5e ("iio: ad_sigma_delta: Don't put SPI transfer buffer on the stack")
Signed-off-by: Nuno Sa <nuno.sa(a)analog.com>
Link: https://lore.kernel.org/r/20240117-dev_sigma_delta_no_irq_flags-v1-1-db3926…
Cc: <Stable(a)vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
---
include/linux/iio/adc/ad_sigma_delta.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h
index 7852f6c9a714..719cf9cc6e1a 100644
--- a/include/linux/iio/adc/ad_sigma_delta.h
+++ b/include/linux/iio/adc/ad_sigma_delta.h
@@ -8,6 +8,8 @@
#ifndef __AD_SIGMA_DELTA_H__
#define __AD_SIGMA_DELTA_H__
+#include <linux/iio/iio.h>
+
enum ad_sigma_delta_mode {
AD_SD_MODE_CONTINUOUS = 0,
AD_SD_MODE_SINGLE = 1,
@@ -99,7 +101,7 @@ struct ad_sigma_delta {
* 'rx_buf' is up to 32 bits per sample + 64 bit timestamp,
* rounded to 16 bytes to take into account padding.
*/
- uint8_t tx_buf[4] ____cacheline_aligned;
+ uint8_t tx_buf[4] __aligned(IIO_DMA_MINALIGN);
uint8_t rx_buf[16] __aligned(8);
};
--
2.43.1
This is a note to let you know that I've just added the patch titled
iio: imu: adis: ensure proper DMA alignment
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.
If you have any questions about this process, please let me know.
From 8e98b87f515d8c4bae521048a037b2cc431c3fd5 Mon Sep 17 00:00:00 2001
From: Nuno Sa <nuno.sa(a)analog.com>
Date: Wed, 17 Jan 2024 14:10:49 +0100
Subject: iio: imu: adis: ensure proper DMA alignment
Aligning the buffer to the L1 cache is not sufficient in some platforms
as they might have larger cacheline sizes for caches after L1 and thus,
we can't guarantee DMA safety.
That was the whole reason to introduce IIO_DMA_MINALIGN in [1]. Do the same
for the sigma_delta ADCs.
[1]: https://lore.kernel.org/linux-iio/20220508175712.647246-2-jic23@kernel.org/
Fixes: ccd2b52f4ac6 ("staging:iio: Add common ADIS library")
Signed-off-by: Nuno Sa <nuno.sa(a)analog.com>
Link: https://lore.kernel.org/r/20240117-adis-improv-v1-1-7f90e9fad200@analog.com
Cc: <Stable(a)vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
---
include/linux/iio/imu/adis.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index dc9ea299e088..8898966bc0f0 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -11,6 +11,7 @@
#include <linux/spi/spi.h>
#include <linux/interrupt.h>
+#include <linux/iio/iio.h>
#include <linux/iio/types.h>
#define ADIS_WRITE_REG(reg) ((0x80 | (reg)))
@@ -131,7 +132,7 @@ struct adis {
unsigned long irq_flag;
void *buffer;
- u8 tx[10] ____cacheline_aligned;
+ u8 tx[10] __aligned(IIO_DMA_MINALIGN);
u8 rx[4];
};
--
2.43.1