Article View: linux.kernel.netdev
Article #1104Re: [PATCH] ipconfig: fix use-after-free of device list after ic_close_devs()
From: Eric Dumazet
Date: Fri, 09 Oct 2026 08:04
Date: Fri, 09 Oct 2026 08:04
71 lines
8903 bytes
8903 bytes
Le ven. 9 oct. 2026 Γ 09:45, Henry Martin <bsdhenrymartin@gmail.com> a Γ©crit :
>
> 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 reply
> consists of an OFFER that is never followed by an ACK (a misbehaving
> or lossy DHCP server, or a network that drops the ACK), the boot-time
> autoconfiguration loop becomes vulnerable:
>
> 1. ic_bootp_recv() accepts the OFFER and records ic_dev = <list
> node> ("We have a winner!" state);
> 2. the retransmit round times out in ic_dynamic(), so
> ic_close_devs() frees the whole list β node included;
> 3. the dynamic retry path (try_try_again) runs ic_open_devs() and
> ic_dynamic() again; on failure it falls through ic_close_devs()
> once more, where the entry point evaluates
>
> struct net_device *selected_dev = ic_dev ? ic_dev->dev : NULL;
>
> β an 8-byte use-after-free read against the freed ic_device.
>
>
> NULL both pointers after the free loop so subsequent retry rounds
> take the clean empty-list path instead of acting on freed entries.
>
> This vulnerability was discovered by Tencent CodeBuddy Security.
This is __init code, on a boot that already failed to get a lease.
I would not call it a vulnerability.
>
> Cc: stable@vger.kernel.org
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Wrong tag. In 2.6.12 ic_dev was a 'struct net_device *' that was only
compared, never dereferenced. The dereference came in v5.12 with:
Fixes: 46acf7bdbc72 ("Revert "net: ipv4: handle DSA enabled master
network devices"")
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
> ---
> net/ipv4/ipconfig.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
> index 1b8585404a41..ac4851e59c3b 100644
> --- a/net/ipv4/ipconfig.c
> +++ b/net/ipv4/ipconfig.c
> @@ -346,6 +346,13 @@ static void __init ic_close_devs(void)
> kfree(d);
> }
> rtnl_unlock();
> +
> + /* The whole ic_device list was just kfree()'d above; clear the
> + * static pointers so retry rounds (e.g. dynamic retry after an
> + * OFFER without ACK) don't dereference them (use-after-free).
> + */
> + ic_first_dev = NULL;
> + ic_dev = NULL;
> }
The change looks correct, but the comment is not needed.
Please send a V2 (in more than 24 hours) targeting the net tree
([PATCH net v2]).
Thanks.
pw-bot: cr
Technical Details
Message-ID:
<CAL4WiipX3uc6FD1=saqEthm+PTCKkoY=J7cXRf9R9FTqd68raw@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343502-linux-kernel-netdev=dewy.ruReferences:
<20261009074523.2747168-1-bsdhenrymartin@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343502-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] ipconfig: fix use-after-free of device list after ic_close_devs()
Date: Fri, 9 Oct 2026 10:04:03 +0200
Organization: Usenet Network
Message-ID: <CAL4WiipX3uc6FD1=saqEthm+PTCKkoY=J7cXRf9R9FTqd68raw@mail.gmail.com>
References: <20261009074523.2747168-1-bsdhenrymartin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="1060075"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3FC55rzjN4Ifo1LPCXek1grO+Z4= sha256:heWSQPErKmsh9t60CT9AyAT70BRs6IOe+q2wcZK2sHQ=
sha1:qGiw/EEhvLs18uVTbdFE9MWIf3c= sha256:Hj6gOI7TWBqZsW7jhIj/qS/fjYeUmvIGGFEfLUBrzig=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 61F8410F5FC; Fri, 9 Oct 2026 11:04:33 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.441
X-Spam-Status: No, score=-1.441 tagged_above=-9999 required=6.31
tests=[DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id pFP2W7XcfM6J;
Fri, 9 Oct 2026 11:04:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-343502-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 28B2E10F5F2; Fri, 9 Oct 2026 11:04:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sto.lore.kernel.org (Postfix) with ESMTP id 67917609453; Fri, 9 Oct 2026 08:04:22 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D752376BF7;
Fri, 9 Oct 2026 08:04:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hd2yY7Bf"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
(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 E478D492E4E
for <netdev@vger.kernel.org>; Fri, 9 Oct 2026 08:04:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791533058; cv=none; b=pKnQ9ax3xsJ4tQ+Issb7pRhXEaIbrIU8d8e+VnZXetjXI8BB1rGCLj6u8S7ejWUQSr8xILYJrALIYE6nDg+DVkNNTeCnGBcQ40nMq80HMOuc35dln7dox8IQFD8PimFYeYSnw+6Ke6yD8OXhgxrjpEC0B2N6xk2XKA7KnLr8WAk=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791533058; c=relaxed/simple;
bh=0y74i2STDjmKr4lBePoInGDutw/6C+poWpHkbdAVK1I=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=ZMw1vkCpllpJCK1P7z28hty54II6NY0xnZFGZGUFKSnt7u9CQy/JbRrvQrXcTGtmfGeSdrpUmVEoQp3qlxIBV3DfQ+HPbJ/VoUdTXqC7pIRFe5FWDHBLGp3IiEFBo84a/58bJGd1O4naWGIUXsReea0fu4GYdK34vzfSHAKpEtI=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hd2yY7Bf; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 693711F00893
for <netdev@vger.kernel.org>; Fri, 9 Oct 2026 08:04:15 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1791533055;
bh=s/5A+ZClw8uFOpyIi+IWKMRcAZDloocaw/uDqLtwjvM=;
h=References:In-Reply-To:From:Date:Subject:To:Cc;
b=Hd2yY7Bf/6HQv2JT31eHw4xxh6qv2pVK2+TKA8ZZGIN+Fepttoygqwu8OGSD6E3JT
WVW5BGva4e8Mp5TXySE3UdShEOmo7j3JK7BcR8aWYW3hEJ3UNo+973//1z9xefJJa1
E6dytF5qet5tUAjrmBLU38VdIuerB97XgCwIzJz+JX2sgrLXbJHEjgPKVAambKGcuJ
R//Qczr4xpAX5vpu8sjsHRcTlorJmH99LH/GBKvT/I+q33GJEZOmJ6gFLD+7cage1e
9gUAde6xeQa1VaZt5kRBE94YLVgAmuEH6krMMIFliCM3Y0/O4oeBNttM1V1LNgi1CV
o9+kr/XnqTqlA==
X-Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-49e5f85ce89so1592768fac.0
for <netdev@vger.kernel.org>; Fri, 09 Oct 2026 01:04:15 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvBx2wp2eAdDxuJWhHOsoYNq034LpLEUAH2HCF20eCv7hV8h5ylPm02pUYMCNFVZ0ZEUWsw4euXA=@vger.kernel.org
X-Gm-Message-State: AFq9FYIyBio5PKjwp3pHQ60PrKuq1E0jGSwDD5JdfeVrK30P2p2r6F9w
RodnESPSoOi1UAFPC6Oj80rDBIPoeJZTRPZP3Ddp9zwWJc6oi2HYehH7BKo1MkVw4pYPPMlGmnA
omfams1lFpYcorUaUdnzAWS0DjztroqU=
X-Received: by 2002:a05:6870:6493:b0:4a2:4d77:866d with SMTP id
586e51a60fabf-4a2a87ff162mr990737fac.11.1791533054730; Fri, 09 Oct 2026
01:04:14 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261009074523.2747168-1-bsdhenrymartin@gmail.com>
X-Gmail-Original-Message-ID: <CAL4WiipX3uc6FD1=saqEthm+PTCKkoY=J7cXRf9R9FTqd68raw@mail.gmail.com>
X-Gm-Features: AclHuK8ltwaJAIjTWP05-fE44s7cCMnjL8O00smo3LgS1FtFj3W92as-vTo_gZ4
X-Cc: David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>,
"David S . Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org