From mboxrd@z Thu Jan 1 00:00:00 1970 From: liu weni Subject: Re: [PATCHv3 1/3]posix_acl: add the pointer check into fs/posix_acl.c Date: Tue, 29 Dec 2009 07:29:05 +0800 Message-ID: References: <20091228153236.GB10490@hack> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel , linux-fsdevel , viro To: =?ISO-8859-1?Q?Am=E9rico_Wang?= Return-path: In-Reply-To: <20091228153236.GB10490@hack> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Sorry. I forgot diff it again. 2009/12/28 Am=E9rico Wang : > On Mon, Dec 28, 2009 at 11:00:58PM +0800, liu weni wrote: >>If the acl pointer is NULL or have some error, the acl is invalid. >>The Macro of FOREACH_ACL_ENTRY will make some error. >> >>--- >>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..45f8afa 100644 >>--- a/fs/posix_acl.c >>+++ b/fs/posix_acl.c >>@@ -76,6 +76,12 @@ posix_acl_valid(const struct posix_acl *acl) >> =A0 =A0 =A0 unsigned int id =3D 0; =A0/* keep gcc happy */ >> =A0 =A0 =A0 int needs_mask =3D 0; >> >>+ =A0 =A0 =A0if (!acl) >>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0return -EINVAL; >>+ >>+ =A0 =A0 =A0if (IS_ERR) > > Did you even do a compile test? > I don't think this line will work... > > >>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0return PTR_ERR(acl); >>+ >> =A0 =A0 =A0 FOREACH_ACL_ENTRY(pa, acl, pe) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (pa->e_perm & ~(ACL_READ|ACL_WRITE|AC= L_EXECUTE)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -EINVAL; >>-- >>To unsubscribe from this list: send the line "unsubscribe linux-kerne= l" in >>the body of a message to majordomo@vger.kernel.org >>More majordomo info at =A0http://vger.kernel.org/majordomo-info.html >>Please read the FAQ at =A0http://www.tux.org/lkml/ > > -- > Live like a child, think like the god. > >