Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1102815ybm; Wed, 22 May 2019 17:33:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTsMONl4ymKD7Bv8pcA0g75o2e3/4BeEaqnI1LBsLRIwZ/jOOuoYedQzd/3nlXMti13Gsb X-Received: by 2002:a63:ee0a:: with SMTP id e10mr79341904pgi.28.1558571606597; Wed, 22 May 2019 17:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558571606; cv=none; d=google.com; s=arc-20160816; b=fTiElT2fKSHiZolhiLTeBq3df6tyKTeie11UrVyAeuGdTN/rDxYo9jc0kym2NAWfmF ST2BYyMkqKE5kBfpKzA/B5H5hy/YWKKwlpwrw7NGtjIKaW9A1OoEuWvI3lCk+CVx8YjD wxQmmaX7ZKz6EPSQbLEl1E/FFfPwfPsROzFvAyh92qHNpgHRv3xercOMJZEozWM2+dtJ n6Vvh9wUzmE9nyGHBb8fj2HQDlLxhjMGoMc65ohs65Uv1fi6j2djUS/mUjNOwjyxtFX7 0A/Osf+NLJORgCH9VofkpiC0SOdj1g/ei2jiW5Liv2defeGhnHMQqAi8d275ADYEace6 zI9w== 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=xHxRAHny7MqHauNPa2NCJChMz/QrdToa+RjUnndgfSg=; b=M9IFjtg+Q3GmMZfTyprYOIwVHULG47+6jIwBUiI0ge1GvFiG1bLWDxFGMXJsYq2Ht6 5p/dZum94SeDIFkjC+xvn2OJ4d1UrbYqpHxzFoNbbdyLiGaI0PG5pbAAKeQcue2ndGt1 d4r7ORwTJw35Qugj0oMGebycCJjhJT8z042D0cSkVMPRSDrmGk0K1nLbH2GsysoZEHCt bgVxjBBIMCsd1HENs8O/ZiGQIVG66oblSuVlbyLUbdSP3cVAynIOYE7nZSf7Xty1cII/ QRJxL6Leq3qNf5QiZdIZNeYa4o2KIjMm3N0pxgyskwIrVy0/Ggu0ywTpjNcLXoKWGQAJ 5hbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="mDwa6TX/"; 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 h187si26634232pfb.129.2019.05.22.17.33.11; Wed, 22 May 2019 17:33:26 -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="mDwa6TX/"; 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 S1729699AbfEWAad (ORCPT + 99 others); Wed, 22 May 2019 20:30:33 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37784 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727634AbfEWAac (ORCPT ); Wed, 22 May 2019 20:30:32 -0400 Received: by mail-pg1-f194.google.com with SMTP id n27so2147520pgm.4 for ; Wed, 22 May 2019 17:30:32 -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=xHxRAHny7MqHauNPa2NCJChMz/QrdToa+RjUnndgfSg=; b=mDwa6TX/Kk7zbHpul3PnRMnRcFAHtg9Xxdc24+ZinXhxG+fPbcQ0lPXhcjw/e+SZyJ r5hiBcHtBWBMwvP2O9xuJuOXbPIS5SCp6p6tUIyVMHWNxuM62iB4Uj6Pn0qx7gcmRuxg gJi3DXM9pmth7tPBqKf1GX6YqHxDX4SYivy9rKzzLH5ElV38ltdHrjtODYKScuRGI4kD 9K+PNNQfm8ukf//NHwhMV23ACI4bA/xitFgvwUGihvzNvZoOs54eKctiQFJnhFeSD8eS t6luF5jNUCiJV/2I7K/pFakZUOUa1to+ZeqR/47TZoriFWBcz2Serh1dRKcRuH0c4m7z Ensw== 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=xHxRAHny7MqHauNPa2NCJChMz/QrdToa+RjUnndgfSg=; b=MhcOoomkwZh4glvn86s4Km4RIDzJq5E/eNuVYmqug0bxK/OAh/TvEYUVWlDg+brVdr ZJn1FGcamt1ctvOV/1RTd/26PihiMzJgd7iXgstutkA/fffbAS6QcF2G6SfQcGoKi1Nw OE0ELTUZBgQlaD+bYM4MUSQrl4Da7HUyoqwdpgwXzui6Q2ZZpGzap9I7lkLJvCPFaJ4W h9xCq1sc6u7gMC45gTkvHnlfpum8e95VBcYsILXiErPhovlQagUDRvOLLHrAeC2ogAjp SfJ8XfpD2MdeUj3EAklLhx+dJc1I8yZ5xL4D70yNBjGeeWA+4K1VeXOFAMoyoDLnZ5C9 /QJA== X-Gm-Message-State: APjAAAWEgILahzhBxiMUde0jiadsMSkUf330d/93PfHP9z257juxOpXO h7c+QZX3svgYc0OEIKV2ONn+XF3ZFaLaZw== X-Received: by 2002:a63:1b65:: with SMTP id b37mr93264021pgm.408.1558571432112; Wed, 22 May 2019 17:30:32 -0700 (PDT) Received: from zhanggen-UX430UQ ([66.42.35.75]) by smtp.gmail.com with ESMTPSA id q27sm40498511pfg.49.2019.05.22.17.29.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 May 2019 17:30:31 -0700 (PDT) Date: Thu, 23 May 2019 08:29:23 +0800 From: Gen Zhang To: Kees Cook Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c Message-ID: <20190523002923.GA14060@zhanggen-UX430UQ> References: <20190521092935.GA2297@zhanggen-UX430UQ> <201905211342.DE554F0D@keescook> <20190522015055.GC4093@zhanggen-UX430UQ> <201905221353.AD8E585E6D@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201905221353.AD8E585E6D@keescook> 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 Wed, May 22, 2019 at 01:54:47PM -0700, Kees Cook wrote: > On Wed, May 22, 2019 at 09:50:55AM +0800, Gen Zhang wrote: > > On Tue, May 21, 2019 at 01:44:33PM -0700, Kees Cook wrote: > > > This doesn't look safe to me: p->uni_pgdir[n] will still have a handle > > > to the freed memory, won't it? > > > > > Thanks for your reply, Kees! > > I think you are right. Maybe we should do this: > > kfree(p1); > > p->uni_pgdir[n] = NULL; > > Is this correct? > > That's what I'm not sure about. I *think* so, from reading the code, but > I'd love to have Greg (or someone more familiar with the code) to > double-check this. > > Otherwise, yeah, this looks right. Please send a v2 and we can debate > the correctness there, if it turns out to be wrong. :) > > -- > Kees Cook Thanks for your suggestions, Kees. I follow your guidance and work on resubmitting a patch. Thanks Gen