From nobody Mon Aug 07 00:59:54 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RJyf25W34z4pk0G; Mon, 7 Aug 2023 00:59:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RJyf24PdVz3Wgw; Mon, 7 Aug 2023 00:59:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691369994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5GSngTGBZ+EMeibS5270R5UXvI9bDIw6fP9Y9/s7VTI=; b=DXzYbWnpf91U5q/b4a8pNR6+GoCpnXiu+Y6k+h6hDaoApeCWLvWSJ2UJ2yCz95jvLdug5y SiRRzgnXC017bYcJON7DB9BY3cb97hIiBNCJ/2fo4+ZhGrLOlwjPpx/HHJsmMEia2nkQkC mhzESC2A+5zW6cuLpCg9J5N5+CjbQn8UAW04mWr0kl+RpvD7neWNtKgmnNnB+4tgUJ6XgC wvRzE6gGJKNdw+o4BvXJlIlHuvDHB8zkMRkzTYhkYlS7q0vMVzM2P3jfcnZubtbEk2DWTL hN4rpbPbNnrY7yO0TMh0k23CNdfDnap39OD5HTLQC5yJuRHV2j8O9HiaUGKJqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691369994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5GSngTGBZ+EMeibS5270R5UXvI9bDIw6fP9Y9/s7VTI=; b=JJnMUyPk1S94iv9oW7KtxUMNggQajtmUInT9iLmm/daK7CcYwdPBB8UMEGbRPSkfYnCyH3 9ecraLQp8pHpAg4a3nBsqPMZEMwuw/oetU6fTd8pzAcGq0JW1UYoDDLLwJhhmi9dR4PlRT 64wndmuNrrthWlRl0HkrGjkSXK9OfPpfrnwBAlzdh+ELhFkuJO2tKPxSTlce2aKBgN2IxJ F4OtG0wO0jGwAIFR5J/qjuhKd8WqRPtZkQF0D1f/tsXTUYQOIQANc1qxfEBt6PBC0BRLqS hAMLNaFnQafoeuf2D/cRhYLv49U28dlWdXVaDbx4FKLl4GqTY1Z7Dj0+Q5ik7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691369994; a=rsa-sha256; cv=none; b=aqY7EvN7hW6Z4uoLuWY6vwvLqmTOEECB/709v2Ddmf4CloAqHa0rK8Fr1Ho2+hPI2jgWmv xIULBn1j+fAcYq3Xq1Fvuoxekq+tY7JpmpQBJTYdFCyMK8cT0KwfNbCcAvTvc/3AWD6z5Y p5KOnQmyI4aFlQ7oGtPccUCl1fzCKcj3TQ8uDNWSEflcOLFDnnAcBjOdWt3taSmx+/oVbq oskGQo/R2BuKN30K2mifmTsSXEikqhopGBIA57Ox+awLn2mfWJ2ESv8r2tXmsEhuCVVYxX OABWf6gC5luZcepBonKA4F3PxShrJhyIi9DzThS+qgbEL9x527IlsWT2VW2EIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RJyf23VLVzXMV; Mon, 7 Aug 2023 00:59:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3770xs45077268; Mon, 7 Aug 2023 00:59:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3770xsjL077267; Mon, 7 Aug 2023 00:59:54 GMT (envelope-from git) Date: Mon, 7 Aug 2023 00:59:54 GMT Message-Id: <202308070059.3770xsjL077267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 746c8f0cd706 - stable/13 - cd9660: do not leak buffers in cd9660_rrip_loop() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 746c8f0cd7061bcda4bb68cb612827288459bee6 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=746c8f0cd7061bcda4bb68cb612827288459bee6 commit 746c8f0cd7061bcda4bb68cb612827288459bee6 Author: Konstantin Belousov AuthorDate: 2023-07-31 22:55:13 +0000 Commit: Konstantin Belousov 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);