Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3684619imm; Sun, 10 Jun 2018 23:16:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIEECbC6gal3J/UA8/S2lX4kQbbFXN9uikIJ1awTMe+DPE/PC6StnPyY3fqqkf5hmbvb1UV X-Received: by 2002:a17:902:369:: with SMTP id 96-v6mr17283455pld.64.1528697799393; Sun, 10 Jun 2018 23:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528697799; cv=none; d=google.com; s=arc-20160816; b=HxuueuD2SrtDqJyJUTddgh5IXdCs7Jc6INc3LLWA5hyw3hG49+FiuaAVbRpk7SUcpA YeLmXKKdOHPbCNSunuJuN1jvFxSDV/dkQn7B2j28smB+OnV1vS8XqQGKwKPefsye/0My IWXFL+FI2yhQxRoF/OlxPAj9CrFPbQkRn1++vWjWCeqixmGrZhQvL7e3osNRQ1faH2ml Cg7JGDtWGcSkTn5p/Et9A1OoUdEYKjXCUATTe21l05jK3c2nhM0etlRtBVjsn3/bTbER XDVQpFr8AFb/vrqFBUKwCiN2fiA5H/6RrkgIgME6dXakKfnsjSeS7Q4yYCt1/uTslTS+ G6Kg== 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:arc-authentication-results; bh=i26TbTgB509GNiy2wB+ccbMIWXbfmTVbYLQrjrpSvTY=; b=JkYl2+6Mu4CqtjmkjB9lLtQL8ciGJsd70Uo1mBY6UwH3TS9Efe1PT0ligSwVHDrMfA OcZ8I4/oYASAwzXljcuqolL5v8rXqKd1VRzvscqG+FR3mj+5uWjRxcOvpZuaa9naOeCE HBiOPsZx6qeg4bB6hk+8a1K031fMBkqgus0BV3aRqQ8kUOHcLMw8j8f0/0AbxS4M97Hb mTDRftSIG9obJiaAH6Rn3XeDM68BYveCiC+FAdOj7/tf+YaveRDzvZgfvrQKJVvrPr71 c/0h4mi9dAUpnB4Jcti/v+gnI72eQZqN+lA8AWLxEBchCDjtgFSCqr9GS3k9Uy5UOuQv bG2Q== ARC-Authentication-Results: i=1; mx.google.com; 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 j15-v6si1693894pgs.348.2018.06.10.23.16.25; Sun, 10 Jun 2018 23:16: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; 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 S1754026AbeFKGQB (ORCPT + 99 others); Mon, 11 Jun 2018 02:16:01 -0400 Received: from verein.lst.de ([213.95.11.211]:57286 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753929AbeFKGQA (ORCPT ); Mon, 11 Jun 2018 02:16:00 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 9249F68CEE; Mon, 11 Jun 2018 08:23:54 +0200 (CEST) Date: Mon, 11 Jun 2018 08:23:54 +0200 From: Christoph Hellwig To: Chunyu Hu Cc: viro@zeniv.linux.org.uk, hch@lst.de, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] proc: add proc_seq_release Message-ID: <20180611062354.GA32641@lst.de> References: <1528573884-9133-1-git-send-email-chuhu@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1528573884-9133-1-git-send-email-chuhu@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 10, 2018 at 03:51:24AM +0800, Chunyu Hu wrote: > kmemleak reported some memory leak on reading proc files. After adding > some debug lines, find that proc_seq_fops is using seq_release as > release handler, which won't handle the free of 'private' field of > seq_file, while in fact the open handler proc_seq_open could create > the private data with __seq_open_private when state_size is greater > than zero. So after reading files created with proc_create_seq_private, > such as /proc/timer_list and /proc/vmallocinfo, the private mem of a > seq_file is not freed. Fix it by adding the paired proc_seq_release > as the default release handler of proc_seq_ops instead of seq_release. Indeed, thanks for the patch. Reviewed-by: Christoph Hellwig