Netdev List
 help / color / mirror / Atom feed
* Re: [BUGFIX][PATCH 3/3] memcg/tcp: ignore tcp usage before accounting started
From: David Miller @ 2012-04-02  3:41 UTC (permalink / raw)
  To: glommer; +Cc: kamezawa.hiroyu, netdev, akpm
In-Reply-To: <4F742983.1080402@parallels.com>

From: Glauber Costa <glommer@parallels.com>
Date: Thu, 29 Mar 2012 11:21:07 +0200

> On 03/29/2012 09:10 AM, KAMEZAWA Hiroyuki wrote:
>> tcp memcontrol starts accouting after res->limit is set. So, if a sockets
>> starts before setting res->limit, there are already used resource.
>> After setting res->limit, the resource (already used) will be uncharged and
>> make res_counter below 0 because they are not charged. This causes warning.
>> 
>> This patch fixes that by adding res_counter_uncharge_nowarn().
>> (*) We cannot avoid this while we have 'account start' switch.
>> 
>> Signed-off-by: KAMEZAWA Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com>
> 
> Fine by me.
> 
> Acked-by: Glauber Costa <glommer@parallels.com>

I'm not applying patches that simply ignore accounting counter
underflows.

You must either:

1) Integrate the socket's existing usage when the limit is set.

2) Avoid accounting completely for a socket that started before
   the limit was set.

No half-way solutions, please.  Otherwise it is impossible to design
validations of the resource usage for a particular socket or group of
sockets, because they can always be potentially "wrong" and over the
limit.  That's a design for a buggy system.

^ permalink raw reply

* Re: [PATCH] net: Report dev->promiscuity in netlink reports.
From: David Miller @ 2012-04-02  3:35 UTC (permalink / raw)
  To: greearb; +Cc: netdev
In-Reply-To: <1333061490-4484-1-git-send-email-greearb@candelatech.com>

From: greearb@candelatech.com
Date: Thu, 29 Mar 2012 15:51:30 -0700

> From: Ben Greear <greearb@candelatech.com>
> 
> The standard ways of probing a device's promiscuity
> (ifi_flags, for instance) does not report the actual
> state of the device.  This patch adds dev->promiscuity
> to the netlink netdevice report so that users can know
> for certain if the device is acting PROMISC or not.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>

Ok, applied to net-next, thanks.

^ permalink raw reply

* Re: [PATCH] net: usb: cdc_eem: fix mtu
From: David Miller @ 2012-04-02  3:33 UTC (permalink / raw)
  To: rabin; +Cc: oliver, linux-usb, netdev
In-Reply-To: <1333041315-4303-1-git-send-email-rabin@rab.in>

From: Rabin Vincent <rabin@rab.in>
Date: Thu, 29 Mar 2012 22:45:15 +0530

> Make CDC EEM recalculate the hard_mtu after adjusting the
> hard_header_len.
> 
> Without this, usbnet adjusts the MTU down to 1494 bytes, and the host is
> unable to receive standard 1500-byte frames from the device.
> 
> Tested with the Linux USB Ethernet gadget.
> 
> Cc: Oliver Neukum <oliver@neukum.name>
> Signed-off-by: Rabin Vincent <rabin@rab.in>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* Re: [PATCH net-next-2.6] net: remove unused icmp_ioctl() definition.
From: David Miller @ 2012-04-02  3:31 UTC (permalink / raw)
  To: ramirose; +Cc: netdev
In-Reply-To: <CAHLOa7RZFQHLtsYE2VeS7Fmhcr+O9guEFYYVoGTPJQos48Eo1w@mail.gmail.com>

From: Rami Rosen <ramirose@gmail.com>
Date: Thu, 29 Mar 2012 20:49:01 +0200

> The patch removes unused icmp_ioctl() method definition in
> include/net/icmp.h.
> 
> Signed-off-by: Rami Rosen <ramirose@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH] net: check the length of the data before dereferencing it
From: David Miller @ 2012-04-02  3:29 UTC (permalink / raw)
  To: eric.dumazet; +Cc: xiaosuo, kaber, pablo, netfilter-devel, netdev
In-Reply-To: <1333336773.2325.6531.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 02 Apr 2012 05:19:33 +0200

>> @@ -3845,6 +3845,8 @@ void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *o
>>  			length--;
>>  			continue;
>>  		default:
>> +			if (length < 2)
>> +				return;
>>  			opsize = *ptr++;
>>  			if (opsize < 2) /* "silly options" */
>>  				return;
> 
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Tag Eric, you're it.

