patch-2.4.25 linux-2.4.25/include/net/sock.h
Next file: linux-2.4.25/include/pcmcia/cs_types.h
Previous file: linux-2.4.25/include/net/sctp/sctp.h
Back to the patch index
Back to the overall index
- Lines: 27
- Date:
2004-02-18 05:36:32.000000000 -0800
- Orig file:
linux-2.4.24/include/net/sock.h
- Orig date:
2003-11-28 10:26:21.000000000 -0800
diff -urN linux-2.4.24/include/net/sock.h linux-2.4.25/include/net/sock.h
@@ -1184,6 +1184,7 @@
static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
{
int err = 0;
+ int skb_len;
/* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
number of warnings when compiling with -W --ANK
@@ -1203,9 +1204,17 @@
skb->dev = NULL;
skb_set_owner_r(skb, sk);
+
+ /* Cache the SKB length before we tack it onto the receive
+ * queue. Once it is added it no longer belongs to us and
+ * may be freed by other threads of control pulling packets
+ * from the queue.
+ */
+ skb_len = skb->len;
+
skb_queue_tail(&sk->receive_queue, skb);
if (!sk->dead)
- sk->data_ready(sk,skb->len);
+ sk->data_ready(sk,skb_len);
out:
return err;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)