Skip to content

Fix potential double-close in ip/mad - #1350

Merged
flyingmutant merged 1 commit into
cmus:masterfrom
pgaskin:ip-mad-double-close
Sep 8, 2024
Merged

flyingmutant merged 1 commit into
cmus:masterfrom
pgaskin:ip-mad-double-close

Conversation

@pgaskin

@pgaskin pgaskin commented Aug 6, 2024

Copy link
Copy Markdown
Member

In input.c, ip_close calls ip->ops->close, then closes ip->data.fd (aka ip_data->fd) if fd is not -1. In ip/mad.c, close_func closes ip_data->fd without setting it to -1.

May be the cause of the fdsan failure reported in termux/termux-packages#18954. I've been looking at all the close calls and tracing the callers, and this seems to be the most likely issue.

@pgaskin

pgaskin commented Sep 2, 2024

Copy link
Copy Markdown
Member Author

This may or may not actually be the bug, but it's harmless if it isn't.

@flyingmutant

In input.c, ip_close calls ip->ops->close, then closes ip->data.fd
(aka ip_data->fd) if fd is not -1. In ip/mad.c, close_func closes
ip_data->fd without setting it to -1.

May be the cause of the fdsan failure reported in termux/termux-packages#18954.
@flyingmutant
flyingmutant merged commit 2caa838 into cmus:master Sep 8, 2024
@flyingmutant

Copy link
Copy Markdown
Member

Thanks! Merged.

@pgaskin
pgaskin deleted the ip-mad-double-close branch September 11, 2024 14:59
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.

3 participants