diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-22 03:40:59 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-22 03:40:59 -0400 |
commit | 04e4223f44b89e50f275cb6b95a58ebe2c4909be (patch) | |
tree | 16f797eef4e2620b4150ddb94da78eaeb2baa679 /net/llc/llc_conn.c | |
parent | afdbe35787ea3390af0f1dd38b3dd9d8a8d313e7 (diff) |
[LLC]: Do better struct sock accounting on skbs
Signed-off-by: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/llc/llc_conn.c')
-rw-r--r-- | net/llc/llc_conn.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index d3783f8ee481..9f0e10e0978d 100644 --- a/net/llc/llc_conn.c +++ b/net/llc/llc_conn.c | |||
@@ -90,8 +90,8 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) | |||
90 | 90 | ||
91 | switch (ev->ind_prim) { | 91 | switch (ev->ind_prim) { |
92 | case LLC_DATA_PRIM: | 92 | case LLC_DATA_PRIM: |
93 | llc_save_primitive(skb, LLC_DATA_PRIM); | 93 | llc_save_primitive(sk, skb, LLC_DATA_PRIM); |
94 | if (sock_queue_rcv_skb(sk, skb)) { | 94 | if (unlikely(sock_queue_rcv_skb(sk, skb))) { |
95 | /* | 95 | /* |
96 | * shouldn't happen | 96 | * shouldn't happen |
97 | */ | 97 | */ |
@@ -103,6 +103,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) | |||
103 | case LLC_CONN_PRIM: { | 103 | case LLC_CONN_PRIM: { |
104 | struct sock *parent = skb->sk; | 104 | struct sock *parent = skb->sk; |
105 | 105 | ||
106 | skb_orphan(skb); | ||
107 | /* | ||
108 | * Set the skb->sk to the new struct sock, so that at accept | ||
109 | * type the upper layer can get the newly created struct sock. | ||
110 | */ | ||
106 | skb->sk = sk; | 111 | skb->sk = sk; |
107 | skb_queue_tail(&parent->sk_receive_queue, skb); | 112 | skb_queue_tail(&parent->sk_receive_queue, skb); |
108 | sk->sk_state_change(parent); | 113 | sk->sk_state_change(parent); |
@@ -702,10 +707,9 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb) | |||
702 | memcpy(&llc->daddr, &saddr, sizeof(llc->daddr)); | 707 | memcpy(&llc->daddr, &saddr, sizeof(llc->daddr)); |
703 | llc_sap_add_socket(sap, sk); | 708 | llc_sap_add_socket(sap, sk); |
704 | sock_hold(sk); | 709 | sock_hold(sk); |
710 | skb_set_owner_r(skb, parent); | ||
705 | sock_put(parent); | 711 | sock_put(parent); |
706 | skb->sk = parent; | 712 | } |
707 | } else | ||
708 | skb->sk = sk; | ||
709 | bh_lock_sock(sk); | 713 | bh_lock_sock(sk); |
710 | if (!sock_owned_by_user(sk)) | 714 | if (!sock_owned_by_user(sk)) |
711 | llc_conn_rcv(sk, skb); | 715 | llc_conn_rcv(sk, skb); |