diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-08 10:55:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-08 10:55:01 -0500 |
commit | d7fc02c7bae7b1cf69269992cf880a43a350cdaa (patch) | |
tree | a43d56fa72913a1cc98a0bbebe054d08581b3a7c /net/phonet/pep.c | |
parent | ee1262dbc65ce0b6234a915d8432171e8d77f518 (diff) | |
parent | 28b4d5cc17c20786848cdc07b7ea237a309776bb (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1815 commits)
mac80211: fix reorder buffer release
iwmc3200wifi: Enable wimax core through module parameter
iwmc3200wifi: Add wifi-wimax coexistence mode as a module parameter
iwmc3200wifi: Coex table command does not expect a response
iwmc3200wifi: Update wiwi priority table
iwlwifi: driver version track kernel version
iwlwifi: indicate uCode type when fail dump error/event log
iwl3945: remove duplicated event logging code
b43: fix two warnings
ipw2100: fix rebooting hang with driver loaded
cfg80211: indent regulatory messages with spaces
iwmc3200wifi: fix NULL pointer dereference in pmkid update
mac80211: Fix TX status reporting for injected data frames
ath9k: enable 2GHz band only if the device supports it
airo: Fix integer overflow warning
rt2x00: Fix padding bug on L2PAD devices.
WE: Fix set events not propagated
b43legacy: avoid PPC fault during resume
b43: avoid PPC fault during resume
tcp: fix a timewait refcnt race
...
Fix up conflicts due to sysctl cleanups (dead sysctl_check code and
CTL_UNNUMBERED removed) in
kernel/sysctl_check.c
net/ipv4/sysctl_net_ipv4.c
net/ipv6/addrconf.c
net/sctp/sysctl.c
Diffstat (limited to 'net/phonet/pep.c')
-rw-r--r-- | net/phonet/pep.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 5f32d217535b..b6356f3832f6 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -360,8 +360,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
360 | err = sock_queue_rcv_skb(sk, skb); | 360 | err = sock_queue_rcv_skb(sk, skb); |
361 | if (!err) | 361 | if (!err) |
362 | return 0; | 362 | return 0; |
363 | if (err == -ENOMEM) | ||
364 | atomic_inc(&sk->sk_drops); | ||
365 | break; | 363 | break; |
366 | } | 364 | } |
367 | 365 | ||
@@ -716,8 +714,8 @@ static int pep_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
716 | return -EINVAL; | 714 | return -EINVAL; |
717 | 715 | ||
718 | lock_sock(sk); | 716 | lock_sock(sk); |
719 | if (sock_flag(sk, SOCK_URGINLINE) | 717 | if (sock_flag(sk, SOCK_URGINLINE) && |
720 | && !skb_queue_empty(&pn->ctrlreq_queue)) | 718 | !skb_queue_empty(&pn->ctrlreq_queue)) |
721 | answ = skb_peek(&pn->ctrlreq_queue)->len; | 719 | answ = skb_peek(&pn->ctrlreq_queue)->len; |
722 | else if (!skb_queue_empty(&sk->sk_receive_queue)) | 720 | else if (!skb_queue_empty(&sk->sk_receive_queue)) |
723 | answ = skb_peek(&sk->sk_receive_queue)->len; | 721 | answ = skb_peek(&sk->sk_receive_queue)->len; |
@@ -845,7 +843,7 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
845 | struct msghdr *msg, size_t len) | 843 | struct msghdr *msg, size_t len) |
846 | { | 844 | { |
847 | struct pep_sock *pn = pep_sk(sk); | 845 | struct pep_sock *pn = pep_sk(sk); |
848 | struct sk_buff *skb = NULL; | 846 | struct sk_buff *skb; |
849 | long timeo; | 847 | long timeo; |
850 | int flags = msg->msg_flags; | 848 | int flags = msg->msg_flags; |
851 | int err, done; | 849 | int err, done; |
@@ -853,6 +851,16 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
853 | if (msg->msg_flags & MSG_OOB || !(msg->msg_flags & MSG_EOR)) | 851 | if (msg->msg_flags & MSG_OOB || !(msg->msg_flags & MSG_EOR)) |
854 | return -EOPNOTSUPP; | 852 | return -EOPNOTSUPP; |
855 | 853 | ||
854 | skb = sock_alloc_send_skb(sk, MAX_PNPIPE_HEADER + len, | ||
855 | flags & MSG_DONTWAIT, &err); | ||
856 | if (!skb) | ||
857 | return -ENOBUFS; | ||
858 | |||
859 | skb_reserve(skb, MAX_PHONET_HEADER + 3); | ||
860 | err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); | ||
861 | if (err < 0) | ||
862 | goto outfree; | ||
863 | |||
856 | lock_sock(sk); | 864 | lock_sock(sk); |
857 | timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); | 865 | timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); |
858 | if ((1 << sk->sk_state) & (TCPF_LISTEN|TCPF_CLOSE)) { | 866 | if ((1 << sk->sk_state) & (TCPF_LISTEN|TCPF_CLOSE)) { |
@@ -896,28 +904,13 @@ disabled: | |||
896 | goto disabled; | 904 | goto disabled; |
897 | } | 905 | } |
898 | 906 | ||
899 | if (!skb) { | ||
900 | skb = sock_alloc_send_skb(sk, MAX_PNPIPE_HEADER + len, | ||
901 | flags & MSG_DONTWAIT, &err); | ||
902 | if (skb == NULL) | ||
903 | goto out; | ||
904 | skb_reserve(skb, MAX_PHONET_HEADER + 3); | ||
905 | |||
906 | if (sk->sk_state != TCP_ESTABLISHED || | ||
907 | !atomic_read(&pn->tx_credits)) | ||
908 | goto disabled; /* sock_alloc_send_skb might sleep */ | ||
909 | } | ||
910 | |||
911 | err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); | ||
912 | if (err < 0) | ||
913 | goto out; | ||
914 | |||
915 | err = pipe_skb_send(sk, skb); | 907 | err = pipe_skb_send(sk, skb); |
916 | if (err >= 0) | 908 | if (err >= 0) |
917 | err = len; /* success! */ | 909 | err = len; /* success! */ |
918 | skb = NULL; | 910 | skb = NULL; |
919 | out: | 911 | out: |
920 | release_sock(sk); | 912 | release_sock(sk); |
913 | outfree: | ||
921 | kfree_skb(skb); | 914 | kfree_skb(skb); |
922 | return err; | 915 | return err; |
923 | } | 916 | } |