target-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] IB/isert: Possible null-pointer dereference related
@ 2024-10-24  1:02 Tuo Li
  0 siblings, 0 replies; only message in thread
From: Tuo Li @ 2024-10-24  1:02 UTC (permalink / raw)
  To: sagi, jgg, leon; +Cc: linux-rdma, target-devel, linux-kernel, baijiaju1990

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);  //1398

The 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;      //982

The 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-24  1:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-24  1:02 [BUG] IB/isert: Possible null-pointer dereference related Tuo Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).