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] [day] [month] [year] [list]
Date:	Wed, 07 Aug 2013 10:47:08 -0500
From:	Dan Williams <dcbw@...hat.com>
To:	Jussi Kivilinna <jussi.kivilinna@....fi>
Cc:	netdev@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-usb@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Jan Dumon <j.dumon@...ion.com>
Subject: Re: [PATCH 2/2] net/usb: hso: allocate serial_state_notification as
 separate buffer

On Wed, 2013-08-07 at 16:29 +0300, Jussi Kivilinna wrote:
> URB transfer_buffers must not be allocated as part of larger structure because
> DMA coherence issues.
> 
> Patch changes hso to allocate serial_state_notification member of
> 'struct hso_tiocmget' as separate buffer.
> 
> Patch is only compile tested.

Tested-by: Dan Williams <dcbw@...hat.com>

> Cc: <stable@...r.kernel.org>
> Signed-off-by: Jussi Kivilinna <jussi.kivilinna@....fi>
> ---
>  drivers/net/usb/hso.c |   18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index fc082c0..21ffa6f 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -211,7 +211,7 @@ struct hso_tiocmget {
>  	int    intr_completed;
>  	struct usb_endpoint_descriptor *endp;
>  	struct urb *urb;
> -	struct hso_serial_state_notification serial_state_notification;
> +	struct hso_serial_state_notification *serial_state_notification;
>  	u16    prev_UART_state_bitmap;
>  	struct uart_icount icount;
>  };
> @@ -1465,7 +1465,7 @@ static int tiocmget_submit_urb(struct hso_serial *serial,
>  			 usb_rcvintpipe(usb,
>  					tiocmget->endp->
>  					bEndpointAddress & 0x7F),
> -			 &tiocmget->serial_state_notification,
> +			 tiocmget->serial_state_notification,
>  			 sizeof(struct hso_serial_state_notification),
>  			 tiocmget_intr_callback, serial,
>  			 tiocmget->endp->bInterval);
> @@ -1499,7 +1499,7 @@ static void tiocmget_intr_callback(struct urb *urb)
>  	if (!tiocmget)
>  		return;
>  	usb = serial->parent->usb;
> -	serial_state_notification = &tiocmget->serial_state_notification;
> +	serial_state_notification = tiocmget->serial_state_notification;
>  	if (serial_state_notification->bmRequestType != BM_REQUEST_TYPE ||
>  	    serial_state_notification->bNotification != B_NOTIFICATION ||
>  	    le16_to_cpu(serial_state_notification->wValue) != W_VALUE ||
> @@ -2608,6 +2608,7 @@ static void hso_free_tiomget(struct hso_serial *serial)
>  		usb_free_urb(tiocmget->urb);
>  		tiocmget->urb = NULL;
>  		serial->tiocmget = NULL;
> +		kfree(tiocmget->serial_state_notification);
>  		kfree(tiocmget);
>  	}
>  }
> @@ -2664,6 +2665,13 @@ static struct hso_device *hso_create_bulk_serial_device(
>  		 */
>  		if (serial->tiocmget) {
>  			tiocmget = serial->tiocmget;
> +
> +			tiocmget->serial_state_notification = kzalloc(
> +				sizeof(struct hso_serial_state_notification),
> +				GFP_KERNEL);
> +			if (!tiocmget->serial_state_notification)
> +				goto tiocmget_fail;
> +
>  			tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
>  			if (tiocmget->urb) {
>  				mutex_init(&tiocmget->mutex);
> @@ -2672,8 +2680,10 @@ static struct hso_device *hso_create_bulk_serial_device(
>  					interface,
>  					USB_ENDPOINT_XFER_INT,
>  					USB_DIR_IN);
> -			} else
> +			} else {
> +tiocmget_fail:
>  				hso_free_tiomget(serial);
> +			}
>  		}
>  	}
>  	else
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