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-next>] [day] [month] [year] [list]
Message-ID: <20130807132902.14451.37517.stgit@localhost6.localdomain6>
Date:	Wed, 07 Aug 2013 16:29:02 +0300
From:	Jussi Kivilinna <jussi.kivilinna@....fi>
To:	netdev@...r.kernel.org
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-usb@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Jan Dumon <j.dumon@...ion.com>
Subject: [PATCH 1/2] net/usb: hso: allocate URB setup_packets as separate
 buffers

URB setup packets must not be allocated as part of larger structure because
DMA coherence issues.

Patch changes hso to allocate ctrl_req_[tr]x members of 'struct hso_serial'
as separate buffers.

Patch is only compile tested.

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 cba1d46..fc082c0 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -237,8 +237,8 @@ struct hso_serial {
 	u16 tx_data_length;	/* should contain allocated length */
 	u16 tx_data_count;
 	u16 tx_buffer_count;
-	struct usb_ctrlrequest ctrl_req_tx;
-	struct usb_ctrlrequest ctrl_req_rx;
+	struct usb_ctrlrequest *ctrl_req_tx;
+	struct usb_ctrlrequest *ctrl_req_rx;
 
 	struct usb_endpoint_descriptor *in_endp;
 	struct usb_endpoint_descriptor *out_endp;
@@ -1847,7 +1847,7 @@ static int hso_mux_serial_read(struct hso_serial *serial)
 				  USB_CDC_GET_ENCAPSULATED_RESPONSE,
 				  serial->parent->port_spec & HSO_PORT_MASK,
 				  serial->rx_urb[0],
-				  &serial->ctrl_req_rx,
+				  serial->ctrl_req_rx,
 				  serial->rx_data[0], serial->rx_data_length);
 }
 
@@ -1916,7 +1916,7 @@ static int hso_mux_serial_write_data(struct hso_serial *serial)
 				  USB_CDC_SEND_ENCAPSULATED_COMMAND,
 				  serial->parent->port_spec & HSO_PORT_MASK,
 				  serial->tx_urb,
-				  &serial->ctrl_req_tx,
+				  serial->ctrl_req_tx,
 				  serial->tx_data, serial->tx_data_count);
 }
 
@@ -2264,6 +2264,10 @@ static void hso_serial_common_free(struct hso_serial *serial)
 	usb_free_urb(serial->tx_urb);
 	kfree(serial->tx_data);
 	tty_port_destroy(&serial->port);
+
+	/* free control URB setup packet buffers */
+	kfree(serial->ctrl_req_tx);
+	kfree(serial->ctrl_req_rx);
 }
 
 static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
@@ -2292,6 +2296,12 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
 	spin_lock_init(&serial->serial_lock);
 	serial->num_rx_urbs = num_urbs;
 
+	/* allocate control URB setup packet buffers */
+	serial->ctrl_req_tx = kzalloc(sizeof(*serial->ctrl_req_tx), GFP_KERNEL);
+	serial->ctrl_req_rx = kzalloc(sizeof(*serial->ctrl_req_rx), GFP_KERNEL);
+	if (!serial->ctrl_req_tx || !serial->ctrl_req_rx)
+		goto exit;
+
 	/* RX, allocate urb and initialize */
 
 	/* prepare our RX buffer */

--
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