Netdev List
 help / color / mirror / Atom feed
* re: smsc95xx: detect chip revision specific features
From: Dan Carpenter @ 2012-11-26 20:47 UTC (permalink / raw)
  To: steve.glendinning; +Cc: netdev

Hello Steve Glendinning,

The patch 9ebca5071c86: "smsc95xx: detect chip revision specific 
features" from Nov 22, 2012, leads to the following warning:
drivers/net/usb/smsc95xx.c:1349 smsc95xx_suspend()
	 error: buffer overflow 'filter_mask' 8 <= 31

drivers/net/usb/smsc95xx.c
  1283          if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) {
  1284                  u32 *filter_mask = kzalloc(32, GFP_KERNEL);
                                                   ^^
We allocate 8 unsigned 32 bit values.  I think this is the mistake here
actually.  It is a typo and should say:

			u32 *filter_mask = kzalloc(sizeof(u32) * 32, GFP_KERNEL);

If 8 elements was the intent then that's nasty.

  1285                  u32 command[2];
  1286                  u32 offset[2];
  1287                  u32 crc[4];
  1288                  int wuff_filter_count =
  1289                          (pdata->features & FEATURE_8_WAKEUP_FILTERS) ?
  1290                          LAN9500A_WUFF_NUM : LAN9500_WUFF_NUM;

LAN9500A_WUFF_NUM is 8.  LAN9500_WUFF_NUM is 4.

  1291                  int i, filter = 0;
  1292  

[snip]

  1348                  for (i = 0; i < (wuff_filter_count * 4); i++) {
                                         ^^^^^^^^^^^^^^^^^^^^^

We are either counting to 15 or 31, and both are more that 8.

  1349                          ret = smsc95xx_write_reg_nopm(dev, WUFF, filter_mask[i]);
                                                                         ^^^^^^^^^^^^^^
So we're going past the end of the 8 element array.

  1350                          if (ret < 0)
  1351                                  kfree(filter_mask);
  1352                          check_warn_return(ret, "Error writing WUFF\n");
  1353                  }

regards,
dan carpenter

^ permalink raw reply

* pull-request: can 2012-11-26
From: Marc Kleine-Budde @ 2012-11-26 21:47 UTC (permalink / raw)
  To: netdev; +Cc: linux-can

Hello David,

two late fixes for v3.7 from Oliver Hartkopp, he found and fixed a problem in
the peak usb driver, a hardware timestamp is assigned wrong. In the second
patch he fixed a problem in the broadcast manager, in case of a timeout the
rx_ifindex is not set properly.

regards, Marc

---

The following changes since commit 194d9831f0419b5125dc94ec0ece4434d8ef74f0:

  Merge tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound (2012-11-24 08:32:11 -1000)

are available in the git repository at:


  git://gitorious.org/linux-can/linux-can.git fixes-for-3.7

for you to fetch changes up to 81b401100c01d2357031e874689f89bd788d13cd:

  can: bcm: initialize ifindex for timeouts without previous frame reception (2012-11-26 22:33:59 +0100)

----------------------------------------------------------------
Oliver Hartkopp (2):
      can: peak_usb: fix hwtstamp assignment
      can: bcm: initialize ifindex for timeouts without previous frame reception

 drivers/net/can/usb/peak_usb/pcan_usb.c     |    8 ++++++--
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c |    8 ++++++--
 net/can/bcm.c                               |    3 +++
 3 files changed, 15 insertions(+), 4 deletions(-)



^ permalink raw reply

* [PATCH 2/2] can: bcm: initialize ifindex for timeouts without previous frame reception
From: Marc Kleine-Budde @ 2012-11-26 21:47 UTC (permalink / raw)
  To: netdev; +Cc: linux-can, Oliver Hartkopp, linux-stable, Marc Kleine-Budde
In-Reply-To: <1353966430-12601-1-git-send-email-mkl@pengutronix.de>

From: Oliver Hartkopp <socketcan@hartkopp.net>

Set in the rx_ifindex to pass the correct interface index in the case of a
message timeout detection. Usually the rx_ifindex value is set at receive
time. But when no CAN frame has been received the RX_TIMEOUT notification
did not contain a valid value.

Cc: linux-stable <stable@vger.kernel.org>
Reported-by: Andre Naujoks <nautsch2@googlemail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/bcm.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/can/bcm.c b/net/can/bcm.c
index 6f74758..969b7cd 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1084,6 +1084,9 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
 		op->sk = sk;
 		op->ifindex = ifindex;
 
+		/* ifindex for timeout events w/o previous frame reception */
+		op->rx_ifindex = ifindex;
+
 		/* initialize uninitialized (kzalloc) structure */
 		hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 		op->timer.function = bcm_rx_timeout_handler;
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 1/2] can: peak_usb: fix hwtstamp assignment
From: Marc Kleine-Budde @ 2012-11-26 21:47 UTC (permalink / raw)
  To: netdev; +Cc: linux-can, Oliver Hartkopp, linux-stable, Marc Kleine-Budde