You ACK'd this patch, so you get to show how this is actually able
to cause some kind of problem.

I assert that this is adding a useless test, that doesn't fix any kind
of possible crash or misbehavior.  If length == 1 at the default:, the
code will absolutely do the right thing.

Prove me wrong.

^ permalink raw reply

* [PATCH] netfilter: don't scale the size of the window up twice
From: Changli Gao @ 2012-04-02  3:25 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev,
	Changli Gao

For a picked up connection, the window win is scaled twice: one is by the
initialization code, and the other is by the sender updating code.

I use the temporary variable swin instead of modifying the variable win.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 361eade..0d07a1d 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
 			 * Let's try to use the data from the packet.
 			 */
 			sender->td_end = end;
-			win <<= sender->td_scale;
-			sender->td_maxwin = (win == 0 ? 1 : win);
+			swin = win << sender->td_scale;
+			sender->td_maxwin = (swin == 0 ? 1 : swin);
 			sender->td_maxend = end + sender->td_maxwin;
 			/*
 			 * We haven't seen traffic in the other direction yet

^ permalink raw reply related

* Re: [PATCH] net: sh_eth: fix endian check for architecture independent
From: David Miller @ 2012-04-02  3:22 UTC (permalink / raw)
  To: yoshihiro.shimoda.uh; +Cc: netdev, linux-sh
In-Reply-To: <4F754558.1070001@renesas.com>

From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
Date: Fri, 30 Mar 2012 14:32:08 +0900

> SuperH has the "CONFIG_CPU_LITTLE_ENDIAN" and the "__LITTLE_ENDIAN__".
> But, other architecture doesn't have them. So, this patch fixes it.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Applied.

^ permalink raw reply

* Re: [PATCH] usb/rtl8150 : Remove duplicated definitions
From: David Miller @ 2012-04-02  3:20 UTC (permalink / raw)
  To: huajun.li.lee; +Cc: petkan, netdev
In-Reply-To: <CA+v9cxYHCNTmPagMBMM6quco2EexCobZrF-bpvhKVP40OWjNhA@mail.gmail.com>

From: Huajun Li <huajun.li.lee@gmail.com>
Date: Fri, 30 Mar 2012 18:11:05 +0800

> There exist duplicated macro definitions in rtl8150.c, remove them.
> 
> Signed-off-by: Huajun Li <huajun.li.lee@gmail.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] net: check the length of the data before dereferencing it
From: David Miller @ 2012-04-02  3:19 UTC (permalink / raw)
  To: xiaosuo; +Cc: kaber, pablo, eric.dumazet, netfilter-devel, netdev
In-Reply-To: <1333336250-4110-1-git-send-email-xiaosuo@gmail.com>

From: Changli Gao <xiaosuo@gmail.com>
Date: Mon,  2 Apr 2012 11:10:50 +0800

> We should check the length of the data before dereferencing it when parsing
> the TCP options.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>

Proper Subject prefix here would be "tcp: ", not "net: "
and maybe adjust the subject line to also mention the
specific function being fixed, which in this case would
be tcp_parse_options().  So:

	tcp: Validate length of data before dereference in tcp_parse_options().

and then you can make the commit message just be your signoff.


^ permalink raw reply

* Re: [PATCH] net: check the length of the data before dereferencing it
From: Eric Dumazet @ 2012-04-02  3:19 UTC (permalink / raw)
  To: Changli Gao
  Cc: David S. Miller, Patrick McHardy, Pablo Neira Ayuso,
	netfilter-devel, netdev
In-Reply-To: <1333336250-4110-1-git-send-email-xiaosuo@gmail.com>

On Mon, 2012-04-02 at 11:10 +0800, Changli Gao wrote:
> We should check the length of the data before dereferencing it when parsing
> the TCP options.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ---
>  net/ipv4/tcp_input.c |    2 ++
>  1 file changed, 2 insertions(+)
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index e886e2f..5099f08 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -3845,6 +3845,8 @@ void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *o
>  			length--;
>  			continue;
>  		default:
> +			if (length < 2)
> +				return;
>  			opsize = *ptr++;
>  			if (opsize < 2) /* "silly options" */
>  				return;

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>



^ permalink raw reply

* Re: [PATCH] rionet: fix page allocation order of rionet_active
From: David Miller @ 2012-04-02  3:17 UTC (permalink / raw)
  To: akinobu.mita; +Cc: netdev, mporter, alexandre.bounine
