All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Henry Martin <bsdhenrymartin@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net v2] ipconfig: fix use-after-free of device list after ic_close_devs()
Date: Fri, 16 Oct 2026 18:00:07 +0100	[thread overview]
Message-ID: <20261016170007.GH363352@horms.kernel.org> (raw)
In-Reply-To: <20261010085003.3261587-1-bsdhenrymartin@gmail.com>

On Sat, Oct 10, 2026 at 04:49:58PM +0800, Henry Martin wrote:
> ic_close_devs() kfree()s every ic_device node but leaves the static
> ic_first_dev and ic_dev pointers dangling behind.  When a DHCP
> negotiation gets an OFFER but never the matching ACK, ic_bootp_recv()
> accepts the OFFER and records ic_dev = <list node>, the round times
> out and ic_close_devs() frees the whole list — node included.  The
> next failed retry round runs ic_close_devs() once more, evaluating
> 
>     selected_dev = ic_dev ? ic_dev->dev : NULL;
> 
> against the freed ic_device — an 8-byte use-after-free read.
> 
> KASAN confirms:
> 
>   BUG: KASAN: slab-use-after-free in ic_close_devs+0x214/0x220
>   Read of size 8
>     ic_close_devs    <- ip_auto_config
>   Allocated by: ip_auto_config (ic_open_devs)
>   Freed by:      ic_close_devs <- ip_auto_config
> 
> NULL both pointers after the free loop so retry rounds take the
> clean empty-list path.
> 
> This memory-safety issue was discovered by Tencent CodeBuddy Security.
> 
> Cc: stable@vger.kernel.org
> Fixes: 46acf7bdbc72 ("Revert "net: ipv4: handle DSA enabled master network devices"")
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
> ---
> Changes in v2:
>  - Fixes: tag corrected to the commit that introduced the ic_dev->dev
>    dereference that makes this a UAF (46acf7bdbc72); in 2.6.12 ic_dev
>    was a struct net_device * that was only compared, never dereferenced.
>  - Code comment in ic_close_devs() dropped per review.
>  - Message reduced to the memory-safety mechanism (no vulnerability
>    framing).

Thanks for the updates.

Reviewed-by: Simon Horman <horms@kernel.org>

  reply	other threads:[~2026-10-16 17:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10  8:49 [PATCH net v2] ipconfig: fix use-after-free of device list after ic_close_devs() Henry Martin
2026-10-16 17:00 ` Simon Horman [this message]
2026-10-17  0:50 ` patchwork-bot+netdevbpf

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=20261016170007.GH363352@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=bsdhenrymartin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=vladimir.oltean@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.