On Mon, 2016-04-04 at 12:31 +0200, Torsten Hilbrich wrote:
> commit a81cf9799ad7299b03a4dff020d9685f9ac5f3e0
> Author: Oliver Neukum <[email protected]>
> Date: Wed Feb 10 10:39:49 2016 +0100
>
> cdc-acm: implement put_char() and flush_chars()
Hi,
does this fix the issue?
Regards
Oliver
From e533cede8ccb9f5778f7894ee039f63ac083a334 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Mon, 4 Apr 2016 13:04:44 +0200
Subject: [PATCH] cdc-acm: fix crash if flushed with nothing buffered
Under some circumstances acm_tty_flush_chars() is called
with no buffer to flush. We simply need to do nothing.
Signed-off-by: Oliver Neukum <[email protected]>
Reported-by: Torsten Hilbrich <[email protected]>
---
drivers/usb/class/cdc-acm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 83fd30b..a6c4a1b 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -744,11 +744,15 @@ static void acm_tty_flush_chars(struct tty_struct *tty)
int err;
unsigned long flags;
+ if (!cur) /* nothing to do */
+ return;
+
acm->putbuffer = NULL;
err = usb_autopm_get_interface_async(acm->control);
spin_lock_irqsave(&acm->write_lock, flags);
if (err < 0) {
cur->use = 0;
+ acm->putbuffer = cur;
goto out;
}
--
2.1.4