Skip to contentSkip to conversation

quota: info leak in quota_getquota()

PATCH In review Dan Carpenter 2 participants 2 messages Nov 1, 2013 – Nov 4, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quota: info leak in quota_getquota()

The if_dqblk struct has a 4 byte hole at the end of the struct so uninitialized stack information is leaked to user space.

fs/quota/quota.c +1 -0
index dea86e8..2b363e2 100644
@@ -117,6 +117,7 @@ static int quota_setinfo(struct super_block *sb, int type, void __user *addr)
 
 static void copy_to_if_dqblk(struct if_dqblk *dst, struct fs_disk_quota *src)
 {
+	memset(dst, 0, sizeof(*dst));
 	dst->dqb_bhardlimit = src->d_blk_hardlimit;
 	dst->dqb_bsoftlimit = src->d_blk_softlimit;
 	dst->dqb_curspace = src->d_bcount;
#1 lore raw
Quoted 4 lines · Dan Carpenter

The if_dqblk struct has a 4 byte hole at the end of the struct so uninitialized stack information is leaked to user space.

Thanks. I've merged the patch into my tree.

Honza

Quoted 13 lines
fs/quota/quota.c +1 -0
index dea86e8..2b363e2 100644
@@ -117,6 +117,7 @@ static int quota_setinfo(struct super_block *sb, int type, void __user *addr)
 
 static void copy_to_if_dqblk(struct if_dqblk *dst, struct fs_disk_quota *src)
 {
+	memset(dst, 0, sizeof(*dst));
 	dst->dqb_bhardlimit = src->d_blk_hardlimit;
 	dst->dqb_bsoftlimit = src->d_blk_softlimit;
 	dst->dqb_curspace = src->d_bcount;
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR