* [PATCHv4 0/3]posix_acl: Add the acl pointer check
@ 2009-12-28 23:34 liu weni
2009-12-28 23:35 ` [PATCHv4 1/3]posix_acl: " liu weni
0 siblings, 1 reply; 4+ messages in thread
From: liu weni @ 2009-12-28 23:34 UTC (permalink / raw)
To: viro, linux-kernel, linux-fsdevel
Sorry for previous version. I changed the source but forgot patch it again.
And then, I upload this version.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCHv4 1/3]posix_acl: Add the acl pointer check
2009-12-28 23:34 [PATCHv4 0/3]posix_acl: Add the acl pointer check liu weni
@ 2009-12-28 23:35 ` liu weni
2009-12-28 23:36 ` [PATCHv4 2/3]posix_acl: " liu weni
0 siblings, 1 reply; 4+ messages in thread
From: liu weni @ 2009-12-28 23:35 UTC (permalink / raw)
To: viro, linux-kernel, linux-fsdevel
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 <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..d4bacb9 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -76,6 +76,12 @@ posix_acl_valid(const struct posix_acl *acl)
unsigned int id = 0; /* keep gcc happy */
int needs_mask = 0;
+ if (!acl)
+ return -EINVAL;
+
+ if (IS_ERR(acl))
+ return PTR_ERR(acl);
+
FOREACH_ACL_ENTRY(pa, acl, pe) {
if (pa->e_perm & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
return -EINVAL;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv4 2/3]posix_acl: Add the acl pointer check
2009-12-28 23:35 ` [PATCHv4 1/3]posix_acl: " liu weni
@ 2009-12-28 23:36 ` liu weni
2009-12-28 23:37 ` [PATCHv4 3/3]posix_acl: " liu weni
0 siblings, 1 reply; 4+ messages in thread
From: liu weni @ 2009-12-28 23:36 UTC (permalink / raw)
To: viro, linux-kernel, linux-fsdevel
Add two acl pointer checks before this function.
---
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..0d2a7a2 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -150,6 +150,12 @@ posix_acl_equiv_mode(const struct posix_acl *acl,
mode_t *mode_p)
mode_t mode = 0;
int not_equiv = 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:
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv4 3/3]posix_acl: Add the acl pointer check
2009-12-28 23:36 ` [PATCHv4 2/3]posix_acl: " liu weni
@ 2009-12-28 23:37 ` liu weni
0 siblings, 0 replies; 4+ messages in thread
From: liu weni @ 2009-12-28 23:37 UTC (permalink / raw)
To: viro, linux-kernel, linux-fsdevel
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 <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..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:
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-28 23:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-28 23:34 [PATCHv4 0/3]posix_acl: Add the acl pointer check liu weni
2009-12-28 23:35 ` [PATCHv4 1/3]posix_acl: " liu weni
2009-12-28 23:36 ` [PATCHv4 2/3]posix_acl: " liu weni
2009-12-28 23:37 ` [PATCHv4 3/3]posix_acl: " liu weni
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).