nf_conntrack: Null pointer check added prior deleting sip node
authorUtkarsh Saxena <usaxena@codeaurora.org>
Wed, 11 Jan 2017 11:00:00 +0000 (16:30 +0530)
committerStricted <info@stricted.net>
Tue, 6 Aug 2019 11:33:35 +0000 (11:33 +0000)
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 <rna@qti.qualcomm.com>
Signed-off-by: Utkarsh Saxena <usaxena@codeaurora.org>
Signed-off-by: Jan Altensen <info@stricted.net>
net/netfilter/nf_conntrack_core.c

index 261acb30d08ea6354179783cfcd6c4743ca53234..c50c89ca6ffb985327309245311dc31b9468057f 100644 (file)
@@ -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,