From 333aa64d054ce4e5c242cb50968005be07ebcc6f Mon Sep 17 00:00:00 2001 From: Brian Feldman Date: Wed, 22 Mar 2000 02:27:30 +0000 Subject: [PATCH] in6_pcb.c: Remove a bogus (redundant, just weird, etc.) key_freeso(so). There are no consumers of it now, nor does it seem there ever will be. in6?_pcb.c: Add an if (inp->in6?p_sp != NULL) before the call to ipsec[46]_delete_pcbpolicy(inp). In low-memory conditions this can cause a crash because in6?_sp can be NULL... --- sys/netinet/in_pcb.c | 3 ++- sys/netinet6/in6_pcb.c | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 2ac79ef4fd2..020987ea99b 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -527,7 +527,8 @@ in_pcbdetach(inp) struct inpcbinfo *ipi = inp->inp_pcbinfo; #ifdef IPSEC - ipsec4_delete_pcbpolicy(inp); + if (inp->inp_sp != NULL) + ipsec4_delete_pcbpolicy(inp); #endif /*IPSEC*/ inp->inp_gencnt = ++ipi->ipi_gencnt; in_pcbremlists(inp); diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index e8e7c167601..341260a3db6 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -719,9 +719,8 @@ in6_pcbdetach(inp) struct inpcbinfo *ipi = inp->inp_pcbinfo; #ifdef IPSEC - if (sotoinpcb(so) != 0) - key_freeso(so); - ipsec6_delete_pcbpolicy(inp); + if (inp->in6p_sp != NULL) + ipsec6_delete_pcbpolicy(inp); #endif /* IPSEC */ inp->inp_gencnt = ++ipi->ipi_gencnt; in_pcbremlists(inp);