diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 91d28957dc10..6961700ff3a0 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -926,6 +926,29 @@ static inline void sock_put(struct sock *sk) | |||
926 | sk_free(sk); | 926 | sk_free(sk); |
927 | } | 927 | } |
928 | 928 | ||
929 | static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb) | ||
930 | { | ||
931 | int rc = NET_RX_SUCCESS; | ||
932 | |||
933 | if (sk_filter(sk, skb, 0)) | ||
934 | goto discard_and_relse; | ||
935 | |||
936 | skb->dev = NULL; | ||
937 | |||
938 | bh_lock_sock(sk); | ||
939 | if (!sock_owned_by_user(sk)) | ||
940 | rc = sk->sk_backlog_rcv(sk, skb); | ||
941 | else | ||
942 | sk_add_backlog(sk, skb); | ||
943 | bh_unlock_sock(sk); | ||
944 | out: | ||
945 | sock_put(sk); | ||
946 | return rc; | ||
947 | discard_and_relse: | ||
948 | kfree_skb(skb); | ||
949 | goto out; | ||
950 | } | ||
951 | |||
929 | /* Detach socket from process context. | 952 | /* Detach socket from process context. |
930 | * Announce socket dead, detach it from wait queue and inode. | 953 | * Announce socket dead, detach it from wait queue and inode. |
931 | * Note that parent inode held reference count on this struct sock, | 954 | * Note that parent inode held reference count on this struct sock, |