From owner-svn-src-all@FreeBSD.ORG Tue Oct 8 19:18:03 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0ECA4C79; Tue, 8 Oct 2013 19:18:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D531B2A50; Tue, 8 Oct 2013 19:18:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r98JI2nX009760; Tue, 8 Oct 2013 19:18:02 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r98JI2tn009759; Tue, 8 Oct 2013 19:18:02 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201310081918.r98JI2tn009759@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 8 Oct 2013 19:18:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256163 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2013 19:18:03 -0000 Author: trasz Date: Tue Oct 8 19:18:02 2013 New Revision: 256163 URL: http://svnweb.freebsd.org/changeset/base/256163 Log: Properly fix out of memory handling in the iSCSI target. Approved by: re (glebius) Sponsored by: FreeBSD Foundation Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Tue Oct 8 19:07:48 2013 (r256162) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Tue Oct 8 19:18:02 2013 (r256163) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -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;