summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2013-10-08 19:18:02 +0000
committertrasz <trasz@FreeBSD.org>2013-10-08 19:18:02 +0000
commit4d9730d87ebcc393e8d10b3ba4efa2799db67896 (patch)
treec18ae35c1a117bb075a29cd58a75443120cf9e77
parenta0450dc1cc327a14d4fdf7d4b39611196ca82a59 (diff)
downloadFreeBSD-src-4d9730d87ebcc393e8d10b3ba4efa2799db67896.zip
FreeBSD-src-4d9730d87ebcc393e8d10b3ba4efa2799db67896.tar.gz
Properly fix out of memory handling in the iSCSI target.
Approved by: re (glebius) Sponsored by: FreeBSD Foundation
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 46eaf08..e8e2d33 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <cam/ctl/ctl_io.h>
#include <cam/ctl/ctl.h>
#include <cam/ctl/ctl_backend.h>
+#include <cam/ctl/ctl_error.h>
#include <cam/ctl/ctl_frontend.h>
#include <cam/ctl/ctl_frontend_internal.h>
#include <cam/ctl/ctl_debug.h>
@@ -2301,7 +2302,8 @@ cfiscsi_datamove_in(union ctl_io *io)
if (response == NULL) {
CFISCSI_SESSION_WARN(cs, "failed to "
"allocate memory; dropping connection");
- icl_pdu_free(request);
+ ctl_set_busy(&io->scsiio);
+ io->scsiio.be_move_done(io);
cfiscsi_session_terminate(cs);
return;
}
@@ -2330,8 +2332,9 @@ cfiscsi_datamove_in(union ctl_io *io)
if (error != 0) {
CFISCSI_SESSION_WARN(cs, "failed to "
"allocate memory; dropping connection");
- icl_pdu_free(request);
icl_pdu_free(response);
+ ctl_set_busy(&io->scsiio);
+ io->scsiio.be_move_done(io);
cfiscsi_session_terminate(cs);
return;
}
@@ -2428,8 +2431,10 @@ cfiscsi_datamove_out(union ctl_io *io)
if (cdw == NULL) {
CFISCSI_SESSION_WARN(cs, "failed to "
"allocate memory; dropping connection");
- icl_pdu_free(request);
+ ctl_set_busy(&io->scsiio);
+ io->scsiio.be_move_done(io);
cfiscsi_session_terminate(cs);
+ return;
}
cdw->cdw_ctl_io = io;
cdw->cdw_target_transfer_tag = htonl(target_transfer_tag);
@@ -2462,8 +2467,10 @@ cfiscsi_datamove_out(union ctl_io *io)
if (response == NULL) {
CFISCSI_SESSION_WARN(cs, "failed to "
"allocate memory; dropping connection");
- icl_pdu_free(request);
+ ctl_set_busy(&io->scsiio);
+ io->scsiio.be_move_done(io);
cfiscsi_session_terminate(cs);
+ return;
}
bhsr2t = (struct iscsi_bhs_r2t *)response->ip_bhs;
bhsr2t->bhsr2t_opcode = ISCSI_BHS_OPCODE_R2T;
OpenPOWER on IntegriCloud