From owner-freebsd-bugs@FreeBSD.ORG Wed Apr 20 07:20:09 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21E3C106566C for ; Wed, 20 Apr 2011 07:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id EBB608FC14 for ; Wed, 20 Apr 2011 07:20:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p3K7K8P7041704 for ; Wed, 20 Apr 2011 07:20:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p3K7K8iH041703; Wed, 20 Apr 2011 07:20:08 GMT (envelope-from gnats) Resent-Date: Wed, 20 Apr 2011 07:20:08 GMT Resent-Message-Id: <201104200720.p3K7K8iH041703@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Henning Petersen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32B3A106566B for ; Wed, 20 Apr 2011 07:11:27 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 0782D8FC16 for ; Wed, 20 Apr 2011 07:11:27 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p3K7BQgi091278 for ; Wed, 20 Apr 2011 07:11:26 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p3K7BQ9S091277; Wed, 20 Apr 2011 07:11:26 GMT (envelope-from nobody) Message-Id: <201104200711.p3K7BQ9S091277@red.freebsd.org> Date: Wed, 20 Apr 2011 07:11:26 GMT From: Henning Petersen To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/156513: Missing check of scb. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2011 07:20:09 -0000 >Number: 156513 >Category: kern >Synopsis: Missing check of scb. >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Apr 20 07:20:08 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Henning Petersen >Release: FreeBSD-current >Organization: >Environment: >Description: Missing check of scb != NULL. Remove debug printf. Remove unused variable. >How-To-Repeat: >Fix: diff -u -r1.42 aic79xx.c --- sys/dev/aic7xxx/aic79xx.c 12 Mar 2011 20:36:52 -0000 1.42 +++ sys/dev/aic7xxx/aic79xx.c 20 Apr 2011 06:56:47 -0000 @@ -1062,7 +1062,6 @@ struct scb *scb; struct ahd_initiator_tinfo *targ_info; struct ahd_tmode_tstate *tstate; - struct ahd_transinfo *tinfo; u_int scbid; /* @@ -1096,7 +1095,6 @@ devinfo.our_scsiid, devinfo.target, &tstate); - tinfo = &targ_info->curr; ahd_set_width(ahd, &devinfo, MSG_EXT_WDTR_BUS_8_BIT, AHD_TRANS_ACTIVE, /*paused*/TRUE); ahd_set_syncrate(ahd, &devinfo, /*period*/0, @@ -2262,7 +2260,6 @@ found = ahd_abort_scbs(ahd, target, 'A', saved_lun, tag, ROLE_INITIATOR, CAM_REQ_ABORTED); - printf("found == 0x%x\n", found); printerror = 0; } else if (ahd_sent_msg(ahd, AHDMSG_1B, MSG_BUS_DEV_RESET, TRUE)) { @@ -2406,7 +2403,8 @@ */ if (printerror != 0 && (lastphase == P_MESGIN || lastphase == P_MESGOUT) - && ((ahd->msg_flags & MSG_FLAG_EXPECT_PPR_BUSFREE) != 0)) { + && ((ahd->msg_flags & MSG_FLAG_EXPECT_PPR_BUSFREE) != 0) + && scb != NULL) { ahd_freeze_devq(ahd, scb); aic_set_transaction_status(scb, CAM_REQUEUE_REQ); Patch attached with submission follows: diff -u -r1.42 aic79xx.c --- sys/dev/aic7xxx/aic79xx.c 12 Mar 2011 20:36:52 -0000 1.42 +++ sys/dev/aic7xxx/aic79xx.c 20 Apr 2011 06:56:47 -0000 @@ -1062,7 +1062,6 @@ struct scb *scb; struct ahd_initiator_tinfo *targ_info; struct ahd_tmode_tstate *tstate; - struct ahd_transinfo *tinfo; u_int scbid; /* @@ -1096,7 +1095,6 @@ devinfo.our_scsiid, devinfo.target, &tstate); - tinfo = &targ_info->curr; ahd_set_width(ahd, &devinfo, MSG_EXT_WDTR_BUS_8_BIT, AHD_TRANS_ACTIVE, /*paused*/TRUE); ahd_set_syncrate(ahd, &devinfo, /*period*/0, @@ -2262,7 +2260,6 @@ found = ahd_abort_scbs(ahd, target, 'A', saved_lun, tag, ROLE_INITIATOR, CAM_REQ_ABORTED); - printf("found == 0x%x\n", found); printerror = 0; } else if (ahd_sent_msg(ahd, AHDMSG_1B, MSG_BUS_DEV_RESET, TRUE)) { @@ -2406,7 +2403,8 @@ */ if (printerror != 0 && (lastphase == P_MESGIN || lastphase == P_MESGOUT) - && ((ahd->msg_flags & MSG_FLAG_EXPECT_PPR_BUSFREE) != 0)) { + && ((ahd->msg_flags & MSG_FLAG_EXPECT_PPR_BUSFREE) != 0) + && scb != NULL) { ahd_freeze_devq(ahd, scb); aic_set_transaction_status(scb, CAM_REQUEUE_REQ); >Release-Note: >Audit-Trail: >Unformatted: