Skip to content

libuio: fix FILE descriptor leak#1053

Open
Qliangw wants to merge 1 commit into
openembedded:master-nextfrom
Qliangw:Qliangw-patch-1
Open

libuio: fix FILE descriptor leak#1053
Qliangw wants to merge 1 commit into
openembedded:master-nextfrom
Qliangw:Qliangw-patch-1

Conversation

@Qliangw

@Qliangw Qliangw commented May 27, 2026

Copy link
Copy Markdown

The function uio_line_from_file() fails to close the FILE pointer when fgets() returns NULL, causing a file descriptor leak.

This can be triggered when reading from /sys files that return empty content, leading to resource exhaustion over time.

Fix this by using goto-based error handling to ensure fclose() is called on all exit paths.

@Qliangw Qliangw force-pushed the Qliangw-patch-1 branch from b0d9b3d to 7bbb904 Compare May 28, 2026 00:18
@halstead halstead force-pushed the master-next branch 18 times, most recently from bbb28db to ccba300 Compare June 12, 2026 14:30
@halstead halstead force-pushed the master-next branch 10 times, most recently from 1d238ff to 8a58449 Compare June 19, 2026 06:03
@halstead halstead force-pushed the master-next branch 17 times, most recently from affdc42 to 76652b0 Compare June 27, 2026 07:45
@halstead halstead force-pushed the master-next branch 5 times, most recently from c215452 to b2dd6be Compare June 28, 2026 08:02

@kraj kraj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit this patches upstream to libuio for review and comment and add Upstream-Status: tag to the patch header.

Secondly, apply the patch directly in bb file no need to do it via a bbappend.

@Qliangw Qliangw marked this pull request as draft June 30, 2026 07:20
The function uio_line_from_file() fails to close the FILE pointer
when fgets() returns NULL, causing a file descriptor leak.

This can be triggered when reading from /sys files that return
empty content, leading to resource exhaustion over time.

Fix this by using goto-based error handling to ensure fclose()
is called on all exit paths.

Signed-off-by: Qliangw <qili00001@gmail.com>
@Qliangw Qliangw marked this pull request as ready for review June 30, 2026 07:29
@Qliangw

Qliangw commented Jun 30, 2026

Copy link
Copy Markdown
Author

Please submit this patches upstream to libuio for review and comment and add Upstream-Status: tag to the patch header.

Secondly, apply the patch directly in bb file no need to do it via a bbappend.

Done.

  1. The patch has been submitted upstream to libuio Merge Request #2 for review and comments
  2. The Upstream-Status tag has been added to the patch header
  3. The patch is now applied directly in the .bb file, and the .bbappend has been removed

@Qliangw Qliangw requested a review from kraj July 1, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants