From: Utkarsh Saxena Date: Wed, 11 Jan 2017 11:00:00 +0000 (+0530) Subject: nf_conntrack: Null pointer check added prior deleting sip node X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4501495340b8cd4c944dffc06679b04bbbcccb38;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git nf_conntrack: Null pointer check added prior deleting sip node Prior to null pointer check, SIP node was deleted from the list a null pointer check is added to confront the exception. Bug: 111529827 Change-Id: Ia12fa468eed7d1a91fad96840fa27cb0e4e208a8 Acked-by: Rishav LNU Signed-off-by: Utkarsh Saxena Signed-off-by: Jan Altensen --- diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 261acb30d08..c50c89ca6ff 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -222,14 +222,14 @@ destroy_conntrack(struct nf_conntrack *nfct) spin_lock_bh(&nf_conntrack_lock); - list_for_each_safe(sip_node_list, sip_node_save_list, - &ct->sip_segment_list) - { - sip_node = list_entry(sip_node_list, struct sip_list, list); - pr_debug("freeing item in the SIP list\n"); - list_del(&(sip_node->list)); - kfree(sip_node); - } + if (ct->sip_segment_list.next != NULL) + list_for_each_safe(sip_node_list, sip_node_save_list, + &ct->sip_segment_list) { + sip_node = list_entry(sip_node_list, + struct sip_list, list); + list_del(&sip_node->list); + kfree(sip_node); + } /* Expectations will have been removed in clean_from_lists, * except TFTP can create an expectation on the first packet,