Commit Graph

804270 Commits

Author SHA1 Message Date
Paul Lawrence
f461a8a77a Revert "ANDROID: Incremental fs: Allow running a single test"
This reverts commit aab713422e.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ie48159cd19e3c4b686d6187482ab93ad46846e91
2021-01-26 13:31:14 -08:00
Paul Lawrence
eb9260053f Revert "ANDROID: Incremental fs: Fix incfs to work on virtio-9p"
This reverts commit abe35abbf0.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Id03aeccb6676d51ee5f27d78541ca4c19510f595
2021-01-26 13:31:13 -08:00
Paul Lawrence
ccb9435403 Revert "ANDROID: Incremental fs: Don't allow renaming .index directory."
This reverts commit 85e158e3e1.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Id119ffb4da700bd28baad5c303a6369311b2b3f5
2021-01-26 13:31:12 -08:00
Paul Lawrence
6fe44a54fa Revert "ANDROID: Incremental fs: Create mapped file"
This reverts commit 0eae0d2704.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ic8e2c2b8b0bcbc2df620cb7a3ded3d0df93f3f29
2021-01-26 13:31:12 -08:00
Paul Lawrence
a7538ee772 Revert "ANDROID: Incremental fs: Add UID to pending_read"
This reverts commit 20ec909ffb.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ia8678769daa8d993cd11a45fad84a5fd7d249c3e
2021-01-26 13:31:11 -08:00
Paul Lawrence
3e485e3161 Revert "ANDROID: Incremental fs: Separate pseudo-file code"
This reverts commit 9577751233.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I64ded1a7dff46658e1cefe9738327e8db75f2abc
2021-01-26 13:31:11 -08:00
Paul Lawrence
e0ec295d60 Revert "ANDROID: Incremental fs: Add .blocks_written file"
This reverts commit b7fb6bb4c0.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I97d9e1766294002685eb5ab3dec843496bc47a51
2021-01-26 13:31:10 -08:00
Paul Lawrence
ed5fc9b069 Revert "ANDROID: Incremental fs: Remove attributes from file"
This reverts commit 37436094c8.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ifb78100c507a1f78eda0962e13c068118f87402e
2021-01-26 13:31:10 -08:00
Paul Lawrence
b0b6129436 Revert "ANDROID: Incremental fs: Remove back links and crcs"
This reverts commit 63702b82a4.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I5bc2dd1bf59f98accc866c7a3b2a6d436a96b7a0
2021-01-26 13:31:09 -08:00
Paul Lawrence
975cb23bb8 Revert "ANDROID: Incremental fs: Remove block HASH flag"
This reverts commit 8ac8eb342e.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I58d91c7b2cd32de30bdf02cea2ffbcdc9947456a
2021-01-26 13:31:08 -08:00
Paul Lawrence
85a2003755 Revert "ANDROID: Incremental fs: Make compatible with existing files"
This reverts commit dfbe6ee141.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I9f47de728c72315be3db9a9b6e40108835b90282
2021-01-26 13:31:08 -08:00
Paul Lawrence
26988c4722 Revert "ANDROID: Incremental fs: Add INCFS_IOC_GET_BLOCK_COUNT"
This reverts commit 1652f2647e.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ifdbdbffee413a16e8c222da60a371ac95797501a
2021-01-26 13:31:07 -08:00
Paul Lawrence
dd42a10714 Revert "ANDROID: Incremental fs: Add hash block counts to IOC_IOCTL_GET_BLOCK_COUNT"
This reverts commit 837bf5a401.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I66251f68e82e90cf4ca5823f41a733696434f0b5
2021-01-26 13:31:07 -08:00
Paul Lawrence
2f9d5f81ae Revert "ANDROID: Incremental fs: Fix filled block count from get filled blocks"
This reverts commit 29e40c29df.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I4587d44b5baa59a879e8ab42ab65bb70ade086ed
2021-01-26 13:31:06 -08:00
Paul Lawrence
0499239948 Revert "ANDROID: Incremental fs: Fix uninitialized variable"
This reverts commit 45598888d8.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Id4f4e30a1b94adeadeebd9d734f15e0e2567cf0a
2021-01-26 13:31:06 -08:00
Paul Lawrence
b34943af9f Revert "ANDROID: Incremental fs: Fix dangling else"
This reverts commit a040750a76.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ie54e29dc84cd980d7ffafce75671ee3193a2a4c6
2021-01-26 13:31:05 -08:00
Paul Lawrence
4fc01aac7f Revert "ANDROID: Incremental fs: Add .incomplete folder"
This reverts commit 5b188fc353.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Icc3189af926bf815d8dc7ca337f2010ae59bbad1
2021-01-26 13:31:04 -08:00
Paul Lawrence
ee47ecc35e Revert "ANDROID: Incremental fs: Add per UID read timeouts"
This reverts commit c9704ce7c9.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ic89b180cf34b468885490a5586484a655465b887
2021-01-26 13:31:04 -08:00
Paul Lawrence
2eeb84fd87 Revert "ANDROID: Incremental fs: Fix misuse of cpu_to_leXX and poll return"
This reverts commit 6851a6dcf2.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I72978b9f3a5f1cf9e32817e72b6272e53f3f72d0
2021-01-26 13:31:03 -08:00
Paul Lawrence
b4bbf2b32a Revert "ANDROID: Incremental fs: Fix read_log_test which failed sporadically"
This reverts commit 38ef4a2294.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ia0b91821d3d75dfa5b5e43d7daf61ad3211dfce3
2021-01-26 13:31:03 -08:00
Paul Lawrence
a4ca48189f Revert "ANDROID: Incremental fs: Initialize mount options correctly"
This reverts commit 63ddad8bce.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Id80c83386b3fb37f48c625c1cd540b8a08a5c203
2021-01-26 13:31:02 -08:00
Paul Lawrence
199e5e4f5e Revert "ANDROID: Incremental fs: Small improvements"
This reverts commit 28520c784a.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I36f491264d82120bd3b996dd83ad810b060aee9e
2021-01-26 13:31:02 -08:00
Paul Lawrence
56c882a37d Revert "ANDROID: Incremental fs: Add zstd compression support"
This reverts commit 41a12dfcf5.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ic975a83f60a0e5e3b16079358a65c0ef333a4c81
2021-01-26 13:31:01 -08:00
Paul Lawrence
b30c199aff Revert "ANDROID: Incremental fs: Add zstd feature flag"
This reverts commit ea66b38152.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Idda973c1d6b5be43eee6130aa1de2e601b35ae75
2021-01-26 13:31:01 -08:00
Paul Lawrence
b53d5a21c8 Revert "ANDROID: Incremental fs: Add v2 feature flag"
This reverts commit 82e433b1dd.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I8628dd97b13e88efddd65addbf9a479bf853a6cb
2021-01-26 13:31:00 -08:00
Paul Lawrence
295c582dfd Revert "ANDROID: Incremental fs: Change per UID timeouts to microseconds"
This reverts commit c18f2a956e.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I9e62d66e47d76c619c1d3f4a4c2449d35300f3db
2021-01-26 13:30:59 -08:00
Paul Lawrence
07b4594142 Revert "ANDROID: Incremental fs: Fix incfs_test use of atol, open"
This reverts commit 9284eed39b.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I40f5416786e40bfb85c546bf508aac8d9f9dd0fb
2021-01-26 13:30:59 -08:00
Paul Lawrence
3033d71190 Revert "ANDROID: Incremental fs: Set credentials before reading/writing"
This reverts commit 2b82ff2dae.

