iscsi-scst: Restore msg->msg_iov check

This commit is contained in:
Bart Van Assche
2016-11-30 21:12:01 -08:00
parent 585e1a9e65
commit 34bf6df75d

View File

@@ -697,6 +697,10 @@ static int do_recv(struct iscsi_conn *conn)
mm_segment_t oldfs;
struct msghdr *msg;
int read_size;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
struct iovec *first_iov;
int first_len;
#endif
EXTRACHECKS_BUG_ON(conn->read_cmnd == NULL);
@@ -717,6 +721,8 @@ restart:
read_size = msg->msg_iter.count;
#else
read_size = conn->read_size;
first_iov = msg->msg_iov;
first_len = first_iov->iov_len;
#endif
oldfs = get_fs();
@@ -746,7 +752,7 @@ restart:
sBUG_ON(msg->msg_iter.count + res != read_size);
res = msg->msg_iter.count;
#else
/* To do: restore msg->msg_iov check. */
sBUG_ON((res >= first_len) && (first_iov->iov_len != 0));
conn->read_size -= res;
res = conn->read_size;
#endif