In-Reply-To: <1353966430-12601-1-git-send-email-mkl@pengutronix.de>

From: Oliver Hartkopp <socketcan@hartkopp.net>

The skb->tstamp is set to the hardware timestamp when available in the USB
urb message. This leads to user visible timestamps which contain the 'uptime'
of the USB adapter - and not the usual system generated timestamp.

Fix this wrong assignment by applying the available hardware timestamp to the
skb_shared_hwtstamps data structure - which is intended for this purpose.

Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/peak_usb/pcan_usb.c     |    8 ++++++--
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c |    8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 86f26a1..25723d8 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -519,8 +519,10 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
 	mc->pdev->dev.can.state = new_state;
 
 	if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) {
+		struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
+
 		peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv);
-		skb->tstamp = timeval_to_ktime(tv);
+		hwts->hwtstamp = timeval_to_ktime(tv);
 	}
 
 	netif_rx(skb);
@@ -605,6 +607,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)
 	struct sk_buff *skb;
 	struct can_frame *cf;
 	struct timeval tv;
+	struct skb_shared_hwtstamps *hwts;
 
 	skb = alloc_can_skb(mc->netdev, &cf);
 	if (!skb)
@@ -652,7 +655,8 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)
 
 	/* convert timestamp into kernel time */
 	peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv);
-	skb->tstamp = timeval_to_ktime(tv);
+	hwts = skb_hwtstamps(skb);
+	hwts->hwtstamp = timeval_to_ktime(tv);
 
 	/* push the skb */
 	netif_rx(skb);
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
index e1626d9..30d79bf 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
@@ -532,6 +532,7 @@ static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if,
 	struct can_frame *can_frame;
 	struct sk_buff *skb;
 	struct timeval tv;
+	struct skb_shared_hwtstamps *hwts;
 
 	skb = alloc_can_skb(netdev, &can_frame);
 	if (!skb)
@@ -549,7 +550,8 @@ static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if,
 		memcpy(can_frame->data, rx->data, can_frame->can_dlc);
 
 	peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(rx->ts32), &tv);
-	skb->tstamp = timeval_to_ktime(tv);
+	hwts = skb_hwtstamps(skb);
+	hwts->hwtstamp = timeval_to_ktime(tv);
 
 	netif_rx(skb);
 	netdev->stats.rx_packets++;
@@ -570,6 +572,7 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if,
 	u8 err_mask = 0;
 	struct sk_buff *skb;
 	struct timeval tv;
+	struct skb_shared_hwtstamps *hwts;
 
 	/* nothing should be sent while in BUS_OFF state */
 	if (dev->can.state == CAN_STATE_BUS_OFF)
@@ -664,7 +667,8 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if,
 	dev->can.state = new_state;
 
 	peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(er->ts32), &tv);
