Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2025148rdh; Sat, 25 Nov 2023 10:31:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuLYdYbQ1GnmGnIlf5RuTEhNs35wGi5lzQ14qBMz/EyDk3AttiYx9jwSevlmENh/MSBcFA X-Received: by 2002:a05:620a:4115:b0:76c:adb5:108d with SMTP id j21-20020a05620a411500b0076cadb5108dmr7737908qko.31.1700937118392; Sat, 25 Nov 2023 10:31:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700937118; cv=none; d=google.com; s=arc-20160816; b=dRTeGLW8KjpSe1djkx+nD140g/FEMDiSCvKPTrZmeAs9Q9J1+p2G2BNM1Xrs9lqAu8 g8K0bcgo+MT7cpKnPhnHCqFR/NoqK2mm6vGS9BYVEIpcLTQb5H/vv8Tm+B0C6C+0p1xp SAOvTOQFT/5hs5JvGE8z/AmkOPWWW8g/DLXbj9FToBOazeyDWWbZnW4rd+g6Hfwr2bKn Hg0BioXnsj3yhzVgdTa5G7SqYiq4xcsDLgzWujj6Wafxz0vjpuedbGsvqqSwE1eajjO6 0LNx6+/paF2HvVeHF/jJw3/Nu7qcCNDnx354KR/Z246NXkd2ogkiP0lFAdyerNt7n+6F zVQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=/elYiV2h43xgthyj4ibpKzQ7Pp8ZcGl+f6ZqBes/X4g=; fh=XFc9PuEowi9IgrGOEyZNuzLmBJHFVJ/nPpXgdDR0foA=; b=iGZJiqMYHIMeRnQhWDmM6fHFwd91z/cr7tTnALoArWbJtFdlrEaeSPEwv3d1886cF6 tVK3vPlNdAC/pnxctZ083TppCNx0G7/qPoedi6KX8kYL+tbD6RuMvRnQkzkq97EdqYBC 2ZBogro9n2BO8G4bAET7OIJ4bGbgvjpgy8FV/hGqiwFIlhbzgtRXypw1hqlyXq3MYIL7 i5OKjFFhEVYHx9ETymM/sGxcR0+t8wzFE1FY++txOJw48reUx12evNDGK/fhMUM2AL3b iaDx9X9tFs63vVyMo/t7MHqrGvz7MQW3iDl8y1L5Y/0IDA4crQlAS7hC/MvpfZnvd5SB vN/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b="yVTo/WLF"; spf=pass (google.com: domain of linux-wireless+bounces-76-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-76-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o10-20020a05620a2a0a00b007777245a946si5804417qkp.41.2023.11.25.10.31.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 10:31:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-76-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b="yVTo/WLF"; spf=pass (google.com: domain of linux-wireless+bounces-76-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-76-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C56E91C20B1B for ; Sat, 25 Nov 2023 18:31:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B68772E648; Sat, 25 Nov 2023 18:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="yVTo/WLF" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E506DB; Sat, 25 Nov 2023 10:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=/elYiV2h43xgthyj4ibpKzQ7Pp8ZcGl+f6ZqBes/X4g=; t=1700937111; x=1702146711; b=yVTo/WLFUyDnnC0oOyAM9dz299ILLM9zK2FeE5+kIplRarN eZWoGX47VEdsRxfCbeLRF/tvzSbo/ReJvGr2kBphUH2mcr0ovMkHaLGDfA00KJtldMf3t5ooe+k0e UYV53XXuG4dE2nIjB4Cx8LKVu6SFH2RnClfdqK7fDn6vY5PSpR6QUVdvCtjz8zbdIpP/C5vIGbt0G 1TpMJepjpmd8qumD+VV6K5B8CUj+5pVubumUYVSaVs6d2HbzXHsBNuESto4s4ogUkYEAc9u30IrPW CdozLSk+ZiWpCrlpcMHIQXUMCmc0PASV+WWpkAklKvx3pZYIQ0lA/oqbCv31M0aw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1r6xRU-00000003uMR-1doN; Sat, 25 Nov 2023 19:31:48 +0100 Message-ID: Subject: Re: [PATCH v2 1/6] debugfs: fix automount d_fsdata usage From: Johannes Berg To: Greg Kroah-Hartman Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" Date: Sat, 25 Nov 2023 19:31:47 +0100 In-Reply-To: <2023112519-reprocess-backtrack-0732@gregkh> References: <20231124162522.16344-7-johannes@sipsolutions.net> <20231124172522.01928f127e73.I64fe5615568e87f9ae2d7fb2ac4e5fa96924cb50@changeid> <2023112519-reprocess-backtrack-0732@gregkh> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned On Sat, 2023-11-25 at 14:48 +0000, Greg Kroah-Hartman wrote: > On Fri, Nov 24, 2023 at 05:25:24PM +0100, Johannes Berg wrote: > > From: Johannes Berg > >=20 > > debugfs_create_automount() stores a function pointer in d_fsdata, > > but since commit 7c8d469877b1 ("debugfs: add support for more > > elaborate ->d_fsdata") debugfs_release_dentry() will free it, now > > conditionally on DEBUGFS_FSDATA_IS_REAL_FOPS_BIT, but that's not > > set for the function pointer in automount. As a result, removing > > an automount dentry would attempt to free the function pointer. > > Luckily, the only user of this (tracing) never removes it. > >=20 > > Nevertheless, it's safer if we just handle the fsdata in one way, > > namely either DEBUGFS_FSDATA_IS_REAL_FOPS_BIT or allocated. Thus, > > change the automount to allocate it, and use the real_fops in the > > data to indicate whether or not automount is filled, rather than > > adding a type tag. At least for now this isn't actually needed, > > but the next changes will require it. > >=20 > > Also check in debugfs_file_get() that it gets only called > > on regular files, just to make things clearer. > >=20 > > Signed-off-by: Johannes Berg > > --- > > v2: add missing kfree() pointed out by smatch >=20 > Acked-by: Greg Kroah-Hartman I have to fix the Kconfig issue in one of the later (wireless) patches, but does that mean you'd actually prefer the debugfs changes go through the wireless tree, together with the code using it? Thanks, johannes