From: Dave Chinner <david@fromorbit.com>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] Fix possible memory corruption in xfs_readlink
Date: Tue, 18 Oct 2011 09:43:09 +1100 [thread overview]
Message-ID: <20111017224309.GT3159@dastard> (raw)
In-Reply-To: <1318885528-7650-1-git-send-email-cmaiolino@redhat.com>
On Mon, Oct 17, 2011 at 07:05:28PM -0200, Carlos Maiolino wrote:
> Fixes a possible memory corruption when the link is larger than
> MAXPATHLEN and XFS_DEBUG is not enabled. This also remove the
> S_ISLNK assert, since the inode mode is checked previously in
> xfs_readlink_by_handle() and via VFS.
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Looks good. One minor thing for consistency, but consider it:
Reviewed-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_vnodeops.c | 11 ++++++++---
> 1 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
> index 51fc429..9ca6676 100644
> --- a/fs/xfs/xfs_vnodeops.c
> +++ b/fs/xfs/xfs_vnodeops.c
> @@ -123,13 +123,18 @@ xfs_readlink(
>
> xfs_ilock(ip, XFS_ILOCK_SHARED);
>
> - ASSERT(S_ISLNK(ip->i_d.di_mode));
> - ASSERT(ip->i_d.di_size <= MAXPATHLEN);
> -
> pathlen = ip->i_d.di_size;
> if (!pathlen)
> goto out;
>
> + if (pathlen > MAXPATHLEN) {
> + xfs_emerg(mp, "%s: inode (%lld) symlink length (%d) too long",
> + __func__, (unsigned long long)ip->i_ino, pathlen);
xfs_alert() is generally used for such messages - it's not a fatal
error (yet)....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-10-17 22:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-17 21:05 [PATCH] Fix possible memory corruption in xfs_readlink Carlos Maiolino
2011-10-17 22:39 ` Alex Elder
2011-10-17 22:43 ` Dave Chinner [this message]
2011-10-18 1:28 ` Carlos Maiolino
-- strict thread matches above, loose matches on Subject: below --
2011-11-01 14:14 Ben Hutchings
2011-11-02 17:52 ` Alex Elder
2011-11-02 19:45 ` Christoph Hellwig
2011-11-02 20:22 ` Alex Elder
2011-10-18 4:18 Carlos Maiolino
2011-10-18 6:52 ` Christoph Hellwig
2011-10-18 13:59 ` Alex Elder
2011-10-18 14:25 ` Eric Sandeen
2011-10-17 15:30 Carlos Maiolino
2011-10-17 14:00 ` Christoph Hellwig
2011-10-17 17:24 ` Eric Sandeen
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=20111017224309.GT3159@dastard \
--to=david@fromorbit.com \
--cc=cmaiolino@redhat.com \
--cc=xfs@oss.sgi.com \
/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