From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 067A62F7F1E for ; Tue, 14 Jul 2026 14:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784038678; cv=none; b=Wat/zIHy8w8V89gK331qL90k2VZy5chKQsTKO+WW2JdoAuFURCOs4FZ4Uu2nUW/KMS2aP55jbCiSvnyQmGrfaxFXMockBm5N/eEo87wNqOVSPi1jYe5Hg+Oi9sTdyQJB631v/KEM4sbVYJffQ3mv91rpzHMZ/KABUVgMvdizNMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784038678; c=relaxed/simple; bh=NmVoz6joegwYe9CdRnyLHDSMMl4NxXUK4NpBnsbb4q0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sNafCPqvzFEmHMTB0MTOmq7NDI50QcEcKcVEp66v8wnhh261Jy9nG0dWEIlLWtUtUbi6r6PlG0Ekuq5myBjxtl3n/20SIYyM6fA7/RoCIsUXTYc83N0Ufj+cnIbsAqIt0E66CXEpD0dO6VzqLqOl+0msTbAmhdlj+MynBhNE/6M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PTZw4PXN; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=BmSaWELW; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PTZw4PXN"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="BmSaWELW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784038675; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vGE7ci+ke1IPkdZhFvGpXaKEwx50Hxeiu/Fd/UCrWm4=; b=PTZw4PXNkvjfHnvqV45NulOsoUiiArR80MOFYWzea3rFXb2vTrtr4KbzgUgqucgpMfypel TmCA+pZ5CpbgGC5BwL47ybhHJOJ15mIut/717t4BnVuG7xVf7NNL7ovAc9Juxwkd2f4bNy CLxffEyvbC0YNpTSs1KdH6NQZGK+jQE= Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-88-LmJR8BFLMaW5Hp0TGSfjMw-1; Tue, 14 Jul 2026 10:17:54 -0400 X-MC-Unique: LmJR8BFLMaW5Hp0TGSfjMw-1 X-Mimecast-MFC-AGG-ID: LmJR8BFLMaW5Hp0TGSfjMw_1784038674 Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-6a0f261aeb6so1634223eaf.3 for ; Tue, 14 Jul 2026 07:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1784038673; x=1784643473; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:content-type :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=vGE7ci+ke1IPkdZhFvGpXaKEwx50Hxeiu/Fd/UCrWm4=; b=BmSaWELWesYNnahjIdEjtnLKxtDrhdOBcYMR1hX39ggMnu0M3MO0uBUoI9f1pvLrnr ge+CNVAYLrTDKJaX+F2oRDulVf4e9MgNpx+9wiNqpciJkGLf8LbFaY1RcL7pzYzQB3QD RxxtXHTCUimV+psGn72cBAI36edjWl3NRgeMOLBo4nbSk+01woFOBXMUALqqrqOY/7nR pJgcNzIvkfdy+EsrObLxwt6XQLAvZS0dreG0q+vWcaCsIrlveVZsCggRoWb4jGYiaqYc +bXCraMtR88bXhRnIzQ8aHOy9JAwgVtEuSwoqsHo5jaYku22dN9WjBWD5Lemqnlf/O37 W41g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784038673; x=1784643473; h=user-agent:in-reply-to:content-disposition:content-type :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=vGE7ci+ke1IPkdZhFvGpXaKEwx50Hxeiu/Fd/UCrWm4=; b=YX0eZH7XBpBKFLcl7mGzoO2yfFiew/L12TTXhXnYk3MRfgZUUVDLdhLuXnUJYfoktG DMg+keHTYdD7H2B3nm5081drMDJhDMAA2nMjAMVuGLmofKD75KzAHGarAT2VF/WURlUu tqaOPtl3xJhf/8WYv68WKhMJ04qFOtfGhgf4Mi0IcWNbd7WolYzjWfVT4JDeX+ekyv1w uQQsjOHKrzQyJ1VQOxS5eF7ihP465B9P1NtnkUSwAePCjPZGw2ZJ4Y4BB6dLGJLBmgBp nLh1gqidDgGS6pq4REJJ2tG6UzztCV73WtesnNLyZcaa3xSWOLImHzSMvjKwAtRmNbis Qx/Q== X-Forwarded-Encrypted: i=1; AFNElJ/ir3Bz9bOsD3sTdd3v7okKT8f41QiQyOG+qJ0F1gAC4WH590fykKtApVJWLXlJAQB9L3TXAvmsLHn6O4c=@vger.kernel.org X-Gm-Message-State: AOJu0YwPVI3n31Qdow1phpyh8+dLjlsV+6TyilJ4yrPuHXIJSkGApV+E +xff8tPZIZ95Zhd0CEIttlOl9MvSUtA+OtxSnCok2IvGaDYQaQKfeubvbgxxeOGKkp3oUPMJf9r MTX4+UUMk6SqfeXwaSo2dbsQdNTX287dM65iBTHmN7Yc5XcyQ7zhmwaBNQBF03dvO3w== X-Gm-Gg: AfdE7ckH+2o0gQm10ozv7laGDIqBEQFtzqFl6tqMqmT23+HSsWbAt5ohDBLD7pGOHie /yUuJ/Uje9VorJ0K5wfGCcFw0/twGUXs5S8HXNAHMVhZEnx4EQIcpB17OzYmHCj1q7NyaVueCo1 QKpsNH53KB4MHc+lYAQ5EvZefy3/DX8K/fefE7xnqcszyozKE0kmBi2CeizbOP4Zs3WQ9qG8vvE hUz8hVhtncjOdZYOogesNAyehPKx3PRX2JRieBvC8oTJvoJcOLsGI70caUEynr+2riKaH02uYQB sOAGAUyX63iydcN7Xp4YSPMf8dVk/AzWf2uRbqiTMa0/1mHP3oD2a55jx8X3dJlrh+rym8tbJCG ZdYmnQFfy X-Received: by 2002:a4a:e84b:0:b0:6a0:b429:443e with SMTP id 006d021491bc7-6a39a6737edmr8060431eaf.23.1784038673598; Tue, 14 Jul 2026 07:17:53 -0700 (PDT) X-Received: by 2002:a4a:e84b:0:b0:6a0:b429:443e with SMTP id 006d021491bc7-6a39a6737edmr8060419eaf.23.1784038673181; Tue, 14 Jul 2026 07:17:53 -0700 (PDT) Received: from redhat.com ([2600:382:8527:6e7:f2a6:402c:94ff:1948]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6a36a8cb24dsm13607161eaf.14.2026.07.14.07.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 07:17:51 -0700 (PDT) Date: Tue, 14 Jul 2026 10:17:49 -0400 From: Brian Masney To: kdamaski Cc: Yifeng Huang , Xuyang Dong , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: eswin: Zero-initialize stack-allocated clk_init_data Message-ID: References: <20260710141520.285132-1-kostas.damaskinakis@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260710141520.285132-1-kostas.damaskinakis@gmail.com> User-Agent: Mutt/2.4.0 (2026-06-19) On Fri, Jul 10, 2026 at 05:15:20PM +0300, kdamaski wrote: > From: Kostas Damaskinakis > > eswin_clk_register_pll() and eswin_register_clkdiv() declare a struct > clk_init_data on the stack and only initialize some of its fields > (parent_data respectively parent_hws). clk_core_populate_parent_map() > checks parent_names first and parent_data second before falling back > to parent_hws, so leftover stack garbage in the uninitialized fields > hijacks parent resolution and the clk core dereferences a bogus > pointer: > > Unable to handle kernel NULL pointer dereference at virtual address 000000000000000c > Oops [#1] > epc : __clk_register+0x31a/0x7f0 > [] __clk_register+0x31a/0x7f0 > [] devm_clk_hw_register+0x2a/0x94 > [] eswin_register_clkdiv+0x80/0xd0 > [] eswin_clk_register_clks+0x162/0x1a0 > [] eic7700_clk_probe+0x146/0x180 > [] platform_probe+0x3c/0x7a > > Observed on EIC7700 hardware (with the driver backported to a 6.17 > tree); whether the bug triggers depends entirely on what the stack > happens to contain when the registration helpers run. > > Zero-initialize both structures. > > Fixes: cd44f127c1d4 ("clk: eswin: Add eic7700 clock driver") > Signed-off-by: Kostas Damaskinakis Reviewed-by: Brian Masney