From patchwork Fri Nov 18 09:44:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 22243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp91673wrr; Fri, 18 Nov 2022 01:47:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf5a8p8/GULEy4YJ6A/iHVR+RpMuXH54Bc2xlshFpdgLPgC9wbNrKhOqvhUhyBfa4LdfEZDq X-Received: by 2002:a17:902:b218:b0:188:e255:39af with SMTP id t24-20020a170902b21800b00188e25539afmr6797692plr.86.1668764863742; Fri, 18 Nov 2022 01:47:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668764863; cv=none; d=google.com; s=arc-20160816; b=Sw2Z0tzVzR2y5mfv4CsRqpCwqqzqnqYRVppGrGNtD3wmzmhRk2pH+rsrpbXrYkOj78 oogImyK4xgovTD8NL4zy1V3DjL79flSKkgfM33g4MjwI+AhD30/xURsUNJjWfRjgfwc2 PBtdXP3DW95fPzhvZxxubehDQ1QmzTKUdyw3HT7hC4NM2gKMLYPtiJcggxI3LIG0xBcS 569e3Aqx3QXYrzvZw6ptsQ9Eq7dyRo7qcujfHyEQZA8vba+ZXvmGWgQ1lc7ckRfr02l9 2ETDV4cmerxeI8hdrKsMWeEEetQYSCUeTQWGQKh1yZDbSn9gy1sdRZ0fnU50j304qOQu D1ug== 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 :message-id:date:subject:cc:to:dkim-signature:from; bh=zhq3ZPbOW/IjySbkqalqQrSgHm9uIPo6a/xa8S5bNyE=; b=HIlEnobisN/iftcxXHDZPuYAGyXnVddPUsCN+sTIkHR8Q8mK4LhCvSV/4iCuYtBcXb VvCCfpsEJuKy687x5VTM3SY11o4f7seV93VtaXqk2EFvoAbhYbq/krbK3jF3cEPzcWnK w3kE2pvjZi3llhqHXy5jXt2xKMdFpuzfdlKUZq8UI3LhIORldH4mdfLs/JlxA4FQFlNJ UDK9JTf3X5an/6nifiM4Zm23gkGMcUFXAxKFwHclcHPDP8sc2lb5jf8Mc7VvzbJ5BidJ eYYtSVgvmQofwtwocCpM3QBIPpjfNHQSSWKXlSpg5g7liJkIpkkmP8UJRVecxNYCksdL VLfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=Xi3duiFH; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb9-20020a056a004c8900b0056157a60187si2865101pfb.203.2022.11.18.01.47.30; Fri, 18 Nov 2022 01:47:43 -0800 (PST) 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=@swemel.ru header.s=mail header.b=Xi3duiFH; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241582AbiKRJqM (ORCPT + 99 others); Fri, 18 Nov 2022 04:46:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241338AbiKRJpm (ORCPT ); Fri, 18 Nov 2022 04:45:42 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E8956829A for ; Fri, 18 Nov 2022 01:44:07 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1668764643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zhq3ZPbOW/IjySbkqalqQrSgHm9uIPo6a/xa8S5bNyE=; b=Xi3duiFHxBl/SeswyWTEHSQmenur5IYUy3c5yXCK8Ow/OJYCmFlF4VJslIK+Hp8mLbQHMk qDa3061tLie8FKqNM95mi5+4t2vpJ6/ZXjoj8O0kYIzG/Wf+wI2ZraY50mJaPB+XCk4Cyy Q5vFJlRYPZts+IiNy97ph3v23kCQI+g= To: Joerg Roedel Cc: Will Deacon , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, trufanov@swemel.ru, vfh@swemel.ru Subject: [PATCH] iommu: amd: Added value check Date: Fri, 18 Nov 2022 12:44:02 +0300 Message-Id: <20221118094402.122027-1-arefev@swemel.ru> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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?1749826785859274718?= X-GMAIL-MSGID: =?utf-8?q?1749826785859274718?= Аdded a return value check for the function mmu_notifier_register. Return value of a function 'mmu_notifier_register' called at iommu_v2.c:642 is not checked, but it is usually checked for this function Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev --- drivers/iommu/amd/iommu_v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd/iommu_v2.c b/drivers/iommu/amd/iommu_v2.c index 5ecc0bc608ec..88134f34589f 100644 --- a/drivers/iommu/amd/iommu_v2.c +++ b/drivers/iommu/amd/iommu_v2.c @@ -639,7 +639,9 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid, if (pasid_state->mm == NULL) goto out_free; - mmu_notifier_register(&pasid_state->mn, mm); + ret = mmu_notifier_register(&pasid_state->mn, mm); + if (ret) + goto out_free; ret = set_pasid_state(dev_state, pasid_state, pasid); if (ret)