Netdev List
 help / color / mirror / Atom feed
* Re: [PATCHv4 3/4] sparc64: Avoid irqsave/restore on vio.lock if in_softirq()
From: Julian Calaby @ 2014-10-21 22:42 UTC (permalink / raw)
  To: Sowmini Varadhan; +Cc: David S. Miller, netdev, sparclinux
In-Reply-To: <20141021223952.GA26724@oracle.com>

Hi Sowmini,

On Wed, Oct 22, 2014 at 9:39 AM, Sowmini Varadhan
<sowmini.varadhan@oracle.com> wrote:
> On (10/22/14 09:35), Julian Calaby wrote:
>> >  void vio_port_up(struct vio_driver_state *vio)
>> >  {
>> > -       unsigned long flags;
>> > +       unsigned long flags = 0;
>>
>> Is gcc not smart enough to know that this variable isn't used before
>> it's set? (I assume it isn't used elsewhere in this function)
>
> No, it's not used elsewhere in the function, and yes, I too was
> surprised by the build warning, which is why I initialized it
> as above.

Ok, fair enough then.

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply

* Re: [stable request <= 3.11] net/mlx4_en: Fix BlueFlame race
From: Cong Wang @ 2014-10-21 23:15 UTC (permalink / raw)
  To: Vinson Lee
  Cc: David S. Miller, Amir Vadai, Or Gerlitz, Jack Morgenstein,
	Eugenia Emantayev, Matan Barak, netdev
In-Reply-To: <CAHTgTXVn1479XCoh1-j=Xghtad3zA-hf0za5r_AyoaKuKeFZ2g@mail.gmail.com>

On Sat, Oct 18, 2014 at 2:14 PM, Vinson Lee <vlee@twopensource.com> wrote:
> Hi.
>
> Please consider backporting upstream commit
> 2d4b646613d6b12175b017aca18113945af1faf3 "net/mlx4_en: Fix BlueFlame
> race" to stable kernels <= 3.11.
>

David, could you take care of it if you have time? It fixes a real
bug in production. :)

Thanks a lot!

^ permalink raw reply

* IPv6 UFO for VMs
From: Ben Hutchings @ 2014-10-21 23:44 UTC (permalink / raw)
  To: netdev; +Cc: Hannes Frederic Sowa, virtualization


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

There are several ways that VMs can take advantage of UFO and get the
host to do fragmentation for them:

drivers/net/macvtap.c:                  gso_type = SKB_GSO_UDP;
drivers/net/tun.c:                      skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
drivers/net/virtio_net.c:                       skb_shinfo(skb)->gso_type = SKB_GSO_UDP;

Our implementation of UFO for IPv6 does:

		fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);
		fptr->nexthdr = nexthdr;
		fptr->reserved = 0;
		fptr->identification = skb_shinfo(skb)->ip6_frag_id;

which assumes ip6_frag_id has been set.  That's only true if the local
stack constructed the skb; otherwise it appears we get zero.

This seems to be a regression as a result of:

commit 916e4cf46d0204806c062c8c6c4d1f633852c5b6
Author: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date:   Fri Feb 21 02:55:35 2014 +0100

    ipv6: reuse ip6_frag_id from ip6_ufo_append_data

However, that change seems reasonable - we *shouldn't* be choosing IDs
for any other stack.  Any paravirt net driver that can use IPv6 UFO
needs to have some way of passing a fragmentation ID to put in
skb_shared_info::ip6_frag_id.

Ben.

-- 
Ben Hutchings
For every action, there is an equal and opposite criticism. - Harrison

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply

* Re: [PATCHv4 3/4] sparc64: Avoid irqsave/restore on vio.lock if in_softirq()
From: Dave Kleikamp @ 2014-10-21 23:56 UTC (permalink / raw)
  To: Julian Calaby, Sowmini Varadhan; +Cc: David S. Miller, netdev, sparclinux
In-Reply-To: <CAGRGNgXvKJBhOE1z3=_gZkE=X94HnoAvTN6Zv5G1h8JuFfS8Ng@mail.gmail.com>

On 10/21/2014 05:35 PM, Julian Calaby wrote:
> Hi Sowmini,
> 
> On Wed, Oct 22, 2014 at 1:16 AM, Sowmini Varadhan
> <sowmini.varadhan@oracle.com> wrote:
>> For NAPIfied drivers , there is no need to
>> synchronize by doing irqsave/restore on vio.lock in the I/O
>> path.
>>
>> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
>> ---
>>  arch/sparc/kernel/viohs.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/sparc/kernel/viohs.c b/arch/sparc/kernel/viohs.c
>> index 7ef081a..d731586 100644
>> --- a/arch/sparc/kernel/viohs.c
>> +++ b/arch/sparc/kernel/viohs.c
>> @@ -747,10 +747,11 @@ EXPORT_SYMBOL(vio_ldc_free);
>>
>>  void vio_port_up(struct vio_driver_state *vio)
>>  {
>> -       unsigned long flags;
>> +       unsigned long flags = 0;
> 
> Is gcc not smart enough to know that this variable isn't used before
> it's set? (I assume it isn't used elsewhere in this function)

It probably assumes in_softirq() might evaluate differently in the each
case.

> 
>>         int err, state;
>>
>> -       spin_lock_irqsave(&vio->lock, flags);
>> +       if (!in_softirq())
>> +               spin_lock_irqsave(&vio->lock, flags);
>>
>>         state = ldc_state(vio->lp);
>>
>> @@ -777,7 +778,8 @@ void vio_port_up(struct vio_driver_state *vio)
>>                 mod_timer(&vio->timer, expires);
>>         }
>>
>> -       spin_unlock_irqrestore(&vio->lock, flags);
>> +       if (!in_softirq())
>> +               spin_unlock_irqrestore(&vio->lock, flags);
>>  }
>>  EXPORT_SYMBOL(vio_port_up);
> 
> Thanks,
> 

^ permalink raw reply

* Re: [PATCHv4 3/4] sparc64: Avoid irqsave/restore on vio.lock if in_softirq()
From: Sowmini Varadhan @ 2014-10-22  0:16 UTC (permalink / raw)
  To: Dave Kleikamp; +Cc: Julian Calaby, David S. Miller, netdev, sparclinux
In-Reply-To: <5446F291.1030400@oracle.com>

On (10/21/14 18:56), Dave Kleikamp wrote:
> > 
> > Is gcc not smart enough to know that this variable isn't used before
> > it's set? (I assume it isn't used elsewhere in this function)
> 
> It probably assumes in_softirq() might evaluate differently in the each
> case.

yes, that's what I suspected too. I suppose it is possible
from the compiler's point of view that something in between 
might change the result of in_softirq() so that we may be 
using an uninit variable in the second call.

anyway, the warning was annoying, and would only numb the
user into ignoring other real issues, so I figured I might
as well silence the warning.

--Sowmini


^ permalink raw reply

* RE: Urgent Order
From: Parker Nick @ 2014-10-22  7:37 UTC (permalink / raw)


Hello,

Please send me a price list and quotation for your products we want to import from your country this is a very large order for long term import and urgent request.

Thank you in advance for your prompt confirmation.
Regards,

Parker Nick

Equipos de Elevaci n , S.A. de C.V.Av. Texcoco #35,
54070 Tlalnepantla , Edo . de M xico
M xico
Tels.+27840117769

^ permalink raw reply

* Re: [PATCH] netlink: Re-add locking to netlink_lookup() and seq walker
From: David Miller @ 2014-10-22  1:36 UTC (permalink / raw)
  To: tgraf; +Cc: davem, netdev, linux-kernel, eric.dumazet
In-Reply-To: <14101d52c64e0d52176ca0d4b8888f8cf20ab9b0.1413921873.git.tgraf@suug.ch>

From: Thomas Graf <tgraf@suug.ch>
Date: Tue, 21 Oct 2014 22:05:38 +0200

> The synchronize_rcu() in netlink_release() introduces unacceptable
> latency. Reintroduce minimal lookup so we can drop the
> synchronize_rcu() until socket destruction has been RCUfied.
> 
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Reported-by: Steinar H. Gunderson <sgunderson@bigfoot.com>
> Reported-and-tested-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> Signed-off-by: Thomas Graf <tgraf@suug.ch>

Applied and queued up for -stable.

Please use an appropriate "Fixes: " tag in the future, this is
especially important for an issue as serious as this one.

Thanks.

^ permalink raw reply

