From mboxrd@z Thu Jan 1 00:00:00 1970 From: liu weni Subject: [PATCHv3 3/3]posix_acl: add the pointer check into fs/posix_acl.c Date: Mon, 28 Dec 2009 23:02:02 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 To: linux-kernel , linux-fsdevel , viro Return-path: Received: from mail-iw0-f171.google.com ([209.85.223.171]:48768 "EHLO mail-iw0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbZL1PCD (ORCPT ); Mon, 28 Dec 2009 10:02:03 -0500 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: While the acl pointer is IS_ERR, We cannot get the correct return. And the acl pointer is NULL. Oh, my god! The FOREACH_ACL_ENTRY will call that. --- Signed-off-by: Liuwenyi Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 39df95a..4e0261b 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -213,6 +213,12 @@ posix_acl_permission(struct inode *inode, const struct posix_acl *acl, int want) const struct posix_acl_entry *pa, *pe, *mask_obj; int found = 0; + if (!acl) + return -EINVAL; + + if (IS_ERR(acl)) + return PTR_ERR(acl); + FOREACH_ACL_ENTRY(pa, acl, pe) { switch(pa->e_tag) { case ACL_USER_OBJ: