jffs2: add additinal sanity check for jffs2_acl_from_medium()
PATCH 1/1 jffs2: add additinal sanity check for jffs2_acl_from_medium()
In the case ACL_USER and ACL_GROUP we check if value has exceeded end, add same check in the case ACL_OTHER as well.
--- fs/jffs2/acl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/jffs2/acl.c +2 -0
@@ -94,6 +94,8 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)case ACL_MASK :case ACL_OTHER : value +=sizeof (struct jffs2_acl_entry_short ); +if (value > end) + goto fail;break ;case ACL_USER :
Signature · 1 line
2.17.1
Quoted 3 lines · Chengguang Xu
In the case
ACL_USERandACL_GROUPwe check if value has exceeded end, add same check in the caseACL_OTHERas well.
Did you hit a problem in that area or was this found by review?
Quoted 1 line
From looking at the code I'd say it is fine as is.
In the ACL_MASK/_OTHER case we don't look into the entry object like ACL_USER/_GROUP
do, we immediately break the switch and run another round in the for loop. And here we do:
entry = value;
if (value + sizeof(struct jffs2_acl_entry_short) > end)
goto fail;Which is what your additional check does. So, we'd check twice. What do I miss?
Quoted 25 lines
Signed-off-by Chengguang Xu <[email protected]>--- fs/jffs2/acl.c | 2 ++ 1 file changed, 2 insertions(+)fs/jffs2/acl.c +2
-1@@ -94,6 +94,8 @@ static struct posix_acl *jffs2_acl_from_medium(void *value, size_t size)case ACL_MASK :case ACL_OTHER : value +=sizeof (struct jffs2_acl_entry_short ); +if (value > end) + goto fail;break ;case ACL_USER : --2.17.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Signature · 2 lines
Thanks, //richard
Quoted 9 lines · Richard Weinberger
Quoted 2 lines · Chengguang Xu
In the case
ACL_USERandACL_GROUPwe check if value has exceeded end, add same check in the caseACL_OTHERas well.Did you hit a problem in that area or was this found by review?
From looking at the code I'd say it is fine as is.
In the ACL_MASK/_OTHER case we don't look into the entry object like ACL_USER/_GROUP
do, we immediately break the switch and run another round in the for loop. And here we do:
Quoted 6 lines
entry = value; if (value + sizeof(struct jffs2_acl_entry_short) > end) goto fail;Which is what your additional check does. So, we'd check twice. What do I miss?
You are right, it is actually not needed. Sorry, please just drop the patch.
Richard Weinberger
maintainerAm Montag, 3. September 2018, 15:28:31 CEST schrieb cgxu519:
Quoted 14 lines · Richard Weinberger
Quoted 13 lines · Chengguang Xu
Quoted 2 lines
In the case
ACL_USERandACL_GROUPwe check if value has exceeded end, add same check in the caseACL_OTHERas well.Did you hit a problem in that area or was this found by review?
From looking at the code I'd say it is fine as is.
In the ACL_MASK/_OTHER case we don't look into the entry object like ACL_USER/_GROUP
do, we immediately break the switch and run another round in the for loop. And here we do:entry = value; if (value + sizeof(struct jffs2_acl_entry_short) > end) goto fail;
Quoted 4 lines
Quoted 2 lines
Which is what your additional check does. So, we'd check twice. What do I miss?
You are right, it is actually not needed. Sorry, please just drop the patch.
No problem, that's why we have a review process. :-)
Thanks,
//richard