* Re: [PATCH] netlink: don't copy over empty attribute data
From: David Miller @ 2014-10-22  1:39 UTC (permalink / raw)
  To: sasha.levin; +Cc: a.ryabinin, pablo, mschmidt, akpm, linux-kernel, netdev
In-Reply-To: <1413924669-26732-1-git-send-email-sasha.levin@oracle.com>

From: Sasha Levin <sasha.levin@oracle.com>
Date: Tue, 21 Oct 2014 16:51:09 -0400

> netlink uses empty data to seperate different levels. However, we still
> try to copy that data from a NULL ptr using memcpy, which is an undefined
> behaviour.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

This isn't a POSIX C library, this it the Linux kernel, and as such
we can make sure none of our memcpy() implementations try to access
any bytes if the given length is NULL.

And to be quite honest, there is no benefit whatsoever nor even the
possibility of using that "undefined behavior" flexibility to do
anthing. This is because every memcpy() implementation must be sure
not to access past the end of either source or destination buffer.

And the one and only way to do that is to respect the length.

I'm not applying this, because the basis for which this is claimed
to be a bug fix is quite bogus in my opinion.

Sorry.

^ permalink raw reply

* Re: [PATCH] drivers: net: xgene: Add missing initialization in xgene_enet_ecc_init()
From: David Miller @ 2014-10-22  1:41 UTC (permalink / raw)
  To: geert; +Cc: isubramanian, kchudgar, netdev, linux-kernel
In-Reply-To: <1413792496-8558-1-git-send-email-geert@linux-m68k.org>

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Mon, 20 Oct 2014 10:08:16 +0200

> drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c: In function ‘xgene_enet_ecc_init’:
> drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c:126: warning: ‘data’ may be used uninitialized in this function
> 
> Depending on the arbitrary value on the stack, the loop may terminate
> too early, and cause a bogus -ENODEV failure.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Please, use a do { } while(0) loop to fix this, thanks.

^ permalink raw reply

* Re: [PATCH 1/2] xfrm: fix a potential use after free in xfrm4_policy.c
From: David Miller @ 2014-10-22  1:42 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev, steffen.klassert
In-Reply-To: <1413794954-16967-1-git-send-email-roy.qing.li@gmail.com>

From: roy.qing.li@gmail.com
Date: Mon, 20 Oct 2014 16:49:13 +0800

> From: Li RongQing <roy.qing.li@gmail.com>
> 
> pskb_may_pull() maybe change skb->data and make xprth pointer oboslete,
> so recompute the xprth
> 
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>

Please don't use macros that hide uses of local variables.

That is almost as bad as hiding control flow inside of
a macro.

^ permalink raw reply

* Re: [PATCH net] bpf: fix bug in eBPF verifier
From: David Miller @ 2014-10-22  1:44 UTC (permalink / raw)
  To: ast; +Cc: hannes, dborkman, netdev, linux-kernel
In-Reply-To: <1413842097-4380-1-git-send-email-ast@plumgrid.com>

From: Alexei Starovoitov <ast@plumgrid.com>
Date: Mon, 20 Oct 2014 14:54:57 -0700

> while comparing for verifier state equivalency the comparison
> was missing a check for uninitialized register.
> Make sure it does so and add a testcase.
> 
> Fixes: f1bca824dabb ("bpf: add search pruning optimization to verifier")
> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net] net: sched: initialize bstats syncp
From: David Miller @ 2014-10-22  1:46 UTC (permalink / raw)
  To: sd; +Cc: netdev, john.r.fastabend
In-Reply-To: <20141021092330.GA9863@kria>

From: Sabrina Dubroca <sd@queasysnail.net>
Date: Tue, 21 Oct 2014 11:23:30 +0200

> Use netdev_alloc_pcpu_stats to allocate percpu stats and initialize syncp.
> 
> Fixes: 22e0f8b9322c "net: sched: make bstats per cpu and estimator RCU safe"
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>

Applied, thank you.

^ permalink raw reply

* Re: [PATCH] netlink: don't copy over empty attribute data
From: Sasha Levin @ 2014-10-22  2:19 UTC (permalink / raw)
  To: David Miller; +Cc: a.ryabinin, pablo, mschmidt, akpm, linux-kernel, netdev
In-Reply-To: <20141021.213908.1088381802543942481.davem@davemloft.net>

