mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 05:41:55 +00:00
SCSI fixes on 20211231
Three fixes, all in drivers. The lpfc one doesn't look exploitable, but nasty things could happen in string operations if mybuf ends up with an on stack unterminated string. Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com> -----BEGIN PGP SIGNATURE----- iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCYc8YLiYcamFtZXMuYm90 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishdUhAQCVmqLx GhEK15Y8etJwMoj03I6hO5gChhQz6kk7pxXAVwD/e5LHrVVeq/WxjUnyrC1gx6sm iYHYbZ0UHotwbRpwU9k= =WAIf -----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: "Three fixes, all in drivers. The lpfc one doesn't look exploitable, but nasty things could happen in string operations if mybuf ends up with an on stack unterminated string" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: vmw_pvscsi: Set residual data length conditionally scsi: libiscsi: Fix UAF in iscsi_conn_get_param()/iscsi_conn_teardown() scsi: lpfc: Terminate string in lpfc_debugfs_nvmeio_trc_write()
This commit is contained in:
commit
e46227bf38
@ -3100,6 +3100,8 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
|
||||
{
|
||||
struct iscsi_conn *conn = cls_conn->dd_data;
|
||||
struct iscsi_session *session = conn->session;
|
||||
char *tmp_persistent_address = conn->persistent_address;
|
||||
char *tmp_local_ipaddr = conn->local_ipaddr;
|
||||
|
||||
del_timer_sync(&conn->transport_timer);
|
||||
|
||||
@ -3121,8 +3123,6 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
|
||||
spin_lock_bh(&session->frwd_lock);
|
||||
free_pages((unsigned long) conn->data,
|
||||
get_order(ISCSI_DEF_MAX_RECV_SEG_LEN));
|
||||
kfree(conn->persistent_address);
|
||||
kfree(conn->local_ipaddr);
|
||||
/* regular RX path uses back_lock */
|
||||
spin_lock_bh(&session->back_lock);
|
||||
kfifo_in(&session->cmdpool.queue, (void*)&conn->login_task,
|
||||
@ -3134,6 +3134,8 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
|
||||
mutex_unlock(&session->eh_mutex);
|
||||
|
||||
iscsi_destroy_conn(cls_conn);
|
||||
kfree(tmp_persistent_address);
|
||||
kfree(tmp_local_ipaddr);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(iscsi_conn_teardown);
|
||||
|
||||
|
@ -2954,8 +2954,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,
|
||||
char mybuf[64];
|
||||
char *pbuf;
|
||||
|
||||
if (nbytes > 64)
|
||||
nbytes = 64;
|
||||
if (nbytes > 63)
|
||||
nbytes = 63;
|
||||
|
||||
memset(mybuf, 0, sizeof(mybuf));
|
||||
|
||||
|
@ -586,9 +586,12 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
|
||||
* Commands like INQUIRY may transfer less data than
|
||||
* requested by the initiator via bufflen. Set residual
|
||||
* count to make upper layer aware of the actual amount
|
||||
* of data returned.
|
||||
* of data returned. There are cases when controller
|
||||
* returns zero dataLen with non zero data - do not set
|
||||
* residual count in that case.
|
||||
*/
|
||||
scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
|
||||
if (e->dataLen && (e->dataLen < scsi_bufflen(cmd)))
|
||||
scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
|
||||
cmd->result = (DID_OK << 16);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user