public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xfs: fix kernel memory exposure problems
@ 2017-04-03 17:34 Darrick J. Wong
  2017-04-03 17:36 ` [PATCH] xfs: fix over-copying of getbmap parameters from userspace Darrick J. Wong
  2017-04-03 19:42 ` [PATCH v2] xfs: fix kernel memory exposure problems Darrick J. Wong
  0 siblings, 2 replies; 7+ messages in thread
From: Darrick J. Wong @ 2017-04-03 17:34 UTC (permalink / raw)
  To: xfs; +Cc: Eric Sandeen, Christoph Hellwig

Fix a memory exposure problems in inumbers where we allocate an array of
structures with holes, fail to zero the holes, then blindly copy the
kernel memory contents (junk and all) into userspace.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
v2: split patches
---
 fs/xfs/xfs_itable.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 2a6d9b1..26d67ce 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -583,7 +583,7 @@ xfs_inumbers(
 		return error;
 
 	bcount = MIN(left, (int)(PAGE_SIZE / sizeof(*buffer)));
-	buffer = kmem_alloc(bcount * sizeof(*buffer), KM_SLEEP);
+	buffer = kmem_zalloc(bcount * sizeof(*buffer), KM_SLEEP);
 	do {
 		struct xfs_inobt_rec_incore	r;
 		int				stat;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-04  6:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-03 17:34 [PATCH v2] xfs: fix kernel memory exposure problems Darrick J. Wong
2017-04-03 17:36 ` [PATCH] xfs: fix over-copying of getbmap parameters from userspace Darrick J. Wong
2017-04-03 18:57   ` Christoph Hellwig
2017-04-03 19:20     ` Darrick J. Wong
2017-04-03 19:42 ` [PATCH v2] xfs: fix kernel memory exposure problems Darrick J. Wong
2017-04-03 20:06   ` Eric Sandeen
2017-04-04  6:54     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox