Bug 30332 - udisks does not tear down LUKS devices when the slave is forcibly removed
Summary: udisks does not tear down LUKS devices when the slave is forcibly removed
Status: RESOLVED FIXED
Alias: None
Product: udisks
Classification: Unclassified
Component: luks (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-22 13:21 UTC by Mathieu Trudel-Lapierre
Modified: 2010-09-27 06:22 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
use luks_holder property to identify luks cleartext device (2.51 KB, patch)
2010-09-22 13:28 UTC, Mathieu Trudel-Lapierre
Details | Splinter Review
updated patch (2.71 KB, patch)
2010-09-23 08:27 UTC, Mathieu Trudel-Lapierre
Details | Splinter Review

Description Mathieu Trudel-Lapierre 2010-09-22 13:21:00 UTC
As reported in Launchpad here: https://bugs.edge.launchpad.net/ubuntu/lucid/+source/gnome-disk-utility/+bug/484429

It seems that udisks doesn't tear down cleartext LUKS devices when its slave is forcibly removed, for example, by unplugging a USB drive which holds a LUKS-encrypted partition.

Re-inserting the device then yields the usual password prompt to decrypt the device, but fails to load it with a cryptsetup error:

Error unlocking device: cryptsetup exited with exit code 239: Device udisks-luks-uuid-7bdbda08-473f-41eb-9837-88a4285b1c05-uid1000 already exists.
Comment 1 Mathieu Trudel-Lapierre 2010-09-22 13:28:04 UTC
Created attachment 38888 [details] [review]
use luks_holder property to identify luks cleartext device

It seems that using device->priv->luks_holder for the device that is being remove still contains the name of the cleartext LUKS device that requires that slave, so it's possible to use it to immediately get which device to use for force_luks_teardown().
Comment 2 Mathieu Trudel-Lapierre 2010-09-23 08:27:31 UTC
Created attachment 38904 [details] [review]
updated patch

udisks would segfault if the device was ejected from Nautilus... this is because luks_holder is NULL in that case.
Comment 3 Martin Pitt 2010-09-27 05:46:15 UTC
I can reproduce this bug.
Comment 4 Martin Pitt 2010-09-27 06:22:48 UTC
Thanks! This patch makes a sense, and I confirm that it now behaves correctly with both regular unmount and yanking out a mounted encrypted USB stick. Pushed to git master.

I'll try to write a test case for this, too.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.