Dimitris Michailidis 9fa5fdf291 tcp: Fix length tcp_splice_data_recv passes to skb_splice_bits.
tcp_splice_data_recv has two lengths to consider: the len parameter it
gets from tcp_read_sock, which specifies the amount of data in the skb,
and rd_desc->count, which is the amount of data the splice caller still
wants.  Currently it passes just the latter to skb_splice_bits, which then
splices min(rd_desc->count, skb->len - offset) bytes.

Most of the time this is fine, except when the skb contains urgent data.
In that case len goes only up to the urgent byte and is less than
skb->len - offset.  By ignoring len tcp_splice_data_recv may a) splice
data tcp_read_sock told it not to, b) return to tcp_read_sock a value > len.

Now, tcp_read_sock doesn't handle used > len and leaves the socket in a
bad state (both sk_receive_queue and copied_seq are bad at that point)
resulting in duplicated data and corruption.

Fix by passing min(rd_desc->count, len) to skb_splice_bits.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Acked-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-01-26 22:15:31 -08:00
..
2008-11-25 17:59:27 -08:00
2008-07-16 20:20:11 -07:00
2008-11-03 02:48:48 -08:00
2008-11-25 17:59:27 -08:00
2008-11-25 17:35:18 -08:00
2008-11-03 18:21:05 -08:00
2008-11-25 17:30:50 -08:00
2008-12-16 01:15:11 -08:00
2008-10-07 08:38:24 +11:00
2008-10-07 08:38:24 +11:00
2008-12-29 23:04:08 -08:00
2008-06-11 21:00:38 -07:00
2008-11-03 18:21:05 -08:00
2008-11-02 00:28:10 -07:00
2008-11-12 01:41:09 -08:00
2008-12-09 00:13:04 -08:00