USB devices are not closed when error occurs

Bug #1642812 reported by Robert Liu
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
fwupd (Ubuntu)
Fix Released
Medium
Unassigned
Xenial
Fix Released
Medium
Brian Murray
Yakkety
Won't Fix
Undecided
Unassigned
Zesty
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

 * fwupd (used in Xenial) does not close USB device nodes when it fails to process the
devices.

 * The orphan (un-closed) device node will be kept until fwupd ends

 * The behavior will avoid the system to set the USB device as idle/suspend then the system cannot enter some power-saving mode (eg. S0ix)

[Test Case]

 * make sure fwupd is not running by executing 'fwupdmgr get-devices'
   It will show devices information.

 * list the fds opened by fwupd
   $ sudo ls -l /proc/$(pgrep fwupd)/fd | grep usb
   If a system is not affected, it will output nothing.
   If the result shows one or more strings like /dev/bus/usb/[BUS]/[DEV]
   (BUS and DEV are numeric variables), that means the issue is existing.

[Regression Potential]

 * The fix only closes file descriptors of USB devices when errors happen and should not have regression there.

[Original description]
  In fwupd, a few of USB devices are not closed when there are some failures of
  operations. This issue will cause fwupd has some orphan USB nodes inside during fwupd is
  running. A orphan USB node might introduce memory leak and block some runtime power
  features as well.

  I proposed a upstream PR, and also put the link here.
  https://github.com/hughsie/fwupd/pull/73

Robert Liu (robertliu)
description: updated
Revision history for this message
Robert Liu (robertliu) wrote :

The upstream PR has been merged.
Could we have this patch also land in Ubuntu, please?

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Close-usb-devices-before-error-returns.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Robert Liu (robertliu) wrote :

update the patch to fix the compiling error.

Revision history for this message
Robert Liu (robertliu) wrote :

for Zesty

Revision history for this message
Robert Liu (robertliu) wrote :

for Yakkety

Revision history for this message
Robert Liu (robertliu) wrote :

for Xenial

Mathew Hodson (mhodson)
Changed in fwupd (Ubuntu):
importance: Undecided → Medium
Changed in fwupd (Ubuntu Zesty):
status: New → Fix Released
Revision history for this message
Mario Limonciello (superm1) wrote :

Zesty adopted 0.8.1, this is already fixed there.

Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

Ping!

Changed in fwupd (Ubuntu Yakkety):
status: New → Won't Fix
Changed in fwupd (Ubuntu):
status: New → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

Could you please update the bug description so that it contains information necessary for the SRU process? Thanks in advance!

https://wiki.ubuntu.com/StableReleaseUpdates#SRU_Bug_Template

I've subscribed myself to the bug and will upload the SRU once we have a properly formatted bug report.

Changed in fwupd (Ubuntu Xenial):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Robert Liu (robertliu) wrote :

Hi @Brian,
I have updated the bug description. If there is something missing, please let me know. Thanks.

description: updated
Revision history for this message
Brian Murray (brian-murray) wrote :

I've uploaded this for review by the SRU team.

Changed in fwupd (Ubuntu Xenial):
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Brian Murray (brian-murray) wrote :

Oh, I somehow missed there is already a version, 0.8.3, of fwupd in -proposed for Xenial. Do you know if that version includes the fix for which you are looking?

Revision history for this message
Brian Murray (brian-murray) wrote :

There are calls to "g_usb_device_close" in 0.8.3 so could you test the version of fwupd in -proposed for xenial and see if it fixes this bug also?

Revision history for this message
Robert Liu (robertliu) wrote :

Hi @Brian,
The proposed version (0.8.3) has been verified. It does fix the bug as well.

SKU: Dell Thin client
Old version (0.7.0): fwupd has a open fd (/dev/bus/usb/001/007)
New version (0.8.3): fwupd doesn't have a open fd.

Changed in fwupd (Ubuntu Xenial):
status: Triaged → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Robert, or anyone else affected,

Accepted fwupd into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/fwupd/0.8.3-0ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed verification-needed-xenial
Revision history for this message
Robert Liu (robertliu) wrote :

The proposed version 0.8.3-0ubuntu2 has been verified. It does fix the bug and no regression is found with my hardware.

SKU: Dell Thin client
Old version (0.7.0-0ubuntu4.3): fwupd has a open fd (/dev/bus/usb/001/007)
New version (0.8.3-0ubuntu2): fwupd doesn't have a open fd.

tags: added: verification-done-xenial
removed: verification-needed-xenial
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package fwupd - 0.8.3-0ubuntu2

---------------
fwupd (0.8.3-0ubuntu2) xenial; urgency=medium

  * Fix systemd unit for what is actually supported in
    systemd 229 in xenial (LP: #1746114)
  * This bug also fixes issues with USB devices being closed (LP: #1642812)

 -- Mario Limonciello <email address hidden> Wed, 14 Feb 2018 14:32:41 -0500

Changed in fwupd (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for fwupd has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.