usbatm : modprobe & rmmod

Roman Kagan rkagan at
Sat Jan 22 16:05:23 EST 2005

  Hi Duncan,

On Sat, 2005-01-22 at 16:19 +0100, Duncan Sands wrote:
> > It looks like there's a bug in usb_atm.c reference counting:
> > udsl_destroy_instance kfrees udsl_instance_data, while the latter is
> > is a member of {speedtch,cxacru,...}_instance_data and not kmalloced
> > separately.  I'll try to come up with a proper fix tomorrow (I'll have
> > to check if simply removing kfree in udsl_destroy_instance is enough).
What a bullshit I can write when I'm falling asleep.  Strangely enough
another message I wrote this morning with a better wording didn't get to
the list.

> For what it's worth, this is fixed (I think) in the new driver organisation
> I'm playing with.

I can't tell since the code to store the minidriver instance data hasn't
hit CVS yet.  You'll probably need a release function for the
minidrivers whose instance data can't be destroyed synchronously though,
and call it in udsl_destroy_instance.

Meanwhile, if you don't mind, I'll keep trying with the split up
usb_atm.  In particular, I'm going to change the interface so that

1) modem driver instance owns a pointer to udsl_instance, rather than
the struct itself.  It's allocated in udsl_instance_setup, and freed in

2) udsl_instance_{setup,disconnect} calls usb_{get,put}_dev (already
there) so that usb_atm can continue after driver instance is destroyed.
In future it'll also need to call usb_{get,put}_interface to support the
drivers like eagle-usb, which AFAICS uses different interfaces to send
and to receive data.

3) usb_atm refcount counts atm references only, and
udsl_{get,put}_instance become internal to usb_atm.  The drivers do
their own bookkeeping, if needed.

Even if this turns out to be a duplicated effort ending up in a waste
bin, I'll consider it a good exercise in kernel programming for me :)


More information about the Usbatm mailing list