svn commit: r350261 - stable/12/sys/kern
Ed Maste
emaste at FreeBSD.org
Tue Jul 23 21:12:33 UTC 2019
Author: emaste
Date: Tue Jul 23 21:12:32 2019
New Revision: 350261
URL: https://svnweb.freebsd.org/changeset/base/350261
Log:
MFC r350260: mqueuefs: fix struct file leak
In some error cases we previously leaked a stuct file.
Submitted by: mjg, markj
Approved by: so (insta-MFC)
Modified:
stable/12/sys/kern/uipc_mqueue.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/uipc_mqueue.c
==============================================================================
--- stable/12/sys/kern/uipc_mqueue.c Tue Jul 23 20:59:36 2019 (r350260)
+++ stable/12/sys/kern/uipc_mqueue.c Tue Jul 23 21:12:32 2019 (r350261)
@@ -2275,13 +2275,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);
}
@@ -2301,13 +2302,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);
}
@@ -2826,7 +2828,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;
@@ -2835,6 +2837,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);
}
More information about the svn-src-all
mailing list