@@ -1055,8 +1055,12 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
pkt_offset = (u16)round_up(tmp_len, 128);
/* for first fragment packet, driver need allocate 1536 +
* drvinfo_sz + RXDESC_SIZE to defrag packet. */
- if ((mf == 1) && (frag == 0))
+ if ((mf == 1) && (frag == 0)) {
alloc_sz = 1658;/*1658+6=1664, 1664 is 128 alignment.*/
+ if (tmp_len > alloc_sz) {
+ tmp_len = alloc_sz;
+ }
+ }
else
alloc_sz = tmp_len;
/* 2 is for IP header 4 bytes alignment in QoS packet case.
With an RTL8191SU USB adaptor, sometimes the hints for a fragmented packet are set, but the packet length is too large. Truncate the packet to prevent memory corruption. Signed-off-by: Haggai Eran <haggai.eran@gmail.com> --- Hi, I think this solves the issue for me. I'll test it more thoroughly later. I still don't know why a fragmented packet has such a large pkt_len value though. Thanks, Haggai drivers/staging/rtl8712/rtl8712_recv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)