SCSI fixes on 20140919

This is a set of three fixes.  One represents a nasty shared tag map
 regression (another inverted condition) caused by recent SCSI MQ patches, one
 is a longstanding potential buffer overrun in the iscsi data buffer and the
 final one is a use after free for the rare bidirectional commands.
 
 Signed-off-by: James Bottomley <JBottomley@Parallels.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJUHDQjAAoJEDeqqVYsXL0MAksIAMW7JMBW2BRSixKhqtZOsItd
 DrYN1wfvOuoKgyKnXBfhLbgKih9UgMEnc4zWnB96gBnNJCwFpW9vIICdf6kCWwXh
 c7Bh24SjcHMvYU9Of08TcAdUxyql6md/d28jzjoIi9zFj4C3XvLgevR8n4x2Lk2b
 3SQnX/PYUVMd4sKZaTQDLLAy5+CYGf2tbLPHlMZQHlIN+Cgjorm8zW7tIWJ+rhrv
 Sc3f9O9LxROsJ5wJNJpD0/9adlpsFxSD6cJWELaXBFsgw7jh0ZUjAXSYpyHASZqF
 Mln4kNCEcoa3IIiLVxBbBoQCVF01+kYpGuZM4o4nU6b+wluXupcuhTh5o37G7Q8=
 =FPm9
 -----END PGP SIGNATURE-----

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "This is a set of three fixes.

  One represents a nasty shared tag map regression (another inverted
  condition) caused by recent SCSI MQ patches, one is a longstanding
  potential buffer overrun in the iscsi data buffer and the final one is
  a use after free for the rare bidirectional commands"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  [SCSI] fix for bidi use after free
  [SCSI] fix regression that accidentally disabled block-based tcq
  [SCSI] libiscsi: fix potential buffer overrun in __iscsi_conn_send_pdu
This commit is contained in:
Linus Torvalds 2014-09-19 10:46:48 -07:00
commit 73030efad5
3 changed files with 14 additions and 3 deletions

View File

@ -717,11 +717,21 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
return NULL;
}
if (data_size > ISCSI_DEF_MAX_RECV_SEG_LEN) {
iscsi_conn_printk(KERN_ERR, conn, "Invalid buffer len of %u for login task. Max len is %u\n", data_size, ISCSI_DEF_MAX_RECV_SEG_LEN);
return NULL;
}
task = conn->login_task;
} else {
if (session->state != ISCSI_STATE_LOGGED_IN)
return NULL;
if (data_size != 0) {
iscsi_conn_printk(KERN_ERR, conn, "Can not send data buffer of len %u for op 0x%x\n", data_size, opcode);
return NULL;
}
BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE);
BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED);

View File

@ -733,12 +733,13 @@ static bool scsi_end_request(struct request *req, int error,
} else {
unsigned long flags;
if (bidi_bytes)
scsi_release_bidi_buffers(cmd);
spin_lock_irqsave(q->queue_lock, flags);
blk_finish_request(req, error);
spin_unlock_irqrestore(q->queue_lock, flags);
if (bidi_bytes)
scsi_release_bidi_buffers(cmd);
scsi_release_buffers(cmd);
scsi_next_command(cmd);
}

View File

@ -68,7 +68,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
return;
if (!shost_use_blk_mq(sdev->host) &&
blk_queue_tagged(sdev->request_queue))
!blk_queue_tagged(sdev->request_queue))
blk_queue_init_tags(sdev->request_queue, depth,
sdev->host->bqt);