lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 11 Apr 2014 11:45:16 +0200
From:	Johan Hovold <jhovold@...il.com>
To:	Oliver Neukum <oneukum@...e.de>
Cc:	Johan Hovold <jhovold@...il.com>, Xiao Jin <jin.xiao@...el.com>,
	gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, david.a.cohen@...ux.intel.com,
	yanmin.zhang@...el.com
Subject: Re: [PATCH] cdc-acm: some enhancement on acm delayed write

On Tue, Apr 08, 2014 at 12:22:22PM +0200, Oliver Neukum wrote:
> On Tue, 2014-04-08 at 09:33 +0200, Johan Hovold wrote:
> > On Tue, Apr 08, 2014 at 11:05:20AM +0800, Xiao Jin wrote:
> > > We find two problems on acm tty write delayed mechanism.
> > 
> > Then you should split this into two patches.
> > 
> > > (1) When acm resume, the delayed wb will be started. But now
> > > only one write can be saved during acm suspend. More acm write
> > > may be abandoned.
> > 
> > Why not simply return 0 in write and use the tty buffering rather than
> > implement another buffer in cdc_acm?
> 
> Yes. We need a single buffer because the tty layer is not happy
> when you accept no data. But we should be able to refuse subsequent
> writes. Could you test this patch?
> 
> 	Regards
> 		Oliver
> 
> From 1d44c1f2a10b5617824a37c8ec51f5547e482259 Mon Sep 17 00:00:00 2001
> From: Oliver Neukum <oneukum@...e.de>
> Date: Tue, 8 Apr 2014 12:17:39 +0200
> Subject: [PATCH] cdc-acm: fix consecutive writes while device is suspended
> 
> CDC-ACM needs to handle one attempt to write to a suspended
> device because we told the tty layer that there is room.
> A second attempt may and must fail or we drop data.
> 
> Signed-off-by: Oliver Neukum <oneukum@...e.de>
> CC: stable@...r.kernel.org
> ---
>  drivers/usb/class/cdc-acm.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> index 900f7ff..7ad3105 100644
> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -646,10 +646,12 @@ static int acm_tty_write(struct tty_struct *tty,
>  
>  	usb_autopm_get_interface_async(acm->control);
>  	if (acm->susp_count) {
> -		if (!acm->delayed_wb)
> +		if (!acm->delayed_wb) {
>  			acm->delayed_wb = wb;
> -		else
> +		} else {
>  			usb_autopm_put_interface_async(acm->control);
> +			count = 0;

You would still leak write urbs here, unless you set wb.use = 0.

> +		}
>  		spin_unlock_irqrestore(&acm->write_lock, flags);
>  		return count;	/* A white lie */
>  	}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