When demand loading drivers during discovery, iscsiadm can receive an
unexpected netlink event, like a link up, when looking for a discovery
session login status.  That could expose krecv_conn_state to a
connection without a valid recv_context pointer.
Guard against that to prevent the NULL dereference.

Signed-off-by: Chris Leech <[email protected]>
---
 usr/netlink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/usr/netlink.c b/usr/netlink.c
index 328f21c..3984727 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -1038,6 +1038,10 @@ static int krecv_conn_state(struct iscsi_conn *conn, 
uint32_t *state)
                /* fatal handling error or conn error */
                goto exit;
 
+        /* unexpected event without a receive context */
+        if (!conn->recv_context)
+                return -EAGAIN;
+
        *state = *(enum iscsi_conn_state *)conn->recv_context->data;
 
        ipc_ev_clbk->put_ev_context(conn->recv_context);
-- 
2.1.0

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to