aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-09-24 00:14:56 +0000
committerEd Maste <emaste@FreeBSD.org>2022-06-27 17:25:44 +0000
commit76ed54dda74ffe8c7284cab10a4b30445a8db12f (patch)
tree809584fd16590851f4225aa9023b290c310b0d4a
parent35c420809942fb7c9ce781c3835f941e426d5f4d (diff)
aio_aqueue(): avoid ucred leak on failure path
PR: 258698 Submitted by: sigsys@gmail.com (cherry picked from commit 45c2c7c484de7747014492b17ff89e323ee66496)
-rw-r--r--sys/kern/vfs_aio.c4
1 files changed, 3 insertions, 1 deletions
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)