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 D86B434FF79; Tue, 16 Jun 2026 18:33:23 +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=1781634804; cv=none; b=Jt28r0NvE8kbZhtCgpXhLw2Z++NC+GejCkzgY04oxFzU+cYDveDNsJpu1bpc4J0qkYCCoWmeu6+DJo9f7l3jusMnM9TjIdm5HHcbGd5R8U3d+S0TLjc9Y5LZqGtnv3VjZTncINK7BUjjKfTQONrj+44AaUaZn2MrWHldSgCA7vk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781634804; c=relaxed/simple; bh=0jMpN45fDvOvS6ly9kU9u98SDZU2KkqXgJ80dfDzgWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U0SY4+bmUsgON/ikUE+aihOzpq0rJyuUczyUZTRygOy5+H56PT6LDJtUXbLMe19ru7S8+JEZ0l6IeVqMC7eCnI2BOX1kSMPjln+1idFfXpEQTQE2ZKxETzWufq0Gn7pJZUWpkaJFS1tiVnKGkMUfv5hjHHtRyBA+clvfNxxaUIk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Cz/hKWOS; 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="Cz/hKWOS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B391D1F000E9; Tue, 16 Jun 2026 18:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781634803; bh=ETredjUqkT5ps/ysBg/kebdiF2Fo71tOyERpEdBxlt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Cz/hKWOS2N6DviKjIcwhfQCta+T9/JP8m2dxdrDhX8vSEUNg1jEvrmNoCN51ZC/z1 9LTsPaYGP+tuhZ6IS2u+hvEwL6ba4xubHwG5jdDv7iTqlrMKmi5vkhZ+PSdhJciT1P /pZkvE03ofOJT71Nhk70MFF3N2fzQugquHsbTtSI= 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 5.15 292/411] crypto: nx - fix bounce buffer leaks in nx842_crypto_{alloc,free}_ctx Date: Tue, 16 Jun 2026 20:28:50 +0530 Message-ID: <20260616145116.672551944@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145100.376842714@linuxfoundation.org> References: <20260616145100.376842714@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 5.15-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);