Bug 2013934 - watchdog: memory leak when verbose mode is on
Summary: watchdog: memory leak when verbose mode is on
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: watchdog
Version: rawhide
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-10-14 07:25 UTC by Josef Ridky
Modified: 2021-10-29 23:05 UTC (History)
2 users (show)

Fixed In Version: watchdog-5.16-2.fc33 watchdog-5.16-2.fc34 watchdog-5.16-2.fc35
Clone Of: 1997755
Environment:
Last Closed: 2021-10-21 17:06:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Proposed solution (758 bytes, patch)
2021-10-14 07:26 UTC, Josef Ridky
no flags Details | Diff

Description Josef Ridky 2021-10-14 07:25:04 UTC
Description of problem:

Coverity report shows a memory leak in watchdog-5.16/src/run-as-child.c:102 with `realloc()` call. Issue is that realloc may return `NULL` when there is an error causing `opt` to be a null pointer and losing the pointer to the memory that was allocated by `strdup()` or reallocated by `realloc()`. Recommend using a temporary ptr to assign the return value from realloc in order to test for NULL prior to updating the `opt` pointer.

**This is a hardening bug, not a CVE.**

Version-Release number of selected component (if applicable):
5.16-1

Steps to Reproduce:
1. watchdog needs to be run with the verbose flag
2. watchdog needs to receive test/repair arguments of sufficient length to cause a ENOMEM or another error that may be triggered by realloc

Comment 1 Josef Ridky 2021-10-14 07:26:31 UTC
Created attachment 1832832 [details]
Proposed solution

Comment 2 Fedora Update System 2021-10-14 08:29:30 UTC
FEDORA-2021-45b7585d65 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-45b7585d65

Comment 3 Fedora Update System 2021-10-14 08:29:30 UTC
FEDORA-2021-4cf4b682e8 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-4cf4b682e8

Comment 4 Fedora Update System 2021-10-14 15:50:55 UTC
FEDORA-2021-45b7585d65 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-45b7585d65`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-45b7585d65

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2021-10-14 15:57:51 UTC
FEDORA-2021-31748c40a6 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-31748c40a6`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-31748c40a6

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2021-10-14 18:54:57 UTC
FEDORA-2021-4cf4b682e8 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-4cf4b682e8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-4cf4b682e8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2021-10-21 17:06:56 UTC
FEDORA-2021-45b7585d65 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2021-10-23 03:21:28 UTC
FEDORA-2021-31748c40a6 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2021-10-29 23:05:38 UTC
FEDORA-2021-4cf4b682e8 has been pushed to the Fedora 35 stable repository.
If problem still persists, 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.