lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120503175857.GA13988@ioremap.net>
Date:	Thu, 3 May 2012 21:58:57 +0400
From:	Evgeniy Polyakov <zbr@...emap.net>
To:	NeilBrown <neilb@...e.de>
Cc:	linux-kernel@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] w1: Introduce a slave mutex for serializing IO.

On Wed, May 02, 2012 at 04:26:27PM +1000, NeilBrown (neilb@...e.de) wrote:
> Take takes me back to the deadlock.
> To be precise:
>   while scanning the w1 bus - with master->mutex held - w1_attach_slave_device
>   eventually calls into bq27000_battery_probe  which calls
>     power_supply_register -> device_add -> kobject_uevent_env
> 
>   and the to get all the data for the uevent, power_supply_uevent calls
>   the get_property callback which tries to read from the w1 bus and so
>   needs the master->mutex.  Which is held.  Deadlock.
> 
> So options seems to be:
>  - drop the lock while attaching slave devices
>  - create a list of slave devices, then attach them after the bus scan has
>    finished.
>  - have device_add run the kobject_uevent in a separate task (work_queue)
>  - or maybe the following which feels ugly but is easy.  Mark the bq27000 as
>    not ready until after the power_supply_register, and if get_property is 
>    called before the device is ready, return ENODATA.
>    Simple and works.  Maybe horrible.
>    power_supply_register will have scheduled a power_supply_changed() which
>    will poll

You can check mutex owner - and if it is you who holds it, then dig into
low-level function without lock.

-- 
	Evgeniy Polyakov
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