diff mbox

staging: r8712u: fix bug in r8712_recv_indicatepkt()

Message ID 1347299715.1234.1902.camel@edumazet-glaptop (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Eric Dumazet Sept. 10, 2012, 5:55 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

64bit arches have a buggy r8712u driver, let's fix it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/staging/rtl8712/recv_linux.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Larry Finger Sept. 10, 2012, 6:34 p.m. UTC | #1
On 09/10/2012 12:55 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> 64bit arches have a buggy r8712u driver, let's fix it.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>   drivers/staging/rtl8712/recv_linux.c |    7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/recv_linux.c b/drivers/staging/rtl8712/recv_linux.c
> index 0e26d5f..495ee12 100644
> --- a/drivers/staging/rtl8712/recv_linux.c
> +++ b/drivers/staging/rtl8712/recv_linux.c
> @@ -117,13 +117,8 @@ void r8712_recv_indicatepkt(struct _adapter *padapter,
>   	if (skb == NULL)
>   		goto _recv_indicatepkt_drop;
>   	skb->data = precv_frame->u.hdr.rx_data;
> -#ifdef NET_SKBUFF_DATA_USES_OFFSET
> -	skb->tail = (sk_buff_data_t)(precv_frame->u.hdr.rx_tail -
> -		     precv_frame->u.hdr.rx_head);
> -#else
> -	skb->tail = (sk_buff_data_t)precv_frame->u.hdr.rx_tail;
> -#endif
>   	skb->len = precv_frame->u.hdr.len;
> +	skb_set_tail_pointer(skb, skb->len);
>   	if ((pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1))
>   		skb->ip_summed = CHECKSUM_UNNECESSARY;
>   	else

Eric,

Thanks for this. It works for me. I had looked at this code a number of times, 
but for some reason, I thought that the u.hdr.rx_yyyy parameters were like 
32-bit systems and that all 4 values were pointers, and not like 64-bit systems, 
thus the funny conversion. Strange that the bug was never triggered until commit 
c8628155ece3 - this code has not changed since the driver was accepted into 2.6.37.

A few points on the patch. As the driver is in staging, the patch needs to go to 
Greg Kroah-Hartman. In addition, please add the "Cc: Stable 
<stable@vger.kernel.org>" line. You may also give an a s-o-b for me. Finally, 
this patch should fix https://bugzilla.redhat.com/show_bug.cgi?id=847525, and 
https://bugzilla.kernel.org/show_bug.cgi?id=45071.

Larry

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/rtl8712/recv_linux.c b/drivers/staging/rtl8712/recv_linux.c
index 0e26d5f..495ee12 100644
--- a/drivers/staging/rtl8712/recv_linux.c
+++ b/drivers/staging/rtl8712/recv_linux.c
@@ -117,13 +117,8 @@  void r8712_recv_indicatepkt(struct _adapter *padapter,
 	if (skb == NULL)
 		goto _recv_indicatepkt_drop;
 	skb->data = precv_frame->u.hdr.rx_data;
-#ifdef NET_SKBUFF_DATA_USES_OFFSET
-	skb->tail = (sk_buff_data_t)(precv_frame->u.hdr.rx_tail -
-		     precv_frame->u.hdr.rx_head);
-#else
-	skb->tail = (sk_buff_data_t)precv_frame->u.hdr.rx_tail;
-#endif
 	skb->len = precv_frame->u.hdr.len;
+	skb_set_tail_pointer(skb, skb->len);
 	if ((pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1))
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 	else