In-Reply-To: <1333105306-2601-1-git-send-email-akinobu.mita@gmail.com>

From: Akinobu Mita <akinobu.mita@gmail.com>
Date: Fri, 30 Mar 2012 20:01:46 +0900

> rionet_active is allocated from the page allocator and the allocation
> order is calculated on the assumption that the page size is 4KB, so it
> wastes memory on more than 4K page systems.
> 
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

Applied, thanks.

^ permalink raw reply

* [PATCH] net: check the length of the data before dereferencing it
From: Changli Gao @ 2012-04-02  3:10 UTC (permalink / raw)
  To: David S. Miller
  Cc: Patrick McHardy, Pablo Neira Ayuso, Eric Dumazet, netfilter-devel,
	netdev, Changli Gao

We should check the length of the data before dereferencing it when parsing
the TCP options.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 net/ipv4/tcp_input.c |    2 ++
 1 file changed, 2 insertions(+)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e886e2f..5099f08 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3845,6 +3845,8 @@ void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *o
 			length--;
 			continue;
 		default:
+			if (length < 2)
+				return;
 			opsize = *ptr++;
 			if (opsize < 2) /* "silly options" */
 				return;

^ permalink raw reply related

* Re: [PATCH] via-rhine: fix wait-bit inversion.
From: David Miller @ 2012-04-02  3:10 UTC (permalink / raw)
  To: romieu; +Cc: netdev, andi, DavidLv
In-Reply-To: <20120401223500.GA28138@electric-eye.fr.zoreil.com>

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Mon, 2 Apr 2012 00:35:00 +0200

