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 7C8AA1EB26 for ; Thu, 11 Apr 2024 13:00:57 +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=1712840457; cv=none; b=a8OydxmP9cPa/a4k6dTLHNusl/R8F/mJDIrT16loNojYK4Q154Jin2fbxA/Ci/w8B/5Z/XiJJiCxBCQQDFOu6YRiozVZdfEuBjTu60z/tAJQHi3CHuKAT6gXX0N5i//AKWfkLuetb8N2oxqxoAfNnGNCUF9u69SsCen/kjW3dek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712840457; c=relaxed/simple; bh=98TrFhUIOGBPLgvKQW9yiisACadTMu7wmvJOzNKD9mg=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=n/STeNSgFq1gAgRH6m6DGKV2QC7NcfTAouq6lhk4uFcBfR0IvVhmY6bkPTAI+mc4a9+bBeqtwwKFauzZ7uAz7mc+SIiYBfyhG4XflmpHkwwukogWCJHR1VIFe4YcSrnufRcGo2kwLbVGo4yZ2RsZv9mpltLKNG1QKPsvwb040FI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lLvYw14k; 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="lLvYw14k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A1F7C43390; Thu, 11 Apr 2024 13:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712840457; bh=98TrFhUIOGBPLgvKQW9yiisACadTMu7wmvJOzNKD9mg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lLvYw14kjYbXUT/XD6jSaVNTNMrZ8qsDrIN+dhsW5GS1vLg75iHBz+EiNxAWF6bZA +DDpzPLfMKK/EZumhAKlCXuWZDmfs9N5oI8R/g+8aBxefLYu5NvwZ9bqfIfoFRMeTR 416KlX1mEYk4y3T6EdmVgxMxfRJN+0J1vUvN6AUDnQzXwUlEuXiXFnTEPF8F+zRz5w mCNEU6hPzukTUNpSkVUMcMGLzP8goIMtfJePBCxdTVrfkAlGSVyBqDHGscsnywBskw g1/YdcdwgiwN7DikS9Scofv1kN3GB3FW4mgzsO2I/MNopOQmWawIXExW/J/LcbVEzB bB/GPNi5mQaJQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ruu2w-003Twy-N3; Thu, 11 Apr 2024 14:00:54 +0100 Date: Thu, 11 Apr 2024 14:00:53 +0100 Message-ID: <86pluwrr3u.wl-maz@kernel.org> From: Marc Zyngier To: Guanrui Huang Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, shannon.zhao@linux.alibaba.com, tglx@linutronix.de, yuzenghui@huawei.com Subject: Re: [PATCH v2] irqchip/gic-v3-its: Fix double free on error In-Reply-To: <20240411115805.115673-1-guanrui.huang@linux.alibaba.com> References: <86r0fcrvsz.wl-maz@kernel.org> <20240411115805.115673-1-guanrui.huang@linux.alibaba.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: guanrui.huang@linux.alibaba.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, shannon.zhao@linux.alibaba.com, tglx@linutronix.de, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 11 Apr 2024 12:58:05 +0100, Guanrui Huang wrote: > > if (vm != domain->host_data) > > This is just a safety check. It looks unlikely happened. It's not a safety check. It is just papering over problems. If you don't trust the vm pointer, why do you trust the domain pointer? Why do you trust *anything* at all? > After all, vm is obtained from the args. If the caller has a bug, > can we check here to avoid possible problems that may arise in later > code? If the caller has a bug, please fix the caller. Don't paper over it. And you can remove the BUG_ON(!vm) which is equally useless. Thanks, M. -- Without deviation from the norm, progress is not possible.