Skip to contentSkip to conversation

netlabel: Fix a potential NULL pointer dereference

PATCH Applied Paul Moore 2 participants 2 messages Dec 2, 2008 – Dec 3, 2008

Subsystems (3)
lore
Share & tools
lore

Paul Moore

author
#0 lore raw

PATCH 1/1 netlabel: Fix a potential NULL pointer dereference

Fix a potential NULL pointer dereference seen when trying to remove a static label configuration with an invalid address/mask combination.

---

 net/netlabel/netlabel_unlabeled.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
net/netlabel/netlabel_unlabeled.c +6 -4
index e8a5c32..90c8506 100644
@@ -574,9 +574,10 @@ static int netlbl_unlhsh_remove_addr4(struct net *net,
 	list_entry = netlbl_af4list_remove(addr->s_addr, mask->s_addr,
 					   &iface->addr4_list);
 	spin_unlock(&netlbl_unlhsh_lock);
-	if (list_entry == NULL)
+	if (list_entry != NULL)
+		entry = netlbl_unlhsh_addr4_entry(list_entry);
+	else
 		ret_val = -ENOENT;
-	entry = netlbl_unlhsh_addr4_entry(list_entry);
 
 	audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL,
 					      audit_info);
@@ -634,9 +635,10 @@ static int netlbl_unlhsh_remove_addr6(struct net *net,
 	spin_lock(&netlbl_unlhsh_lock);
 	list_entry = netlbl_af6list_remove(addr, mask, &iface->addr6_list);
 	spin_unlock(&netlbl_unlhsh_lock);
-	if (list_entry == NULL)
+	if (list_entry != NULL)
+		entry = netlbl_unlhsh_addr6_entry(list_entry);
+	else
 		ret_val = -ENOENT;
-	entry = netlbl_unlhsh_addr6_entry(list_entry);
 
 	audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL,
 					      audit_info);
maintainer Applied
#1 lore raw

From: Paul Moore <[email protected]>
Date: Mon, 01 Dec 2008 22:27:55 -0500

Quoted 4 lines

Fix a potential NULL pointer dereference seen when trying to remove a static label configuration with an invalid address/mask combination.

Applied to net-2.6, thanks Paul.