Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 May 2021 10:45:35 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0f206cc91279 - main - cam: add missing zeroing of a stack-allocated CCB.
Message-ID:  <202105161045.14GAjZIL093217@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=0f206cc91279e630ad9e733eb6e330b7dbe6c70e

commit 0f206cc91279e630ad9e733eb6e330b7dbe6c70e
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-05-16 09:28:04 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-05-16 10:38:26 +0000

    cam: add missing zeroing of a stack-allocated CCB.
    
    This could cause a panic at boot.
    
    Reported By:    Shawn Webb <shawn.webb AT hardenedbsd.org>
    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;



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