Skip to contentSkip to conversation

Char: riscom8, fix tty refcnt

PATCH New Jiri Slaby 1 participant 2 messages Sep 6, 2009

Subsystems (4)
lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/2 Char: riscom8, fix tty refcnt

Stanse found a tty refcnt leak on one fail path in rc_transmit. Fix that by jumping to the 'out' label.

http://stanse.fi.muni.cz/

---
 drivers/char/riscom8.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/riscom8.c +1 -1
index 3c7cf2c..3cfa22d 100644
@@ -467,7 +467,7 @@ static void rc_transmit(struct riscom_board const *bp)
 			rc_out(bp, CD180_CCR, CCR_CORCHG2);
 			port->break_length = 0;
 		}
-		return;
+		goto out;
 	}
 
 	count = CD180_NFIFO;
Signature · 1 line
1.6.4.2
author
#1 lore raw

PATCH 2/2 USB: serial/mct_u232, fix tty refcnt

Stanse found a tty refcnt leak in read_int_callback. In fact it's handled wrong altogether. tty_port_tty_get can return NULL and it's not checked in that manner.

Fix that by checking the tty_port_tty_get retval and put tty kref properly.

http://stanse.fi.muni.cz/

---
 drivers/usb/serial/mct_u232.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/usb/serial/mct_u232.c +6 -3
index d501aef..ad4998b 100644
@@ -566,10 +566,13 @@ static void mct_u232_read_int_callback(struct urb *urb)
 	 * Work-a-round: handle the 'usual' bulk-in pipe here
 	 */
 	if (urb->transfer_buffer_length > 2) {
-		tty = tty_port_tty_get(&port->port);
 		if (urb->actual_length) {
-			tty_insert_flip_string(tty, data, urb->actual_length);
-			tty_flip_buffer_push(tty);
+			tty = tty_port_tty_get(&port->port);
+			if (tty) {
+				tty_insert_flip_string(tty, data,
+						urb->actual_length);
+				tty_flip_buffer_push(tty);
+			}
 			tty_kref_put(tty);
 		}
 		goto exit;
Signature · 1 line
1.6.4.2