git: bd6e8729d6f6 - main - ctl ramdisk: Free compare buffer after a compare I/O request.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Feb 2022 23:21:06 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=bd6e8729d6f6d42102b0359b56b7e3c89edd0ec9
commit bd6e8729d6f6d42102b0359b56b7e3c89edd0ec9
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-18 23:20:14 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-02-18 23:20:14 +0000
ctl ramdisk: Free compare buffer after a compare I/O request.
For a compare request, the ramdisk backend allocates a temporary
buffer to hold the I/O data and then compares it against the LUN's
pages in ctl_backend_ramdisk_cmp after the data has been filled.
However, the tempory buffer was leaked when after the comparison was
complete. Fix this by freeing the buffer after the comparison.
Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34316
---
sys/cam/ctl/ctl_backend_ramdisk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c
index 6febdd469bdd..9ddee1814aa1 100644
--- a/sys/cam/ctl/ctl_backend_ramdisk.c
+++ b/sys/cam/ctl/ctl_backend_ramdisk.c
@@ -386,6 +386,7 @@ ctl_backend_ramdisk_cmp(union ctl_io *io)
if (res < cbe_lun->blocksize)
break;
}
+ free(io->scsiio.kern_data_ptr, M_RAMDISK);
if (lbas > 0) {
off += io->scsiio.kern_rel_offset - io->scsiio.kern_data_len;
scsi_u64to8b(off, info);