Skip to content

Commit 6b09b19

Browse files
committed
backend: guard prctl(PR_SET_NAME) against NULL thread name
o->comm may be NULL if job initialization fails or the job structure is only partially initialized before thread creation. Calling prctl(PR_SET_NAME, NULL) results in a NULL pointer dereference inside strncpy(). Add a NULL check before calling prctl(). Reported-by: Criticayon Black Signed-off-by: Criticayon Black <1318083585@qq.com>
1 parent 4db5740 commit 6b09b19

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

backend.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,7 @@ static void *thread_main(void *data)
18231823
fio_local_clock_init();
18241824

18251825
#ifdef CONFIG_LINUX
1826+
if (o->comm)//fix:Add a simple NULL check
18261827
prctl(PR_SET_NAME, o->comm);
18271828
#endif
18281829

0 commit comments

Comments
 (0)