* Re: pull request (net-next): ipsec-next 2013-09-26
From: David Miller @ 2013-09-30 19:12 UTC (permalink / raw)
To: steffen.klassert; +Cc: herbert, netdev
In-Reply-To: <1380185923-8976-1-git-send-email-steffen.klassert@secunet.com>
From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Thu, 26 Sep 2013 10:58:41 +0200
> Two patches that are left from the last development cycle.
> Manual merging of include/net/xfrm.h is needed. The conflict
> can be solved as it is currently done in linux-next.
>
> 1) We announce the creation of temporary acquire state via an asyc event,
> so the deletion should be annunced too. From Nicolas Dichtel.
>
> 2) The VTI tunnels do not real tunning, they just provide a routable
> IPsec tunnel interface. So introduce and use xfrm_tunnel_notifier
> instead of xfrm_tunnel for xfrm tunnel mode callback. From Fan Du.
>
> Please pull or let me know if there are problems.
Pulled, thanks a lot!
^ permalink raw reply
* Re: [PATCH net v6 1/1] xen-netback: Handle backend state transitions in a more robust way
From: David Miller @ 2013-09-30 19:14 UTC (permalink / raw)
To: Ian.Campbell; +Cc: paul.durrant, xen-devel, netdev, wei.liu2, david.vrabel
In-Reply-To: <1380200853.29483.83.camel@kazak.uk.xensource.com>
From: Ian Campbell <Ian.Campbell@citrix.com>
Date: Thu, 26 Sep 2013 14:07:33 +0100
> On Thu, 2013-09-26 at 12:09 +0100, Paul Durrant wrote:
>> When the frontend state changes netback now specifies its desired state to
>> a new function, set_backend_state(), which transitions through any
>> necessary intermediate states.
>> This fixes an issue observed with some old Windows frontend drivers where
>> they failed to transition through the Closing state and netback would not
>> behave correctly.
>>
>> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next] MAINTAINERS: add myself as maintainer of xen-netback
From: David Miller @ 2013-09-30 19:16 UTC (permalink / raw)
To: Ian.Campbell; +Cc: wei.liu2, netdev, xen-devel
In-Reply-To: <1380200887.29483.84.camel@kazak.uk.xensource.com>
From: Ian Campbell <Ian.Campbell@citrix.com>
Date: Thu, 26 Sep 2013 14:08:07 +0100
> On Thu, 2013-09-26 at 12:41 +0100, Wei Liu wrote:
>> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
I've actually applied this to 'net', it's important that this
is accurate and it's a doc change so "safe" :-)
^ permalink raw reply
* [PATCH] isdn: eicon: free pointer after using it in log msg in divas_um_idi_delete_entity()
From: Jesper Juhl @ 2013-09-30 19:25 UTC (permalink / raw)
To: Armin Schindler; +Cc: Karsten Keil, netdev, linux-kernel
Not really a problem, but nice IMHO; the Coverity static analyzer
complains that we use the pointer 'e' after it has been freed, so move
the freeing below the final use, even if that use is just using the
value of the pointer and not actually dereferencing it.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
drivers/isdn/hardware/eicon/um_idi.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/isdn/hardware/eicon/um_idi.c b/drivers/isdn/hardware/eicon/um_idi.c
index 7cab5c3..e151971 100644
--- a/drivers/isdn/hardware/eicon/um_idi.c
+++ b/drivers/isdn/hardware/eicon/um_idi.c
@@ -288,9 +288,9 @@ int divas_um_idi_delete_entity(int adapter_nr, void *entity)
cleanup_entity(e);
diva_os_free(0, e->os_context);
memset(e, 0x00, sizeof(*e));
- diva_os_free(0, e);
DBG_LOG(("A(%d) remove E:%08x", adapter_nr, e));
+ diva_os_free(0, e);
return (0);
}
--
1.7.1
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related
* Re: [PATCH] net: flow_dissector: fix thoff for IPPROTO_AH
From: David Miller @ 2013-09-30 19:34 UTC (permalink / raw)
To: eric.dumazet; +Cc: nikolay, dborkman, netdev, andy, fubar, vfalico
In-Reply-To: <1380210246.3165.184.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 26 Sep 2013 08:44:06 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> In commit 8ed781668dd49 ("flow_keys: include thoff into flow_keys for
> later usage"), we missed that existing code was using nhoff as a
> temporary variable that could not always contain transport header
> offset.
>
> This is not a problem for TCP/UDP because port offset (@poff)
> is 0 for these protocols.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied and queued up for -stable, thanks Eric.
^ permalink raw reply
* Re: [PATCH 0/3 - GIT PULL] include/linux: Remove externs from networking function prototypes
From: David Miller @ 2013-09-30 19:37 UTC (permalink / raw)
To: joe; +Cc: netdev, linux-kernel, linux-hippi, netfilter-devel, netfilter,
coreteam
In-Reply-To: <cover.1380233637.git.joe@perches.com>
From: Joe Perches <joe@perches.com>
Date: Thu, 26 Sep 2013 15:18:30 -0700
>
> The following changes since commit aae8c287e664d49df4aa315ad263c33b9a2af3e1:
>
> Merge branch 'bonding_neighbours' (2013-09-26 16:02:19 -0400)
>
> are available in the git repository at:
>
> git://repo.or.cz/linux-2.6/trivial-mods.git 20130926_include_linux_networking_externs
>
> for you to fetch changes up to f629d208d27a22f495b7734eede585b5d207e912:
>
> [networking]device.h: Remove extern from function prototypes (2013-09-26 15:06:58 -0700)
Pulled, thanks Joe.
^ permalink raw reply
* Re: [PATCH net-next] bonding: trivial: remove forgotten bond_next_vlan()
From: David Miller @ 2013-09-30 19:39 UTC (permalink / raw)
To: vfalico; +Cc: netdev, fubar, andy
In-Reply-To: <1380237721-8229-1-git-send-email-vfalico@redhat.com>
From: Veaceslav Falico <vfalico@redhat.com>
Date: Fri, 27 Sep 2013 01:22:01 +0200
> It's a forgotten function declaration, which was removed some time ago
> already.
>
> CC: Jay Vosburgh <fubar@us.ibm.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 3/7] net: introduce new macro net_get_random_once
From: David Miller @ 2013-09-30 19:43 UTC (permalink / raw)
To: hannes; +Cc: netdev, edumazet
In-Reply-To: <1380236199-3726-4-git-send-email-hannes@stressinduktion.org>
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Fri, 27 Sep 2013 00:56:35 +0200
> +/* BE CAREFUL: this function is not interrupt safe */
> +#define net_get_random_once(buf, nbytes) \
> + ({ \
> + static bool ___done = false; \
> + bool ___ret = false; \
> + if (unlikely(!___done)) \
> + ___ret = __net_get_random_once(buf, \
> + nbytes, \
> + &___done); \
> + ___ret; \
> + })
I don't want to see this happening in every fast path, it's silly to test
this every time after the first iteration.
Maybe... _maybe_ I can be convinced if you use a static branch for this so
that it _really_ costs next to nothing.
But as-is I am not going to apply this series, sorry.
^ permalink raw reply
* Re: [PATCH net-next] qdisc: meta return ENOMEM on alloc failure
From: David Miller @ 2013-09-30 19:48 UTC (permalink / raw)
To: stephen; +Cc: tgraf, netdev
In-Reply-To: <20130926174011.22632779@nehalam.linuxnetplumber.net>
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 26 Sep 2013 17:40:11 -0700
> Rather than returning earlier value (EINVAL), return ENOMEM if
> kzalloc fails. Found while reviewing to find another EINVAL condition.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] qdisc: basic classifier - remove unnecessary initialization
From: David Miller @ 2013-09-30 19:48 UTC (permalink / raw)
To: stephen; +Cc: jhs, netdev
In-Reply-To: <20130926174216.447555bd@nehalam.linuxnetplumber.net>
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 26 Sep 2013 17:42:16 -0700
> err is set once, then first code resets it.
> err = tcf_exts_validate(...)
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Applied.
^ permalink raw reply
* Re: [PATCH] pkt_sched: fq: qdisc dismantle fixes
From: David Miller @ 2013-09-30 19:51 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1380316801.30872.37.camel@edumazet-glaptop.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 27 Sep 2013 14:20:01 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> fq_reset() should drops all packets in queue, including
> throttled flows.
>
> This patch moves code from fq_destroy() to fq_reset()
> to do the cleaning.
>
> fq_change() must stop calling fq_dequeue() if all remaining
> packets are from throttled flows.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply
* [PATCH 0/4] connector fixes
From: Mathias Krause @ 2013-09-30 20:03 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: Mathias Krause, netdev
This series fixes a few netlink related issues of the connector interface.
The first two patches are bug fixes. The last two are cleanups.
Please apply!
Mathias Krause (4):
proc connector: fix info leaks
connector: use nlmsg_len() to check message length
connector: use 'size' everywhere in cn_netlink_send()
connector - documentation: simplify netlink message length assignment
Documentation/connector/ucon.c | 2 +-
drivers/connector/cn_proc.c | 18 ++++++++++++++++++
drivers/connector/connector.c | 9 +++++----
3 files changed, 24 insertions(+), 5 deletions(-)
--
1.7.10.4
^ permalink raw reply
* [PATCH 1/4] proc connector: fix info leaks
From: Mathias Krause @ 2013-09-30 20:03 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: Mathias Krause, netdev
In-Reply-To: <1380571389-15343-1-git-send-email-minipli@googlemail.com>
Initialize event_data for all possible message types to prevent leaking
kernel stack contents to userland (up to 20 bytes). Also set the flags
member of the connector message to 0 to prevent leaking two more stack
bytes this way.
Cc: stable@vger.kernel.org # v2.6.15+
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
drivers/connector/cn_proc.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 08ae128..c73fc2b 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -65,6 +65,7 @@ void proc_fork_connector(struct task_struct *task)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
get_seq(&msg->seq, &ev->cpu);
ktime_get_ts(&ts); /* get high res monotonic timestamp */
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -80,6 +81,7 @@ void proc_fork_connector(struct task_struct *task)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = 0; /* not used */
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
/* If cn_netlink_send() failed, the data is not sent */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
@@ -96,6 +98,7 @@ void proc_exec_connector(struct task_struct *task)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
get_seq(&msg->seq, &ev->cpu);
ktime_get_ts(&ts); /* get high res monotonic timestamp */
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -106,6 +109,7 @@ void proc_exec_connector(struct task_struct *task)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = 0; /* not used */
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
@@ -122,6 +126,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
ev->what = which_id;
ev->event_data.id.process_pid = task->pid;
ev->event_data.id.process_tgid = task->tgid;
@@ -145,6 +150,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = 0; /* not used */
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
@@ -160,6 +166,7 @@ void proc_sid_connector(struct task_struct *task)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
get_seq(&msg->seq, &ev->cpu);
ktime_get_ts(&ts); /* get high res monotonic timestamp */
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -170,6 +177,7 @@ void proc_sid_connector(struct task_struct *task)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = 0; /* not used */
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
@@ -185,6 +193,7 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
get_seq(&msg->seq, &ev->cpu);
ktime_get_ts(&ts); /* get high res monotonic timestamp */
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -203,6 +212,7 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = 0; /* not used */
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
@@ -218,6 +228,7 @@ void proc_comm_connector(struct task_struct *task)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
get_seq(&msg->seq, &ev->cpu);
ktime_get_ts(&ts); /* get high res monotonic timestamp */
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -229,6 +240,7 @@ void proc_comm_connector(struct task_struct *task)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = 0; /* not used */
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
@@ -244,6 +256,7 @@ void proc_coredump_connector(struct task_struct *task)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
get_seq(&msg->seq, &ev->cpu);
ktime_get_ts(&ts); /* get high res monotonic timestamp */
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -254,6 +267,7 @@ void proc_coredump_connector(struct task_struct *task)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = 0; /* not used */
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
@@ -269,6 +283,7 @@ void proc_exit_connector(struct task_struct *task)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
get_seq(&msg->seq, &ev->cpu);
ktime_get_ts(&ts); /* get high res monotonic timestamp */
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -281,6 +296,7 @@ void proc_exit_connector(struct task_struct *task)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = 0; /* not used */
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
@@ -304,6 +320,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
msg = (struct cn_msg *)buffer;
ev = (struct proc_event *)msg->data;
+ memset(&ev->event_data, 0, sizeof(ev->event_data));
msg->seq = rcvd_seq;
ktime_get_ts(&ts); /* get high res monotonic timestamp */
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -313,6 +330,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = rcvd_ack + 1;
msg->len = sizeof(*ev);
+ msg->flags = 0; /* not used */
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/4] connector: use 'size' everywhere in cn_netlink_send()
From: Mathias Krause @ 2013-09-30 20:03 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: Mathias Krause, netdev
In-Reply-To: <1380571389-15343-1-git-send-email-minipli@googlemail.com>
We calculated the size for the netlink message buffer as size. Use size
in the memcpy() call as well instead of recalculating it.
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
drivers/connector/connector.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 0daa11e..a36749f 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -109,7 +109,7 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
data = nlmsg_data(nlh);
- memcpy(data, msg, sizeof(*data) + msg->len);
+ memcpy(data, msg, size);
NETLINK_CB(skb).dst_group = group;
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/4] connector: use nlmsg_len() to check message length
From: Mathias Krause @ 2013-09-30 20:03 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: Mathias Krause, netdev
In-Reply-To: <1380571389-15343-1-git-send-email-minipli@googlemail.com>
The current code tests the length of the whole netlink message to be
at least as long to fit a cn_msg. This is wrong as nlmsg_len includes
the length of the netlink message header. Use nlmsg_len() instead to
fix this "off-by-NLMSG_HDRLEN" size check.
Cc: stable@vger.kernel.org # v2.6.14+
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
drivers/connector/connector.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 6ecfa75..0daa11e 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -157,17 +157,18 @@ static int cn_call_callback(struct sk_buff *skb)
static void cn_rx_skb(struct sk_buff *__skb)
{
struct nlmsghdr *nlh;
- int err;
struct sk_buff *skb;
+ int len, err;
skb = skb_get(__skb);
if (skb->len >= NLMSG_HDRLEN) {
nlh = nlmsg_hdr(skb);
+ len = nlmsg_len(nlh);
- if (nlh->nlmsg_len < sizeof(struct cn_msg) ||
+ if (len < (int)sizeof(struct cn_msg) ||
skb->len < nlh->nlmsg_len ||
- nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) {
+ len > CONNECTOR_MAX_MSG_SIZE) {
kfree_skb(skb);
return;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 4/4] connector - documentation: simplify netlink message length assignment
From: Mathias Krause @ 2013-09-30 20:03 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: Mathias Krause, netdev
In-Reply-To: <1380571389-15343-1-git-send-email-minipli@googlemail.com>
Use the precalculated size instead of obfuscating the message length
calculation by first subtracting the netlink header length from size
and then use the NLMSG_LENGTH() macro to add it back again.
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
Documentation/connector/ucon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/connector/ucon.c b/Documentation/connector/ucon.c
index 4848db8..8a4da64 100644
--- a/Documentation/connector/ucon.c
+++ b/Documentation/connector/ucon.c
@@ -71,7 +71,7 @@ static int netlink_send(int s, struct cn_msg *msg)
nlh->nlmsg_seq = seq++;
nlh->nlmsg_pid = getpid();
nlh->nlmsg_type = NLMSG_DONE;
- nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
+ nlh->nlmsg_len = size;
nlh->nlmsg_flags = 0;
m = NLMSG_DATA(nlh);
--
1.7.10.4
^ permalink raw reply related
* [PATCH net] unix_diag: fix info leak
From: Mathias Krause @ 2013-09-30 20:05 UTC (permalink / raw)
To: David S. Miller; +Cc: Mathias Krause, netdev
When filling the netlink message we miss to wipe the pad field,
therefore leak one byte of heap memory to userland. Fix this by
setting pad to 0.
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
Probably material for stable as well (v3.3+).
net/unix/diag.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/unix/diag.c b/net/unix/diag.c
index d591091..86fa0f3 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -124,6 +124,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r
rep->udiag_family = AF_UNIX;
rep->udiag_type = sk->sk_type;
rep->udiag_state = sk->sk_state;
+ rep->pad = 0;
rep->udiag_ino = sk_ino;
sock_diag_save_cookie(sk, rep->udiag_cookie);
--
1.7.10.4
^ permalink raw reply related
* [PATCH 0/3] calxedaxgmac: fixes for xgmac_set_rx_mode
From: Rob Herring @ 2013-09-30 20:12 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: Rob Herring
From: Rob Herring <rob.herring@calxeda.com>
This is a couple of fixes related to xgmac_set_rx_mode. The changes are
necessary for "bridge fdb add" to work correctly.
Rob
Rob Herring (3):
net: calxedaxgmac: fix clearing of old filter addresses
net: calxedaxgmac: add uc and mc filter addresses in promiscuous mode
net: calxedaxgmac: determine number of address filters at runtime
drivers/net/ethernet/calxeda/xgmac.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
--
1.8.1.2
^ permalink raw reply
* [PATCH 1/3] net: calxedaxgmac: fix clearing of old filter addresses
From: Rob Herring @ 2013-09-30 20:12 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: Rob Herring
In-Reply-To: <1380571937-23439-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
In commit 2ee68f621af280 (net: calxedaxgmac: fix various errors in
xgmac_set_rx_mode), a fix to clean-up old address entries was added.
However, the loop to zero out the entries failed to increment the register
address resulting in only 1 entry getting cleared. Fix this to correctly
use the loop index. Also, the end of the loop condition was off by 1 and
should have been <= rather than <.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
drivers/net/ethernet/calxeda/xgmac.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 78d6d6b..94358d2 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1342,8 +1342,8 @@ static void xgmac_set_rx_mode(struct net_device *dev)
}
out:
- for (i = reg; i < XGMAC_MAX_FILTER_ADDR; i++)
- xgmac_set_mac_addr(ioaddr, NULL, reg);
+ for (i = reg; i <= XGMAC_MAX_FILTER_ADDR; i++)
+ xgmac_set_mac_addr(ioaddr, NULL, i);
for (i = 0; i < XGMAC_NUM_HASH; i++)
writel(hash_filter[i], ioaddr + XGMAC_HASH(i));
--
1.8.1.2
^ permalink raw reply related
* [PATCH 2/3] net: calxedaxgmac: add uc and mc filter addresses in promiscuous mode
From: Rob Herring @ 2013-09-30 20:12 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: Rob Herring
In-Reply-To: <1380571937-23439-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
Even in promiscuous mode, we need to add filter addresses for correct
operation. This fixes silent failures when using a bridge and adding
addresses using the "bridge fdb add" command.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
drivers/net/ethernet/calxeda/xgmac.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 94358d2..35da09b 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1291,10 +1291,8 @@ static void xgmac_set_rx_mode(struct net_device *dev)
netdev_dbg(priv->dev, "# mcasts %d, # unicast %d\n",
netdev_mc_count(dev), netdev_uc_count(dev));
- if (dev->flags & IFF_PROMISC) {
- writel(XGMAC_FRAME_FILTER_PR, ioaddr + XGMAC_FRAME_FILTER);
- return;
- }
+ if (dev->flags & IFF_PROMISC)
+ value |= XGMAC_FRAME_FILTER_PR;
memset(hash_filter, 0, sizeof(hash_filter));
--
1.8.1.2
^ permalink raw reply related
* [PATCH 3/3] net: calxedaxgmac: determine number of address filters at runtime
From: Rob Herring @ 2013-09-30 20:12 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: Rob Herring
In-Reply-To: <1380571937-23439-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
Highbank and Midway xgmac h/w have different number of MAC address filter
registers with 7 and 31, respectively. Highbank has been wrong, so fix it
and detect the number of filter registers at run-time. Unfortunately,
the version register is the same on both SOCs, so simply test if write to
the last filter register will take a value. It always reads as 0 if not.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
drivers/net/ethernet/calxeda/xgmac.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 35da09b..48f5288 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -106,7 +106,6 @@
#define XGMAC_DMA_HW_FEATURE 0x00000f58 /* Enabled Hardware Features */
#define XGMAC_ADDR_AE 0x80000000
-#define XGMAC_MAX_FILTER_ADDR 31
/* PMT Control and Status */
#define XGMAC_PMT_POINTER_RESET 0x80000000
@@ -384,6 +383,7 @@ struct xgmac_priv {
struct device *device;
struct napi_struct napi;
+ int max_macs;
struct xgmac_extra_stats xstats;
spinlock_t stats_lock;
@@ -1296,7 +1296,7 @@ static void xgmac_set_rx_mode(struct net_device *dev)
memset(hash_filter, 0, sizeof(hash_filter));
- if (netdev_uc_count(dev) > XGMAC_MAX_FILTER_ADDR) {
+ if (netdev_uc_count(dev) > priv->max_macs) {
use_hash = true;
value |= XGMAC_FRAME_FILTER_HUC | XGMAC_FRAME_FILTER_HPF;
}
@@ -1319,7 +1319,7 @@ static void xgmac_set_rx_mode(struct net_device *dev)
goto out;
}
- if ((netdev_mc_count(dev) + reg - 1) > XGMAC_MAX_FILTER_ADDR) {
+ if ((netdev_mc_count(dev) + reg - 1) > priv->max_macs) {
use_hash = true;
value |= XGMAC_FRAME_FILTER_HMC | XGMAC_FRAME_FILTER_HPF;
} else {
@@ -1340,7 +1340,7 @@ static void xgmac_set_rx_mode(struct net_device *dev)
}
out:
- for (i = reg; i <= XGMAC_MAX_FILTER_ADDR; i++)
+ for (i = reg; i <= priv->max_macs; i++)
xgmac_set_mac_addr(ioaddr, NULL, i);
for (i = 0; i < XGMAC_NUM_HASH; i++)
writel(hash_filter[i], ioaddr + XGMAC_HASH(i));
@@ -1759,6 +1759,13 @@ static int xgmac_probe(struct platform_device *pdev)
uid = readl(priv->base + XGMAC_VERSION);
netdev_info(ndev, "h/w version is 0x%x\n", uid);
+ /* Figure out how many valid mac address filter registers we have */
+ writel(1, priv->base + XGMAC_ADDR_HIGH(31));
+ if (readl(priv->base + XGMAC_ADDR_HIGH(31)) == 1)
+ priv->max_macs = 31;
+ else
+ priv->max_macs = 7;
+
writel(0, priv->base + XGMAC_DMA_INTR_ENA);
ndev->irq = platform_get_irq(pdev, 0);
if (ndev->irq == -ENXIO) {
--
1.8.1.2
^ permalink raw reply related
* [RFC PATCH] net: calxedaxgmac: add mac address learning
From: Rob Herring @ 2013-09-30 20:17 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: Rob Herring
From: Rob Herring <rob.herring@calxeda.com>
The Calxeda xgmac must learn secondary mac addresses such as those
behind a bridge in order to properly receive packets with those mac
addresses. Add mac address learning on transmit with aging of entries.
The mac addresses are added to the driver's unicast address list, so
they are visible to user via "bridge fdb show" command.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
drivers/net/ethernet/calxeda/xgmac.c | 84 ++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 48f5288..2afe8b7 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -360,6 +360,12 @@ struct xgmac_extra_stats {
unsigned long rx_process_stopped;
unsigned long tx_early;
unsigned long fatal_bus_error;
+ unsigned long learning_drop;
+};
+
+struct xgmac_mac {
+ char mac_addr[ETH_ALEN];
+ unsigned long time;
};
struct xgmac_priv {
@@ -384,6 +390,8 @@ struct xgmac_priv {
struct napi_struct napi;
int max_macs;
+ struct xgmac_mac mac_list[32];
+
struct xgmac_extra_stats xstats;
spinlock_t stats_lock;
@@ -392,8 +400,11 @@ struct xgmac_priv {
char tx_pause;
int wolopts;
struct work_struct tx_timeout_work;
+ struct delayed_work mac_aging_work;
};
+#define XGMAC_AGING_TIMEOUT (120 * HZ)
+
/* XGMAC Configuration Settings */
#define MAX_MTU 9000
#define PAUSE_TIME 0x400
@@ -1047,6 +1058,8 @@ static int xgmac_open(struct net_device *dev)
writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS);
writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA);
+ schedule_delayed_work(&priv->mac_aging_work, 5 * HZ);
+
return 0;
}
@@ -1059,6 +1072,7 @@ static int xgmac_open(struct net_device *dev)
static int xgmac_stop(struct net_device *dev)
{
struct xgmac_priv *priv = netdev_priv(dev);
+ int i;
netif_stop_queue(dev);
@@ -1073,9 +1087,74 @@ static int xgmac_stop(struct net_device *dev)
/* Release and free the Rx/Tx resources */
xgmac_free_dma_desc_rings(priv);
+ cancel_delayed_work_sync(&priv->mac_aging_work);
+ for (i = 0; i < priv->max_macs; i++) {
+ if (!is_valid_ether_addr(priv->mac_list[i].mac_addr))
+ continue;
+ priv->mac_list[i].time = 0;
+ dev_uc_del(dev, priv->mac_list[i].mac_addr);
+ memset(priv->mac_list[i].mac_addr, 0, ETH_ALEN);
+ }
+
return 0;
}
+static void xgmac_mac_aging_work(struct work_struct *work)
+{
+ int i;
+ struct xgmac_priv *priv =
+ container_of(work, struct xgmac_priv, mac_aging_work.work);
+ struct net_device *dev = priv->dev;
+
+ for (i = 0; i < priv->max_macs; i++) {
+ if (time_is_after_jiffies(priv->mac_list[i].time + XGMAC_AGING_TIMEOUT))
+ continue;
+ if (!is_valid_ether_addr(priv->mac_list[i].mac_addr))
+ continue;
+
+ priv->mac_list[i].time = 0;
+ printk("unlearned addr %pM\n", priv->mac_list[i].mac_addr);
+ dev_uc_del(dev, priv->mac_list[i].mac_addr);
+ memset(priv->mac_list[i].mac_addr, 0, ETH_ALEN);
+ }
+
+ schedule_delayed_work(to_delayed_work(work), 5 * HZ);
+}
+
+static void xgmac_learn_mac(struct xgmac_priv *priv, struct sk_buff *skb)
+{
+ struct net_device *dev = priv->dev;
+ struct ethhdr *phdr = (struct ethhdr *)(skb->data);
+ char *src_addr = phdr->h_source;
+ int i, slot = -1;
+
+ if (ether_addr_equal(src_addr, dev->dev_addr) ||
+ !is_valid_ether_addr(src_addr))
+ return;
+
+ for (i = 0; i < priv->max_macs; i++) {
+ /* update timestamp if we already learned the address */
+ if (ether_addr_equal(priv->mac_list[i].mac_addr, src_addr)) {
+ priv->mac_list[i].time = jiffies;
+ return;
+ }
+ /* find empty slot */
+ if ((slot < 0) && !priv->mac_list[i].time)
+ slot = i;
+ }
+
+ /* Check if we've already filled all slots */
+ if (slot < 0) {
+ priv->xstats.learning_drop++;
+ return;
+ }
+
+ printk("learned addr %pM\n", src_addr);
+ priv->mac_list[slot].time = jiffies;
+ memcpy(priv->mac_list[slot].mac_addr, src_addr, ETH_ALEN);
+ dev_uc_add_excl(dev, src_addr);
+}
+
/**
* xgmac_xmit:
* @skb : the socket buffer
@@ -1155,6 +1234,9 @@ static netdev_tx_t xgmac_xmit(struct sk_buff *skb, struct net_device *dev)
if (tx_dma_ring_space(priv) > MAX_SKB_FRAGS)
netif_start_queue(dev);
}
+
+ xgmac_learn_mac(priv, skb);
+
return NETDEV_TX_OK;
dma_err:
@@ -1605,6 +1687,7 @@ static const struct xgmac_stats xgmac_gstrings_stats[] = {
XGMAC_STAT(rx_ip_header_error),
XGMAC_STAT(rx_da_filter_fail),
XGMAC_STAT(fatal_bus_error),
+ XGMAC_STAT(learning_drop),
XGMAC_HW_STAT(rx_watchdog, XGMAC_MMC_RXWATCHDOG),
XGMAC_HW_STAT(tx_vlan, XGMAC_MMC_TXVLANFRAME),
XGMAC_HW_STAT(rx_vlan, XGMAC_MMC_RXVLANFRAME),
@@ -1743,6 +1826,7 @@ static int xgmac_probe(struct platform_device *pdev)
SET_ETHTOOL_OPS(ndev, &xgmac_ethtool_ops);
spin_lock_init(&priv->stats_lock);
INIT_WORK(&priv->tx_timeout_work, xgmac_tx_timeout_work);
+ INIT_DELAYED_WORK(&priv->mac_aging_work, xgmac_mac_aging_work);
priv->device = &pdev->dev;
priv->dev = ndev;
--
1.8.1.2
^ permalink raw reply related
* [PATCH 07/11] igb: Avoid uninitialized advertised variable in eee_set_cur
From: Andi Kleen @ 2013-09-30 20:29 UTC (permalink / raw)
To: linux-kernel; +Cc: Andi Kleen, jeffrey.t.kirsher, netdev
In-Reply-To: <1380572952-30729-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
eee_get_cur assumes that the output data is already zeroed. It can
read-modify-write the advertised field:
if (ipcnfg & E1000_IPCNFG_EEE_100M_AN)
2594 edata->advertised |= ADVERTISED_100baseT_Full;
This is ok for the normal ethtool eee_get call, which always
zeroes the input data before.
But eee_set_cur also calls eee_get_cur and it did not zero the input
field. Later on it then compares agsinst the field, which can contain partial
stack garbage.
Zero the input field in eee_set_cur() too.
Cc: jeffrey.t.kirsher@intel.com
Cc: netdev@vger.kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 48cbc83..41e37ff 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2652,6 +2652,8 @@ static int igb_set_eee(struct net_device *netdev,
(hw->phy.media_type != e1000_media_type_copper))
return -EOPNOTSUPP;
+ memset(&eee_curr, 0, sizeof(struct ethtool_eee));
+
ret_val = igb_get_eee(netdev, &eee_curr);
if (ret_val)
return ret_val;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 10/11] tcp: Always set options to 0 before calling tcp_established_options
From: Andi Kleen @ 2013-09-30 20:29 UTC (permalink / raw)
To: linux-kernel; +Cc: Andi Kleen, netdev
In-Reply-To: <1380572952-30729-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
tcp_established_options assumes opts->options is 0 before calling,
as it read modify writes it.
For the tcp_current_mss() case the opts structure is not zeroed,
so this can be done with uninitialized values.
This is ok, because ->options is not read in this path.
But it's still better to avoid the operation on the uninitialized
field. This shuts up a static code analyzer, and presumably
may help the optimizer.
Cc: netdev@vger.kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
net/ipv4/tcp_output.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 7c83cb8..f3ed78d 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -637,6 +637,8 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb
unsigned int size = 0;
unsigned int eff_sacks;
+ opts->options = 0;
+
#ifdef CONFIG_TCP_MD5SIG
*md5 = tp->af_specific->md5_lookup(sk, sk);
if (unlikely(*md5)) {
--
1.8.3.1
^ permalink raw reply related
* [PATCH] ip: make -resolve addr to print names rather than addresses
From: Sami Kerola @ 2013-09-30 21:01 UTC (permalink / raw)
To: netdev; +Cc: kerolasa
As a system admin I occasionally want to be able to check that all
interfaces has a name in DNS or /etc/hosts file.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
ip/ipaddress.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 1c3e4da..d02eaaf 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -636,7 +636,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
fprintf(fp, " family %d ", ifa->ifa_family);
if (rta_tb[IFA_LOCAL]) {
- fprintf(fp, "%s", rt_addr_n2a(ifa->ifa_family,
+ fprintf(fp, "%s", format_host(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_LOCAL]),
RTA_DATA(rta_tb[IFA_LOCAL]),
abuf, sizeof(abuf)));
@@ -647,7 +647,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
fprintf(fp, "/%d ", ifa->ifa_prefixlen);
} else {
fprintf(fp, " peer %s/%d ",
- rt_addr_n2a(ifa->ifa_family,
+ format_host(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_ADDRESS]),
RTA_DATA(rta_tb[IFA_ADDRESS]),
abuf, sizeof(abuf)),
@@ -657,14 +657,14 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
if (rta_tb[IFA_BROADCAST]) {
fprintf(fp, "brd %s ",
- rt_addr_n2a(ifa->ifa_family,
+ format_host(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_BROADCAST]),
RTA_DATA(rta_tb[IFA_BROADCAST]),
abuf, sizeof(abuf)));
}
if (rta_tb[IFA_ANYCAST]) {
fprintf(fp, "any %s ",
- rt_addr_n2a(ifa->ifa_family,
+ format_host(ifa->ifa_family,
RTA_PAYLOAD(rta_tb[IFA_ANYCAST]),
RTA_DATA(rta_tb[IFA_ANYCAST]),
abuf, sizeof(abuf)));
--
1.8.4
^ permalink raw reply related
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