diff options
author | Mark Johnston <markj@FreeBSD.org> | 2021-03-25 21:55:20 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2021-03-28 15:03:37 +0000 |
commit | af6611e5adc69d791fc1441a1078ffb6c2ea12f0 (patch) | |
tree | 9023b921a44339e61ff473ef2888922d42e4fdff /sys/kern/uipc_accf.c | |
parent | fa6d101e5f67246a6804577a9532676eae64c049 (diff) | |
download | src-af6611e5adc69d791fc1441a1078ffb6c2ea12f0.tar.gz src-af6611e5adc69d791fc1441a1078ffb6c2ea12f0.zip |
accept_filter: Fix filter parameter handling
For filters which implement accf_create, the setsockopt(2) handler
caches the filter name in the socket, but it also incorrectly frees the
buffer containing the copy, leaving a dangling pointer. Note that no
accept filters provided in the base system are susceptible to this, as
they don't implement accf_create.
Approved by: re (gjb)
Reported by: Alexey Kulaev <alex.qart@gmail.com>
Discussed with: emaste
Security: kernel use-after-free
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 653a437c04440495cd8e7712c7cf39444f26f1ee)
(cherry picked from commit c7d10e7ec872070a40bbddc3158b1997c1df09af)
Diffstat (limited to 'sys/kern/uipc_accf.c')
-rw-r--r-- | sys/kern/uipc_accf.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/uipc_accf.c b/sys/kern/uipc_accf.c index debf4b2deeb1..3ca64dd21e25 100644 --- a/sys/kern/uipc_accf.c +++ b/sys/kern/uipc_accf.c @@ -299,6 +299,7 @@ accept_filt_setopt(struct socket *so, struct sockopt *sopt) so->sol_accept_filter = afp; so->sol_accept_filter_arg = accept_filter_arg; so->sol_accept_filter_str = accept_filter_str; + accept_filter_str = NULL; so->so_options |= SO_ACCEPTFILTER; out: SOCK_UNLOCK(so); |