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 06B9A2C0F60; Tue, 26 Aug 2025 14:17:40 +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=1756217861; cv=none; b=GFPtzzsul/bIa3xC5sjO/8H/EQPg0+v4M19i5UFfWUTSa7qr4Y1Pk9NA87M2yjTG/UCtjzDh4DChxKNxLW4CLDyXoWo0CagBqlF+oKvpd93TDLS9zunCi9FdzLqcW1wXHdyjwy7RxD4Xnh9Ac0tSINHuLLRr1c44zLy8LPXgjvE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756217861; c=relaxed/simple; bh=O1y36TJV/tpEokJ6ii8hqmu95/QRrewMWUjSn135ra8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RrWc7alxniOPypwAOsibmaNQ4UyZ5np+P4OzXJdOxEbd67aQP58RLXXRAWCCHTJS5jeoVVsbMtFNxcOzy/PQPuNFlpZzNP8aKyYCOVBbE5rS333769eoznLTWgIWaGPsjYFUns9PKlV6iFDQhNDDEoj8zwlTzwaESop447Kdguw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lip+5x0k; 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="lip+5x0k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41214C4CEF1; Tue, 26 Aug 2025 14:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756217860; bh=O1y36TJV/tpEokJ6ii8hqmu95/QRrewMWUjSn135ra8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lip+5x0k2thA02gVs0S4bxi4hKP/NGQNFPbQtMSpYATpNuT7Ed/pvg1vMH7f+rgV0 WkwezWkxbxNIUbct7H7lg9mZ2JwU5HUUYp/y1x1t0WUV36A0CebGPrQRPqpa+VFhyB 7csHOS7JyAhDZNO1l5sOzWq20+5hOfl28WpnMkNs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thomas Fourier , Christophe Leroy , Madhavan Srinivasan , Sasha Levin Subject: [PATCH 5.10 271/523] (powerpc/512) Fix possible `dma_unmap_single()` on uninitialized pointer Date: Tue, 26 Aug 2025 13:08:01 +0200 Message-ID: <20250826110931.112695817@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110924.562212281@linuxfoundation.org> References: <20250826110924.562212281@linuxfoundation.org> User-Agent: quilt/0.68 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.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Fourier [ Upstream commit 760b9b4f6de9a33ca56a05f950cabe82138d25bd ] If the device configuration fails (if `dma_dev->device_config()`), `sg_dma_address(&sg)` is not initialized and the jump to `err_dma_prep` leads to calling `dma_unmap_single()` on `sg_dma_address(&sg)`. Signed-off-by: Thomas Fourier Reviewed-by: Christophe Leroy Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20250610142918.169540-2-fourier.thomas@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/512x/mpc512x_lpbfifo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c b/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c index 04bf6ecf7d55..85e0fa7d902b 100644 --- a/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c +++ b/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c @@ -240,10 +240,8 @@ static int mpc512x_lpbfifo_kick(void) dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; /* Make DMA channel work with LPB FIFO data register */ - if (dma_dev->device_config(lpbfifo.chan, &dma_conf)) { - ret = -EINVAL; - goto err_dma_prep; - } + if (dma_dev->device_config(lpbfifo.chan, &dma_conf)) + return -EINVAL; sg_init_table(&sg, 1); -- 2.39.5