From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Hurley Subject: [PATCH 10/15] tty: audit: Remove false memory optimization Date: Tue, 10 Nov 2015 21:05:55 -0500 Message-ID: <1447207560-16410-11-git-send-email-peter@hurleysoftware.com> References: <1447207560-16410-1-git-send-email-peter@hurleysoftware.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAB26SMW032744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 10 Nov 2015 21:06:28 -0500 Received: from mail-io0-f179.google.com (mail-io0-f179.google.com [209.85.223.179]) by mx1.redhat.com (Postfix) with ESMTPS id C8713743 for ; Wed, 11 Nov 2015 02:06:27 +0000 (UTC) Received: by iouu10 with SMTP id u10so12960204iou.0 for ; Tue, 10 Nov 2015 18:06:27 -0800 (PST) In-Reply-To: <1447207560-16410-1-git-send-email-peter@hurleysoftware.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: Greg Kroah-Hartman Cc: linux-audit@redhat.com, Jiri Slaby , Peter Hurley List-Id: linux-audit@redhat.com The tty audit buffer is allocated at first use and not freed until the process exits. If tty audit is turned off after the audit buffer has been allocated, no effort is made to release the buffer. So re-checking if tty audit has just been turned off when tty audit was just on is false optimization; the likelihood of triggering this condition is exceedingly small. Signed-off-by: Peter Hurley --- drivers/tty/tty_audit.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c index 3d90f88..7943984 100644 --- a/drivers/tty/tty_audit.c +++ b/drivers/tty/tty_audit.c @@ -200,8 +200,7 @@ int tty_audit_push(void) * tty_audit_buf_get - Get an audit buffer. * * Get an audit buffer, allocate it if necessary. Return %NULL - * if TTY auditing is disabled or out of memory. Otherwise, return a new - * reference to the buffer. + * if out of memory. Otherwise, return a new reference to the buffer. */ static struct tty_audit_buf *tty_audit_buf_get(void) { @@ -224,9 +223,6 @@ static struct tty_audit_buf *tty_audit_buf_get(void) return NULL; } - if (~current->signal->audit_tty & AUDIT_TTY_ENABLE) - goto out; - spin_lock_irqsave(¤t->sighand->siglock, flags); buf = current->signal->tty_audit_buf; if (!buf) { -- 2.6.3