Skip to contentSkip to conversation

drivers/tty/serial: avoid double free after call ioc4_serial_remove_one

PATCH In review Chen Gang 1 participant 2 messages Dec 26, 2012 – Jan 10, 2013 TTY layer and serial drivers

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 drivers/tty/serial: avoid double free after call ioc4_serial_remove_one

before goto out5, soft, control, serial are all assigned to idd after finish call ioc4_serial_remove_one, all resources are released we need return instead of go on, or double free

---
 drivers/tty/serial/ioc4_serial.c |    1 +
 1 file changed, 1 insertion(+)
drivers/tty/serial/ioc4_serial.c +1 -0
index 3e7da10..c4e30b8 100644
@@ -2883,6 +2883,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
 	/* error exits that give back resources */
 out5:
 	ioc4_serial_remove_one(idd);
+	return ret;
 out4:
 	kfree(soft);
 out3:
Signature · 1 line
1.7.10.4
author
#1 lore raw

Hello Alan Cox:

can you have time to give a glance for it ?

I send it according to the MAINTAINER file, if I send to an incorrect member, please tell me.

thanks.

gchen

Quoted 23 lines · Chen Gang

before goto out5, soft, control, serial are all assigned to idd after finish call ioc4_serial_remove_one, all resources are released we need return instead of go on, or double free

---
 drivers/tty/serial/ioc4_serial.c |    1 +
 1 file changed, 1 insertion(+)
drivers/tty/serial/ioc4_serial.c +1 -0
index 3e7da10..c4e30b8 100644
@@ -2883,6 +2883,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
 	/* error exits that give back resources */
 out5:
 	ioc4_serial_remove_one(idd);
+	return ret;
 out4:
 	kfree(soft);
 out3:
Signature · 7 lines
Chen Gang

Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html