From 0f206cc91279e630ad9e733eb6e330b7dbe6c70e Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sun, 16 May 2021 10:28:04 +0100 Subject: [PATCH] cam: add missing zeroing of a stack-allocated CCB. This could cause a panic at boot. Reported By: Shawn Webb Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. --- sys/cam/ata/ata_xpt.c | 1 + sys/cam/scsi/scsi_xpt.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index c13c7b493c78..2e3f862cbf41 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -2187,6 +2187,7 @@ ata_announce_periph_sbuf(struct cam_periph *periph, struct sbuf *sb) struct ccb_trans_settings cts; u_int speed, mb; + bzero(&cts, sizeof(cts)); _ata_announce_periph(periph, &cts, &speed); if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) return; diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index bdc23e4b51b7..5097802c4063 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -3154,6 +3154,7 @@ scsi_announce_periph(struct cam_periph *periph) struct ccb_trans_settings cts; u_int speed, freq, mb; + memset(&cts, 0, sizeof(cts)); _scsi_announce_periph(periph, &speed, &freq, &cts); if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) return;