]> git.baikalelectronics.ru Git - kernel.git/commit
ring-buffer: Do no reuse reader page if still in use
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Sat, 23 Dec 2017 02:19:29 +0000 (21:19 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 27 Dec 2017 19:21:09 +0000 (14:21 -0500)
commita11721ce852e6081809d5350811cac3cdeb86b62
tree6b9ee0b8ea7064dadf79fa505afda046c0627f45
parent2e6670fbf22e5171278eacd9dd1960c5138ee6ac
ring-buffer: Do no reuse reader page if still in use

To free the reader page that is allocated with ring_buffer_alloc_read_page(),
ring_buffer_free_read_page() must be called. For faster performance, this
page can be reused by the ring buffer to avoid having to free and allocate
new pages.

The issue arises when the page is used with a splice pipe into the
networking code. The networking code may up the page counter for the page,
and keep it active while sending it is queued to go to the network. The
incrementing of the page ref does not prevent it from being reused in the
ring buffer, and this can cause the page that is being sent out to the
network to be modified before it is sent by reading new data.

Add a check to the page ref counter, and only reuse the page if it is not
being used anywhere else.

Cc: stable@vger.kernel.org
Fixes: c2fc732c20b9a ("ring-buffer: Return reader page back into existing ring buffer")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c