[FIX] buffer: kernel crash caused by splice_read
authorNikita Kalyazin <n.kalyazin@samsung.com>
Sun, 7 Jul 2013 08:56:35 +0000 (12:56 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Sun, 7 Jul 2013 09:05:17 +0000 (13:05 +0400)
commit1b5a5f9f4b0842305020d4f6f787b5847a3cb0b3
treec1bb56862007865e7b37c1daf0d0037d1521a433
parent34dc7c59514f4e23c50a95029c0014bca66aba53
[FIX] buffer: kernel crash caused by splice_read

 - splice_grow_spd must be done _before_ spd structure filling;
 - number of pages and partial must be PIPE_DEF_BUFFERS;
 - pages that will be passed to splice_to_pipe must be copied, not
   moved: it is unknown when they will be returned by tcp stack, so we
   must not rely on their reuse;
 - small refactoring.

Known issue:
 - If a subbuffer is greater than max pipe size, we should splice this
   subbuffer partially. So we should not put it to "write list". In
   general a new mechanism for this should be implemented.

Tested with:
 - 2 x 8Kb buffer;
 - 16 x 64Kb buffer.
driver_new/device_driver.c
driver_new/driver_to_buffer.c
driver_new/driver_to_buffer.h