]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: always increment reference count
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 23 Jan 2015 02:52:47 +0000 (13:22 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 23 Jan 2015 04:12:16 +0000 (14:42 +1030)
commit4283831d56b176a5c6355edd80e400705e985527
tree5af9b7e384ae01cacea65f9a85cee4967fd2d494
parent242f3602328ec5d65da70d9ad7d1e3db8eb57838
scsi: always increment reference count

James reported:
> After f5e3aa0 module: Remove stop_machine from module unloading,
> module_refcount() is returning (unsigned long)-1 when called from within
> a routine that runs in module_exit.  This is confusing the scsi device
> put code which is coded to detect a module_refcount() of zero for
> running within a module exit routine and not try to do another
> module_put.  The fix is to restore the original behaviour of
> module_refcount() and return zero if we're running inside an exit
> routine.

The correct fix is to turn try_module_get() into __module_get(), and
always do the module_put().

Acked-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/scsi/scsi.c