On 10/21/2014 09:39 PM, David Miller wrote:
> From: Sasha Levin <sasha.levin@oracle.com>
> Date: Tue, 21 Oct 2014 16:51:09 -0400
> 
>> > netlink uses empty data to seperate different levels. However, we still
>> > try to copy that data from a NULL ptr using memcpy, which is an undefined
>> > behaviour.
>> > 
>> > Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> This isn't a POSIX C library, this it the Linux kernel, and as such
> we can make sure none of our memcpy() implementations try to access
> any bytes if the given length is NULL.

We can make *our* implementations work around that undefined behaviour if we
want, but right now our implementations is to call GCC's builtin memcpy(),
which follows the standards and doesn't allow you to call it with NULL 'from'
ptr.

The fact that it doesn't die and behaves properly is just "luck".


Thanks,
Sasha

^ permalink raw reply

* RE: Issue about dst spoofed in case of IPv6 RD (Rapid Deployment)
From: Cheng (LC) Li @ 2014-10-22  3:13 UTC (permalink / raw)
  To: netdev@vger.kernel.org

After moving from Linux kernel 3.8.3 to 3.14.13, I have the dst spoofed issue when testing IPv6 RD (Rapid Deployment). The console output below error message and the ping reply pack is dropped.

sit: Dst spoofed 10.149.6.128/2001:db8:ac10:1::1 -> 172.16.0.192/2001:db8:ac10:c0:d59d:4649:8244:6dfd

In my testing, I created an 6rd tunnel on the CE router:
sit1: ipv6/ip remote any local 172.16.0.192 ttl 64 6rd-prefix 2001:db8::/32 6rd-relay_prefix 10.149.6.128/32 

Correspondingly, there was a 6rd tunnel on the server 
sit1: ipv6/ip remote any local 10.149.6.128 ttl 64 6rd-prefix 2001:db8::/32 

172.16.0.192 is the IPv4 address of my CE router, 10.149.6.128 is the address of the BR. 6rd prefix is 2001:db8::/32.

After looking into the linux kernel file, linux\net\ipv6\sit.c,
I suspect the function 
static bool check_6rd(struct ip_tunnel *tunnel, const struct in6_addr *v6dst,
__be32 *v4dst)

misbehave.

It get the IPv4 destination IP by
*v4dst = tunnel->ip6rd.relay_prefix | htonl(d);

But I think it should get the IPv4 destination IP by getting it from IPv6 destination IP address per rfc5569.

Can anybody please help confirm this is a kernel issue or not?

^ permalink raw reply

* Re: [stable request <= 3.11] net/mlx4_en: Fix BlueFlame race
From: Or Gerlitz @ 2014-10-22  4:17 UTC (permalink / raw)
  To: Cong Wang
  Cc: Vinson Lee, David S. Miller, Amir Vadai, Or Gerlitz,
	Jack Morgenstein, Eugenia Emantayev, Matan Barak, netdev, saeedm
In-Reply-To: <CAHA+R7MSiuazaAr-F5UGZ+DYv-8EE5mLmVtvjVvfC7iYY9+i=Q@mail.gmail.com>

On Wed, Oct 22, 2014 at 2:15 AM, Cong Wang <cwang@twopensource.com> wrote:
> On Sat, Oct 18, 2014 at 2:14 PM, Vinson Lee <vlee@twopensource.com> wrote:
>> Hi.
>>
>> Please consider backporting upstream commit
>> 2d4b646613d6b12175b017aca18113945af1faf3 "net/mlx4_en: Fix BlueFlame
>> race" to stable kernels <= 3.11.
>>
>
> David, could you take care of it if you have time? It fixes a real
> bug in production. :)

Let out folks here look on that 1st.

Or.

^ permalink raw reply

* [PATCH net-next 0/6] cleanup on resource check
From: Varka Bhadram @ 2014-10-22  4:16 UTC (permalink / raw)
  To: netdev; +Cc: Varka Bhadram
In-Reply-To: <N>

This series removes the duplication of sanity check for
platform_get_resource() return resource. It will be checked 
with devm_ioremap_resource()

