Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755137AbbHYKkB (ORCPT ); Tue, 25 Aug 2015 06:40:01 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:28947 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751032AbbHYKj7 (ORCPT ); Tue, 25 Aug 2015 06:39:59 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-93-55dc45fbf210 From: Lukasz Pawelczyk To: Casey Schaufler , James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Cc: havner@gmail.com, Lukasz Pawelczyk Subject: [PATCH] Smack: fix a NULL dereference in wrong smack_import_entry() usage Date: Tue, 25 Aug 2015 12:39:46 +0200 Message-id: <1440499186-9844-1-git-send-email-l.pawelczyk@samsung.com> X-Mailer: git-send-email 2.4.3 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHJMWRmVeSWpSXmKPExsVy+t/xK7q/Xe+EGmx/Z2xxb9svNov/r3Us +h4HWZyZtJDJ4vKuOWwWH3oesVmcv3CO3YHdY+esu+we13ZHenx8eovFo2/LKkaPo/sXsXl8 3iQXwBbFZZOSmpNZllqkb5fAlXH461rGggfsFdsmrWVrYFzG1sXIySEhYCJx6dtkKFtM4sK9 9UA2F4eQwFJGiZ7GViinkUliwdZ7zCBVbAIGEt8v7GUGSYgIHGeU6Hu2k7GLkYODWcBB4taB YpAaYYEQif8P3rKD2CwCqhKP384Hs3kF3CQ2bL7LBLFNTuLc+i8sExi5FzAyrGIUTS1NLihO Ss811CtOzC0uzUvXS87P3cQICZUvOxgXH7M6xCjAwajEw/th4e1QIdbEsuLK3EOMEhzMSiK8 zzcChXhTEiurUovy44tKc1KLDzFKc7AoifPO3fU+REggPbEkNTs1tSC1CCbLxMEp1cC40lW1 P9lt5TbjmUskfPnV4q4sWFJ9/NGjeZYpCkaJCzZulN80N/zyIedrf34y1k/v7D78uXZVet3f NfFayw8tL/1Qvd4154PKhytShscyF5h8e7km0/nEHJtVT1qsHp099mO+a9iqjKh+zYkcNjrT S7kKWndu53y1oVT0wf63BRO9TGSNK4WvK7EUZyQaajEXFScCABj3MeERAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1203 Lines: 39 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/