]> git.karo-electronics.de Git - karo-tx-linux.git/commit
tracing: Fix panic when lseek() called on "trace" opened for writing
authorSlava Pestov <slavapestov@google.com>
Wed, 24 Nov 2010 23:13:16 +0000 (15:13 -0800)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 30 Nov 2010 17:18:17 +0000 (12:18 -0500)
commit364829b1263b44aa60383824e4c1289d83d78ca7
treedaaaf4cecd56ff9f3f9a2eadc69d0cc4f361c607
parent60e677373be9c0bf7c9a22937601d5a40e51c042
tracing: Fix panic when lseek() called on "trace" opened for writing

The file_ops struct for the "trace" special file defined llseek as seq_lseek().
However, if the file was opened for writing only, seq_open() was not called,
and the seek would dereference a null pointer, file->private_data.

This patch introduces a new wrapper for seq_lseek() which checks if the file
descriptor is opened for reading first. If not, it does nothing.

Cc: <stable@kernel.org>
Signed-off-by: Slava Pestov <slavapestov@google.com>
LKML-Reference: <1290640396-24179-1-git-send-email-slavapestov@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c