From e038e67f0891b5fddffd779c20f32a7c59288170 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Mon, 6 Feb 2017 20:23:27 +0300 Subject: [PATCH] staging:r8188eu: update pkt->(data|tail|len) synchronously with rx_(data|tail|len) in recv_frame structure Original driver code uses rx_* members to store skb (pkt) fields (instead of pkt->* members), pkt->* updated only after data completely formed, not in process. Update pkt->* after data buffer changed (with rx_*). Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/include/rtw_recv.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h index 2e5caa4ac59d..d4d8a740990f 100644 --- a/drivers/staging/rtl8188eu/include/rtw_recv.h +++ b/drivers/staging/rtl8188eu/include/rtw_recv.h @@ -261,6 +261,8 @@ static inline u8 *recvframe_pull(struct recv_frame *precvframe, int sz) if (precvframe == NULL) return NULL; + + skb_pull(precvframe->pkt, sz); precvframe->rx_data += sz; if (precvframe->rx_data > precvframe->rx_tail) { precvframe->rx_data -= sz; @@ -278,7 +280,7 @@ static inline u8 *recvframe_put(struct recv_frame *precvframe, int sz) if (precvframe == NULL) return NULL; - + skb_put(precvframe->pkt, sz); precvframe->rx_tail += sz; if (precvframe->rx_tail > precvframe->pkt->end) { @@ -299,6 +301,7 @@ static inline u8 *recvframe_pull_tail(struct recv_frame *precvframe, int sz) if (precvframe == NULL) return NULL; + skb_trim(precvframe->pkt, precvframe->pkt->len - sz); precvframe->rx_tail -= sz; if (precvframe->rx_tail < precvframe->rx_data) { precvframe->rx_tail += sz; -- 2.20.1