From patchwork Fri Nov 18 10:42:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 22257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp115299wrr; Fri, 18 Nov 2022 02:47:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ud6awxekueOgTDdBAByo1hhb2fWjoMW8B+FFvMMUYvmGQKVoiuq9gbAy9IupqTaz6AR8g X-Received: by 2002:a65:5541:0:b0:476:759b:7952 with SMTP id t1-20020a655541000000b00476759b7952mr6218221pgr.316.1668768420807; Fri, 18 Nov 2022 02:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668768420; cv=none; d=google.com; s=arc-20160816; b=e09QNs1mg0fd1KhJGJ1MbCrsRMObDn48+ebkRkhiQZ/p+GTnc0nHwbhqooXt/eD/tw 3KbF7ja2YGzKZb+D3T2sIIacRMfsz3ExxWF2PjQVgn+vEnqbSbL4vLY5OpVQV4HeDtu7 n+pmnDzoWwUx7deDXgARhhEuVHzjHAbjvkz7id2yLb0jUwWlRLweyepOVb4MUGB4ot1o BlgrN8/1jfD2WGwO59XWzns1J9nc6P+UHrjMZGQRq7w5WWtJ8u3GPMY1dCYf9Uzk0ed1 KaGnOw0ku9M99H+1Pv7X7U5vJfIJOK2FlfZlyxFam9vqqvArYzR8uTpQfEM5AUQl9PVP gWbA== 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=m8Um/Rg95KgS2s7/snnzIy1wGp2M3ZVDsw+nqyd2eUugFKPfVLCPEuYTSBYPftiwv+ /VF4Nks34OqfJD1N3jIFhfyM8zcxgBsz5jty2w8CMRmZE9JdNIDAZkhWdK1E75ptJL9L t0ekQtcHuf4eoQ0Jtkkqm4NQHlavk40NHTqC1+nObAm+yzNsX1qAI2XvsITlIqonVmPh mMd/SV9ggHXTTdK1Mw+zf2cAlRzA2z2A0BIGgNqth3lgj2C/dVtdFwbzXlj2kaf1TX+y ps2/Pf8wboYbt9PpSSVaybh2jrTg0vK71hs8etman/TrDf/1/KD+sQ0JMWQbc+mENdbW MJIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=Ht2++Lnd; 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 b9-20020a170902e94900b00186881688f9si3422440pll.276.2022.11.18.02.46.47; Fri, 18 Nov 2022 02:47:00 -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=Ht2++Lnd; 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 S241338AbiKRKm6 (ORCPT + 99 others); Fri, 18 Nov 2022 05:42:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbiKRKmz (ORCPT ); Fri, 18 Nov 2022 05:42:55 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 757DF97083 for ; Fri, 18 Nov 2022 02:42:54 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1668768172; 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=Ht2++LndUjVOqrAQD0+1tnKkVc0lpX3HoTEFa58uWLO+SaR/r7amjxj5fYlev1agdSx5LN RwfAjrXH7aOkiRE3FHSxFwxWW/tnzL/GYYZbFyI4aqhhEY4B5R2vy+0fjc4p4kxMEwHTi1 zJUmdMN7WjkNR5fza5+eRJ+gB44Kny0= To: Joerg Roedel Cc: Will Deacon , iommu@lists.linux.dev, 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 13:42:52 +0300 Message-Id: <20221118104252.122809-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?1749830515616202547?= А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)