routing: plug mbuf leak for the packets hitting IPv6 blackhole route

Reported by:	Dmitriy Smirnov <[email protected]>
Tested by:	Dmitriy Smirnov <[email protected]>
MFC after:	1 day
This commit is contained in:
Alexander V. Chernikov committed 2023-05-17 09:06:04 +00:00
1 parent 4c63ecf5c7
commit b50e1465e8
1 file changed
+6 -3
+6 -3
View File
@@ -198,9 +198,12 @@ again:
if (nh->nh_flags & (NHF_BLACKHOLE | NHF_REJECT)) {
IP6STAT_INC(ip6s_cantforward);
if ((nh->nh_flags & NHF_REJECT) && (mcopy != NULL)) {
icmp6_error(mcopy, ICMP6_DST_UNREACH,
ICMP6_DST_UNREACH_REJECT, 0);
if (mcopy != NULL) {
if (nh->nh_flags & NHF_REJECT) {
icmp6_error(mcopy, ICMP6_DST_UNREACH,
ICMP6_DST_UNREACH_REJECT, 0);
} else
m_freem(mcopy);
}
goto bad;
}