[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120110100541.38a3940f@de.ibm.com>
Date: Tue, 10 Jan 2012 10:05:41 +0100
From: Martin Schwidefsky <schwidefsky@...ibm.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Joerg Roedel <joerg.roedel@....com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Michael Buesch <m@...s.ch>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Kernel development list <linux-kernel@...r.kernel.org>,
Sebastian Ott <sebott@...ux.vnet.ibm.com>
Subject: Re: Incorrect uses of get_driver()/put_driver()
On Mon, 9 Jan 2012 12:35:09 -0500 (EST)
Alan Stern <stern@...land.harvard.edu> wrote:
> drivers/s390/cio/device.c:1681: drv = get_driver(&cdrv->driver);
> drivers/s390/cio/device.c:1687: put_driver(drv);
>
> Martin, these calls seem to be useless. The calls in ccwgroup.c are
> definitely useless; there's no reason to take a reference to a driver
> while it's being unregistered, since it can't go away until the
> unregistration is finished.
The get_driver/put_driver in ccwgroup.c are obviously useless, the caller
passed ccwgroup_driver_unregister a ccwgroup_driver reference.
I am not so sure about the code in device.c. get_ccwdev_by_busid() gets
used e.g. by vmur like this:
static struct ccw_driver ur_driver = { .. };
static struct urdev *urdev_get_from_devno(u16 devno)
{
..
sprintf(bus_id, "0.0.%04x", devno);
cdev = get_ccwdev_by_busid(&ur_driver, bus_id);
..
}
static int ur_open(struct inode *inode, struct file *file)
{
..
urd = urdev_get_from_devno(devno);
..
}
For vmur we should be safe by the fact that ur_open is only possible if
a try_module_get has been successful and the ccw_driver is unregistered
only in the module exit function. But we have to check if this is true
for all users of the get_ccwdev_by_busid() function.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists