* [PATCH 0/4] Netfilter/IPVS fixes for net
From: Pablo Neira Ayuso @ 2015-02-19 18:19 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
Hi David,
The following patchset contains updates for your net tree, they are:
1) Fix removal of destination in IPVS when the new mixed family support
is used, from Alexey Andriyanov via Simon Horman.
2) Fix module refcount undeflow in nft_compat when reusing a match /
target.
3) Fix iptables-restore when the recent match is used with a new hitcount
that exceeds threshold, from Florian Westphal.
4) Fix stack corruption in xt_socket due to using stack storage to save
the inner IPv6 header, from Eric Dumazet.
I'll follow up soon with another batch with more fixes that are still
cooking.
You can pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
Thanks!
----------------------------------------------------------------
The following changes since commit 42b5212fee4f57907e9415b18fe19c13e65574bc:
xen-netback: stop the guest rx thread after a fatal error (2015-02-02 19:39:04 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git master
for you to fetch changes up to 78296c97ca1fd3b104f12e1f1fbc06c46635990b:
netfilter: xt_socket: fix a stack corruption bug (2015-02-16 17:00:48 +0100)
----------------------------------------------------------------
Alexey Andriyanov (1):
ipvs: fix inability to remove a mixed-family RS
Eric Dumazet (1):
netfilter: xt_socket: fix a stack corruption bug
Florian Westphal (1):
netfilter: xt_recent: don't reject rule if new hitcount exceeds table max
Pablo Neira Ayuso (1):
netfilter: nft_compat: fix module refcount underflow
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
net/netfilter/nft_compat.c | 12 ++++++++++--
net/netfilter/xt_recent.c | 11 +++++------
net/netfilter/xt_socket.c | 21 ++++++++++++---------
4 files changed, 28 insertions(+), 18 deletions(-)
^ permalink raw reply
* [PATCH 4/4] netfilter: xt_socket: fix a stack corruption bug
From: Pablo Neira Ayuso @ 2015-02-19 18:19 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1424369960-10988-1-git-send-email-pablo@netfilter.org>
From: Eric Dumazet <edumazet@google.com>
As soon as extract_icmp6_fields() returns, its local storage (automatic
variables) is deallocated and can be overwritten.
Lets add an additional parameter to make sure storage is valid long
enough.
While we are at it, adds some const qualifiers.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: b64c9256a9b76 ("tproxy: added IPv6 support to the socket match")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/xt_socket.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c
index 1ba6793..13332db 100644
--- a/net/netfilter/xt_socket.c
+++ b/net/netfilter/xt_socket.c
@@ -243,12 +243,13 @@ static int
extract_icmp6_fields(const struct sk_buff *skb,
unsigned int outside_hdrlen,
int *protocol,
- struct in6_addr **raddr,
- struct in6_addr **laddr,
+ const struct in6_addr **raddr,
+ const struct in6_addr **laddr,
__be16 *rport,
- __be16 *lport)
+ __be16 *lport,
+ struct ipv6hdr *ipv6_var)
{
- struct ipv6hdr *inside_iph, _inside_iph;
+ const struct ipv6hdr *inside_iph;
struct icmp6hdr *icmph, _icmph;
__be16 *ports, _ports[2];
u8 inside_nexthdr;
@@ -263,12 +264,14 @@ extract_icmp6_fields(const struct sk_buff *skb,
if (icmph->icmp6_type & ICMPV6_INFOMSG_MASK)
return 1;
- inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph), sizeof(_inside_iph), &_inside_iph);
+ inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph),
+ sizeof(*ipv6_var), ipv6_var);
if (inside_iph == NULL)
return 1;
inside_nexthdr = inside_iph->nexthdr;
- inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + sizeof(_inside_iph),
+ inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) +
+ sizeof(*ipv6_var),
&inside_nexthdr, &inside_fragoff);
if (inside_hdrlen < 0)
return 1; /* hjm: Packet has no/incomplete transport layer headers. */
@@ -315,10 +318,10 @@ xt_socket_get_sock_v6(struct net *net, const u8 protocol,
static bool
socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par)
{
- struct ipv6hdr *iph = ipv6_hdr(skb);
+ struct ipv6hdr ipv6_var, *iph = ipv6_hdr(skb);
struct udphdr _hdr, *hp = NULL;
struct sock *sk = skb->sk;
- struct in6_addr *daddr = NULL, *saddr = NULL;
+ const struct in6_addr *daddr = NULL, *saddr = NULL;
__be16 uninitialized_var(dport), uninitialized_var(sport);
int thoff = 0, uninitialized_var(tproto);
const struct xt_socket_mtinfo1 *info = (struct xt_socket_mtinfo1 *) par->matchinfo;
@@ -342,7 +345,7 @@ socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par)
} else if (tproto == IPPROTO_ICMPV6) {
if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr,
- &sport, &dport))
+ &sport, &dport, &ipv6_var))
return false;
} else {
return false;
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/4] ipvs: fix inability to remove a mixed-family RS
From: Pablo Neira Ayuso @ 2015-02-19 18:19 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1424369960-10988-1-git-send-email-pablo@netfilter.org>
From: Alexey Andriyanov <alan@al-an.info>
The current code prevents any operation with a mixed-family dest
unless IP_VS_CONN_F_TUNNEL flag is set. The problem is that it's impossible
for the client to follow this rule, because ip_vs_genl_parse_dest does
not even read the destination conn_flags when cmd = IPVS_CMD_DEL_DEST
(need_full_dest = 0).
Also, not every client can pass this flag when removing a dest. ipvsadm,
for example, does not support the "-i" command line option together with
the "-d" option.
This change disables any checks for mixed-family on IPVS_CMD_DEL_DEST command.
Signed-off-by: Alexey Andriyanov <alan@al-an.info>
Fixes: bc18d37f676f ("ipvs: Allow heterogeneous pools now that we support them")
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index b8295a4..fdcda8b 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3399,7 +3399,7 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)
if (udest.af == 0)
udest.af = svc->af;
- if (udest.af != svc->af) {
+ if (udest.af != svc->af && cmd != IPVS_CMD_DEL_DEST) {
/* The synchronization protocol is incompatible
* with mixed family services
*/
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/4] netfilter: nft_compat: fix module refcount underflow
From: Pablo Neira Ayuso @ 2015-02-19 18:19 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1424369960-10988-1-git-send-email-pablo@netfilter.org>
Feb 12 18:20:42 nfdev kernel: ------------[ cut here ]------------
Feb 12 18:20:42 nfdev kernel: WARNING: CPU: 4 PID: 4359 at kernel/module.c:963 module_put+0x9b/0xba()
Feb 12 18:20:42 nfdev kernel: CPU: 4 PID: 4359 Comm: ebtables-compat Tainted: G W 3.19.0-rc6+ #43
[...]
Feb 12 18:20:42 nfdev kernel: Call Trace:
Feb 12 18:20:42 nfdev kernel: [<ffffffff815fd911>] dump_stack+0x4c/0x65
Feb 12 18:20:42 nfdev kernel: [<ffffffff8103e6f7>] warn_slowpath_common+0x9c/0xb6
Feb 12 18:20:42 nfdev kernel: [<ffffffff8109919f>] ? module_put+0x9b/0xba
Feb 12 18:20:42 nfdev kernel: [<ffffffff8103e726>] warn_slowpath_null+0x15/0x17
Feb 12 18:20:42 nfdev kernel: [<ffffffff8109919f>] module_put+0x9b/0xba
Feb 12 18:20:42 nfdev kernel: [<ffffffff813ecf7c>] nft_match_destroy+0x45/0x4c
Feb 12 18:20:42 nfdev kernel: [<ffffffff813e683f>] nf_tables_rule_destroy+0x28/0x70
Reported-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
net/netfilter/nft_compat.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 265e190..b636486 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -578,8 +578,12 @@ nft_match_select_ops(const struct nft_ctx *ctx,
struct xt_match *match = nft_match->ops.data;
if (strcmp(match->name, mt_name) == 0 &&
- match->revision == rev && match->family == family)
+ match->revision == rev && match->family == family) {
+ if (!try_module_get(match->me))
+ return ERR_PTR(-ENOENT);
+
return &nft_match->ops;
+ }
}
match = xt_request_find_match(family, mt_name, rev);
@@ -648,8 +652,12 @@ nft_target_select_ops(const struct nft_ctx *ctx,
struct xt_target *target = nft_target->ops.data;
if (strcmp(target->name, tg_name) == 0 &&
- target->revision == rev && target->family == family)
+ target->revision == rev && target->family == family) {
+ if (!try_module_get(target->me))
+ return ERR_PTR(-ENOENT);
+
return &nft_target->ops;
+ }
}
target = xt_request_find_target(family, tg_name, rev);
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/4] netfilter: xt_recent: don't reject rule if new hitcount exceeds table max
From: Pablo Neira Ayuso @ 2015-02-19 18:19 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
In-Reply-To: <1424369960-10988-1-git-send-email-pablo@netfilter.org>
From: Florian Westphal <fw@strlen.de>
given:
-A INPUT -m recent --update --seconds 30 --hitcount 4
and
iptables-save > foo
then
iptables-restore < foo
will fail with:
kernel: xt_recent: hitcount (4) is larger than packets to be remembered (4) for table DEFAULT
Even when the check is fixed, the restore won't work if the hitcount is
increased to e.g. 6, since by the time checkentry runs it will find the
'old' incarnation of the table.
We can avoid this by increasing the maximum threshold silently; we only
have to rm all the current entries of the table (these entries would
not have enough room to handle the increased hitcount).
This even makes (not-very-useful)
-A INPUT -m recent --update --seconds 30 --hitcount 4
-A INPUT -m recent --update --seconds 30 --hitcount 42
work.
Fixes: abc86d0f99242b7f142b (netfilter: xt_recent: relax ip_pkt_list_tot restrictions)
Tracked-down-by: Chris Vine <chris@cvine.freeserve.co.uk>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/xt_recent.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 30dbe34..45e1b30 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -378,12 +378,11 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
mutex_lock(&recent_mutex);
t = recent_table_lookup(recent_net, info->name);
if (t != NULL) {
- if (info->hit_count > t->nstamps_max_mask) {
- pr_info("hitcount (%u) is larger than packets to be remembered (%u) for table %s\n",
- info->hit_count, t->nstamps_max_mask + 1,
- info->name);
- ret = -EINVAL;
- goto out;
+ if (nstamp_mask > t->nstamps_max_mask) {
+ spin_lock_bh(&recent_lock);
+ recent_table_flush(t);
+ t->nstamps_max_mask = nstamp_mask;
+ spin_unlock_bh(&recent_lock);
}
t->refcnt++;
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH net-next] sunvnet: failed trigger should not cause BUG_ON()
From: Sowmini Varadhan @ 2015-02-19 18:24 UTC (permalink / raw)
To: David L Stevens; +Cc: David Miller, netdev
In-Reply-To: <54E62855.5080201@oracle.com>
On (02/19/15 13:15), David L Stevens wrote:
> An error return from __vnet_tx_trigger() sets the TX descriptor to
> VIO_DESC_FREE while leaving port->tx_bufs[txi].skb set. This leads
> to a BUG_ON() the next time this descriptor is used.
>
> This patch frees the pending skb when getting a trigger error to
> match the VIO_DESC_FREE state.
>
> Signed-off-by: David L Stevens <david.stevens@oracle.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
^ permalink raw reply
* Re: [PATCH next] bonding: simple code refactor
From: Andy Gospodarek @ 2015-02-19 18:39 UTC (permalink / raw)
To: Mahesh Bandewar
Cc: Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
Nikolay Aleksandrov, David Miller, Maciej Zenczykowski, netdev,
Eric Dumazet
In-Reply-To: <1424369605-26655-1-git-send-email-maheshb@google.com>
On Thu, Feb 19, 2015 at 10:13:25AM -0800, Mahesh Bandewar wrote:
> Remove duplicate code.
>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Looks good.
Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
> ---
> drivers/net/bonding/bond_main.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 19b12fbd808d..cbf77d388f53 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -2933,6 +2933,8 @@ static int bond_slave_netdev_event(unsigned long event,
> if (old_duplex != slave->duplex)
> bond_3ad_adapter_duplex_changed(slave);
> }
> + /* Fallthrough */
> + case NETDEV_DOWN:
> /* Refresh slave-array if applicable!
> * If the setup does not use miimon or arpmon (mode-specific!),
> * then these events will not cause the slave-array to be
> @@ -2944,10 +2946,6 @@ static int bond_slave_netdev_event(unsigned long event,
> if (bond_mode_uses_xmit_hash(bond))
> bond_update_slave_arr(bond, NULL);
> break;
> - case NETDEV_DOWN:
> - if (bond_mode_uses_xmit_hash(bond))
> - bond_update_slave_arr(bond, NULL);
> - break;
> case NETDEV_CHANGEMTU:
> /* TODO: Should slaves be allowed to
> * independently alter their MTU? For
> --
> 2.2.0.rc0.207.ga3a616c
>
> --
> 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
* smsc95xx truesize badness
From: Steve Glendinning @ 2015-02-19 18:58 UTC (permalink / raw)
To: netdev; +Cc: popcorn mix, eric.dumazet
Hi all,
It seems smsc95xx is doing bad things with truesize in our receive loop.
Simplified loop with some bits removed for clarity (handles the
possible case of receiving multiple frames in one USB transaction):
while (skb->len > 0) {
/* last frame in this batch */
if (skb->len == size) {
skb_trim(skb, skb->len - 4); /* remove fcs */
skb->truesize = size + sizeof(struct sk_buff);
return 1;
}
ax_skb = skb_clone(skb, GFP_ATOMIC);
if (unlikely(!ax_skb)) {
netdev_warn(dev->net, "Error allocating skb\n");
return 0;
}
ax_skb->len = size;
ax_skb->data = packet;
skb_set_tail_pointer(ax_skb, size);
skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */
ax_skb->truesize = size + sizeof(struct sk_buff);
usbnet_skb_return(dev, ax_skb);
}
This is triggering warnings for many Raspberry Pi users due to Eric's
patch to catch truesize offenders. It's a fair cop.
Before I submit a patch to remove these two truesize lines, I believe
it's safe to just do so but can anyone confirm if removing them will
have any adverse impact?
Thanks!
--
Steve Glendinning
^ permalink raw reply
* [PATCH net] net: dsa: bcm_sf2: fix 64-bits register reads
From: Florian Fainelli @ 2015-02-19 19:09 UTC (permalink / raw)
To: netdev; +Cc: davem, Florian Fainelli
Reading 64-bits register was not working because we inverted the steps
between reading the lower 32-bits of the register and reading the upper
32-bits. Swapping these operations is how the HW guarantees that 64-bits
reads are latched correctly. We only have a handful of 64-bits registers
for now, mostly MIB counters, so the imapct is low.
Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h
index ee9f650d5026..7b7053d3c5fa 100644
--- a/drivers/net/dsa/bcm_sf2.h
+++ b/drivers/net/dsa/bcm_sf2.h
@@ -105,8 +105,8 @@ static inline u64 name##_readq(struct bcm_sf2_priv *priv, u32 off) \
{ \
u32 indir, dir; \
spin_lock(&priv->indir_lock); \
- indir = reg_readl(priv, REG_DIR_DATA_READ); \
dir = __raw_readl(priv->name + off); \
+ indir = reg_readl(priv, REG_DIR_DATA_READ); \
spin_unlock(&priv->indir_lock); \
return (u64)indir << 32 | dir; \
} \
--
2.1.0
^ permalink raw reply related
* Re: [PATCH net-next v2 1/2] enic: implement frag allocator
From: David Miller @ 2015-02-19 19:25 UTC (permalink / raw)
To: _govind; +Cc: netdev, benve, ssujith
In-Reply-To: <1423659558-32523-2-git-send-email-_govind@gmx.com>
From: Govindarajulu Varadarajan <_govind@gmx.com>
Date: Wed, 11 Feb 2015 18:29:17 +0530
> This patch implements frag allocator for rq buffer. This is based on
> __alloc_page_frag & __page_frag_refill implementation in net/core/skbuff.c
>
> In addition to frag allocation from order(3) page in __alloc_page_frag,
> we also maintain dma address of the page. While allocating a frag for rx buffer
> we return va + offset for virtual address of the frag, and pa + offset for
> dma address of the frag. This reduces the number of calls to dma_map()
> by 1/3 for 9k mtu and by 1/20 for 1500 mtu.
>
> __alloc_page_frag is limited to max buffer size of PAGE_SIZE, i.e 4096 in most
> of the cases. So 9k buffer allocation goes through kmalloc which return
> page of order 2, 16k. We waste 7k bytes for every 9k buffer.
>
> we maintain dma_count variable which is incremented when we allocate a frag.
> enic_unmap_dma will decrement the dma_count and unmap it when there is no user
> of that page in rx ring.
>
> This reduces the memory utilization for 9k mtu by 33%.
>
> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
This is a nice optimization, but this is definitely useful for other drivers
rather than just your's. And there isn't anything that really keeps this from
being put somewhere generically.
> +#define ENIC_ALLOC_ORDER PAGE_ALLOC_COSTLY_ORDER
You talk about order(3) but then use PAGE_ALLOC_COSTLY_ORDER, which in
theory could change in the future.
But, in any event, there is no reason not to use NETDEV_FRAG_PAGE_MAX_ORDER,
just like __alloc_page_frag() does.
> +struct enic_alloc_cache {
> + struct page_frag frag;
> + unsigned int pagecnt_bias;
> + int dma_count;
> + void *va;
> + dma_addr_t pa;
> +};
Make this a generic structure, perhaps named something like
"netdev_dma_alloc_cache".
'pa' is not a good name for a DMA address, because it is not (necessarily)
a physical address. It could be a virtual address translated by an IOMMU.
"dma_addr" is probably therefore a better member name.
In the generic version the driver will have to pass in a pointer to the
"netdev_dma_alloc_cache". I would suggest having this embedded in the
driver per-queue structure rather than being allocated dynamically.
Then you can provide a netdev_dma_alloc_cache_init() the driver can
call which initializes this embedded object.
> + ec->pa = pci_map_single(enic->pdev, ec->va, ec->frag.size,
> + PCI_DMA_FROMDEVICE);
Next, these need to be converted to dma_*() calls, and the interface
for netdev_dma_alloc_cache() will need to have a "struct device *"
argument for these calls.
> @@ -199,6 +200,18 @@ void vnic_rq_clean(struct vnic_rq *rq,
> rq->ring.desc_avail++;
> }
>
> + if (rq->ec) {
> + struct enic *enic = vnic_dev_priv(rq->vdev);
> + struct enic_alloc_cache *ec = rq->ec;
> +
> + WARN_ON(ec->dma_count);
> + pci_unmap_single(enic->pdev, ec->pa, ec->frag.size,
> + PCI_DMA_FROMDEVICE);
> + atomic_sub(ec->pagecnt_bias - 1, &ec->frag.page->_count);
> + __free_pages(ec->frag.page, get_order(ec->frag.size));
> + kfree(ec);
> + rq->ec = NULL;
> + }
> /* Use current fetch_index as the ring starting point */
> fetch_index = ioread32(&rq->ctrl->fetch_index);
>
Finally, you'll need to define a "netdev_dma_alloc_cache_destroy()"
function which you'll call from here.
^ permalink raw reply
* [PATCH net] net/hsr: Fix NULL pointer dereference and refcnt bugs when deleting a HSR interface.
From: Arvid Brodin @ 2015-02-19 19:22 UTC (permalink / raw)
To: Arvid Brodin, David Miller, netdev@vger.kernel.org; +Cc: Nicolas Dichtel
How to repeat:
$ sudo ip link add hsr0 type hsr slave1 <if1> slave2 <if2>
$ sudo ip link del hsr0
BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
IP: [<ffffffff8187f495>] hsr_del_port+0x15/0xa0
etc...
Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Fixes: 51f3c605318b056a ("net/hsr: Move slave init to hsr_slave.c.")
Signed-off-by: Arvid Brodin <arvid.brodin@alten.se>
---
net/hsr/hsr_device.c | 3 +++
net/hsr/hsr_main.c | 4 ++++
net/hsr/hsr_slave.c | 10 +++++++---
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index a138d75..44d2746 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -359,8 +359,11 @@ static void hsr_dev_destroy(struct net_device *hsr_dev)
struct hsr_port *port;
hsr = netdev_priv(hsr_dev);
+
+ rtnl_lock();
hsr_for_each_port(hsr, port)
hsr_del_port(port);
+ rtnl_unlock();
del_timer_sync(&hsr->prune_timer);
del_timer_sync(&hsr->announce_timer);
diff --git a/net/hsr/hsr_main.c b/net/hsr/hsr_main.c
index 779d28b..cd37d00 100644
--- a/net/hsr/hsr_main.c
+++ b/net/hsr/hsr_main.c
@@ -36,6 +36,10 @@ static int hsr_netdev_notify(struct notifier_block *nb, unsigned long event,
return NOTIFY_DONE; /* Not an HSR device */
hsr = netdev_priv(dev);
port = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
+ if (port == NULL) {
+ /* Resend of notification concerning removed device? */
+ return NOTIFY_DONE;
+ }
} else {
hsr = port->hsr;
}
diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
index a348dcb..7d37366 100644
--- a/net/hsr/hsr_slave.c
+++ b/net/hsr/hsr_slave.c
@@ -181,8 +181,10 @@ void hsr_del_port(struct hsr_port *port)
list_del_rcu(&port->port_list);
if (port != master) {
- netdev_update_features(master->dev);
- dev_set_mtu(master->dev, hsr_get_max_mtu(hsr));
+ if (master != NULL) {
+ netdev_update_features(master->dev);
+ dev_set_mtu(master->dev, hsr_get_max_mtu(hsr));
+ }
netdev_rx_handler_unregister(port->dev);
dev_set_promiscuity(port->dev, -1);
}
@@ -192,5 +194,7 @@ void hsr_del_port(struct hsr_port *port)
*/
synchronize_rcu();
- dev_put(port->dev);
+
+ if (port != master)
+ dev_put(port->dev);
}
--
2.0.4
--
Arvid Brodin | Consultant (Linux)
ALTEN | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden
arvid.brodin@alten.se | www.alten.se/en/
^ permalink raw reply related
* Re: [PATCH net-next v5] Add support of Cavium Liquidio ethernet adapters
From: David Miller @ 2015-02-19 19:36 UTC (permalink / raw)
To: rvatsavayi
Cc: netdev, derek.chickles, satananda.burla, felix.manlunas,
raghu.vatsavayi
In-Reply-To: <1423704042-4026-1-git-send-email-rvatsavayi@caviumnetworks.com>
From: Raghu Vatsavayi <rvatsavayi@caviumnetworks.com>
Date: Wed, 11 Feb 2015 17:20:42 -0800
> + uint32_t val;
uint32_t, uint64_t, etc. are userspace types, and inside the kernel
one should canonically use u32, u64, etc.
Please update your entire driver wrt. this issue.
> + pci_unmap_single(lio->oct_dev->pci_dev, finfo->dptr, skb->len,
> + PCI_DMA_TODEVICE);
Please use the dma_*() variants of the DMA interfaces for which you
will pass in a reference to the struct device embedded in the pci_dev.
This will allow you to later make use of various generic facilities
we will build for DMA mapping SKBs in the networking, allocating
networknig page frags, etc.
And even more importantly, the pci_*() variants are slowly being
phased out and deprecated.
^ permalink raw reply
* [PATCH] Allow specifying bridge port STP state by name rather than number.
From: Alex Pilon @ 2015-02-19 19:27 UTC (permalink / raw)
To: netdev
The existing behaviour forces one to memorize the integer constants for
STP port states.
# bridge link set dev dummy0 state 3
This patch makes it possible to use the lowercased port state name.
# bridge link set dev dummy0 state forwarding
Invalid non-integer inputs now cause exit with status -1.
Signed-off-by: Alex Pilon <alp@alexpilon.ca>
---
bridge/link.c | 14 +++++++++++++-
man/man8/bridge.8 | 4 +++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/bridge/link.c b/bridge/link.c
index c8555f8..a7bd85f 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -316,7 +316,19 @@ static int brlink_modify(int argc, char **argv)
priority = atoi(*argv);
} else if (strcmp(*argv, "state") == 0) {
NEXT_ARG();
- state = atoi(*argv);
+ char *endptr;
+ size_t nstates = sizeof(port_states) / sizeof(*port_states);
+ state = strtol(*argv, &endptr, 10);
+ if (!(**argv != '\0' && *endptr == '\0')) {
+ for (state = 0; state < nstates; state++)
+ if (strcmp(port_states[state], *argv) == 0)
+ break;
+ if (state == nstates) {
+ fprintf(stderr,
+ "Error: invalid STP port state\n");
+ exit(-1);
+ }
+ }
} else if (strcmp(*argv, "hwmode") == 0) {
NEXT_ARG();
flags = BRIDGE_FLAGS_SELF;
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index e344db2..68ad71e 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -207,7 +207,9 @@ droot port selectio algorithms.
.TP
.BI state " STATE "
the operation state of the port. This is primarily used by user space STP/RSTP
-implementation. The following is a list of valid values:
+implementation. One may enter a lowercased port state name, or one of the
+numbers below. Negative inputs are ignored, and unrecognized names return an
+error.
.B 0
- port is DISABLED. Make this port completely inactive.
--
2.3.0
^ permalink raw reply related
* Re: network namespace bloat
From: David Miller @ 2015-02-19 19:49 UTC (permalink / raw)
To: ebiederm
Cc: edumazet, netdev, stephen, nicolas.dichtel, roopa, hannes, ddutt,
vipin, shmulik.ladkani, dsahern
In-Reply-To: <87d25hrv9m.fsf@x220.int.ebiederm.org>
From: ebiederm@xmission.com (Eric W. Biederman)
Date: Tue, 10 Feb 2015 21:18:13 -0600
> Eric Dumazet <edumazet@google.com> writes:
>
>> On Tue, Feb 10, 2015 at 6:42 PM, Eric W. Biederman
>> <ebiederm@xmission.com> wrote:
>>
>>>
>>> Those large hash tables impact creation speed as large memory
>>> allocations require more work from the memory allocators, and they
>>> affect reliability of as order > 0 pages are not reliabily available in
>>> the kernel. So from a network namespace perspective I would really like
>>> to convert the per network namespace hash tables to hash tables that
>>> have a single instance across all network namespaces.
>>>
>>
>> tcp_metric can fallback to vzalloc() after commit 976a702ac9eea ?
>
> True, although vmalloc space is limited on some architectures.
>
>> There is nothing preventing to use a single tcp_metric, a bit like
>> global TCP hash table.
>>
>> We only have to convert the thing...
>
> Thanks for the confirmation, that is what I figured was going on.
>
>> Note : At Google we do not save tcp metrics.
>> We have to use it only for FastOpen cookies eventually (For clients)
>
> Interesting. That makes it doubly desirable to not need to allocate
> a per network namespace hash table.
As a first step we can make the tcp_metrics hash global, but in addition
to that an rhashtable conversion is probably in order as well.
^ permalink raw reply
* Re: [PATCH net-next v2 2/3] net: use skb->priority for overloading skb->dropcount and skb->reserved_tailroom instead of skb->mark
From: David Miller @ 2015-02-19 20:05 UTC (permalink / raw)
To: eyal.birger; +Cc: netdev, edumazet, shmulik.ladkani
In-Reply-To: <1423715535-884-3-git-send-email-eyal.birger@gmail.com>
From: Eyal Birger <eyal.birger@gmail.com>
Date: Thu, 12 Feb 2015 06:32:14 +0200
> The purpose of overloading skb->priority is solely for retaining
> struct sk_buff size; skb->priority is not used after the skb queued
> to the socket and has the same guarentee of not being shared as
> skb->mark.
I don't think this analysis is accurate.
> @@ -621,7 +621,7 @@ struct sk_buff {
> __u16 csum_offset;
> };
> };
> - __u32 priority;
> + __u32 mark;
> int skb_iif;
> __u32 hash;
> __be16 vlan_proto;
> @@ -636,7 +636,7 @@ struct sk_buff {
> __u32 secmark;
> #endif
> union {
> - __u32 mark;
> + __u32 priority;
> __u32 dropcount;
> __u32 reserved_tailroom;
> };
> --
You are going to now write to dropcount in packet_rcv() and that will
corrupt skb->priority. If we got to packet_rcv() via
dev_queue_xmit_nit() then that skb->priority value is actually going
to be used by the packet schedulers for classification, flow
scheduling, etc.
So I don't think this transformation is going to work properly.
I'm also wondering if aliasing with skb->mark, which is what happens
now, is legal too.
^ permalink raw reply
* Re: [PATCH net-next v2 0/3] Adjust the settings about USB_RX_EARLY_AGG
From: David Miller @ 2015-02-19 20:09 UTC (permalink / raw)
To: hayeswang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb
In-Reply-To: <1394712342-15778-141-Taiwan-albertk@realtek.com>
From: Hayes Wang <hayeswang@realtek.com>
Date: Thu, 12 Feb 2015 14:33:45 +0800
> v2:
> For patch #1, replace
>
> u32 ocp_data;
> ocp_data = tp->coalesce / 8;
>
> with
>
> u32 ocp_data = tp->coalesce / 8;
>
> And replace
>
> struct net_device *dev = tp->netdev;
> u32 ocp_data;
> ocp_data = (agg_buf_sz - dev->mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4;
>
> with
>
> u32 mtu = tp->netdev->mtu;
> u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4;
>
> Use *switch* statement to replace the checking of *if*.
>
> v1:
> The USB_RX_EARLY_AGG contains timeout and size. Separate them, and
> they could be set independently. Then, the ethtool could be used to
> change the timeout according to situation of the platform.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH 2/2] dsa: mv88e6131: support fixed PHYs
From: David Miller @ 2015-02-19 20:19 UTC (permalink / raw)
To: tobias; +Cc: netdev
In-Reply-To: <20150212141317.GB12318@gmail.com>
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 12 Feb 2015 15:13:17 +0100
> Statically setup the PCS Control on the MAC to match the fixed PHY.
>
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
...
> + /* PPU will configure MACs with physical PHYs */
> + if (!fixed_phy_get_status(phy))
> + return;
I kind of agree with Florian that you probably don't need this.
And furthermore, this fixed_phy_get_status() interface you created
isn't even used for what it's designed for.
As coded, fixed_phy_get_status() returns the link status structure,
but here you are only interested in whether a phy is fixed or not
because you're simply making a boolean test upon whether you were
given a non-NULL fixed phy status or not.
^ permalink raw reply
* Re: [PATCH net] net: eth: altera: Change access ports to mdio for all xMII applications
From: David Miller @ 2015-02-19 20:24 UTC (permalink / raw)
To: vbridger; +Cc: netdev, nios2-dev, linux-kernel, vbridger, kailng, dwesterg
In-Reply-To: <1423759653-5023-1-git-send-email-vbridger@opensource.altera.com>
From: Vince Bridgers <vbridger@opensource.altera.com>
Date: Thu, 12 Feb 2015 10:47:33 -0600
> Change use of Altera TSE's MDIO access from phy 0 registers to phy 1
> registers. This allows support for GMII, MII, RGMII, and SGMII
> designs where the external PHY is always accesible through
> Altera TSE's MDIO phy 1 registers and Altera's PCS is accessible
> through MDIO phy 0 registers for SGMII applications.
>
> Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
> Tested-by: Kai Lin Ng <kailng@altera.com>
> Tested-by: Dalon Westergreen <dwesterg@gmail.com>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH net] net: eth: altera: Change reset_mac failure message masks from err to dbg
From: David Miller @ 2015-02-19 20:24 UTC (permalink / raw)
To: vbridger; +Cc: netdev, nios2-dev, linux-kernel, vbridger
In-Reply-To: <1423759665-5062-1-git-send-email-vbridger@opensource.altera.com>
From: Vince Bridgers <vbridger@opensource.altera.com>
Date: Thu, 12 Feb 2015 10:47:45 -0600
> This debug output is not really an error message since mac reset can fail
> if the phy clocks are gated, specifically when the phy has been placed in
> a powered down or isolation mode. The netdev output masks were changed from
> err to dbg, and comments added in the code.
>
> Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
Also applied to net-next, thanks.
^ permalink raw reply
* Re: [PATCH] ipv6: address issue in __ip6_append_data
From: David Miller @ 2015-02-19 20:27 UTC (permalink / raw)
To: madalin.bucur; +Cc: netdev, vyasevich
In-Reply-To: <1423841459-21880-1-git-send-email-madalin.bucur@freescale.com>
From: Madalin Bucur <madalin.bucur@freescale.com>
Date: Fri, 13 Feb 2015 17:30:59 +0200
> I think I've found a problem that allows generic IPv6 traffic to be
> sent by the stack with CHECKSUM_PARTIAL to a netdevice that declares
> NETIF_F_IPV6_CSUM. The NETIF_F_IPV6_CSUM flag is based on the
> NETIF_F_IPV6_CSUM_BIT that is described as referring only to TCP and
> UDP but in my test ICMPv6 frames with CHECKSUM_PARTIAL are seen:
>
> NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
>
> I've traced the issue to a recent commit that includes this check:
>
> rt->dst.dev->features & NETIF_F_V6_CSUM
>
> The problem with this is that NETIF_F_V6_CSUM is more than one bit:
>
> #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
>
> Thus the above check should be either:
>
> (rt->dst.dev->features & NETIF_F_V6_CSUM) == NETIF_F_V6_CSUM
>
> or probably should use NETIF_F_HW_CSUM only:
>
> rt->dst.dev->features & NETIF_F_HW_CSUM
>
> The mentioned commit is 32dce968dd987adfb0c00946d78dad9154f64759
Vlad, please review this fix.
Thanks.
>> Author: Vlad Yasevich <vyasevich@gmail.com>
>> Date: Sat Jan 31 10:40:18 2015 -0500
>>
>> ipv6: Allow for partial checksums on non-ufo packets
>>
>> Currntly, if we are not doing UFO on the packet, all UDP
>> packets will start with CHECKSUM_NONE and thus perform full
>> checksum computations in software even if device support
>> IPv6 checksum offloading.
>
>> Let's start start with CHECKSUM_PARTIAL if the device
>> supports it and we are sending only a single packet at
>> or below mtu size.
>
>> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
>> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> Reverting this commit solved the issue, then the changes below were
> validated as well. The problem was evidentiated by running ping6
> but it should be visible with any IPv6 payload that it is not UDP
> nor TCP.
>
> Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
> ---
> net/ipv6/ip6_output.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index d33df4c..7177f63 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -1275,7 +1275,7 @@ emsgsize:
> */
> if (!skb &&
> length + fragheaderlen < mtu &&
> - rt->dst.dev->features & NETIF_F_V6_CSUM &&
> + (rt->dst.dev->features & NETIF_F_V6_CSUM) == NETIF_F_V6_CSUM &&
> !exthdrlen)
> csummode = CHECKSUM_PARTIAL;
> /*
> --
> 1.7.11.7
>
^ permalink raw reply
* Re: [PATCH] Revert "smc91x: retrieve IRQ and trigger flags in a modern way"
From: David Miller @ 2015-02-19 20:28 UTC (permalink / raw)
To: robert.jarzmik; +Cc: linus.walleij, nico, netdev, linux-kernel
In-Reply-To: <87bnkx6bja.fsf@free.fr>
From: Robert Jarzmik <robert.jarzmik@free.fr>
Date: Fri, 13 Feb 2015 17:06:49 +0100
> Linus Walleij <linus.walleij@linaro.org> writes:
>
>> On Fri, Feb 13, 2015 at 12:59 AM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
>>
>> But isn't the real problem that in the device tree case,
>> irq_get_irq_data(ndev->irq) will work becaus parsing an interrupt
>> from the device tree populates it correctly in platform_get_irq()
>> whereas for the legacy lookup it just fetches the number.
>>
>> So to me it seems like a weakness in the platform_get_irq()
>> helper altogether.
>>
>> Does the following work? (I can send as a separate patch for
>> testing if you like).
>
> Almost. If you replace :
>> + if (r->flags & IORESOURCE_BITS)
> with:
>> + if (r && r->flags & IORESOURCE_BITS)
>
> Then you can push a patch with my:
> Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
>
> Now if you can make it in -rc2 or -rc3, this revert should be forgotten. But if
> you can't make it for 3.20, I'll push for the revert.
>
> So I think it's up to you now, and let's see what Gregh says about it.
What is the current status of this? I'd like to see this move forward so we
can get this fixed ASAP.
Thanks.
^ permalink raw reply
* Re: [net-next 0/2] bna: Update the Driver and Firmware Version
From: David Miller @ 2015-02-19 20:30 UTC (permalink / raw)
To: rasesh.mody; +Cc: netdev
In-Reply-To: <1423766258-8720-1-git-send-email-rasesh.mody@qlogic.com>
From: Rasesh Mody <rasesh.mody@qlogic.com>
Date: Thu, 12 Feb 2015 13:37:36 -0500
> These patches re-brands the BNA driver to QLogic. The patches update the BNA
> driver version to 3.2.25.1 and firmware version to 3.2.5.1.
>
> The patches are tested against 3.18.0-rc6. Please apply to the net-next.
These do not apply cleanly to net-next, please respin.
Thanks.
^ permalink raw reply
* Re: Possible Bug in gnet_start_copy_compat for the file,gen_stats.c
From: David Miller @ 2015-02-19 20:34 UTC (permalink / raw)
To: xerofoify
Cc: john.fastabend, standby24x7, xiyou.wangcong, rdunlap, netdev,
linux-kernel
In-Reply-To: <54DD626C.80505@gmail.com>
From: nick <xerofoify@gmail.com>
Date: Thu, 12 Feb 2015 21:33:16 -0500
> I am wondering after running sparse on the latest mainline tree why
> we are not unlocking the spinlock_bh,lock when calling the function,
> gnet_stats_start_copy_compat at the end of this function's
> body. Unless someone can explain to me why there is a very good
> reason for not unlocking the spinlock_bh,lock at the end of this
> function I will send in a patch fixing this. I am assuming this is a
> bug due to us infinitely looping in the spinlock_bh and deadlocking
> unless we exit this lock external to the call to the
> function,gnet_start_copy_compat.
This function is used to start a dump, and the caller needs the lock
to be held during the dump operation.
The lock is released by the caller by invoking gnet_stats_finish_copy().
^ permalink raw reply
* Re: [PATCH 1/1] tun: change speed from 10M to dynamically configured
From: David Miller @ 2015-02-19 20:37 UTC (permalink / raw)
To: gospo
Cc: stephen, Yanjun.Zhu, romieu, netdev, mst, jasowang, viro,
sergei.shtylyov, jonathon.reinhart
In-Reply-To: <20150218193909.GB580@gospo.home.greyhouse.net>
From: Andy Gospodarek <gospo@cumulusnetworks.com>
Date: Wed, 18 Feb 2015 14:39:09 -0500
> (Dave, if you want a more official-looking post in a standalone thread I
> can do that.)
Please do so, thanks.
^ permalink raw reply
* Re: [PATCH 1/1] tun: change speed from 10M to dynamically configured
From: David Miller @ 2015-02-19 20:40 UTC (permalink / raw)
To: stephen
Cc: Yanjun.Zhu, romieu, netdev, mst, jasowang, viro, sergei.shtylyov,
jonathon.reinhart
In-Reply-To: <20150216120345.4dfd9950@uryu.home.lan>
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Mon, 16 Feb 2015 12:03:45 -0500
> I would like to propose this is as a more complete alternative.
>
> From: Stephen Hemminger <stephen@networkpluber.org>
> Subject: [PATCH] tun: support overriding ethtool information
>
> Extensions to allow masqurade of ethtool info and device statistics.
> This is useful to provide correct information to SNMP and OSPF routing
> daemons when doing hw/sw offload of network device.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
We need a consistent policy regarding link attributes of encapsulating
"software" devices.
I see three realistic options:
1) Create a link state indication which means "I am a software device,
so I don't really have a link state in the traditional sense"
2) Don't implement the link set/get operations at all on software
devices.
People can use ETHTOOL_GLINK to see if the thing is "up"
3) Propagate the ultimate physical transport parameters into what
the software device advertises.
It's important to carefully pick one of these, and consistently apply
it to all of our software devices.
I don't want TUN doing one thing, ipv4 tunnels doing another, etc.
^ 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