Bug 270040 - micphy: memory leak in micphy
Summary: micphy: memory leak in micphy
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Yoshihiro Takahashi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-08 14:54 UTC by Jiahao LI
Modified: 2024-01-15 10:40 UTC (History)
1 user (show)

See Also:
nyan: mfc-stable14+
nyan: mfc-stable13+


Attachments
Fix memory leak in micphy (299 bytes, patch)
2023-03-08 14:54 UTC, Jiahao LI
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiahao LI 2023-03-08 14:54:23 UTC
Created attachment 240667 [details]
Fix memory leak in micphy

The micphy_attach() uses mii_fdt_get_config() to allocates memory for mii_fdt_phy_config_t *cfg. However, the allocated memory, mii_fdt_phy_config_t *cfg, is not freed before the micphy_attach() returns. (See vscphy_fdt_get_config() in vscphy.c for an example)
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-01-08 07:42:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9a622787244c4cda76d1509b0eae168bf4fd1952

commit 9a622787244c4cda76d1509b0eae168bf4fd1952
Author:     Jiahao LI <jiahali@blackberry.com>
AuthorDate: 2024-01-08 07:39:56 +0000
Commit:     Yoshihiro Takahashi <nyan@FreeBSD.org>
CommitDate: 2024-01-08 07:39:56 +0000

    mii: Fix memory leak in micphy.

    PR:             270040
    MFC after:      1 week

 sys/dev/mii/micphy.c | 2 ++
 1 file changed, 2 insertions(+)
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-01-15 10:27:38 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fbc5e31c4f1e97139aa718baafec096ead8139dd

commit fbc5e31c4f1e97139aa718baafec096ead8139dd
Author:     Jiahao LI <jiahali@blackberry.com>
AuthorDate: 2024-01-08 07:39:56 +0000
Commit:     Yoshihiro Takahashi <nyan@FreeBSD.org>
CommitDate: 2024-01-15 10:26:02 +0000

    mii: Fix memory leak in micphy.

    PR:             270040
    MFC after:      1 week

    (cherry picked from commit 9a622787244c4cda76d1509b0eae168bf4fd1952)

 sys/dev/mii/micphy.c | 2 ++
 1 file changed, 2 insertions(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-01-15 10:27:41 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e31753a024758a1aa5db95950497c7f04e245b42

commit e31753a024758a1aa5db95950497c7f04e245b42
Author:     Jiahao LI <jiahali@blackberry.com>
AuthorDate: 2024-01-08 07:39:56 +0000
Commit:     Yoshihiro Takahashi <nyan@FreeBSD.org>
CommitDate: 2024-01-15 10:26:49 +0000

    mii: Fix memory leak in micphy.

    PR:             270040
    MFC after:      1 week

    (cherry picked from commit 9a622787244c4cda76d1509b0eae168bf4fd1952)

 sys/dev/mii/micphy.c | 2 ++
 1 file changed, 2 insertions(+)