From: Donald Sharp Date: Wed, 2 Aug 2017 16:10:50 +0000 (-0400) Subject: pimd: Clean back pointer upon deletion X-Git-Tag: frr-4.0-dev~468^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F797%2Fhead;p=mirror%2Ffrr.git pimd: Clean back pointer upon deletion The channel_oil has a back pointer(up) to the upstream data structure. If we are planning on keeping the channel oil (due to ref count issues) longer than keeping the upstream, when we delete the upstream we were not clearing the back pointer to up. This would result in a situation where if that memory has started to be used again it will cause a crash and other fun things. Ticket: CM-17092 Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index a8506501e5..95d1a840ff 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -153,6 +153,7 @@ static void upstream_channel_oil_detach(struct pim_upstream *up) /* Detaching from channel_oil, channel_oil may exist post del, but upstream would not keep reference of it */ + up->channel_oil->up = NULL; pim_channel_oil_del(up->channel_oil); up->channel_oil = NULL; }