IB/isert: Possible null-pointer dereference related
Subsystems (2)
Hello,
Our static analysis tool has identified a potential null-pointer dereference related to the wait-completion synchronization mechanism in ibsert.c.
Consider the following execution scenario:
isert_login_recv_done() //1375
if (isert_conn->conn) //1390
complete(&isert_conn->login_req_comp); //1398The variable isert_conn->conn is checked by an if statement at Line 1390, which indicates that isert_conn->conn can be NULL. Then, complete() is called at Line 1398 which will wake up the wait_for_completion_xxx().
Consider the following wait_for_completion_interruptible().
isert_get_login_rx() //2336
wait_for_completion_interruptible(&isert_conn->login_req_comp); //2342
isert_rx_login_req(isert_conn); //2359
conn = isert_conn->conn; //981
login = conn->conn_login; //982The value of isert_conn->conn is assigned to conn at Line 981, and then dereferenced through conn->conn_login at Line 982. However, the variable isert_conn->conn is checked at Line 1390, which means it can be NULL. If so, a null-pointer dereference can occur at Line 982.
I am not quite sure whether this possible null-pointer dereference is real and how to fix it if it is real.
Any feedback would be appreciated, thanks!
Best wishes,
Tuo Li