diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2011-02-16 16:04:41 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-02-24 12:41:26 -0500 |
commit | c7f7fd5b7ea114e0f85fc4f2a853f6564410588d (patch) | |
tree | 2e295b156c37a8d6ec6254ca6a1fed3db4b50118 /drivers/scsi/be2iscsi | |
parent | 7c53c6f89d7a6487986c51cd73ae9a9be338a8f4 (diff) |
[SCSI] be2iscsi: fix null ptr ref in conn get param
The ep_disconnect function could be freeing the ep
while beiscsi_conn_get_param is running. This has
the driver use the get ep param callback instead
of the get conn param to fix this.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/be2iscsi')
-rw-r--r-- | drivers/scsi/be2iscsi/be_iscsi.c | 18 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_iscsi.h | 4 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 3 |
3 files changed, 9 insertions, 16 deletions
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index eaaa8813067d..868cc5590145 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c | |||
@@ -210,28 +210,20 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, | |||
210 | } | 210 | } |
211 | 211 | ||
212 | /** | 212 | /** |
213 | * beiscsi_conn_get_param - get the iscsi parameter | 213 | * beiscsi_ep_get_param - get the iscsi parameter |
214 | * @cls_conn: pointer to iscsi cls conn | 214 | * @ep: pointer to iscsi ep |
215 | * @param: parameter type identifier | 215 | * @param: parameter type identifier |
216 | * @buf: buffer pointer | 216 | * @buf: buffer pointer |
217 | * | 217 | * |
218 | * returns iscsi parameter | 218 | * returns iscsi parameter |
219 | */ | 219 | */ |
220 | int beiscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | 220 | int beiscsi_ep_get_param(struct iscsi_endpoint *ep, |
221 | enum iscsi_param param, char *buf) | 221 | enum iscsi_param param, char *buf) |
222 | { | 222 | { |
223 | struct beiscsi_endpoint *beiscsi_ep; | 223 | struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; |
224 | struct iscsi_conn *conn = cls_conn->dd_data; | ||
225 | struct beiscsi_conn *beiscsi_conn = conn->dd_data; | ||
226 | int len = 0; | 224 | int len = 0; |
227 | 225 | ||
228 | SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_get_param, param= %d\n", param); | 226 | SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_get_param, param= %d\n", param); |
229 | beiscsi_ep = beiscsi_conn->ep; | ||
230 | if (!beiscsi_ep) { | ||
231 | SE_DEBUG(DBG_LVL_1, | ||
232 | "In beiscsi_conn_get_param , no beiscsi_ep\n"); | ||
233 | return -ENODEV; | ||
234 | } | ||
235 | 227 | ||
236 | switch (param) { | 228 | switch (param) { |
237 | case ISCSI_PARAM_CONN_PORT: | 229 | case ISCSI_PARAM_CONN_PORT: |
@@ -244,7 +236,7 @@ int beiscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | |||
244 | len = sprintf(buf, "%pI6\n", &beiscsi_ep->dst6_addr); | 236 | len = sprintf(buf, "%pI6\n", &beiscsi_ep->dst6_addr); |
245 | break; | 237 | break; |
246 | default: | 238 | default: |
247 | return iscsi_conn_get_param(cls_conn, param, buf); | 239 | return -ENOSYS; |
248 | } | 240 | } |
249 | return len; | 241 | return len; |
250 | } | 242 | } |
diff --git a/drivers/scsi/be2iscsi/be_iscsi.h b/drivers/scsi/be2iscsi/be_iscsi.h index 8950a702b9f4..9c532797c29e 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.h +++ b/drivers/scsi/be2iscsi/be_iscsi.h | |||
@@ -48,8 +48,8 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, | |||
48 | struct iscsi_cls_conn *cls_conn, | 48 | struct iscsi_cls_conn *cls_conn, |
49 | uint64_t transport_fd, int is_leading); | 49 | uint64_t transport_fd, int is_leading); |
50 | 50 | ||
51 | int beiscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | 51 | int beiscsi_ep_get_param(struct iscsi_endpoint *ep, enum iscsi_param param, |
52 | enum iscsi_param param, char *buf); | 52 | char *buf); |
53 | 53 | ||
54 | int beiscsi_get_host_param(struct Scsi_Host *shost, | 54 | int beiscsi_get_host_param(struct Scsi_Host *shost, |
55 | enum iscsi_host_param param, char *buf); | 55 | enum iscsi_host_param param, char *buf); |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 79cefbe31367..bd50145ab71b 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -4384,7 +4384,7 @@ struct iscsi_transport beiscsi_iscsi_transport = { | |||
4384 | .bind_conn = beiscsi_conn_bind, | 4384 | .bind_conn = beiscsi_conn_bind, |
4385 | .destroy_conn = iscsi_conn_teardown, | 4385 | .destroy_conn = iscsi_conn_teardown, |
4386 | .set_param = beiscsi_set_param, | 4386 | .set_param = beiscsi_set_param, |
4387 | .get_conn_param = beiscsi_conn_get_param, | 4387 | .get_conn_param = iscsi_conn_get_param, |
4388 | .get_session_param = iscsi_session_get_param, | 4388 | .get_session_param = iscsi_session_get_param, |
4389 | .get_host_param = beiscsi_get_host_param, | 4389 | .get_host_param = beiscsi_get_host_param, |
4390 | .start_conn = beiscsi_conn_start, | 4390 | .start_conn = beiscsi_conn_start, |
@@ -4395,6 +4395,7 @@ struct iscsi_transport beiscsi_iscsi_transport = { | |||
4395 | .alloc_pdu = beiscsi_alloc_pdu, | 4395 | .alloc_pdu = beiscsi_alloc_pdu, |
4396 | .parse_pdu_itt = beiscsi_parse_pdu, | 4396 | .parse_pdu_itt = beiscsi_parse_pdu, |
4397 | .get_stats = beiscsi_conn_get_stats, | 4397 | .get_stats = beiscsi_conn_get_stats, |
4398 | .get_ep_param = beiscsi_ep_get_param, | ||
4398 | .ep_connect = beiscsi_ep_connect, | 4399 | .ep_connect = beiscsi_ep_connect, |
4399 | .ep_poll = beiscsi_ep_poll, | 4400 | .ep_poll = beiscsi_ep_poll, |
4400 | .ep_disconnect = beiscsi_ep_disconnect, | 4401 | .ep_disconnect = beiscsi_ep_disconnect, |