Linux I2C development
 help / color / mirror / Atom feed
From: Peter Rosin <peda@lysator.liu.se>
To: Ahmad Byagowi <ahmadexp@gmail.com>
Cc: Andi Shyti <andi.shyti@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/3] i2c: mux: Fix channel node leak on adapter add failure
Date: Tue, 25 Aug 2026 07:49:45 +0200	[thread overview]
Message-ID: <ao0s-aS8iPx-ofLn@gryt> (raw)
In-Reply-To: <b3e46bbee781b3cb4029aca9a71316cc5e36dc17.1787502619.git.ahmadexp@gmail.com>

Den Sun, Aug 23, 2026 at 09:34:36AM -0700, skrev Ahmad Byagowi:
> i2c_mux_add_adapter() takes a reference to the Device Tree channel node
> before registering the new adapter. If adapter registration fails, the
> error path frees the private data without dropping that reference.
> 
> Release the channel node before freeing the private data.
> 
> Fixes: bc45449b1444 ("i2c/of: Automatically populate i2c mux busses from device tree data.")
> Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>

Acked-by: Peter Rosin <peda@lysator.liu.se>

Cheers,
Peter

> ---
>  drivers/i2c/i2c-mux.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> index 681a201c239b..68a4c34b5987 100644
> --- a/drivers/i2c/i2c-mux.c
> +++ b/drivers/i2c/i2c-mux.c
> @@ -408,6 +408,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
>  	return 0;
>  
>  err_free_priv:
> +	of_node_put(priv->adap.dev.of_node);
>  	kfree(priv);
>  	return ret;
>  }
> -- 
> 2.50.1 (Apple Git-155)
> 

  reply	other threads:[~2026-08-25  5:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 16:34 [PATCH v7 0/3] i2c: mux: Propagate software nodes to channel adapters Ahmad Byagowi
2026-08-23 16:34 ` [PATCH v7 1/3] i2c: mux: Fix channel node leak on adapter add failure Ahmad Byagowi
2026-08-25  5:49   ` Peter Rosin [this message]
2026-08-23 16:34 ` [PATCH v7 2/3] i2c: mux: Factor out channel node lookup Ahmad Byagowi
2026-08-25  5:50   ` Peter Rosin
2026-08-23 16:34 ` [PATCH v7 3/3] i2c: mux: Propagate software nodes to channel adapters Ahmad Byagowi
2026-08-25  5:50   ` Peter Rosin
     [not found]     ` <CAOQiBWNVvHpO7X8yWyZEa3-nV76YJfRbkzo+_4U-upEj4VNfow@mail.gmail.com>
2026-08-26 16:39       ` Ahmad Byagowi
2026-08-26 13:45 ` [PATCH v7 0/3] " Andi Shyti

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=ao0s-aS8iPx-ofLn@gryt \
    --to=peda@lysator.liu.se \
    --cc=ahmadexp@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.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