Set incfs back to rvc shipping incfs

Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I77529835747d73a69907d0838ec35dee35fdde48
2021-01-26 13:30:58 -08:00
Alistair Delva
36fa4039e2 ANDROID: GKI: Update ABI for clang bump
Leaf changes summary: 0 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 0 Removed, 0 Added function symbol not referenced by debug info
Variable symbols changes summary: 0 Removed, 1 Added variable symbol not referenced by debug info

1 Added variable symbol not referenced by debug info:

  [A] jiffies

Bug: 176824850
Change-Id: Ie40321c0b38be2ca41c9bcaf56fa19a3c50fc363
Signed-off-by: Alistair Delva <adelva@google.com>
2021-01-26 04:20:20 +00:00
Alistair Delva
788594063c ANDROID: clang: update to 12.0.1
Bug: 176824850
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: I19ae68518af68caa99ed55b87e4e04c58ded9947
2021-01-26 04:20:13 +00:00
Nick Desaulniers
e9a55d9770 Revert "ANDROID: enable LLVM_IAS=1 for clang's integrated assembler for x86_64"
This reverts commit b009f0a1a7.

Bug: 178427746
Reason for revert: syscalls.nanosleep01_32bit#syscalls.nanosleep01_32bit failing

Change-Id: I0089e40fd8e3a6aa14649ba7838851f1e247fdf0
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2021-01-26 01:05:23 +00:00
Nick Desaulniers
b009f0a1a7 ANDROID: enable LLVM_IAS=1 for clang's integrated assembler for x86_64
Step 8 of:
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/BINUTILS_KERNEL_DEPRECATION.md