-	skb->tstamp = timeval_to_ktime(tv);
+	hwts = skb_hwtstamps(skb);
+	hwts->hwtstamp = timeval_to_ktime(tv);
 	netif_rx(skb);
 	netdev->stats.rx_packets++;
 	netdev->stats.rx_bytes += can_frame->can_dlc;
-- 
1.7.10.4

^ permalink raw reply related

* Re: [PATCH net-next] dsa: Hide core config options; make drivers select what they need
From: David Miller @ 2012-11-26 22:11 UTC (permalink / raw)
  To: rdunlap; +Cc: bhutchings, netdev, viresh.kumar
In-Reply-To: <50B3C8B0.5000308@infradead.org>

From: Randy Dunlap <rdunlap@infradead.org>
Date: Mon, 26 Nov 2012 11:53:20 -0800

> On 11/26/2012 11:16 AM, Ben Hutchings wrote:
> 
>> Commit 82167cb8c6b2f8166d5c7532e5ef4b5e0cc46a72 ('net: dsa/slave: Fix
>> compilation warnings') fixed one possible invalid configuration
>> (NET_DSA enabled with no trailer formats) but added others: drivers
>> can select NET_DSA without its dependencies being met.
>> 
>> It's not very useful to make either the DSA core or the tagging
>> formats manually selectable without a driver to use them, so:
>> 
>> 1. Define a hidden HAVE_NET_DSA option and move the dependencies of
>>    NET_DSA to that.  While we're at it, drop the deprecated
>>    EXPERIMENTAL dependency.
>> 2. Make NET_DSA and the drivers dependent on HAVE_NET_DSA.
>> 3. Hide the tagging format options again.
>> 4. Make drivers select both NET_DSA and the appropriate tagging format
>>    option.
>> 
>> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> 
> Acked-by: Randy Dunlap <rdunlap@infradead.org>

Applied, thanks everyone.

^ permalink raw reply

* Re: pull-request: can 2012-11-26
From: David Miller @ 2012-11-26 22:16 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can
In-Reply-To: <1353966430-12601-1-git-send-email-mkl@pengutronix.de>

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Mon, 26 Nov 2012 22:47:08 +0100

> two late fixes for v3.7 from Oliver Hartkopp, he found and fixed a problem in
> the peak usb driver, a hardware timestamp is assigned wrong. In the second
> patch he fixed a problem in the broadcast manager, in case of a timeout the
> rx_ifindex is not set properly.

Pulled, but I cannot guarentee these will make it into 3.7 as
this is very late and I am also travelling.

Worst case is they end up in net-next and you can submit them
to -stable if you wish.

^ permalink raw reply

* Re: [PATCH v2] atm: br2684: Fix excessive queue bloat
From: David Miller @ 2012-11-26 22:16 UTC (permalink / raw)
  To: dwmw2; +Cc: netdev, blogic, dave.taht, chas
In-Reply-To: <1353881212.26346.303.camel@shinybook.infradead.org>


Applied, thanks a lot.

^ permalink raw reply

* Re: [PATCH net-next 0/2] tun: trivial fixes.
From: David Miller @ 2012-11-26 22:22 UTC (permalink / raw)
  To: ramirose; +Cc: maxk, netdev
In-Reply-To: <1353917261-2974-1-git-send-email-ramirose@gmail.com>

From: Rami Rosen <ramirose@gmail.com>
Date: Mon, 26 Nov 2012 10:07:39 +0200

> These two patches contain trivial fixes to the tun driver.
>   First patch fixes 4 typos.
>   Second patch puts the correct method name in a debug message in tun_do_read().
> 
> Rami Rosen (2):
>   [PATCH net-next 1/2] vtun: fix typos.
>   [PATCH net-next 2/2] tun: put correct method name in a debug message.

All applied to net-next

^ permalink raw reply

* Re: [net-next.git 0/6 (V5)] stmmac: remove dead code for STMMAC_TIMER and add new mitigation schema
From: David Miller @ 2012-11-26 22:23 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, bhutchings
In-Reply-To: <1353921046-5121-1-git-send-email-peppe.cavallaro@st.com>

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Mon, 26 Nov 2012 10:10:40 +0100

> These patch series remove the STMMAC_TIMER option no longer updated
> and never used and add a new mitigation schema.
> Having removed the Timer opt, this has made the driver slim.
> On top of this work, it has been easier to introduce the new
> mitigation schema based on HW RX-watchdog (available in new cores).
> In fact, 3.50 and newer cores have an HW RX-Watchdog that can be used for 
> mitigating the Rx-interrupts and first results look promising.

All applied to net-next

^ permalink raw reply

* Re: [PATCH net-next 1/2] ptp: reduce stack usage when reading external time stamps
From: David Miller @ 2012-11-26 22:23 UTC (permalink / raw)
  To: richardcochran; +Cc: netdev
In-Reply-To: <1146e32bcb835ebf394bab91db3161600ab5213a.1353929829.git.richardcochran@gmail.com>

From: Richard Cochran <richardcochran@gmail.com>
Date: Mon, 26 Nov 2012 12:44:34 +0100

> This patch removes the large buffer from the stack of the read file
> operation and replaces it with a kmalloced buffer.
> 
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next 2/2] ptp: reduce stack usage when measuring the system time offset
From: David Miller @ 2012-11-26 22:23 UTC (permalink / raw)
  To: richardcochran; +Cc: netdev
