git: 76ed54dda74f - stable/12 - aio_aqueue(): avoid ucred leak on failure path

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 27 Jun 2022 17:26:49 UTC
The branch stable/12 has been updated by emaste:

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

commit 76ed54dda74ffe8c7284cab10a4b30445a8db12f
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-09-24 00:14:56 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-06-27 17:25:44 +0000

    aio_aqueue(): avoid ucred leak on failure path
    
    PR:             258698
    Submitted by:   sigsys@gmail.com
    
    (cherry picked from commit 45c2c7c484de7747014492b17ff89e323ee66496)
---
 sys/kern/vfs_aio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index d68301d3d342..ba46a5031410 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -1616,7 +1616,7 @@ no_kqueue:
 	else
 		error = fo_aio_queue(fp, job);
 	if (error)
-		goto aqueue_fail;
+		goto err4;
 
 	AIO_LOCK(ki);
 	job->jobflags &= ~KAIOCB_QUEUEING;
@@ -1637,6 +1637,8 @@ no_kqueue:
 	AIO_UNLOCK(ki);
 	return (0);
 
+err4:
+	crfree(job->cred);
 aqueue_fail:
 	knlist_delete(&job->klist, curthread, 0);
 	if (fp)