driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] staging: wfx: fix potential vulnerability to spectre
@ 2019-10-11 16:47 Jerome Pouiller
  0 siblings, 0 replies; only message in thread
From: Jerome Pouiller @ 2019-10-11 16:47 UTC (permalink / raw)
  To: devel; +Cc: Greg Kroah-Hartman, linux-kernel, Dan Carpenter

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

array_index_nospec() should be applied after a bound check.

Fixes: 9bca45f3d692 ("staging: wfx: allow to send 802.11 frames")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
v2: cut down commit-id to 12 characters
v3: fix missing include

 drivers/staging/wfx/wfx.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h
index 489836837b0a..d678b5a08873 100644
--- a/drivers/staging/wfx/wfx.h
+++ b/drivers/staging/wfx/wfx.h
@@ -13,6 +13,7 @@
 #include <linux/completion.h>
 #include <linux/workqueue.h>
 #include <linux/mutex.h>
+#include <linux/nospec.h>
 #include <net/mac80211.h>
 
 #include "bh.h"
@@ -138,6 +139,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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-11 17:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 16:47 [PATCH v3] staging: wfx: fix potential vulnerability to spectre Jerome Pouiller

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).