Re: [PATCH] CDRW packet writing support for 2.6.7-bk13

From: Peter Osterlund
Date: Fri Jul 02 2004 - 18:26:07 EST


Andrew Morton <akpm@xxxxxxxx> writes:

> Greg KH <greg@xxxxxxxxx> wrote:
> >
> > > const char *__bdevname(dev_t dev, char *buffer)
> > > {
> > > struct gendisk *disk;
> > > int part;
> > >
> > > disk = get_gendisk(dev, &part);
> > > if (disk) {
> > > buffer = disk_name(disk, part, buffer);
> > > put_disk(disk);
> > > } else {
> > > snprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)",
> > > MAJOR(dev), MINOR(dev));
> > > }
> > >
> > > get_gendisk() did an internal module_get() in kobj_lookup().
> >
> > But if kobj_lookup() succeeds, module_put() is called before returning
> > (actually it's always called, right?)

But kobj_lookup() also calls probe(), which equals ata_probe() in the
IDE case, and ata_probe() calls get_disk() which calls
try_module_get() to acquire another reference to the module. I guess
all probe() functions behave the same way, as I've seen the same
problem with the sr_mod module.

> Oop, sorry, yes. Peter, are you sure this is where the leak is coming from?

I'm sure that the module reference count as reported by lsmod
increases each time I access /proc/driver/pktcdvd/pktcdvd0. I can make
this problem go away either by patching __bdevname() or by deleting
the call to __bdevname() in pktcdvd.c.

--
Peter Osterlund - petero2@xxxxxxxxx
http://w1.894.telia.com/~u89404340
-
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/