Bug 1378419 - Double free and double close in alsabat
Summary: Double free and double close in alsabat
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: alsa-utils
Version: 26
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jaroslav Kysela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-22 11:25 UTC by Josselin Feist
Modified: 2018-04-09 13:26 UTC (History)
1 user (show)

Fixed In Version: alsa-utils-1.1.6-1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-09 13:26:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Josselin Feist 2016-09-22 11:25:02 UTC
Description of problem:
A double free and a double close are present in alsabat (part of alsa-utils).

Version-Release number of selected component (if applicable):
alsa-utils in version 1.1.2

How reproducible:
Found statically, no test-case provided.

Steps to Reproduce:
In the file bat/asla.c, the function record_alsa (line 663): there is a call to free on sndpcm.buffer, at line 693:

    pthread_cleanup_push(free, sndpcm.buffer);

Another call to free on the same variable is possible at line 715:

exit3:

   free(sndpcm.buffer);

The presence of a "goto exit 3", right after the first free makes such path possible. 
Notice that in the same way, a double close can be achieved on sndpcm.handle (yet the double free seems more dangerous).

Actual results:


Expected results:

Additional info:
A fix could be to set sndpcm.buffer (resp. sndpcm.handle) to a NULL value after the first free (resp. close), and to check its value before the second call.

Comment 1 Fedora End Of Life 2017-02-28 10:20:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 2 Fedora Update System 2018-04-06 18:56:00 UTC
alsa-lib-1.1.6-2.fc28, alsa-plugins-1.1.6-2.fc28, alsa-tools-1.1.6-1.fc28, alsa-utils-1.1.6-1.fc28, python-alsa-1.1.6-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-6bd008c547

Comment 3 Fedora Update System 2018-04-09 13:26:47 UTC
alsa-lib-1.1.6-2.fc28, alsa-plugins-1.1.6-2.fc28, alsa-tools-1.1.6-1.fc28, alsa-utils-1.1.6-1.fc28, python-alsa-1.1.6-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.