From 1304be5fe0efb42b7ec6a50dd8e1a9bce2adae17 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Thu, 26 Jan 2012 21:13:10 -0600 Subject: [SCSI] libiscsi_tcp: fix max_r2t manipulation Problem description from Xi Wang: A large max_r2t could lead to integer overflow in subsequent call to iscsi_tcp_r2tpool_alloc(), allocating a smaller buffer than expected and leading to out-of-bounds write. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- include/scsi/libiscsi.h | 2 +- include/scsi/libiscsi_tcp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include/scsi') diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 2e42e9a0e0b6..6e33386a3898 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -268,7 +268,7 @@ struct iscsi_session { int lu_reset_timeout; int tgt_reset_timeout; int initial_r2t_en; - unsigned max_r2t; + unsigned short max_r2t; int imm_data_en; unsigned first_burst; unsigned max_burst; diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h index ac0cc1d925ef..215469a9b801 100644 --- a/include/scsi/libiscsi_tcp.h +++ b/include/scsi/libiscsi_tcp.h @@ -128,7 +128,7 @@ extern void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn); /* misc helpers */ extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session); extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session); - +extern int iscsi_tcp_set_max_r2t(struct iscsi_conn *conn, char *buf); extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats); #endif /* LIBISCSI_TCP_H */ -- cgit v1.2.3