[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191011101551.30946-1-Jerome.Pouiller@silabs.com>
Date: Fri, 11 Oct 2019 10:15:54 +0000
From: Jerome Pouiller <Jerome.Pouiller@...abs.com>
To: "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jerome Pouiller <Jerome.Pouiller@...abs.com>,
kbuild test robot <lkp@...el.com>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH] staging: wfx: fix potential vulnerability to spectre
From: Jérôme Pouiller <jerome.pouiller@...abs.com>
array_index_nospec() should be applied after a bound check.
Fixes: 9bca45f3d6924f19f29c0d019e961af3f41bdc9e ("staging: wfx: allow to send 802.11 frames")
Reported-by: kbuild test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@...abs.com>
---
drivers/staging/wfx/wfx.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h
index 489836837b0a..4c0f2836015c 100644
--- a/drivers/staging/wfx/wfx.h
+++ b/drivers/staging/wfx/wfx.h
@@ -138,6 +138,7 @@ static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id)
dev_dbg(wdev->dev, "requesting non-existent vif: %d\n", vif_id);
return NULL;
}
+ vif_id = array_index_nospec(vif_id, ARRAY_SIZE(wdev->vif));
if (!wdev->vif[vif_id]) {
dev_dbg(wdev->dev, "requesting non-allocated vif: %d\n", vif_id);
return NULL;
--
2.20.1
Powered by blists - more mailing lists