From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (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 4E31231F98C for ; Tue, 7 Jul 2026 06:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.96.220.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783406066; cv=none; b=Uwn2bmbRm/bcrauEtvkTrTWBXPIaNQpzRMyvBYePKF8tcGXKi1Xv7ppndYqHU4qcRNcWzoZKV6RdcDQriSENXJeB++04XXHcduJovKz19Y53lCfM/blJOpBwMyYPooG8073i32VaD4u2tPkPghFoNfXn2DCJw6598SSyGYcoedg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783406066; c=relaxed/simple; bh=k11VdWHwY3cjmoxE1M32L0f9O0Yb6PtQ+fpGkmGMnt8=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Jz6KIWgeao1aKk/EaoKcpwPJl2HOtelZCdA4ltrI9iM/xVnST1VtZBIh/e21P7AtYeDZigsk3Ac7UVSWbTMmwdS/ejBB+lJE/8FYmT1FWwQ2VtkpAI+7SWG+RP3yVLBGCY1WLloZfwEUiXXcyOGlfRvPkmOEzwtSy02yu2B7ais= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b=F/5ljjGb; arc=none smtp.client-ip=62.96.220.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b="F/5ljjGb" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 8DBB620684; Tue, 7 Jul 2026 08:34:23 +0200 (CEST) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PPOsmWHX3Tdd; Tue, 7 Jul 2026 08:34:23 +0200 (CEST) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id ED670201A7; Tue, 7 Jul 2026 08:34:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com ED670201A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1783406063; bh=vjJsBw3BtA6cE34lD/Mmnxd3QgrZqy4aN7wcsT/LSM4=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=F/5ljjGb7Tw9xX0VnUzGtS2PObszEvQhp6csTZ/dN7UWe7z/LHtNtCABb4OCuh0IM WdoobmkYyAdUGz0+DQyXHqfEoX1kbt7EMmkDQ1k9qWjkNAW48Hh6+kckbI6bZiFaHd JRct4vFhj3JFvpgWZySzWWMPG9upVDs56SitimpwhG8z6eE2pyHKO+fxO8Fkvwe4cZ CHrz/vda9RZzA2wnI7ecd77TUnSvE1WRDxQ22k1COcbfbs09F02xhqR6/XU+V9PBK6 qAQINtaJYYVyrdzB/vPLpEYIX+bnVC+iaL7d93g00h/JOp8n1yHGu7BW+3iblUhYLS vxpwQJxGYI1Bg== Received: from secunet.com (10.182.7.193) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Tue, 7 Jul 2026 08:34:22 +0200 Received: (nullmailer pid 204818 invoked by uid 1000); Tue, 07 Jul 2026 06:34:21 -0000 Date: Tue, 7 Jul 2026 08:34:21 +0200 From: Steffen Klassert To: "Xiang Mei (Microsoft)" CC: Herbert Xu , "David S . Miller" , , Simon Horman , Eric Dumazet , Jakub Kicinski , Paolo Abeni , , , Subject: Re: [PATCH ipsec] xfrm6: clear dst.dev on error to avoid double netdev_put in xfrm6_fill_dst() Message-ID: References: <20260702010516.221830-1-xmei5@asu.edu> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20260702010516.221830-1-xmei5@asu.edu> X-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-01.secunet.de (10.32.0.171) On Thu, Jul 02, 2026 at 01:05:16AM +0000, Xiang Mei (Microsoft) wrote: > On the error path where in6_dev_get(dev) returns NULL, xfrm6_fill_dst() > releases the device reference with netdev_put() but leaves > xdst->u.dst.dev set. dst_destroy() later calls netdev_put(dst->dev) > again, so the same net_device reference is released twice, underflowing > its refcount (ref_tracker WARNING + "unregister_netdevice: waiting for > to become free"). > > Clear xdst->u.dst.dev after the netdev_put(), the same way the XFRM > device-offload paths xfrm_dev_state_add() and xfrm_dev_policy_add() in > net/xfrm/xfrm_device.c NULL ->dev when releasing the reference on error. > > ref_tracker: reference already released. > ref_tracker: allocated in: > xfrm6_fill_dst (net/ipv6/xfrm6_policy.c:86) > ... > udpv6_sendmsg (net/ipv6/udp.c:1696) > ... > ref_tracker: freed in: > xfrm6_fill_dst (net/ipv6/xfrm6_policy.c:90) > ... > WARNING: lib/ref_tracker.c:322 at ref_tracker_free+0x58b/0x780 > dst_destroy (net/core/dst.c:115) > rcu_core > handle_softirqs > ... > > Fixes: 84c4a9dfbf43 ("xfrm6: release dev before returning error") > Reported-by: AutonomousCodeSecurity@microsoft.com > Signed-off-by: Xiang Mei (Microsoft) Applied, thanks a lot!