Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] gpib: lpvo_usb_gpib: fix heap buffer overflow in lpvo_do_write()
@ 2026-05-13 23:20 Aditya
  0 siblings, 0 replies; only message in thread
From: Aditya @ 2026-05-13 23:20 UTC (permalink / raw)
  To: dpenkler; +Cc: linux-kernel, stable, Aditya

The memcpy in lpvo_do_write() uses the original unbounded 'count' parameter instead of the capped 'writesize', causing a heap buffer overflow when a user writes more than MAX_TRANSFER (3584 bytes) to /dev/lpvo_raw%d.

Fix by using 'writesize' which is already capped to MAX_TRANSFER.

Cc: stable@vger.kernel.org
Signed-off-by: Aditya <mail4adityaa@gmail.com>
---
 drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
index e6ea9422d6f2..ff7cef08031d 100644
--- a/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
+++ b/drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
@@ -1638,7 +1638,7 @@ static ssize_t lpvo_do_write(struct lpvo *dev, const char *buffer, size_t count)
 		goto error;
 	}
 
-	memcpy(buf, buffer, count);
+	memcpy(buf, buffer, writesize);
 
 	/* this lock makes sure we don't submit URBs to gone devices */
 	mutex_lock(&dev->io_mutex);
-- 
2.43.0


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

only message in thread, other threads:[~2026-05-13 23:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 23:20 [PATCH] gpib: lpvo_usb_gpib: fix heap buffer overflow in lpvo_do_write() Aditya

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