[lustre-devel] [PATCH 18/24] lnet: libcfs: set x->ls_len to 0 when x->ls_str is NULL
James Simmons
jsimmons at infradead.org
Thu Jan 13 17:37:57 PST 2022
From: Etienne AUJAMES <eaujames at ddn.com>
cfs_gettok() set next->ls_str to NULL if no delimiter is found but
it does not update next->ls_len to 0.
This patch fix cfs_gettok() to update "next->ls_len = 0;" if no
delimiter is found.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15130
Lustre-commit: cec864b7938f1138d ("LU-15130 nrs: null pointer dereference in nrs_tbf_id_parse")
Signed-off-by: Etienne AUJAMES <eaujames at ddn.com>
Reviewed-on: https://review.whamcloud.com/45291
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Li Xi <lixi at ddn.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
net/lnet/libcfs/libcfs_string.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/lnet/libcfs/libcfs_string.c b/net/lnet/libcfs/libcfs_string.c
index 4259f8b8..0563c42 100644
--- a/net/lnet/libcfs/libcfs_string.c
+++ b/net/lnet/libcfs/libcfs_string.c
@@ -154,6 +154,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
/* there is no the delimeter in the string */
end = next->ls_str + next->ls_len;
next->ls_str = NULL;
+ next->ls_len = 0;
} else {
next->ls_str = end + 1;
next->ls_len -= (end - res->ls_str + 1);
--
1.8.3.1
More information about the lustre-devel
mailing list