> From: Andreas Mohr <andi@lisas.de>
> 
> Bug appeared in a384a33bb1c9ec2d99db2046b41f57023fa7d77b
> ("via-rhine: RHINE_WAIT_FOR macro removal). It can be noticed
> during suspend/resume.
> 
> Signed-off-by: Andreas Mohr <andi@lisas.de>
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
> Cc: David Lv <DavidLv@viatech.com.cn>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* Re: [PATCH 8/8] net/ipv6/addrconf.c: Checkpatch cleanups
From: David Miller @ 2012-04-02  3:07 UTC (permalink / raw)
  To: eldad; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1333302548-9187-8-git-send-email-eldad@fogrefinery.com>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Sun,  1 Apr 2012 19:49:08 +0200

> net/ipv6/addrconf.c:340: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> net/ipv6/addrconf.c:342: ERROR: "foo * bar" should be "foo *bar"
> net/ipv6/addrconf.c:444: ERROR: "foo * bar" should be "foo *bar"
> net/ipv6/addrconf.c:1337: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> net/ipv6/addrconf.c:1526: ERROR: "(foo*)" should be "(foo *)"
> net/ipv6/addrconf.c:1671: ERROR: open brace '{' following function declarations go on the next line
> net/ipv6/addrconf.c:1914: ERROR: "foo * bar" should be "foo *bar"
> net/ipv6/addrconf.c:2368: ERROR: "foo * bar" should be "foo *bar"
> net/ipv6/addrconf.c:2370: ERROR: "foo * bar" should be "foo *bar"
> net/ipv6/addrconf.c:2416: ERROR: "foo * bar" should be "foo *bar"
> net/ipv6/addrconf.c:2437: ERROR: "foo    * bar" should be "foo    *bar"
> net/ipv6/addrconf.c:2573: ERROR: "foo * bar" should be "foo *bar"
> net/ipv6/addrconf.c:3797: ERROR: "foo* bar" should be "foo *bar"
> 
> Signed-off-by: Eldad Zack <eldad@fogrefinery.com>

Applied.

^ permalink raw reply

* Re: [PATCH 7/8] net/ipv6/icmp.c: Checkpatch cleanups
From: David Miller @ 2012-04-02  3:07 UTC (permalink / raw)
  To: eldad; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1333302548-9187-7-git-send-email-eldad@fogrefinery.com>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Sun,  1 Apr 2012 19:49:07 +0200

> icmp.c:501: ERROR: "(foo*)" should be "(foo *)"
> icmp.c:582: ERROR: "(foo*)" should be "(foo *)"
> icmp.c:954: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> 
> Signed-off-by: Eldad Zack <eldad@fogrefinery.com>

Applied.

^ permalink raw reply

* Re: [PATCH 6/8] net/ipv6/fib6_rules.c: Checkpatch cleanup
From: David Miller @ 2012-04-02  3:07 UTC (permalink / raw)
  To: eldad; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1333302548-9187-6-git-send-email-eldad@fogrefinery.com>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Sun,  1 Apr 2012 19:49:06 +0200

> fib6_rules.c:26: ERROR: open brace '{' following struct go on the same line
> 
> Signed-off-by: Eldad Zack <eldad@fogrefinery.com>

Applied.

^ permalink raw reply

* Re: [PATCH 5/8] net/ipv6/exthdrs_core.c: Checkpatch cleanups
From: David Miller @ 2012-04-02  3:07 UTC (permalink / raw)
  To: eldad; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1333302548-9187-5-git-send-email-eldad@fogrefinery.com>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Sun,  1 Apr 2012 19:49:05 +0200

> exthdrs_core.c:113: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> exthdrs_core.c:114: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> 
> Signed-off-by: Eldad Zack <eldad@fogrefinery.com>

Applied.

^ permalink raw reply

* Re: [PATCH 4/8] net/ipv6/exthdrs.c: Checkpatch cleanups
From: David Miller @ 2012-04-02  3:07 UTC (permalink / raw)
  To: eldad; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1333302548-9187-4-git-send-email-eldad@fogrefinery.com>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Sun,  1 Apr 2012 19:49:04 +0200

> exthdrs.c:726: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> exthdrs.c:741: ERROR: "(foo*)" should be "(foo *)"
> exthdrs.c:741: ERROR: "(foo*)" should be "(foo *)"
> exthdrs.c:744: ERROR: "(foo**)" should be "(foo **)"
> exthdrs.c:746: ERROR: "(foo**)" should be "(foo **)"
> exthdrs.c:748: ERROR: "(foo**)" should be "(foo **)"
> exthdrs.c:750: ERROR: "(foo**)" should be "(foo **)"
> exthdrs.c:755: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> exthdrs.c:896: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> 
> Signed-off-by: Eldad Zack <eldad@fogrefinery.com>

Applied.

^ permalink raw reply

* Re: [PATCH 3/8] net/ipv6/datagram.c: Checkpatch cleanups
From: David Miller @ 2012-04-02  3:07 UTC (permalink / raw)
  To: eldad; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1333302548-9187-3-git-send-email-eldad@fogrefinery.com>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Sun,  1 Apr 2012 19:49:03 +0200

> datagram.c:101: ERROR: "(foo*)" should be "(foo *)"
> datagram.c:521: ERROR: space required before the open parenthesis '('
> datagram.c:830: WARNING: braces {} are not necessary for single statement blocks
> datagram.c:849: WARNING: braces {} are not necessary for single statement blocks
> 
> Signed-off-by: Eldad Zack <eldad@fogrefinery.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/8] net/ipv6/addrconf_core.c: Checkpatch cleanup
From: David Miller @ 2012-04-02  3:07 UTC (permalink / raw)
  To: eldad; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1333302548-9187-2-git-send-email-eldad@fogrefinery.com>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Sun,  1 Apr 2012 19:49:02 +0200

> addrconf_core.c:13: ERROR: space required before the open parenthesis '('
> 
> Signed-off-by: Eldad Zack <eldad@fogrefinery.com>

Applied.

^ permalink raw reply

* Re: [PATCH 1/8] net/ipv6/sit.c: Checkpatch cleanup
From: David Miller @ 2012-04-02  3:07 UTC (permalink / raw)
  To: eldad; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1333302548-9187-1-git-send-email-eldad@fogrefinery.com>

From: Eldad Zack <eldad@fogrefinery.com>
Date: Sun,  1 Apr 2012 19:49:01 +0200

> sit.c:118: ERROR: "foo * bar" should be "foo *bar"
> sit.c:694: ERROR: "(foo*)" should be "(foo *)"
> sit.c:724: ERROR: "(foo*)" should be "(foo *)"
> 
> Signed-off-by: Eldad Zack <eldad@fogrefinery.com>

Applied.

^ permalink raw reply

* Re: [PATCH] netfilter: check the length of the data before dereferencing it
From: Changli Gao @ 2012-04-02  3:05 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Eric Dumazet, Patrick McHardy, David S. Miller, netfilter-devel,
	netdev
In-Reply-To: <20120401170226.GA11101@1984>

On Mon, Apr 2, 2012 at 1:02 AM, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>
> Indeed, then I think we need a similar patch for tcp_parse_options()
> in net/ipv4/tcp_input.c