Bug: 141693040
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I9d1621f6484c0402a7518ffb12a3f8f3815f43a9
2021-01-25 20:06:57 +00:00
Greg Kroah-Hartman
d084fe8b5d Merge 4.19.170 into android-4.19-stable
Changes in 4.19.170
	usb: ohci: Make distrust_firmware param default to false
	compiler.h: Raise minimum version of GCC to 5.1 for arm64
	dm integrity: fix flush with external metadata device
	crypto: x86/crc32c - fix building with clang ias
	nfsd4: readdirplus shouldn't return parent of export
	udp: Prevent reuseport_select_sock from reading uninitialized socks
	netxen_nic: fix MSI/MSI-x interrupts
	net: mvpp2: Remove Pause and Asym_Pause support
	rndis_host: set proper input size for OID_GEN_PHYSICAL_MEDIUM request
	esp: avoid unneeded kmap_atomic call
	net: dcb: Validate netlink message in DCB handler
	net: dcb: Accept RTM_GETDCB messages carrying set-like DCB commands
	rxrpc: Call state should be read with READ_ONCE() under some circumstances
	net: stmmac: Fixed mtu channged by cache aligned
	net: sit: unregister_netdevice on newlink's error path
	net: avoid 32 x truesize under-estimation for tiny skbs
	rxrpc: Fix handling of an unsupported token type in rxrpc_read()
	tipc: fix NULL deref in tipc_link_xmit()
	net: introduce skb_list_walk_safe for skb segment walking
	net: skbuff: disambiguate argument and member for skb_list_walk_safe helper
	net: ipv6: Validate GSO SKB before finish IPv6 processing
	spi: cadence: cache reference clock rate during probe
	Linux 4.19.170

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4a12e49eae7097a468161952228c57c974a1b0ac
2021-01-23 16:13:31 +01:00
Greg Kroah-Hartman
2263955bf7 Linux 4.19.170
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Pavel Machek (CIP) <pavel@denx.de>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20210122135731.921636245@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:57 +01:00
Michael Hennerich
cfca01ab14 spi: cadence: cache reference clock rate during probe
commit 4d163ad79b upstream.

The issue is that using SPI from a callback under the CCF lock will
deadlock, since this code uses clk_get_rate().

