Commit Graph

637825 Commits

Author SHA1 Message Date
Dan Streetman
75c2781998 xen: do not re-use pirq number cached in pci device msi msg data
am: 4b40611a9b

Change-Id: I5e8f2ddc8888af461ad5999d34712e5439ece2c7
2017-03-22 12:02:08 +00:00
Krister Johansen
09f8b38b10 dmaengine: iota: ioat_alloc_chan_resources should not perform sleeping allocations.
am: 2382c1486c

Change-Id: Ib8146526ffab5be0440f24cd1610e84628a9e04a
2017-03-22 12:01:58 +00:00
Daniel Borkmann
82af7abe04 bpf: fix mark_reg_unknown_value for spilled regs on map value marking
am: 0e0f1d6fdb

Change-Id: I3990cdd8bc095423723df1771ec87158dc8cb63a
2017-03-22 12:01:48 +00:00
Daniel Borkmann
01db8bf2c4 bpf: fix regression on verifier pruning wrt map lookups
am: 1889d6d9b5

Change-Id: I528df00bc5cd00aec10f56ad53907f6ca8044973
2017-03-22 12:01:38 +00:00
Alexei Starovoitov
67684a346c bpf: fix state equivalence
am: b7f5aa1ca0

Change-Id: I1d61f752ac33e41ebb748eba7d3f48003ee29c19
2017-03-22 12:01:29 +00:00
Thomas Graf
199e71c26a bpf: Detect identical PTR_TO_MAP_VALUE_OR_NULL registers
am: 1411707acb

Change-Id: I02e316379d5a19258ea601e75b9f4cece6450acd
2017-03-22 12:01:20 +00:00
Hannes Frederic Sowa
692c6d74bc dccp: fix memory leak during tear-down of unsuccessful connection request
am: 9e38375a4b

Change-Id: I365b84799d537368f2fc8629fd0c15a27d4dbbea
2017-03-22 12:01:10 +00:00
Hannes Frederic Sowa
912e06c79e tun: fix premature POLLOUT notification on tun devices
am: beaa66cce5

Change-Id: Icbdc858f3a86d09f5c328480e057d9fdc33b1a3d
2017-03-22 12:01:01 +00:00
Jon Maxwell
ee059e366e dccp/tcp: fix routing redirect race
am: 98933eb36d

Change-Id: I8a66a08fd74a7cd585eab307004983d71b26cbcd
2017-03-22 12:00:51 +00:00
Florian Westphal
aa93808f26 bridge: drop netfilter fake rtable unconditionally
am: 9bce26f224

Change-Id: I5477f23d8e81d7554189e76d92548847b8a8a11f
2017-03-22 12:00:41 +00:00
Florian Westphal
4dd40f999e ipv6: avoid write to a possibly cloned skb
am: 683100ed45

Change-Id: If32c172adceadc53f7222c310e8f939004154687
2017-03-22 12:00:32 +00:00
Sabrina Dubroca
7ce7a5f06c ipv6: make ECMP route replacement less greedy
am: 4a8d3bb73a

Change-Id: I4ad550999f8823f3b895e001bfc6407dd99cb01b
2017-03-22 12:00:24 +00:00
David Ahern
8b173e509d mpls: Do not decrement alive counter for unregister events
am: 87c0286a07

Change-Id: Ia6628475db31d2e13a71a7f2f2eac26cecb6db58
2017-03-22 12:00:13 +00:00
David Ahern
7e57f7ceb6 mpls: Send route delete notifications when router module is unloaded
am: b61206e253

Change-Id: I8ea312c623d90e7f0e5e163048117067ab3c91f3
2017-03-22 12:00:04 +00:00
Etienne Noss
97097b23df act_connmark: avoid crashing on malformed nlattrs with null parms
am: 47c8dc47c0

Change-Id: Id90f1df9017b4c441658827c7b31b9f141498ad5
2017-03-22 11:59:55 +00:00
Dmitry V. Levin
324876828b uapi: fix linux/packet_diag.h userspace compilation error
am: ccb65adc6c

Change-Id: I83ab2f6c544a4de2912cbc65cec776aefa46bdce
2017-03-22 11:59:46 +00:00
Paolo Abeni
eb0517198c net/tunnel: set inner protocol in network gro hooks
am: b07eed8f71

Change-Id: Ie756dda34329d2c49e000e881c141449bcf0f3c1
2017-03-22 11:59:36 +00:00
David Ahern
036a0009bd vrf: Fix use-after-free in vrf_xmit
am: db6e779618

