URB transfer_buffer must not be allocated as part of larger structure because DMA coherence issues. Patch changes catc to allocate tx_buf, rx_buf, irq_buf and ctrl_buf members as separate buffers. Patch is only compile tested. Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Jussi Kivilinna <jussi.kivilinna@xxxxxx> --- drivers/net/usb/catc.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index a7d3c1b..26039d6 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c @@ -169,10 +169,10 @@ struct catc { unsigned int ctrl_head, ctrl_tail; spinlock_t tx_lock, ctrl_lock; - u8 tx_buf[2][TX_MAX_BURST * (PKT_SZ + 2)]; - u8 rx_buf[RX_MAX_BURST * (PKT_SZ + 2)]; - u8 irq_buf[2]; - u8 ctrl_buf[64]; + u8 *tx_buf[2]; + u8 *rx_buf; + u8 *irq_buf; + u8 *ctrl_buf; struct usb_ctrlrequest *ctrl_dr; struct timer_list timer; @@ -794,9 +794,15 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id catc = netdev_priv(netdev); catc->ctrl_dr = kzalloc(sizeof(*catc->ctrl_dr), GFP_KERNEL); - if (!catc->ctrl_dr) { + catc->tx_buf[0] = kzalloc(TX_MAX_BURST * (PKT_SZ + 2), GFP_KERNEL); + catc->tx_buf[1] = kzalloc(TX_MAX_BURST * (PKT_SZ + 2), GFP_KERNEL); + catc->rx_buf = kzalloc(RX_MAX_BURST * (PKT_SZ + 2), GFP_KERNEL); + catc->irq_buf = kzalloc(2, GFP_KERNEL); + catc->ctrl_buf = kzalloc(64, GFP_KERNEL); + if (!catc->ctrl_dr || !catc->ctrl_buf || !catc->tx_buf[0] || + !catc->tx_buf[1] || !catc->rx_buf || !catc->irq_buf) { err = -ENOMEM; - goto err_free_dev; + goto err_free_buf; } netdev->netdev_ops = &catc_netdev_ops; @@ -930,8 +936,13 @@ err_free: usb_free_urb(catc->tx_urb); usb_free_urb(catc->rx_urb); usb_free_urb(catc->irq_urb); +err_free_buf: + kfree(catc->ctrl_buf); + kfree(catc->irq_buf); + kfree(catc->rx_buf); + kfree(catc->tx_buf[1]); + kfree(catc->tx_buf[0]); kfree(catc->ctrl_dr); -err_free_dev: free_netdev(netdev); return err; @@ -948,6 +959,11 @@ static void catc_disconnect(struct usb_interface *intf) usb_free_urb(catc->tx_urb); usb_free_urb(catc->rx_urb); usb_free_urb(catc->irq_urb); + kfree(catc->ctrl_buf); + kfree(catc->irq_buf); + kfree(catc->rx_buf); + kfree(catc->tx_buf[1]); + kfree(catc->tx_buf[0]); kfree(catc->ctrl_dr); free_netdev(catc->netdev); } -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html