From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AF1478B61; Tue, 27 Feb 2024 14:16:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709043374; cv=none; b=iWcZ4iKcrsIEmc6SJhAV9mPJ95q45XS3zxooTgpW6u3T+IerweOxDr/vvGsgIgkjK9sIeydQo6pP8KnCuLNMLT9e9NBLPaFJVOq3KzbpJRCB5c6vAvET7p2QzURZ3c8bozIfbr32wIPR86L7GRkLGGHIy7Mi55BaGe9ExSUD8eo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709043374; c=relaxed/simple; bh=xVfocRMoWHUihPS3SogmE1oeUFt79/SX7r4pM2iBdLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MpY5n7WCcjs5gvqx4jkrz3+dYk3SXq3RnhHn3WuBdG6c85hpvhySnnUUYxb/piUmP/Ma/eRxNkhbsiqKaZpQlbJQG6DV1HFwyiML7mVwRJL44zoF+631n0FdcpEH2Tk4bDjhfUeVM9PUZeP+te1mHka7GujaeOBscrH+UH5KcOY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=M3euDZ3R; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="M3euDZ3R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51190C433F1; Tue, 27 Feb 2024 14:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709043373; bh=xVfocRMoWHUihPS3SogmE1oeUFt79/SX7r4pM2iBdLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3euDZ3Rni/iTyERVdNOzVpFNbNArH97RsYPPn71MRJf58GO3g6goutAGAzXMzKR4 8sqaye5cdGf7ITK4cMPPX7gK27jQZrUr8czkKDNncOyi3bdWr/Jw4ErYQF394Zt0xv zCGB+0sMaJgcMxBtxkwSQpd9nkY35+SorN8S0yzw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , Dave Airlie , Huang Rui , dri-devel@lists.freedesktop.org, Matthew Auld Subject: [PATCH 6.1 085/195] drm/ttm: Fix an invalid freeing on already freed page in error path Date: Tue, 27 Feb 2024 14:25:46 +0100 Message-ID: <20240227131613.291946379@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227131610.391465389@linuxfoundation.org> References: <20240227131610.391465389@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Hellström commit 40510a941d27d405a82dc3320823d875f94625df upstream. If caching mode change fails due to, for example, OOM we free the allocated pages in a two-step process. First the pages for which the caching change has already succeeded. Secondly the pages for which a caching change did not succeed. However the second step was incorrectly freeing the pages already freed in the first step. Fix. Signed-off-by: Thomas Hellström Fixes: 379989e7cbdc ("drm/ttm/pool: Fix ttm_pool_alloc error path") Cc: Christian König Cc: Dave Airlie Cc: Christian Koenig Cc: Huang Rui Cc: dri-devel@lists.freedesktop.org Cc: # v6.4+ Reviewed-by: Matthew Auld Reviewed-by: Christian König Link: https://patchwork.freedesktop.org/patch/msgid/20240221073324.3303-1-thomas.hellstrom@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/ttm/ttm_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -383,7 +383,7 @@ static void ttm_pool_free_range(struct t enum ttm_caching caching, pgoff_t start_page, pgoff_t end_page) { - struct page **pages = tt->pages; + struct page **pages = &tt->pages[start_page]; unsigned int order; pgoff_t i, nr;