Commit b44a2b67 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Nicholas Bellinger

iser-target: Fix wrong allocation in the case of an empty text message

if text message dlength is 0, don't allocate a buffer for it, pass
NULL to iscsit_process_text_cmd.
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent be7dcfb6
...@@ -1351,17 +1351,19 @@ isert_handle_text_cmd(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd ...@@ -1351,17 +1351,19 @@ isert_handle_text_cmd(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd
struct iscsi_conn *conn = isert_conn->conn; struct iscsi_conn *conn = isert_conn->conn;
u32 payload_length = ntoh24(hdr->dlength); u32 payload_length = ntoh24(hdr->dlength);
int rc; int rc;
unsigned char *text_in; unsigned char *text_in = NULL;
rc = iscsit_setup_text_cmd(conn, cmd, hdr); rc = iscsit_setup_text_cmd(conn, cmd, hdr);
if (rc < 0) if (rc < 0)
return rc; return rc;
text_in = kzalloc(payload_length, GFP_KERNEL); if (payload_length) {
if (!text_in) { text_in = kzalloc(payload_length, GFP_KERNEL);
isert_err("Unable to allocate text_in of payload_length: %u\n", if (!text_in) {
payload_length); isert_err("Unable to allocate text_in of payload_length: %u\n",
return -ENOMEM; payload_length);
return -ENOMEM;
}
} }
cmd->text_in_ptr = text_in; cmd->text_in_ptr = text_in;
......
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