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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42799C4345F for ; Sun, 14 Apr 2024 23:23:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B46011201F; Sun, 14 Apr 2024 23:23:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="g099EBGR"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8A79211201F for ; Sun, 14 Apr 2024 23:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713137035; x=1744673035; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=m8igsyuCj+BEZxsNlKY9VUyc9V2pK+X+p2LLBtKZVoU=; b=g099EBGRYW2ewMcX6msEr50WD+hd4AmTnK+qwUc1FwNdJcPmLJyGm+// mv+SLZALCg2CxO0201RWCZDPo5bphWEvpPz9hxDl5tpe237aP1IVv5c86 +c9apXd03WIFiJrb0aFX1NtOiWMCizxgi+fCJ1PCyJHAfdBE3rTB2Koeu +fLTCzJGAd3LfCEkdHu8JeDMNLzTvW3ECBnzJ+DWlDFhc+MUbEoexa5JC FsAlus6ttAfiYxe4Q+DGw1KAIKGIhuO6ENuAS/27ldEN3UxkyJU42NFbG pFpK/Hs2U5CRXvhjcN5uVAFtqu56uJEUy/EEDsYhiWp1WD/eoMlKruO7o A==; X-CSE-ConnectionGUID: w+c1CXS3QIazsvhMrXTqHQ== X-CSE-MsgGUID: 2GfnwywCTD6s33DsOPSKQw== X-IronPort-AV: E=McAfee;i="6600,9927,11044"; a="8637320" X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="8637320" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 16:23:54 -0700 X-CSE-ConnectionGUID: O9n+fkWZR/igkV2E/zWp2g== X-CSE-MsgGUID: gygYXM4iTFi7ES2U8kKQZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="26550470" Received: from orsosgc001.jf.intel.com (HELO orsosgc001.intel.com) ([10.165.21.138]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 16:23:54 -0700 Date: Sun, 14 Apr 2024 16:23:53 -0700 Message-ID: <85cyqrtto6.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: intel-gfx@lists.freedesktop.org Cc: Badal Nilawar , Andi Shyti , Ville =?ISO-8859-1?Q?Syrj=E4l=E4?= , linux-hwmon@vger.kernel.org Subject: Re: [PATCH] drm/i915/hwmon: Get rid of devm In-Reply-To: <20240413001031.481961-1-ashutosh.dixit@intel.com> References: <20240413001031.481961-1-ashutosh.dixit@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-redhat-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, 12 Apr 2024 17:10:31 -0700, Ashutosh Dixit wrote: > > When both hwmon and hwmon drvdata (on which hwmon depends) are device > managed resources, the expectation, on device unbind, is that hwmon will be > released before the drvdata. However, it appears devres does not do this > consistently, so that we occasionally see drvdata being released before > hwmon itself. This results in a uaf if hwmon sysfs is accessed during > device unbind. > > The only way out of this seems to be do get rid of devm_ and release/free > everything explicitly during device unbind. > > Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10366 > Signed-off-by: Ashutosh Dixit Please don't review this patch yet, I will send a v2 tomorrow. Please review the v2. Thanks.