Change-Id: I10260107581ce24ff33a51d4b0f6ebfaf8012ca0
2017-03-22 11:59:26 +00:00
Eric Dumazet
4d5de05e03 dccp: fix use-after-free in dccp_feat_activate_values
am: 7c0eaeec84

Change-Id: I2dd8d59ff4042ff3a2452afdd77a02020263da6c
2017-03-22 11:59:15 +00:00
Alexey Khoroshilov
e7828ad52e net/sched: act_skbmod: remove unneeded rcu_read_unlock in tcf_skbmod_dump
am: 5f79aab41d

Change-Id: I007c849ee59abde3d88abd28e15eb7bd1db2fc02
2017-03-22 11:59:05 +00:00
Eric Dumazet
f99d227704 net: fix socket refcounting in skb_complete_tx_timestamp()
am: f157cc1d72

Change-Id: Ib17c80b08cd1aef7e1df9831ecfe3f75c42a5935
2017-03-22 11:58:55 +00:00
Eric Dumazet
af1d708c38 net: fix socket refcounting in skb_complete_wifi_ack()
am: 98fa3d2a8e

Change-Id: Ifa1377176961d3e38034a5aaa4f50e170f3111a7
2017-03-22 11:58:44 +00:00
Eric Dumazet
4d30eeb583 tcp: fix various issues for sockets morphing to listen state
am: 07753bc6a2

Change-Id: Iaa47a7c68e8637d092e2167d71325d7bad0aca78
2017-03-22 11:58:34 +00:00
WANG Cong
76f6a37cd4 strparser: destroy workqueue on module exit
am: 4547f03d1a

Change-Id: Ic7ab85b64a43fa395a431d43c547eb290da7320a
2017-03-22 11:58:26 +00:00
Arnaldo Carvalho de Melo
9980cc21e5 dccp: Unlock sock before calling sk_free()
am: 51ae1fbcf1

Change-Id: I2f51c7e0ac3dbcd91e4f0a6a2d2701d16b4daa98
2017-03-22 11:58:17 +00:00
Eric Dumazet
f51c4101f6 ipv6: orphan skbs in reassembly unit
am: 0bcc319d55

Change-Id: Idaa732740884af5b6f7273d813b431250953a439
2017-03-22 11:58:08 +00:00
Eric Dumazet
2fd730d552 net: net_enable_timestamp() can be called from irq contexts
am: 3d87dce3df

Change-Id: Ib4161ed12db4e8e0b826c2d9c87f744f4eed9a3a
2017-03-22 11:57:58 +00:00
Alexander Potapenko
ca2c57a3f0 net: don't call strlen() on the user buffer in packet_bind_spkt()
am: 62fe0521fb

Change-Id: Ibaeafd070ed3914db3f5e208ea1e06a4741afde2
2017-03-22 11:57:49 +00:00
Mike Manning
61a8ace19b net: bridge: allow IPv6 when multicast flood is disabled
am: fa7c48fb3a

Change-Id: I5bbedf52bb3722528cb1fcab86751d6e2ba20269
2017-03-22 11:57:40 +00:00
Eric Dumazet
a107e41eb5 tcp/dccp: block BH for SYN processing
am: bbaeb9b73f

Change-Id: I5c94cc9374b969fe509b0922d3ddd0a119e5e9ec
2017-03-22 11:57:29 +00:00
Ido Schimmel
965f701bbc mlxsw: spectrum_router: Avoid potential packets loss
am: 8f4db60c7f

Change-Id: I8f963c33b6f672e06fa25e49efe80df9ffa9eb2e
2017-03-22 11:57:21 +00:00
Jakub Kicinski
acd63a918d geneve: lock RCU on TX path
am: 02595f4725

Change-Id: If14cf1ffc0909614eb240e44235d1211fd460cb8
2017-03-22 11:57:13 +00:00
Jakub Kicinski
14d3ccd4de vxlan: lock RCU on TX path
am: 0a40da4a74

Change-Id: Idd0aff0df07b5a0052482cce4854584c8d592de0
2017-03-22 11:57:04 +00:00
Florian Fainelli
d0ae0e0640 net: phy: Avoid deadlock during phy_error()
am: feaa5bab43

Change-Id: I5698aaec3dc28e69f88860c762d47cf554977bfe
2017-03-22 11:56:55 +00:00
Paul Hber
6a3a773418 l2tp: avoid use-after-free caused by l2tp_ip_backlog_recv
am: 837786cbbb

Change-Id: I50cc6eec703138b7b7e9163ae7424f541947be1c
2017-03-22 11:56:46 +00:00
Roman Mashak
a6f9e55836 net sched actions: decrement module reference count after table flush.
am: 063893e4ec

