From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 581233FE35D for ; Tue, 24 Mar 2026 13:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774360031; cv=none; b=U4UJm/iOldiXnLrqJEEB+lLZSX2NRlifKj61TUTKKajFrJ5ZeL8Q/QPTzF+lL6r8qiJWHHs+dlCF/7XWmOzA8RNPs+daMLOqd++72DLDByAM+q9dRpZjasN/S3N4LAMirkaDC4nhviY22Gs8gUEBRovHH2k79o9IGMGUaG0xaJ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774360031; c=relaxed/simple; bh=P7hdlk9agELe0A1qr6nFer12udYaXk1PPxLMDqx39ZA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qOHqpzIus/3A/+uM0H02zqwMX9lEOYyJ4XiDMrvOZ/9+AD6kJnpcSMEiuPC9IBSrtfR4aeMsTc6H4x7/2R7vG62fwLvhJsa3Pdz4iKqYcGDW5xbu1aP1W7uiDwMhISz37AkTzOdN5tMDtPrs87JhTQzE7+R2qlv5EWoNyQQcD9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YTPWewIy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YTPWewIy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E28DC2BC87; Tue, 24 Mar 2026 13:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774360031; bh=P7hdlk9agELe0A1qr6nFer12udYaXk1PPxLMDqx39ZA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=YTPWewIy2XjmxYlPmx78726H6Q3b3o2/K/XUTePzsvwm3uznu6RxSQ9VVOI3XlzOG HsrbKbDCx3m9YmyaD3qdFsMmBHphI8gV8cNWgVIhnQPUqzkVJcCVavloxupaiM3Bm6 gr3e0Px4RcxCPcL83D1wX9JJc6dId3W2C4QqzltZ/kcXDNKp3m5fD4ExEn6LR+XdUP PelNtyhfO1qewjmDgvfR6vVAiq3X/L5HZs831H4nzB/UTtvqLpliKm4Brg2uWgVMzM 9xAQxVjmsfR7x8Rkzygwl+RYpr/4lCFYaT1TqD0D9iSWCxDdCbIPG8WQDVTWpttBID 43LOH87Q4rQ6Q== Message-ID: <780c1ba3-6639-478e-896f-e35ec059b58c@kernel.org> Date: Tue, 24 Mar 2026 14:47:06 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] soc: fsl: qe: Fix potential NULL pointer dereference inqe_reset() To: =?UTF-8?B?5pyq5ZCb?= <1742789905@qq.com>, "qiang.zhao" , linux-arm-kernel , linuxppc-dev Cc: linux-kernel References: <7e0425c2-debe-448a-a5f9-26039de71db5@kernel.org> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Le 16/03/2026 à 04:28, 未君 a écrit : > > Vous n’obtenez pas souvent d’e-mail à partir de 1742789905@qq.com. > Pourquoi c’est important > > > Hi, > > Thank you for the detailed review. You are completely right. > > My commit message was confusing, and returning early in qe_reset() just > shifts the NULL pointer dereference to the dependent drivers later on, > without actually fixing the root cause. > > To achieve what you suggested ("if qe_immr remap fails, all drivers > depending on it don't get probed"), I plan to do the following in the v2 > patch: > > 1. Change the return type of qe_reset() from `void` to `int`. > 2. Return `-ENOMEM` if the ioremap() fails. > 3. Update the callers of qe_reset() (e.g., qe_probe() and other board- > specific setup functions) to check this return value. If qe_reset() > fails, the callers will abort their initialization/probing, which will > properly prevent the child devices from being probed. > > Does this approach sound correct to you? If so, I will prepare and > submit the v2 patch accordingly. Well, it would probably work but is it worth it ? If the board is already unable to get a few bytes of memory that early in the boot process it is unlikely that it will be able to do much more work. Wouldn't it be good enough to just panic() when ioremap() fails, similar to what happens when qe_sdma_init() fails, see https://elixir.bootlin.com/linux/v7.0-rc5/source/drivers/soc/fsl/qe/qe.c#L101 Christophe