Varka Bhadram (6):
  ethernet: wiznet: remove unnecessary check
  ethernet: wiznet: remove unnecessary check
  ethernet: apm: xgene: remove unnecessary check
  ethernet: marvell: remove unnecessary check
  ethernet: renesas: remove unnecessary check
  ethernet: samsung: sxgbe: remove unnecessary check

 drivers/net/ethernet/apm/xgene/xgene_enet_main.c   |   12 ------------
 drivers/net/ethernet/marvell/pxa168_eth.c          |    6 ++----
 drivers/net/ethernet/renesas/sh_eth.c              |    4 ----
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c    |    3 ---
 drivers/net/ethernet/wiznet/w5100.c                |    3 +--
 drivers/net/ethernet/wiznet/w5300.c                |    3 +--
 6 files changed, 4 insertions(+), 27 deletions(-)

-- 
1.7.9.5

^ permalink raw reply

* [PATCH net-next 1/6] ethernet: wiznet: remove unnecessary check
From: Varka Bhadram @ 2014-10-22  4:16 UTC (permalink / raw)
  To: netdev; +Cc: Varka Bhadram
In-Reply-To: <1413951386-29645-1-git-send-email-varkab@cdac.in>

devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/wiznet/w5100.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index 0f56b1c..bf195e3 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -638,8 +638,7 @@ static int w5100_hw_probe(struct platform_device *pdev)
 	}
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!mem)
-		return -ENXIO;
+
 	mem_size = resource_size(mem);
 
 	priv->base = devm_ioremap_resource(&pdev->dev, mem);
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next 2/6] ethernet: wiznet: remove unnecessary check
From: Varka Bhadram @ 2014-10-22  4:16 UTC (permalink / raw)
  To: netdev; +Cc: Varka Bhadram
In-Reply-To: <1413951386-29645-1-git-send-email-varkab@cdac.in>

devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/wiznet/w5300.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index f961f14..315d090 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -558,8 +558,7 @@ static int w5300_hw_probe(struct platform_device *pdev)
 	}
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!mem)
-		return -ENXIO;
+
 	mem_size = resource_size(mem);
 
 	priv->base = devm_ioremap_resource(&pdev->dev, mem);
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next 3/6] ethernet: apm: xgene: remove unnecessary check
From: Varka Bhadram @ 2014-10-22  4:16 UTC (permalink / raw)
  To: netdev; +Cc: Varka Bhadram
In-Reply-To: <1413951386-29645-1-git-send-email-varkab@cdac.in>

devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c |   12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 3c208cc..f226594 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -761,10 +761,6 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	ndev = pdata->ndev;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "enet_csr");
-	if (!res) {
-		dev_err(dev, "Resource enet_csr not defined\n");
-		return -ENODEV;
-	}
 	pdata->base_addr = devm_ioremap_resource(dev, res);
 	if (IS_ERR(pdata->base_addr)) {
 		dev_err(dev, "Unable to retrieve ENET Port CSR region\n");
@@ -772,10 +768,6 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	}
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ring_csr");
-	if (!res) {
-		dev_err(dev, "Resource ring_csr not defined\n");
-		return -ENODEV;
-	}
 	pdata->ring_csr_addr = devm_ioremap_resource(dev, res);
 	if (IS_ERR(pdata->ring_csr_addr)) {
 		dev_err(dev, "Unable to retrieve ENET Ring CSR region\n");
@@ -783,10 +775,6 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	}
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ring_cmd");
-	if (!res) {
-		dev_err(dev, "Resource ring_cmd not defined\n");
-		return -ENODEV;
-	}
 	pdata->ring_cmd_addr = devm_ioremap_resource(dev, res);
 	if (IS_ERR(pdata->ring_cmd_addr)) {
 		dev_err(dev, "Unable to retrieve ENET Ring command region\n");
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next 4/6] ethernet: marvell: remove unnecessary check
From: Varka Bhadram @ 2014-10-22  4:16 UTC (permalink / raw)
  To: netdev; +Cc: Varka Bhadram
In-Reply-To: <1413951386-29645-1-git-send-email-varkab@cdac.in>

devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/marvell/pxa168_eth.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index c3b209c..a378c92 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1505,16 +1505,14 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 	pep = netdev_priv(dev);
 	pep->dev = dev;
 	pep->clk = clk;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res == NULL) {
-		err = -ENODEV;
-		goto err_netdev;
-	}
 	pep->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(pep->base)) {
 		err = -ENOMEM;
 		goto err_netdev;
 	}
