From nobody Fri Dec 19 18:52:56 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 057B6C04A95 for ; Sat, 22 Oct 2022 07:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231395AbiJVHpy (ORCPT ); Sat, 22 Oct 2022 03:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231384AbiJVHoE (ORCPT ); Sat, 22 Oct 2022 03:44:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DEAB65002; Sat, 22 Oct 2022 00:42:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E125460ADB; Sat, 22 Oct 2022 07:38:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0183EC433D6; Sat, 22 Oct 2022 07:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424294; bh=mTM8XwlixReFBR2M/bAy6NtBfzbCLFwzZaBA3O/Amjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OB2p/japObCqWth+VM4eOx89oQx7r7fc9ZTSADbkXdvCND7VUjWxcJKA8zsuUeYEK J1vxu2xcsYru2Ww1QEs4quYOj9Hx0aaUGOxcwDqC9fpsvRjXkKrZ6iBT7rqSefTFWL AajHqapvIA+hYRjgXL2ogxhbFBZemrjU3vuIugzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Marangi , Arnd Bergmann , Dmitry Baryshkov , Vinod Koul Subject: [PATCH 5.19 065/717] dmaengine: qcom-adm: fix wrong sizeof config in slave_config Date: Sat, 22 Oct 2022 09:19:04 +0200 Message-Id: <20221022072426.574843271@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Marangi commit 7c8765308371be30f50c1b5b97618b731514b207 upstream. Fix broken slave_config function that uncorrectly compare the peripheral_size with the size of the config pointer instead of the size of the config struct. This cause the crci value to be ignored and cause a kernel panic on any slave that use adm driver. To fix this, compare to the size of the struct and NOT the size of the pointer. Fixes: 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config") Signed-off-by: Christian Marangi Cc: stable@vger.kernel.org # v5.17+ Reviewed-by: Arnd Bergmann Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220915204844.3838-1-ansuelsmth@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/qcom/qcom_adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c index facdacf8aede..c77d9de853de 100644 --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -494,7 +494,7 @@ static int adm_slave_config(struct dma_chan *chan, stru= ct dma_slave_config *cfg) =20 spin_lock_irqsave(&achan->vc.lock, flag); memcpy(&achan->slave, cfg, sizeof(struct dma_slave_config)); - if (cfg->peripheral_size =3D=3D sizeof(config)) + if (cfg->peripheral_size =3D=3D sizeof(*config)) achan->crci =3D config->crci; spin_unlock_irqrestore(&achan->vc.lock, flag); =20 --=20 2.38.0