mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chenghai Huang <huangchenghai2@huawei.com>
To: <herbert@gondor.apana.org.au>, <davem@davemloft.net>
Cc: <linux-kernel@vger.kernel.org>, <linux-crypto@vger.kernel.org>,
	<liulongfang@huawei.com>, <shenyang39@huawei.com>,
	<qianweili@huawei.com>, <linwenkai6@hisilicon.com>,
	<wangzhou1@hisilicon.com>, <huangchenghai2@huawei.com>
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	[thread overview]
Message-ID: <20250816102834.828655-5-huangchenghai2@huawei.com> (raw)
In-Reply-To: <20250816102834.828655-1-huangchenghai2@huawei.com>

From: Zhushuai Yin <yinzhushuai@huawei.com>

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 <yinzhushuai@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
---
 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,
 	}
 
 	pdev = container_of(dev, struct pci_dev, dev);
+	if (pci_physfn(pdev) != qm->pdev) {
+		pci_err(qm->pdev, "the pdev input does not match the pf!\n");
+		return -EINVAL;
+	}
 
 	*fun_index = pdev->devfn;
 
-- 
2.33.0


  parent reply	other threads:[~2025-08-16 10:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-16 10:28 [PATCH 0/6] crypto: hisilicon - enhancements and fixes for device reset and configuration Chenghai Huang
2025-08-16 10:28 ` [PATCH 1/6] crypto: hisilicon - re-enable address prefetch after device resuming Chenghai Huang
2025-08-20  7:01   ` Weili Qian
2025-08-16 10:28 ` [PATCH 2/6] crypto: hisilicon/zip - remove unnecessary validation for high-performance mode configurations Chenghai Huang
2025-08-16 10:28 ` [PATCH 3/6] crypto: hisilicon - check the sva module status while enabling or disabling address prefetch Chenghai Huang
2025-08-16 10:28 ` Chenghai Huang [this message]
2025-08-16 10:28 ` [PATCH 5/6] crypto: hisilicon/qm - request reserved interrupt for virtual function Chenghai Huang
2025-08-16 10:28 ` [PATCH 6/6] crypto: hisilicon/zip - enable literal length in stream mode compression Chenghai Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250816102834.828655-5-huangchenghai2@huawei.com \
    --to=huangchenghai2@huawei.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linwenkai6@hisilicon.com \
    --cc=liulongfang@huawei.com \
    --cc=qianweili@huawei.com \
    --cc=shenyang39@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®