From nobody Sat Oct 4 14:13:10 2025 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B537D252912; Sat, 16 Aug 2025 10:28:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755340122; cv=none; b=FsVriqgwIeow6NvXN4KWb396n6c6Ir0TPtYz4QQLLXggR3xL80trpWbsbzvx6uc7Y7dnTc3yiW5mUSiotEmmDCA0h9RAMKhdjw1yMCgkkKTnVUGQiUKiqJlcf34g3VOpbTv+xLLtF4780Yrl+sbECq8A84+d7GY4E5HaTIbIK00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755340122; c=relaxed/simple; bh=faGEZEUY6p7AmPBtg081KvfiTo99MSUHwiEokQSTPpI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uzlp7YPo4L+uNC7ipHkPDXL8eNj2QLL78W2+sWPlGThTH8eRt6bcUC2tNcF5bDcM6V/5DRXYLDmPZJPDqus/YCM1uhjXXXOEkN1mN2Qhi38D8kQEQ58YSsqjGrqNnsQnXQvoGbWV29qctknsu31DZkf7ybLfHk0Ty6cBnveW5/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4c3w7h58zjz2Cg5h; Sat, 16 Aug 2025 18:24:16 +0800 (CST) Received: from dggemv706-chm.china.huawei.com (unknown [10.3.19.33]) by mail.maildlp.com (Postfix) with ESMTPS id B00DA140295; Sat, 16 Aug 2025 18:28:37 +0800 (CST) Received: from kwepemq200001.china.huawei.com (7.202.195.16) by dggemv706-chm.china.huawei.com (10.3.19.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 16 Aug 2025 18:28:37 +0800 Received: from localhost.huawei.com (10.90.31.46) by kwepemq200001.china.huawei.com (7.202.195.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 16 Aug 2025 18:28:36 +0800 From: Chenghai Huang To: , CC: , , , , , , , Subject: [PATCH 4/6] crypto: hisilicon/qm - check whether the input function and PF are on the same device Date: Sat, 16 Aug 2025 18:28:32 +0800 Message-ID: <20250816102834.828655-5-huangchenghai2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20250816102834.828655-1-huangchenghai2@huawei.com> References: <20250816102834.828655-1-huangchenghai2@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemq200001.china.huawei.com (7.202.195.16) Content-Type: text/plain; charset="utf-8" From: Zhushuai Yin Function rate limiting is set through physical function driver. Users configure by providing function information and rate limit values. Before configuration, it is necessary to check whether the provided function and PF belong to the same device. Fixes: 22d7a6c39cab ("crypto: hisilicon/qm - add pci bdf number check") Signed-off-by: Zhushuai Yin Signed-off-by: Chenghai Huang --- drivers/crypto/hisilicon/qm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index a5cc0ccd94f1..2f96c673b60a 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -3826,6 +3826,10 @@ static ssize_t qm_get_qos_value(struct hisi_qm *qm, = const char *buf, } =20 pdev =3D container_of(dev, struct pci_dev, dev); + if (pci_physfn(pdev) !=3D qm->pdev) { + pci_err(qm->pdev, "the pdev input does not match the pf!\n"); + return -EINVAL; + } =20 *fun_index =3D pdev->devfn; =20 --=20 2.33.0