git: 76cfc6fa0d81 - main - Fix a use after free in update_rtm_from_rc().
Alexander V. Chernikov
melifaro at FreeBSD.org
Fri May 14 16:10:17 UTC 2021
The branch main has been updated by melifaro:
URL: https://cgit.FreeBSD.org/src/commit/?id=76cfc6fa0d819e7caca86c8299947cea1af9d6bc
commit 76cfc6fa0d819e7caca86c8299947cea1af9d6bc
Author: Alexander V. Chernikov <melifaro at FreeBSD.org>
AuthorDate: 2021-05-14 16:03:08 +0000
Commit: Alexander V. Chernikov <melifaro at FreeBSD.org>
CommitDate: 2021-05-14 16:06:41 +0000
Fix a use after free in update_rtm_from_rc().
update_rtm_from_rc() calls update_rtm_from_info() internally.
The latter one may update provided prtm pointer with a new rtm.
Reassign rtm from prtm afeter calling update_rtm_from_info() to
avoid touching the freed rtm.
PR: 255871
Submitted by: lylgood at foxmail.com
MFC after: 3 days
---
sys/net/rtsock.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 6930bd167ac1..3cb645f42e4c 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -976,6 +976,7 @@ update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm,
if ((error = update_rtm_from_info(info, prtm, alloc_len)) != 0)
return (error);
+ rtm = *prtm;
rtm->rtm_flags = rc->rc_rt->rte_flags | nhop_get_rtflags(nh);
if (rtm->rtm_flags & RTF_GWFLAG_COMPAT)
rtm->rtm_flags = RTF_GATEWAY |
More information about the dev-commits-src-main
mailing list