Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Sep 2019 14:52:40 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r351745 - stable/12/sys/cam/scsi
Message-ID:  <201909031452.x83EqelP084605@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Sep  3 14:52:39 2019
New Revision: 351745
URL: https://svnweb.freebsd.org/changeset/base/351745

Log:
  MFC r351550: Always check cam_periph_error() status for ERESTART.
  
  Even if we do not expect retries, we better be sure, since otherwise it
  may result in use after free kernel panic.  I've noticed that it retries
  SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY.

Modified:
  stable/12/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- stable/12/sys/cam/scsi/scsi_xpt.c	Tue Sep  3 14:39:36 2019	(r351744)
+++ stable/12/sys/cam/scsi/scsi_xpt.c	Tue Sep  3 14:52:39 2019	(r351745)
@@ -1684,8 +1684,9 @@ probe_device_check:
 	case PROBE_TUR_FOR_NEGOTIATION:
 	case PROBE_DV_EXIT:
 		if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
-			cam_periph_error(done_ccb, 0,
-			    SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
+			if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
+			    SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
+				goto outr;
 		}
 		if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
 			/* Don't wedge the queue */
@@ -1735,8 +1736,9 @@ probe_device_check:
 		struct ccb_scsiio *csio;
 
 		if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
-			cam_periph_error(done_ccb, 0,
-			    SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
+			if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
+			    SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
+				goto outr;
 		}
 		if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
 			/* Don't wedge the queue */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909031452.x83EqelP084605>