linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Guanrui Huang <guanrui.huang@linux.alibaba.com>
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
Date: Thu, 11 Apr 2024 14:00:53 +0100	[thread overview]
Message-ID: <86pluwrr3u.wl-maz@kernel.org> (raw)
In-Reply-To: <20240411115805.115673-1-guanrui.huang@linux.alibaba.com>

On Thu, 11 Apr 2024 12:58:05 +0100,
Guanrui Huang <guanrui.huang@linux.alibaba.com> 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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2024-04-11 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 10:56 [PATCH v2] irqchip/gic-v3-its: Fix double free on error Guanrui Huang
2024-04-11 11:19 ` Marc Zyngier
2024-04-11 11:58   ` Guanrui Huang
2024-04-11 13:00     ` Marc Zyngier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86pluwrr3u.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=guanrui.huang@linux.alibaba.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shannon.zhao@linux.alibaba.com \
    --cc=tglx@linutronix.de \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).