Commit b794073e authored by Jörn Engel's avatar Jörn Engel Committed by Greg Kroah-Hartman

target: prevent NULL pointer dereference in target_report_luns

commit 47f1b880 upstream.

transport_kmap_data_sg can return NULL.  I never saw this trigger, but
returning -ENOMEM seems better than a crash.  Also removes a pointless
case while at it.
Signed-off-by: default avatarJoern Engel <joern@logfs.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f18009c7
......@@ -658,7 +658,9 @@ int target_report_luns(struct se_task *se_task)
unsigned char *buf;
u32 cdb_offset = 0, lun_count = 0, offset = 8, i;
buf = (unsigned char *) transport_kmap_data_sg(se_cmd);
buf = transport_kmap_data_sg(se_cmd);
if (!buf)
return -ENOMEM;
/*
* If no struct se_session pointer is present, this struct se_cmd is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment