Linux-Wireless Archive on lore.kernel.org
 help / Atom feed
* [PATCH] ray_cs: fix array out-of-bounds access
@ 2018-12-20 14:05 Colin King
  2019-01-10 11:32 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-12-20 14:05 UTC (permalink / raw)
  To: Kalle Valo, David S . Miller, linux-wireless; +Cc: kernel-janitors, netdev

From: Colin Ian King <colin.king@canonical.com>

Currently array element org[3] is being accessed, however the array is
only 3 elements in size, so this looks like an off-by-one out-of-bounds
error. Fix this by using org[2], which I believe was the original
intent.

This issue has existed in the driver back in the pre-git days, so no
idea when it was introduced.

Detected by CoverityScan, CID#711344 ("Out-of-bounds read")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/ray_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 33ad87528d9a..8b2741c8edf2 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -959,7 +959,7 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx,
 		if (proto == htons(ETH_P_AARP) || proto == htons(ETH_P_IPX)) {
 			/* This is the selective translation table, only 2 entries */
 			writeb(0xf8,
-			       &((struct snaphdr_t __iomem *)ptx->var)->org[3]);
+			       &((struct snaphdr_t __iomem *)ptx->var)->org[2]);
 		}
 		/* Copy body of ethernet packet without ethernet header */
 		memcpy_toio((void __iomem *)&ptx->var +
-- 
2.19.1


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

* Re: [PATCH] ray_cs: fix array out-of-bounds access
  2018-12-20 14:05 [PATCH] ray_cs: fix array out-of-bounds access Colin King
@ 2019-01-10 11:32 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-01-10 11:32 UTC (permalink / raw)
  To: Colin King; +Cc: David S . Miller, linux-wireless, kernel-janitors, netdev

Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently array element org[3] is being accessed, however the array is
> only 3 elements in size, so this looks like an off-by-one out-of-bounds
> error. Fix this by using org[2], which I believe was the original
> intent.
> 
> This issue has existed in the driver back in the pre-git days, so no
> idea when it was introduced.
> 
> Detected by CoverityScan, CID#711344 ("Out-of-bounds read")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch applied to wireless-drivers-next.git, thanks.

72255c807156 ray_cs: fix array out-of-bounds access

-- 
https://patchwork.kernel.org/patch/10738943/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20 14:05 [PATCH] ray_cs: fix array out-of-bounds access Colin King
2019-01-10 11:32 ` Kalle Valo

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org linux-wireless@archiver.kernel.org
	public-inbox-index linux-wireless


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/ public-inbox