From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Liuweni" Subject: [PATCH 1/3]posix acl:Add an acl check Date: Thu, 17 Dec 2009 22:15:43 +0800 Message-ID: <200912172215402654375@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: "Xiao Guangrong" , "strongzgy" , "Liu Hui" , "qingshenlwy" To: "linux-fsdevel" , "linux-kernel" , "viro" Return-path: Received: from mail-px0-f174.google.com ([209.85.216.174]:65259 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754133AbZLQOMJ (ORCPT ); Thu, 17 Dec 2009 09:12:09 -0500 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: In this function, the parameter of acl will be called by FOREACH_ACL_ENTRY(macro) without null point check. I add a null point check to it. --- 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..956df14 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -76,6 +76,9 @@ posix_acl_valid(const struct posix_acl *acl) unsigned int id = 0; /* keep gcc happy */ int needs_mask = 0; + if (!acl) + return -EINVAL; + FOREACH_ACL_ENTRY(pa, acl, pe) { if (pa->e_perm & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE)) return -EINVAL; -------------- Best Regards, Liuweni 2009-12-17