Jiri Kosina 59ea33a68a tcp: perform DMA to userspace only if there is a task waiting for it
Back in 2006, commit 1a2449a87b ("[I/OAT]: TCP recv offload to I/OAT")
added support for receive offloading to IOAT dma engine if available.

The code in tcp_rcv_established() tries to perform early DMA copy if
applicable. It however does so without checking whether the userspace
task is actually expecting the data in the buffer.

This is not a problem under normal circumstances, but there is a corner
case where this doesn't work -- and that's when MSG_TRUNC flag to
recvmsg() is used.

If the IOAT dma engine is not used, the code properly checks whether
there is a valid ucopy.task and the socket is owned by userspace, but
misses the check in the dmaengine case.

This problem can be observed in real trivially -- for example 'tbench' is a
good reproducer, as it makes a heavy use of MSG_TRUNC. On systems utilizing
IOAT, you will soon find tbench waiting indefinitely in sk_wait_data(), as they
have been already early-copied in tcp_rcv_established() using dma engine.

This patch introduces the same check we are performing in the simple
iovec copy case to the IOAT case as well. It fixes the indefinite
recvmsg(MSG_TRUNC) hangs.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-27 13:45:51 -07:00
..
2012-04-15 12:37:19 -04:00
2012-07-16 22:31:34 -07:00
2012-04-15 12:37:19 -04:00
2011-10-19 03:10:46 -04:00
2012-07-26 15:50:39 -07:00
2012-07-22 17:04:15 -07:00
2012-07-20 13:38:34 -07:00
2012-07-19 10:55:36 -07:00
2012-07-19 10:55:36 -07:00
2012-07-19 10:55:36 -07:00
2012-01-20 14:17:26 -05:00
2012-07-20 10:59:41 -07:00
2012-01-20 14:17:26 -05:00
2012-07-19 10:55:36 -07:00
2012-05-17 14:59:59 -04:00
2012-07-27 13:45:51 -07:00
2012-07-27 13:45:51 -07:00
2012-03-11 23:42:51 -07:00
2012-07-16 22:31:34 -07:00
2012-04-15 12:37:19 -04:00