summaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2005-12-02 20:30:06 -0800
committerDavid S. Miller <davem@davemloft.net>2005-12-02 20:30:06 -0800
commit6736dc35e9e1b9c8084d5c362a429a3e8189af6b (patch)
treeeeead909e51390c8e5c3df73bcf3dbddbba71575 /net/sctp
parent1b0997f561bf46689cc6e0903f342e9bf2506bf1 (diff)
downloadop-kernel-dev-6736dc35e9e1b9c8084d5c362a429a3e8189af6b.zip
op-kernel-dev-6736dc35e9e1b9c8084d5c362a429a3e8189af6b.tar.gz
[SCTP]: Return socket errors only if the receive queue is empty.
This patch fixes an issue where it is possible to get valid data after a ENOTCONN error. It returns socket errors only after data queued on socket receive queue is consumed. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/socket.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index abab81f..d890dfa 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4743,11 +4743,6 @@ static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags,
struct sk_buff *skb;
long timeo;
- /* Caller is allowed not to check sk->sk_err before calling. */
- error = sock_error(sk);
- if (error)
- goto no_packet;
-
timeo = sock_rcvtimeo(sk, noblock);
SCTP_DEBUG_PRINTK("Timeout: timeo: %ld, MAX: %ld.\n",
@@ -4774,6 +4769,11 @@ static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags,
if (skb)
return skb;
+ /* Caller is allowed not to check sk->sk_err before calling. */
+ error = sock_error(sk);
+ if (error)
+ goto no_packet;
+
if (sk->sk_shutdown & RCV_SHUTDOWN)
break;
OpenPOWER on IntegriCloud