All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Munderloh <munderl@tnt.uni-hannover.de>
To: linux-fsdevel@vger.kernel.org
Subject: [PATCH V2] catch acl==NULL in __jfs_set_acl (fixed null pointer dereference)
Date: Tue, 29 Apr 2014 19:59:51 +0200	[thread overview]
Message-ID: <535FE897.9040607@tnt.uni-hannover.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

changes V2: I forgot to set rc = 0, leaving it uninitialized if acl was NULL.

--- linux-3.14.2.vanilla/fs/jfs/acl.c	2014-04-28 17:24:55.544597204 +0200
+++ linux-3.14.2/fs/jfs/acl.c	2014-04-29 19:57:27.028465728 +0200
@@ -83,13 +83,16 @@
 	switch (type) {
 	case ACL_TYPE_ACCESS:
 		ea_name = POSIX_ACL_XATTR_ACCESS;
-		rc = posix_acl_equiv_mode(acl, &inode->i_mode);
-		if (rc < 0)
-			return rc;
-		inode->i_ctime = CURRENT_TIME;
-		mark_inode_dirty(inode);
-		if (rc == 0)
-			acl = NULL;
+		if( acl ) {
+			rc = posix_acl_equiv_mode(acl, &inode->i_mode);
+			if (rc < 0)
+				return rc;
+			inode->i_ctime = CURRENT_TIME;
+			mark_inode_dirty(inode);
+			if (rc == 0)
+				acl = NULL;
+		}
+		rc = 0;
 		break;
 	case ACL_TYPE_DEFAULT:
 		ea_name = POSIX_ACL_XATTR_DEFAULT;


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4700 bytes --]

             reply	other threads:[~2014-04-29 17:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 17:59 Marco Munderloh [this message]
2014-04-29 18:26 ` [PATCH V2] catch acl==NULL in __jfs_set_acl (fixed null pointer dereference) Matthew Wilcox
2014-04-29 18:28   ` Christoph Hellwig
2014-04-29 18:33     ` Marco Munderloh
2014-04-29 18:30   ` Marco Munderloh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=535FE897.9040607@tnt.uni-hannover.de \
    --to=munderl@tnt.uni-hannover.de \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.