Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp699807pxb; Mon, 25 Oct 2021 16:57:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpw7Cl95Mjm3Dd1blg9oyOvwOnh85CE68EhN5ERD8aDhHuGEFSq7pXpdZSYfLuR7F6ZLEj X-Received: by 2002:a50:e041:: with SMTP id g1mr30511757edl.4.1635206219776; Mon, 25 Oct 2021 16:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635206219; cv=none; d=google.com; s=arc-20160816; b=zjglFaD7GyhtKIx8k0ABkvUe0zrTORwgbGFoHWR2Z8w+IkJ/n8PD9TGP2n0O2IvRhH TNwDhHVvfM3lFhzlwneQ3fVsX1WUmpN+Uy+zt/TxIU1kw7TUF+KUWlBlcOtpDNLD0jcj nAh+zgO6kIRT8Oxwf4RGLAvQW1vAx9G+p4GXhwnwa+3i1/EiGjhzEIHu2xTmP5W9CRab tj+qU8pQ6y4R03lAyZrDhA3fvg5iLZV29Ve7Ly/6+yX/ILVB+zXYjqYm5wgM8IhEIYIS 415dRExdQrDLkm28KKKT16HlPs6cqo6gVMYzBNv2IKndtNTYUtyQwkCcAZB2sAFrcDGk vTiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BuIDneoceQaSy59MyjhzITEC4+qL1Q6a+vOyb4ml4HY=; b=Qaz3Dpd+VoWMvzPpQKDd7SRWH4pBDLx3zD9FbWb2I01639sjxVxGsOK6uLCFDhPZGD tjpG0dPicofRtfmJTpB33f4mDIOnTFsD5ARR4wUmgdVy13gXUlbNwQ83e3Wh7Lg/w4uq ZQt/0yhQDeUd5L0oE35mIZ3cbEvXisjbaBGdSTrdC1RY1iRlno/DNzXu9EnhjubZh6bL moWYqqHJIz1xQpJWSsAYGzQhvZ4bhLzOA0rjFQ/av+QkT1bFg7D60RDJmgGqj9Qat6jJ TtfbV7Nu8l+Mon8uYDuR/hSo+BO6vImlhmXpwPGQGVV8IHGgXN3EWvLom0yw5cTzvVec HKpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f6nyCGMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si13148656edt.406.2021.10.25.16.56.37; Mon, 25 Oct 2021 16:56:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f6nyCGMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236915AbhJYTiT (ORCPT + 99 others); Mon, 25 Oct 2021 15:38:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:48326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235465AbhJYTcD (ORCPT ); Mon, 25 Oct 2021 15:32:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2A6361156; Mon, 25 Oct 2021 19:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635190103; bh=oKOedprlXAMmIjBW+LoonKVEX3UwgkZf3o4aPgFK0FU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f6nyCGMjkhpH5sI4YDxtrPH7/5K2qYpYg9mEmquW9Ea/+oNQP3QqcC9Wb3QyGe+QS 4n9doIOQaEadgCgY8VQZi5L8/GV20fP04FtZ120QHD3lCuO8BUuZLPsrIRg/L6WiDH VDu+keTvaueBOnTfioEMKMJ/fMu5KlY/UQGWT5NY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Gaosheng Cui , Paul Moore Subject: [PATCH 5.4 34/58] audit: fix possible null-pointer dereference in audit_filter_rules Date: Mon, 25 Oct 2021 21:14:51 +0200 Message-Id: <20211025190943.166985103@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190937.555108060@linuxfoundation.org> References: <20211025190937.555108060@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gaosheng Cui commit 6e3ee990c90494561921c756481d0e2125d8b895 upstream. Fix possible null-pointer dereference in audit_filter_rules. audit_filter_rules() error: we previously assumed 'ctx' could be null Cc: stable@vger.kernel.org Fixes: bf361231c295 ("audit: add saddr_fam filter field") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Gaosheng Cui Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -624,7 +624,7 @@ static int audit_filter_rules(struct tas result = audit_comparator(audit_loginuid_set(tsk), f->op, f->val); break; case AUDIT_SADDR_FAM: - if (ctx->sockaddr) + if (ctx && ctx->sockaddr) result = audit_comparator(ctx->sockaddr->ss_family, f->op, f->val); break;