diff mbox

[net] VXLAN: fix potential NULL dereference in arp_reduce()

Message ID 201403181632.s2IGWTjT003613@lab1.dls
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

David Stevens March 18, 2014, 4:32 p.m. UTC
This patch fixes a NULL pointer dereference in the event of an
skb allocation failure in arp_reduce().

Signed-Off-By: David L Stevens <dlstevens@us.ibm.com>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Cong Wang March 18, 2014, 4:53 p.m. UTC | #1
On Tue, Mar 18, 2014 at 9:32 AM, David L Stevens <dlstevens@us.ibm.com> wrote:
>
>         This patch fixes a NULL pointer dereference in the event of an
> skb allocation failure in arp_reduce().
>
> Signed-Off-By: David L Stevens <dlstevens@us.ibm.com>
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index eb59b14..570792c 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -1315,6 +1315,9 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb)
>
>                 neigh_release(n);
>
> +               if (reply == NULL)
> +                       goto out;
> +

Nit: move it right after arp_create(). Otherwise:

Acked-by: Cong Wang <cwang@twopensource.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Stevens March 18, 2014, 4:57 p.m. UTC | #2
>From: Cong Wang 

>
>Nit: move it right after arp_create(). Otherwise:
>

That would exit without releasing the neighbor reference.

                                                   +-DLS

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Cong Wang March 18, 2014, 5:36 p.m. UTC | #3
On Tue, Mar 18, 2014 at 9:57 AM, David Stevens <dlstevens@us.ibm.com> wrote:
>
>
>>From: Cong Wang
>
>>
>>Nit: move it right after arp_create(). Otherwise:
>>
>
> That would exit without releasing the neighbor reference.
>

Ah, then it's ok.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 18, 2014, 8:10 p.m. UTC | #4
From: David L Stevens <dlstevens@us.ibm.com>
Date: Tue, 18 Mar 2014 12:32:29 -0400

> 	This patch fixes a NULL pointer dereference in the event of an
> skb allocation failure in arp_reduce().
> 
> Signed-Off-By: David L Stevens <dlstevens@us.ibm.com>

Applied, thanks.

Please refer to subsystems in your Subject lines using lowercase
letters, as is the convention these days.  I've fixed it up this
time.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index eb59b14..570792c 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1315,6 +1315,9 @@  static int arp_reduce(struct net_device *dev, struct sk_buff *skb)
 
 		neigh_release(n);
 
+		if (reply == NULL)
+			goto out;
+
 		skb_reset_mac_header(reply);
 		__skb_pull(reply, skb_network_offset(reply));
 		reply->ip_summed = CHECKSUM_UNNECESSARY;