From f37192064a44f28d1b1c6dfe311ad8a0d45aed89 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 20 Aug 2019 17:44:03 +0000 Subject: [PATCH] mqueuefs: fix compat32 struct file leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a compat32 error case we previously leaked a struct file. Submitted by: Karsten König, Secfault Security Security: CVE-2019-5603 --- sys/kern/uipc_mqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index d0917db506ca..0f5b48cea1f8 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -2806,7 +2806,7 @@ freebsd32_kmq_timedsend(struct thread *td, if (uap->abs_timeout != NULL) { error = copyin(uap->abs_timeout, &ets32, sizeof(ets32)); if (error != 0) - return (error); + goto out; CP(ets32, ets, tv_sec); CP(ets32, ets, tv_nsec); abs_timeout = &ets; @@ -2815,6 +2815,7 @@ freebsd32_kmq_timedsend(struct thread *td, waitok = !(fp->f_flag & O_NONBLOCK); error = mqueue_send(mq, uap->msg_ptr, uap->msg_len, uap->msg_prio, waitok, abs_timeout); +out: fdrop(fp, td); return (error); }