Change-Id: Ifa57da1167a2f524970c46df8ad3618279b6d343
2017-03-22 11:56:38 +00:00
Julian Anastasov
9bd18b379a ipv4: mask tos for input route
am: 36931eb015

Change-Id: Ib906004640e0fb5e597266ef0a3b584e300c2e5d
2017-03-22 11:56:29 +00:00
Brian Russell
c5d8f64447 vxlan: don't allow overwrite of config src addr
am: a64407fafe

Change-Id: Ife8444909be44dbd1536c557bcc907034c406123
2017-03-22 11:56:20 +00:00
David Forster
dc327756f2 vti6: return GRE_KEY for vti6
am: f7081057d1

Change-Id: I2dc004c172148c3bd51fe617b209ba41d981e145
2017-03-22 11:56:11 +00:00
Matthias Schiffer
1d1ee5c300 vxlan: correctly validate VXLAN ID against VXLAN_N_VID
am: ee2da79de2

Change-Id: I584dd8ee361b92e09984a4220c74764dd16680d5
2017-03-22 11:56:02 +00:00
Tariq Toukan
2ce0127671 net/mlx5e: Fix wrong CQE decompression
am: 0c6e38e791

Change-Id: I547e5fb461f355033cc54dc43f13c9134eb9541f
2017-03-22 11:55:52 +00:00
Tariq Toukan
f74ef7b729 net/mlx5e: Do not reduce LRO WQE size when not using build_skb
am: a633266469

Change-Id: Idbfaac84a7970752c04269afb6251b810ae87f3e
2017-03-22 11:55:44 +00:00
Saeed Mahameed
fa5eb531a3 net/mlx5e: Register/unregister vport representors on interface attach/detach
am: 9e354abf9c

Change-Id: I40452a902e006787009549e820e1df90ec6c55ae
2017-03-22 11:55:34 +00:00
Dan Streetman
4b40611a9b xen: do not re-use pirq number cached in pci device msi msg data
[ Upstream commit c74fd80f2f ]

Revert the main part of commit:
af42b8d12f ("xen: fix MSI setup and teardown for PV on HVM guests")

That commit introduced reading the pci device's msi message data to see
if a pirq was previously configured for the device's msi/msix, and re-use
that pirq.  At the time, that was the correct behavior.  However, a
later change to Qemu caused it to call into the Xen hypervisor to unmap
all pirqs for a pci device, when the pci device disables its MSI/MSIX
vectors; specifically the Qemu commit:
c976437c7dba9c7444fb41df45468968aaa326ad
("qemu-xen: free all the pirqs for msi/msix when driver unload")

Once Qemu added this pirq unmapping, it was no longer correct for the
kernel to re-use the pirq number cached in the pci device msi message
data.  All Qemu releases since 2.1.0 contain the patch that unmaps the
pirqs when the pci device disables its MSI/MSIX vectors.

This bug is causing failures to initialize multiple NVMe controllers
under Xen, because the NVMe driver sets up a single MSIX vector for
each controller (concurrently), and then after using that to talk to
the controller for some configuration data, it disables the single MSIX
vector and re-configures all the MSIX vectors it needs.  So the MSIX
setup code tries to re-use the cached pirq from the first vector
for each controller, but the hypervisor has already given away that
pirq to another controller, and its initialization fails.

This is discussed in more detail at:
https://lists.xen.org/archives/html/xen-devel/2017-01/msg00447.html

Fixes: af42b8d12f ("xen: fix MSI setup and teardown for PV on HVM guests")
Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-22 12:43:35 +01:00
Krister Johansen
2382c1486c dmaengine: iota: ioat_alloc_chan_resources should not perform sleeping allocations.
commit 21d25f6a42 upstream.

On a kernel with DEBUG_LOCKS, ioat_free_chan_resources triggers an
in_interrupt() warning.  With PROVE_LOCKING, it reports detecting a
SOFTIRQ-safe to SOFTIRQ-unsafe lock ordering in the same code path.

This is because dma_generic_alloc_coherent() checks if the GFP flags
permit blocking.  It allocates from different subsystems if blocking is
permitted.  The free path knows how to return the memory to the correct
allocator.  If GFP_KERNEL is specified then the alloc and free end up
going through cma_alloc(), which uses mutexes.

Given that ioat_free_chan_resources() can be called in interrupt
context, ioat_alloc_chan_resources() must specify GFP_NOWAIT so that the
allocations do not block and instead use an allocator that uses
spinlocks.

Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-22 12:43:35 +01:00
Daniel Borkmann
0e0f1d6fdb bpf: fix mark_reg_unknown_value for spilled regs on map value marking
[ Upstream commit 6760bf2ddd ]

