mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: Linkai Gong <gonglinkai@kylinos.cn>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	 Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Wolfram Sang <wsa@kernel.org>,
	linux-i2c@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] i2c: atr: fix dangling adapter pointer on add failure
Date: Wed, 16 Sep 2026 08:09:59 +0200	[thread overview]
Message-ID: <aqoykvwKbsFS81aO@zenone.zhora.eu> (raw)
In-Reply-To: <20260907071102.1080840-1-gonglinkai@kylinos.cn>

Hi Linkai,

On Mon, Sep 07, 2026 at 03:11:02PM +0800, Linkai Gong wrote:
> i2c_atr_add_adapter() stores atr->adapter[chan_id] before
> i2c_add_adapter() so that the I2C bus notifier can match child clients
> during registration. On failure the channel is freed but the slot was
> left pointing at freed memory, which can lead to use-after-free in
> i2c_atr_del_adapter() / cleanup and also block reuse with -EEXIST.
> 
> Clear the slot on the i2c_add_adapter() error path before freeing chan.
> 
> Fixes: a076a860acae ("media: i2c: add I2C Address Translator (ATR) support")
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

pushed to i2c/i2c-fixes.

Please, next time don't send v2 as --in-reply-to.

Thank you,
Andi

      reply	other threads:[~2026-09-16  6:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  7:35 [PATCH] " Linkai Gong
2026-08-11 14:36 ` Andy Shevchenko
2026-09-07  7:07   ` Linkai Gong
2026-09-07  7:11 ` [PATCH v2] " Linkai Gong
2026-09-16  6:09   ` Andi Shyti [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=aqoykvwKbsFS81aO@zenone.zhora.eu \
    --to=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gonglinkai@kylinos.cn \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=mchehab@kernel.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=wsa@kernel.org \
    /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

all inboxes | Powered by JetHome®