Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2207442iof; Tue, 7 Jun 2022 23:13:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyARHa9d9qRTWNyqTAX6i+6WctBhE7GacmtX6Sx29AInJo7vzXLnwvaYaBxZk8EYChOaRSU X-Received: by 2002:a17:90a:a096:b0:1df:58d7:5b20 with SMTP id r22-20020a17090aa09600b001df58d75b20mr35791301pjp.212.1654668796906; Tue, 07 Jun 2022 23:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668796; cv=none; d=google.com; s=arc-20160816; b=nC4gkd4rsySafNVEN/GmLgQRoLWokKZZlw+bfmpVp4RU2YTEIpxChqfD6067NR1a01 TMwUDEmy/etGtpIbUja0eYnrc3t4lvLNeFhii24mJKE+DG6lyyvSAHZDRP69Gzw1ZxUi w9I6oYfrIl30/vAhLpluMHQIFuiedKiyXrh/icdsYqP20klEvaCP+q5RBYuqlhXiCctE kxiriY9geYtOAs8Gy0eboclS8N/UomM1yYgPqvtyDPkUGfd/n7NOBMuxJoyT8TCznr3P mnE9qh7NnrRwYidThiznLNxWU9F6qcs0ofKp278gfgp2DxfdHFn6wPlfYl+qk/2XIM+U Ke8A== 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=oIlSRAJdH/fcP+EbB+bP/svdjQQI3+EkFVph9jZzbh8=; b=kgeZmedd+hOYUYoV7ipakmO/mxenoIAahA1zYfzdY9wtxhGedeXwgxUZOJKZmdFo0q oPOivlAHt4mdkpGpN7qcAXSdmyEM3tsLQ3z3dCuWo9P/0YpR7fef8W2btVSJjaiHdtjk kH2ns/tUGqAwLmUeQFLd0zeuAEqm87GQrlL/vzXY1VI6VJYobVsGCBJUyxZxxjsKsGRt KGXF9ySdwPVQai5Mz6i95KcO0VVxSYGI4KN0o03nANO/jVXHQ9baWCvS5smTQ18SOR6h i7G5L4x8F2D7QN4vmKIcJVFG1yQgDeDKedKTLH/GoWoIckS4dPMNKc6IsYEKWzHw4HuT jdtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q93KIY4N; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id pb2-20020a17090b3c0200b001d28b845edcsi26150903pjb.59.2022.06.07.23.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:13:16 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q93KIY4N; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9493C21FBED; Tue, 7 Jun 2022 22:35:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391142AbiFHBwS (ORCPT + 99 others); Tue, 7 Jun 2022 21:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383311AbiFGVxC (ORCPT ); Tue, 7 Jun 2022 17:53:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB237243B82; Tue, 7 Jun 2022 12:11:23 -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 ams.source.kernel.org (Postfix) with ESMTPS id E7D3DB8220B; Tue, 7 Jun 2022 19:11:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A855C385A2; Tue, 7 Jun 2022 19:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629080; bh=/jRDmFSFPhC1E2+WCUaB7eecRJmaXUV3udXOeKe+JVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q93KIY4NXiwjra4Lkv1FK5NeSb6gayuZ35XxSQW86QAnsmLoBvlQGqxsde1jS4RIT 4+NmTl2jMqGO3rUREjmTOW4B9gcDnR+HcauPceQpP/kz3UQbwnM6e0Pq/z7o49VQ4P aycDHxeBlrMncZQw+vUBdt9a5XiC8FUhqgQwNluY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianrong Zhang , Jiantao Zhang , Lorenzo Pieralisi , Rob Herring , Sasha Levin Subject: [PATCH 5.18 545/879] PCI: dwc: Fix setting error return on MSI DMA mapping failure Date: Tue, 7 Jun 2022 19:01:03 +0200 Message-Id: <20220607165018.687969949@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Jiantao Zhang [ Upstream commit 88557685cd72cf0db686a4ebff3fad4365cb6071 ] When dma_mapping_error() returns error because of no enough memory, but dw_pcie_host_init() returns success, which will mislead the callers. Link: https://lore.kernel.org/r/30170911-0e2f-98ce-9266-70465b9073e5@huawei.com Fixes: 07940c369a6b ("PCI: dwc: Fix MSI page leakage in suspend/resume") Signed-off-by: Jianrong Zhang Signed-off-by: Jiantao Zhang Signed-off-by: Lorenzo Pieralisi Reviewed-by: Rob Herring Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pcie-designware-host.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 2fa86f32d964..9979302532b7 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -396,7 +396,8 @@ int dw_pcie_host_init(struct pcie_port *pp) sizeof(pp->msi_msg), DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); - if (dma_mapping_error(pci->dev, pp->msi_data)) { + ret = dma_mapping_error(pci->dev, pp->msi_data); + if (ret) { dev_err(pci->dev, "Failed to map MSI data\n"); pp->msi_data = 0; goto err_free_msi; -- 2.35.1