[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>

authored by Neil Horman and committed by David S. Miller 6736dc35 1b0997f5

+5 -5
+5 -5
net/sctp/socket.c
··· 4743 4743 struct sk_buff *skb; 4744 4744 long timeo; 4745 4745 4746 - /* Caller is allowed not to check sk->sk_err before calling. */ 4747 - error = sock_error(sk); 4748 - if (error) 4749 - goto no_packet; 4750 - 4751 4746 timeo = sock_rcvtimeo(sk, noblock); 4752 4747 4753 4748 SCTP_DEBUG_PRINTK("Timeout: timeo: %ld, MAX: %ld.\n", ··· 4768 4773 4769 4774 if (skb) 4770 4775 return skb; 4776 + 4777 + /* Caller is allowed not to check sk->sk_err before calling. */ 4778 + error = sock_error(sk); 4779 + if (error) 4780 + goto no_packet; 4771 4781 4772 4782 if (sk->sk_shutdown & RCV_SHUTDOWN) 4773 4783 break;