LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* BAD PATCH: IDE: remove rwsem use from ide-proc core
       [not found] <200704272059.l3RKxQBF024043@hera.kernel.org>
@ 2007-04-27 21:43 ` Alan Cox
  0 siblings, 0 replies; only message in thread
From: Alan Cox @ 2007-04-27 21:43 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: torvalds

> -	down_read(&dev->bus->subsys.rwsem);
>  	if (dev->driver) {
>  		ide_drv = container_of(dev->driver, ide_driver_t, gen_driver);
>  		len = sprintf(page, "%s version %s\n",
>  				dev->driver->name, ide_drv->version);
>  	} else
>  		len = sprintf(page, "ide-default version 0.9.newide\n");
> -	up_read(&dev->bus->subsys.rwsem);
>  	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);

The semaphore is used to ensure dev->driver doesn't change under us. This
patch appears to remove the neccessary locking without replacing it with
anything viable. A local lock would do but the simple removal appears to
be unsafe.


> @@ -327,7 +325,6 @@ static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
>  	int ret = 1;
>  	int err;
>  
> -	down_write(&dev->bus->subsys.rwsem);
>  	device_release_driver(dev);
>  	/* FIXME: device can still be in use by previous driver */
>  	strlcpy(drive->driver_req, driver, sizeof(drive->driver_req));
> @@ -345,7 +342,6 @@ static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
>  	}
>  	if (dev->driver && !strcmp(dev->driver->name, driver))
>  		ret = 0;
> -	up_write(&dev->bus->subsys.rwsem);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-27 21:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200704272059.l3RKxQBF024043@hera.kernel.org>
2007-04-27 21:43 ` BAD PATCH: IDE: remove rwsem use from ide-proc core Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).