I'll send a separated patch for it. Thanks.

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)

^ permalink raw reply

* [PATCH 1/2 v2] pch_gbe: Do not abort probe on bad MAC
From: Tomoya MORINAGA @ 2012-04-02  3:00 UTC (permalink / raw)
  To: stable
  Cc: Tomoya MORINAGA, Darren Hart, Arjan van de Ven, Alan Cox,
	Jeff Kirsher, David S. Miller, Paul Gortmaker, Jon Mason, netdev,
	Mark Brown, David Laight, Joe Perches

If the MAC is invalid or not implemented, do not abort the probe. Issue
a warning and prevent bringing the interface up until a MAC is set manually
(via ifconfig $IFACE hw ether $MAC).

Tested on two platforms, one with a valid MAC, the other without a MAC. The real
MAC is used if present, the interface fails to come up until the MAC is set on
the other. They successfully get an IP over DHCP and pass a simple ping and
login over ssh test.

This is meant to allow the Inforce SYS940X development board:
http://www.inforcecomputing.com/SYS940X_ECX.html
(and others suffering from a missing MAC) to work with the mainline kernel.
Without this patch, the probe will fail and the interface will not be created,
preventing the user from configuring the MAC manually.

This does not make any attempt to address a missing or invalid MAC for the
pch_phub driver.

commit: 2b53d07891630dead46d65c8f896955fd3ae0302
kernel version: 3.0, 3.2

Cc: stable@vger.kernel.org
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
CC: Arjan van de Ven <arjan@linux.intel.com>
CC: Alan Cox <alan@linux.intel.com>
CC: Tomoya MORINAGA <tomoya.rohm@gmail.com>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Paul Gortmaker <paul.gortmaker@windriver.com>
CC: Jon Mason <jdmason@kudzu.us>
CC: netdev@vger.kernel.org
CC: Mark Brown <broonie@opensource.wolfsonmicro.com>
CC: David Laight <David.Laight@ACULAB.COM>
CC: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
---
v2:
  Retrieve change log and cc-/Signed-off lists.
---
 .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c   |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 48406ca..43c7b25 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -1745,6 +1745,12 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter)
 	struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring;
 	int err;
 
+	/* Ensure we have a valid MAC */
+	if (!is_valid_ether_addr(adapter->hw.mac.addr)) {
+		pr_err("Error: Invalid MAC address\n");
+		return -EINVAL;
+	}
+
 	/* hardware has been reset, we need to reload some things */
 	pch_gbe_set_multi(netdev);
 
