Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6981848ybi; Wed, 5 Jun 2019 09:17:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwb6bxKawDyioXa52rq7STMsiAUK8FpKRJxZ5+ZwN6Ewb1IqvrrqlnBv8MF2aP2Y6rYxiNP X-Received: by 2002:a63:2d41:: with SMTP id t62mr5628654pgt.113.1559751459865; Wed, 05 Jun 2019 09:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559751459; cv=none; d=google.com; s=arc-20160816; b=TRSF6pLLa81zKZMG+Obh4xL41JMl7e8wzFC4A8EM+tAQzZvwm6xZZ9Em2jt3ycyhBo Y+me6xcZxtBmVix88KJ12vNZB2HOzf6J5hBXvjM4aLKUriBAml9h99WbT3PwL90EO8yn uREwSxdjsWCiI5YEE5vSaEqmqhPWgBVMWdKwn+nSZtxQfovKizMwOYxG+gylcUYqpsr/ MQSbi4T4lyfofS1ghWmEdTiQKgFFdtJhNT8utOChdUanY0wzR1tKDJg2kbWA1ohRnpPs +AVwJiIOayRGwvAmJVjsi/cqOM0HAhupZy8IUgxMftV5xqZrEQHu/ePNUFR5grrqKJUK isFw== 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=cVJij5px6cgbTmt5z68onmeHRyl3UNhKUu1rRuGXNYc=; b=lCBhlrl4OfQI/hYQcTqK54d3K3wrAmn0Fw1EDCTElp+tzpyTGL/WnP3VRZ11oVSMQX 6eNKq2u+2zTf5QtvJBnt94PM7adEVL9tK9j1Zjb12um9tactTIVIDY4BaIlDlKjs1KNN tfO1lRhSSIhgrCUFSeFVwl5DS137ZvAKPFkTC3htvquRXk+l2qxX9l6bdeKi/ff6LV5B d5FG7Dg0uS8RhJMOcpfBPrgPRvqunOVICf+zgQu2JZijSi50/WqpkPsQ2s/YVCR1UOUA 62qENBPoadIjPseYzidQQxEr55FW2dJMWyxoWtC+DoVAfD1NjSwlwqjA5Fi6vdqq7kSd EsKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OQ24olSE; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q17si12412117pgm.479.2019.06.05.09.17.22; Wed, 05 Jun 2019 09:17:39 -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=@gmail.com header.s=20161025 header.b=OQ24olSE; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728650AbfFEQQL (ORCPT + 99 others); Wed, 5 Jun 2019 12:16:11 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44657 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728263AbfFEQQL (ORCPT ); Wed, 5 Jun 2019 12:16:11 -0400 Received: by mail-wr1-f65.google.com with SMTP id w13so20048136wru.11 for ; Wed, 05 Jun 2019 09:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cVJij5px6cgbTmt5z68onmeHRyl3UNhKUu1rRuGXNYc=; b=OQ24olSESqI7BgEmOlAKFmqiPlICqgBBFqgQ0jeXETTAF3DSYL7T5/HU0J7Hti7y0u idaxbS+l9CxJ1bgmIU39ezjMW0u5TfQAEzKyQtlfR/U5whBeOxjuEjW2z2PERxjpP2UQ AyhYMak6vNyqjFs7tGgdnRRGd0+v0jRzgdsrrne8uk+sNF3kX6q8yu/QMJyKLX0IEiWp REUJCgPjCMLd/RjchG94M8JAvc8Az7pu7D2EcaU3hzbWzoWzMRkSx45OZE6lkAaLwbds 3/xQepMv1HUAwwFLwjR16sW5HrLvp9LtO6m1sw7V9U+wZKpnlmDJHgINfueh8QNWssj5 vmnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cVJij5px6cgbTmt5z68onmeHRyl3UNhKUu1rRuGXNYc=; b=Ai2oi46qnRBCQoxXerfltbe1e3uEXCJmKiszG1RNzoXV2fYN6Mn7Rphqltcm7D+9dz mWpKdUb5J1Tpb2duAzkEbkQhyq3dxY47VxMezcx+Gvwug+v4qbGOTKdK8z+xp2oUQkOH ktgf8IAHJvjl1SbcSN5gmdIFs26uOxcRMuCs7gNpsJM36VMMgarZFZAuuJBlHnZBby1/ Zk2hVC3SjQ59DQOxHxP42qXW4Bw8BtUEXVF6d8Hh6J1TOhzU46Bplnj5QKKKv2C6iSgG gTXRehrQI8Tof8ynP3fgpVD5ToVj1EztJCd/IO85RfgY4fv7FNkjZGTzj5tw/wk11yYQ i6fw== X-Gm-Message-State: APjAAAWSlawh/Gfx6S2kTsFl7WxnvrAPs1K+EIFe/rBZ+kCUN1nLY8yT Ra5g9cg8Ha4xe2BZSIR7sC0= X-Received: by 2002:adf:eb43:: with SMTP id u3mr12023336wrn.342.1559751369349; Wed, 05 Jun 2019 09:16:09 -0700 (PDT) Received: from zhanggen-UX430UQ ([108.61.173.19]) by smtp.gmail.com with ESMTPSA id c18sm20819435wrm.7.2019.06.05.09.16.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 09:16:08 -0700 (PDT) Date: Thu, 6 Jun 2019 00:16:00 +0800 From: Gen Zhang To: Greg Kroah-Hartman Cc: Ben Hutchings , Jiri Slaby , Kees Cook , LKML Subject: Re: [PATCH] Revert "consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c" Message-ID: <20190605161600.GA4720@zhanggen-UX430UQ> References: <20190604180039.gai2phwdxn7ias6n@decadent.org.uk> <20190604190234.GA10572@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190604190234.GA10572@kroah.com> User-Agent: Mutt/1.5.24 (2015-08-30) 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 09:02:34PM +0200, Greg Kroah-Hartman wrote: > 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 for your comments. I will for sure. And I am always submutting patches and revising it according to the maintainers. Thanks Gen > > thanks, > > greg k-h