In-Reply-To: <6151dfc7e5bb80d73563502a2a14c9f2aad8bdb0.1353929830.git.richardcochran@gmail.com>

From: Richard Cochran <richardcochran@gmail.com>
Date: Mon, 26 Nov 2012 12:44:35 +0100

> This patch removes the large buffer from the stack of the system
> offset ioctl and replaces it with a kmalloced buffer.
> 
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next] cpts: add missing kconfig dependency
From: David Miller @ 2012-11-26 22:23 UTC (permalink / raw)
  To: richardcochran; +Cc: netdev, linux-arm-kernel, cyril, mugunthanvnm
In-Reply-To: <1353931638-1023-1-git-send-email-richardcochran@gmail.com>

From: Richard Cochran <richardcochran@gmail.com>
Date: Mon, 26 Nov 2012 13:07:18 +0100

> The Common Platform Time Sync function of the CPSW does not depend the
> CPSW configuration option as it should. This patch fixes the issue by
> adding the dependency.
> 
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net] ipv4: avoid passing NULL to inet_putpeer() in icmpv4_xrlim_allow()
From: David Miller @ 2012-11-26 22:25 UTC (permalink / raw)
  To: ncardwell; +Cc: netdev
In-Reply-To: <1353819277-2350-1-git-send-email-ncardwell@google.com>

From: Neal Cardwell <ncardwell@google.com>
Date: Sat, 24 Nov 2012 23:54:37 -0500

