git: ad9f4e6351fb - main - wg: fix MOD_LOAD to fail properly if cookie_init() fails

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 23 Jun 2023 17:01:12 UTC
The branch main has been updated by kevans:

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

commit ad9f4e6351fb23ee81bc940638d20af3ca7c278d
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2023-06-23 16:41:07 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2023-06-23 16:55:00 +0000

    wg: fix MOD_LOAD to fail properly if cookie_init() fails
    
    Previously we'd jump to the `free_crypto` label, but never set `ret` to
    a failure value -- it would retain success from the call just prior.
    
    Set ret up properly.
    
    This is part of D40708, but not the main point of the change.
---
 sys/dev/wg/if_wg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c
index d2403792cec8..77aed2621c9a 100644
--- a/sys/dev/wg/if_wg.c
+++ b/sys/dev/wg/if_wg.c
@@ -2996,7 +2996,8 @@ wg_module_init(void)
 	ret = crypto_init();
 	if (ret != 0)
 		goto free_zone;
-	if (cookie_init() != 0)
+	ret = cookie_init();
+	if (ret != 0)
 		goto free_crypto;
 
 	wg_osd_jail_slot = osd_jail_register(NULL, methods);