Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Mike Christie and committed by
James Bottomley
74dcd0ec 03adb5f9

+3 -11
+3 -11
drivers/scsi/libiscsi_tcp.c
··· 1084 1084 struct iscsi_cls_conn *cls_conn; 1085 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 1089 if (!cls_conn) 1089 1090 return NULL; 1090 1091 conn = cls_conn->dd_data; ··· 1097 1096 1098 1097 tcp_conn = conn->dd_data; 1099 1098 tcp_conn->iscsi_conn = conn; 1100 - 1101 - tcp_conn->dd_data = kzalloc(dd_data_size, GFP_KERNEL); 1102 - if (!tcp_conn->dd_data) { 1103 - iscsi_conn_teardown(cls_conn); 1104 - return NULL; 1105 - } 1099 + tcp_conn->dd_data = conn->dd_data + sizeof(*tcp_conn); 1106 1100 return cls_conn; 1107 1101 } 1108 1102 EXPORT_SYMBOL_GPL(iscsi_tcp_conn_setup); 1109 1103 1110 1104 void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn) 1111 1105 { 1112 - struct iscsi_conn *conn = cls_conn->dd_data; 1113 - struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 1114 - 1115 - kfree(tcp_conn->dd_data); 1116 1106 iscsi_conn_teardown(cls_conn); 1117 1107 } 1118 1108 EXPORT_SYMBOL_GPL(iscsi_tcp_conn_teardown);