Bug 264249 - mlx4: Fix memory leak in rem_slave_fs_rule
Summary: mlx4: Fix memory leak in rem_slave_fs_rule
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Many People
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-26 02:54 UTC by ruc_gongyuanjun
Modified: 2022-06-07 06:48 UTC (History)
2 users (show)

See Also:


Attachments
a possible patch (1012 bytes, patch)
2022-05-26 02:54 UTC, ruc_gongyuanjun
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ruc_gongyuanjun 2022-05-26 02:54:00 UTC
Created attachment 234222 [details]
a possible patch

Before kfree(fs_rule), fs_rule->mirr_mbox should be released
since it is an allocated data.
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2022-05-26 16:06:20 UTC
Have you checked if a fix exist in Linux?
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-05-30 18:23:11 UTC
A commit in branch main references this bug:

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

commit f29c9901a41fb650d46fd48f4880a894f54aa737
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-05-30 18:11:50 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-05-30 18:22:18 +0000

    mlx4core: Fix a memory leak when deleting slave's resources

    mlx4_delete_all_resources_for_slave() in the resource tracker should free
    all memory allocated for a slave. While releasing memory of fs_rule,
    it misses releasing memory of fs_rule->mirr_mbox.

    Linux commit:
    461d5f1b59490ce0096dfda45e10038c122a7892

    PR:             264249
    MFC after:      1 week
    Sponsored by:   NVIDIA Networking

 sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c | 1 +
 1 file changed, 1 insertion(+)
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2022-05-30 18:23:34 UTC
Thank you!

--HPS
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-06-07 06:45:47 UTC
A commit in branch stable/13 references this bug:

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

commit d264494e983ac964dc5cb8a2e51cddbb9d6c3631
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-05-30 18:11:50 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-06-07 06:44:29 +0000

    mlx4core: Fix a memory leak when deleting slave's resources

    mlx4_delete_all_resources_for_slave() in the resource tracker should free
    all memory allocated for a slave. While releasing memory of fs_rule,
    it misses releasing memory of fs_rule->mirr_mbox.

    Linux commit:
    461d5f1b59490ce0096dfda45e10038c122a7892

    PR:             264249
    Sponsored by:   NVIDIA Networking

    (cherry picked from commit f29c9901a41fb650d46fd48f4880a894f54aa737)

 sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c | 1 +
 1 file changed, 1 insertion(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-06-07 06:48:52 UTC
A commit in branch stable/12 references this bug:

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

commit e8215345313aa9ac7aca6cbe0851fa452088a784
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-05-30 18:11:50 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-06-07 06:46:18 +0000

    mlx4core: Fix a memory leak when deleting slave's resources

    mlx4_delete_all_resources_for_slave() in the resource tracker should free
    all memory allocated for a slave. While releasing memory of fs_rule,
    it misses releasing memory of fs_rule->mirr_mbox.

    Linux commit:
    461d5f1b59490ce0096dfda45e10038c122a7892

    PR:             264249
    Sponsored by:   NVIDIA Networking

    (cherry picked from commit f29c9901a41fb650d46fd48f4880a894f54aa737)

 sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c | 1 +
 1 file changed, 1 insertion(+)