aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUtkarsh Saxena <usaxena@codeaurora.org>2017-01-11 16:30:00 +0530
committerGreekDragon <alextsanisbadlorg@gmail.com>2019-04-20 04:59:13 -0700
commit4ad8c594d13a0365538221c040caffec34f62f25 (patch)
tree22b0966f6d72bd7a40665f7b9b9a6239fe5fef31
parent87ce0cb5549a4fd4a71f91a5cada55972f397c2e (diff)
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 <rna@qti.qualcomm.com> Signed-off-by: Utkarsh Saxena <usaxena@codeaurora.org>
-rw-r--r--net/netfilter/nf_conntrack_core.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 978bf7304c9..a4645007e25 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -222,15 +222,15 @@ 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);
- }
-
+ pr_debug("freeing item in the SIP list\n");
+ 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,
* before connection is in the list, so we need to clean here,