From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6877C433DB for ; Thu, 11 Mar 2021 09:44:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69E3064FBB for ; Thu, 11 Mar 2021 09:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232097AbhCKJnu (ORCPT ); Thu, 11 Mar 2021 04:43:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:52702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbhCKJnr (ORCPT ); Thu, 11 Mar 2021 04:43:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3DA4A64F38; Thu, 11 Mar 2021 09:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615455826; bh=J8Jxz9e8okdXOazQPLeITn0YDWgZhVvBfqAaIZA7/5M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c9kMxhDQOgu7bmak3puPXUM5oqPm+l1jssvTS8AgrsJNDzzyrutLfKJs3d7P42Qdh 6xNPaO/V9C3lYU3zBj7nwTI86nd8I5A+N1FhRLTRaYTucItaYg6cFcoK2Fjnmse74w HqBBm7KDFt/cqHUn4UQjgLhK8JkX2eteFoWPPTzs= Date: Thu, 11 Mar 2021 10:43:44 +0100 From: Greg Kroah-Hartman To: Petr Mladek Cc: Chris Down , linux-kernel@vger.kernel.org, Sergey Senozhatsky , John Ogness , Johannes Weiner , Andrew Morton , Steven Rostedt , Kees Cook , kernel-team@fb.com Subject: Re: [PATCH v5] printk: Userspace format enumeration support Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 11, 2021 at 10:34:46AM +0100, Petr Mladek wrote: > On Wed 2021-03-10 13:16:43, Greg Kroah-Hartman wrote: > > On Wed, Mar 10, 2021 at 12:12:57PM +0000, Chris Down wrote: > > > Greg Kroah-Hartman writes: > > > > On Wed, Mar 10, 2021 at 02:30:31AM +0000, Chris Down wrote: > > > > > + ps->file = debugfs_create_file(pi_get_module_name(mod), 0444, dfs_index, > > > > > + ps, &dfs_index_fops); > > > > > + > > > > > + if (IS_ERR(ps->file)) { > > > > > + pi_sec_remove(mod); > > > > > + return; > > > > > + } > > > > > > > > No need to check this and try to clean up if there is a problem, just > > > > save the pointer off and call debugfs_remove() when you want to clean > > > > up. > > > > > > Petr, what are your thoughts on this, since you requested the cleanup on > > > debugfs failure? :-) > > > > There is nothing to "clean up" if there is a debugfs failure here so I > > don't see the need. > > My main concern is that the allocated struct pi_sec must not be leaked > when debugfs file was not created. > > I still have to check if it would be freed even without the file > when the module is going out. To me it looks like it still will happen as pi_sec_remove() will be called either way. thanks, greg k-h