Martin reported a verifier issue that hit the BUG_ON() for his
test case in the mark_reg_unknown_value() function:

  [  202.861380] kernel BUG at kernel/bpf/verifier.c:467!
  [...]
  [  203.291109] Call Trace:
  [  203.296501]  [<ffffffff811364d5>] mark_map_reg+0x45/0x50
  [  203.308225]  [<ffffffff81136558>] mark_map_regs+0x78/0x90
  [  203.320140]  [<ffffffff8113938d>] do_check+0x226d/0x2c90
  [  203.331865]  [<ffffffff8113a6ab>] bpf_check+0x48b/0x780
  [  203.343403]  [<ffffffff81134c8e>] bpf_prog_load+0x27e/0x440
  [  203.355705]  [<ffffffff8118a38f>] ? handle_mm_fault+0x11af/0x1230
  [  203.369158]  [<ffffffff812d8188>] ? security_capable+0x48/0x60
  [  203.382035]  [<ffffffff811351a4>] SyS_bpf+0x124/0x960
  [  203.393185]  [<ffffffff810515f6>] ? __do_page_fault+0x276/0x490
  [  203.406258]  [<ffffffff816db320>] entry_SYSCALL_64_fastpath+0x13/0x94

This issue got uncovered after the fix in a08dd0da53 ("bpf: fix
regression on verifier pruning wrt map lookups"). The reason why it
wasn't noticed before was, because as mentioned in a08dd0da53,
mark_map_regs() was doing the id matching incorrectly based on the
uncached regs[regno].id. So, in the first loop, we walked all regs
and as soon as we found regno == i, then this reg's id was cleared
when calling mark_reg_unknown_value() thus that every subsequent
register was probed against id of 0 (which, in combination with the
PTR_TO_MAP_VALUE_OR_NULL type is an invalid condition that no other
register state can hold), and therefore wasn't type transitioned such
as in the spilled register case for the second loop.

Now since that got fixed, it turned out that 57a09bf0a4 ("bpf:
Detect identical PTR_TO_MAP_VALUE_OR_NULL registers") used
mark_reg_unknown_value() incorrectly for the spilled regs, and thus
hitting the BUG_ON() in some cases due to regno >= MAX_BPF_REG.

Although spilled regs have the same type as the non-spilled regs
for the verifier state, that is, struct bpf_reg_state, they are
semantically different from the non-spilled regs. In other words,
there can be up to 64 (MAX_BPF_STACK / BPF_REG_SIZE) spilled regs
in the stack, for example, register R<x> could have been spilled by
the program to stack location X, Y, Z, and in mark_map_regs() we
need to scan these stack slots of type STACK_SPILL for potential
registers that we have to transition from PTR_TO_MAP_VALUE_OR_NULL.
Therefore, depending on the location, the spilled_regs regno can
be a lot higher than just MAX_BPF_REG's value since we operate on
stack instead. The reset in mark_reg_unknown_value() itself is
just fine, only that the BUG_ON() was inappropriate for this. Fix
it by making a __mark_reg_unknown_value() version that can be
called from mark_map_reg() generically; we know for the non-spilled
case that the regno is always < MAX_BPF_REG anyway.

Fixes: 57a09bf0a4 ("bpf: Detect identical PTR_TO_MAP_VALUE_OR_NULL registers")
Reported-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-22 12:43:35 +01:00
Daniel Borkmann
1889d6d9b5 bpf: fix regression on verifier pruning wrt map lookups
[ Upstream commit a08dd0da53 ]

Commit 57a09bf0a4 ("bpf: Detect identical PTR_TO_MAP_VALUE_OR_NULL
registers") introduced a regression where existing programs stopped
loading due to reaching the verifier's maximum complexity limit,
whereas prior to this commit they were loading just fine; the affected
program has roughly 2k instructions.

What was found is that state pruning couldn't be performed effectively
anymore due to mismatches of the verifier's register state, in particular
in the id tracking. It doesn't mean that 57a09bf0a4 is incorrect per
se, but rather that verifier needs to perform a lot more work for the
same program with regards to involved map lookups.

Since commit 57a09bf0a4 is only about tracking registers with type
PTR_TO_MAP_VALUE_OR_NULL, the id is only needed to follow registers
until they are promoted through pattern matching with a NULL check to
either PTR_TO_MAP_VALUE or UNKNOWN_VALUE type. After that point, the
id becomes irrelevant for the transitioned types.

For UNKNOWN_VALUE, id is already reset to 0 via mark_reg_unknown_value(),
but not so for PTR_TO_MAP_VALUE where id is becoming stale. It's even
transferred further into other types that don't make use of it. Among
others, one example is where UNKNOWN_VALUE is set on function call
return with RET_INTEGER return type.

states_equal() will then fall through the memcmp() on register state;
note that the second memcmp() uses offsetofend(), so the id is part of
that since d2a4dd37f6 ("bpf: fix state equivalence"). But the bisect
pointed already to 57a09bf0a4, where we really reach beyond complexity
limit. What I found was that states_equal() often failed in this
case due to id mismatches in spilled regs with registers in type
PTR_TO_MAP_VALUE. Unlike non-spilled regs, spilled regs just perform
a memcmp() on their reg state and don't have any other optimizations
in place, therefore also id was relevant in this case for making a
pruning decision.

We can safely reset id to 0 as well when converting to PTR_TO_MAP_VALUE.
For the affected program, it resulted in a ~17 fold reduction of
complexity and let the program load fine again. Selftest suite also
runs fine. The only other place where env->id_gen is used currently is
through direct packet access, but for these cases id is long living, thus
a different scenario.

Also, the current logic in mark_map_regs() is not fully correct when
marking NULL branch with UNKNOWN_VALUE. We need to cache the destination
reg's id in any case. Otherwise, once we marked that reg as UNKNOWN_VALUE,
it's id is reset and any subsequent registers that hold the original id
and are of type PTR_TO_MAP_VALUE_OR_NULL won't be marked UNKNOWN_VALUE
anymore, since mark_map_reg() reuses the uncached regs[regno].id that
was just overridden. Note, we don't need to cache it outside of
mark_map_regs(), since it's called once on this_branch and the other
time on other_branch, which are both two independent verifier states.
A test case for this is added here, too.

Fixes: 57a09bf0a4 ("bpf: Detect identical PTR_TO_MAP_VALUE_OR_NULL registers")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-22 12:43:35 +01:00
Alexei Starovoitov
b7f5aa1ca0 bpf: fix state equivalence
[ Upstream commit d2a4dd37f6 ]

Commmits 57a09bf0a4 ("bpf: Detect identical PTR_TO_MAP_VALUE_OR_NULL registers")
and 484611357c ("bpf: allow access into map value arrays") by themselves
are correct, but in combination they make state equivalence ignore 'id' field
of the register state which can lead to accepting invalid program.

Fixes: 57a09bf0a4 ("bpf: Detect identical PTR_TO_MAP_VALUE_OR_NULL registers")
Fixes: 484611357c ("bpf: allow access into map value arrays")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-22 12:43:35 +01:00
Thomas Graf
1411707acb bpf: Detect identical PTR_TO_MAP_VALUE_OR_NULL registers
[ Upstream commit 57a09bf0a4 ]

A BPF program is required to check the return register of a
map_elem_lookup() call before accessing memory. The verifier keeps
track of this by converting the type of the result register from
PTR_TO_MAP_VALUE_OR_NULL to PTR_TO_MAP_VALUE after a conditional
jump ensures safety. This check is currently exclusively performed
for the result register 0.

In the event the compiler reorders instructions, BPF_MOV64_REG
instructions may be moved before the conditional jump which causes
them to keep their type PTR_TO_MAP_VALUE_OR_NULL to which the
verifier objects when the register is accessed:

0: (b7) r1 = 10
1: (7b) *(u64 *)(r10 -8) = r1
2: (bf) r2 = r10
3: (07) r2 += -8
4: (18) r1 = 0x59c00000
6: (85) call 1
7: (bf) r4 = r0
8: (15) if r0 == 0x0 goto pc+1
 R0=map_value(ks=8,vs=8) R4=map_value_or_null(ks=8,vs=8) R10=fp
9: (7a) *(u64 *)(r4 +0) = 0
R4 invalid mem access 'map_value_or_null'

This commit extends the verifier to keep track of all identical
PTR_TO_MAP_VALUE_OR_NULL registers after a map_elem_lookup() by
assigning them an ID and then marking them all when the conditional
jump is observed.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-22 12:43:35 +01:00
Hannes Frederic Sowa
9e38375a4b dccp: fix memory leak during tear-down of unsuccessful connection request
[ Upstream commit 72ef9c4125 ]

This patch fixes a memory leak, which happens if the connection request
is not fulfilled between parsing the DCCP options and handling the SYN
(because e.g. the backlog is full), because we forgot to free the
list of ack vectors.

Reported-by: Jianwen Ji <jiji@redhat.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-22 12:43:35 +01:00