svn commit: r350284 - in releng: 11.2/sys/kern 11.3/sys/kern 12.0/sys/kern
Gordon Tetlow
gordon at FreeBSD.org
Wed Jul 24 12:55:17 UTC 2019
Author: gordon
Date: Wed Jul 24 12:55:16 2019
New Revision: 350284
URL: https://svnweb.freebsd.org/changeset/base/350284
Log:
Fix reference count overflow in mqueuefs.
Approved by: so
Security: FreeBSD-SA-19:15.mqueuefs
Security: CVE-2019-5603
Modified:
releng/11.2/sys/kern/uipc_mqueue.c
releng/11.3/sys/kern/uipc_mqueue.c
releng/12.0/sys/kern/uipc_mqueue.c
Modified: releng/11.2/sys/kern/uipc_mqueue.c
==============================================================================
--- releng/11.2/sys/kern/uipc_mqueue.c Wed Jul 24 12:54:10 2019 (r350283)
+++ releng/11.2/sys/kern/uipc_mqueue.c Wed Jul 24 12:55:16 2019 (r350284)
@@ -2266,13 +2266,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);
}
@@ -2291,13 +2292,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);
}
@@ -2815,7 +2817,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;
@@ -2824,6 +2826,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);
}
Modified: releng/11.3/sys/kern/uipc_mqueue.c
==============================================================================
--- releng/11.3/sys/kern/uipc_mqueue.c Wed Jul 24 12:54:10 2019 (r350283)
+++ releng/11.3/sys/kern/uipc_mqueue.c Wed Jul 24 12:55:16 2019 (r350284)
@@ -2266,13 +2266,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);
}
@@ -2291,13 +2292,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);
}
@@ -2815,7 +2817,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;
@@ -2824,6 +2826,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);
}
Modified: releng/12.0/sys/kern/uipc_mqueue.c
==============================================================================
--- releng/12.0/sys/kern/uipc_mqueue.c Wed Jul 24 12:54:10 2019 (r350283)
+++ releng/12.0/sys/kern/uipc_mqueue.c Wed Jul 24 12:55:16 2019 (r350284)
@@ -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