To fix the crash caused by issue of faked flexible arrays
in jobid.
Signed-off-by: Yang Sheng <ys@whamcloud.com>
Change-Id: Iba88582e20dfe38ec060ed9a05ba3d65ee3e31e1
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55995
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
struct pid *sj_session;
struct rhash_head sj_linkage;
struct rcu_head sj_rcu;
- char sj_jobid[1];
+ char sj_jobid[];
};
static const struct rhashtable_params jobid_params = {
int ret;
int len = strlen(jobid);
- sj = kmalloc(sizeof(*sj) + len, GFP_KERNEL);
+ sj = kmalloc(sizeof(*sj) + len + 1, GFP_KERNEL);
if (!sj)
return -ENOMEM;
rcu_read_lock();
sid = task_session(current);
sj->sj_session = get_pid(sid);
- strncpy(sj->sj_jobid, jobid, len+1);
+ strncpy(sj->sj_jobid, jobid, len + 1);
origsj = rhashtable_lookup_get_insert_fast(&session_jobids,
&sj->sj_linkage,
jobid_params);