> inet_getpeer_v4() can return NULL under OOM conditions, and while
> inet_peer_xrlim_allow() is OK with a NULL peer, inet_putpeer() will
> crash.
> 
> This code path now uses the same idiom as the others from:
> 1d861aa4b3fb08822055345f480850205ffe6170 ("inet: Minimize use of
> cached route inetpeer.").
> 
> Signed-off-by: Neal Cardwell <ncardwell@google.com>

Applied, thanks a lot Neil.

^ permalink raw reply

* Re: private netdev flags into UAPI?
From: Or Gerlitz @ 2012-11-26 22:29 UTC (permalink / raw)
  To: David Howells; +Cc: Or Gerlitz, netdev
In-Reply-To: <10845.1353921761@warthog.procyon.org.uk>

On Mon, Nov 26, 2012 at 11:22 AM, David Howells <dhowells@redhat.com> wrote:
> They were exposed to userspace already

So the script carries the bug into a new directory... why? AFAIK,
intentionally there's no way to read private flags from user space, so
what's the point in defining them there?

Or.

^ permalink raw reply

* Re: [PATCH net-next 2/2] tun: put correct method name in a debug message.
From: Joe Perches @ 2012-11-26 22:31 UTC (permalink / raw)
  To: Rami Rosen; +Cc: davem, maxk, netdev
In-Reply-To: <1353917261-2974-3-git-send-email-ramirose@gmail.com>

On Mon, 2012-11-26 at 10:07 +0200, Rami Rosen wrote:
> This patch puts the correct method name, tun_do_read, in a debug message.
> 
> Signed-off-by: Rami Rosen <ramirose@gmail.com>
> ---
>  drivers/net/tun.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 1dfb135..607a3a5 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1296,7 +1296,7 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,
>  	struct sk_buff *skb;
>  	ssize_t ret = 0;
>  
> -	tun_debug(KERN_INFO, tun, "tun_chr_read\n");
> +	tun_debug(KERN_INFO, tun, "tun_do_read\n");

It's almost always better to use "%s\n", __func__

Of course for these sorts of trivial tracing functions,
it's better to use the function tracer instead.

http://lwn.net/Articles/370423/

^ permalink raw reply

* Re: [PATCH] sctp: fix memory leak in sctp_datamsg_from_user() when copy from user space fails
From: David Miller @ 2012-11-26 22:34 UTC (permalink / raw)
  To: vyasevich; +Cc: tt.rantala, linux-sctp, netdev, nhorman, sri, davej
In-Reply-To: <50B38235.6070908@gmail.com>

From: Vlad Yasevich <vyasevich@gmail.com>
Date: Mon, 26 Nov 2012 09:52:37 -0500

> Should be using sctp_chunk_free().  Good find.

Tommi, please respin your patch to use sctp_chunk_free() as
Vlad has asked.

Thanks.

^ permalink raw reply

* Re: [PATCH] sctp: fix -ENOMEM result with invalid user space pointer in sendto() syscall
From: David Miller @ 2012-11-26 22:34 UTC (permalink / raw)
  To: vyasevich; +Cc: tt.rantala, linux-sctp, netdev, nhorman, sri, davej
In-Reply-To: <50B38339.40105@gmail.com>

From: Vlad Yasevich <vyasevich@gmail.com>
Date: Mon, 26 Nov 2012 09:56:57 -0500

> On 11/22/2012 08:23 AM, Tommi Rantala wrote:
>> Consider the following program, that sets the second argument to the
>> sendto() syscall incorrectly:
 ...
>> Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
> 
> Looks good
> 
> Acked-by: Vlad Yasevich <vyasevich@gmail.com>

I'll apply this after the other SCTP fix is respun, because there
is a dependency.

^ permalink raw reply

* Please Open The Attach Letter And Get Back To Me.
From: From Mr Steven Edom @ 2012-11-26 22:29 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: MOST URGENT..docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 11898 bytes --]

^ permalink raw reply

* Re: [PATCH] ip6mr: Add sizeof verification to MRT6_ASSERT and MT6_PIM
From: David Miller @ 2012-11-26 22:36 UTC (permalink / raw)
  To: joe; +Cc: eric.dumazet, netdev
In-Reply-To: <1353903994.2493.2.camel@joe-AO722>

From: Joe Perches <joe@perches.com>
Date: Sun, 25 Nov 2012 20:26:34 -0800

> Verify the length of the user-space arguments.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied to net-next, thanks.

^ permalink raw reply

* Re: [PATCH] net: ipmr: limit MRT_TABLE identifiers
From: David Miller @ 2012-11-26 22:37 UTC (permalink / raw)
  To: eric.dumazet; +Cc: gang.chen, netdev
In-Reply-To: <1353872669.30446.863.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 25 Nov 2012 11:44:29 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> Name of pimreg devices are built from following format :
> 
> char name[IFNAMSIZ]; // IFNAMSIZ == 16
> 
> sprintf(name, "pimreg%u", mrt->id);
> 
> We must therefore limit mrt->id to 9 decimal digits
> or risk a buffer overflow and a crash.
> 
> Restrict table identifiers in [0 ... 999999999] interval.
> 
> Reported-by: Chen Gang <gang.chen@asianux.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks Eric.

