git: 746c8f0cd706 - stable/13 - cd9660: do not leak buffers in cd9660_rrip_loop()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Aug 2023 00:59:54 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=746c8f0cd7061bcda4bb68cb612827288459bee6 commit 746c8f0cd7061bcda4bb68cb612827288459bee6 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-07-31 22:55:13 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-08-07 00:48:45 +0000 cd9660: do not leak buffers in cd9660_rrip_loop() PR: 272856 (cherry picked from commit fa3cf6cdc68cb6d6f2c440f2653258d68eae1015) --- sys/fs/cd9660/cd9660_rrip.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/fs/cd9660/cd9660_rrip.c b/sys/fs/cd9660/cd9660_rrip.c index 87bc64c9b7d2..5d64e2c17f0a 100644 --- a/sys/fs/cd9660/cd9660_rrip.c +++ b/sys/fs/cd9660/cd9660_rrip.c @@ -549,12 +549,18 @@ cd9660_rrip_loop(isodir,ana,table) } if (ana->fields && ana->iso_ce_len) { - if (ana->iso_ce_blk >= ana->imp->volume_space_size - || ana->iso_ce_off + ana->iso_ce_len > ana->imp->logical_block_size - || bread(ana->imp->im_devvp, - ana->iso_ce_blk << - (ana->imp->im_bshift - DEV_BSHIFT), - ana->imp->logical_block_size, NOCRED, &bp)) + if (ana->iso_ce_blk >= ana->imp->volume_space_size || + ana->iso_ce_off + ana->iso_ce_len > + ana->imp->logical_block_size) + break; + if (bp != NULL) { + brelse(bp); + bp = NULL; + } + if (bread(ana->imp->im_devvp, + ana->iso_ce_blk << + (ana->imp->im_bshift - DEV_BSHIFT), + ana->imp->logical_block_size, NOCRED, &bp) != 0) /* what to do now? */ break; phead = (ISO_SUSP_HEADER *)(bp->b_data + ana->iso_ce_off);