From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:47872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750826AbeEQI4U (ORCPT ); Thu, 17 May 2018 04:56:20 -0400 Date: Thu, 17 May 2018 10:56:02 +0200 From: Greg Kroah-Hartman To: Ben Hutchings Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Richard Guy Briggs , Paul Moore Subject: Re: [PATCH 4.4 24/72] audit: add tty field to LOGIN event Message-ID: <20180517085602.GC25318@kroah.com> References: <20180406084305.210085169@linuxfoundation.org> <20180406084307.173351538@linuxfoundation.org> <1526314736.9159.13.camel@codethink.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1526314736.9159.13.camel@codethink.co.uk> Sender: stable-owner@vger.kernel.org List-ID: On Mon, May 14, 2018 at 05:18:56PM +0100, Ben Hutchings wrote: > On Fri, 2018-04-06 at 15:23 +0200, Greg Kroah-Hartman wrote: > > 4.4-stable review patch.��If anyone has any objections, please let me know. > > > > ------------------ > > > > From: Richard Guy Briggs > > > > commit db0a6fb5d97afe01fd9c47d37c6daa82d4d4001d upstream. > [...] > > --- a/kernel/auditsc.c > > +++ b/kernel/auditsc.c > > @@ -1976,6 +1976,7 @@ static void audit_log_set_loginuid(kuid_ > > �{ > > � struct audit_buffer *ab; > > � uid_t uid, oldloginuid, loginuid; > > + struct tty_struct *tty; > > � > > � if (!audit_enabled) > > � return; > > @@ -1983,14 +1984,17 @@ static void audit_log_set_loginuid(kuid_ > > � uid = from_kuid(&init_user_ns, task_uid(current)); > > � oldloginuid = from_kuid(&init_user_ns, koldloginuid); > > � loginuid = from_kuid(&init_user_ns, kloginuid), > > + tty = audit_get_tty(current); > > � > > � ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN); > > � if (!ab) > > � return; > > This error path leaks the tty ref. Fixed upstream by: > > commit 76a658c20efd541a62838d9ff68ce94170d7a549 > Author: Richard Guy Briggs > Date: Tue Jun 28 12:06:58 2016 -0400 > > audit: move calcs after alloc and check when logging set loginuid Thanks, now queued up. greg k-h