Skip to contentSkip to conversation

jfs: Fix early release of acl in jfs_get_acl

PATCH In review Stefan Bader 2 participants 2 messages Jul 23, 2009 JFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jfs: Fix early release of acl in jfs_get_acl

Commit 073aaa1b142461d91f83da66db1184d7c1b1edea "helpers for acl caching + switch to those" introduced new helper functions for acl handling but seems to have introduced a regression for jfs as the acl is released before returning it to the caller, instead of leaving this for the caller to do.
This causes the acl object to be used after freeing it, leading to kernel panics in completely different places.

Thanks to Christophe Dumez for reporting and bisecting into this.

---
 fs/jfs/acl.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
Quoted 1 line

From a345a80ca7a926c9c6e322a1e8add4817c834d0f Mon Sep 17 00:00:00 2001

From: Stefan Bader <[email protected]>
Date: Thu, 23 Jul 2009 11:26:05 +0200
Subject: [PATCH] jfs: Fix early release of acl in jfs_get_acl

Commit 073aaa1b142461d91f83da66db1184d7c1b1edea "helpers for acl caching + switch to those" introduced new helper functions for acl handling but seems to have introduced a regression for jfs as the acl is released before returning it to the caller, instead of leaving this for the caller to do.
This causes the acl object to be used after freeing it, leading to kernel panics in completely different places.

Thanks to Christophe Dumez for reporting and bisecting into this.

---
 fs/jfs/acl.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
fs/jfs/acl.c +1 -3
index f272bf0..3c88d1b 100644
@@ -67,10 +67,8 @@ static struct posix_acl *jfs_get_acl(struct inode *inode, int type)
 		acl = posix_acl_from_xattr(value, size);
 	}
 	kfree(value);
-	if (!IS_ERR(acl)) {
+	if (!IS_ERR(acl))
 		set_cached_acl(inode, type, acl);
-		posix_acl_release(acl);
-	}
 	return acl;
 }
 
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 7 lines · Stefan Bader

Commit 073aaa1b142461d91f83da66db1184d7c1b1edea "helpers for acl caching + switch to those" introduced new helper functions for acl handling but seems to have introduced a regression for jfs as the acl is released before returning it to the caller, instead of leaving this for the caller to do.
This causes the acl object to be used after freeing it, leading to kernel panics in completely different places.

This looks good. Thanks much! I'll get it upstream as soon as possible.

Quoted 9 lines

Thanks to Christophe Dumez for reporting and bisecting into this.

---
  fs/jfs/acl.c |    4 +---
  1 files changed, 1 insertions(+), 3 deletions(-)

Thanks,
Shaggy

Signature · 2 lines
David Kleikamp
IBM Linux Technology Center