[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 struct sk_buff *skb; 4744 long timeo; 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 timeo = sock_rcvtimeo(sk, noblock); 4752 4753 SCTP_DEBUG_PRINTK("Timeout: timeo: %ld, MAX: %ld.\n", ··· 4768 4769 if (skb) 4770 return skb; 4771 4772 if (sk->sk_shutdown & RCV_SHUTDOWN) 4773 break;
··· 4743 struct sk_buff *skb; 4744 long timeo; 4745 4746 timeo = sock_rcvtimeo(sk, noblock); 4747 4748 SCTP_DEBUG_PRINTK("Timeout: timeo: %ld, MAX: %ld.\n", ··· 4773 4774 if (skb) 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; 4781 4782 if (sk->sk_shutdown & RCV_SHUTDOWN) 4783 break;