mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
To: Casey Schaufler <casey@schaufler-ca.com>,
	James Morris <james.l.morris@oracle.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: havner@gmail.com, Lukasz Pawelczyk <l.pawelczyk@samsung.com>
Subject: [PATCH] Smack: fix a NULL dereference in wrong smack_import_entry() usage
Date: Tue, 25 Aug 2015 12:39:46 +0200	[thread overview]
Message-ID: <1440499186-9844-1-git-send-email-l.pawelczyk@samsung.com> (raw)

The e774ad683f425a51f87711164ea166d9dcc41477 commit made this function
return proper error codes instead of NULL. Reflect that.

This is a fix for a NULL dereference introduced in
21abb1ec414c75abe32c3854848ff30e2b4a6113:

echo "$SOME_IPV6_ADDR \"test" > /smack/ipv6host
  (this should return EINVAL, it doesn't)
cat /smack/ipv6host
  (derefences 0x000a)

Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
---
 security/smack/smackfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index c20b154..103a619 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -1501,8 +1501,8 @@ static ssize_t smk_write_net6addr(struct file *file, const char __user *buf,
 	 */
 	if (smack[0] != '-') {
 		skp = smk_import_entry(smack, 0);
-		if (skp == NULL) {
-			rc = -EINVAL;
+		if (IS_ERR(skp)) {
+			rc = PTR_ERR(skp);
 			goto free_out;
 		}
 	} else {
-- 
2.4.3


             reply	other threads:[~2015-08-25 10:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25 10:39 Lukasz Pawelczyk [this message]
2015-10-09 22:19 ` Casey Schaufler

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=1440499186-9844-1-git-send-email-l.pawelczyk@samsung.com \
    --to=l.pawelczyk@samsung.com \
    --cc=casey@schaufler-ca.com \
    --cc=havner@gmail.com \
    --cc=james.l.morris@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®