Fixes: c474b38665 ("spi: Add driver for Cadence SPI controller")
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210114154217.51996-1-alexandru.ardelean@analog.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:57 +01:00
Aya Levin
394d9608da net: ipv6: Validate GSO SKB before finish IPv6 processing
[ Upstream commit b210de4f8c ]

There are cases where GSO segment's length exceeds the egress MTU:
 - Forwarding of a TCP GRO skb, when DF flag is not set.
 - Forwarding of an skb that arrived on a virtualisation interface
   (virtio-net/vhost/tap) with TSO/GSO size set by other network
   stack.
 - Local GSO skb transmitted on an NETIF_F_TSO tunnel stacked over an
   interface with a smaller MTU.
 - Arriving GRO skb (or GSO skb in a virtualised environment) that is
   bridged to a NETIF_F_TSO tunnel stacked over an interface with an
   insufficient MTU.

If so:
 - Consume the SKB and its segments.
 - Issue an ICMP packet with 'Packet Too Big' message containing the
   MTU, allowing the source host to reduce its Path MTU appropriately.

Note: These cases are handled in the same manner in IPv4 output finish.
This patch aligns the behavior of IPv6 and the one of IPv4.

Fixes: 9e50849054 ("netfilter: ipv6: move POSTROUTING invocation before fragmentation")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/1610027418-30438-1-git-send-email-ayal@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:57 +01:00
Jason A. Donenfeld
bae6277ad3 net: skbuff: disambiguate argument and member for skb_list_walk_safe helper
commit 5eee7bd7e2 upstream.

This worked before, because we made all callers name their next pointer
"next". But in trying to be more "drop-in" ready, the silliness here is
revealed. This commit fixes the problem by making the macro argument and
the member use different names.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
Jason A. Donenfeld
8e6f5a1d3b net: introduce skb_list_walk_safe for skb segment walking
commit dcfea72e79 upstream.

As part of the continual effort to remove direct usage of skb->next and
skb->prev, this patch adds a helper for iterating through the
singly-linked variant of skb lists, which are used for lists of GSO
packet. The name "skb_list_..." has been chosen to match the existing
function, "kfree_skb_list, which also operates on these singly-linked
lists, and the "..._walk_safe" part is the same idiom as elsewhere in
the kernel.

This patch removes the helper from wireguard and puts it into
linux/skbuff.h, while making it a bit more robust for general usage. In
particular, parenthesis are added around the macro argument usage, and it
now accounts for trying to iterate through an already-null skb pointer,
which will simply run the iteration zero times. This latter enhancement
means it can be used to replace both do { ... } while and while (...)
open-coded idioms.

This should take care of these three possible usages, which match all
current methods of iterations.

skb_list_walk_safe(segs, skb, next) { ... }
skb_list_walk_safe(skb, skb, next) { ... }
skb_list_walk_safe(segs, skb, segs) { ... }

Gcc appears to generate efficient code for each of these.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ Just the skbuff.h changes for backporting - gregkh]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
Hoang Le
4d1d3dddcb tipc: fix NULL deref in tipc_link_xmit()
[ Upstream commit b774134464 ]

The buffer list can have zero skb as following path:
tipc_named_node_up()->tipc_node_xmit()->tipc_link_xmit(), so
we need to check the list before casting an &sk_buff.

