From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB41E3905EC for ; Fri, 17 Jul 2026 18:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784314646; cv=none; b=J0Id1AmtlkEee0qxsiOUEhTfIcBkpTE0e4H20CgS0lUt6vZN329uhbPjb+7xx4C8jFZByMTI+Lw4XAtrRKR8PTaoMHC3YEz4c6QUHRX8A1aO2X0I1QoXyZJzNz12UgZxsoQfLL0tuxq7YpEwQeSAbAcQsmywOiL557V8WPoMobw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784314646; c=relaxed/simple; bh=1F1SE1lLP/oS3nzGeTd/9IBL0aREwzGS+Bo3bJtQMdw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AdalgOVaZRGGNEO/Wij1pnRKg3ujFR313TRFZVOvWyCkLvujs5gbrSFHVQ7xrMzzATKZCBknzir6Cf84MTcM9+JqyJNtHDJwuTdCpwoAXo0Ku7/AQmVj5mLP9EfdvGtfqMBxSKXtpaSSrE/3kwCJNtb+DKRRSa1ixxLeyDzfH9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gsFMA99E; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gsFMA99E" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-848479c9bd5so3853808b3a.3 for ; Fri, 17 Jul 2026 11:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784314644; x=1784919444; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=joB5XdEMkRYTFOe6oQxV2wUDblqkRFAT1rpZftZWDv8=; b=gsFMA99EfPG7VxxbP/T+hdSq0a8HGgOyQHeviAw40zTvPK/cCJG5M+t4OGeUIsDkYG fW3nhFMA+Dl+RtjdoMvlA7hxMNbV/woo78qEDtAt6p9QdqSu+CHhVOceCqv7BKPd/ehi r2VhvCnLoMgM1Nqr+xciqK+1kbCpHILOMhm8VAPxowY5ACMAADv8MbXjviVBBoDVEZJb CrZ1SCG0oHqxxgjXRLn+OPdvvvJcTwmOFEPno5WUSj/lcTdGTbzP5haMMwszYxMkRgtK Sv0Ng/ksRTb5sNfiilAAIk5LCTLl+gEdfbVZiCKuESyOvZ3Cf3Y0HJiMBtLmRCVgmD/e xYoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784314644; x=1784919444; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=joB5XdEMkRYTFOe6oQxV2wUDblqkRFAT1rpZftZWDv8=; b=tAilAP/rvirkBPxtcJKXxgJdIOeOD1CAFUNwiB0IZGSrowRxc0+Jd5Ym0VMuEE28Uk /HOQRITQZ8oaRJCMsozSJpvEfC5nIUOQYtZzgyG7M4yMQFOy0QgPZ/9mSEyXxEtG6UnZ aN7XOFT4JFA2y+9x9zBVCGVZwHhS9Hmvhvz4arkQ5HjS4XkC0vj7WmPaM0r8D97Jak2w bSgheUSf7vljc2TV8QVO0han6rOcMuxE0vEzzy+SIAKUKgCZkukVp/dW+zKrjAD14VFN JH/X0MOrfCI678O4lXH38E0+D5YCA+OpFLZ6kz9m9Mb5qAv/qnUqKNDvqfbc3LsBe+V8 9Z7g== X-Forwarded-Encrypted: i=1; AHgh+RplPfucNWZSWJYA00x++SqqnAVh2OwofEHhtP7gX6HKEPHMckDWVYeN8CfUIM2XT7MrYo5HF+57dVGTkUM=@vger.kernel.org X-Gm-Message-State: AOJu0YwVrIeaCyxPVPZAMXufrK5nczc87wZvJ06DZYMQplWT2mpJ5djy Q7/rOq/ezRtW5tzdSZp5zLQ+dTWU84i0ROvP6cZ9f0nFnAvnUl0UNi/4 X-Gm-Gg: AfdE7ck+NoywibbAUIewwEVDl6FGIxHM7rf8Sx4EPrZowaZI8NUKS+d5OHNuVYPecrX jLhB5fZDhNPhrkksx6z+jzOM2+oh8Bd/HUJcXj0jTApQn0kj6rtW+lw8kGlasRSR2mS2rVu+KRt N4290LnkToN5cqUs+xtHZ5grQPoClDzlWEkhcHDRKnSbPbxcLcuou0r/vMiCNXIYiQPlhjE2qP4 qkMsm2jim3/3/xXJZUIVPTeRifq2ZM6AUnbRcghpK1e4iXiBzdF5uYW/mg037uylaDjcc43osP4 b5Uqb5rRdul5Hz31tigB3iRXnHFLBrTTl09HdnqxVTOoHaLFF5Hwsd3LjlEHryDnozOQuLvTc44 Fcp37BqSLSGed2P4AFMv11UghwST8tiqWt5m6Q5VnVWKDfM91wLREjJ8bRDi7BW5HDjWV95tEaz DNQWkSicIMez3fLnqTLENvn2WaPErhVpQcQk9GrLg= X-Received: by 2002:a05:6a20:e292:b0:3c3:6cfb:4ed7 with SMTP id adf61e73a8af0-3c3ad7ec516mr4411442637.30.1784314644148; Fri, 17 Jul 2026 11:57:24 -0700 (PDT) Received: from kimi-bug-hunter.. ([47.236.164.125]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13ce2cbb7c5sm7376688c88.10.2026.07.17.11.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2026 11:57:23 -0700 (PDT) From: Weiming Shi To: Jon Maloy , Tung Nguyen , netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net Cc: Xiang Mei , Weiming Shi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org Subject: [PATCH net v6 3/3] tipc: fix node reference leak when defer work is already pending Date: Sat, 18 Jul 2026 02:57:00 +0800 Message-ID: <20260717185701.2828080-4-bestswngs@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260717185701.2828080-1-bestswngs@gmail.com> References: <20260717185701.2828080-1-bestswngs@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In tipc_node_write_unlock(), TIPC_NOTIFY_NODE_UP with an empty cluster_scope takes a node reference and schedules n->work. If the link flaps down and up while that work is still pending, the next NODE_UP takes another reference, but schedule_work() returns false and the extra reference is never dropped. The tipc_node structure leaks. Verified by flapping the bearer while the work is pending: one reference is leaked per repeated NODE_UP, while the work is put only once when it finally runs. Drop the reference when the work was already queued. Reported-by: Xiang Mei Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Weiming Shi --- net/tipc/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/tipc/node.c b/net/tipc/node.c index b545a47d6ccb..428c4eacd02f 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -447,7 +447,8 @@ static void tipc_node_write_unlock(struct tipc_node *n) /* Defer bulk distribution to work queue */ if (rc > 0) { tipc_node_get(n); - schedule_work(&n->work); + if (!schedule_work(&n->work)) + tipc_node_put(n); } else if (rc < 0) { /* Bring the link down to start over bulk distribution * when the link is up again. -- 2.43.0