|
|
3f831a8 |
X-Spam-Checker-Version: SpamAssassin 3.4.0-r929098 (2010-03-30) on oss.sgi.com
|
|
|
3f831a8 |
X-Spam-Level:
|
|
|
3f831a8 |
X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,J_CHICKENPOX_64
|
|
|
3f831a8 |
autolearn=no version=3.4.0-r929098
|
|
|
3f831a8 |
Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11])
|
|
|
3f831a8 |
by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p9I1KBVD036341
|
|
|
3f831a8 |
for <xfs@oss.sgi.com>; Mon, 17 Oct 2011 20:20:11 -0500
|
|
|
3f831a8 |
X-ASG-Debug-ID: 1318901280-3911029d0000-NocioJ
|
|
|
3f831a8 |
X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi
|
|
|
3f831a8 |
Received: from hades.usersys.redhat.com (localhost [127.0.0.1])
|
|
|
3f831a8 |
by cuda.sgi.com (Spam Firewall) with ESMTP id B9D1DF75F0A
|
|
|
3f831a8 |
for <xfs@oss.sgi.com>; Mon, 17 Oct 2011 18:28:01 -0700 (PDT)
|
|
|
3f831a8 |
Received: from hades.usersys.redhat.com ([187.60.101.4]) by cuda.sgi.com with ESMTP id 81CuyNdYBqrtvtnD for <xfs@oss.sgi.com>; Mon, 17 Oct 2011 18:28:01 -0700 (PDT)
|
|
|
3f831a8 |
Received: by hades.usersys.redhat.com (Postfix, from userid 500)
|
|
|
3f831a8 |
id 5B763E089B; Tue, 18 Oct 2011 02:18:59 -0200 (BRST)
|
|
|
3f831a8 |
From: Carlos Maiolino <cmaiolino@redhat.com>
|
|
|
3f831a8 |
To: xfs@oss.sgi.com
|
|
|
3f831a8 |
Cc: Carlos Maiolino <cmaiolino@redhat.com>
|
|
|
3f831a8 |
X-ASG-Orig-Subj: [PATCH] Fix possible memory corruption in xfs_readlink
|
|
|
3f831a8 |
Subject: [PATCH] Fix possible memory corruption in xfs_readlink
|
|
|
3f831a8 |
Date: Tue, 18 Oct 2011 02:18:58 -0200
|
|
|
3f831a8 |
Message-Id: <1318911538-9174-1-git-send-email-cmaiolino@redhat.com>
|
|
|
3f831a8 |
X-Mailer: git-send-email 1.7.6.2
|
|
|
3f831a8 |
X-Barracuda-Connect: UNKNOWN[187.60.101.4]
|
|
|
3f831a8 |
X-Barracuda-Start-Time: 1318901282
|
|
|
3f831a8 |
X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210
|
|
|
3f831a8 |
X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com
|
|
|
3f831a8 |
X-Barracuda-Spam-Score: -1.42
|
|
|
3f831a8 |
X-Barracuda-Spam-Status: No, SCORE=-1.42 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests=BSF_SC5_MJ1963, RDNS_NONE
|
|
|
3f831a8 |
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.77645
|
|
|
3f831a8 |
Rule breakdown below
|
|
|
3f831a8 |
pts rule name description
|
|
|
3f831a8 |
---- ---------------------- --------------------------------------------------
|
|
|
3f831a8 |
0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS
|
|
|
3f831a8 |
0.50 BSF_SC5_MJ1963 Custom Rule MJ1963
|
|
|
3f831a8 |
X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com
|
|
|
3f831a8 |
X-Virus-Status: Clean
|
|
|
3f831a8 |
|
|
|
3f831a8 |
Fixes a possible memory corruption when the link is larger than
|
|
|
3f831a8 |
MAXPATHLEN and XFS_DEBUG is not enabled. This also remove the
|
|
|
3f831a8 |
S_ISLNK assert, since the inode mode is checked previously in
|
|
|
3f831a8 |
xfs_readlink_by_handle() and via VFS.
|
|
|
3f831a8 |
|
|
|
3f831a8 |
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
|
|
|
3f831a8 |
---
|
|
|
3f831a8 |
fs/xfs/xfs_vnodeops.c | 11 ++++++++---
|
|
|
3f831a8 |
1 files changed, 8 insertions(+), 3 deletions(-)
|
|
|
3f831a8 |
|
|
|
3f831a8 |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
|
|
|
3f831a8 |
index 51fc429..c3288be 100644
|
|
|
3f831a8 |
--- a/fs/xfs/xfs_vnodeops.c
|
|
|
3f831a8 |
+++ b/fs/xfs/xfs_vnodeops.c
|
|
|
3f831a8 |
@@ -123,13 +123,18 @@ xfs_readlink(
|
|
|
3f831a8 |
|
|
|
3f831a8 |
xfs_ilock(ip, XFS_ILOCK_SHARED);
|
|
|
3f831a8 |
|
|
|
3f831a8 |
- ASSERT(S_ISLNK(ip->i_d.di_mode));
|
|
|
3f831a8 |
- ASSERT(ip->i_d.di_size <= MAXPATHLEN);
|
|
|
3f831a8 |
-
|
|
|
3f831a8 |
pathlen = ip->i_d.di_size;
|
|
|
3f831a8 |
if (!pathlen)
|
|
|
3f831a8 |
goto out;
|
|
|
3f831a8 |
|
|
|
3f831a8 |
+ if (pathlen > MAXPATHLEN) {
|
|
|
3f831a8 |
+ xfs_alert(mp, "%s: inode (%llu) symlink length (%d) too long",
|
|
|
3f831a8 |
+ __func__, (unsigned long long)ip->i_ino, pathlen);
|
|
|
3f831a8 |
+ ASSERT(0);
|
|
|
3f831a8 |
+ return XFS_ERROR(EFSCORRUPTED);
|
|
|
3f831a8 |
+ }
|
|
|
3f831a8 |
+
|
|
|
3f831a8 |
+
|
|
|
3f831a8 |
if (ip->i_df.if_flags & XFS_IFINLINE) {
|
|
|
3f831a8 |
memcpy(link, ip->i_df.if_u1.if_data, pathlen);
|
|
|
3f831a8 |
link[pathlen] = '\0';
|
|
|
3f831a8 |
--
|
|
|
3f831a8 |
1.7.6.2
|
|
|
3f831a8 |
|