From: sashiko-bot@kernel.org
To: "Taha Ed-Dafili" <0rayn.dev@gmail.com>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v3 3/5] iio: dac: ad5504: Align headers with IWYU principle
Date: Sat, 09 May 2026 14:55:18 +0000 [thread overview]
Message-ID: <20260509145519.360B8C2BCB2@smtp.kernel.org> (raw)
In-Reply-To: <20260509142047.30302-4-0rayn.dev@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing lock protection for shared SPI DMA buffer 'st->data'.
--
commit 4601fb5b571a0290d2e1fd539e465ce5c954b588
Author: Taha Ed-Dafili <0rayn.dev@gmail.com>
iio: dac: ad5504: Align headers with IWYU principle
This commit updates the header inclusions to follow the Include What You Use
principle and ensures they are sorted alphabetically. Unused headers are
removed, and required ones are added.
> diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
> index 03ce37e2c616a..57e6eeed26efb 100644
> --- a/drivers/iio/dac/ad5504.c
> +++ b/drivers/iio/dac/ad5504.c
> @@ -5,16 +5,19 @@
> * Copyright 2011 Analog Devices Inc.
> */
>
> -#include <linux/bitops.h>
> +#include <asm/byteorder.h>
> +#include <linux/array_size.h>
> +#include <linux/bits.h>
> #include <linux/device.h>
[ ... ]
> #include <linux/sysfs.h>
> +#include <linux/types.h>
>
> #include <linux/iio/dac/ad5504.h>
> #include <linux/iio/events.h>
This isn't a regression from this patch, but while reviewing this driver
I noticed a concurrency issue.
The driver allocates a shared tx/rx buffer st->data for SPI transfers.
Multiple sysfs callbacks, such as ad5504_read_raw(), ad5504_write_raw(),
and ad5504_write_dac_powerdown(), directly access and modify st->data
without any driver-level locking.
If thread A calls ad5504_spi_read() and thread B calls ad5504_spi_write()
concurrently, can thread B overwrite st->data[0] while thread A's
spi_sync_transfer() is in progress?
Modifying a DMA buffer while a transfer is in flight violates SPI API
contracts, corrupts the transmitted data, and causes the DAC to receive
incorrect commands.
Additionally, read-modify-write operations on driver state like
st->pwr_down_mask lack locking. Could concurrent writes to different
channels' powerdown files race?
Would it be appropriate to introduce a lock to serialize sysfs operations?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260509142047.30302-1-0rayn.dev@gmail.com?part=3
next prev parent reply other threads:[~2026-05-09 14:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 14:20 [PATCH v3 0/5] iio: dac: ad5504: bindings, cleanups, and scale fixes Taha Ed-Dafili
2026-05-09 14:20 ` [PATCH v3 1/5] dt-bindings: iio: dac: ad5504: add output-range and missing gpios Taha Ed-Dafili
2026-05-09 14:45 ` sashiko-bot
2026-05-09 14:20 ` [PATCH v3 2/5] iio: dac: ad5504: sort headers alphabetically Taha Ed-Dafili
2026-05-09 14:20 ` [PATCH v3 3/5] iio: dac: ad5504: Align headers with IWYU principle Taha Ed-Dafili
2026-05-09 14:55 ` sashiko-bot [this message]
2026-05-09 14:20 ` [PATCH v3 4/5] iio: dac: ad5504: introduce local dev pointer Taha Ed-Dafili
2026-05-09 14:20 ` [PATCH v3 5/5] iio: dac: ad5504: fix scale via output-range-microvolt Taha Ed-Dafili
2026-05-09 14:57 ` Jonathan Cameron
2026-05-09 15:29 ` sashiko-bot
2026-05-09 20:59 ` David Lechner
2026-05-09 20:46 ` [PATCH v3 0/5] iio: dac: ad5504: bindings, cleanups, and scale fixes David Lechner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260509145519.360B8C2BCB2@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=0rayn.dev@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sashiko@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox