linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] ath6kl: Array index out of bounds check
@ 2012-09-21 14:41 Pandiyarajan Pitchaimuthu
  2012-10-12 12:27 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Pandiyarajan Pitchaimuthu @ 2012-09-21 14:41 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo, ath6kl-devel

The variable assigned_ep can be assigned value of -1 and is never
checked if it equals -1. So the endpoint array can have -1  as the index
value and can be out of bounds.

The value of assigned_ep is checked for -1 and is ensured that the
endpoint array doesn't go out of bounds.

Signed-off-by: Pandiyarajan Pitchaimuthu <c_ppitch@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/htc_mbox.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
index cd0e1ba..ceaf921 100644
--- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c
+++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
@@ -2492,7 +2492,8 @@ static int ath6kl_htc_mbox_conn_service(struct htc_target *target,
 		max_msg_sz = le16_to_cpu(resp_msg->max_msg_sz);
 	}
 
-	if (assigned_ep >= ENDPOINT_MAX || !max_msg_sz) {
+	if (WARN_ON_ONCE(assigned_ep == ENDPOINT_UNUSED ||
+			 assigned_ep >= ENDPOINT_MAX || !max_msg_sz)) {
 		status = -ENOMEM;
 		goto fail_tx;
 	}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2] ath6kl: Array index out of bounds check
  2012-09-21 14:41 [PATCH V2] ath6kl: Array index out of bounds check Pandiyarajan Pitchaimuthu
@ 2012-10-12 12:27 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2012-10-12 12:27 UTC (permalink / raw)
  To: Pandiyarajan Pitchaimuthu; +Cc: linux-wireless, ath6kl-devel

On 09/21/2012 05:41 PM, Pandiyarajan Pitchaimuthu wrote:
> The variable assigned_ep can be assigned value of -1 and is never
> checked if it equals -1. So the endpoint array can have -1  as the index
> value and can be out of bounds.
> 
> The value of assigned_ep is checked for -1 and is ensured that the
> endpoint array doesn't go out of bounds.
> 
> Signed-off-by: Pandiyarajan Pitchaimuthu <c_ppitch@qca.qualcomm.com>

Thanks, applied.

Kalle

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-12 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21 14:41 [PATCH V2] ath6kl: Array index out of bounds check Pandiyarajan Pitchaimuthu
2012-10-12 12:27 ` Kalle Valo

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