diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-08-02 22:23:56 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-08-02 22:42:28 -0400 |
commit | 3516ffb0fef710749daf288c0fe146503e0cf9d4 (patch) | |
tree | f3e3cd29dd541a457e61152560fe4416642a69bc /net/ipv4/tcp.c | |
parent | 1bcabbdb0bdfe8b15b05150a7857646430aaa7f8 (diff) |
[TCP]: Invoke tcp_sendmsg() directly, do not use inet_sendmsg().
As discovered by Evegniy Polyakov, if we try to sendmsg after
a connection reset, we can do incredibly stupid things.
The core issue is that inet_sendmsg() tries to autobind the
socket, but we should never do that for TCP. Instead we should
just go straight into TCP's sendmsg() code which will do all
of the necessary state and pending socket error checks.
TCP's sendpage already directly vectors to tcp_sendpage(), so this
merely brings sendmsg() in line with that.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index da4c0b6ab79a..7e740112b238 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -658,9 +658,10 @@ static inline int select_size(struct sock *sk) | |||
658 | return tmp; | 658 | return tmp; |
659 | } | 659 | } |
660 | 660 | ||
661 | int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 661 | int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, |
662 | size_t size) | 662 | size_t size) |
663 | { | 663 | { |
664 | struct sock *sk = sock->sk; | ||
664 | struct iovec *iov; | 665 | struct iovec *iov; |
665 | struct tcp_sock *tp = tcp_sk(sk); | 666 | struct tcp_sock *tp = tcp_sk(sk); |
666 | struct sk_buff *skb; | 667 | struct sk_buff *skb; |