Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp664286pxv; Wed, 14 Jul 2021 12:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbV4k7eaU0Urct3TRvTcnsGkCThaxSlwZ6fdGq4DpNsGaHT5+5Q3Tq8hDnTmukA/vQcgxh X-Received: by 2002:a50:9faf:: with SMTP id c44mr15923733edf.197.1626290888901; Wed, 14 Jul 2021 12:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626290888; cv=none; d=google.com; s=arc-20160816; b=X+ohZWseKdT50Lxto8u6u76Il62gwvmQ1Fqc2gHjCg8tdiFVt3Adr4QHar8FbEPeNj cJLJ1R527A5/nuJfvtTxSehtw3KRod2UuTQoulQtMO9hSWjLpLzrdtk0vLZt0DyuYIll ZenP27lvujIf/+zeTfPzKOzdnpIpTurx5HhEpU27dKAJO46/0MWKySbJmHnP8SCiJJ2Q OVZYWS9IixdINpiDO/LfpHLnxzMetLg5/72dLyz7Iz+7tiU8WTktW5YNj2MP82pXzmVq HPDWB6BJnJXMryY0cVpnRUd5qDHMgnq2XxHTHMDVJY67U3TlXkjCNw02xCuauICU5rTK wk0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=t5WdCmdzAAZvn5CRq9XtWBn39mC8lrQD6RcbEsNxMOI=; b=QuSN96btod7WZ1Y/dU4LYlWX8kf2GjkrwRGS6uJmcvqACONj4LMFtWZgVSs6cbIyeh Jn7Go7UsISma+jSz5Tidi9R6li9hno7Ge74GR0M+vtHvUsj0rIST1PTuFTrfIjLVVThY DELrlzh2IY/iRlzPBQsVS9KYQ7gfhci5Y7z9eZIsZojm6EP2PmQmSWIpC4PWqMQbU9yV K+LmIDdQg4BzjaSDOVVXY3CG2BuN0z1h8bmaN49rKQ1IiGOF6ybmjrwmp9pgqf7yPeT7 KI7sNEm3YAqnc4ksh/ghh1qze/M7KrA+9E8eXv+rTs15qJkYywXkKxvLujEaO8u7FiE7 e5Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=Gjva4LKS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id em21si3523062ejc.542.2021.07.14.12.27.44; Wed, 14 Jul 2021 12:28:08 -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=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=Gjva4LKS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229657AbhGNT3m (ORCPT + 99 others); Wed, 14 Jul 2021 15:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbhGNT3m (ORCPT ); Wed, 14 Jul 2021 15:29:42 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5916C061760 for ; Wed, 14 Jul 2021 12:26:49 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id k27so4645986edk.9 for ; Wed, 14 Jul 2021 12:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t5WdCmdzAAZvn5CRq9XtWBn39mC8lrQD6RcbEsNxMOI=; b=Gjva4LKSPLcViL3TOIl2Mc/A0lDJQTjRM9xq2B9qx1sHfcDAKjhG/577r60coBuTmt lveR39Z2Q22b8Ni995AAZHyuELVSC7x+xq5/hqoobsl3HnqHTmkTaO88zRHyoOqxQw6p 5BpWpvzXkNYL5X9+YFlv0d1TzcK58hNXXJhKlDhNiNNOnz+PIY2oNF4RqGGeN3QYzdQd WrdYryvX9GQXtiklsSUto/WFgaJeZXejGy8fdSLv/yGGJGF4jnb8hK6JrvMh/OZZ9S/B 3rdO8J2PSygyHP3tia+Bf0SDINS6usxgdT4pzs0sC3PMjph7DlHGKt0qlXvCBErx66LV 1teQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t5WdCmdzAAZvn5CRq9XtWBn39mC8lrQD6RcbEsNxMOI=; b=XEbbZ3OHA3v1snuAVeUQ3Eepw3xtW95ZvH5M7T9Lc2pCGaqCINAZ83Q87qlWoxMPcC GMk2qDqZWXHiTfN5xMcWKuH6LF98WihUuHlGPeW6ViGJ+GoK7wusd0O9jlyx8i9CRorn hi3+AuuBGZw8mW1ANaj9LhXuLajemjf17lNpbpPwzkha/DJF61vSM6nXDxze38dUAz76 ij1v/t19I92bNn8CPoNQawG++dQzs3rTvqnHIpQHyPUnPsI5QyJKLw1vVME6GDRQ4X6v zKfSxBMV77dK0bf1TYynA6pSPinLcjwq1MgZHiZ+6KxW/7ZtWJxqPdvIJYZ2CruBsqys wgSg== X-Gm-Message-State: AOAM5333SqP6PJmQf6LcYg+8ssBGJlVFo4xKzWg/soQMkJqP9rEhX2oE kH6pODtI+hd66M9HIqDl680d8cN90kvuNMGeACaH X-Received: by 2002:a05:6402:b79:: with SMTP id cb25mr15716215edb.164.1626290808373; Wed, 14 Jul 2021 12:26:48 -0700 (PDT) MIME-Version: 1.0 References: <20210714001127.GA994@raspberrypi> In-Reply-To: <20210714001127.GA994@raspberrypi> From: Paul Moore Date: Wed, 14 Jul 2021 15:26:37 -0400 Message-ID: Subject: Re: [PATCH v2] lsm_audit,selinux: return early for possible NULL audit buffers To: Austin Kim Cc: Stephen Smalley , Eric Paris , Ondrej Mosnacek , selinux@vger.kernel.org, linux-kernel@vger.kernel.org, austin.kim@lge.com, kernel-team@lge.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 13, 2021 at 8:11 PM Austin Kim wrote: > > From: Austin Kim > > audit_log_start() may return NULL in below cases: > > - when audit is not initialized. > - when audit backlog limit exceeds. > > After the call to audit_log_start() is made and then possible NULL audit > buffer argument is passed to audit_log_*() functions, > audit_log_*() functions return immediately in case of a NULL audit buffer > argument. > > But it is optimal to return early when audit_log_start() returns NULL, > because it is not necessary for audit_log_*() functions to be called with > NULL audit buffer argument. > > So add exception handling for possible NULL audit buffers where > return value can be handled from callers. > > Signed-off-by: Austin Kim > --- > security/selinux/hooks.c | 4 ++++ > security/selinux/ss/services.c | 2 ++ > 2 files changed, 6 insertions(+) Merged into selinux/next, thank you! -- paul moore www.paul-moore.com