^ permalink raw reply

* [PATCH for 3.8] iproute2: Add "ip netns pids" and "ip netns identify"
From: Eric W. Biederman @ 2012-11-26 23:16 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Serge E. Hallyn


Add command that go between network namespace names and process
identifiers.  The code builds and runs agains older kernels but
only works on Linux 3.8+ kernels where I have fixed stat to work
properly.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---

I don't know if this is too soon to send this patch to iproute as the
kernel code that fixes stat is currently sitting in my for-next branch
of:
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git

and has not hit Linus's tree yet.  Still the code runs and is harmless
on older kernels so it should be harmless whatever happens with it.

 ip/ipnetns.c        |  141 +++++++++++++++++++++++++++++++++++++++++++++++++++
 man/man8/ip-netns.8 |    5 ++-
 2 files changed, 145 insertions(+), 1 deletions(-)

diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index e41a598..c55fe3a 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -13,6 +13,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <unistd.h>
+#include <ctype.h>
 
 #include "utils.h"
 #include "ip_common.h"
@@ -48,6 +49,8 @@ static void usage(void)
 	fprintf(stderr, "Usage: ip netns list\n");
 	fprintf(stderr, "       ip netns add NAME\n");
 	fprintf(stderr, "       ip netns delete NAME\n");
+	fprintf(stderr, "       ip netns identify PID\n");
+	fprintf(stderr, "       ip netns pids NAME\n");
 	fprintf(stderr, "       ip netns exec NAME cmd ...\n");
 	fprintf(stderr, "       ip netns monitor\n");
 	exit(-1);
@@ -171,6 +174,138 @@ static int netns_exec(int argc, char **argv)
 	exit(-1);
 }
 
