netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netlabel: Fix a potential NULL pointer dereference
@ 2008-12-02  3:27 Paul Moore
  2008-12-03  8:37 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Moore @ 2008-12-02  3:27 UTC (permalink / raw)
  To: netdev

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

Signed-off-by: Paul Moore <paul.moore@hp.com>
---

 net/netlabel/netlabel_unlabeled.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index e8a5c32..90c8506 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -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);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netlabel: Fix a potential NULL pointer dereference
  2008-12-02  3:27 [PATCH] netlabel: Fix a potential NULL pointer dereference Paul Moore
@ 2008-12-03  8:37 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-12-03  8:37 UTC (permalink / raw)
  To: paul.moore; +Cc: netdev

From: Paul Moore <paul.moore@hp.com>
Date: Mon, 01 Dec 2008 22:27:55 -0500

> Fix a potential NULL pointer dereference seen when trying to remove a static
> label configuration with an invalid address/mask combination.
> 
> Signed-off-by: Paul Moore <paul.moore@hp.com>

Applied to net-2.6, thanks Paul.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-03 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02  3:27 [PATCH] netlabel: Fix a potential NULL pointer dereference Paul Moore
2008-12-03  8:37 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).