From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796281161; b=NASqcPWfObsWCEnVWYJgO518tll+l+chhi5nu4o+pNnhQu9MUlCdWarMF8XHcv0hY0n/ 9PVuRcb5mWcEAu0NBGQp8XyIevYb3+tSgQBNyxeQuVBXJnIb9Tk6zSqhyt22DhvI/9n8i sW1E9yTG3Nr6kTytKrdI9FfdTQlCBDBQdqyFKoTW/nHYjfpavwx4v/WZ/Y+Cov1ljUOGf UEVNercYmfDIAA5bRMoFzhEZ22CijwkVOAHuoo83qKyBLB8xfOSh9+6fwJYMIzOZlM5Bd hSAY8POE8U6YNeGejOkMNGPX5noE0LG4eSmdks10cCsDBiL9DsbGm9ujr4dX55ZzVnA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796281161; h=Received:DKIM-Signature:Received:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=AqpK5MwsnPKLxNo34QLKBgvA76ngfcL8WAgfl3He/Ks=; b=NyTJbpd452prCT3aaEjGla0RdEw0SCc11tL8+ddJbd26fqnM/bptMJR1OLNf6PUM+Qvq lBPX6NfE3hlmcNHJIirFer1ZjVuJwLBt5jUuCLe3Mpm7ESfLhhMJ2K+D2GJLORGGeGv0U OzuVMS61k1sw1s8qdfHhTdo6KtlBFxVqeXSQMC4rFftaBog64H0Wbu8R7qFHKOkbIc+pr +oRuf9qx4tu9oZuGOBDbsYsgI5O80XFZ9csyOui28EnoSVnKmvdGKsmF17Vis9sdyYh+T 5AC7lK7ACOUfdADjm15j7by7t0hiLZu7az7r9tYLt/diWNgy6NSpM260rSKVlxVHzZw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SLRsdhAk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85781606A322; Thu, 3 Dec 2026 06:59:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SLRsdhAk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 453F31F00893; Thu, 3 Dec 2026 06:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796281161; bh=AqpK5MwsnPKLxNo34QLKBgvA76ngfcL8WAgfl3He/Ks=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=SLRsdhAkHjgXdzEIl2hV43lFU3bkLexOlL5q0VFB6U7VnJw1pwdxbN/e6uDCwDcul 7t8TsHCnZ5HE9nXK2ZkmAQnkU47924Hetp/EefC82urXrThkLmJV7S8Woce4EPqlk3 +J1/hVstnb4AORYpFkv7nRf89PhDP6MdFt4qBPPSC6lEBv1UlJeKMPl8Lvr5tB42U1 239xDEvxnd1eBG7rl88hBqqY/uSCLaD+5Jwql5ypyxoEo7MlQzPAHB9ZvlrW4ZODX+ zZiBKuZt2sjOKYJ07+Msenuk1G6Yk/h+w+kpXJmyHejw0A5zQ5rj1cBNaC/8gtoBzm odAL8C87dotGg== Received: from johan by xi.lan with local (Exim 4.100.2) (envelope-from ) id 1xZ0mk-00000004cGX-2g6U; Thu, 03 Dec 2026 07:59:18 +0100 Date: Thu, 3 Dec 2026 07:59:18 +0100 From: Johan Hovold To: Lee Jones Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, "George G. Davis" , Alexandre Belloni , Dave Gerlach , Keerthy , linux-rtc@vger.kernel.org, Tony Lindgren Subject: Re: [PATCH v2 09/10] rtc: omap: prevent NULL and dangling pointer dereferences in power-off path Message-ID: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Dec 02, 2026 at 08:22:38PM +0000, Lee Jones wrote: > omap_rtc_power_off_program() is exported and called directly from > am33xx_rtc_only_idle() during suspend without checking whether > omap_rtc_power_off_rtc is NULL, causing a NULL pointer dereference if > omap_rtc_power_off_rtc was never assigned or was cleared on unbind. > Furthermore, omap_rtc_remove() only clears omap_rtc_power_off_rtc if > pm_power_off still equals omap_rtc_power_off; if another driver > overwrote pm_power_off after probe, unbinding the RTC leaves > omap_rtc_power_off_rtc pointing to freed memory for subsequent calls to > omap_rtc_power_off_program(). > > Return -ENODEV from omap_rtc_power_off_program() when > omap_rtc_power_off_rtc is NULL, and always clear omap_rtc_power_off_rtc > when removing the matching RTC instance. > > Fixes: 5a99ae0092fe ("soc: ti: pm33xx: AM437X: Add rtc_only with ddr in self-refresh support") > Closes: https://sashiko.dev/#/bug/linux-97b795c5-f68f-4228-948f-547a106c6775 > Cc: stable@vger.kernel.org > Signed-off-by: Lee Jones > --- > > v1 => v2: > - Update Fixes: tag to 5a99ae0092fe ("soc: ti: pm33xx: AM437X: Add > rtc_only with ddr in self-refresh support") and reword the commit > message accordingly (Johan) > - Drop the unrelated refactoring in omap_rtc_power_off() (Johan) Reviewed-by: Johan Hovold