From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (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 97D3E340DB0 for ; Tue, 3 Feb 2026 14:03:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770127400; cv=none; b=jhs9hPo5XrLzXM8rRBXhepgdNDyc+pgPkZ2DxC1FWG0kmNf2w/UxekHguvtB5DyR09DEp5SUVYwTHXKcDFEOtS3b1iEVD6KLXgD7W25fSuWyaFybuRfzakeDXp23Fpm7u0pXni/NLtj2bkCL7kPDGBNJeIPfx3Lbc+rucYnpRWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770127400; c=relaxed/simple; bh=eqlA3EqmxLfxE7QaoNTcC3oTDfV63ivVGxnH0rWO/AA=; h=Mime-Version:Content-Type:Date:Message-Id:From:To:Cc:Subject: References:In-Reply-To; b=Or3Za1bCLZdeSJhsu9w2N/xau+BFstLIQwB8S0UHVQsTvlWWa4OiEr+3mF6cFuyBs1xn712VlY35g1LvdYuHr9weSdIJEyFffHAC7w3MH/30+OCeC7XG836ElYtPru0JbpGiRLmHPfbZQ8/x6sbq6CGPj07mBPVahI23EA0rNCI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=l2MemYRl; arc=none smtp.client-ip=95.215.58.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="l2MemYRl" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1770127396; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NRrkh3Ad3sEIOvwMJAakZ3eaeEUS2YBl+bQjyr22hDM=; b=l2MemYRlC4Fr1R/MCS5VKCnOQj4gfgs+xBP7IzHZ3qhkVcuCqfMOX7aLlr4kjOeMcf2CUk lG9KwbO2RqNqgHGI3YmFcYLIrhi5LydtItW9ZaAfMWJwu++dRnJZAYdMt0FOs72oKJOhjQ stjaVuYPuJd7HQJpE4xHrGDuQ77AwUo= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 03 Feb 2026 22:02:33 +0800 Message-Id: X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Ze Huang" To: "Linus Walleij" , "Jiayu Du" Cc: , , , , , , , , Subject: Re: [PATCH v2] pinctrl: canaan: k230: Fix NULL pointer dereference when parsing devicetree References: <20251228154947.194684-1-jiayu.riscv@isrc.iscas.ac.cn> In-Reply-To: X-Migadu-Flow: FLOW_OUT On Tue Feb 3, 2026 at 8:32 AM CST, Linus Walleij wrote: > On Sun, Dec 28, 2025 at 4:53=E2=80=AFPM Jiayu Du wrote: > >> When probing the k230 pinctrl driver, the kernel triggers a NULL pointer >> dereference. The crash trace showed: >> [ 0.732084] Unable to handle kernel NULL pointer dereference at virtu= al address 0000000000000068 >> [ 0.740737] ... >> [ 0.776296] epc : k230_pinctrl_probe+0x1be/0x4fc >> >> In k230_pinctrl_parse_functions(), we attempt to retrieve the device >> pointer via info->pctl_dev->dev, but info->pctl_dev is only initialized >> after k230_pinctrl_parse_dt() completes. >> >> At the time of DT parsing, info->pctl_dev is still NULL, leading to >> the invalid dereference of info->pctl_dev->dev. >> >> Use the already available device pointer from platform_device >> instead of accessing through uninitialized pctl_dev. >> >> Fixes: d94a32ac688f ("pinctrl: canaan: k230: Fix order of DT parse and p= inctrl register") >> Signed-off-by: Jiayu Du > > Patch applied! > > Sorry for missing this, I was waiting for maintainer feedback > but it never arrived. > > Yours, > Linus Walleij Hi Linus, Jiayu, Apologies for the delay. I tested this on k230; it fixes the NULL pointer dereference during pinctrl probing. The approach is correct. Thanks to you both! Best regards, Ze Huang