@@ -2467,9 +2473,14 @@ static int pch_gbe_probe(struct pci_dev *pdev,
 
 	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
 	if (!is_valid_ether_addr(netdev->dev_addr)) {
-		dev_err(&pdev->dev, "Invalid MAC Address\n");
-		ret = -EIO;
-		goto err_free_adapter;
+		/*
+		 * If the MAC is invalid (or just missing), display a warning
+		 * but do not abort setting up the device. pch_gbe_up will
+		 * prevent the interface from being brought up until a valid MAC
+		 * is set.
+		 */
+		dev_err(&pdev->dev, "Invalid MAC address, "
+		                    "interface disabled.\n");
 	}
 	setup_timer(&adapter->watchdog_timer, pch_gbe_watchdog,
 		    (unsigned long)adapter);
-- 
1.7.7.6

^ permalink raw reply related

* [PATCH 50/51] xfrm: Stop using NLA_PUT*().
From: David S. Miller @ 2012-04-02  2:58 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller
In-Reply-To: <1333335521-1348-1-git-send-email-davem@davemloft.net>

From: "David S. Miller" <davem@davemloft.net>

These macros contain a hidden goto, and are thus extremely error
prone and make code hard to audit.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/xfrm.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 96239e7..1cb32bf 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1682,8 +1682,9 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
 
 static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
 {
-	if (m->m | m->v)
-		NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
+	if ((m->m | m->v) &&
+	    nla_put(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m))
+		goto nla_put_failure;
 	return 0;
 
 nla_put_failure:
-- 
1.7.7.6

^ permalink raw reply related

* [PATCH 51/51] netlink: Delete all NLA_PUT*() macros.
From: David S. Miller @ 2012-04-02  2:58 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller
In-Reply-To: <1333335521-1348-1-git-send-email-davem@davemloft.net>

From: "David S. Miller" <davem@davemloft.net>

They were error prone due to an embedded goto, and the entire tree has
been converted away from using them.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/netlink.h |   68 -------------------------------------------------
 1 files changed, 0 insertions(+), 68 deletions(-)

diff --git a/include/net/netlink.h b/include/net/netlink.h
index efbd2c1..785f37a 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -102,20 +102,6 @@
  *   nla_put_flag(skb, type)		add flag attribute to skb
  *   nla_put_msecs(skb, type, jiffies)	add msecs attribute to skb
  *
- * Exceptions Based Attribute Construction:
- *   NLA_PUT(skb, type, len, data)	add attribute to skb
- *   NLA_PUT_U8(skb, type, value)	add u8 attribute to skb
- *   NLA_PUT_U16(skb, type, value)	add u16 attribute to skb
- *   NLA_PUT_U32(skb, type, value)	add u32 attribute to skb
- *   NLA_PUT_U64(skb, type, value)	add u64 attribute to skb
- *   NLA_PUT_STRING(skb, type, str)	add string attribute to skb
- *   NLA_PUT_FLAG(skb, type)		add flag attribute to skb
- *   NLA_PUT_MSECS(skb, type, jiffies)	add msecs attribute to skb
- *
- *   The meaning of these functions is equal to their lower case
- *   variants but they jump to the label nla_put_failure in case
- *   of a failure.
- *
  * Nested Attributes Construction:
  *   nla_nest_start(skb, type)		start a nested attribute
  *   nla_nest_end(skb, nla)		finalize a nested attribute
@@ -927,60 +913,6 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
 	return nla_put(skb, attrtype, sizeof(u64), &tmp);
 }
 
-#define NLA_PUT(skb, attrtype, attrlen, data) \
-	do { \
-		if (unlikely(nla_put(skb, attrtype, attrlen, data) < 0)) \
-			goto nla_put_failure; \
-	} while(0)
-
-#define NLA_PUT_TYPE(skb, type, attrtype, value) \
-	do { \
-		type __tmp = value; \
-		NLA_PUT(skb, attrtype, sizeof(type), &__tmp); \
-	} while(0)
-
-#define NLA_PUT_U8(skb, attrtype, value) \
-	NLA_PUT_TYPE(skb, u8, attrtype, value)
-
-#define NLA_PUT_U16(skb, attrtype, value) \
-	NLA_PUT_TYPE(skb, u16, attrtype, value)
-
-#define NLA_PUT_LE16(skb, attrtype, value) \
-	NLA_PUT_TYPE(skb, __le16, attrtype, value)
-
-#define NLA_PUT_BE16(skb, attrtype, value) \
-	NLA_PUT_TYPE(skb, __be16, attrtype, value)
-
-#define NLA_PUT_NET16(skb, attrtype, value) \
-	NLA_PUT_BE16(skb, attrtype | NLA_F_NET_BYTEORDER, value)
-
-#define NLA_PUT_U32(skb, attrtype, value) \
-	NLA_PUT_TYPE(skb, u32, attrtype, value)
-
-#define NLA_PUT_BE32(skb, attrtype, value) \
-	NLA_PUT_TYPE(skb, __be32, attrtype, value)
-
-#define NLA_PUT_NET32(skb, attrtype, value) \
-	NLA_PUT_BE32(skb, attrtype | NLA_F_NET_BYTEORDER, value)
-
-#define NLA_PUT_U64(skb, attrtype, value) \
-	NLA_PUT_TYPE(skb, u64, attrtype, value)
-
-#define NLA_PUT_BE64(skb, attrtype, value) \
-	NLA_PUT_TYPE(skb, __be64, attrtype, value)
-
-#define NLA_PUT_NET64(skb, attrtype, value) \
-	NLA_PUT_BE64(skb, attrtype | NLA_F_NET_BYTEORDER, value)
-
-#define NLA_PUT_STRING(skb, attrtype, value) \
-	NLA_PUT(skb, attrtype, strlen(value) + 1, value)
-
-#define NLA_PUT_FLAG(skb, attrtype) \
-	NLA_PUT(skb, attrtype, 0, NULL)
-
-#define NLA_PUT_MSECS(skb, attrtype, jiffies) \
-	NLA_PUT_U64(skb, attrtype, jiffies_to_msecs(jiffies))
-
 /**
  * nla_get_u32 - return payload of u32 attribute
  * @nla: u32 netlink attribute
-- 
1.7.7.6

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox