Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp726163imm; Thu, 13 Sep 2018 06:53:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZUjx4Y/C+tCRYB0ugEUuMIpBYPHuaABUX61+kEJmqxvnWu5K/XeVvmKZyix9Y7V+WKlk0o X-Received: by 2002:a63:be4a:: with SMTP id g10-v6mr5655463pgo.378.1536846838994; Thu, 13 Sep 2018 06:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846838; cv=none; d=google.com; s=arc-20160816; b=HL/YrhW5Y2LJzMuKJuu9ivF7fMnPHdmFI7Mc0TWsAcmlrxJ8sQxq1TlzwBWmFjjS84 wU2L5M1dI+utqM6xj1n9tvNOzgA5+cF1dM93MpgXMPks1dMicpyuIpGSqeSJYbuOAyIF hzYA/90bwdUuvOZut/2Vh4iWmhvDHyMkS1svyTc01SCgnHlw7aipYegM/BC8gnVyqnNn uSIo5TvWCx+34yZiuCKp2+/fAmThLvqFygJlIZfn+NXD9tiLsuUH2SvYN05mjrPnzYCS cfCOq0lvqVv+bdx3F2Mp8bYWPZeXNdkN9Q1X5ZW5aRVQib4fNO6qbr9g0cFc+Bl3C/EN pysQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=qpRC4HxDsSDgUqVxvyUfFI6VnaxEewCXBUsJEYzRZTs=; b=Oebj8CwxmePSWJ65NaUfddZWmhgSIQQqt5Epcvi6EqDCZGzf2rTaAangTI/pcTt2Co z1rJMoUDP+UuXrqEEfgky2jnbrciV4f+/jTkbq3mddjoCOL35l+tobC7bhBWZhecu2qC 60dctq6dpEkiPXoPf4ZuCuPBMzk30r9O2YTdNPXg41NDqUqKaOenz6FElWqTCCUmbKXS ZQgRzo1upfT9bcnD4xd4SemWaOr/HFtbXjqMd3AR4BlZ9raQO8M9K1SIOdZG/0lzNTo8 6yyTLvP8NkFfMrQHGufKH/c5gn4BSlHVar4qvhUF6X6fdK/TLdsxr//gJtvCiQKdksLj 9p/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si4306816pgh.359.2018.09.13.06.53.44; Thu, 13 Sep 2018 06:53:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730691AbeIMTDH (ORCPT + 99 others); Thu, 13 Sep 2018 15:03:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33676 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728810AbeIMTDG (ORCPT ); Thu, 13 Sep 2018 15:03:06 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E0F9CCE7; Thu, 13 Sep 2018 13:53:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , John Johansen , Sasha Levin Subject: [PATCH 4.18 052/197] apparmor: fix an error code in __aa_create_ns() Date: Thu, 13 Sep 2018 15:30:01 +0200 Message-Id: <20180913131843.615114388@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 0a6b29230ec336189bab32498df3f06c8a6944d8 ] We should return error pointers in this function. Returning NULL results in a NULL dereference in the caller. Fixes: 73688d1ed0b8 ("apparmor: refactor prepare_ns() and make usable from different views") Signed-off-by: Dan Carpenter Signed-off-by: John Johansen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- security/apparmor/policy_ns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/security/apparmor/policy_ns.c +++ b/security/apparmor/policy_ns.c @@ -255,7 +255,7 @@ static struct aa_ns *__aa_create_ns(stru ns = alloc_ns(parent->base.hname, name); if (!ns) - return NULL; + return ERR_PTR(-ENOMEM); ns->level = parent->level + 1; mutex_lock_nested(&ns->lock, ns->level); error = __aafs_ns_mkdir(ns, ns_subns_dir(parent), name, dir);