* [PATCH 1/3]posix acl:Add an acl check
@ 2009-12-17 14:15 Liuweni
2009-12-17 14:19 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: Liuweni @ 2009-12-17 14:15 UTC (permalink / raw)
To: linux-fsdevel, linux-kernel, viro
Cc: Xiao Guangrong, strongzgy, Liu Hui, qingshenlwy
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 <qingshenlwy@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/3]posix acl:Add an acl check
2009-12-17 14:15 [PATCH 1/3]posix acl:Add an acl check Liuweni
@ 2009-12-17 14:19 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2009-12-17 14:19 UTC (permalink / raw)
To: Liuweni
Cc: linux-fsdevel, linux-kernel, viro, Xiao Guangrong, strongzgy,
Liu Hui
On Thu, Dec 17, 2009 at 10:15:43PM +0800, Liuweni wrote:
> 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.
All the callers of posix_acl_valid() currently check for acl being a
null pointer themselves. Moving the check to posix_acl_valid() certainly
seems like a good idea to me, but you need to delete the check from all
the callers.
Further, it seems like many of the callers might have a PTR_ERR value
for 'acl', so you should also move this check into posix_acl_valid().
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-17 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-17 14:15 [PATCH 1/3]posix acl:Add an acl check Liuweni
2009-12-17 14:19 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).