+
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	BUG_ON(!res);
 	dev->irq = res->start;
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next 5/6] ethernet: renesas: remove unnecessary check
From: Varka Bhadram @ 2014-10-22  4:16 UTC (permalink / raw)
  To: netdev; +Cc: Varka Bhadram
In-Reply-To: <1413951386-29645-1-git-send-email-varkab@cdac.in>

devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/net/ethernet/renesas/sh_eth.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 60e9c2c..d824ba5 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2769,10 +2769,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 
 	/* get base addr */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (unlikely(res == NULL)) {
-		dev_err(&pdev->dev, "invalid resource\n");
-		return -EINVAL;
-	}
 
 	ndev = alloc_etherdev(sizeof(struct sh_eth_private));
 	if (!ndev)
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next 6/6] ethernet: samsung: sxgbe: remove unnecessary check
From: Varka Bhadram @ 2014-10-22  4:16 UTC (permalink / raw)
  To: netdev; +Cc: Varka Bhadram
In-Reply-To: <1413951386-29645-1-git-send-email-varkab@cdac.in>

devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c    |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index b147d46..7fd6e27 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
@@ -90,9 +90,6 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
 
 	/* Get memory resource */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		goto err_out;
-
 	addr = devm_ioremap_resource(dev, res);
 	if (IS_ERR(addr))
 		return PTR_ERR(addr);
-- 
1.7.9.5

^ permalink raw reply related

* Re: [RFC PATCH v2 net-next] net: ipv6: Add a sysctl to make optimistic addresses useful candidates
From: Erik Kline @ 2014-10-22  5:25 UTC (permalink / raw)
  To: Hannes Frederic Sowa; +Cc: netdev, Ben Hutchings, Lorenzo Colitti
In-Reply-To: <1413920743.32553.45.camel@localhost>

Hello.