Fault report:
 [] tipc: Bulk publication failure
 [] general protection fault, probably for non-canonical [#1] PREEMPT [...]
 [] KASAN: null-ptr-deref in range [0x00000000000000c8-0x00000000000000cf]
 [] CPU: 0 PID: 0 Comm: swapper/0 Kdump: loaded Not tainted 5.10.0-rc4+ #2
 [] Hardware name: Bochs ..., BIOS Bochs 01/01/2011
 [] RIP: 0010:tipc_link_xmit+0xc1/0x2180
 [] Code: 24 b8 00 00 00 00 4d 39 ec 4c 0f 44 e8 e8 d7 0a 10 f9 48 [...]
 [] RSP: 0018:ffffc90000006ea0 EFLAGS: 00010202
 [] RAX: dffffc0000000000 RBX: ffff8880224da000 RCX: 1ffff11003d3cc0d
 [] RDX: 0000000000000019 RSI: ffffffff886007b9 RDI: 00000000000000c8
 [] RBP: ffffc90000007018 R08: 0000000000000001 R09: fffff52000000ded
 [] R10: 0000000000000003 R11: fffff52000000dec R12: ffffc90000007148
 [] R13: 0000000000000000 R14: 0000000000000000 R15: ffffc90000007018
 [] FS:  0000000000000000(0000) GS:ffff888037400000(0000) knlGS:000[...]
 [] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 [] CR2: 00007fffd2db5000 CR3: 000000002b08f000 CR4: 00000000000006f0

Fixes: af9b028e27 ("tipc: make media xmit call outside node spinlock context")
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Link: https://lore.kernel.org/r/20210108071337.3598-1-hoang.h.le@dektech.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
David Howells
d9364c8f03 rxrpc: Fix handling of an unsupported token type in rxrpc_read()
[ Upstream commit d52e419ac8 ]

Clang static analysis reports the following:

net/rxrpc/key.c:657:11: warning: Assigned value is garbage or undefined
                toksize = toksizes[tok++];
                        ^ ~~~~~~~~~~~~~~~

rxrpc_read() contains two consecutive loops.  The first loop calculates the
token sizes and stores the results in toksizes[] and the second one uses
the array.  When there is an error in identifying the token in the first
loop, the token is skipped, no change is made to the toksizes[] array.
When the same error happens in the second loop, the token is not skipped.
This will cause the toksizes[] array to be out of step and will overrun
past the calculated sizes.

Fix this by making both loops log a message and return an error in this
case.  This should only happen if a new token type is incompletely
implemented, so it should normally be impossible to trigger this.

Fixes: 9a059cd5ca ("rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read()")
Reported-by: Tom Rix <trix@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/161046503122.2445787.16714129930607546635.stgit@warthog.procyon.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
Eric Dumazet
669c0b5782 net: avoid 32 x truesize under-estimation for tiny skbs
[ Upstream commit 3226b158e6 ]

Both virtio net and napi_get_frags() allocate skbs
with a very small skb->head

While using page fragments instead of a kmalloc backed skb->head might give
a small performance improvement in some cases, there is a huge risk of
under estimating memory usage.

For both GOOD_COPY_LEN and GRO_MAX_HEAD, we can fit at least 32 allocations
per page (order-3 page in x86), or even 64 on PowerPC

We have been tracking OOM issues on GKE hosts hitting tcp_mem limits
but consuming far more memory for TCP buffers than instructed in tcp_mem[2]

Even if we force napi_alloc_skb() to only use order-0 pages, the issue
would still be there on arches with PAGE_SIZE >= 32768

This patch makes sure that small skb head are kmalloc backed, so that
other objects in the slab page can be reused instead of being held as long
as skbs are sitting in socket queues.

Note that we might in the future use the sk_buff napi cache,
instead of going through a more expensive __alloc_skb()

Another idea would be to use separate page sizes depending
on the allocated length (to never have more than 4 frags per page)

I would like to thank Greg Thelen for his precious help on this matter,
analysing crash dumps is always a time consuming task.

Fixes: fd11a83dd3 ("net: Pull out core bits of __netdev_alloc_skb and add __napi_alloc_skb")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20210113161819.1155526-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
Jakub Kicinski
11e36dcef4 net: sit: unregister_netdevice on newlink's error path
[ Upstream commit 47e4bb147a ]

We need to unregister the netdevice if config failed.
.ndo_uninit takes care of most of the heavy lifting.

This was uncovered by recent commit c269a24ce0 ("net: make
free_netdev() more lenient with unregistering devices").
Previously the partially-initialized device would be left
in the system.

Reported-and-tested-by: syzbot+2393580080a2da190f04@syzkaller.appspotmail.com
Fixes: e2f1f072db ("sit: allow to configure 6rd tunnels via netlink")
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Link: https://lore.kernel.org/r/20210114012947.2515313-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
David Wu
594711af9f net: stmmac: Fixed mtu channged by cache aligned
[ Upstream commit 5b55299eed ]

Since the original mtu is not used when the mtu is updated,
the mtu is aligned with cache, this will get an incorrect.
For example, if you want to configure the mtu to be 1500,
but mtu 1536 is configured in fact.

Fixed: eaf4fac478 ("net: stmmac: Do not accept invalid MTU values")
Signed-off-by: David Wu <david.wu@rock-chips.com>
Link: https://lore.kernel.org/r/20210113034109.27865-1-david.wu@rock-chips.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
Baptiste Lepers
6b676c4bd0 rxrpc: Call state should be read with READ_ONCE() under some circumstances
[ Upstream commit a95d25dd7b ]

The call state may be changed at any time by the data-ready routine in
response to received packets, so if the call state is to be read and acted
upon several times in a function, READ_ONCE() must be used unless the call
state lock is held.

As it happens, we used READ_ONCE() to read the state a few lines above the
unmarked read in rxrpc_input_data(), so use that value rather than
re-reading it.

Fixes: a158bdd324 ("rxrpc: Fix call timeouts")
Signed-off-by: Baptiste Lepers <baptiste.lepers@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/161046715522.2450566.488819910256264150.stgit@warthog.procyon.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
Petr Machata
5fd803e108 net: dcb: Accept RTM_GETDCB messages carrying set-like DCB commands
[ Upstream commit df85bc140a ]

In commit 826f328e2b ("net: dcb: Validate netlink message in DCB
handler"), Linux started rejecting RTM_GETDCB netlink messages if they
contained a set-like DCB_CMD_ command.

The reason was that privileges were only verified for RTM_SETDCB messages,
but the value that determined the action to be taken is the command, not
the message type. And validation of message type against the DCB command
was the obvious missing piece.

Unfortunately it turns out that mlnx_qos, a somewhat widely deployed tool
for configuration of DCB, accesses the DCB set-like APIs through
RTM_GETDCB.

Therefore do not bounce the discrepancy between message type and command.
Instead, in addition to validating privileges based on the actual message
type, validate them also based on the expected message type. This closes
the loophole of allowing DCB configuration on non-admin accounts, while
maintaining backward compatibility.

Fixes: 2f90b8657e ("ixgbe: this patch adds support for DCB to the kernel and ixgbe driver")
Fixes: 826f328e2b ("net: dcb: Validate netlink message in DCB handler")
Signed-off-by: Petr Machata <petrm@nvidia.com>
Link: https://lore.kernel.org/r/a3edcfda0825f2aa2591801c5232f2bbf2d8a554.1610384801.git.me@pmachata.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
Petr Machata
3997f963f1 net: dcb: Validate netlink message in DCB handler
[ Upstream commit 826f328e2b ]

DCB uses the same handler function for both RTM_GETDCB and RTM_SETDCB
messages. dcb_doit() bounces RTM_SETDCB mesasges if the user does not have
the CAP_NET_ADMIN capability.

However, the operation to be performed is not decided from the DCB message
type, but from the DCB command. Thus DCB_CMD_*_GET commands are used for
reading DCB objects, the corresponding SET and DEL commands are used for
manipulation.

The assumption is that set-like commands will be sent via an RTM_SETDCB
message, and get-like ones via RTM_GETDCB. However, this assumption is not
enforced.

It is therefore possible to manipulate DCB objects without CAP_NET_ADMIN
capability by sending the corresponding command in an RTM_GETDCB message.
That is a bug. Fix it by validating the type of the request message against
the type used for the response.

Fixes: 2f90b8657e ("ixgbe: this patch adds support for DCB to the kernel and ixgbe driver")
Signed-off-by: Petr Machata <me@pmachata.org>
Link: https://lore.kernel.org/r/a2a9b88418f3a58ef211b718f2970128ef9e3793.1608673640.git.me@pmachata.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:56 +01:00
Willem de Bruijn
d4ede0a453 esp: avoid unneeded kmap_atomic call
[ Upstream commit 9bd6b629c3 ]

esp(6)_output_head uses skb_page_frag_refill to allocate a buffer for
the esp trailer.

It accesses the page with kmap_atomic to handle highmem. But
skb_page_frag_refill can return compound pages, of which
kmap_atomic only maps the first underlying page.

skb_page_frag_refill does not return highmem, because flag
__GFP_HIGHMEM is not set. ESP uses it in the same manner as TCP.
That also does not call kmap_atomic, but directly uses page_address,
in skb_copy_to_page_nocache. Do the same for ESP.

This issue has become easier to trigger with recent kmap local
debugging feature CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP.

Fixes: cac2661c53 ("esp4: Avoid skb_cow_data whenever possible")
Fixes: 03e2a30f6a ("esp6: Avoid skb_cow_data whenever possible")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:55 +01:00
Andrey Zhizhikin
eaf0f23329 rndis_host: set proper input size for OID_GEN_PHYSICAL_MEDIUM request
[ Upstream commit e56b3d94d9 ]

MSFT ActiveSync implementation requires that the size of the response for
incoming query is to be provided in the request input length. Failure to
set the input size proper results in failed request transfer, where the
ActiveSync counterpart reports the NDIS_STATUS_INVALID_LENGTH (0xC0010014L)
error.

Set the input size for OID_GEN_PHYSICAL_MEDIUM query to the expected size
of the response in order for the ActiveSync to properly respond to the
request.

Fixes: 039ee17d1b ("rndis_host: Add RNDIS physical medium checking into generic_rndis_bind()")
Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Link: https://lore.kernel.org/r/20210108095839.3335-1-andrey.zhizhikin@leica-geosystems.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:55 +01:00
Stefan Chulski
ba739c7533 net: mvpp2: Remove Pause and Asym_Pause support
[ Upstream commit 6f83802a1a ]

Packet Processor hardware not connected to MAC flow control unit and
cannot support TX flow control.
This patch disable flow control support.

Fixes: 3f518509de ("ethernet: Add new driver for Marvell Armada 375 network unit")
Signed-off-by: Stefan Chulski <stefanc@marvell.com>
Acked-by: Marcin Wojtas <mw@semihalf.com>
Link: https://lore.kernel.org/r/1610306582-16641-1-git-send-email-stefanc@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:55 +01:00
Manish Chopra
cb95e031bc netxen_nic: fix MSI/MSI-x interrupts
[ Upstream commit a2bc221b97 ]

For all PCI functions on the netxen_nic adapter, interrupt
mode (INTx or MSI) configuration is dependent on what has
been configured by the PCI function zero in the shared
interrupt register, as these adapters do not support mixed
mode interrupts among the functions of a given adapter.

Logic for setting MSI/MSI-x interrupt mode in the shared interrupt
register based on PCI function id zero check is not appropriate for
all family of netxen adapters, as for some of the netxen family
adapters PCI function zero is not really meant to be probed/loaded
in the host but rather just act as a management function on the device,
which caused all the other PCI functions on the adapter to always use
legacy interrupt (INTx) mode instead of choosing MSI/MSI-x interrupt mode.

This patch replaces that check with port number so that for all
type of adapters driver attempts for MSI/MSI-x interrupt modes.

Fixes: b37eb210c0 ("netxen_nic: Avoid mixed mode interrupts")
Signed-off-by: Manish Chopra <manishc@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Link: https://lore.kernel.org/r/20210107101520.6735-1-manishc@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 15:49:55 +01:00