From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 1A14C32A3C9; Tue, 16 Jun 2026 17:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781632190; cv=none; b=sWCnJldRr7g1IkiuqKOUtxBkdy9lzCsFLwVdIf4CzPU9tRlJBh0YNoJ0Zk+0ibQzO8w2E93pHQruP4pM/PlnujtvTfW/R7Ee4n80p9qVxKb/3XNsmziUX1MgzgPoqYRzVpCYXAsiorPlPcrnDqpBViRZGFWAzUTbsIU0m08soqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781632190; c=relaxed/simple; bh=Br60sMqHXs2bOnn2su+2FdAW/jP35d2dekRxuC7Fxwg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iIQ3yqTbV46Y1Pnp9+4wnuXNv06SGHvApBdKm969YnWMCw8mg7jl4tBNAcGDIAvGO2MdXI5/V03O6oWwbzFd8ceCpGQRqfKDxqdKBCWnqFyGwLwlCMF9RnMSr8N1SIkVa12kU0feciUZryFdClVaftjCMDbJubiJ+Us28MtAgVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ubw38Y1E; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ubw38Y1E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E82001F000E9; Tue, 16 Jun 2026 17:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781632189; bh=F8b5h7le0lK+h2Zwk1EGBrwuxbMAMjIzpWq55Wzns/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ubw38Y1EgwTkOAll2rh5iHI1Z94Fz4ievkp04jlQ4+zSAUWDEFeaP3i7IPZkSg1TA ojZ5TcaF3uTW6r9K51iI+BFltrrSfet5ZOO04RzN//nNJYHG2cnr0bCj6EesGOuk78 bas5SQlRo4y29yYNRr7xGNIQuXVhGY7jK+cGhvws= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thorsten Blum , Herbert Xu , Sasha Levin Subject: [PATCH 6.1 363/522] crypto: nx - fix bounce buffer leaks in nx842_crypto_{alloc,free}_ctx Date: Tue, 16 Jun 2026 20:28:30 +0530 Message-ID: <20260616145142.770407045@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145125.307082728@linuxfoundation.org> References: <20260616145125.307082728@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thorsten Blum [ Upstream commit adb3faf2db1a66d0f015b44ac909a32dfc7f2f9c ] The bounce buffers are allocated with __get_free_pages() using BOUNCE_BUFFER_ORDER (order 2 = 4 pages), but both the allocation error path and nx842_crypto_free_ctx() release the buffers with free_page(). Use free_pages() with the matching order instead. Fixes: ed70b479c2c0 ("crypto: nx - add hardware 842 crypto comp alg") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/nx/nx-842.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/crypto/nx/nx-842.c +++ b/drivers/crypto/nx/nx-842.c @@ -116,8 +116,8 @@ void *nx842_crypto_alloc_ctx(struct nx84 ctx->dbounce = (u8 *)__get_free_pages(GFP_KERNEL, BOUNCE_BUFFER_ORDER); if (!ctx->wmem || !ctx->sbounce || !ctx->dbounce) { kfree(ctx->wmem); - free_page((unsigned long)ctx->sbounce); - free_page((unsigned long)ctx->dbounce); + free_pages((unsigned long)ctx->sbounce, BOUNCE_BUFFER_ORDER); + free_pages((unsigned long)ctx->dbounce, BOUNCE_BUFFER_ORDER); kfree(ctx); return ERR_PTR(-ENOMEM); } @@ -131,8 +131,8 @@ void nx842_crypto_free_ctx(void *p) struct nx842_crypto_ctx *ctx = p; kfree(ctx->wmem); - free_page((unsigned long)ctx->sbounce); - free_page((unsigned long)ctx->dbounce); + free_pages((unsigned long)ctx->sbounce, BOUNCE_BUFFER_ORDER); + free_pages((unsigned long)ctx->dbounce, BOUNCE_BUFFER_ORDER); } EXPORT_SYMBOL_GPL(nx842_crypto_free_ctx);