From: Christopher Ertl <Christopher.Ertl@microsoft.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>,
"somnath.kotur@broadcom.com" <somnath.kotur@broadcom.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [EXTERNAL] [PATCH 2/6] net/bnxt: fix potential data race
Date: Tue, 3 Mar 2020 18:13:22 +0000 [thread overview]
Message-ID: <DB6PR83MB018304594088E58E2566EAE997E40@DB6PR83MB0183.EURPRD83.prod.outlook.com> (raw)
In-Reply-To: <20200303175938.14292-3-stephen@networkplumber.org>
Can we add the `volatile` qualifier to the `hwrm_cmd_resp_addr` member (in drivers/net/bnxt/bnxt.h) to get a stronger guarantee that the compiler won't insert TOCTOU races in the output?
Christopher Ertl | MSRC Vulnerabilities & Mitigations | Microsoft Limited | +44 7773976589 | Christopher.Ertl@microsoft.com
Microsoft Limited (company number 01624297) is a company registered in England and Wales whose registered office is at Microsoft Campus, Thames Valley Park, Reading. RG6 1WG
-----Original Message-----
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: Tuesday, March 3, 2020 6:00 PM
To: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>; somnath.kotur@broadcom.com
Cc: dev@dpdk.org; Stephen Hemminger <stephen@networkplumber.org>; Christopher Ertl <Christopher.Ertl@microsoft.com>
Subject: [EXTERNAL] [PATCH 2/6] net/bnxt: fix potential data race
The response from the firmware is accessed multiple times.
This is a potential TOCTOU error.
Reported-by: Christopher Ertl <Christopher.Ertl@microsoft.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bnxt/bnxt_hwrm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index a9c9c7297cab..20e2f6a36713 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3746,6 +3746,7 @@ int bnxt_hwrm_port_led_qcaps(struct bnxt *bp) {
struct hwrm_port_led_qcaps_output *resp = bp->hwrm_cmd_resp_addr;
struct hwrm_port_led_qcaps_input req = {0};
+ uint8_t num_leds;
int rc;
if (BNXT_VF(bp))
@@ -3757,10 +3758,11 @@ int bnxt_hwrm_port_led_qcaps(struct bnxt *bp)
HWRM_CHECK_RESULT();
- if (resp->num_leds > 0 && resp->num_leds < BNXT_MAX_LED) {
+ num_leds = resp->num_leds;
+ if (num_leds > 0 && num_leds < BNXT_MAX_LED) {
unsigned int i;
- bp->num_leds = resp->num_leds;
+ bp->num_leds = num_leds;
memcpy(bp->leds, &resp->led0_id,
sizeof(bp->leds[0]) * bp->num_leds);
for (i = 0; i < bp->num_leds; i++) {
--
2.20.1
next prev parent reply other threads:[~2020-03-05 9:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 17:59 [dpdk-dev] [PATCH 0/6] net/bnxt: bounds checking patches Stephen Hemminger
2020-03-03 17:59 ` [dpdk-dev] [PATCH 1/6] eal: add portable way to check for math overflow Stephen Hemminger
2020-03-03 22:28 ` Dmitry Kozlyuk
2020-03-03 17:59 ` [dpdk-dev] [PATCH 2/6] net/bnxt: fix potential data race Stephen Hemminger
2020-03-03 18:13 ` Christopher Ertl [this message]
2020-03-03 18:16 ` [dpdk-dev] [EXTERNAL] " Stephen Hemminger
2020-03-03 17:59 ` [dpdk-dev] [PATCH 3/6] net/bnxt: avoid potential out of bounds read Stephen Hemminger
2020-03-03 17:59 ` [dpdk-dev] [PATCH 4/6] net/bnxt: check for integer overflow in buffer sizing Stephen Hemminger
2020-03-03 17:59 ` [dpdk-dev] [PATCH 5/6] net/bnxt: add integer underflow check Stephen Hemminger
2020-03-03 17:59 ` [dpdk-dev] [PATCH 6/6] net/bnxt: sanitize max_l2_ctx Stephen Hemminger
2020-03-31 11:47 ` [dpdk-dev] [PATCH 0/6] net/bnxt: bounds checking patches Ferruh Yigit
2020-03-31 17:52 ` Ajit Khaparde
2020-03-31 18:04 ` Stephen Hemminger
2020-10-19 22:28 ` Thomas Monjalon
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=DB6PR83MB018304594088E58E2566EAE997E40@DB6PR83MB0183.EURPRD83.prod.outlook.com \
--to=christopher.ertl@microsoft.com \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=somnath.kotur@broadcom.com \
--cc=stephen@networkplumber.org \
/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;
as well as URLs for NNTP newsgroup(s).