public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix acl count validation in xfs_acl_from_disk()
@ 2011-12-12 21:55 Xi Wang
  2011-12-12 22:42 ` Christoph Hellwig
  2011-12-16 21:19 ` Ben Myers
  0 siblings, 2 replies; 3+ messages in thread
From: Xi Wang @ 2011-12-12 21:55 UTC (permalink / raw)
  To: Christoph Hellwig, Ben Myers; +Cc: xfs, linux-kernel, Xi Wang

Commit fa8b18ed didn't prevent the integer overflow and possible
memory corruption.  "count" can go negative and bypass the check.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
 fs/xfs/xfs_acl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 76e4266..ac702a6 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -39,7 +39,7 @@ xfs_acl_from_disk(struct xfs_acl *aclp)
 	struct posix_acl_entry *acl_e;
 	struct posix_acl *acl;
 	struct xfs_acl_entry *ace;
-	int count, i;
+	unsigned int count, i;
 
 	count = be32_to_cpu(aclp->acl_cnt);
 	if (count > XFS_ACL_MAX_ENTRIES)
-- 
1.7.5.4


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

* Re: [PATCH] xfs: fix acl count validation in xfs_acl_from_disk()
  2011-12-12 21:55 [PATCH] xfs: fix acl count validation in xfs_acl_from_disk() Xi Wang
@ 2011-12-12 22:42 ` Christoph Hellwig
  2011-12-16 21:19 ` Ben Myers
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2011-12-12 22:42 UTC (permalink / raw)
  To: Xi Wang; +Cc: Christoph Hellwig, Ben Myers, xfs, linux-kernel

On Mon, Dec 12, 2011 at 04:55:52PM -0500, Xi Wang wrote:
> Commit fa8b18ed didn't prevent the integer overflow and possible
> memory corruption.  "count" can go negative and bypass the check.

Thanks, this looks good to me.

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] xfs: fix acl count validation in xfs_acl_from_disk()
  2011-12-12 21:55 [PATCH] xfs: fix acl count validation in xfs_acl_from_disk() Xi Wang
  2011-12-12 22:42 ` Christoph Hellwig
@ 2011-12-16 21:19 ` Ben Myers
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Myers @ 2011-12-16 21:19 UTC (permalink / raw)
  To: Xi Wang; +Cc: Christoph Hellwig, linux-kernel, xfs

On Mon, Dec 12, 2011 at 04:55:52PM -0500, Xi Wang wrote:
> Commit fa8b18ed didn't prevent the integer overflow and possible
> memory corruption.  "count" can go negative and bypass the check.
> 
> Signed-off-by: Xi Wang <xi.wang@gmail.com>

Looks good.  Nice catch!
Reviewed-by: Ben Myers <bpm@sgi.com>

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

end of thread, other threads:[~2011-12-16 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 21:55 [PATCH] xfs: fix acl count validation in xfs_acl_from_disk() Xi Wang
2011-12-12 22:42 ` Christoph Hellwig
2011-12-16 21:19 ` Ben Myers

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