Commit Graph

862781 Commits

Author SHA1 Message Date
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
XiaoDong Huang
c75258fee8 arm64: dts: rockchip: rk3568: add rockchip-suspend node
Change-Id: I1b298724bdcb527c91a5fc2656590865730539bb
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2021-01-26 19:29:40 +08:00
XiaoDong Huang
4485e65cb4 soc: rockchip: support rk3568 pm config
Change-Id: I800cfe6a34d06085d194ec27a5708837c06ac027
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2021-01-26 19:29:40 +08:00
XiaoDong Huang
ab7f089cfa soc: rockchip: pm-config: support mem_lite/mem_ultra config
Change-Id: I6086e8cd94d0b1d96bcc92fee5050b23a910b163
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2021-01-26 19:29:40 +08:00
XiaoDong Huang
362667b0e3 PM / sleep: support mem_lite/mem_ultra mode
Change-Id: Iab2e11a2f63b1a3f38c1c9b6c4b675ee2660f244
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2021-01-26 19:29:35 +08:00
Jianhui Wang
23de275f5e soc: rockchip: system_monitor: add ddr devfreq callback for eink
Signed-off-by: Jianhui Wang <wjh@rock-chips.com>
Change-Id: I832be44e594942d854e75aca4e4075659e5c5fdc
2021-01-26 18:48:51 +08:00
Jianhui Wang
a99d9117ce arm64: dts: rockchip: rk3566-eink: Optimize the power consumption
Signed-off-by: Jianhui Wang <wjh@rock-chips.com>
Change-Id: I15948c95a841cfd9ba89248c7bf03e19a5139434
2021-01-26 18:47:45 +08:00
Cai YiWei
2ae52f15a0 media: rockchip: isp: fix array overflow
Fixes: 5358e9d0b6 ("media: rockchip: isp: 64 align y size for fbcgain format")
Change-Id: Ic73e28ade0800562eeca1863277dc414c85e49d6
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
2021-01-26 17:57:46 +08:00
Allon Huang
474c2aa03d drivers: media: platform: rockchip: cif: restruct cif reset monitor
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: Iec0b8499f4a3da086421bc7ab28566bb27ca6aa8
Signed-off-by: Vicent Chi <vicent.chi@rock-chips.com>
2021-01-26 14:19:14 +08:00
Shawn Lin
d7c0bd4acd phy: phy-rockchip-snps-pcie3: Remove unused reset signal
We have move p30x1 and p30x2 reset signal to corresponding
controller drivers. So we need to remove them in PHY driver
in order not to add misleading debug message.

Change-Id: I5f180bf51a449ce2db6c49f937d3898a61d7c4d9
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-01-26 14:09:04 +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
Zorro Liu
9de289947d arm64: dts: rockchip: rk3566-eink: add int pin for tps65185
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
Change-Id: I923d0441d9155d477e742b54e4f66a0060be77ef
2021-01-26 09:19:57 +08:00
Zorro Liu
d53a8a4015 drm/rockchip: ebc_dev: tps68185: add int to do power err
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
Change-Id: I09ec350480a9d61549b3cc72aeb69281255d299e
2021-01-26 09:19:17 +08:00
William Wu
b41682e5e7 usb: dwc3: core: do gadget exit when drd init fails during probe
If it fails to do dwc3_drd_init() during probe, call the
dwc3_gadget_exit() to release the gadget resource when
the flag dwc->en_runtime is enabled.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: I12903841db4d83a7811b7e05d0a950932b4d3085
2021-01-26 09:17:43 +08: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
Sandy Huang
53491bd312 drm/rockchip: vop2: alpha_cal_mode use ALPHA_NO_SATURATION is better
set Ad0" = Ad0_" to instead of Ad0" = Ad0_" + (Ad0_" >> 7), than VOP
some alpha result is same with GPU output.

Change-Id: If05f561c16b4eb6e46671f4a130fae0fe50191c2
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2021-01-25 20:25:25 +08:00
Andy Yan
49eae01a53 drm/rockchip: vop2: Set wb_axi_yrgb/uv id
Set wb_axi_yrgb_id to 0xd
set wb_axi_uv_id to 0xe

Change-Id: Ie8188c2c307d2167ea237b4a176b03cfdab73792
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2021-01-25 19:25:07 +08:00
Sandy Huang
38db9d9604 drm/rockchip: vop2: update for alpha config
Change-Id: Idf269d18464108bbe5e340bd8b34183e8e4716f9
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2021-01-25 17:34:15 +08:00
Huang zhibao
acfeb3f707 ARM: dts: rv1126: uvc: fix cpll to 491520000
Signed-off-by: Huang zhibao <hzb@rock-chips.com>
Change-Id: Ibd6df2bbcb24ea5ba72c40a8146d8a6d1c3e32a7
2021-01-25 15:50:03 +08:00
Shunqing Chen
0eae5a230c arm64: dts: rockchip: rk3566-rk817-eink-w103: add low power sleep support
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: Ie3ca658f3e7a774515b67c6affafede86f10ff89
2021-01-25 15:22:11 +08:00
Shunqing Chen
9c3442728c arm64: dts: rockchip: rk3566-rk817-eink-w6: add low power sleep support
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: If93766f70889e59453f0c6c11c0f28769032912c
2021-01-25 15:22:05 +08:00
Shunqing Chen
ff9607fe94 power: rk817-battery: Add low power support in suspend
Some platforms (such as Eink) during suspend the current
is very low (low than 2Ma), if long time to sleep, it will
cause the dsoc to drain faster.

Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: I25330a3a79f9684487bea0f523d97d61b8098e8a
2021-01-25 15:21:45 +08:00
Yandong Lin
29f57122a3 video: rockchip: mpp: Fix irq state err.
Set handled state, only when a valid irq

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I0db013066c795dc2d5ae896e84dc23c42026aabf
2021-01-25 15:18:50 +08:00
Shawn Lin
a9bdf904a0 PCI: rockchip: Disable ltssm after waiting for L2 handshake
We should not disable it before L2, otherwise all L2 transaction
event would be lost for RC side, leading to unstable L2 link stage.

Change-Id: Ia87f8749d4a0acc9aeb1215682209c853672a84d
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-01-25 11:27:46 +08:00
Yu Qiaowei
2d6a3e38e1 video/rockchip: rga2: Modify the judgment of first req.
Fixed the error that color fill would cause "req argument is inval".

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: I94ebfc2061f16916813a0d85630f8a9862728b0e
2021-01-25 10:57:41 +08:00
Yu Qiaowei
93e6da0968 video/rockchip: rga2: Fix a crash cause by rga timeout.
Because update_patten_buff_mode is not currently used,
it is removed.

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: I48c97e75d27d475eee528ed6c838c67fdaa430f8
2021-01-25 10:57:31 +08: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