mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpib: fluke: Fix possible null dereference in fluke_dma_read()
@ 2026-12-01 13:36 Thomas Fourier
  0 siblings, 0 replies; only message in thread
From: Thomas Fourier @ 2026-12-01 13:36 UTC (permalink / raw)
  Cc: Thomas Fourier, Dave Penkler, Greg Kroah-Hartman,
	Dominik Karol Piątkowski,
	Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Takashi Sakamoto, open list

fluke_dma_read() maps the DMA buffer with board->dev, but when
dmaengine_prep_slave_single() fails it calls dma_unmap_single() with a
NULL device. This call may dereference the device pointer.

Unmap with board->dev.

Fixes: 55936779f496 ("staging: gpib: Add Fluke cda based cards GPIB driver")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/gpib/eastwood/fluke_gpib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpib/eastwood/fluke_gpib.c b/drivers/gpib/eastwood/fluke_gpib.c
index 1363f0a1f570..f08a8229aa99 100644
--- a/drivers/gpib/eastwood/fluke_gpib.c
+++ b/drivers/gpib/eastwood/fluke_gpib.c
@@ -585,7 +585,7 @@ static int fluke_dma_read(struct gpib_board *board, u8 *buffer,
 					      DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!tx_desc) {
 		dev_err(board->gpib_dev, "failed to allocate dma transmit descriptor\n");
-		dma_unmap_single(NULL, bus_address, length, DMA_FROM_DEVICE);
+		dma_unmap_single(board->dev, bus_address, length, DMA_FROM_DEVICE);
 		return -EIO;
 	}
 	tx_desc->callback = fluke_dma_callback;
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01 13:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-01 13:36 [PATCH] gpib: fluke: Fix possible null dereference in fluke_dma_read() Thomas Fourier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®