Skip to contentSkip to conversation

hso: memsetting wrong data in hso_get_count()

PATCH Applied Dan Carpenter 2 participants 2 messages Feb 22, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hso: memsetting wrong data in hso_get_count()

The intent was to clear out the icount struct here, but we accidentally clear stack memory instead. It probably will lead to a NULL dereference right away.

drivers/net/usb/hso.c +1 -1
index 304fe78..e1324b4 100644
@@ -1632,7 +1632,7 @@ static int hso_get_count(struct tty_struct *tty,
 	struct hso_serial *serial = get_serial_by_tty(tty);
 	struct hso_tiocmget  *tiocmget = serial->tiocmget;
 
-	memset(&icount, 0, sizeof(struct serial_icounter_struct));
+	memset(icount, 0, sizeof(struct serial_icounter_struct));
 
 	if (!tiocmget)
 		 return -ENOENT;
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Wed, 22 Feb 2012 10:30:25 +0300

Quoted 5 lines

The intent was to clear out the icount struct here, but we accidentally clear stack memory instead. It probably will lead to a NULL dereference right away.

Applied, thanks a lot Dan.