Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2024 06:05:08 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3f2792166aee - main - MAC: improve consistency in error handling
Message-ID:  <202409260605.48Q658Gp053814@gitrepo.freebsd.org>

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

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

commit 3f2792166aeed4baf07d351bcb12a9d196c443eb
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-09-26 06:02:06 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-09-26 06:04:54 +0000

    MAC: improve consistency in error handling
    
    Whenever mac_syncache_init() returns an error, ensure that
    *label = NULL. This simplifies the error handling by the caller.
    
    Reviewed by:            rscheff
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D46701
---
 sys/security/mac/mac_inet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/security/mac/mac_inet.c b/sys/security/mac/mac_inet.c
index 29a355071065..9770fa840f95 100644
--- a/sys/security/mac/mac_inet.c
+++ b/sys/security/mac/mac_inet.c
@@ -485,6 +485,7 @@ mac_syncache_init(struct label **label)
 			MAC_POLICY_PERFORM_NOSLEEP(syncache_destroy_label,
 			    *label);
 			mac_labelzone_free(*label);
+			*label = NULL;
 		}
 		return (error);
 	} else



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