diff mbox series

[16/25] lnet: Check empty list in cfs_match_nid_net

Message ID 20250130141115.950749-17-jsimmons@infradead.org (mailing list archive)
State New
Headers show
Series lustre: sync to OpenSFS branch April 30, 2023 | expand

Commit Message

James Simmons Jan. 30, 2025, 2:11 p.m. UTC
From: Chris Horn <chris.horn@hpe.com>

cfs_match_nid_net() needs to check whether the list of range
expressions describing the address is empty. Otherwise, for numeric
based addresses, we may hit the assert in libcfs_num_match().

HPE-bug-id: LUS-11480
WC-bug-id: https://jira.whamcloud.com/browse/LU-16573
Lustre-commit: f3ba286b05d557b0d ("LU-16573 lnet: Check empty list in cfs_match_nid_net")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50576
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/lnet/nidstrings.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/lnet/lnet/nidstrings.c b/net/lnet/lnet/nidstrings.c
index d235048a8ff0..05a9b3275624 100644
--- a/net/lnet/lnet/nidstrings.c
+++ b/net/lnet/lnet/nidstrings.c
@@ -822,11 +822,11 @@  cfs_match_nid_net(struct lnet_nid *nid, u32 net_type,
 	u32 address;
 	struct netstrfns *nf;
 
-	if (!addr || !net_num_list)
+	if (!addr || list_empty(addr) || !net_num_list)
 		return 0;
 
 	nf = type2net_info(LNET_NETTYP(LNET_NID_NET(nid)));
-	if (!nf || !net_num_list || !addr)
+	if (!nf)
 		return 0;
 
 	/* FIXME handle long-addr nid */