git: c6d11ae455a9 - stable/14 - ctl: fix uninitialized data used by PREVENT ALLOW MEDIUM REMOVAL

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Thu, 19 Sep 2024 20:24:55 UTC
The branch stable/14 has been updated by asomers:

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

commit c6d11ae455a9c5b6e927ac0a5d63570081074208
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-08-26 20:44:24 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-09-19 20:24:04 +0000

    ctl: fix uninitialized data used by PREVENT ALLOW MEDIUM REMOVAL
    
    Zero-initialize the bitmap of preventers.  Otherwise, the START STOP
    UNIT command may not have the intended effect.
    
    Sponsored by:   Axcient
    Reviewed by:    emaste, markj
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1409
    
    (cherry picked from commit 0f2b2276abc305905e7d88619a7abca26b0dd7eb)
---
 sys/cam/ctl/ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index 0e0d79d15d8f..9a99823a5c1c 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -4771,7 +4771,7 @@ fail:
 	ctl_tpc_lun_init(lun);
 	if (lun->flags & CTL_LUN_REMOVABLE) {
 		lun->prevent = malloc((CTL_MAX_INITIATORS + 31) / 32 * 4,
-		    M_CTL, M_WAITOK);
+		    M_CTL, M_WAITOK | M_ZERO);
 	}
 
 	/*