All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libertas if_usb: Fix crash on 64-bit machines
@ 2009-10-30 17:45 David Woodhouse
  2009-10-30 18:17 ` David Miller
  2009-10-30 18:23 ` Larry Finger
  0 siblings, 2 replies; 14+ messages in thread
From: David Woodhouse @ 2009-10-30 17:45 UTC (permalink / raw)
  To: linville; +Cc: libertas-dev, linux-wireless, dcbw, stern, davem

On a 64-bit kernel, skb->tail is an offset, not a pointer. The libertas
usb driver passes it to usb_fill_bulk_urb() anyway, causing interesting
crashes. Fix that by using skb->data instead.

This highlights a problem with usb_fill_bulk_urb(). It doesn't notice
when dma_map_single() fails and return the error to its caller as it
should. In fact it _can't_ currently return the error, since it returns
void.

So this problem was showing up only at unmap time, after we'd already
suffered memory corruption by doing DMA to a bogus address.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Cc: stable@kernel.org
---
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 92bc8c5..3fac4ef 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -508,7 +508,7 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp,
 	/* Fill the receive configuration URB and initialise the Rx call back */
 	usb_fill_bulk_urb(cardp->rx_urb, cardp->udev,
 			  usb_rcvbulkpipe(cardp->udev, cardp->ep_in),
-			  (void *) (skb->tail + (size_t) IPFIELD_ALIGN_OFFSET),
+			  skb->data + IPFIELD_ALIGN_OFFSET,
 			  MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn,
 			  cardp);
 

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-11-10  7:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-30 17:45 [PATCH] libertas if_usb: Fix crash on 64-bit machines David Woodhouse
2009-10-30 18:17 ` David Miller
2009-10-30 18:23 ` Larry Finger
2009-10-30 18:44   ` Christian Lamparter
2009-10-30 18:51     ` David Woodhouse
2009-10-30 19:08       ` Larry Finger
2009-10-30 19:26       ` Christian Lamparter
2009-11-04 19:16         ` John W. Linville
2009-11-04 19:36           ` David Woodhouse
2009-11-04 20:01             ` Dan Williams
2009-11-04 21:16               ` John W. Linville
2009-11-04 22:12                 ` [PATCH] libertas if_usb: tiny usb-rx overhaul Christian Lamparter
2009-11-10  7:02                   ` Dan Williams
2009-10-31  1:41       ` [PATCH] libertas if_usb: Fix crash on 64-bit machines Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.