FAILED: patch "[PATCH] iio: dac: mcp4821: reject devices without match data" failed to apply to 6.18-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 6ac1faf4de61dcf27ffe8f2c25d96fe5f4b2886d
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 6ac1faf4de61dcf27ffe8f2c25d96fe5f4b2886d Mon Sep 17 00:00:00 2001
From: Jiale Yao <[email protected]>
Date: Fri, 25 Sep 2026 21:17:32 +0800
Subject: [PATCH] iio: dac: mcp4821: reject devices without match data
A device bound through driver_override need not match an entry in the driver tables. In that case spi_get_device_match_data() returns NULL, but mcp4821_probe() dereferences the result while configuring the IIO device.
Reject devices without match data before using the chip information.
--- drivers/iio/dac/mcp4821.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/iio/dac/mcp4821.c +5 -2
@@ -255,9 +255,13 @@ static const struct iio_info mcp4821_info = {static int mcp4821_probe (struct spi_device *spi) { +const struct mcp4821_chip_info *info;struct iio_dev *indio_dev;struct mcp4821_state *state; -const struct mcp4821_chip_info *info; + + info =spi_get_device_match_data (spi); +if (!info) +return -ENODATA ; indio_dev =devm_iio_device_alloc (&spi->dev,sizeof (*state));if (indio_dev ==NULL )
@@ -268,7 +272,6 @@ static int mcp4821_probe(struct spi_device *spi)/* default gain is 2x */ state->gain =2 ; - info =spi_get_device_match_data (spi); indio_dev->name = info->name; indio_dev->info = &mcp4821_info; indio_dev->modes =INDIO_DIRECT_MODE ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 iio: dac: mcp4821: reject devices without match data
From: Jiale Yao <[email protected]>
[ Upstream commit 6ac1faf4de61dcf27ffe8f2c25d96fe5f4b2886d ]
A device bound through driver_override need not match an entry in the driver tables. In that case spi_get_device_match_data() returns NULL, but mcp4821_probe() dereferences the result while configuring the IIO device.
Reject devices without match data before using the chip information.
--- drivers/iio/dac/mcp4821.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/iio/dac/mcp4821.c +5 -2
@@ -172,9 +172,13 @@ static const struct iio_info mcp4821_info = {static int mcp4821_probe (struct spi_device *spi) { +const struct mcp4821_chip_info *info;struct iio_dev *indio_dev;struct mcp4821_state *state; -const struct mcp4821_chip_info *info; + + info =spi_get_device_match_data (spi); +if (!info) +return -ENODATA ; indio_dev =devm_iio_device_alloc (&spi->dev,sizeof (*state));if (indio_dev ==NULL )
@@ -183,7 +187,6 @@ static int mcp4821_probe(struct spi_device *spi) state =iio_priv (indio_dev); state->spi = spi; - info =spi_get_device_match_data (spi); indio_dev->name = info->name; indio_dev->info = &mcp4821_info; indio_dev->modes =INDIO_DIRECT_MODE ;
Signature · 1 line
2.53.0