aio_aqueue(): avoid ucred leak on failure path

PR:	258698
Submitted by:	sigsys@gmail.com
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2021-09-24 03:14:56 +03:00
parent 502dc84a8b
commit 45c2c7c484

View File

@ -1713,7 +1713,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj,
else
error = fo_aio_queue(fp, job);
if (error)
goto err3;
goto err4;
AIO_LOCK(ki);
job->jobflags &= ~KAIOCB_QUEUEING;
@ -1734,6 +1734,8 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj,
AIO_UNLOCK(ki);
return (0);
err4:
crfree(job->cred);
err3:
if (fp)
fdrop(fp, td);