Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp374896lqg; Thu, 11 Apr 2024 06:01:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlaTeW4tzp0F5SMmmg4MtOlb/p25RSNT1XIWKt3dG/I+kd6jzB6O9FZDnLo07Y6moh053pSxUvRJrH0Grs0RXD6yYvaJEinLlAV/qdwg== X-Google-Smtp-Source: AGHT+IHIR2neppI0cUGwhcpGXA9GPjJPDcF1jFRZiXNPv094vUw+lCyKlKUkp2eK80OOIiKJ1Lk2 X-Received: by 2002:a50:d7d9:0:b0:56f:e58f:31f7 with SMTP id m25-20020a50d7d9000000b0056fe58f31f7mr1510286edj.28.1712840464209; Thu, 11 Apr 2024 06:01:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712840464; cv=pass; d=google.com; s=arc-20160816; b=g2IwkE2NR2FegZ0jtthg1+3OddE2uzRCsIVPaTzeKynX0PDcyKUz1/o1Q9JJsJv8rc iGqpIyLCm4ZJ0VLclibj1lJ5eCdt3wEfsP9Tqm7MDG7lK3ckE5Ww9Rkx2opQ/BrSLlyd 7z2Xu76qxvpqj3i8nHCPcpHoBnVm8NsSdLzvqFBJshZUUY1P48hUibQZt6Z5CxKXWVRO 4EVomUXfTOaWC5khIBODN1mQ9+FRRaSZg9kfq2HHqnnaqM9Xy6FcZH8X6MIMQt1U46Gi +p8vZ1Gnl1HT6tbuXTD5fA1QMqKVPt2k8jxqiazbIbex6qmy4u3xRhAgo/JC3V1svQJe tzPw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=DUUn0FY8paahkGe0QqhCKrEZIiSw7SkFD9ia9yiqMow=; fh=GJqY5OFnnI1tCUicnDP03SvYBDY/WoNToeWzyP5M4zg=; b=YLSpRPgxVKlrw0fNQgYC+IIKwMPMRlZa5Pvro9KxvNOrdPBsImyvqgbjXY7Fn4fnDB sT69DFn5ape5TfES6orCC+R4V2L4m/NaeZsa22TTGB/a7N2WuGEMQ/VaNRUg8LvT3Efg oO1WD5mz/eahlUwhGXIZdKst9C0uDoQW3AUpHwU0hf/HC1ADx3e0sM344uvS4gxr/tqx Dne8g0ejRovixOErtt5HVzhIeW5yJ7a7iLuqLY1pzM28qlBBkp7KpesSnIlPEf2K+9Lh izfN6ZBaPZsk8TBBI4sX5fo5Y57lJhObCBe3JFkAGV+zhKqd4m9n7bLSBJz7tNCMf7be 7vGw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lLvYw14k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-140475-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t24-20020a508d58000000b0056e759bdc15si717655edt.140.2024.04.11.06.01.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 06:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140475-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lLvYw14k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-140475-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E68081F2199B for ; Thu, 11 Apr 2024 13:01:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B0D5146D7C; Thu, 11 Apr 2024 13:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lLvYw14k" 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 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.