From: Yann Droneaud <ydroneaud@opteya.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Yann Droneaud <ydroneaud@opteya.com>
Subject: [PATCH 0/3] seq_file allocation in seq_open()
Date: Tue, 5 May 2015 00:19:12 +0200 [thread overview]
Message-ID: <cover.1430777196.git.ydroneaud@opteya.com> (raw)
Hi,
I found myself trying to use seq_open() and experiencing
crash as seq_open() was using my private data in
file->private_data as its own struct seq_file.
It should be noted such behavior is not documented.
It's also an issue if seq_release() is used in release
handler, as it will kfree() a pointer which was not
allocated by seq_open().
So, please find a patchset that drop the support for
pre-allocated struct seq_file in seq_open(): it's
only of use in proc_namespace.c and can be easily
replaced by using seq_open_private()/seq_release_private().
Additionally, it documents the use of file->private_data
to hold pointer to struct seq_file.
Yann Droneaud (3):
fs: use seq_open_private() for proc_mounts
fs: allocate structure unconditionally in seq_open()
fs: documents seq_open()'s usage of file->private_data
fs/mount.h | 3 ---
fs/namespace.c | 6 +++---
fs/proc_namespace.c | 34 ++++++++++++++++------------------
fs/seq_file.c | 18 +++++++++++-------
4 files changed, 30 insertions(+), 31 deletions(-)
--
2.1.0
next reply other threads:[~2015-05-04 22:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 22:19 Yann Droneaud [this message]
2015-05-04 22:19 ` [PATCH 1/3] fs: use seq_open_private() for proc_mounts Yann Droneaud
2015-05-04 22:19 ` [PATCH 2/3] fs: allocate structure unconditionally in seq_open() Yann Droneaud
2015-05-04 22:19 ` [PATCH 3/3] fs: documents seq_open()'s usage of file->private_data Yann Droneaud
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1430777196.git.ydroneaud@opteya.com \
--to=ydroneaud@opteya.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).