summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-02-23 14:44:02 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-23 14:44:02 -0800
commit13d1ea9a20ed7d77f98c1622dcf9f3881649f6d7 (patch)
tree5f051aa8477aae53ca30536720f91bc55a55019c
parentf19e0eec8b82faae4c2a5d129dfa9fe1cf66f5a9 (diff)
parentbe715140b5c3baf8ab6708060cfab80bef279d18 (diff)
downloadlwn-13d1ea9a20ed7d77f98c1622dcf9f3881649f6d7.tar.gz
lwn-13d1ea9a20ed7d77f98c1622dcf9f3881649f6d7.zip
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
* 'for-linus' of git://oss.sgi.com/xfs/xfs: xfs: check if device support discard in xfs_ioc_trim() xfs: prevent leaking uninitialized stack memory in FSGEOMETRY_V1
-rw-r--r--fs/xfs/linux-2.6/xfs_discard.c2
-rw-r--r--fs/xfs/xfs_fsops.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_discard.c b/fs/xfs/linux-2.6/xfs_discard.c
index 05201ae719e5..d61611c88012 100644
--- a/fs/xfs/linux-2.6/xfs_discard.c
+++ b/fs/xfs/linux-2.6/xfs_discard.c
@@ -152,6 +152,8 @@ xfs_ioc_trim(
if (!capable(CAP_SYS_ADMIN))
return -XFS_ERROR(EPERM);
+ if (!blk_queue_discard(q))
+ return -XFS_ERROR(EOPNOTSUPP);
if (copy_from_user(&range, urange, sizeof(range)))
return -XFS_ERROR(EFAULT);
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index cec89dd5d7d2..85668efb3e3e 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -53,6 +53,9 @@ xfs_fs_geometry(
xfs_fsop_geom_t *geo,
int new_version)
{
+
+ memset(geo, 0, sizeof(*geo));
+
geo->blocksize = mp->m_sb.sb_blocksize;
geo->rtextsize = mp->m_sb.sb_rextsize;
geo->agblocks = mp->m_sb.sb_agblocks;