Re: [git pull] Input update for 2.6.17

From: Linus Torvalds
Date: Wed Jun 28 2006 - 19:57:45 EST




On Wed, 28 Jun 2006, Jeff Garzik wrote:
>
> You do:
>
> > urb->transfer_buffer = skb->data;
> > urb->transfer_buffer_length = skb->len;
> >
> > __fill_isoc_desc(urb, skb->len,
> > le16_to_cpu(husb->isoc_out_ep->desc.wMaxPacketSize));
> >
> > _urb->priv = skb;
>
> so it looks like you can grab it out of the 'priv' field.
>
> And a damned good thing too...

Yeah, you'd have to do something like

struct _urb *_urb = container_of(urb, struct _urb, urb);

first. However, it also turns out that some other code-paths are _also_
filling "urb->transfer_buffer", and those are indeed using a kmalloc'ed
buffer (hci_usb_isoc_rx_submit()).

So the proper thing to do is probably along the lines of

static void free_transfer_buffer(struct urb *urb)
{
struct _urb *_urb = container_of(urb, struct _urb, urb);

if (_urb->priv) {
kfree_skb((struct sk_buff *) _urb->priv);
_urb->priv = NULL;
urb->transfer_buffer = NULL;
return;
}
kfree(urb->transfer_buffer);
urb->transfer_buffer = NULL;
}

or whatever. I dunno. I ended up just uncommenting the "kfree()" in my
code, to see that it doesn't oops any more (and it doesn't).

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/