On Wed, Oct 22, 2014 at 4:45 AM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> Hi,
>
> On Di, 2014-10-21 at 13:05 +0900, Erik Kline wrote:
>> Add a sysctl that causes an interface's optimistic addresses
>> to be considered equivalent to other non-deprecated addresses
>> for source address selection purposes.  Preferred addresses
>> will still take precedence over optimistic addresses, subject
>> to other ranking in the source address selection algorithm.
>>
>> This is useful where different interfaces are connected to
>> different networks from different ISPs (e.g., a cell network
>> and a home wifi network).
>>
>> The current behaviour complies with RFC 3484/6724, and it
>> makes sense if the host has only one interface, or has
>> multiple interfaces on the same network (same or cooperating
>> administrative domain(s), but not in the multiple distinct
>> networks case.
>>
>> For example, if a mobile device has an IPv6 address on an LTE
>> network and then connects to IPv6-enabled wifi, while the wifi
>> IPv6 address is undergoing DAD, IPv6 connections will try use
>> the wifi default route with the LTE IPv6 address, and will get
>> stuck until they time out.
>>
>> Also, because optimistic addresses can actually be used, issue
>> an RTM_NEWADDR as soon as DAD starts.  If DAD fails an separate
>> RTM_DELADDR will be sent.
>>
>> Also: add an entry in ip-sysctl.txt for optimistic_dad.
>>
>> Signed-off-by: Erik Kline <ek@google.com>
>> ---
>>  Documentation/networking/ip-sysctl.txt | 13 ++++++++++++
>>  include/linux/ipv6.h                   |  1 +
>>  include/uapi/linux/ipv6.h              |  1 +
>>  net/ipv6/addrconf.c                    | 36 ++++++++++++++++++++++++++++++++--
>>  4 files changed, 49 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
>> index 0307e28..e03cf49 100644
>> --- a/Documentation/networking/ip-sysctl.txt
>> +++ b/Documentation/networking/ip-sysctl.txt
>> @@ -1452,6 +1452,19 @@ suppress_frag_ndisc - INTEGER
>>       1 - (default) discard fragmented neighbor discovery packets
>>       0 - allow fragmented neighbor discovery packets
>>
>> +optimistic_dad - BOOLEAN
>> +     Whether to perform Optimistic Duplicate Address Detection (RFC 4429).
>> +             0: disabled (default)
>> +             1: enabled
>> +
>> +use_optimistic - BOOLEAN
>> +     If enabled, do not classify optimistic addresses as deprecated during
>> +     source address selection.  Preferred addresses will still be chosen
>> +     before optimistic addresses, subject to other ranking in the source
>> +     address selection algorithm.
>> +             0: disabled (default)
>> +             1: enabled
>> +
>>  icmp/*:
>>  ratelimit - INTEGER
>>       Limit the maximal rates for sending ICMPv6 packets.
>> diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
>> index ff56053..7121a2e 100644
>> --- a/include/linux/ipv6.h
>> +++ b/include/linux/ipv6.h
>> @@ -42,6 +42,7 @@ struct ipv6_devconf {
>>       __s32           accept_ra_from_local;
>>  #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
>>       __s32           optimistic_dad;
>> +     __s32           use_optimistic;
>>  #endif
>>  #ifdef CONFIG_IPV6_MROUTE
>>       __s32           mc_forwarding;
>> diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
>> index efa2666..e863d08 100644
>> --- a/include/uapi/linux/ipv6.h
>> +++ b/include/uapi/linux/ipv6.h
>> @@ -164,6 +164,7 @@ enum {
>>       DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
>>       DEVCONF_SUPPRESS_FRAG_NDISC,
>>       DEVCONF_ACCEPT_RA_FROM_LOCAL,
>> +     DEVCONF_USE_OPTIMISTIC,
>>       DEVCONF_MAX
>>  };
>>
>> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
>> index 725c763..c2fddb7 100644
>> --- a/net/ipv6/addrconf.c
>> +++ b/net/ipv6/addrconf.c
>> @@ -1169,6 +1169,9 @@ enum {
>>       IPV6_SADDR_RULE_LABEL,
>>       IPV6_SADDR_RULE_PRIVACY,
>>       IPV6_SADDR_RULE_ORCHID,
>> +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
>> +     IPV6_SADDR_RULE_NOT_OPTIMISTIC,
>> +#endif
>>       IPV6_SADDR_RULE_PREFIX,
>>       IPV6_SADDR_RULE_MAX
>>  };
>> @@ -1257,10 +1260,17 @@ static int ipv6_get_saddr_eval(struct net *net,
>>               score->scopedist = ret;
>>               break;
>>       case IPV6_SADDR_RULE_PREFERRED:
>> +         {
>>               /* Rule 3: Avoid deprecated and optimistic addresses */
>> +             u8 avoid = IFA_F_DEPRECATED;
>> +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
>> +             if (!score->ifa->idev->cnf.use_optimistic)
>> +                     avoid |= IFA_F_OPTIMISTIC;
>> +#endif
>>               ret = ipv6_saddr_preferred(score->addr_type) ||
>> -                   !(score->ifa->flags & (IFA_F_DEPRECATED|IFA_F_OPTIMISTIC));
>> +                   !(score->ifa->flags & avoid);
>>               break;
>> +         }
>>  #ifdef CONFIG_IPV6_MIP6
>>       case IPV6_SADDR_RULE_HOA:
>>           {
>> @@ -1299,6 +1309,14 @@ static int ipv6_get_saddr_eval(struct net *net,
>>               ret = !(ipv6_addr_orchid(&score->ifa->addr) ^
>>                       ipv6_addr_orchid(dst->addr));
>>               break;
>> +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
>> +     case IPV6_SADDR_RULE_NOT_OPTIMISTIC:
>> +             /* Optimistic addresses still have lower precedence than other
>> +              * preferred addresses.
>> +              */
>> +             ret = !(score->ifa->flags & IFA_F_OPTIMISTIC);
>> +             break;
>> +#endif
>
> I wonder a bit why this rule is not directly ordered after
> IPV6_SADDR_RULE_PREFERRED? This would e.g. matter for privacy addresses.

Privacy addresses ("tempaddrs") that win in earlier checks are
preferred before optimistic in this code (i.e. a tempaddr on the same
outgoing interface is preferred before an optimistic address).

Similarly, a non-tentative non-privacy address (same outgoing
interface, same label, ...) will match before an optimistic address,
but only until DAD completes and the address is no longer optimistic.
I think this is in keeping with the spirit of the RFC 3484/6724 rules.

After there's an RFC 7217 implementation, EUI-64-based SLAAC could be
disabled by folks.

>>       case IPV6_SADDR_RULE_PREFIX:
>>               /* Rule 8: Use longest matching prefix */
>>               ret = ipv6_addr_diff(&score->ifa->addr, dst->addr);
>> @@ -3222,8 +3240,13 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp)
>>        * Optimistic nodes can start receiving
>>        * Frames right away
>>        */
>> -     if (ifp->flags & IFA_F_OPTIMISTIC)
>> +     if (ifp->flags & IFA_F_OPTIMISTIC) {
>>               ip6_ins_rt(ifp->rt);
>> +             /* Because optimistic nodes can receive frames, notify
>> +              * listeners. If DAD fails, RTM_DELADDR is sent.
>> +              */
>> +             ipv6_ifa_notify(RTM_NEWADDR, ifp);
>> +     }
>
> I wonder if we can now delete the ipv6_ifa_notify(RTM_NEWADDR, ifp) in
> addrconf_dad_completed.

I don't know what everyone's general preference would be, but mine
would be to err on the side of notifying on state changes.  It seems
harmless to me to keep it in, and something in userspace might want to
know if/when DAD completes.

>>       addrconf_dad_kick(ifp);
>>  out:
>> @@ -4330,6 +4353,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
>>       array[DEVCONF_ACCEPT_SOURCE_ROUTE] = cnf->accept_source_route;
>>  #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
>>       array[DEVCONF_OPTIMISTIC_DAD] = cnf->optimistic_dad;
>> +     array[DEVCONF_USE_OPTIMISTIC] = cnf->use_optimistic;
>>  #endif
>>  #ifdef CONFIG_IPV6_MROUTE
>>       array[DEVCONF_MC_FORWARDING] = cnf->mc_forwarding;
>> @@ -5155,6 +5179,14 @@ static struct addrconf_sysctl_table
>>                       .proc_handler   = proc_dointvec,
>>
>>               },
>> +             {
>> +                     .procname       = "use_optimistic",
>> +                     .data           = &ipv6_devconf.use_optimistic,
>> +                     .maxlen         = sizeof(int),
>> +                     .mode           = 0644,
>> +                     .proc_handler   = proc_dointvec,
>> +
>> +             },
>>  #endif
>>  #ifdef CONFIG_IPV6_MROUTE
>>               {
>
> Otherwise looks good.
>
> Thanks,
> Hannes
>
>

Thank /you/.

^ permalink raw reply

* Re: [PATCH] netlink: don't copy over empty attribute data
From: David Miller @ 2014-10-22  6:15 UTC (permalink / raw)
  To: sasha.levin; +Cc: a.ryabinin, pablo, mschmidt, akpm, linux-kernel, netdev
In-Reply-To: <54471438.1040907@oracle.com>

From: Sasha Levin <sasha.levin@oracle.com>
Date: Tue, 21 Oct 2014 22:19:36 -0400

> On 10/21/2014 09:39 PM, David Miller wrote:
>> From: Sasha Levin <sasha.levin@oracle.com>
>> Date: Tue, 21 Oct 2014 16:51:09 -0400
>> 
>>> > netlink uses empty data to seperate different levels. However, we still
>>> > try to copy that data from a NULL ptr using memcpy, which is an undefined
>>> > behaviour.
>>> > 
>>> > Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
>> This isn't a POSIX C library, this it the Linux kernel, and as such
>> we can make sure none of our memcpy() implementations try to access
>> any bytes if the given length is NULL.
> 
> We can make *our* implementations work around that undefined behaviour if we
> want, but right now our implementations is to call GCC's builtin memcpy(),
> which follows the standards and doesn't allow you to call it with NULL 'from'
> ptr.
> 
> The fact that it doesn't die and behaves properly is just "luck".

If GCC's internal memcpy() starts accessing past 'len', I'm going
to report the bug rather than code around it.

That causes a page fault, you _can't_ do it.

^ permalink raw reply

* Re: [PATCH 1/1 net-next] mac80211: remove unnecessary null test before debugfs_remove
From: Johannes Berg @ 2014-10-22  6:36 UTC (permalink / raw)
  To: Fabian Frederick
  Cc: linux-wireless, netdev, linux-kernel, David S. Miller,
	John W. Linville
In-Reply-To: <1473755457.212484.1413921941002.open-xchange@webmail.nmp.skynet.be>

On Tue, 2014-10-21 at 22:05 +0200, Fabian Frederick wrote:

> I can also resubmit patch if necessary.

No worries, I've already applied the patch (with a modified commit
message).

johannes

^ permalink raw reply


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