linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: "Darrick J. Wong" <djwong@us.ibm.com>
Cc: Tao Ma <tm@tao.ma>,
	linux-ext4@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/5] ext4: Prevent stack overrun in ext4_file_open when recording last known mountpoint
Date: Tue, 25 Oct 2011 09:22:56 -0400	[thread overview]
Message-ID: <20111025132256.GK31921@thunk.org> (raw)
In-Reply-To: <20111021211818.10784.77127.stgit@elm3c44.beaverton.ibm.com>

On Fri, Oct 21, 2011 at 02:18:18PM -0700, Darrick J. Wong wrote:
> In ext4_file_open, the filesystem records the mountpoint of the first file that
> is opened after mounting the filesystem.  It does this by allocating a 64-byte
> stack buffer, calling d_path() to grab the mount point through which this file
> was accessed, and then memcpy()ing 64 bytes into the superblock's
> s_last_mounted field, starting from the return value of d_path(), which is
> stored as "cp".  However, if cp > buf (which it frequently is since path
> components are prepended starting at the end of buf) then we can end up copying
> stack data into the superblock.
> 
> Writing stack variables into the superblock doesn't sound like a great idea, so
> use strlcpy instead.  Andi Kleen suggested using strlcpy instead of strncpy.
> 
> Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>

Thanks, applied.

						- Ted

  reply	other threads:[~2011-10-25 13:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-21 21:17 [PATCH 1/5] ext4: ext4_dx_add_entry should dirty directory metadata with the directory inode Darrick J. Wong
2011-10-21 21:18 ` [PATCH 2/5] ext4: ext4_rename should dirty dir_bh with the correct directory Darrick J. Wong
2011-10-25 13:08   ` Ted Ts'o
2011-10-21 21:18 ` [PATCH 3/5] ext4: ext4_mkdir should dirty dir_block with the parent inode Darrick J. Wong
2011-10-25 13:09   ` Ted Ts'o
2011-10-21 21:18 ` [PATCH 4/5] ext4: Prevent stack overrun in ext4_file_open when recording last known mountpoint Darrick J. Wong
2011-10-25 13:22   ` Ted Ts'o [this message]
2011-10-21 21:18 ` [PATCH 5/5] ext4: Fix endian problem in MMP initialization Darrick J. Wong
2011-10-22 17:25   ` Andreas Dilger
2011-10-25 13:35   ` Ted Ts'o
2011-10-25 13:13 ` [PATCH 1/5] ext4: ext4_dx_add_entry should dirty directory metadata with the directory inode Ted Ts'o

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=20111025132256.GK31921@thunk.org \
    --to=tytso@mit.edu \
    --cc=djwong@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tm@tao.ma \
    /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).