Summary: | ocs_fc: fix memory leak bug in ocs_scsi_io_alloc() | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Xiyu Yang <xiyuyang19> | ||||
Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Some People | CC: | markj, ram | ||||
Priority: | --- | ||||||
Version: | CURRENT | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Thanks for the patch. The patch looks good. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fc620f9782d1fda5a243fd51a93a0fb46bc80f64 commit fc620f9782d1fda5a243fd51a93a0fb46bc80f64 Author: Ram Kishore Vegesna <ram@FreeBSD.org> AuthorDate: 2021-04-19 15:40:59 +0000 Commit: Ram Kishore Vegesna <ram@FreeBSD.org> CommitDate: 2021-04-22 12:18:37 +0000 ocs_fc: Fix memory leak in ocs_scsi_io_alloc() PR: 254690 Approved by: mav(mentor) MFC after: 2 weeks sys/dev/ocs_fc/ocs_scsi.c | 1 + 1 file changed, 1 insertion(+) A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=12e6cbd158530259d951e3e246a52ddc57fa644b commit 12e6cbd158530259d951e3e246a52ddc57fa644b Author: Ram Kishore Vegesna <ram@FreeBSD.org> AuthorDate: 2021-04-19 15:40:59 +0000 Commit: Ram Kishore Vegesna <ram@FreeBSD.org> CommitDate: 2021-12-17 09:45:59 +0000 ocs_fc: Fix memory leak in ocs_scsi_io_alloc() PR: 254690 Approved by: mav(mentor) MFC after: 2 weeks (cherry picked from commit fc620f9782d1fda5a243fd51a93a0fb46bc80f64) sys/dev/ocs_fc/ocs_scsi.c | 1 + 1 file changed, 1 insertion(+) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=92d579a9ae192605fe820ff64a6f889e2014e245 commit 92d579a9ae192605fe820ff64a6f889e2014e245 Author: Ram Kishore Vegesna <ram@FreeBSD.org> AuthorDate: 2021-04-19 15:40:59 +0000 Commit: Ram Kishore Vegesna <ram@FreeBSD.org> CommitDate: 2021-12-17 10:11:49 +0000 ocs_fc: Fix memory leak in ocs_scsi_io_alloc() PR: 254690 Approved by: mav(mentor) MFC after: 2 weeks (cherry picked from commit fc620f9782d1fda5a243fd51a93a0fb46bc80f64) sys/dev/ocs_fc/ocs_scsi.c | 1 + 1 file changed, 1 insertion(+) |
Created attachment 223742 [details] patch The memory leak issue happens in one error handling path of ocs_scsi_io_alloc(). When `io->hio != NULL`, the function forgets to release the "io" allocated by ocs_io_alloc(), causing a memory leak. Fix this issue by calling ocs_io_free() when `io->hio != NULL`. The attached patch is generated using Git on the latest version of FreeBSD.