wil6210: add verification for cid upper bound
authorAlexei Avshalom Lazar <ailizaro@codeaurora.org>
Wed, 18 Dec 2019 18:10:13 +0000 (20:10 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 19 Dec 2019 16:16:07 +0000 (18:16 +0200)
max_assoc_sta can receive values (from the user or from the FW)
that are higher than WIL6210_MAX_CID.
Verify that cid doesn't exceed the upper bound of WIL6210_MAX_CID.

Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/wil6210/wil6210.h

index 97626bfd4dac836982080806ccc0db01e6c07cc4..bf00f0693a3d7e77b531e6b030446524e746ca89 100644 (file)
@@ -1148,7 +1148,7 @@ static inline void wil_c(struct wil6210_priv *wil, u32 reg, u32 val)
  */
 static inline bool wil_cid_valid(struct wil6210_priv *wil, int cid)
 {
-       return (cid >= 0 && cid < wil->max_assoc_sta);
+       return (cid >= 0 && cid < wil->max_assoc_sta && cid < WIL6210_MAX_CID);
 }
 
 void wil_get_board_file(struct wil6210_priv *wil, char *buf, size_t len);