git: 0f2b2276abc3 - main - ctl: fix uninitialized data used by PREVENT ALLOW MEDIUM REMOVAL

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Thu, 05 Sep 2024 15:12:15 UTC
The branch main has been updated by asomers:

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

commit 0f2b2276abc305905e7d88619a7abca26b0dd7eb
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-08-26 20:44:24 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-09-05 15:10:14 +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.
    
    MFC after:      2 weeks
    Sponsored by:   Axcient
    Reviewed by:    emaste, markj
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1409
---
 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 53858edc2a1d..1505e0886f57 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -4630,7 +4630,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);
 	}
 
 	/*