Date: Tue, 23 Jul 2019 20:59:37 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350260 - head/sys/kern Message-ID: <201907232059.x6NKxb9J008326@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Tue Jul 23 20:59:36 2019 New Revision: 350260 URL: https://svnweb.freebsd.org/changeset/base/350260 Log: mqueuefs: fix struct file leak In some error cases we previously leaked a stuct file. Submitted by: mjg, markj Modified: head/sys/kern/uipc_mqueue.c Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Tue Jul 23 20:31:54 2019 (r350259) +++ head/sys/kern/uipc_mqueue.c Tue Jul 23 20:59:36 2019 (r350260) @@ -2283,13 +2283,14 @@ sys_kmq_timedreceive(struct thread *td, struct kmq_tim if (uap->abs_timeout != NULL) { error = copyin(uap->abs_timeout, &ets, sizeof(ets)); if (error != 0) - return (error); + goto out; abs_timeout = &ets; } else abs_timeout = NULL; waitok = !(fp->f_flag & O_NONBLOCK); error = mqueue_receive(mq, uap->msg_ptr, uap->msg_len, uap->msg_prio, waitok, abs_timeout); +out: fdrop(fp, td); return (error); } @@ -2309,13 +2310,14 @@ sys_kmq_timedsend(struct thread *td, struct kmq_timeds if (uap->abs_timeout != NULL) { error = copyin(uap->abs_timeout, &ets, sizeof(ets)); if (error != 0) - return (error); + goto out; abs_timeout = &ets; } else abs_timeout = NULL; 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); } @@ -2834,7 +2836,7 @@ freebsd32_kmq_timedreceive(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; @@ -2843,6 +2845,7 @@ freebsd32_kmq_timedreceive(struct thread *td, waitok = !(fp->f_flag & O_NONBLOCK); error = mqueue_receive(mq, uap->msg_ptr, uap->msg_len, uap->msg_prio, waitok, abs_timeout); +out: fdrop(fp, td); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907232059.x6NKxb9J008326>