Liuwenyi
2009-Dec-21 11:52 UTC
[Ocfs2-devel] [PATCHv2 01/12]posix_acl: Add the check items
Add the acl validation check-items to fix the null pointer error and PTR_ERR error. Thanks for Matthew Wilcox's sguuestion. --- Signed-off-by: Liuwenyi <qingshenlwy at gmail.com> Cc: Chris Mason <chris.mason at oracle.com> Cc: Al Viro <viro at zeniv.linux.org.uk> Cc: Joel Becker <joel.becker at oracle.com> Cc: Chris Ball <cjb at laptop.org> Cc: James Morris <jmorris at namei.org> Cc: Serge Hallyn <serue at us.ibm.com> Cc: Christoph Hellwig <hch at lst.de> Cc: Andrew Morton <akpm at linux-foundation.org> Cc: Andreas Dilger <adilger at sun.com> Cc: Jan Kara <jack at suse.cz> Cc: "Theodore Ts'o" <tytso at mit.edu> Cc: David Woodhouse <dwmw2 at infradead.org> Cc: Steven Whitehouse <swhiteho at redhat.com> Cc: J. Bruce Fields <bfields at fieldses.org> Cc: Neil Brown <neilb at suse.de> Cc: Frank Filz <ffilzlnx at us.ibm.com> Cc: Boaz Harrosh <bharrosh at panasas.com> Cc: Mark Fasheh <mfasheh at suse.com> Cc: Tiger Yang <tiger.yang at oracle.com> Cc: Jeff Mahoney <jeffm at suse.com> Cc: Alex Elder <aelder at sgi.com> Cc: Eric Sandeen <sandeen at sandeen.net> Cc: xfs-masters at oss.sgi.com Cc: xfs at oss.sgi.com Cc: reiserfs-devel at vger.kernel.org Cc: ocfs2-devel at oss.oracle.com Cc: linux-nfs at vger.kernel.org Cc: linux-ext4 at vger.kernel.org Cc: linux-btrfs at vger.kernel.org Cc: linux-fsdevel at vger.kernel.org Cc: linux-kernel at vger.kernel.org Cc: cluster-devel at redhat.com Cc: linux-mtd at lists.infradead.org -- diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 39df95a..d4bacb9 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -76,6 +76,12 @@ posix_acl_valid(const struct posix_acl *acl) unsigned int id = 0; /* keep gcc happy */ int needs_mask = 0; + if (!acl) + return -EINVAL; + + if (IS_ERR(acl)) + return PTR_ERR(acl); + FOREACH_ACL_ENTRY(pa, acl, pe) { if (pa->e_perm & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE)) return -EINVAL; -- Best Regards, Liuwenyi