* [PATCH] spi: ljca: Don't require data in write replies
@ 2026-11-03 13:14 Arpith Alexander
2026-11-04 5:52 ` Weibin Liu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arpith Alexander @ 2026-11-03 13:14 UTC (permalink / raw)
To: Mark Brown, Lixu Zhang, Sakari Ailus
Cc: Weibin Liu, linux-spi, linux-kernel, Arpith Alexander, stable
Commit 0fe4573c822c ("spi: ljca: validate the response length before
copying the data") made ljca_spi_read_write() reject any response whose
payload, as announced by r_packet->len, is not contained in the data
received.
That is right for reads, but the adapter acknowledges a write with only
the packet header: r_packet->len holds the number of bytes written and
no payload follows. The reply is 2 bytes long, so
"ret < sizeof(*r_packet) + r_packet->len" is true and every write fails
with -EIO.
Where the Intel Visual Sensing Controller (IVSC) is connected through
the LJCA, as on the Dell XPS 13 9340, its initialisation fails and the
camera behind it is lost:
spi_ljca usb_ljca.ljca-spi.0: transfer failed len: 256
vsc-tp spi-INTC10D0:00: SPI transfer failed: -5
intel_vsc intel_vsc: error -ENODEV: init hw failed
Only require the payload to be present when there is a receive buffer
to copy it into. Write acks are still checked for a non-zero length that
does not exceed the request.
Fixes: 0fe4573c822c ("spi: ljca: validate the response length before copying the data")
Cc: stable@vger.kernel.org # 6.8+
Signed-off-by: Arpith Alexander <arpith99@gmail.com>
---
Tested on a Dell XPS 13 9340: with this applied the IVSC initialises
again and the camera works.
0fe4573c822c is tagged for stable but has not been backported yet, so
it would be good to get this in before it is.
drivers/spi/spi-ljca.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-ljca.c b/drivers/spi/spi-ljca.c
index 8fd001610f67..b1babd43adda 100644
--- a/drivers/spi/spi-ljca.c
+++ b/drivers/spi/spi-ljca.c
@@ -109,8 +109,9 @@ static int ljca_spi_read_write(struct ljca_spi_dev *ljca_spi, const u8 *w_data,
if (ret < sizeof(*r_packet))
return -EIO;
- if (!r_packet->len || ret < sizeof(*r_packet) + r_packet->len ||
- r_packet->len > len)
+ /* write acks carry no payload */
+ if (!r_packet->len || r_packet->len > len ||
+ (r_data && ret < sizeof(*r_packet) + r_packet->len))
return -EIO;
if (r_data)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: ljca: Don't require data in write replies
2026-11-03 13:14 [PATCH] spi: ljca: Don't require data in write replies Arpith Alexander
@ 2026-11-04 5:52 ` Weibin Liu
2026-11-04 11:34 ` Sakari Ailus
2026-11-04 13:43 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Weibin Liu @ 2026-11-04 5:52 UTC (permalink / raw)
To: Arpith Alexander
Cc: Mark Brown, Lixu Zhang, Sakari Ailus, linux-spi, linux-kernel,
stable
Hi Arpith,
Thanks for catching and fixing this. I missed that write replies only
contain the header, with no payload following.
The fix looks good to me. For stable, it should be backported together
with 0fe4573c822c.
Reviewed-by: Weibin Liu <liuwb@xiaopeng.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: ljca: Don't require data in write replies
2026-11-03 13:14 [PATCH] spi: ljca: Don't require data in write replies Arpith Alexander
2026-11-04 5:52 ` Weibin Liu
@ 2026-11-04 11:34 ` Sakari Ailus
2026-11-04 13:43 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2026-11-04 11:34 UTC (permalink / raw)
To: Mark Brown, Arpith Alexander
Cc: Lixu Zhang, Weibin Liu, linux-spi, linux-kernel, stable
Hi Arpith,
On Tue, Nov 03, 2026 at 06:44:35PM +0530, Arpith Alexander wrote:
> Where the Intel Visual Sensing Controller (IVSC) is connected through
> the LJCA, as on the Dell XPS 13 9340, its initialisation fails and the
> camera behind it is lost:
>
> spi_ljca usb_ljca.ljca-spi.0: transfer failed len: 256
> vsc-tp spi-INTC10D0:00: SPI transfer failed: -5
> intel_vsc intel_vsc: error -ENODEV: init hw failed
Indeed. I can also confirm this is the case on Dell XPS 9315. I guess it's
the same on all systems with LJCA.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Mark: can we get this in as a fix for v7.4?
--
Regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: ljca: Don't require data in write replies
2026-11-03 13:14 [PATCH] spi: ljca: Don't require data in write replies Arpith Alexander
2026-11-04 5:52 ` Weibin Liu
2026-11-04 11:34 ` Sakari Ailus
@ 2026-11-04 13:43 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-11-04 13:43 UTC (permalink / raw)
To: Lixu Zhang, Sakari Ailus, Arpith Alexander
Cc: Weibin Liu, linux-spi, linux-kernel, stable
On Tue, 03 Nov 2026 18:44:35 +0530, Arpith Alexander wrote:
> spi: ljca: Don't require data in write replies
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.4
Thanks!
[1/1] spi: ljca: Don't require data in write replies
https://git.kernel.org/broonie/spi/c/5072a9fae45a
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-04 23:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 13:14 [PATCH] spi: ljca: Don't require data in write replies Arpith Alexander
2026-11-04 5:52 ` Weibin Liu
2026-11-04 11:34 ` Sakari Ailus
2026-11-04 13:43 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox