From patchwork Sat Oct 22 07:19:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090272wrr; Sat, 22 Oct 2022 00:46:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ICBhnUZM6OYdDbbCv14ceKU1ZbhUwcxm9pLcUxZaEmWpKU+rdojosro4yY2XmFIQnBs7H X-Received: by 2002:a63:2cc2:0:b0:41c:681d:60d2 with SMTP id s185-20020a632cc2000000b0041c681d60d2mr18773144pgs.502.1666424781866; Sat, 22 Oct 2022 00:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424781; cv=none; d=google.com; s=arc-20160816; b=st0HuxpK3JeeRwPNwCNY/TQC+iiCN9veZSgWcDQz0DHXcQBbOi9W5h6nQDjnovsxaO mfP2pbjTlKnmZNPlUDnjMdwDaEcj0nRzO3ddqi2sZ6FHt1OiEKL84Xu23onCEWllQhwx BT99Erj2RE14mpfJlVn/EV+prxEytTtUjpIkydSYHGM3D/Qtlmk/QPatPQBPXfbpEXxK HlE50TtS4A8wgGF+2Z00PHzLP+llC69MnX+IZKdumWdXn8Uaa2lF0AFEjlvxOt5urmlw m3LzEkSQXs7d50YjPrD6LOfNsNRni11mTELHCL+lq496Ce59RueVKdh0EQK0llQmaNRA 2+xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=74/Y6yyfiUViYUjoXr7LaSrahpXaQuoYJFbDU/aEk8E=; b=K3W5pRdZwqRw1g7YPSpRbgiBj1/G55MmE/3/ZuOQR/iEmuYe+X2b0Hlvbt4a6TV8cJ KXFZ9zW+MT+yqrO40R2pQY3/SP45pkhM1IGL6qjObMkTpsTInEujHnUivuPbQNtBVlOB 7c7TVRDiCyWxwgO9gi5QNV9nfzfmIttBRPh5mhSlbS1YTugaDvR0tCIpQY+O913Q4Uyz 7+B5DMdSdQHBQk0XEEf0XOUr1oE2wlLcRa7Cr7zOd6AWJ15czPE5psXfYjhtU0dqQBE/ JeCsRl3BpL196+VN5/QwltnOd5py4j/gt1h4lacyNa+oZc1gDI6eSYBYTILEGjkYOlGT b3nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OB2p/jap"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a170902ccd100b0017eae5cc961si27691952ple.306.2022.10.22.00.46.09; Sat, 22 Oct 2022 00:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OB2p/jap"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbiJVHpx (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:53 -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 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373032250214296?= X-GMAIL-MSGID: =?utf-8?q?1747373032250214296?= 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, struct dma_slave_config *cfg) spin_lock_irqsave(&achan->vc.lock, flag); memcpy(&achan->slave, cfg, sizeof(struct dma_slave_config)); - if (cfg->peripheral_size == sizeof(config)) + if (cfg->peripheral_size == sizeof(*config)) achan->crci = config->crci; spin_unlock_irqrestore(&achan->vc.lock, flag);