linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76: usb: check urb->num_sgs limit in mt76u_process_rx_entry
       [not found] <cover.1550654091.git.lorenzo@kernel.org>
@ 2019-02-20  9:20 ` lorenzo
  2019-02-26 11:33   ` Felix Fietkau
  0 siblings, 1 reply; 2+ messages in thread
From: lorenzo @ 2019-02-20  9:20 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, sgruszka, lorenzo.bianconi

From: Lorenzo Bianconi <lorenzo@kernel.org>

check nsgs value is less than urb->num_sgs in mt76u_process_rx_entry
in order to avoid an out-of-bound access of urb->sg array

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 78191968b4fa..5d7b57827d1e 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -464,7 +464,7 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct mt76u_buf *buf)
 	__skb_put(skb, data_len);
 	len -= data_len;
 
-	while (len > 0 && urb->num_sgs) {
+	while (len > 0 && nsgs < urb->num_sgs) {
 		data_len = min_t(int, len, urb->sg[nsgs].length);
 		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
 				sg_page(&urb->sg[nsgs]),
-- 
2.20.1


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

* Re: [PATCH] mt76: usb: check urb->num_sgs limit in mt76u_process_rx_entry
  2019-02-20  9:20 ` [PATCH] mt76: usb: check urb->num_sgs limit in mt76u_process_rx_entry lorenzo
@ 2019-02-26 11:33   ` Felix Fietkau
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Fietkau @ 2019-02-26 11:33 UTC (permalink / raw)
  To: lorenzo; +Cc: linux-wireless, sgruszka, lorenzo.bianconi

On 2019-02-20 10:20, lorenzo@kernel.org wrote:
> From: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> check nsgs value is less than urb->num_sgs in mt76u_process_rx_entry
> in order to avoid an out-of-bound access of urb->sg array
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Applied, thanks.

- Felix

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

end of thread, other threads:[~2019-02-26 11:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1550654091.git.lorenzo@kernel.org>
2019-02-20  9:20 ` [PATCH] mt76: usb: check urb->num_sgs limit in mt76u_process_rx_entry lorenzo
2019-02-26 11:33   ` Felix Fietkau

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