Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5779000ybi; Tue, 4 Jun 2019 12:05:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/0PqwZMTd1rGcwkVg7KDgM/V91tt/JOkHDyb0u4rfx2K6WRQYZAjae3tfm6A0kT4mQ6Gn X-Received: by 2002:a63:6603:: with SMTP id a3mr122842pgc.239.1559675110371; Tue, 04 Jun 2019 12:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559675110; cv=none; d=google.com; s=arc-20160816; b=L1D9Q8y2POqqEZPX+Rvn9tsK3ByKFESUItE5FvlipNJ+RD66a3r94oPkosyj4qeG+S FELDVcea4/piXrdfzMq2R29kht4ru0KHMHs4odO4jfycKajvErwpk41AFMU+vOyJibLm ZV2iSEx6oV2a878tOYRGJ1Uzh8MSIWFs1aZCXhyGZSH4+S3fKuK80Dy8MCB2Kpam0bMj mxNktSWFE7aQMtL2DcZj1L3dz1jQjFHuuVT5c50NiYlRGUTUkAaKE8KKz4G/QWEUxkWf qbesgRQT6maUUwoS3cS/onBj82/h6RutaTmPlkxgn4uI2ML+PB5vTfOqIPHOCtTeCbVT Ltww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3/X2qzhUbeCYtNLIJOdeMLei5RJYvEZvUrrjsTmklfQ=; b=DpKi6SboQ2MOVU0fZ4pNjTU1IImiV2N+VBR+HOr+s6uZhdvdCfeM2ejKzrNL4EUMby jFeDVe2oB3lwx3KKjSn9w8GBEJgEQm4h7aUy70UemdwPtQtC3A2fGke3OE8zppkyyCLm DJ0cfVNmu/Z9jkhyjTiOXiNB05PkoITgaKzC+E8+ofJ07vcum2gF3afF40euFE/CM7ZN cJE+Vh34TgzRpdP9s/xxtN6ywO86yEO1we9ffgVZhxau/k5OfPYr1hCxmd+UDimXDBPQ EDZglBgTLoAo0prBv5IUoouNNbpGWuNqw/4ULToOauQ1TNp/1Mnjx1Bpmc5ttCrp9FgE OTrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HzDsQh8f; 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 d34si5384930pld.82.2019.06.04.12.04.53; Tue, 04 Jun 2019 12:05:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=HzDsQh8f; 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 S1726373AbfFDTCh (ORCPT + 99 others); Tue, 4 Jun 2019 15:02:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:56680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbfFDTCh (ORCPT ); Tue, 4 Jun 2019 15:02:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 84F622075C; Tue, 4 Jun 2019 19:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559674957; bh=OHd6h6SqmatjLqX221rCnsqaDitqTk1LE3dD1iixchA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HzDsQh8fhheFUMlik+jJwVJALLlFygf/JIbS8DkzuCyfzt+qdBxN2BbmZJcXac/Li u8x7K8VXEsFoq1p6801Qgo+njBOzvs89tzpoOOw6fsJNsdyxxBkBApAe84o4NGp09x 1NkbtxzTs5KBL4oqaxEdNNv4IOLFylD+dCxkCm48= Date: Tue, 4 Jun 2019 21:02:34 +0200 From: Greg Kroah-Hartman To: Ben Hutchings Cc: Jiri Slaby , Gen Zhang , Kees Cook , LKML Subject: Re: [PATCH] Revert "consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c" Message-ID: <20190604190234.GA10572@kroah.com> References: <20190604180039.gai2phwdxn7ias6n@decadent.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190604180039.gai2phwdxn7ias6n@decadent.org.uk> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 04, 2019 at 07:00:39PM +0100, Ben Hutchings wrote: > This reverts commit 84ecc2f6eb1cb12e6d44818f94fa49b50f06e6ac. > > con_insert_unipair() is working with a sparse 3-dimensional array: > > - p->uni_pgdir[] is the top layer > - p1 points to a middle layer > - p2 points to a bottom layer > > If it needs to allocate a new middle layer, and then fails to allocate > a new bottom layer, it would previously free only p2, and now it frees > both p1 and p2. But since the new middle layer was already registered > in the top layer, it was not leaked. > > However, if it looks up an *existing* middle layer and then fails to > allocate a bottom layer, it now frees both p1 and p2 but does *not* > free any other bottom layers under p1. So it *introduces* a memory > leak. > > The error path also cleared the wrong index in p->uni_pgdir[], > introducing a use-after-free. > > Signed-off-by: Ben Hutchings Now applied, thanks. Gen, please be careful with these types of "fixes"... thanks, greg k-h