提交 47f1b880 编写于 作者: J Jörn Engel 提交者: Nicholas Bellinger

target: prevent NULL pointer dereference in target_report_luns

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: NJoern Engel <joern@logfs.org>
Cc: stable@vger.kernel.org
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 382436f8
......@@ -652,7 +652,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册