public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Cong Wang <amwang@redhat.com>
Cc: netdev@vger.kernel.org, bugs@syam.in,
	David Ward <david.ward@ll.mit.edu>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net] garp: fix a NULL pointer dereference bug
Date: Sun, 03 Mar 2013 21:26:30 -0800	[thread overview]
Message-ID: <1362374790.15793.87.camel@edumazet-glaptop> (raw)
In-Reply-To: <1362368217-30984-1-git-send-email-amwang@redhat.com>

On Mon, 2013-03-04 at 11:36 +0800, Cong Wang wrote:
> From: Cong Wang <amwang@redhat.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@syam.in
> Cc: bugs@syam.in
> Cc: David Ward <david.ward@ll.mit.edu>
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.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);


Nope this patch doesnt solve the problem

Crash is in :

49 8b 1c c6             mov    (%r14,%rax,8),%rbx 

Thats because r14 (port) is NULL

  parent reply	other threads:[~2013-03-04  5:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04  3:36 [Patch net] garp: fix a NULL pointer dereference bug Cong Wang
2013-03-04  3:41 ` Cong Wang
2013-03-04  5:26 ` Eric Dumazet [this message]
2013-03-04  9:55   ` Cong Wang
2013-03-04 14:56     ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362374790.15793.87.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=amwang@redhat.com \
    --cc=bugs@syam.in \
    --cc=davem@davemloft.net \
    --cc=david.ward@ll.mit.edu \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox