aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libiscsi_tcp.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2011-06-24 16:11:55 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-06-29 17:43:10 -0400
commit74dcd0ec735ba9c5bef254b2f6e53068cf3f9ff0 (patch)
treed4a30791f73d07c89bbd7043da92ac3fbf3c4a3d /drivers/scsi/libiscsi_tcp.c
parent03adb5f91280b433c3685d0ee86b2e1424af3d88 (diff)
[SCSI] libiscsi_tcp: fix LLD data allocation
Have libiscsi_tcp have upper layers allocate the LLD data along with the iscsi_cls_conn struct, so it is refcounted. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/libiscsi_tcp.c')
-rw-r--r--drivers/scsi/libiscsi_tcp.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index e98ae33f1295..09b232fd9a1b 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -1084,7 +1084,8 @@ iscsi_tcp_conn_setup(struct iscsi_cls_session *cls_session, int dd_data_size,
1084 struct iscsi_cls_conn *cls_conn; 1084 struct iscsi_cls_conn *cls_conn;
1085 struct iscsi_tcp_conn *tcp_conn; 1085 struct iscsi_tcp_conn *tcp_conn;
1086 1086
1087 cls_conn = iscsi_conn_setup(cls_session, sizeof(*tcp_conn), conn_idx); 1087 cls_conn = iscsi_conn_setup(cls_session,
1088 sizeof(*tcp_conn) + dd_data_size, conn_idx);
1088 if (!cls_conn) 1089 if (!cls_conn)
1089 return NULL; 1090 return NULL;
1090 conn = cls_conn->dd_data; 1091 conn = cls_conn->dd_data;
@@ -1096,22 +1097,13 @@ iscsi_tcp_conn_setup(struct iscsi_cls_session *cls_session, int dd_data_size,
1096 1097
1097 tcp_conn = conn->dd_data; 1098 tcp_conn = conn->dd_data;
1098 tcp_conn->iscsi_conn = conn; 1099 tcp_conn->iscsi_conn = conn;
1099 1100 tcp_conn->dd_data = conn->dd_data + sizeof(*tcp_conn);
1100 tcp_conn->dd_data = kzalloc(dd_data_size, GFP_KERNEL);
1101 if (!tcp_conn->dd_data) {
1102 iscsi_conn_teardown(cls_conn);
1103 return NULL;
1104 }
1105 return cls_conn; 1101 return cls_conn;
1106} 1102}
1107EXPORT_SYMBOL_GPL(iscsi_tcp_conn_setup); 1103EXPORT_SYMBOL_GPL(iscsi_tcp_conn_setup);
1108 1104
1109void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn) 1105void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn)
1110{ 1106{
1111 struct iscsi_conn *conn = cls_conn->dd_data;
1112 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
1113
1114 kfree(tcp_conn->dd_data);
1115 iscsi_conn_teardown(cls_conn); 1107 iscsi_conn_teardown(cls_conn);
1116} 1108}
1117EXPORT_SYMBOL_GPL(iscsi_tcp_conn_teardown); 1109EXPORT_SYMBOL_GPL(iscsi_tcp_conn_teardown);