Module Name:    src
Committed By:   hannken
Date:           Wed Jul 22 08:33:51 UTC 2015

Modified Files:
        src/sys/dev/ic: mpt_netbsd.c

Log Message:
Adapter leaks requests when mpt_event_notify_reply() has to acknowledge
an event leading to "adapter resource shortage" messages when the scsipi
subsystem tries to use all adapt_openings.

Change mpt_ctlop() to free the request on event MPI_FUNCTION_EVENT_ACK.

Tested on a SunFire X4275 with Symbios Logic SAS1068E (1000:0058, rev. 4).


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/mpt_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mpt_netbsd.c
diff -u src/sys/dev/ic/mpt_netbsd.c:1.31 src/sys/dev/ic/mpt_netbsd.c:1.32
--- src/sys/dev/ic/mpt_netbsd.c:1.31	Sun Sep 28 11:27:00 2014
+++ src/sys/dev/ic/mpt_netbsd.c	Wed Jul 22 08:33:51 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_netbsd.c,v 1.31 2014/09/28 11:27:00 jmcneill Exp $	*/
+/*	$NetBSD: mpt_netbsd.c,v 1.32 2015/07/22 08:33:51 hannken Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.31 2014/09/28 11:27:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.32 2015/07/22 08:33:51 hannken Exp $");
 
 #include "bio.h"
 
@@ -1270,8 +1270,16 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, 
 		break;
 
 	case MPI_FUNCTION_EVENT_ACK:
+	    {
+		MSG_EVENT_ACK_REPLY *msg = vmsg;
+		int index = le32toh(msg->MsgContext) & ~0x80000000;
 		mpt_free_reply(mpt, (reply << 1));
+		if (index >= 0 && index < MPT_MAX_REQUESTS(mpt)) {
+			request_t *req = &mpt->request_pool[index];
+			mpt_free_request(mpt, req);
+		}
 		break;
+	    }
 
 	case MPI_FUNCTION_PORT_ENABLE:
 	    {

Reply via email to