From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 4CE6037FF43; Mon, 20 Apr 2026 03:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776655734; cv=none; b=LHkrknF+IDXv9jCsD3sNjtbj10vpfjRZtlUNu/bDTJVa7busMCHEGRldSSaN/fJ7kqpyQf1vwGwa4maAXP+GgRuYu29FvXZGXMb62XYk62xsqikwQA1C5dJEUldCXUAwVsWGOVYvzZwXaOkQUe5++4/DvMjF2T9dGGX1NeWo/KI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776655734; c=relaxed/simple; bh=Nv0sOyHGylTYMSmYdCuitXzs0jn7nV2QHj8+3s7nF+c=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BI0l461oqs5dCwoZfeXMOzIU0y9IrQ9i/iQHg6rFfNH8dxgqgFcNUKlhgByYgkTbF1lLNfyAPcnZHiOE6ovlDDsiK5wDZZHfRBsaj+33OnHT1Nd9JlT5fPRld7P8JPMviPZroO3XDXWIf486zcZ2RiOxM1QQXxyvMhyIH398vVQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 0a2489fa3c6911f1aa26b74ffac11d73-20260420 X-CID-CACHE: Type:Local,Time:202604201115+08,HitQuantity:1 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:1bfbf80e-9ab9-4126-beb2-92fb118b84d2,IP:0,U RL:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:e7bac3a,CLOUDID:6616c3197f7ca96d3a9f256850da7138,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|850|898,TC:nil,Content:0|15|50,EDM:2 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 0a2489fa3c6911f1aa26b74ffac11d73-20260420 X-User: lilinmao@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1852436667; Mon, 20 Apr 2026 11:28:46 +0800 From: Linmao Li To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Linmao Li Subject: [PATCH net] ipv6: addrconf: skip ERRDAD transition when address already DEAD Date: Mon, 20 Apr 2026 11:28:42 +0800 Message-Id: <20260420032842.1063277-1-lilinmao@kylinos.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit addrconf_dad_end() transitions ifp->state from DAD to POSTDAD under ifp->lock and releases the lock. addrconf_dad_failure() takes ifp->lock again with the spin_lock_bh() following the net_info_ratelimited() duplicate-address log. A concurrent ipv6_del_addr() can acquire the lock in that window, set ifp->state to DEAD and run list_del_rcu(&ifp->if_list). addrconf_dad_failure() then overwrites DEAD with ERRDAD at errdad: and schedules a new dad_work. The work calls ipv6_del_addr() again, hitting the already-poisoned list entry: general protection fault: 0000 [#1] SMP NOPTI CPU: 4 PID: 217 Comm: kworker/4:1 Workqueue: ipv6_addrconf addrconf_dad_work RIP: 0010:ipv6_del_addr+0xe9/0x280 RAX: dead000000000122 Call Trace: addrconf_dad_stop+0x113/0x140 addrconf_dad_work+0x28c/0x430 process_one_work+0x1eb/0x3b0 worker_thread+0x4d/0x400 kthread+0x104/0x140 ret_from_fork+0x35/0x40 Bail out at errdad: when ifp->state is already DEAD. The existing in6_ifa_put() releases the reference taken for this invocation. Signed-off-by: Linmao Li --- net/ipv6/addrconf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 5476b6536eb7..14b1ab43da87 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2227,6 +2227,12 @@ void addrconf_dad_failure(struct sk_buff *skb, struct inet6_ifaddr *ifp) errdad: /* transition from _POSTDAD to _ERRDAD */ + if (ifp->state == INET6_IFADDR_STATE_DEAD) { + /* ipv6_del_addr() already removed ifp while lock was dropped */ + spin_unlock_bh(&ifp->lock); + in6_ifa_put(ifp); + return; + } ifp->state = INET6_IFADDR_STATE_ERRDAD; spin_unlock_bh(&ifp->lock); -- 2.25.1