+static int is_pid(const char *str)
+{
+	int ch;
+	for (; (ch = *str); str++) {
+		if (!isdigit(ch))
+			return 0;
+	}
+	return 1;
+}
+
+static int netns_pids(int argc, char **argv)
+{
+	const char *name;
+	char net_path[MAXPATHLEN];
+	int netns;
+	struct stat netst;
+	DIR *dir;
+	struct dirent *entry;
+
+	if (argc < 1) {
+		fprintf(stderr, "No netns name specified\n");
+		return -1;
+	}
+	if (argc > 1) {
+		fprintf(stderr, "extra arguments specified\n");
+		return -1;
+	}
+
+	name = argv[0];
+	snprintf(net_path, sizeof(net_path), "%s/%s", NETNS_RUN_DIR, name);
+	netns = open(net_path, O_RDONLY);
+	if (netns < 0) {
+		fprintf(stderr, "Cannot open network namespace: %s\n",
+			strerror(errno));
+		return -1;
+	}
+	if (fstat(netns, &netst) < 0) {
+		fprintf(stderr, "Stat of netns failed: %s\n",
+			strerror(errno));
+		return -1;
+	}
+	dir = opendir("/proc/");
+	if (!dir) {
+		fprintf(stderr, "Open of /proc failed: %s\n",
+			strerror(errno));
+		return -1;
+	}
+	while((entry = readdir(dir))) {
+		char pid_net_path[MAXPATHLEN];
+		struct stat st;
+		if (!is_pid(entry->d_name))
+			continue;
+		snprintf(pid_net_path, sizeof(pid_net_path), "/proc/%s/ns/net",
+			entry->d_name);
+		if (stat(pid_net_path, &st) != 0)
+			continue;
+		if ((st.st_dev == netst.st_dev) &&
+		    (st.st_ino == netst.st_ino)) {
+			printf("%s\n", entry->d_name);
+		}
+	}
+	closedir(dir);
+	return 0;
+	
+}
+
+static int netns_identify(int argc, char **argv)
+{
+	const char *pidstr;
+	char net_path[MAXPATHLEN];
+	int netns;
+	struct stat netst;
+	DIR *dir;
+	struct dirent *entry;
+
+	if (argc < 1) {
+		fprintf(stderr, "No pid specified\n");
+		return -1;
+	}
+	if (argc > 1) {
+		fprintf(stderr, "extra arguments specified\n");
+		return -1;
+	}
+	pidstr = argv[0];
+
+	if (!is_pid(pidstr)) {
+		fprintf(stderr, "Specified string '%s' is not a pid\n",
+			pidstr);
+		return -1;
+	}
+
+	snprintf(net_path, sizeof(net_path), "/proc/%s/ns/net", pidstr);
+	netns = open(net_path, O_RDONLY);
+	if (netns < 0) {
+		fprintf(stderr, "Cannot open network namespace: %s\n",
+			strerror(errno));
+		return -1;
+	}
+	if (fstat(netns, &netst) < 0) {
+		fprintf(stderr, "Stat of netns failed: %s\n",
+			strerror(errno));
+		return -1;
+	}
+	dir = opendir(NETNS_RUN_DIR);
+	if (!dir)
+		return 0;
+
+	while((entry = readdir(dir))) {
+		char name_path[MAXPATHLEN];
+		struct stat st;
+
+		if (strcmp(entry->d_name, ".") == 0)
+			continue;
+		if (strcmp(entry->d_name, "..") == 0)
+			continue;
+
+		snprintf(name_path, sizeof(name_path), "%s/%s",	NETNS_RUN_DIR,
+			entry->d_name);
+
+		if (stat(name_path, &st) != 0)
+			continue;
+
+		if ((st.st_dev == netst.st_dev) &&
+		    (st.st_ino == netst.st_ino)) {
+			printf("%s\n", entry->d_name);
+		}
+	}
+	closedir(dir);
+	return 0;
+	
+}
+
 static int netns_delete(int argc, char **argv)
 {
 	const char *name;
@@ -298,6 +433,12 @@ int do_netns(int argc, char **argv)
 	if (matches(*argv, "delete") == 0)
 		return netns_delete(argc-1, argv+1);
 
+	if (matches(*argv, "identify") == 0)
+		return netns_identify(argc-1, argv+1);
+
+	if (matches(*argv, "pids") == 0)
+		return netns_pids(argc-1, argv+1);
+
 	if (matches(*argv, "exec") == 0)
 		return netns_exec(argc-1, argv+1);
 
diff --git a/man/man8/ip-netns.8 b/man/man8/ip-netns.8
index 349ee7e..e639836 100644
--- a/man/man8/ip-netns.8
+++ b/man/man8/ip-netns.8
@@ -1,4 +1,4 @@
-.TH IP\-NETNS 8 "20 Dec 2011" "iproute2" "Linux"
+.TH IP\-NETNS 8 "26 Dec 2012" "iproute2" "Linux"
 .SH NAME
 ip-netns \- process network namespace management
 .SH SYNOPSIS
@@ -58,6 +58,9 @@ their traditional location in /etc.
 .SS ip netns delete NAME - delete the name of a network namespace
 .SS ip netns exec NAME cmd ... - Run cmd in the named network namespace
 
+.SS ip netns pids NAME - Report processes in the named network namespace
+.SS ip netns identify PID - Report network namespaces names for process
+
 .SH EXAMPLES
 
 .SH SEE ALSO
-- 
1.7.5.4

^ permalink raw reply related

* linux-next: manual merge of the net-next tree with the infiniband tree
From: Stephen Rothwell @ 2012-11-27  0:47 UTC (permalink / raw)
  To: David Miller, netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-next-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Roland Dreier,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Ben Hutchings

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

Hi all,

Today's linux-next merge of the net-next tree got a conflict in
drivers/net/ethernet/mellanox/mlx4/en_rx.c between commit 08ff32352d6f
("mlx4: 64-byte CQE/EQE support") from the infiniband tree and commit
f1d29a3fa68b ("mlx4_en: Remove remnants of LRO support") from the
net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org

diff --cc drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 6fa106f,f76c967..0000000
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@@ -710,12 -709,9 +710,9 @@@ next
  
  		++cq->mcq.cons_index;
  		index = (cq->mcq.cons_index) & ring->size_mask;
 -		cqe = &cq->buf[index];
 +		cqe = &cq->buf[(index << factor) + factor];
- 		if (++polled == budget) {
- 			/* We are here because we reached the NAPI budget -
- 			 * flush only pending LRO sessions */
+ 		if (++polled == budget)
  			goto out;
- 		}
  	}
  
  out:

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [E1000-devel] 82571EB: Detected Hardware Unit Hang
From: Joe Jin @ 2012-11-27  0:59 UTC (permalink / raw)
  To: Fujinaka, Todd
  Cc: Dave, Tushar N, netdev@vger.kernel.org, e1000-devel@lists.sf.net,
	linux-kernel@vger.kernel.org, Mary Mcgrath
