[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1362368217-30984-1-git-send-email-amwang@redhat.com>
Date: Mon, 4 Mar 2013 11:36:57 +0800
From: Cong Wang <amwang@...hat.com>
To: netdev@...r.kernel.org
Cc: bugs@...m.in, David Ward <david.ward@...mit.edu>,
Stephen Hemminger <stephen@...workplumber.org>,
"David S. Miller" <davem@...emloft.net>,
Cong Wang <amwang@...hat.com>
Subject: [Patch net] garp: fix a NULL pointer dereference bug
From: Cong Wang <amwang@...hat.com>
A NULL-deref bug was reported in:
https://bugzilla.kernel.org/show_bug.cgi?id=54281
when deleting a vlan interface:
# ip link del em1.57
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffffa03c356f>] garp_uninit_applicant+0x2f/0xd0 [garp]
...
This is probably app->pdu is NULL'ed in garp_pdu_rcv()
in BH, while garp_uninit_applicant() only holds rtnl lock
which is not enough to prevent this.
OTOH, garp_pdu_queue() should ways be called with the spin lock.
Reported-by: bugs@...m.in
Cc: bugs@...m.in
Cc: David Ward <david.ward@...mit.edu>
Cc: Stephen Hemminger <stephen@...workplumber.org>
Cc: David S. Miller <davem@...emloft.net>
Signed-off-by: Cong Wang <amwang@...hat.com>
---
diff --git a/net/802/garp.c b/net/802/garp.c
index 8456f5d..5d9630a 100644
--- a/net/802/garp.c
+++ b/net/802/garp.c
@@ -609,8 +609,12 @@ void garp_uninit_applicant(struct net_device *dev, struct garp_application *appl
/* Delete timer and generate a final TRANSMIT_PDU event to flush out
* all pending messages before the applicant is gone. */
del_timer_sync(&app->join_timer);
+
+ spin_lock_bh(&app->lock);
garp_gid_event(app, GARP_EVENT_TRANSMIT_PDU);
garp_pdu_queue(app);
+ spin_unlock_bh(&app->lock);
+
garp_queue_xmit(app);
dev_mc_del(dev, appl->proto.group_address);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists