Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6606336pxb; Wed, 17 Feb 2021 08:39:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4Y2Sq3Opq/w6Bzh84mIafkYM/RwebSO5QVf7Z+RxDoOmahx6rS13WjrRvAvID50bgBl8a X-Received: by 2002:a17:906:17d5:: with SMTP id u21mr26432873eje.109.1613579957786; Wed, 17 Feb 2021 08:39:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613579957; cv=none; d=google.com; s=arc-20160816; b=Kx7QmcPxARy+um+DizH7OnzFU0QMje9qtaqnC4JwkmhBL/TPUsR2YA9ZzGNky7UCVH rlhSkGpg/iBqCznJ+1twetQRiGpF4za8/c0+4MyqPyUHKEKqgvA4hCOSTbH7vb85qzVY zL2rC/b3OsdQi9H4+rzuGsDzQI9a11nOP+l0t4Do8iJ/I+ggn1SkBm0fRJGsf4DT3sZ5 MbZZiG5sugbWVzJi8QOVXZ84KHvI692b1noIcDpZuAHsgiabgQGjUyIdpoe8PpFxkfdR A2Go1J+PTFamNZCZ5nCSHenNhqxukBE0zHBcR1IFzGqoTSIV3ZG1YU5BOyyuDx40AgLm 9xUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=p8EXC5f8XmmEzFQQjXafcaeNFWSNN27JEw5tE0rgszc=; b=b/UN2mMIYFUmiIM5ru4ilkqFAz5b7GuPfCaduM+J/8l5ecUwJ+2WRk7v9J31TZTHNU p8UcvI7j+ENYTUhGWPBUY87Y4aYC12bGr0SYQKGvZoF0urNRkf7dzlLIEE8JSWrR+MPJ oXnM3//q4Qw5pldwG42PrMtHpiQJRi6S8hNvX7UMu5sJgB/KC5zAvns8/XxLT+6ZBG5E HtyOvUQTbAO16fLxTgxyDgVEQAALt8OJTLCtzkAHQTvN8z1eLt03BLkkuCiKDeyrMFNm hVgwAzi+1/Odw8sRsqiOLS2958MxYa65/G87CfxK/3E7I4C9EkwJlbveadcXwmnWwzh1 4Dew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=bIhQ0iKT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay10si1768685ejb.105.2021.02.17.08.38.53; Wed, 17 Feb 2021 08:39:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=bIhQ0iKT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234259AbhBQQdt (ORCPT + 99 others); Wed, 17 Feb 2021 11:33:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234239AbhBQQdE (ORCPT ); Wed, 17 Feb 2021 11:33:04 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7CBEC061574 for ; Wed, 17 Feb 2021 08:32:23 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id g6so18014549wrs.11 for ; Wed, 17 Feb 2021 08:32:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=p8EXC5f8XmmEzFQQjXafcaeNFWSNN27JEw5tE0rgszc=; b=bIhQ0iKTGuHw5g/CU7AUMxGI7Wx/Uw1wz8DNcOjWPieW4H2gELFxvII2Kt6ZinzQae EhyyW1uKRYZlpFx33gsuy+Tm7s5NifyDJcGcReXNKKRJB3m54g5MPaS+y60EJedDzTJZ 6keodpR2GbdqsnZ5w0tmtKGDmLq9Rmd5lYZRY= 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=p8EXC5f8XmmEzFQQjXafcaeNFWSNN27JEw5tE0rgszc=; b=WmNMvZWe41gc/X5AhX8bM4Yv/Ku/atOFCZ/4oGvKVJnLL/cq+YVTRS0vXLLzZoSMUk 3LGrEPB3FaTLGC4Q1gyfEX49Ed3HWQ+kTpdhEdcsaY1MC01PO2DlcRtRyO6ou/HTGKsH OfrL9dfHSRs5CcncMFCCFSdTRSb2DwkVoDU6VaRyzA/ESrr1bkELtPXi158lEm4qpzqC BodSY0XyR0BF6jRNl8iy6dveZqhlXFvy0qjqWkCIHvRZOP/aQv66f+9LvfaTk3lKr06A 87yt6v6vSML+i1krF2LsDKz6MKIfOEVBej/8egPch2TJPwggbihi0RCnqAvgK+9Ei6Gp aiqw== X-Gm-Message-State: AOAM53102J6THvCAc2vskXeLcv6BV3dfsIKoCgPMHWW1Evxu3xjaf4Ru QZFCaLXsjuA3n7TW+DuPrvgMfg== X-Received: by 2002:adf:de86:: with SMTP id w6mr101058wrl.32.1613579542483; Wed, 17 Feb 2021 08:32:22 -0800 (PST) Received: from localhost ([2620:10d:c093:400::4:76fd]) by smtp.gmail.com with ESMTPSA id t30sm4871829wra.56.2021.02.17.08.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 08:32:22 -0800 (PST) Date: Wed, 17 Feb 2021 16:32:21 +0000 From: Chris Down To: Petr Mladek Cc: linux-kernel@vger.kernel.org, Sergey Senozhatsky , John Ogness , Johannes Weiner , Andrew Morton , Steven Rostedt , Greg Kroah-Hartman , Kees Cook , kernel-team@fb.com Subject: Re: code style: Re: [PATCH v4] printk: Userspace format enumeration support Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (da5e3282) (2021-01-21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Chris Down writes: >open(f); > debugfs_file_get(f); > fops->open(); > inode->private = ps; > debugfs_file_put(f); > >remove_printk_fmt_sec(); /* kfree ps */ > >read(f); > debugfs_file_get(f); > fops->read(); > ps = inode->private; /* invalid */ > debugfs_file_put(f); Er, sorry, inode->private is populated at creation time, not at open(). The same general concern applies though -- as far as I can tell there's some period where we may be able to _read() and `ps` has already been freed.