In-Reply-To: <9B4A1B1917080E46B64F07F2989DADD62F2D62D6@ORSMSX102.amr.corp.intel.com>

On 11/27/12 00:23, Fujinaka, Todd wrote:
> If you look at the previous section, DevCap, you'll see that it's
> correctly advertising 256 bytes but the system is negotiating 128 for
> the link to the Ethernet controller. Things on the "other" side of the
> link are controlled outside of the e1000 driver.
> 
> Tushar's first suggestion was to check the PCIe payload settings in the
> entire chain. Have you done that? Mismatches will cause hangs.

Hi Todd,

So far I had to know how to modify the maxpayload size, since BIOS have not
entry to change this, so I had to use ethtool, now I need to get the offset
of MaxPayload size in eeprom, I ever tried to find from Intel online document
but failed, any idea?

Thanks in advance,
Joe

^ permalink raw reply

* [PATCH] netfilter updates for net (3.7-rc7)
From: pablo @ 2012-11-27  1:03 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev

From: Pablo Neira Ayuso <pablo@netfilter.org>

Hi David,

This update contains one patch to fix an overflow via the interface
name attribute in the ipset infrastructure, from Florian Westphal.

You can pull this change from:

git://1984.lsi.us.es/nf master

Thanks!

Florian Westphal (1):
  netfilter: ipset: fix netiface set name overflow

 net/netfilter/ipset/ip_set_hash_netiface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.7.10.4


^ permalink raw reply

* [PATCH] netfilter: ipset: fix netiface set name overflow
From: pablo @ 2012-11-27  1:03 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1353978185-3564-1-git-send-email-pablo@netfilter.org>

From: Florian Westphal <fw@strlen.de>

attribute is copied to IFNAMSIZ-size stack variable,
but IFNAMSIZ is smaller than IPSET_MAXNAMELEN.

Fortunately nfnetlink needs CAP_NET_ADMIN.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/ipset/ip_set_hash_netiface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c
index b9a6338..45a1014 100644
--- a/net/netfilter/ipset/ip_set_hash_netiface.c
+++ b/net/netfilter/ipset/ip_set_hash_netiface.c
@@ -793,7 +793,7 @@ static struct ip_set_type hash_netiface_type __read_mostly = {
 		[IPSET_ATTR_IP]		= { .type = NLA_NESTED },
 		[IPSET_ATTR_IP_TO]	= { .type = NLA_NESTED },
 		[IPSET_ATTR_IFACE]	= { .type = NLA_NUL_STRING,
-					    .len = IPSET_MAXNAMELEN - 1 },
+					    .len  = IFNAMSIZ - 1 },
 		[IPSET_ATTR_CADT_FLAGS]	= { .type = NLA_U32 },
 		[IPSET_ATTR_CIDR]	= { .type = NLA_U8 },
 		[IPSET_ATTR_TIMEOUT]	= { .type = NLA_U32 },
-- 
1.7.10.4


^ 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