Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761520AbZLQOMP (ORCPT ); Thu, 17 Dec 2009 09:12:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760156AbZLQOMN (ORCPT ); Thu, 17 Dec 2009 09:12:13 -0500 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 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; b=kK/L1ffL+NoxKA65Wnng5uJXHs2ouGiFc+yxVcOXGa54tfakAakdMdobsL7aKCO9Ci 5tVvA4yJaTKslbaDmzvCdUtD87s1i3cxsuzeiolhy8vwVYWCFDPycXWT8P0mkicANzHH p5cPpHV/v7R7u+5tVr+2iAvDe7Ty0/Ub53FzQ= Date: Thu, 17 Dec 2009 22:15:43 +0800 From: "Liuweni" To: "linux-fsdevel" , "linux-kernel" , "viro" Cc: "Xiao Guangrong" , "strongzgy" , "Liu Hui" , "qingshenlwy" Subject: [PATCH 1/3]posix acl:Add an acl check Message-ID: <200912172215402654375@gmail.com> X-mailer: Foxmail 6, 15, 201, 22 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1004 Lines: 35 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/