* [3.11.y.z extended stable] Linux 3.11.10.8 stable review
@ 2014-04-16 10:31 Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 01/46] Input: cypress_ps2 - don't report as a button pads Luis Henriques
` (45 more replies)
0 siblings, 46 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team; +Cc: Luis Henriques
This is the start of the review cycle for the Linux 3.11.10.8 stable kernel.
This version contains 46 new patches, summarized below. The new patches are
posted as replies to this message and also available in this git branch:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.11.y-review;a=shortlog
git://kernel.ubuntu.com/ubuntu/linux.git linux-3.11.y-review
The review period for version 3.11.10.8 will be open for the next three days.
To report a problem, please reply to the relevant follow-up patch message.
For more information about the Linux 3.11.y.z extended stable kernel version,
see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .
-Luis
--
arch/m68k/Kconfig | 1 +
arch/s390/Kconfig | 1 +
arch/sparc/Kconfig | 2 +-
arch/sparc/include/asm/uaccess_64.h | 4 +-
arch/sparc/kernel/pci.c | 4 +-
arch/sparc/kernel/process_64.c | 4 +-
arch/sparc/kernel/syscalls.S | 4 +-
arch/x86/crypto/ghash-clmulni-intel_asm.S | 29 ------
arch/x86/crypto/ghash-clmulni-intel_glue.c | 14 ++-
drivers/cpufreq/cpufreq_governor.c | 3 +
drivers/cpufreq/powernow-k6.c | 147 +++++++++++++++++++++++-----
drivers/cpuidle/driver.c | 3 +-
drivers/input/mouse/cypress_ps2.c | 1 -
drivers/isdn/isdnloop/isdnloop.c | 23 +++--
drivers/net/ethernet/broadcom/tg3.c | 5 +-
drivers/net/usb/usbnet.c | 33 ++++---
drivers/net/vxlan.c | 3 +
drivers/net/xen-netback/netback.c | 4 +-
drivers/vhost/net.c | 20 +++-
include/linux/futex.h | 4 +
include/linux/usb/usbnet.h | 2 +-
include/net/netfilter/nf_conntrack_extend.h | 4 +-
include/net/sock.h | 5 +
init/Kconfig | 7 ++
kernel/futex.c | 14 ++-
lib/nlattr.c | 10 +-
net/8021q/vlan.c | 4 +-
net/8021q/vlan_dev.c | 6 +-
net/bridge/br_multicast.c | 6 ++
net/bridge/netfilter/ebtables.c | 5 +-
net/core/netpoll.c | 2 +-
net/core/rtnetlink.c | 10 +-
net/core/sock.c | 5 +-
net/ipv4/inet_fragment.c | 5 +-
net/ipv4/ipmr.c | 13 ++-
net/ipv4/netfilter/arp_tables.c | 6 +-
net/ipv4/netfilter/ip_tables.c | 6 +-
net/ipv4/tcp_output.c | 11 +++
net/ipv6/addrconf.c | 5 +-
net/ipv6/exthdrs_offload.c | 4 +-
net/ipv6/icmp.c | 2 +-
net/ipv6/ip6_output.c | 18 ++--
net/ipv6/ip6mr.c | 13 ++-
net/ipv6/mcast.c | 11 ++-
net/ipv6/netfilter/ip6_tables.c | 6 +-
net/ipv6/ping.c | 4 +-
net/ipv6/route.c | 2 +-
net/netfilter/nf_conntrack_proto_dccp.c | 6 +-
net/rds/iw.c | 3 +-
net/sctp/sm_make_chunk.c | 4 +-
net/sctp/sm_statefuns.c | 5 -
net/socket.c | 4 +
net/unix/af_unix.c | 17 +++-
security/selinux/hooks.c | 36 +++++--
54 files changed, 390 insertions(+), 180 deletions(-)
Andrey Vagin (1):
netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len
Anton Nayshtut (1):
ipv6: Fix exthdrs offload registration.
Ard Biesheuvel (1):
crypto: ghash-clmulni-intel - use C implementation for setkey()
Dan Carpenter (1):
isdnloop: several buffer overflows
Daniel Borkmann (2):
netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages
net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk
Daniel Fu (1):
cpuidle: Check the result of cpuidle_get_driver() against NULL
Dave Kleikamp (2):
Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines."
sparc64: don't treat 64-bit syscall return codes as 32-bit
David S. Miller (1):
sparc64: Make sure %pil interrupts are enabled during hypervisor yield.
David Stevens (1):
vxlan: fix potential NULL dereference in arp_reduce()
Eric Dumazet (2):
net: unix: non blocking recvmsg() should not return -EINTR
tcp: tcp_release_cb() should release socket ownership
Finn Thain (1):
m68k: Skip futex_atomic_cmpxchg_inatomic() test
Florian Westphal (1):
inet: frag: make sure forced eviction removes all frags
Hannes Frederic Sowa (1):
ipv6: some ipv6 statistic counters failed to disable bh
Hans de Goede (1):
Input: cypress_ps2 - don't report as a button pads
Heiko Carstens (1):
futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test
Heiner Kallweit (1):
ipv6: Avoid unnecessary temporary addresses being generated
Li RongQing (1):
netpoll: fix the skb check in pkt_is_ns
Linus Lüssing (1):
bridge: multicast: add sanity check for query source addresses
Matthew Leach (1):
net: socket: error on a negative msg_namelen
Michael S. Tsirkin (2):
vhost: fix total length when packets are too short
vhost: validate vhost_get_vq_desc return value
Mikulas Patocka (3):
powernow-k6: disable cache when changing frequency
powernow-k6: correctly initialize default parameters
powernow-k6: reorder frequencies
Nicolas Dichtel (3):
rtnetlink: fix fdb notification flags
ipmr: fix mfc notification flags
ip6mr: fix mfc notification flags
Nikolay Aleksandrov (1):
net: fix for a race condition in the inet frag code
Oliver Neukum (1):
usbnet: include wait queue head in device structure
Pablo Neira (1):
netlink: don't compare the nul-termination in nla_strcmp
Paul Durrant (1):
xen-netback: remove pointless clause from if statement
Paul Gortmaker (1):
sparc32: fix build failure for arch_jump_label_transform
Paul Moore (1):
selinux: correctly label /proc inodes in use before the policy is loaded
Peter Boström (1):
vlan: Set correct source MAC address with TX VLAN offload enabled
Sabrina Dubroca (1):
ipv6: don't set DST_NOCOUNT for remotely added routes
Sasha Levin (1):
rds: prevent dereference of a NULL device in rds_iw_laddr_check
Stephen Boyd (1):
cpufreq: Fix timer/workqueue corruption due to double queueing
Thomas Graf (1):
netfilter: Can't fail and free after table replacement
Vlad Yasevich (2):
tg3: Do not include vlan acceleration features in vlan_features
vlan: Set hard_header_len according to available acceleration
YOSHIFUJI Hideaki / 吉藤英明 (1):
isdnloop: Validate NUL-terminated strings from user.
lucien (1):
ipv6: ip6_append_data_mtu do not handle the mtu of the second fragment properly
oftedal (1):
sparc: PCI: Fix incorrect address calculation of PCI Bridge windows on Simba-bridges
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 01/46] Input: cypress_ps2 - don't report as a button pads
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 02/46] netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages Luis Henriques
` (44 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Hans de Goede, Dmitry Torokhov, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <hdegoede@redhat.com>
commit 6797b39e6f6f34c74177736e146406e894b9482b upstream.
The cypress PS/2 trackpad models supported by the cypress_ps2 driver
emulate BTN_RIGHT events in firmware based on the finger position, as part
of this no motion events are sent when the finger is in the button area.
The INPUT_PROP_BUTTONPAD property is there to indicate to userspace that
BTN_RIGHT events should be emulated in userspace, which is not necessary
in this case.
When INPUT_PROP_BUTTONPAD is advertised userspace will wait for a motion
event before propagating the button event higher up the stack, as it needs
current abs x + y data for its BTN_RIGHT emulation. Since in the
cypress_ps2 pads don't report motion events in the button area, this means
that clicks in the button area end up being ignored, so
INPUT_PROP_BUTTONPAD actually causes problems for these touchpads, and
removing it fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=76341
Reported-by: Adam Williamson <awilliam@redhat.com>
Tested-by: Adam Williamson <awilliam@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/input/mouse/cypress_ps2.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index 888a81a..0aaea7a 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -410,7 +410,6 @@ static int cypress_set_input_params(struct input_dev *input,
__clear_bit(REL_X, input->relbit);
__clear_bit(REL_Y, input->relbit);
- __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
__set_bit(EV_KEY, input->evbit);
__set_bit(BTN_LEFT, input->keybit);
__set_bit(BTN_RIGHT, input->keybit);
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 02/46] netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 01/46] Input: cypress_ps2 - don't report as a button pads Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 03/46] cpufreq: Fix timer/workqueue corruption due to double queueing Luis Henriques
` (43 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Daniel Borkmann, Pablo Neira Ayuso, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <dborkman@redhat.com>
commit b22f5126a24b3b2f15448c3f2a254fc10cbc2b92 upstream.
Some occurences in the netfilter tree use skb_header_pointer() in
the following way ...
struct dccp_hdr _dh, *dh;
...
skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
... where dh itself is a pointer that is being passed as the copy
buffer. Instead, we need to use &_dh as the forth argument so that
we're copying the data into an actual buffer that sits on the stack.
Currently, we probably could overwrite memory on the stack (e.g.
with a possibly mal-formed DCCP packet), but unintentionally, as
we only want the buffer to be placed into _dh variable.
Fixes: 2bc780499aa3 ("[NETFILTER]: nf_conntrack: add DCCP protocol support")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/netfilter/nf_conntrack_proto_dccp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c
index a99b6c3..59359be 100644
--- a/net/netfilter/nf_conntrack_proto_dccp.c
+++ b/net/netfilter/nf_conntrack_proto_dccp.c
@@ -428,7 +428,7 @@ static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb,
const char *msg;
u_int8_t state;
- dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
+ dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &_dh);
BUG_ON(dh == NULL);
state = dccp_state_table[CT_DCCP_ROLE_CLIENT][dh->dccph_type][CT_DCCP_NONE];
@@ -486,7 +486,7 @@ static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb,
u_int8_t type, old_state, new_state;
enum ct_dccp_roles role;
- dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
+ dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &_dh);
BUG_ON(dh == NULL);
type = dh->dccph_type;
@@ -577,7 +577,7 @@ static int dccp_error(struct net *net, struct nf_conn *tmpl,
unsigned int cscov;
const char *msg;
- dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
+ dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &_dh);
if (dh == NULL) {
msg = "nf_ct_dccp: short packet ";
goto out_invalid;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 03/46] cpufreq: Fix timer/workqueue corruption due to double queueing
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 01/46] Input: cypress_ps2 - don't report as a button pads Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 02/46] netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 04/46] futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test Luis Henriques
` (42 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Stephen Boyd, Rafael J. Wysocki, Krzysztof Kozlowski, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <sboyd@codeaurora.org>
commit 3617f2ca6d0eba48114308532945a7f1577816a4 upstream.
When a CPU is hot removed we'll cancel all the delayed work items
via gov_cancel_work(). Normally this will just cancels a delayed
timer on each CPU that the policy is managing and the work won't
run, but if the work is already running the workqueue code will
wait for the work to finish before continuing to prevent the
work items from re-queuing themselves like they normally do. This
scheme will work most of the time, except for the case where the
work function determines that it should adjust the delay for all
other CPUs that the policy is managing. If this scenario occurs,
the canceling CPU will cancel its own work but queue up the other
CPUs works to run. For example:
CPU0 CPU1
---- ----
cpu_down()
...
__cpufreq_remove_dev()
cpufreq_governor_dbs()
case CPUFREQ_GOV_STOP:
gov_cancel_work(dbs_data, policy);
cpu0 work is canceled
timer is canceled
cpu1 work is canceled <work runs>
<waits for cpu1> od_dbs_timer()
gov_queue_work(*, *, true);
cpu0 work queued
cpu1 work queued
cpu2 work queued
...
cpu1 work is canceled
cpu2 work is canceled
...
At the end of the GOV_STOP case cpu0 still has a work queued to
run although the code is expecting all of the works to be
canceled. __cpufreq_remove_dev() will then proceed to
re-initialize all the other CPUs works except for the CPU that is
going down. The CPUFREQ_GOV_START case in cpufreq_governor_dbs()
will trample over the queued work and debugobjects will spit out
a warning:
WARNING: at lib/debugobjects.c:260 debug_print_object+0x94/0xbc()
ODEBUG: init active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x10
Modules linked in:
CPU: 0 PID: 1491 Comm: sh Tainted: G W 3.10.0 #19
[<c010c178>] (unwind_backtrace+0x0/0x11c) from [<c0109dec>] (show_stack+0x10/0x14)
[<c0109dec>] (show_stack+0x10/0x14) from [<c01904cc>] (warn_slowpath_common+0x4c/0x6c)
[<c01904cc>] (warn_slowpath_common+0x4c/0x6c) from [<c019056c>] (warn_slowpath_fmt+0x2c/0x3c)
[<c019056c>] (warn_slowpath_fmt+0x2c/0x3c) from [<c0388a7c>] (debug_print_object+0x94/0xbc)
[<c0388a7c>] (debug_print_object+0x94/0xbc) from [<c0388e34>] (__debug_object_init+0x2d0/0x340)
[<c0388e34>] (__debug_object_init+0x2d0/0x340) from [<c019e3b0>] (init_timer_key+0x14/0xb0)
[<c019e3b0>] (init_timer_key+0x14/0xb0) from [<c0635f78>] (cpufreq_governor_dbs+0x3e8/0x5f8)
[<c0635f78>] (cpufreq_governor_dbs+0x3e8/0x5f8) from [<c06325a0>] (__cpufreq_governor+0xdc/0x1a4)
[<c06325a0>] (__cpufreq_governor+0xdc/0x1a4) from [<c0633704>] (__cpufreq_remove_dev.isra.10+0x3b4/0x434)
[<c0633704>] (__cpufreq_remove_dev.isra.10+0x3b4/0x434) from [<c08989f4>] (cpufreq_cpu_callback+0x60/0x80)
[<c08989f4>] (cpufreq_cpu_callback+0x60/0x80) from [<c08a43c0>] (notifier_call_chain+0x38/0x68)
[<c08a43c0>] (notifier_call_chain+0x38/0x68) from [<c01938e0>] (__cpu_notify+0x28/0x40)
[<c01938e0>] (__cpu_notify+0x28/0x40) from [<c0892ad4>] (_cpu_down+0x7c/0x2c0)
[<c0892ad4>] (_cpu_down+0x7c/0x2c0) from [<c0892d3c>] (cpu_down+0x24/0x40)
[<c0892d3c>] (cpu_down+0x24/0x40) from [<c0893ea8>] (store_online+0x2c/0x74)
[<c0893ea8>] (store_online+0x2c/0x74) from [<c04519d8>] (dev_attr_store+0x18/0x24)
[<c04519d8>] (dev_attr_store+0x18/0x24) from [<c02a69d4>] (sysfs_write_file+0x100/0x148)
[<c02a69d4>] (sysfs_write_file+0x100/0x148) from [<c0255c18>] (vfs_write+0xcc/0x174)
[<c0255c18>] (vfs_write+0xcc/0x174) from [<c0255f70>] (SyS_write+0x38/0x64)
[<c0255f70>] (SyS_write+0x38/0x64) from [<c0106120>] (ret_fast_syscall+0x0/0x30)
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/cpufreq/cpufreq_governor.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index e59afaa..38f2da4 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -133,6 +133,9 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy,
{
int i;
+ if (!policy->governor_enabled)
+ return;
+
if (!all_cpus) {
__gov_queue_work(smp_processor_id(), dbs_data, delay);
} else {
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 04/46] futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (2 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 03/46] cpufreq: Fix timer/workqueue corruption due to double queueing Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 05/46] m68k: Skip " Luis Henriques
` (41 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Heiko Carstens, Finn Thain, Geert Uytterhoeven, Thomas Gleixner,
Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <heiko.carstens@de.ibm.com>
commit 03b8c7b623c80af264c4c8d6111e5c6289933666 upstream.
If an architecture has futex_atomic_cmpxchg_inatomic() implemented and there
is no runtime check necessary, allow to skip the test within futex_init().
This allows to get rid of some code which would always give the same result,
and also allows the compiler to optimize a couple of if statements away.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Finn Thain <fthain@telegraphics.com.au>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Link: http://lkml.kernel.org/r/20140302120947.GA3641@osiris
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[ Geert: backported version for v3.10..v3.13 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
arch/s390/Kconfig | 1 +
include/linux/futex.h | 4 ++++
init/Kconfig | 7 +++++++
kernel/futex.c | 14 ++++++++++++--
4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 8a4cae7..f443713 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -116,6 +116,7 @@ config S390
select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_FUNCTION_TRACER
select HAVE_FUNCTION_TRACE_MCOUNT_TEST
+ select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZ4
diff --git a/include/linux/futex.h b/include/linux/futex.h
index b0d95ca..6435f46 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -55,7 +55,11 @@ union futex_key {
#ifdef CONFIG_FUTEX
extern void exit_robust_list(struct task_struct *curr);
extern void exit_pi_state_list(struct task_struct *curr);
+#ifdef CONFIG_HAVE_FUTEX_CMPXCHG
+#define futex_cmpxchg_enabled 1
+#else
extern int futex_cmpxchg_enabled;
+#endif
#else
static inline void exit_robust_list(struct task_struct *curr)
{
diff --git a/init/Kconfig b/init/Kconfig
index fed81b5..390ff19 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1402,6 +1402,13 @@ config FUTEX
support for "fast userspace mutexes". The resulting kernel may not
run glibc-based applications correctly.
+config HAVE_FUTEX_CMPXCHG
+ bool
+ help
+ Architectures should select this if futex_atomic_cmpxchg_inatomic()
+ is implemented and always working. This removes a couple of runtime
+ checks.
+
config EPOLL
bool "Enable eventpoll support" if EXPERT
default y
diff --git a/kernel/futex.c b/kernel/futex.c
index 221a58f..15a7d724 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -68,7 +68,9 @@
#include "rtmutex_common.h"
+#ifndef CONFIG_HAVE_FUTEX_CMPXCHG
int __read_mostly futex_cmpxchg_enabled;
+#endif
#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)
@@ -2730,10 +2732,10 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
}
-static int __init futex_init(void)
+static void __init futex_detect_cmpxchg(void)
{
+#ifndef CONFIG_HAVE_FUTEX_CMPXCHG
u32 curval;
- int i;
/*
* This will fail and we want it. Some arch implementations do
@@ -2747,6 +2749,14 @@ static int __init futex_init(void)
*/
if (cmpxchg_futex_value_locked(&curval, NULL, 0, 0) == -EFAULT)
futex_cmpxchg_enabled = 1;
+#endif
+}
+
+static int __init futex_init(void)
+{
+ int i;
+
+ futex_detect_cmpxchg();
for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
plist_head_init(&futex_queues[i].chain);
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 05/46] m68k: Skip futex_atomic_cmpxchg_inatomic() test
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (3 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 04/46] futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 06/46] powernow-k6: disable cache when changing frequency Luis Henriques
` (40 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Finn Thain, Thomas Gleixner, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <fthain@telegraphics.com.au>
commit e571c58f313d35c56e0018470e3375ddd1fd320e upstream.
Skip the futex_atomic_cmpxchg_inatomic() test in futex_init(). It causes a
fatal exception on 68030 (and presumably 68020 also).
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: http://lkml.kernel.org/r/alpine.LNX.2.00.1403061006440.5525@nippy.intranet
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
arch/m68k/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 821170e..b969eea 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -16,6 +16,7 @@ config M68K
select FPU if MMU
select ARCH_WANT_IPC_PARSE_VERSION
select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
+ select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_REL
select MODULES_USE_ELF_RELA
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 06/46] powernow-k6: disable cache when changing frequency
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (4 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 05/46] m68k: Skip " Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 07/46] powernow-k6: correctly initialize default parameters Luis Henriques
` (39 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Mikulas Patocka, Rafael J. Wysocki, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit e20e1d0ac02308e2211306fc67abcd0b2668fb8b upstream.
I found out that a system with k6-3+ processor is unstable during network
server load. The system locks up or the network card stops receiving. The
reason for the instability is the CPU frequency scaling.
During frequency transition the processor is in "EPM Stop Grant" state.
The documentation says that the processor doesn't respond to inquiry
requests in this state. Consequently, coherency of processor caches and
bus master devices is not maintained, causing the system instability.
This patch flushes the cache during frequency transition. It fixes the
instability.
Other minor changes:
* u64 invalue changed to unsigned long because the variable is 32-bit
* move the logic to set the multiplier to a separate function
powernow_k6_set_cpu_multiplier
* preserve lower 5 bits of the powernow port instead of 4 (the voltage
field has 5 bits)
* mask interrupts when reading the multiplier, so that the port is not
open during other activity (running other kernel code with the port open
shouldn't cause any misbehavior, but we should better be safe and keep
the port closed)
This patch should be backported to all stable kernels. If it doesn't
apply cleanly, change it, or ask me to change it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/cpufreq/powernow-k6.c | 56 ++++++++++++++++++++++++++++++-------------
1 file changed, 39 insertions(+), 17 deletions(-)
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c
index ea8e103..ff3bb8f 100644
--- a/drivers/cpufreq/powernow-k6.c
+++ b/drivers/cpufreq/powernow-k6.c
@@ -44,23 +44,58 @@ static struct cpufreq_frequency_table clock_ratio[] = {
/**
* powernow_k6_get_cpu_multiplier - returns the current FSB multiplier
*
- * Returns the current setting of the frequency multiplier. Core clock
+ * Returns the current setting of the frequency multiplier. Core clock
* speed is frequency of the Front-Side Bus multiplied with this value.
*/
static int powernow_k6_get_cpu_multiplier(void)
{
- u64 invalue = 0;
+ unsigned long invalue = 0;
u32 msrval;
+ local_irq_disable();
+
msrval = POWERNOW_IOPORT + 0x1;
wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */
invalue = inl(POWERNOW_IOPORT + 0x8);
msrval = POWERNOW_IOPORT + 0x0;
wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */
+ local_irq_enable();
+
return clock_ratio[(invalue >> 5)&7].driver_data;
}
+static void powernow_k6_set_cpu_multiplier(unsigned int best_i)
+{
+ unsigned long outvalue, invalue;
+ unsigned long msrval;
+ unsigned long cr0;
+
+ /* we now need to transform best_i to the BVC format, see AMD#23446 */
+
+ /*
+ * The processor doesn't respond to inquiry cycles while changing the
+ * frequency, so we must disable cache.
+ */
+ local_irq_disable();
+ cr0 = read_cr0();
+ write_cr0(cr0 | X86_CR0_CD);
+ wbinvd();
+
+ outvalue = (1<<12) | (1<<10) | (1<<9) | (best_i<<5);
+
+ msrval = POWERNOW_IOPORT + 0x1;
+ wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */
+ invalue = inl(POWERNOW_IOPORT + 0x8);
+ invalue = invalue & 0x1f;
+ outvalue = outvalue | invalue;
+ outl(outvalue, (POWERNOW_IOPORT + 0x8));
+ msrval = POWERNOW_IOPORT + 0x0;
+ wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */
+
+ write_cr0(cr0);
+ local_irq_enable();
+}
/**
* powernow_k6_set_state - set the PowerNow! multiplier
@@ -71,8 +106,6 @@ static int powernow_k6_get_cpu_multiplier(void)
static void powernow_k6_set_state(struct cpufreq_policy *policy,
unsigned int best_i)
{
- unsigned long outvalue = 0, invalue = 0;
- unsigned long msrval;
struct cpufreq_freqs freqs;
if (clock_ratio[best_i].driver_data > max_multiplier) {
@@ -85,18 +118,7 @@ static void powernow_k6_set_state(struct cpufreq_policy *policy,
cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
- /* we now need to transform best_i to the BVC format, see AMD#23446 */
-
- outvalue = (1<<12) | (1<<10) | (1<<9) | (best_i<<5);
-
- msrval = POWERNOW_IOPORT + 0x1;
- wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */
- invalue = inl(POWERNOW_IOPORT + 0x8);
- invalue = invalue & 0xf;
- outvalue = outvalue | invalue;
- outl(outvalue , (POWERNOW_IOPORT + 0x8));
- msrval = POWERNOW_IOPORT + 0x0;
- wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */
+ powernow_k6_set_cpu_multiplier(best_i);
cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
@@ -164,7 +186,7 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
}
/* cpuinfo and default policy values */
- policy->cpuinfo.transition_latency = 200000;
+ policy->cpuinfo.transition_latency = 500000;
policy->cur = busfreq * max_multiplier;
result = cpufreq_frequency_table_cpuinfo(policy, clock_ratio);
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 07/46] powernow-k6: correctly initialize default parameters
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (5 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 06/46] powernow-k6: disable cache when changing frequency Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 08/46] powernow-k6: reorder frequencies Luis Henriques
` (38 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Mikulas Patocka, Rafael J. Wysocki, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit d82b922a4acc1781d368aceac2f9da43b038cab2 upstream.
The powernow-k6 driver used to read the initial multiplier from the
powernow register. However, there is a problem with this:
* If there was a frequency transition before, the multiplier read from the
register corresponds to the current multiplier.
* If there was no frequency transition since reset, the field in the
register always reads as zero, regardless of the current multiplier that
is set using switches on the mainboard and that the CPU is running at.
The zero value corresponds to multiplier 4.5, so as a consequence, the
powernow-k6 driver always assumes multiplier 4.5.
For example, if we have 550MHz CPU with bus frequency 100MHz and
multiplier 5.5, the powernow-k6 driver thinks that the multiplier is 4.5
and bus frequency is 122MHz. The powernow-k6 driver then sets the
multiplier to 4.5, underclocking the CPU to 450MHz, but reports the
current frequency as 550MHz.
There is no reliable way how to read the initial multiplier. I modified
the driver so that it contains a table of known frequencies (based on
parameters of existing CPUs and some common overclocking schemes) and sets
the multiplier according to the frequency. If the frequency is unknown
(because of unusual overclocking or underclocking), the user must supply
the bus speed and maximum multiplier as module parameters.
This patch should be backported to all stable kernels. If it doesn't
apply cleanly, change it, or ask me to change it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/cpufreq/powernow-k6.c | 76 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 72 insertions(+), 4 deletions(-)
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c
index ff3bb8f..656c135 100644
--- a/drivers/cpufreq/powernow-k6.c
+++ b/drivers/cpufreq/powernow-k6.c
@@ -26,6 +26,14 @@
static unsigned int busfreq; /* FSB, in 10 kHz */
static unsigned int max_multiplier;
+static unsigned int param_busfreq = 0;
+static unsigned int param_max_multiplier = 0;
+
+module_param_named(max_multiplier, param_max_multiplier, uint, S_IRUGO);
+MODULE_PARM_DESC(max_multiplier, "Maximum multiplier (allowed values: 20 30 35 40 45 50 55 60)");
+
+module_param_named(bus_frequency, param_busfreq, uint, S_IRUGO);
+MODULE_PARM_DESC(bus_frequency, "Bus frequency in kHz");
/* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */
static struct cpufreq_frequency_table clock_ratio[] = {
@@ -40,6 +48,27 @@ static struct cpufreq_frequency_table clock_ratio[] = {
{0, CPUFREQ_TABLE_END}
};
+static const struct {
+ unsigned freq;
+ unsigned mult;
+} usual_frequency_table[] = {
+ { 400000, 40 }, // 100 * 4
+ { 450000, 45 }, // 100 * 4.5
+ { 475000, 50 }, // 95 * 5
+ { 500000, 50 }, // 100 * 5
+ { 506250, 45 }, // 112.5 * 4.5
+ { 533500, 55 }, // 97 * 5.5
+ { 550000, 55 }, // 100 * 5.5
+ { 562500, 50 }, // 112.5 * 5
+ { 570000, 60 }, // 95 * 6
+ { 600000, 60 }, // 100 * 6
+ { 618750, 55 }, // 112.5 * 5.5
+ { 660000, 55 }, // 120 * 5.5
+ { 675000, 60 }, // 112.5 * 6
+ { 720000, 60 }, // 120 * 6
+};
+
+#define FREQ_RANGE 3000
/**
* powernow_k6_get_cpu_multiplier - returns the current FSB multiplier
@@ -163,18 +192,57 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
return 0;
}
-
static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
{
unsigned int i, f;
int result;
+ unsigned khz;
if (policy->cpu != 0)
return -ENODEV;
- /* get frequencies */
- max_multiplier = powernow_k6_get_cpu_multiplier();
- busfreq = cpu_khz / max_multiplier;
+ max_multiplier = 0;
+ khz = cpu_khz;
+ for (i = 0; i < ARRAY_SIZE(usual_frequency_table); i++) {
+ if (khz >= usual_frequency_table[i].freq - FREQ_RANGE &&
+ khz <= usual_frequency_table[i].freq + FREQ_RANGE) {
+ khz = usual_frequency_table[i].freq;
+ max_multiplier = usual_frequency_table[i].mult;
+ break;
+ }
+ }
+ if (param_max_multiplier) {
+ for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
+ if (clock_ratio[i].driver_data == param_max_multiplier) {
+ max_multiplier = param_max_multiplier;
+ goto have_max_multiplier;
+ }
+ }
+ printk(KERN_ERR "powernow-k6: invalid max_multiplier parameter, valid parameters 20, 30, 35, 40, 45, 50, 55, 60\n");
+ return -EINVAL;
+ }
+
+ if (!max_multiplier) {
+ printk(KERN_WARNING "powernow-k6: unknown frequency %u, cannot determine current multiplier\n", khz);
+ printk(KERN_WARNING "powernow-k6: use module parameters max_multiplier and bus_frequency\n");
+ return -EOPNOTSUPP;
+ }
+
+have_max_multiplier:
+ param_max_multiplier = max_multiplier;
+
+ if (param_busfreq) {
+ if (param_busfreq >= 50000 && param_busfreq <= 150000) {
+ busfreq = param_busfreq / 10;
+ goto have_busfreq;
+ }
+ printk(KERN_ERR "powernow-k6: invalid bus_frequency parameter, allowed range 50000 - 150000 kHz\n");
+ return -EINVAL;
+ }
+
+ busfreq = khz / max_multiplier;
+have_busfreq:
+ param_busfreq = busfreq * 10;
/* table init */
for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 08/46] powernow-k6: reorder frequencies
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (6 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 07/46] powernow-k6: correctly initialize default parameters Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 09/46] selinux: correctly label /proc inodes in use before the policy is loaded Luis Henriques
` (37 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Mikulas Patocka, Rafael J. Wysocki, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit 22c73795b101597051924556dce019385a1e2fa0 upstream.
This patch reorders reported frequencies from the highest to the lowest,
just like in other frequency drivers.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/cpufreq/powernow-k6.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c
index 656c135..396f357 100644
--- a/drivers/cpufreq/powernow-k6.c
+++ b/drivers/cpufreq/powernow-k6.c
@@ -37,17 +37,20 @@ MODULE_PARM_DESC(bus_frequency, "Bus frequency in kHz");
/* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */
static struct cpufreq_frequency_table clock_ratio[] = {
- {45, /* 000 -> 4.5x */ 0},
+ {60, /* 110 -> 6.0x */ 0},
+ {55, /* 011 -> 5.5x */ 0},
{50, /* 001 -> 5.0x */ 0},
+ {45, /* 000 -> 4.5x */ 0},
{40, /* 010 -> 4.0x */ 0},
- {55, /* 011 -> 5.5x */ 0},
- {20, /* 100 -> 2.0x */ 0},
- {30, /* 101 -> 3.0x */ 0},
- {60, /* 110 -> 6.0x */ 0},
{35, /* 111 -> 3.5x */ 0},
+ {30, /* 101 -> 3.0x */ 0},
+ {20, /* 100 -> 2.0x */ 0},
{0, CPUFREQ_TABLE_END}
};
+static const u8 index_to_register[8] = { 6, 3, 1, 0, 2, 7, 5, 4 };
+static const u8 register_to_index[8] = { 3, 2, 4, 1, 7, 6, 0, 5 };
+
static const struct {
unsigned freq;
unsigned mult;
@@ -91,7 +94,7 @@ static int powernow_k6_get_cpu_multiplier(void)
local_irq_enable();
- return clock_ratio[(invalue >> 5)&7].driver_data;
+ return clock_ratio[register_to_index[(invalue >> 5)&7]].driver_data;
}
static void powernow_k6_set_cpu_multiplier(unsigned int best_i)
@@ -111,7 +114,7 @@ static void powernow_k6_set_cpu_multiplier(unsigned int best_i)
write_cr0(cr0 | X86_CR0_CD);
wbinvd();
- outvalue = (1<<12) | (1<<10) | (1<<9) | (best_i<<5);
+ outvalue = (1<<12) | (1<<10) | (1<<9) | (index_to_register[best_i]<<5);
msrval = POWERNOW_IOPORT + 0x1;
wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 09/46] selinux: correctly label /proc inodes in use before the policy is loaded
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (7 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 08/46] powernow-k6: reorder frequencies Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 10/46] net: fix for a race condition in the inet frag code Luis Henriques
` (36 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team; +Cc: Eric Paris, Paul Moore, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <pmoore@redhat.com>
commit f64410ec665479d7b4b77b7519e814253ed0f686 upstream.
This patch is based on an earlier patch by Eric Paris, he describes
the problem below:
"If an inode is accessed before policy load it will get placed on a
list of inodes to be initialized after policy load. After policy
load we call inode_doinit() which calls inode_doinit_with_dentry()
on all inodes accessed before policy load. In the case of inodes
in procfs that means we'll end up at the bottom where it does:
/* Default to the fs superblock SID. */
isec->sid = sbsec->sid;
if ((sbsec->flags & SE_SBPROC) && !S_ISLNK(inode->i_mode)) {
if (opt_dentry) {
isec->sclass = inode_mode_to_security_class(...)
rc = selinux_proc_get_sid(opt_dentry,
isec->sclass,
&sid);
if (rc)
goto out_unlock;
isec->sid = sid;
}
}
Since opt_dentry is null, we'll never call selinux_proc_get_sid()
and will leave the inode labeled with the label on the superblock.
I believe a fix would be to mimic the behavior of xattrs. Look
for an alias of the inode. If it can't be found, just leave the
inode uninitialized (and pick it up later) if it can be found, we
should be able to call selinux_proc_get_sid() ..."
On a system exhibiting this problem, you will notice a lot of files in
/proc with the generic "proc_t" type (at least the ones that were
accessed early in the boot), for example:
# ls -Z /proc/sys/kernel/shmmax | awk '{ print $4 " " $5 }'
system_u:object_r:proc_t:s0 /proc/sys/kernel/shmmax
However, with this patch in place we see the expected result:
# ls -Z /proc/sys/kernel/shmmax | awk '{ print $4 " " $5 }'
system_u:object_r:sysctl_kernel_t:s0 /proc/sys/kernel/shmmax
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Acked-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
security/selinux/hooks.c | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index bf64893..021765e 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1386,15 +1386,33 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
isec->sid = sbsec->sid;
if ((sbsec->flags & SE_SBPROC) && !S_ISLNK(inode->i_mode)) {
- if (opt_dentry) {
- isec->sclass = inode_mode_to_security_class(inode->i_mode);
- rc = selinux_proc_get_sid(opt_dentry,
- isec->sclass,
- &sid);
- if (rc)
- goto out_unlock;
- isec->sid = sid;
- }
+ /* We must have a dentry to determine the label on
+ * procfs inodes */
+ if (opt_dentry)
+ /* Called from d_instantiate or
+ * d_splice_alias. */
+ dentry = dget(opt_dentry);
+ else
+ /* Called from selinux_complete_init, try to
+ * find a dentry. */
+ dentry = d_find_alias(inode);
+ /*
+ * This can be hit on boot when a file is accessed
+ * before the policy is loaded. When we load policy we
+ * may find inodes that have no dentry on the
+ * sbsec->isec_head list. No reason to complain as
+ * these will get fixed up the next time we go through
+ * inode_doinit() with a dentry, before these inodes
+ * could be used again by userspace.
+ */
+ if (!dentry)
+ goto out_unlock;
+ isec->sclass = inode_mode_to_security_class(inode->i_mode);
+ rc = selinux_proc_get_sid(dentry, isec->sclass, &sid);
+ dput(dentry);
+ if (rc)
+ goto out_unlock;
+ isec->sid = sid;
}
break;
}
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 10/46] net: fix for a race condition in the inet frag code
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (8 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 09/46] selinux: correctly label /proc inodes in use before the policy is loaded Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 11/46] net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk Luis Henriques
` (35 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Florian Westphal, Jesper Dangaard Brouer, David S. Miller,
Nikolay Aleksandrov, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <nikolay@redhat.com>
commit 24b9bf43e93e0edd89072da51cf1fab95fc69dec upstream.
I stumbled upon this very serious bug while hunting for another one,
it's a very subtle race condition between inet_frag_evictor,
inet_frag_intern and the IPv4/6 frag_queue and expire functions
(basically the users of inet_frag_kill/inet_frag_put).
What happens is that after a fragment has been added to the hash chain
but before it's been added to the lru_list (inet_frag_lru_add) in
inet_frag_intern, it may get deleted (either by an expired timer if
the system load is high or the timer sufficiently low, or by the
fraq_queue function for different reasons) before it's added to the
lru_list, then after it gets added it's a matter of time for the
evictor to get to a piece of memory which has been freed leading to a
number of different bugs depending on what's left there.
I've been able to trigger this on both IPv4 and IPv6 (which is normal
as the frag code is the same), but it's been much more difficult to
trigger on IPv4 due to the protocol differences about how fragments
are treated.
The setup I used to reproduce this is: 2 machines with 4 x 10G bonded
in a RR bond, so the same flow can be seen on multiple cards at the
same time. Then I used multiple instances of ping/ping6 to generate
fragmented packets and flood the machines with them while running
other processes to load the attacked machine.
*It is very important to have the _same flow_ coming in on multiple CPUs
concurrently. Usually the attacked machine would die in less than 30
minutes, if configured properly to have many evictor calls and timeouts
it could happen in 10 minutes or so.
An important point to make is that any caller (frag_queue or timer) of
inet_frag_kill will remove both the timer refcount and the
original/guarding refcount thus removing everything that's keeping the
frag from being freed at the next inet_frag_put. All of this could
happen before the frag was ever added to the LRU list, then it gets
added and the evictor uses a freed fragment.
An example for IPv6 would be if a fragment is being added and is at
the stage of being inserted in the hash after the hash lock is
released, but before inet_frag_lru_add executes (or is able to obtain
the lru lock) another overlapping fragment for the same flow arrives
at a different CPU which finds it in the hash, but since it's
overlapping it drops it invoking inet_frag_kill and thus removing all
guarding refcounts, and afterwards freeing it by invoking
inet_frag_put which removes the last refcount added previously by
inet_frag_find, then inet_frag_lru_add gets executed by
inet_frag_intern and we have a freed fragment in the lru_list.
The fix is simple, just move the lru_add under the hash chain locked
region so when a removing function is called it'll have to wait for
the fragment to be added to the lru_list, and then it'll remove it (it
works because the hash chain removal is done before the lru_list one
and there's no window between the two list adds when the frag can get
dropped). With this fix applied I couldn't kill the same machine in 24
hours with the same setup.
Fixes: 3ef0eb0db4bf ("net: frag, move LRU list maintenance outside of
rwlock")
CC: Florian Westphal <fw@strlen.de>
CC: Jesper Dangaard Brouer <brouer@redhat.com>
CC: David S. Miller <davem@davemloft.net>
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv4/inet_fragment.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index c5313a9..e15fb7b 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -281,9 +281,10 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
atomic_inc(&qp->refcnt);
hlist_add_head(&qp->list, &hb->chain);
+ inet_frag_lru_add(nf, qp);
spin_unlock(&hb->chain_lock);
read_unlock(&f->lock);
- inet_frag_lru_add(nf, qp);
+
return qp;
}
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 11/46] net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (9 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 10/46] net: fix for a race condition in the inet frag code Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 12/46] bridge: multicast: add sanity check for query source addresses Luis Henriques
` (34 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Daniel Borkmann, Vlad Yasevich, Neil Horman, David S. Miller,
Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <dborkman@redhat.com>
commit c485658bae87faccd7aed540fd2ca3ab37992310 upstream.
While working on ec0223ec48a9 ("net: sctp: fix sctp_sf_do_5_1D_ce to
verify if we/peer is AUTH capable"), we noticed that there's a skb
memory leakage in the error path.
Running the same reproducer as in ec0223ec48a9 and by unconditionally
jumping to the error label (to simulate an error condition) in
sctp_sf_do_5_1D_ce() receive path lets kmemleak detector bark about
the unfreed chunk->auth_chunk skb clone:
Unreferenced object 0xffff8800b8f3a000 (size 256):
comm "softirq", pid 0, jiffies 4294769856 (age 110.757s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
89 ab 75 5e d4 01 58 13 00 00 00 00 00 00 00 00 ..u^..X.........
backtrace:
[<ffffffff816660be>] kmemleak_alloc+0x4e/0xb0
[<ffffffff8119f328>] kmem_cache_alloc+0xc8/0x210
[<ffffffff81566929>] skb_clone+0x49/0xb0
[<ffffffffa0467459>] sctp_endpoint_bh_rcv+0x1d9/0x230 [sctp]
[<ffffffffa046fdbc>] sctp_inq_push+0x4c/0x70 [sctp]
[<ffffffffa047e8de>] sctp_rcv+0x82e/0x9a0 [sctp]
[<ffffffff815abd38>] ip_local_deliver_finish+0xa8/0x210
[<ffffffff815a64af>] nf_reinject+0xbf/0x180
[<ffffffffa04b4762>] nfqnl_recv_verdict+0x1d2/0x2b0 [nfnetlink_queue]
[<ffffffffa04aa40b>] nfnetlink_rcv_msg+0x14b/0x250 [nfnetlink]
[<ffffffff815a3269>] netlink_rcv_skb+0xa9/0xc0
[<ffffffffa04aa7cf>] nfnetlink_rcv+0x23f/0x408 [nfnetlink]
[<ffffffff815a2bd8>] netlink_unicast+0x168/0x250
[<ffffffff815a2fa1>] netlink_sendmsg+0x2e1/0x3f0
[<ffffffff8155cc6b>] sock_sendmsg+0x8b/0xc0
[<ffffffff8155d449>] ___sys_sendmsg+0x369/0x380
What happens is that commit bbd0d59809f9 clones the skb containing
the AUTH chunk in sctp_endpoint_bh_rcv() when having the edge case
that an endpoint requires COOKIE-ECHO chunks to be authenticated:
---------- INIT[RANDOM; CHUNKS; HMAC-ALGO] ---------->
<------- INIT-ACK[RANDOM; CHUNKS; HMAC-ALGO] ---------
------------------ AUTH; COOKIE-ECHO ---------------->
<-------------------- COOKIE-ACK ---------------------
When we enter sctp_sf_do_5_1D_ce() and before we actually get to
the point where we process (and subsequently free) a non-NULL
chunk->auth_chunk, we could hit the "goto nomem_init" path from
an error condition and thus leave the cloned skb around w/o
freeing it.
The fix is to centrally free such clones in sctp_chunk_destroy()
handler that is invoked from sctp_chunk_free() after all refs have
dropped; and also move both kfree_skb(chunk->auth_chunk) there,
so that chunk->auth_chunk is either NULL (since sctp_chunkify()
allocs new chunks through kmem_cache_zalloc()) or non-NULL with
a valid skb pointer. chunk->skb and chunk->auth_chunk are the
only skbs in the sctp_chunk structure that need to be handeled.
While at it, we should use consume_skb() for both. It is the same
as dev_kfree_skb() but more appropriately named as we are not
a device but a protocol. Also, this effectively replaces the
kfree_skb() from both invocations into consume_skb(). Functions
are the same only that kfree_skb() assumes that the frame was
being dropped after a failure (e.g. for tools like drop monitor),
usage of consume_skb() seems more appropriate in function
sctp_chunk_destroy() though.
Fixes: bbd0d59809f9 ("[SCTP]: Implement the receive and verification of AUTH chunk")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Vlad Yasevich <yasevich@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/sctp/sm_make_chunk.c | 4 ++--
net/sctp/sm_statefuns.c | 5 -----
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 362ae6e..da85571 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1400,8 +1400,8 @@ static void sctp_chunk_destroy(struct sctp_chunk *chunk)
BUG_ON(!list_empty(&chunk->list));
list_del_init(&chunk->transmitted_list);
- /* Free the chunk skb data and the SCTP_chunk stub itself. */
- dev_kfree_skb(chunk->skb);
+ consume_skb(chunk->skb);
+ consume_skb(chunk->auth_chunk);
SCTP_DBG_OBJCNT_DEC(chunk);
kmem_cache_free(sctp_chunk_cachep, chunk);
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 7f59623..261c730 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -767,7 +767,6 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net,
/* Make sure that we and the peer are AUTH capable */
if (!net->sctp.auth_enable || !new_asoc->peer.auth_capable) {
- kfree_skb(chunk->auth_chunk);
sctp_association_free(new_asoc);
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
}
@@ -782,10 +781,6 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net,
auth.transport = chunk->transport;
ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth);
-
- /* We can now safely free the auth_chunk clone */
- kfree_skb(chunk->auth_chunk);
-
if (ret != SCTP_IERROR_NO_ERROR) {
sctp_association_free(new_asoc);
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 12/46] bridge: multicast: add sanity check for query source addresses
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (10 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 11/46] net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 13/46] inet: frag: make sure forced eviction removes all frags Luis Henriques
` (33 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Linus Lüssing, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@web.de>
commit 6565b9eeef194afbb3beec80d6dd2447f4091f8c upstream.
MLD queries are supposed to have an IPv6 link-local source address
according to RFC2710, section 4 and RFC3810, section 5.1.14. This patch
adds a sanity check to ignore such broken MLD queries.
Without this check, such malformed MLD queries can result in a
denial of service: The queries are ignored by any MLD listener
therefore they will not respond with an MLD report. However,
without this patch these malformed MLD queries would enable the
snooping part in the bridge code, potentially shutting down the
according ports towards these hosts for multicast traffic as the
bridge did not learn about these listeners.
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/bridge/br_multicast.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index b02fb47..29ff042 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1237,6 +1237,12 @@ static int br_ip6_multicast_query(struct net_bridge *br,
(port && port->state == BR_STATE_DISABLED))
goto out;
+ /* RFC2710+RFC3810 (MLDv1+MLDv2) require link-local source addresses */
+ if (!(ipv6_addr_type(&ip6h->saddr) & IPV6_ADDR_LINKLOCAL)) {
+ err = -EINVAL;
+ goto out;
+ }
+
if (skb->len == sizeof(*mld)) {
if (!pskb_may_pull(skb, sizeof(*mld))) {
err = -EINVAL;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 13/46] inet: frag: make sure forced eviction removes all frags
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (11 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 12/46] bridge: multicast: add sanity check for query source addresses Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 14/46] net: unix: non blocking recvmsg() should not return -EINTR Luis Henriques
` (32 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Florian Westphal, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <fw@strlen.de>
commit e588e2f286ed7da011ed357c24c5b9a554e26595 upstream.
Quoting Alexander Aring:
While fragmentation and unloading of 6lowpan module I got this kernel Oops
after few seconds:
BUG: unable to handle kernel paging request at f88bbc30
[..]
Modules linked in: ipv6 [last unloaded: 6lowpan]
Call Trace:
[<c012af4c>] ? call_timer_fn+0x54/0xb3
[<c012aef8>] ? process_timeout+0xa/0xa
[<c012b66b>] run_timer_softirq+0x140/0x15f
Problem is that incomplete frags are still around after unload; when
their frag expire timer fires, we get crash.
When a netns is removed (also done when unloading module), inet_frag
calls the evictor with 'force' argument to purge remaining frags.
The evictor loop terminates when accounted memory ('work') drops to 0
or the lru-list becomes empty. However, the mem accounting is done
via percpu counters and may not be accurate, i.e. loop may terminate
prematurely.
Alter evictor to only stop once the lru list is empty when force is
requested.
Reported-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Reported-by: Alexander Aring <alex.aring@gmail.com>
Tested-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv4/inet_fragment.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index e15fb7b..12b80fb 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -211,7 +211,7 @@ int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f, bool force)
}
work = frag_mem_limit(nf) - nf->low_thresh;
- while (work > 0) {
+ while (work > 0 || force) {
spin_lock(&nf->lru_lock);
if (list_empty(&nf->lru_list)) {
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 14/46] net: unix: non blocking recvmsg() should not return -EINTR
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (12 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 13/46] inet: frag: make sure forced eviction removes all frags Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 15/46] ipv6: Fix exthdrs offload registration Luis Henriques
` (31 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Eric Dumazet, Rainer Weikusat, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
commit de1443916791d75fdd26becb116898277bb0273f upstream.
Some applications didn't expect recvmsg() on a non blocking socket
could return -EINTR. This possibility was added as a side effect
of commit b3ca9b02b00704 ("net: fix multithreaded signal handling in
unix recv routines").
To hit this bug, you need to be a bit unlucky, as the u->readlock
mutex is usually held for very small periods.
Fixes: b3ca9b02b00704 ("net: fix multithreaded signal handling in unix recv routines")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/unix/af_unix.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 2ea3310..c80c107 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1793,8 +1793,11 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
goto out;
err = mutex_lock_interruptible(&u->readlock);
- if (err) {
- err = sock_intr_errno(sock_rcvtimeo(sk, noblock));
+ if (unlikely(err)) {
+ /* recvmsg() in non blocking mode is supposed to return -EAGAIN
+ * sk_rcvtimeo is not honored by mutex_lock_interruptible()
+ */
+ err = noblock ? -EAGAIN : -ERESTARTSYS;
goto out;
}
@@ -1914,6 +1917,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
struct unix_sock *u = unix_sk(sk);
struct sockaddr_un *sunaddr = msg->msg_name;
int copied = 0;
+ int noblock = flags & MSG_DONTWAIT;
int check_creds = 0;
int target;
int err = 0;
@@ -1929,7 +1933,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
goto out;
target = sock_rcvlowat(sk, flags&MSG_WAITALL, size);
- timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT);
+ timeo = sock_rcvtimeo(sk, noblock);
/* Lock the socket to prevent queue disordering
* while sleeps in memcpy_tomsg
@@ -1941,8 +1945,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
}
err = mutex_lock_interruptible(&u->readlock);
- if (err) {
- err = sock_intr_errno(timeo);
+ if (unlikely(err)) {
+ /* recvmsg() in non blocking mode is supposed to return -EAGAIN
+ * sk_rcvtimeo is not honored by mutex_lock_interruptible()
+ */
+ err = noblock ? -EAGAIN : -ERESTARTSYS;
goto out;
}
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 15/46] ipv6: Fix exthdrs offload registration.
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (13 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 14/46] net: unix: non blocking recvmsg() should not return -EINTR Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 16/46] ipv6: don't set DST_NOCOUNT for remotely added routes Luis Henriques
` (30 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Anton Nayshtut, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Nayshtut <anton@swortex.com>
commit d2d273ffabd315eecefce21a4391d44b6e156b73 upstream.
Without this fix, ipv6_exthdrs_offload_init doesn't register IPPROTO_DSTOPTS
offload, but returns 0 (as the IPPROTO_ROUTING registration actually succeeds).
This then causes the ipv6_gso_segment to drop IPv6 packets with IPPROTO_DSTOPTS
header.
The issue detected and the fix verified by running MS HCK Offload LSO test on
top of QEMU Windows guests, as this test sends IPv6 packets with
IPPROTO_DSTOPTS.
Signed-off-by: Anton Nayshtut <anton@swortex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv6/exthdrs_offload.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/exthdrs_offload.c b/net/ipv6/exthdrs_offload.c
index cf77f3a..447a7fb 100644
--- a/net/ipv6/exthdrs_offload.c
+++ b/net/ipv6/exthdrs_offload.c
@@ -25,11 +25,11 @@ int __init ipv6_exthdrs_offload_init(void)
int ret;
ret = inet6_add_offload(&rthdr_offload, IPPROTO_ROUTING);
- if (!ret)
+ if (ret)
goto out;
ret = inet6_add_offload(&dstopt_offload, IPPROTO_DSTOPTS);
- if (!ret)
+ if (ret)
goto out_rt;
out:
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 16/46] ipv6: don't set DST_NOCOUNT for remotely added routes
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (14 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 15/46] ipv6: Fix exthdrs offload registration Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 17/46] vlan: Set correct source MAC address with TX VLAN offload enabled Luis Henriques
` (29 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Sabrina Dubroca, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <sd@queasysnail.net>
commit c88507fbad8055297c1d1e21e599f46960cbee39 upstream.
DST_NOCOUNT should only be used if an authorized user adds routes
locally. In case of routes which are added on behalf of router
advertisments this flag must not get used as it allows an unlimited
number of routes getting added remotely.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv6/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 2a0f219..bf7a99f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1451,7 +1451,7 @@ int ip6_route_add(struct fib6_config *cfg)
if (!table)
goto out;
- rt = ip6_dst_alloc(net, NULL, DST_NOCOUNT, table);
+ rt = ip6_dst_alloc(net, NULL, (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT, table);
if (!rt) {
err = -ENOMEM;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 17/46] vlan: Set correct source MAC address with TX VLAN offload enabled
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (15 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 16/46] ipv6: don't set DST_NOCOUNT for remotely added routes Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 18/46] tcp: tcp_release_cb() should release socket ownership Luis Henriques
` (28 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Peter Boström, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= <peter.bostrom@netrounds.com>
commit dd38743b4cc2f86be250eaf156cf113ba3dd531a upstream.
With TX VLAN offload enabled the source MAC address for frames sent using the
VLAN interface is currently set to the address of the real interface. This is
wrong since the VLAN interface may be configured with a different address.
The bug was introduced in commit 2205369a314e12fcec4781cc73ac9c08fc2b47de
("vlan: Fix header ops passthru when doing TX VLAN offload.").
This patch sets the source address before calling the create function of the
real interface.
Signed-off-by: Peter Boström <peter.bostrom@netrounds.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/8021q/vlan_dev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4af64af..48db858 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -557,6 +557,9 @@ static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev
struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
struct net_device *real_dev = vlan->real_dev;
+ if (saddr == NULL)
+ saddr = dev->dev_addr;
+
return dev_hard_header(skb, real_dev, type, daddr, saddr, len);
}
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 18/46] tcp: tcp_release_cb() should release socket ownership
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (16 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 17/46] vlan: Set correct source MAC address with TX VLAN offload enabled Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 19/46] net: socket: error on a negative msg_namelen Luis Henriques
` (27 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Eric Dumazet, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <eric.dumazet@gmail.com>
commit c3f9b01849ef3bc69024990092b9f42e20df7797 upstream.
Lars Persson reported following deadlock :
-000 |M:0x0:0x802B6AF8(asm) <-- arch_spin_lock
-001 |tcp_v4_rcv(skb = 0x8BD527A0) <-- sk = 0x8BE6B2A0
-002 |ip_local_deliver_finish(skb = 0x8BD527A0)
-003 |__netif_receive_skb_core(skb = 0x8BD527A0, ?)
-004 |netif_receive_skb(skb = 0x8BD527A0)
-005 |elk_poll(napi = 0x8C770500, budget = 64)
-006 |net_rx_action(?)
-007 |__do_softirq()
-008 |do_softirq()
-009 |local_bh_enable()
-010 |tcp_rcv_established(sk = 0x8BE6B2A0, skb = 0x87D3A9E0, th = 0x814EBE14, ?)
-011 |tcp_v4_do_rcv(sk = 0x8BE6B2A0, skb = 0x87D3A9E0)
-012 |tcp_delack_timer_handler(sk = 0x8BE6B2A0)
-013 |tcp_release_cb(sk = 0x8BE6B2A0)
-014 |release_sock(sk = 0x8BE6B2A0)
-015 |tcp_sendmsg(?, sk = 0x8BE6B2A0, ?, ?)
-016 |sock_sendmsg(sock = 0x8518C4C0, msg = 0x87D8DAA8, size = 4096)
-017 |kernel_sendmsg(?, ?, ?, ?, size = 4096)
-018 |smb_send_kvec()
-019 |smb_send_rqst(server = 0x87C4D400, rqst = 0x87D8DBA0)
-020 |cifs_call_async()
-021 |cifs_async_writev(wdata = 0x87FD6580)
-022 |cifs_writepages(mapping = 0x852096E4, wbc = 0x87D8DC88)
-023 |__writeback_single_inode(inode = 0x852095D0, wbc = 0x87D8DC88)
-024 |writeback_sb_inodes(sb = 0x87D6D800, wb = 0x87E4A9C0, work = 0x87D8DD88)
-025 |__writeback_inodes_wb(wb = 0x87E4A9C0, work = 0x87D8DD88)
-026 |wb_writeback(wb = 0x87E4A9C0, work = 0x87D8DD88)
-027 |wb_do_writeback(wb = 0x87E4A9C0, force_wait = 0)
-028 |bdi_writeback_workfn(work = 0x87E4A9CC)
-029 |process_one_work(worker = 0x8B045880, work = 0x87E4A9CC)
-030 |worker_thread(__worker = 0x8B045880)
-031 |kthread(_create = 0x87CADD90)
-032 |ret_from_kernel_thread(asm)
Bug occurs because __tcp_checksum_complete_user() enables BH, assuming
it is running from softirq context.
Lars trace involved a NIC without RX checksum support but other points
are problematic as well, like the prequeue stuff.
Problem is triggered by a timer, that found socket being owned by user.
tcp_release_cb() should call tcp_write_timer_handler() or
tcp_delack_timer_handler() in the appropriate context :
BH disabled and socket lock held, but 'owned' field cleared,
as if they were running from timer handlers.
Fixes: 6f458dfb4092 ("tcp: improve latencies of timer triggered events")
Reported-by: Lars Persson <lars.persson@axis.com>
Tested-by: Lars Persson <lars.persson@axis.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
include/net/sock.h | 5 +++++
net/core/sock.c | 5 ++++-
net/ipv4/tcp_output.c | 11 +++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 04e148f..643f92e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1443,6 +1443,11 @@ static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
*/
#define sock_owned_by_user(sk) ((sk)->sk_lock.owned)
+static inline void sock_release_ownership(struct sock *sk)
+{
+ sk->sk_lock.owned = 0;
+}
+
/*
* Macro so as to not evaluate some arguments when
* lockdep is not enabled.
diff --git a/net/core/sock.c b/net/core/sock.c
index 2d92ff8..0e2b67e 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2335,10 +2335,13 @@ void release_sock(struct sock *sk)
if (sk->sk_backlog.tail)
__release_sock(sk);
+ /* Warning : release_cb() might need to release sk ownership,
+ * ie call sock_release_ownership(sk) before us.
+ */
if (sk->sk_prot->release_cb)
sk->sk_prot->release_cb(sk);
- sk->sk_lock.owned = 0;
+ sock_release_ownership(sk);
if (waitqueue_active(&sk->sk_lock.wq))
wake_up(&sk->sk_lock.wq);
spin_unlock_bh(&sk->sk_lock.slock);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 24b88d5..acc001e 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -760,6 +760,17 @@ void tcp_release_cb(struct sock *sk)
if (flags & (1UL << TCP_TSQ_DEFERRED))
tcp_tsq_handler(sk);
+ /* Here begins the tricky part :
+ * We are called from release_sock() with :
+ * 1) BH disabled
+ * 2) sk_lock.slock spinlock held
+ * 3) socket owned by us (sk->sk_lock.owned == 1)
+ *
+ * But following code is meant to be called from BH handlers,
+ * so we should keep BH disabled, but early release socket ownership
+ */
+ sock_release_ownership(sk);
+
if (flags & (1UL << TCP_WRITE_TIMER_DEFERRED)) {
tcp_write_timer_handler(sk);
__sock_put(sk);
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 19/46] net: socket: error on a negative msg_namelen
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (17 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 18/46] tcp: tcp_release_cb() should release socket ownership Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 20/46] ipv6: Avoid unnecessary temporary addresses being generated Luis Henriques
` (26 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Matthew Leach, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Leach <matthew.leach@arm.com>
commit dbb490b96584d4e958533fb637f08b557f505657 upstream.
When copying in a struct msghdr from the user, if the user has set the
msg_namelen parameter to a negative value it gets clamped to a valid
size due to a comparison between signed and unsigned values.
Ensure the syscall errors when the user passes in a negative value.
Signed-off-by: Matthew Leach <matthew.leach@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/socket.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/socket.c b/net/socket.c
index 03d5324..6bfb9e4 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1981,6 +1981,10 @@ static int copy_msghdr_from_user(struct msghdr *kmsg,
{
if (copy_from_user(kmsg, umsg, sizeof(struct msghdr)))
return -EFAULT;
+
+ if (kmsg->msg_namelen < 0)
+ return -EINVAL;
+
if (kmsg->msg_namelen > sizeof(struct sockaddr_storage))
kmsg->msg_namelen = sizeof(struct sockaddr_storage);
return 0;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 20/46] ipv6: Avoid unnecessary temporary addresses being generated
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (18 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 19/46] net: socket: error on a negative msg_namelen Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 21/46] ipv6: ip6_append_data_mtu do not handle the mtu of the second fragment properly Luis Henriques
` (25 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Heiner Kallweit, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <heiner.kallweit@web.de>
commit ecab67015ef6e3f3635551dcc9971cf363cc1cd5 upstream.
tmp_prefered_lft is an offset to ifp->tstamp, not now. Therefore
age needs to be added to the condition.
Age calculation in ipv6_create_tempaddr is different from the one
in addrconf_verify and doesn't consider ADDRCONF_TIMER_FUZZ_MINUS.
This can cause age in ipv6_create_tempaddr to be less than the one
in addrconf_verify and therefore unnecessary temporary address to
be generated.
Use age calculation as in addrconf_modify to avoid this.
Signed-off-by: Heiner Kallweit <heiner.kallweit@web.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv6/addrconf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0f99f7b..a6ddced 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1113,8 +1113,11 @@ retry:
* Lifetime is greater than REGEN_ADVANCE time units. In particular,
* an implementation must not create a temporary address with a zero
* Preferred Lifetime.
+ * Use age calculation as in addrconf_verify to avoid unnecessary
+ * temporary addresses being generated.
*/
- if (tmp_prefered_lft <= regen_advance) {
+ age = (now - tmp_tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ;
+ if (tmp_prefered_lft <= regen_advance + age) {
in6_ifa_put(ifp);
in6_dev_put(idev);
ret = -1;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 21/46] ipv6: ip6_append_data_mtu do not handle the mtu of the second fragment properly
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (19 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 20/46] ipv6: Avoid unnecessary temporary addresses being generated Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 22/46] vxlan: fix potential NULL dereference in arp_reduce() Luis Henriques
` (24 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Xin Long, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: lucien <lucien.xin@gmail.com>
commit e367c2d03dba4c9bcafad24688fadb79dd95b218 upstream.
In ip6_append_data_mtu(), when the xfrm mode is not tunnel(such as
transport),the ipsec header need to be added in the first fragment, so the mtu
will decrease to reserve space for it, then the second fragment come, the mtu
should be turn back, as the commit 0c1833797a5a6ec23ea9261d979aa18078720b74
said. however, in the commit a493e60ac4bbe2e977e7129d6d8cbb0dd236be, it use
*mtu = min(*mtu, ...) to change the mtu, which lead to the new mtu is alway
equal with the first fragment's. and cannot turn back.
when I test through ping6 -c1 -s5000 $ip (mtu=1280):
...frag (0|1232) ESP(spi=0x00002000,seq=0xb), length 1232
...frag (1232|1216)
...frag (2448|1216)
...frag (3664|1216)
...frag (4880|164)
which should be:
...frag (0|1232) ESP(spi=0x00001000,seq=0x1), length 1232
...frag (1232|1232)
...frag (2464|1232)
...frag (3696|1232)
...frag (4928|116)
so delete the min() when change back the mtu.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Fixes: 75a493e60ac4bb ("ipv6: ip6_append_data_mtu did not care about pmtudisc and frag_size")
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv6/ip6_output.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 554eb0d..b878dd6 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1110,21 +1110,19 @@ static void ip6_append_data_mtu(unsigned int *mtu,
unsigned int fragheaderlen,
struct sk_buff *skb,
struct rt6_info *rt,
- bool pmtuprobe)
+ unsigned int orig_mtu)
{
if (!(rt->dst.flags & DST_XFRM_TUNNEL)) {
if (skb == NULL) {
/* first fragment, reserve header_len */
- *mtu = *mtu - rt->dst.header_len;
+ *mtu = orig_mtu - rt->dst.header_len;
} else {
/*
* this fragment is not first, the headers
* space is regarded as data space.
*/
- *mtu = min(*mtu, pmtuprobe ?
- rt->dst.dev->mtu :
- dst_mtu(rt->dst.path));
+ *mtu = orig_mtu;
}
*maxfraglen = ((*mtu - fragheaderlen) & ~7)
+ fragheaderlen - sizeof(struct frag_hdr);
@@ -1141,7 +1139,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
struct ipv6_pinfo *np = inet6_sk(sk);
struct inet_cork *cork;
struct sk_buff *skb, *skb_prev = NULL;
- unsigned int maxfraglen, fragheaderlen, mtu;
+ unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu;
int exthdrlen;
int dst_exthdrlen;
int hh_len;
@@ -1223,6 +1221,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
dst_exthdrlen = 0;
mtu = cork->fragsize;
}
+ orig_mtu = mtu;
hh_len = LL_RESERVED_SPACE(rt->dst.dev);
@@ -1302,8 +1301,7 @@ alloc_new_skb:
if (skb == NULL || skb_prev == NULL)
ip6_append_data_mtu(&mtu, &maxfraglen,
fragheaderlen, skb, rt,
- np->pmtudisc ==
- IPV6_PMTUDISC_PROBE);
+ orig_mtu);
skb_prev = skb;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 22/46] vxlan: fix potential NULL dereference in arp_reduce()
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (20 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 21/46] ipv6: ip6_append_data_mtu do not handle the mtu of the second fragment properly Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 23/46] rtnetlink: fix fdb notification flags Luis Henriques
` (23 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: David L Stevens, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: David Stevens <dlstevens@us.ibm.com>
commit 7346135dcd3f9b57f30a5512094848c678d7143e upstream.
This patch fixes a NULL pointer dereference in the event of an
skb allocation failure in arp_reduce().
Signed-Off-By: David L Stevens <dlstevens@us.ibm.com>
Acked-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/net/vxlan.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8a05d77..116810f 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -978,6 +978,9 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb)
neigh_release(n);
+ if (reply == NULL)
+ goto out;
+
skb_reset_mac_header(reply);
__skb_pull(reply, skb_network_offset(reply));
reply->ip_summed = CHECKSUM_UNNECESSARY;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 23/46] rtnetlink: fix fdb notification flags
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (21 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 22/46] vxlan: fix potential NULL dereference in arp_reduce() Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 24/46] ipmr: fix mfc " Luis Henriques
` (22 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Thomas Graf, Nicolas Dichtel, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
commit 1c104a6bebf3c16b6248408b84f91d09ac8a26b6 upstream.
Commit 3ff661c38c84 ("net: rtnetlink notify events for FDB NTF_SELF adds and
deletes") reuses the function nlmsg_populate_fdb_fill() to notify fdb events.
But this function was used only for dump and thus was always setting the
flag NLM_F_MULTI, which is wrong in case of a single notification.
Libraries like libnl will wait forever for NLMSG_DONE.
CC: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/core/rtnetlink.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ca198c1d1..6f73a10 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1991,12 +1991,13 @@ EXPORT_SYMBOL(rtmsg_ifinfo);
static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
struct net_device *dev,
u8 *addr, u32 pid, u32 seq,
- int type, unsigned int flags)
+ int type, unsigned int flags,
+ int nlflags)
{
struct nlmsghdr *nlh;
struct ndmsg *ndm;
- nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), NLM_F_MULTI);
+ nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), nlflags);
if (!nlh)
return -EMSGSIZE;
@@ -2034,7 +2035,7 @@ static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, int type)
if (!skb)
goto errout;
- err = nlmsg_populate_fdb_fill(skb, dev, addr, 0, 0, type, NTF_SELF);
+ err = nlmsg_populate_fdb_fill(skb, dev, addr, 0, 0, type, NTF_SELF, 0);
if (err < 0) {
kfree_skb(skb);
goto errout;
@@ -2259,7 +2260,8 @@ static int nlmsg_populate_fdb(struct sk_buff *skb,
err = nlmsg_populate_fdb_fill(skb, dev, ha->addr,
portid, seq,
- RTM_NEWNEIGH, NTF_SELF);
+ RTM_NEWNEIGH, NTF_SELF,
+ NLM_F_MULTI);
if (err < 0)
return err;
skip:
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 24/46] ipmr: fix mfc notification flags
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (22 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 23/46] rtnetlink: fix fdb notification flags Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 25/46] ip6mr: " Luis Henriques
` (21 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Thomas Graf, Nicolas Dichtel, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
commit 65886f439ab0fdc2dff20d1fa87afb98c6717472 upstream.
Commit 8cd3ac9f9b7b ("ipmr: advertise new mfc entries via rtnl") reuses the
function ipmr_fill_mroute() to notify mfc events.
But this function was used only for dump and thus was always setting the
flag NLM_F_MULTI, which is wrong in case of a single notification.
Libraries like libnl will wait forever for NLMSG_DONE.
CC: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv4/ipmr.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 6fabc8d..aaa1be5 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2255,13 +2255,14 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb,
}
static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb,
- u32 portid, u32 seq, struct mfc_cache *c, int cmd)
+ u32 portid, u32 seq, struct mfc_cache *c, int cmd,
+ int flags)
{
struct nlmsghdr *nlh;
struct rtmsg *rtm;
int err;
- nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), NLM_F_MULTI);
+ nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), flags);
if (nlh == NULL)
return -EMSGSIZE;
@@ -2329,7 +2330,7 @@ static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc,
if (skb == NULL)
goto errout;
- err = ipmr_fill_mroute(mrt, skb, 0, 0, mfc, cmd);
+ err = ipmr_fill_mroute(mrt, skb, 0, 0, mfc, cmd, 0);
if (err < 0)
goto errout;
@@ -2368,7 +2369,8 @@ static int ipmr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb)
if (ipmr_fill_mroute(mrt, skb,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
- mfc, RTM_NEWROUTE) < 0)
+ mfc, RTM_NEWROUTE,
+ NLM_F_MULTI) < 0)
goto done;
next_entry:
e++;
@@ -2382,7 +2384,8 @@ next_entry:
if (ipmr_fill_mroute(mrt, skb,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
- mfc, RTM_NEWROUTE) < 0) {
+ mfc, RTM_NEWROUTE,
+ NLM_F_MULTI) < 0) {
spin_unlock_bh(&mfc_unres_lock);
goto done;
}
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 25/46] ip6mr: fix mfc notification flags
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (23 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 24/46] ipmr: fix mfc " Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 26/46] netpoll: fix the skb check in pkt_is_ns Luis Henriques
` (20 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Thomas Graf, Nicolas Dichtel, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
commit f518338b16038beeb73e155e60d0f70beb9379f4 upstream.
Commit 812e44dd1829 ("ip6mr: advertise new mfc entries via rtnl") reuses the
function ip6mr_fill_mroute() to notify mfc events.
But this function was used only for dump and thus was always setting the
flag NLM_F_MULTI, which is wrong in case of a single notification.
Libraries like libnl will wait forever for NLMSG_DONE.
CC: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv6/ip6mr.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 0caf013..1292075 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -2351,13 +2351,14 @@ int ip6mr_get_route(struct net *net,
}
static int ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb,
- u32 portid, u32 seq, struct mfc6_cache *c, int cmd)
+ u32 portid, u32 seq, struct mfc6_cache *c, int cmd,
+ int flags)
{
struct nlmsghdr *nlh;
struct rtmsg *rtm;
int err;
- nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), NLM_F_MULTI);
+ nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rtm), flags);
if (nlh == NULL)
return -EMSGSIZE;
@@ -2425,7 +2426,7 @@ static void mr6_netlink_event(struct mr6_table *mrt, struct mfc6_cache *mfc,
if (skb == NULL)
goto errout;
- err = ip6mr_fill_mroute(mrt, skb, 0, 0, mfc, cmd);
+ err = ip6mr_fill_mroute(mrt, skb, 0, 0, mfc, cmd, 0);
if (err < 0)
goto errout;
@@ -2464,7 +2465,8 @@ static int ip6mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb)
if (ip6mr_fill_mroute(mrt, skb,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
- mfc, RTM_NEWROUTE) < 0)
+ mfc, RTM_NEWROUTE,
+ NLM_F_MULTI) < 0)
goto done;
next_entry:
e++;
@@ -2478,7 +2480,8 @@ next_entry:
if (ip6mr_fill_mroute(mrt, skb,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
- mfc, RTM_NEWROUTE) < 0) {
+ mfc, RTM_NEWROUTE,
+ NLM_F_MULTI) < 0) {
spin_unlock_bh(&mfc_unres_lock);
goto done;
}
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 26/46] netpoll: fix the skb check in pkt_is_ns
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (24 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 25/46] ip6mr: " Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 27/46] tg3: Do not include vlan acceleration features in vlan_features Luis Henriques
` (19 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team; +Cc: Li RongQing, WANG Cong, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <roy.qing.li@gmail.com>
[ Not applicable upstream commit, the code here has been removed
upstream. ]
Neighbor Solicitation is ipv6 protocol, so we should check
skb->protocol with ETH_P_IPV6
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Cc: WANG Cong <amwang@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/core/netpoll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 462cdc9..9b40f23 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -740,7 +740,7 @@ static bool pkt_is_ns(struct sk_buff *skb)
struct nd_msg *msg;
struct ipv6hdr *hdr;
- if (skb->protocol != htons(ETH_P_ARP))
+ if (skb->protocol != htons(ETH_P_IPV6))
return false;
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + sizeof(struct nd_msg)))
return false;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 27/46] tg3: Do not include vlan acceleration features in vlan_features
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (25 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 26/46] netpoll: fix the skb check in pkt_is_ns Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 28/46] usbnet: include wait queue head in device structure Luis Henriques
` (18 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Nithin Nayak Sujir, Michael Chan, Vlad Yasevich, David S. Miller,
Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Yasevich <vyasevic@redhat.com>
commit 51dfe7b944998eaeb2b34d314f3a6b16a5fd621b upstream.
Including hardware acceleration features in vlan_features breaks
stacked vlans (Q-in-Q) by marking the bottom vlan interface as
capable of acceleration. This causes one of the tags to be lost
and the packets are sent with a sing vlan header.
CC: Nithin Nayak Sujir <nsujir@broadcom.com>
CC: Michael Chan <mchan@broadcom.com>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/net/ethernet/broadcom/tg3.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index c200bc2..17822c5 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17432,8 +17432,6 @@ static int tg3_init_one(struct pci_dev *pdev,
tg3_init_bufmgr_config(tp);
- features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
-
/* 5700 B0 chips do not support checksumming correctly due
* to hardware bugs.
*/
@@ -17465,7 +17463,8 @@ static int tg3_init_one(struct pci_dev *pdev,
features |= NETIF_F_TSO_ECN;
}
- dev->features |= features;
+ dev->features |= features | NETIF_F_HW_VLAN_CTAG_TX |
+ NETIF_F_HW_VLAN_CTAG_RX;
dev->vlan_features |= features;
/*
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 28/46] usbnet: include wait queue head in device structure
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (26 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 27/46] tg3: Do not include vlan acceleration features in vlan_features Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 29/46] vlan: Set hard_header_len according to available acceleration Luis Henriques
` (17 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Oliver Neukum, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <oneukum@suse.de>
commit 14a0d635d18d0fb552dcc979d6d25106e6541f2e upstream.
This fixes a race which happens by freeing an object on the stack.
Quoting Julius:
> The issue is
> that it calls usbnet_terminate_urbs() before that, which temporarily
> installs a waitqueue in dev->wait in order to be able to wait on the
> tasklet to run and finish up some queues. The waiting itself looks
> okay, but the access to 'dev->wait' is totally unprotected and can
> race arbitrarily. I think in this case usbnet_bh() managed to succeed
> it's dev->wait check just before usbnet_terminate_urbs() sets it back
> to NULL. The latter then finishes and the waitqueue_t structure on its
> stack gets overwritten by other functions halfway through the
> wake_up() call in usbnet_bh().
The fix is to just not allocate the data structure on the stack.
As dev->wait is abused as a flag it also takes a runtime PM change
to fix this bug.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Reported-by: Grant Grundler <grundler@google.com>
Tested-by: Grant Grundler <grundler@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/net/usb/usbnet.c | 33 +++++++++++++++++++--------------
include/linux/usb/usbnet.h | 2 +-
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index f6dce47..3d50e7d 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -727,14 +727,12 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
// precondition: never called in_interrupt
static void usbnet_terminate_urbs(struct usbnet *dev)
{
- DECLARE_WAIT_QUEUE_HEAD_ONSTACK(unlink_wakeup);
DECLARE_WAITQUEUE(wait, current);
int temp;
/* ensure there are no more active urbs */
- add_wait_queue(&unlink_wakeup, &wait);
+ add_wait_queue(&dev->wait, &wait);
set_current_state(TASK_UNINTERRUPTIBLE);
- dev->wait = &unlink_wakeup;
temp = unlink_urbs(dev, &dev->txq) +
unlink_urbs(dev, &dev->rxq);
@@ -748,15 +746,14 @@ static void usbnet_terminate_urbs(struct usbnet *dev)
"waited for %d urb completions\n", temp);
}
set_current_state(TASK_RUNNING);
- dev->wait = NULL;
- remove_wait_queue(&unlink_wakeup, &wait);
+ remove_wait_queue(&dev->wait, &wait);
}
int usbnet_stop (struct net_device *net)
{
struct usbnet *dev = netdev_priv(net);
struct driver_info *info = dev->driver_info;
- int retval;
+ int retval, pm;
clear_bit(EVENT_DEV_OPEN, &dev->flags);
netif_stop_queue (net);
@@ -766,6 +763,8 @@ int usbnet_stop (struct net_device *net)
net->stats.rx_packets, net->stats.tx_packets,
net->stats.rx_errors, net->stats.tx_errors);
+ /* to not race resume */
+ pm = usb_autopm_get_interface(dev->intf);
/* allow minidriver to stop correctly (wireless devices to turn off
* radio etc) */
if (info->stop) {
@@ -792,6 +791,9 @@ int usbnet_stop (struct net_device *net)
dev->flags = 0;
del_timer_sync (&dev->delay);
tasklet_kill (&dev->bh);
+ if (!pm)
+ usb_autopm_put_interface(dev->intf);
+
if (info->manage_power &&
!test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags))
info->manage_power(dev, 0);
@@ -1360,11 +1362,12 @@ static void usbnet_bh (unsigned long param)
/* restart RX again after disabling due to high error rate */
clear_bit(EVENT_RX_KILL, &dev->flags);
- // waiting for all pending urbs to complete?
- if (dev->wait) {
- if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) {
- wake_up (dev->wait);
- }
+ /* waiting for all pending urbs to complete?
+ * only then can we forgo submitting anew
+ */
+ if (waitqueue_active(&dev->wait)) {
+ if (dev->txq.qlen + dev->rxq.qlen + dev->done.qlen == 0)
+ wake_up_all(&dev->wait);
// or are we maybe short a few urbs?
} else if (netif_running (dev->net) &&
@@ -1502,6 +1505,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
dev->driver_name = name;
dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV
| NETIF_MSG_PROBE | NETIF_MSG_LINK);
+ init_waitqueue_head(&dev->wait);
skb_queue_head_init (&dev->rxq);
skb_queue_head_init (&dev->txq);
skb_queue_head_init (&dev->done);
@@ -1694,9 +1698,10 @@ int usbnet_resume (struct usb_interface *intf)
spin_unlock_irq(&dev->txq.lock);
if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
- /* handle remote wakeup ASAP */
- if (!dev->wait &&
- netif_device_present(dev->net) &&
+ /* handle remote wakeup ASAP
+ * we cannot race against stop
+ */
+ if (netif_device_present(dev->net) &&
!timer_pending(&dev->delay) &&
!test_bit(EVENT_RX_HALT, &dev->flags))
rx_alloc_submit(dev, GFP_NOIO);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f18d641..123b21b 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -30,7 +30,7 @@ struct usbnet {
struct driver_info *driver_info;
const char *driver_name;
void *driver_priv;
- wait_queue_head_t *wait;
+ wait_queue_head_t wait;
struct mutex phy_mutex;
unsigned char suspend_count;
unsigned char pkt_cnt, pkt_err;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 29/46] vlan: Set hard_header_len according to available acceleration
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (27 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 28/46] usbnet: include wait queue head in device structure Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 30/46] vhost: fix total length when packets are too short Luis Henriques
` (16 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Patrick McHardy, Vlad Yasevich, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Yasevich <vyasevic@redhat.com>
commit fc0d48b8fb449ca007b2057328abf736cb516168 upstream.
Currently, if the card supports CTAG acceleration we do not
account for the vlan header even if we are configuring an
8021AD vlan. This may not be best since we'll do software
tagging for 8021AD which will cause data copy on skb head expansion
Configure the length based on available hw offload capabilities and
vlan protocol.
CC: Patrick McHardy <kaber@trash.net>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/8021q/vlan.c | 4 +++-
net/8021q/vlan_dev.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 2fb2d88..2c3a3b7 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -305,9 +305,11 @@ static void vlan_sync_address(struct net_device *dev,
static void vlan_transfer_features(struct net_device *dev,
struct net_device *vlandev)
{
+ struct vlan_dev_priv *vlan = vlan_dev_priv(vlandev);
+
vlandev->gso_max_size = dev->gso_max_size;
- if (dev->features & NETIF_F_HW_VLAN_CTAG_TX)
+ if (vlan_hw_offload_capable(dev->features, vlan->vlan_proto))
vlandev->hard_header_len = dev->hard_header_len;
else
vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN;
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 48db858..cf35f38 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -611,7 +611,8 @@ static int vlan_dev_init(struct net_device *dev)
#endif
dev->needed_headroom = real_dev->needed_headroom;
- if (real_dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
+ if (vlan_hw_offload_capable(real_dev->features,
+ vlan_dev_priv(dev)->vlan_proto)) {
dev->header_ops = &vlan_passthru_header_ops;
dev->hard_header_len = real_dev->hard_header_len;
} else {
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 30/46] vhost: fix total length when packets are too short
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (28 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 29/46] vlan: Set hard_header_len according to available acceleration Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 31/46] vhost: validate vhost_get_vq_desc return value Luis Henriques
` (15 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Michael S. Tsirkin, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "Michael S. Tsirkin" <mst@redhat.com>
commit d8316f3991d207fe32881a9ac20241be8fa2bad0 upstream.
When mergeable buffers are disabled, and the
incoming packet is too large for the rx buffer,
get_rx_bufs returns success.
This was intentional in order for make recvmsg
truncate the packet and then handle_rx would
detect err != sock_len and drop it.
Unfortunately we pass the original sock_len to
recvmsg - which means we use parts of iov not fully
validated.
Fix this up by detecting this overrun and doing packet drop
immediately.
CVE-2014-0077
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/vhost/net.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 969a859..1284e7a 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -537,6 +537,12 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
*iovcount = seg;
if (unlikely(log))
*log_num = nlogs;
+
+ /* Detect overrun */
+ if (unlikely(datalen > 0)) {
+ r = UIO_MAXIOV + 1;
+ goto err;
+ }
return headcount;
err:
vhost_discard_vq_desc(vq, headcount);
@@ -592,6 +598,14 @@ static void handle_rx(struct vhost_net *net)
/* On error, stop handling until the next kick. */
if (unlikely(headcount < 0))
break;
+ /* On overrun, truncate and discard */
+ if (unlikely(headcount > UIO_MAXIOV)) {
+ msg.msg_iovlen = 1;
+ err = sock->ops->recvmsg(NULL, sock, &msg,
+ 1, MSG_DONTWAIT | MSG_TRUNC);
+ pr_debug("Discarded rx packet: len %zd\n", sock_len);
+ continue;
+ }
/* OK, now we need to know about added descriptors. */
if (!headcount) {
if (unlikely(vhost_enable_notify(&net->dev, vq))) {
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 31/46] vhost: validate vhost_get_vq_desc return value
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (29 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 30/46] vhost: fix total length when packets are too short Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 32/46] xen-netback: remove pointless clause from if statement Luis Henriques
` (14 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Michael S. Tsirkin, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "Michael S. Tsirkin" <mst@redhat.com>
commit a39ee449f96a2cd44ce056d8a0a112211a9b1a1f upstream.
vhost fails to validate negative error code
from vhost_get_vq_desc causing
a crash: we are using -EFAULT which is 0xfffffff2
as vector size, which exceeds the allocated size.
The code in question was introduced in commit
8dd014adfea6f173c1ef6378f7e5e7924866c923
vhost-net: mergeable buffers support
CVE-2014-0055
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/vhost/net.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 1284e7a..786b86d 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -510,9 +510,13 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
r = -ENOBUFS;
goto err;
}
- d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
+ r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg,
ARRAY_SIZE(vq->iov) - seg, &out,
&in, log, log_num);
+ if (unlikely(r < 0))
+ goto err;
+
+ d = r;
if (d == vq->num) {
r = 0;
goto err;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 32/46] xen-netback: remove pointless clause from if statement
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (30 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 31/46] vhost: validate vhost_get_vq_desc return value Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 33/46] ipv6: some ipv6 statistic counters failed to disable bh Luis Henriques
` (13 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Paul Durrant, Ian Campbell, Wei Liu, Sander Eikelenboom,
David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Durrant <Paul.Durrant@citrix.com>
commit 0576eddf24df716d8570ef8ca11452a9f98eaab2 upstream.
This patch removes a test in start_new_rx_buffer() that checks whether
a copy operation is less than MAX_BUFFER_OFFSET in length, since
MAX_BUFFER_OFFSET is defined to be PAGE_SIZE and the only caller of
start_new_rx_buffer() already limits copy operations to PAGE_SIZE or less.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Sander Eikelenboom <linux@eikelenboom.it>
Reported-By: Sander Eikelenboom <linux@eikelenboom.it>
Tested-By: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/net/xen-netback/netback.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index ac55997..3335983 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -354,8 +354,8 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)
* into multiple copies tend to give large frags their
* own buffers as before.
*/
- if ((offset + size > MAX_BUFFER_OFFSET) &&
- (size <= MAX_BUFFER_OFFSET) && offset && !head)
+ BUG_ON(size > MAX_BUFFER_OFFSET);
+ if ((offset + size > MAX_BUFFER_OFFSET) && offset && !head)
return true;
return false;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 33/46] ipv6: some ipv6 statistic counters failed to disable bh
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (31 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 32/46] xen-netback: remove pointless clause from if statement Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 34/46] netlink: don't compare the nul-termination in nla_strcmp Luis Henriques
` (12 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Eric Dumazet, Hannes Frederic Sowa, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
commit 43a43b6040165f7b40b5b489fe61a4cb7f8c4980 upstream.
After commit c15b1ccadb323ea ("ipv6: move DAD and addrconf_verify
processing to workqueue") some counters are now updated in process context
and thus need to disable bh before doing so, otherwise deadlocks can
happen on 32-bit archs. Fabio Estevam noticed this while while mounting
a NFS volume on an ARM board.
As a compensation for missing this I looked after the other *_STATS_BH
and found three other calls which need updating:
1) icmp6_send: ip6_fragment -> icmpv6_send -> icmp6_send (error handling)
2) ip6_push_pending_frames: rawv6_sendmsg -> rawv6_push_pending_frames -> ...
(only in case of icmp protocol with raw sockets in error handling)
3) ping6_v6_sendmsg (error handling)
Fixes: c15b1ccadb323ea ("ipv6: move DAD and addrconf_verify processing to workqueue")
Reported-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/ipv6/icmp.c | 2 +-
net/ipv6/ip6_output.c | 4 ++--
net/ipv6/mcast.c | 11 ++++++-----
net/ipv6/ping.c | 4 ++--
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 7cfc8d2..eea0e24 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -516,7 +516,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
np->tclass, NULL, &fl6, (struct rt6_info *)dst,
MSG_DONTWAIT, np->dontfrag);
if (err) {
- ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS);
+ ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
ip6_flush_pending_frames(sk);
} else {
err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index b878dd6..d18c00a 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1557,8 +1557,8 @@ int ip6_push_pending_frames(struct sock *sk)
if (proto == IPPROTO_ICMPV6) {
struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
- ICMP6MSGOUT_INC_STATS_BH(net, idev, icmp6_hdr(skb)->icmp6_type);
- ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
+ ICMP6MSGOUT_INC_STATS(net, idev, icmp6_hdr(skb)->icmp6_type);
+ ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
}
err = ip6_local_out(skb);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 6b84fc0..8e30bed 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1448,11 +1448,12 @@ static void mld_sendpack(struct sk_buff *skb)
dst_output);
out:
if (!err) {
- ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT);
- ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
- IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
- } else
- IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS);
+ ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT);
+ ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
+ IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len);
+ } else {
+ IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
+ }
rcu_read_unlock();
return;
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 7856e96..6acab0b 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -182,8 +182,8 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
MSG_DONTWAIT, np->dontfrag);
if (err) {
- ICMP6_INC_STATS_BH(sock_net(sk), rt->rt6i_idev,
- ICMP6_MIB_OUTERRORS);
+ ICMP6_INC_STATS(sock_net(sk), rt->rt6i_idev,
+ ICMP6_MIB_OUTERRORS);
ip6_flush_pending_frames(sk);
} else {
err = icmpv6_push_pending_frames(sk, &fl6,
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 34/46] netlink: don't compare the nul-termination in nla_strcmp
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (32 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 33/46] ipv6: some ipv6 statistic counters failed to disable bh Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 35/46] isdnloop: Validate NUL-terminated strings from user Luis Henriques
` (11 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Florian Westphal, Thomas Graf, Pablo Neira Ayuso,
David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira <pablo@netfilter.org>
commit 8b7b932434f5eee495b91a2804f5b64ebb2bc835 upstream.
nla_strcmp compares the string length plus one, so it's implicitly
including the nul-termination in the comparison.
int nla_strcmp(const struct nlattr *nla, const char *str)
{
int len = strlen(str) + 1;
...
d = memcmp(nla_data(nla), str, len);
However, if NLA_STRING is used, userspace can send us a string without
the nul-termination. This is a problem since the string
comparison will not match as the last byte may be not the
nul-termination.
Fix this by skipping the comparison of the nul-termination if the
attribute data is nul-terminated. Suggested by Thomas Graf.
Cc: Florian Westphal <fw@strlen.de>
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
lib/nlattr.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 18eca78..fc67547 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -303,9 +303,15 @@ int nla_memcmp(const struct nlattr *nla, const void *data,
*/
int nla_strcmp(const struct nlattr *nla, const char *str)
{
- int len = strlen(str) + 1;
- int d = nla_len(nla) - len;
+ int len = strlen(str);
+ char *buf = nla_data(nla);
+ int attrlen = nla_len(nla);
+ int d;
+ if (attrlen > 0 && buf[attrlen - 1] == '\0')
+ attrlen--;
+
+ d = attrlen - len;
if (d == 0)
d = memcmp(nla_data(nla), str, len);
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 35/46] isdnloop: Validate NUL-terminated strings from user.
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (33 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 34/46] netlink: don't compare the nul-termination in nla_strcmp Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 36/46] isdnloop: several buffer overflows Luis Henriques
` (10 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: YOSHIFUJI Hideaki, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?YOSHIFUJI=20Hideaki=20/=20=E5=90=89=E8=97=A4=E8=8B=B1?=
commit 77bc6bed7121936bb2e019a8c336075f4c8eef62 upstream.
Return -EINVAL unless all of user-given strings are correctly
NUL-terminated.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/isdn/isdnloop/isdnloop.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index 02125e6..e1f8748 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -1070,6 +1070,12 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
return -EBUSY;
if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)))
return -EFAULT;
+
+ for (i = 0; i < 3; i++) {
+ if (!memchr(sdef.num[i], 0, sizeof(sdef.num[i])))
+ return -EINVAL;
+ }
+
spin_lock_irqsave(&card->isdnloop_lock, flags);
switch (sdef.ptype) {
case ISDN_PTYPE_EURO:
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 36/46] isdnloop: several buffer overflows
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (34 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 35/46] isdnloop: Validate NUL-terminated strings from user Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 37/46] rds: prevent dereference of a NULL device in rds_iw_laddr_check Luis Henriques
` (9 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Dan Carpenter, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <dan.carpenter@oracle.com>
commit 7563487cbf865284dcd35e9ef5a95380da046737 upstream.
There are three buffer overflows addressed in this patch.
1) In isdnloop_fake_err() we add an 'E' to a 60 character string and
then copy it into a 60 character buffer. I have made the destination
buffer 64 characters and I'm changed the sprintf() to a snprintf().
2) In isdnloop_parse_cmd(), p points to a 6 characters into a 60
character buffer so we have 54 characters. The ->eazlist[] is 11
characters long. I have modified the code to return if the source
buffer is too long.
3) In isdnloop_command() the cbuf[] array was 60 characters long but the
max length of the string then can be up to 79 characters. I made the
cbuf array 80 characters long and changed the sprintf() to snprintf().
I also removed the temporary "dial" buffer and changed it to use "p"
directly.
Unfortunately, we pass the "cbuf" string from isdnloop_command() to
isdnloop_writecmd() which truncates anything over 60 characters to make
it fit in card->omsg[]. (It can accept values up to 255 characters so
long as there is a '\n' character every 60 characters). For now I have
just fixed the memory corruption bug and left the other problems in this
driver alone.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/isdn/isdnloop/isdnloop.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index e1f8748..5a4da94 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -518,9 +518,9 @@ static isdnloop_stat isdnloop_cmd_table[] =
static void
isdnloop_fake_err(isdnloop_card *card)
{
- char buf[60];
+ char buf[64];
- sprintf(buf, "E%s", card->omsg);
+ snprintf(buf, sizeof(buf), "E%s", card->omsg);
isdnloop_fake(card, buf, -1);
isdnloop_fake(card, "NAK", -1);
}
@@ -903,6 +903,8 @@ isdnloop_parse_cmd(isdnloop_card *card)
case 7:
/* 0x;EAZ */
p += 3;
+ if (strlen(p) >= sizeof(card->eazlist[0]))
+ break;
strcpy(card->eazlist[ch - 1], p);
break;
case 8:
@@ -1133,7 +1135,7 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
{
ulong a;
int i;
- char cbuf[60];
+ char cbuf[80];
isdn_ctrl cmd;
isdnloop_cdef cdef;
@@ -1198,7 +1200,6 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
break;
if ((c->arg & 255) < ISDNLOOP_BCH) {
char *p;
- char dial[50];
char dcode[4];
a = c->arg;
@@ -1210,10 +1211,10 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
} else
/* Normal Dial */
strcpy(dcode, "CAL");
- strcpy(dial, p);
- sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
- dcode, dial, c->parm.setup.si1,
- c->parm.setup.si2, c->parm.setup.eazmsn);
+ snprintf(cbuf, sizeof(cbuf),
+ "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
+ dcode, p, c->parm.setup.si1,
+ c->parm.setup.si2, c->parm.setup.eazmsn);
i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);
}
break;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 37/46] rds: prevent dereference of a NULL device in rds_iw_laddr_check
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (35 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 36/46] isdnloop: several buffer overflows Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 38/46] cpuidle: Check the result of cpuidle_get_driver() against NULL Luis Henriques
` (8 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Sasha Levin, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <sasha.levin@oracle.com>
commit bf39b4247b8799935ea91d90db250ab608a58e50 upstream.
Binding might result in a NULL device which is later dereferenced
without checking.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/rds/iw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/rds/iw.c b/net/rds/iw.c
index 7826d46..5899356 100644
--- a/net/rds/iw.c
+++ b/net/rds/iw.c
@@ -239,7 +239,8 @@ static int rds_iw_laddr_check(__be32 addr)
ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin);
/* due to this, we will claim to support IB devices unless we
check node_type. */
- if (ret || cm_id->device->node_type != RDMA_NODE_RNIC)
+ if (ret || !cm_id->device ||
+ cm_id->device->node_type != RDMA_NODE_RNIC)
ret = -EADDRNOTAVAIL;
rdsdebug("addr %pI4 ret %d node type %d\n",
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 38/46] cpuidle: Check the result of cpuidle_get_driver() against NULL
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (36 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 37/46] rds: prevent dereference of a NULL device in rds_iw_laddr_check Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 39/46] sparc: PCI: Fix incorrect address calculation of PCI Bridge windows on Simba-bridges Luis Henriques
` (7 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Daniel Fu, Rafael J. Wysocki, Mark Brown, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Fu <danifu@nvidia.com>
commit 3b9c10e98021e1f92e6f8c7ce1778b86ba68db10 upstream.
If the current CPU has no cpuidle driver, drv will be NULL in
cpuidle_driver_ref(). Check if that is the case before trying
to bump up the driver's refcount to prevent the kernel from
crashing.
[rjw: Subject and changelog]
Signed-off-by: Daniel Fu <danifu@nvidia.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/cpuidle/driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 3ac499d..6e11701 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -331,7 +331,8 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
spin_lock(&cpuidle_driver_lock);
drv = cpuidle_get_driver();
- drv->refcnt++;
+ if (drv)
+ drv->refcnt++;
spin_unlock(&cpuidle_driver_lock);
return drv;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 39/46] sparc: PCI: Fix incorrect address calculation of PCI Bridge windows on Simba-bridges
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (37 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 38/46] cpuidle: Check the result of cpuidle_get_driver() against NULL Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 40/46] Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines." Luis Henriques
` (6 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Kjetil Oftedal, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: oftedal <oftedal@gmail.com>
commit 557fc5873ef178c4b3e1e36a42db547ecdc43f9b upstream.
The SIMBA APB Bridges lacks the 'ranges' of-property describing the
PCI I/O and memory areas located beneath the bridge. Faking this
information has been performed by reading range registers in the
APB bridge, and calculating the corresponding areas.
In commit 01f94c4a6ced476ce69b895426fc29bfc48c69bd
("Fix sabre pci controllers with new probing scheme.") a bug was
introduced into this calculation, causing the PCI memory areas
to be calculated incorrectly: The shift size was set to be
identical for I/O and MEM ranges, which is incorrect.
This patch set the shift size of the MEM range back to the
value used before 01f94c4a6ced476ce69b895426fc29bfc48c69bd.
Signed-off-by: Kjetil Oftedal <oftedal@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
arch/sparc/kernel/pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index bc4d3f5..cb02145 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -398,8 +398,8 @@ static void apb_fake_ranges(struct pci_dev *dev,
apb_calc_first_last(map, &first, &last);
res = bus->resource[1];
res->flags = IORESOURCE_MEM;
- region.start = (first << 21);
- region.end = (last << 21) + ((1 << 21) - 1);
+ region.start = (first << 29);
+ region.end = (last << 29) + ((1 << 29) - 1);
pcibios_bus_to_resource(dev, res, ®ion);
}
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 40/46] Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines."
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (38 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 39/46] sparc: PCI: Fix incorrect address calculation of PCI Bridge windows on Simba-bridges Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 41/46] sparc32: fix build failure for arch_jump_label_transform Luis Henriques
` (5 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Dave Kleikamp, Hugh Dickins, David S. Miller, sparclinux, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Kleikamp <dave.kleikamp@oracle.com>
commit 16932237f2978a2265662f8de4af743b1f55a209 upstream.
This reverts commit 145e1c0023585e0e8f6df22316308ec61c5066b2.
This commit broke the behavior of __copy_from_user_inatomic when
it is only partially successful. Instead of returning the number
of bytes not copied, it now returns 1. This translates to the
wrong value being returned by iov_iter_copy_from_user_atomic.
xfstests generic/246 and LTP writev01 both fail on btrfs and nfs
because of this.
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
arch/sparc/include/asm/uaccess_64.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index e562d3c..ad7e178 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -262,8 +262,8 @@ extern unsigned long __must_check __clear_user(void __user *, unsigned long);
extern __must_check long strlen_user(const char __user *str);
extern __must_check long strnlen_user(const char __user *str, long n);
-#define __copy_to_user_inatomic ___copy_to_user
-#define __copy_from_user_inatomic ___copy_from_user
+#define __copy_to_user_inatomic __copy_to_user
+#define __copy_from_user_inatomic __copy_from_user
struct pt_regs;
extern unsigned long compute_effective_address(struct pt_regs *,
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 41/46] sparc32: fix build failure for arch_jump_label_transform
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (39 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 40/46] Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines." Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 42/46] sparc64: don't treat 64-bit syscall return codes as 32-bit Luis Henriques
` (4 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Paul Gortmaker, David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <paul.gortmaker@windriver.com>
commit 4f6500fff5f7644a03c46728fd7ef0f62fa6940b upstream.
In arch/sparc/Kernel/Makefile, we see:
obj-$(CONFIG_SPARC64) += jump_label.o
However, the Kconfig selects HAVE_ARCH_JUMP_LABEL unconditionally
for all SPARC. This in turn leads to the following failure when
doing allmodconfig coverage builds:
kernel/built-in.o: In function `__jump_label_update':
jump_label.c:(.text+0x8560c): undefined reference to `arch_jump_label_transform'
kernel/built-in.o: In function `arch_jump_label_transform_static':
(.text+0x85cf4): undefined reference to `arch_jump_label_transform'
make: *** [vmlinux] Error 1
Change HAVE_ARCH_JUMP_LABEL to be conditional on SPARC64 so that it
matches the Makefile.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
arch/sparc/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index a00cbd3..d268475 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -25,7 +25,7 @@ config SPARC
select RTC_DRV_M48T59
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG
- select HAVE_ARCH_JUMP_LABEL
+ select HAVE_ARCH_JUMP_LABEL if SPARC64
select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_SHOW
select ARCH_WANT_IPC_PARSE_VERSION
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 42/46] sparc64: don't treat 64-bit syscall return codes as 32-bit
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (40 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 41/46] sparc32: fix build failure for arch_jump_label_transform Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 43/46] sparc64: Make sure %pil interrupts are enabled during hypervisor yield Luis Henriques
` (3 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Dave Kleikamp, David S. Miller, sparclinux, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Kleikamp <dave.kleikamp@oracle.com>
commit 1535bd8adbdedd60a0ee62e28fd5225d66434371 upstream.
When checking a system call return code for an error,
linux_sparc_syscall was sign-extending the lower 32-bit value and
comparing it to -ERESTART_RESTARTBLOCK. lseek can return valid return
codes whose lower 32-bits alone would indicate a failure (such as 4G-1).
Use the whole 64-bit value to check for errors. Only the 32-bit path
should sign extend the lower 32-bit value.
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Acked-by: Bob Picco <bob.picco@oracle.com>
Acked-by: Allen Pais <allen.pais@oracle.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
arch/sparc/kernel/syscalls.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index 73ec8a7..c79c687 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -189,7 +189,8 @@ linux_sparc_syscall32:
mov %i0, %l5 ! IEU1
5: call %l7 ! CTI Group brk forced
srl %i5, 0, %o5 ! IEU1
- ba,a,pt %xcc, 3f
+ ba,pt %xcc, 3f
+ sra %o0, 0, %o0
/* Linux native system calls enter here... */
.align 32
@@ -217,7 +218,6 @@ linux_sparc_syscall:
3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
ret_sys_call:
ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
- sra %o0, 0, %o0
mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
sllx %g2, 32, %g2
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 43/46] sparc64: Make sure %pil interrupts are enabled during hypervisor yield.
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (41 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 42/46] sparc64: don't treat 64-bit syscall return codes as 32-bit Luis Henriques
@ 2014-04-16 10:31 ` Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 44/46] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len Luis Henriques
` (2 subsequent siblings)
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:31 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team; +Cc: David S. Miller, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: "David S. Miller" <davem@davemloft.net>
commit cb3042d609e30e6144024801c89be3925106752b upstream.
In arch_cpu_idle() we must enable %pil based interrupts before
potentially invoking the hypervisor cpu yield call.
As per the Hypervisor API documentation for cpu_yield:
Interrupts which are blocked by some mechanism other that
pstate.ie (for example %pil) are not guaranteed to cause
a return from this service.
It seems that only first generation Niagara chips are hit by this
bug. My best guess is that later chips implement this in hardware
and wake up anyways from %pil events, whereas in first generation
chips the yield is implemented completely in hypervisor code and
requires %pil to be enabled in order to wake properly from this
call.
Fixes: 87fa05aeb3a5 ("sparc: Use generic idle loop")
Reported-by: Fabio M. Di Nitto <fabbione@fabbione.net>
Reported-by: Jan Engelhardt <jengelh@inai.de>
Tested-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
arch/sparc/kernel/process_64.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index baebab2..b9cc976 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -57,9 +57,12 @@ void arch_cpu_idle(void)
{
if (tlb_type != hypervisor) {
touch_nmi_watchdog();
+ local_irq_enable();
} else {
unsigned long pstate;
+ local_irq_enable();
+
/* The sun4v sleeping code requires that we have PSTATE.IE cleared over
* the cpu sleep hypervisor call.
*/
@@ -81,7 +84,6 @@ void arch_cpu_idle(void)
: "=&r" (pstate)
: "i" (PSTATE_IE));
}
- local_irq_enable();
}
#ifdef CONFIG_HOTPLUG_CPU
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 44/46] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (42 preceding siblings ...)
2014-04-16 10:31 ` [PATCH 3.11 43/46] sparc64: Make sure %pil interrupts are enabled during hypervisor yield Luis Henriques
@ 2014-04-16 10:32 ` Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 45/46] netfilter: Can't fail and free after table replacement Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 46/46] crypto: ghash-clmulni-intel - use C implementation for setkey() Luis Henriques
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:32 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik,
David S. Miller, Andrey Vagin, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Vagin <avagin@openvz.org>
commit 223b02d923ecd7c84cf9780bb3686f455d279279 upstream.
"len" contains sizeof(nf_ct_ext) and size of extensions. In a worst
case it can contain all extensions. Bellow you can find sizes for all
types of extensions. Their sum is definitely bigger than 256.
nf_ct_ext_types[0]->len = 24
nf_ct_ext_types[1]->len = 32
nf_ct_ext_types[2]->len = 24
nf_ct_ext_types[3]->len = 32
nf_ct_ext_types[4]->len = 152
nf_ct_ext_types[5]->len = 2
nf_ct_ext_types[6]->len = 16
nf_ct_ext_types[7]->len = 8
I have seen "len" up to 280 and my host has crashes w/o this patch.
The right way to fix this problem is reducing the size of the ecache
extension (4) and Florian is going to do this, but these changes will
be quite large to be appropriate for a stable tree.
Fixes: 5b423f6a40a0 (netfilter: nf_conntrack: fix racy timer handling with reliable)
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
include/net/netfilter/nf_conntrack_extend.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 3313108..86dd7dd 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -41,8 +41,8 @@ enum nf_ct_ext_id {
/* Extensions: optional stuff which isn't permanently in struct. */
struct nf_ct_ext {
struct rcu_head rcu;
- u8 offset[NF_CT_EXT_NUM];
- u8 len;
+ u16 offset[NF_CT_EXT_NUM];
+ u16 len;
char data[0];
};
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 45/46] netfilter: Can't fail and free after table replacement
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (43 preceding siblings ...)
2014-04-16 10:32 ` [PATCH 3.11 44/46] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len Luis Henriques
@ 2014-04-16 10:32 ` Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 46/46] crypto: ghash-clmulni-intel - use C implementation for setkey() Luis Henriques
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:32 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Florian Westphal, Thomas Graf, Pablo Neira Ayuso, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Graf <tgraf@suug.ch>
commit c58dd2dd443c26d856a168db108a0cd11c285bf3 upstream.
All xtables variants suffer from the defect that the copy_to_user()
to copy the counters to user memory may fail after the table has
already been exchanged and thus exposed. Return an error at this
point will result in freeing the already exposed table. Any
subsequent packet processing will result in a kernel panic.
We can't copy the counters before exposing the new tables as we
want provide the counter state after the old table has been
unhooked. Therefore convert this into a silent error.
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
net/bridge/netfilter/ebtables.c | 5 ++---
net/ipv4/netfilter/arp_tables.c | 6 ++++--
net/ipv4/netfilter/ip_tables.c | 6 ++++--
net/ipv6/netfilter/ip6_tables.c | 6 ++++--
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index ac78024..b166fc2 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1044,10 +1044,9 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
if (repl->num_counters &&
copy_to_user(repl->counters, counterstmp,
repl->num_counters * sizeof(struct ebt_counter))) {
- ret = -EFAULT;
+ /* Silent error, can't fail, new table is already in place */
+ net_warn_ratelimited("ebtables: counters copy to user failed while replacing table\n");
}
- else
- ret = 0;
/* decrease module count and free resources */
EBT_ENTRY_ITERATE(table->entries, table->entries_size,
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 85a4f21..c8abe31 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1039,8 +1039,10 @@ static int __do_replace(struct net *net, const char *name,
xt_free_table_info(oldinfo);
if (copy_to_user(counters_ptr, counters,
- sizeof(struct xt_counters) * num_counters) != 0)
- ret = -EFAULT;
+ sizeof(struct xt_counters) * num_counters) != 0) {
+ /* Silent error, can't fail, new table is already in place */
+ net_warn_ratelimited("arptables: counters copy to user failed while replacing table\n");
+ }
vfree(counters);
xt_table_unlock(t);
return ret;
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index d23118d..651c107 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1226,8 +1226,10 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
xt_free_table_info(oldinfo);
if (copy_to_user(counters_ptr, counters,
- sizeof(struct xt_counters) * num_counters) != 0)
- ret = -EFAULT;
+ sizeof(struct xt_counters) * num_counters) != 0) {
+ /* Silent error, can't fail, new table is already in place */
+ net_warn_ratelimited("iptables: counters copy to user failed while replacing table\n");
+ }
vfree(counters);
xt_table_unlock(t);
return ret;
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 44400c2..89a4e4d 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1236,8 +1236,10 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
xt_free_table_info(oldinfo);
if (copy_to_user(counters_ptr, counters,
- sizeof(struct xt_counters) * num_counters) != 0)
- ret = -EFAULT;
+ sizeof(struct xt_counters) * num_counters) != 0) {
+ /* Silent error, can't fail, new table is already in place */
+ net_warn_ratelimited("ip6tables: counters copy to user failed while replacing table\n");
+ }
vfree(counters);
xt_table_unlock(t);
return ret;
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH 3.11 46/46] crypto: ghash-clmulni-intel - use C implementation for setkey()
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
` (44 preceding siblings ...)
2014-04-16 10:32 ` [PATCH 3.11 45/46] netfilter: Can't fail and free after table replacement Luis Henriques
@ 2014-04-16 10:32 ` Luis Henriques
45 siblings, 0 replies; 47+ messages in thread
From: Luis Henriques @ 2014-04-16 10:32 UTC (permalink / raw)
To: linux-kernel, stable, kernel-team
Cc: Ard Biesheuvel, Herbert Xu, Luis Henriques
3.11.10.8 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
commit 8ceee72808d1ae3fb191284afc2257a2be964725 upstream.
The GHASH setkey() function uses SSE registers but fails to call
kernel_fpu_begin()/kernel_fpu_end(). Instead of adding these calls, and
then having to deal with the restriction that they cannot be called from
interrupt context, move the setkey() implementation to the C domain.
Note that setkey() does not use any particular SSE features and is not
expected to become a performance bottleneck.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Fixes: 0e1227d356e9b (crypto: ghash - Add PCLMULQDQ accelerated implementation)
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
arch/x86/crypto/ghash-clmulni-intel_asm.S | 29 -----------------------------
arch/x86/crypto/ghash-clmulni-intel_glue.c | 14 +++++++++++---
2 files changed, 11 insertions(+), 32 deletions(-)
diff --git a/arch/x86/crypto/ghash-clmulni-intel_asm.S b/arch/x86/crypto/ghash-clmulni-intel_asm.S
index 586f41a..185fad4 100644
--- a/arch/x86/crypto/ghash-clmulni-intel_asm.S
+++ b/arch/x86/crypto/ghash-clmulni-intel_asm.S
@@ -24,10 +24,6 @@
.align 16
.Lbswap_mask:
.octa 0x000102030405060708090a0b0c0d0e0f
-.Lpoly:
- .octa 0xc2000000000000000000000000000001
-.Ltwo_one:
- .octa 0x00000001000000000000000000000001
#define DATA %xmm0
#define SHASH %xmm1
@@ -134,28 +130,3 @@ ENTRY(clmul_ghash_update)
.Lupdate_just_ret:
ret
ENDPROC(clmul_ghash_update)
-
-/*
- * void clmul_ghash_setkey(be128 *shash, const u8 *key);
- *
- * Calculate hash_key << 1 mod poly
- */
-ENTRY(clmul_ghash_setkey)
- movaps .Lbswap_mask, BSWAP
- movups (%rsi), %xmm0
- PSHUFB_XMM BSWAP %xmm0
- movaps %xmm0, %xmm1
- psllq $1, %xmm0
- psrlq $63, %xmm1
- movaps %xmm1, %xmm2
- pslldq $8, %xmm1
- psrldq $8, %xmm2
- por %xmm1, %xmm0
- # reduction
- pshufd $0b00100100, %xmm2, %xmm1
- pcmpeqd .Ltwo_one, %xmm1
- pand .Lpoly, %xmm1
- pxor %xmm1, %xmm0
- movups %xmm0, (%rdi)
- ret
-ENDPROC(clmul_ghash_setkey)
diff --git a/arch/x86/crypto/ghash-clmulni-intel_glue.c b/arch/x86/crypto/ghash-clmulni-intel_glue.c
index 6759dd1..d785cf2 100644
--- a/arch/x86/crypto/ghash-clmulni-intel_glue.c
+++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c
@@ -30,8 +30,6 @@ void clmul_ghash_mul(char *dst, const be128 *shash);
void clmul_ghash_update(char *dst, const char *src, unsigned int srclen,
const be128 *shash);
-void clmul_ghash_setkey(be128 *shash, const u8 *key);
-
struct ghash_async_ctx {
struct cryptd_ahash *cryptd_tfm;
};
@@ -58,13 +56,23 @@ static int ghash_setkey(struct crypto_shash *tfm,
const u8 *key, unsigned int keylen)
{
struct ghash_ctx *ctx = crypto_shash_ctx(tfm);
+ be128 *x = (be128 *)key;
+ u64 a, b;
if (keylen != GHASH_BLOCK_SIZE) {
crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
return -EINVAL;
}
- clmul_ghash_setkey(&ctx->shash, key);
+ /* perform multiplication by 'x' in GF(2^128) */
+ a = be64_to_cpu(x->a);
+ b = be64_to_cpu(x->b);
+
+ ctx->shash.a = (__be64)((b << 1) | (a >> 63));
+ ctx->shash.b = (__be64)((a << 1) | (b >> 63));
+
+ if (a >> 63)
+ ctx->shash.b ^= cpu_to_be64(0xc2);
return 0;
}
--
1.9.1
^ permalink raw reply [flat|nested] 47+ messages in thread
end of thread, other threads:[~2014-04-16 10:56 UTC | newest]
Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 01/46] Input: cypress_ps2 - don't report as a button pads Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 02/46] netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 03/46] cpufreq: Fix timer/workqueue corruption due to double queueing Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 04/46] futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 05/46] m68k: Skip " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 06/46] powernow-k6: disable cache when changing frequency Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 07/46] powernow-k6: correctly initialize default parameters Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 08/46] powernow-k6: reorder frequencies Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 09/46] selinux: correctly label /proc inodes in use before the policy is loaded Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 10/46] net: fix for a race condition in the inet frag code Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 11/46] net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 12/46] bridge: multicast: add sanity check for query source addresses Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 13/46] inet: frag: make sure forced eviction removes all frags Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 14/46] net: unix: non blocking recvmsg() should not return -EINTR Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 15/46] ipv6: Fix exthdrs offload registration Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 16/46] ipv6: don't set DST_NOCOUNT for remotely added routes Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 17/46] vlan: Set correct source MAC address with TX VLAN offload enabled Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 18/46] tcp: tcp_release_cb() should release socket ownership Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 19/46] net: socket: error on a negative msg_namelen Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 20/46] ipv6: Avoid unnecessary temporary addresses being generated Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 21/46] ipv6: ip6_append_data_mtu do not handle the mtu of the second fragment properly Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 22/46] vxlan: fix potential NULL dereference in arp_reduce() Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 23/46] rtnetlink: fix fdb notification flags Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 24/46] ipmr: fix mfc " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 25/46] ip6mr: " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 26/46] netpoll: fix the skb check in pkt_is_ns Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 27/46] tg3: Do not include vlan acceleration features in vlan_features Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 28/46] usbnet: include wait queue head in device structure Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 29/46] vlan: Set hard_header_len according to available acceleration Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 30/46] vhost: fix total length when packets are too short Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 31/46] vhost: validate vhost_get_vq_desc return value Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 32/46] xen-netback: remove pointless clause from if statement Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 33/46] ipv6: some ipv6 statistic counters failed to disable bh Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 34/46] netlink: don't compare the nul-termination in nla_strcmp Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 35/46] isdnloop: Validate NUL-terminated strings from user Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 36/46] isdnloop: several buffer overflows Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 37/46] rds: prevent dereference of a NULL device in rds_iw_laddr_check Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 38/46] cpuidle: Check the result of cpuidle_get_driver() against NULL Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 39/46] sparc: PCI: Fix incorrect address calculation of PCI Bridge windows on Simba-bridges Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 40/46] Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines." Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 41/46] sparc32: fix build failure for arch_jump_label_transform Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 42/46] sparc64: don't treat 64-bit syscall return codes as 32-bit Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 43/46] sparc64: Make sure %pil interrupts are enabled during hypervisor yield Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 44/46] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 45/46] netfilter: Can't fail and free after table replacement Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 46/46] crypto: ghash-clmulni-intel - use C implementation for setkey() Luis Henriques
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®