svn commit: r351745 - stable/12/sys/cam/scsi

Alexander Motin mav at FreeBSD.org
Tue Sep 3 14:52:41 UTC 2019


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 */


More information about the svn-src-stable-12 mailing list