* 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
* [PATCH] net: fs_enet: set back promiscuity mode after restart
From: Christophe Leroy @ 2014-10-22 7:05 UTC (permalink / raw)
To: Pantelis Antoniou, Vitaly Bordug, davem
Cc: linux-kernel, linuxppc-dev, netdev, Germain Montoies
After interface restart (eg: after link disconnection/reconnection), the bridge
function doesn't work anymore. This is due to the promiscuous mode being cleared
by the restart.
The mac-fcc already includes code to set the promiscuous mode back during the restart.
This patch adds the same handling to mac-fec and mac-scc.
Tested with bridge function on MPC885 with FEC.
Reported-by: Germain Montoies <germain.montoies@c-s.fr>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 3 +++
drivers/net/ethernet/freescale/fs_enet/mac-scc.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
index 3d4e08b..b34214e 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
@@ -341,6 +341,9 @@ static void restart(struct net_device *dev)
FC(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD disable */
}
+ /* Restore multicast and promiscuous settings */
+ set_multicast_list(dev);
+
/*
* Enable interrupts we wish to service.
*/
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
index f30411f..7a184e8 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
@@ -355,6 +355,9 @@ static void restart(struct net_device *dev)
if (fep->phydev->duplex)
S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE);
+ /* Restore multicast and promiscuous settings */
+ set_multicast_list(dev);
+
S32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
}
--
2.1.0
^ permalink raw reply related
* [PATCH v2] drivers: net: xgene: Rewrite loop in xgene_enet_ecc_init()
From: Geert Uytterhoeven @ 2014-10-22 7:39 UTC (permalink / raw)
To: David S. Miller, Iyappan Subramanian, Keyur Chudgar
Cc: netdev, linux-kernel, Geert Uytterhoeven
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>
---
v2: Rewrite the loop instead of pre-initializing data.
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
index e6d24c2101982444..2a497b38ed420495 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
@@ -127,17 +127,15 @@ static int xgene_enet_ecc_init(struct xgene_enet_pdata *p)
int i;
xgene_enet_wr_diag_csr(p, ENET_CFG_MEM_RAM_SHUTDOWN_ADDR, 0);
- for (i = 0; i < 10 && data != ~0U ; i++) {
+ for (i = 0; i < 10; i++) {
usleep_range(100, 110);
data = xgene_enet_rd_diag_csr(p, ENET_BLOCK_MEM_RDY_ADDR);
+ if (data == ~0U)
+ return 0;
}
- if (data != ~0U) {
- netdev_err(ndev, "Failed to release memory from shutdown\n");
- return -ENODEV;
- }
-
- return 0;
+ netdev_err(ndev, "Failed to release memory from shutdown\n");
+ return -ENODEV;
}
static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p)
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] Documentation: ptp: Fix build failure on MIPS cross builds
From: Richard Cochran @ 2014-10-22 8:03 UTC (permalink / raw)
To: Peter Foley
Cc: David Daney, David Miller, markos.chandras, linux-mips, corbet,
netdev, linux-doc@vger.kernel.org, LKML
In-Reply-To: <CAOFdcFNYHgupvMChb4NedMsUMAOmE8k0D_F5eRjL-8H8ft=eRw@mail.gmail.com>
On Tue, Oct 21, 2014 at 06:04:51PM -0400, Peter Foley wrote:
> The intention of these changes was to generate more compiliation
> coverage for code in Documentation/
Sounds good.
> The underlying issue is that this doesn't work for cross-compiling
> because kbuild doesn't have cross-compile support for userspace code.
Well, my testptp does cross compile just fine. All it needs is the glibc
library bundled with the tool chain and the kernel headers.
> I submitted a patch to disable building Documentation when
> cross-compiling, as the consensus in the thread that resulted in that
> patch (https://lkml.org/lkml/2014/10/8/510) was that implementing
> targetprogs in kbuild was not currently worth it.
So this patch did not make it in, right?
Otherwise people wouldn't be disabling cross compilation ad hoc, like
in the patch that started this thread.
> I can try to take a crack at adding targetprogs support, but I'm
> rather busy right now, so it may take a little while.
No rush, please do.
In the mean time, I would like to restore the testptp.mk that *does*
cross compile, so that people may use the test program if they
want. In fact I use this all the time, and so I am a bit annoyed that
something working was deleted and replaced with something broken.
Thanks,
Richard
^ permalink raw reply
* Re: [PATCH 2/5] stmmac: pci: use managed resources
From: Andy Shevchenko @ 2014-10-22 8:36 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Giuseppe Cavallaro, netdev, Kweh Hock Leong, David S. Miller,
Vince Bridgers
In-Reply-To: <5446C827.2040801@cogentembedded.com>
On Wed, 2014-10-22 at 00:55 +0400, Sergei Shtylyov wrote:
> Hello.
>
> On 10/21/2014 08:35 PM, Andy Shevchenko wrote:
>
> > Migrate pci driver to managed resources to reduce boilerplate error handling
> > code.
>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 46 +++++-------------------
> > 1 file changed, 8 insertions(+), 38 deletions(-)
>
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> > index 5459a4e..f8d4ce2 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> > @@ -65,45 +65,29 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
> > const struct pci_device_id *id)
> > {
> > int ret = 0;
> > - void __iomem *addr = NULL;
> > struct stmmac_priv *priv = NULL;
> > - int i;
> > + int pci_bar = 0;
>
> I don't see this variable changing anywhere...
See my comment below.
>
> > /* Enable pci device */
> > - ret = pci_enable_device(pdev);
> > + ret = pcim_enable_device(pdev);
> > if (ret) {
> > pr_err("%s : ERROR: failed to enable %s device\n", __func__,
> > pci_name(pdev));
> > return ret;
> > }
> > - if (pci_request_regions(pdev, STMMAC_RESOURCE_NAME)) {
> > - pr_err("%s: ERROR: failed to get PCI region\n", __func__);
> > - ret = -ENODEV;
> > - goto err_out_req_reg_failed;
> > - }
> > + ret = pcim_iomap_regions(pdev, BIT(pci_bar), pci_name(pdev));
> > + if (ret)
> > + return ret;
> >
> > - /* Get the base address of device */
> > - for (i = 0; i <= 5; i++) {
> > - if (pci_resource_len(pdev, i) == 0)
> > - continue;
> > - addr = pci_iomap(pdev, i, 0);
> > - if (addr == NULL) {
> > - pr_err("%s: ERROR: cannot map register memory aborting",
> > - __func__);
> > - ret = -EIO;
> > - goto err_out_map_failed;
> > - }
> > - break;
> > - }
>
> It's not an equivalent change: the old code mapped a first existing BAR,
> you always map BAR0. Are you sure that's what you meant? If so, wouldn't hurt
> to describe this in the changelog...
So, I was trying to find any specification on public regarding to boards
that have this IP, no luck so far. I guess that that code was created
due to XILINX FPGA usage which probably can provide any BAR user wants
to. Thus, I imply that in real applications the BAR most probably will
be 0. However, I left variable which can be overridden in future
(regarding to PCI ID).
It would be nice to hear someone from ST about this. Giuseppe?
--
Andy Shevchenko <andriy.shevchenko@intel.com>
Intel Finland Oy
^ permalink raw reply
* RE: [PATCH] netlink: don't copy over empty attribute data
From: David Laight @ 2014-10-22 8:55 UTC (permalink / raw)
To: 'Sasha Levin', davem@davemloft.net
Cc: a.ryabinin@samsung.com, pablo@netfilter.org, mschmidt@redhat.com,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
In-Reply-To: <1413924669-26732-1-git-send-email-sasha.levin@oracle.com>
From: Sasha Levin
> 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>
> ---
> lib/nlattr.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/nlattr.c b/lib/nlattr.c
> index 9c3e85f..6512b43 100644
> --- a/lib/nlattr.c
> +++ b/lib/nlattr.c
> @@ -430,7 +430,8 @@ void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,
> struct nlattr *nla;
>
> nla = __nla_reserve(skb, attrtype, attrlen);
> - memcpy(nla_data(nla), data, attrlen);
> + if (data)
> + memcpy(nla_data(nla), data, attrlen);
Were it even appropriate to add a conditional here, the correct
check would be against 'attrlen', not 'data'.
David
> }
> EXPORT_SYMBOL(__nla_put);
>
> --
> 1.7.10.4
>
> --
> 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
^ permalink raw reply
* Re: [PATCH net-next] sfc: add support for skb->xmit_more
From: Ben Hutchings @ 2014-10-22 8:58 UTC (permalink / raw)
To: Edward Cree
Cc: Robert Stonehouse, Daniel Borkmann, davem, nikolay, netdev,
Shradha Shah, Jon Cooper, linux-net-drivers
In-Reply-To: <alpine.LFD.2.03.1410171512070.3218@solarflare.com>
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
On Fri, 2014-10-17 at 15:32 +0100, Edward Cree wrote:
[...]
> @@ -351,7 +343,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
> unsigned short dma_flags;
> int i = 0;
>
> - EFX_BUG_ON_PARANOID(tx_queue->write_count != tx_queue->insert_count);
> + EFX_BUG_ON_PARANOID(tx_queue->write_count > tx_queue->insert_count);
[...]
Doesn't this break after 2^32 descriptors? It seems like you would need
a similar comparison to time_after(); possibly:
EFX_BUG_ON_PARANOID((int)(tx_queue->write_count - tx_queue->insert_count) > 0);
Ben.
--
Ben Hutchings
For every action, there is an equal and opposite criticism. - Harrison
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox