]> 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)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 17 Apr 2011 20:16:10 +0000 (16:16 -0400)
commitae621e2431fa476dcbe1daf1d9d278085b0e95e3
tree9bfe38f6d4f0cbc4ff75e9986d6f3f061034b32c
parent3b1c91ceeaa02ca5fac9312eed959253297a01b7
tracing: Fix panic when lseek() called on "trace" opened for writing

commit 364829b1263b44aa60383824e4c1289d83d78ca7 upstream.

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.

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>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
kernel/trace/trace.c