Whamcloud - gitweb
LU-15130 nrs: null pointer dereference in nrs_tbf_id_parse 91/45291/4
authorEtienne AUJAMES <etienne.aujames@cea.fr>
Tue, 19 Oct 2021 14:10:43 +0000 (16:10 +0200)
committerOleg Drokin <green@whamcloud.com>
Fri, 7 Jan 2022 00:59:16 +0000 (00:59 +0000)
commitcec864b7938f1138d1432ab0720f4e1d51ea6ae4
treeb26591cd62d0d87e34bfd00ab3e140fe3b535fdd
parent5552eba1451d47ce1ba6c7ca112aa4b9b2f87292
LU-15130 nrs: null pointer dereference in nrs_tbf_id_parse

cfs_gettok() set next->ls_str to NULL if no delimiter is found but
it does not update next->ls_len to 0.
We have to check if next->ls_str is null inside nrs_tbf_id_parse()
to verify if the tbf expression is valid.

* Reproducer *
lctl set_param  mds.MDS.mdt.nrs_tbf_rule="start tbf_name gid{500}
rate=100"

This patch fix cfs_gettok() to update "next->ls_len = 0;" if no
delimiter is found.

Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Change-Id: Iaa4eb5085262cee547ea3a944ddb94c6df1f8aa3
Reviewed-on: https://review.whamcloud.com/45291
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/libcfs_string.c
libcfs/libcfs/util/string.c
lustre/ptlrpc/nrs_tbf.c