Skip to content

Commit f1715d9

Browse files
mjbommargregkh
authored andcommitted
tipc: reject inverted service ranges from peer bindings
[ Upstream commit 2afb648 ] tipc_update_nametbl() inserts a binding advertised by a peer node using the lower and upper service-range bounds taken directly from the wire, without checking that lower <= upper. The local bind path validates the ordering (tipc_uaddr_valid()), but the name-distribution path does not. A binding with lower > upper is inserted at the far end of the service-range rbtree (keyed on lower) where no lookup or withdrawal can ever match it (service_range_foreach_match() requires sr->lower <= end). The publication, its service_range node and the augmented rbtree entry are then leaked for the lifetime of the namespace, and there is no per-peer cap equivalent to TIPC_MAX_PUBL on locally created bindings. Reject inverted ranges in the network path as well. A peer node can otherwise leak unbounded binding-table memory by sending PUBLICATION items with lower > upper. Fixes: 37922ea ("tipc: permit overlapping service ranges in name table") Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech> Link: https://patch.msgid.link/20260610124003.3831170-4-michael.bommarito@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 47ed873 commit f1715d9

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

net/tipc/name_distr.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,21 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,
280280
u32 node, u32 dtype)
281281
{
282282
struct publication *p = NULL;
283+
u32 lower = ntohl(i->lower);
284+
u32 upper = ntohl(i->upper);
283285
struct tipc_socket_addr sk;
284-
struct tipc_uaddr ua;
285286
u32 key = ntohl(i->key);
287+
struct tipc_uaddr ua;
288+
289+
/* A peer-advertised binding with lower > upper can never be matched
290+
* or withdrawn and would leak the publication; the local bind path
291+
* rejects such ranges, so reject ranges learned from the network too.
292+
*/
293+
if (lower > upper)
294+
return false;
286295

287296
tipc_uaddr(&ua, TIPC_SERVICE_RANGE, TIPC_CLUSTER_SCOPE,
288-
ntohl(i->type), ntohl(i->lower), ntohl(i->upper));
297+
ntohl(i->type), lower, upper);
289298
sk.ref = ntohl(i->port);
290299
sk.node = node;
291300

0 commit comments

Comments
 (0)