aio_aqueue(): avoid ucred leak on failure path

PR:	258698

(cherry picked from commit 45c2c7c484)
This commit is contained in:
Konstantin Belousov 2021-09-24 03:14:56 +03:00
parent 3c9253c2f6
commit 9499d3c1e4

View File

@ -1709,7 +1709,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;
@ -1730,6 +1730,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);