4.9.232-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.9.232-rc1 review
This is the start of the stable review cycle for the 4.9.232 release. There are 61 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 01 Aug 2020 07:44:05 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.232-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.232-rc1
Changbin Du <[email protected]>
perf: Make perf able to build with latest libbfd
Jiri Olsa <[email protected]>
perf tools: Fix snprint warnings for gcc 8
Arnaldo Carvalho de Melo <[email protected]>
perf annotate: Use asprintf when formatting objdump command line
Masami Hiramatsu <[email protected]>
perf probe: Fix to check blacklist address correctly
Eric Sandeen <[email protected]>
xfs: set format back to extents if xfs_bmap_extents_to_btree
Peng Fan <[email protected]>
regmap: debugfs: check count when read regmap file
Xie He <[email protected]>
drivers/net/wan/x25_asy: Fix to make it work
Wei Yongjun <[email protected]>
ip6_gre: fix null-ptr-deref in ip6gre_init_net()
Yuchung Cheng <[email protected]>
tcp: allow at most one TLP probe per flight
Dan Carpenter <[email protected]>
AX.25: Prevent integer overflows in connect and sendmsg
David Howells <[email protected]>
rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA
Miaohe Lin <[email protected]>
net: udp: Fix wrong clean up for IS_UDPLITE macro
Xiongfeng Wang <[email protected]>
net-sysfs: add a newline when printing 'tx_timeout' by sysfs
Subash Abhinov Kasiviswanathan <[email protected]>
dev: Defer free of skbs in flush_backlog
Peilin Ye <[email protected]>
AX.25: Prevent out-of-bounds read in ax25_sendmsg()
Peilin Ye <[email protected]>
AX.25: Fix out-of-bounds read in ax25_connect()
Mark O'Donovan <[email protected]>
ath9k: Fix regression with Atheros 9271
Qiujun Huang <[email protected]>
ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb
John David Anglin <[email protected]>
parisc: Add atomic64_set_release() define to avoid CPU soft lockups
Michael J. Ruhl <[email protected]>
io-mapping: indicate mapping failure
Hugh Dickins <[email protected]>
mm/memcg: fix refcount error while moving and swapping
Fangrui Song <[email protected]>
Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation
Tetsuo Handa <[email protected]>
vt: Reject zero-sized screen buffer size.
Serge Semin <[email protected]>
serial: 8250_mtk: Fix high-speed baud rates clamping
Yang Yingliang <[email protected]>
serial: 8250: fix null-ptr-deref in serial8250_start_tx()
Ian Abbott <[email protected]>
staging: comedi: addi_apci_1564: check INSN_CONFIG_DIGITAL_TRIG shift
Ian Abbott <[email protected]>
staging: comedi: addi_apci_1500: check INSN_CONFIG_DIGITAL_TRIG shift
Ian Abbott <[email protected]>
staging: comedi: ni_6527: fix INSN_CONFIG_DIGITAL_TRIG support
Ian Abbott <[email protected]>
staging: comedi: addi_apci_1032: check INSN_CONFIG_DIGITAL_TRIG shift
Rustam Kovhaev <[email protected]>
staging: wlan-ng: properly check endpoint types
Steve French <[email protected]>
Revert "cifs: Fix the target file was deleted when rename failed."
Forest Crossman <[email protected]>
usb: xhci: Fix ASM2142/ASM3142 DMA addressing
Chunfeng Yun <[email protected]>
usb: xhci-mtk: fix the failure of bandwidth allocation
Arnd Bergmann <[email protected]>
x86: math-emu: Fix up 'cmp' insn for clang ias
Will Deacon <[email protected]>
arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP
Evgeny Novikov <[email protected]>
usb: gadget: udc: gr_udc: fix memleak on error handling path in gr_ep_init()
Leonid Ravich <[email protected]>
dmaengine: ioat setting ioat timeout as module parameter
Marc Kleine-Budde <[email protected]>
regmap: dev_get_regmap_match(): fix string comparison
Dinghao Liu <[email protected]>
dmaengine: tegra210-adma: Fix runtime PM imbalance on error
Hans de Goede <[email protected]>
HID: apple: Disable Fn-key key-re-mapping on clone keyboards
Federico Ricchiuto <[email protected]>
HID: i2c-hid: add Mediacom FlexBook edge13 to descriptor override
Pi-Hsun Shih <[email protected]>
scripts/decode_stacktrace: strip basepath from all paths
Wang Hai <[email protected]>
net: smc91x: Fix possible memory leak in smc_drv_probe()
Sergey Organov <[email protected]>
net: dp83640: fix SIOCSHWTSTAMP to update the struct with actual configuration
George Kennedy <[email protected]>
ax88172a: fix ax88172a_unbind() failures
Christophe JAILLET <[email protected]>
hippi: Fix a size used in a 'pci_free_consistent()' in an error handling path
Vasundhara Volam <[email protected]>
bnxt_en: Fix race when modifying pause settings.
Boris Burkov <[email protected]>
btrfs: fix mount failure caused by race with umount
Filipe Manana <[email protected]>
btrfs: fix double free on ulist after backref resolution failure
Hans de Goede <[email protected]>
ASoC: rt5670: Correct RT5670_LDO_SEL_MASK
Takashi Iwai <[email protected]>
ALSA: info: Drop WARN_ON() from buffer NULL sanity check
Oleg Nesterov <[email protected]>
uprobes: Change handle_swbp() to send SIGTRAP with si_code=SI_KERNEL, to fix GDB regression
Olga Kornievskaia <[email protected]>
SUNRPC reverting d03727b248d0 ("NFSv4 fix CLOSE not waiting for direct IO compeletion")
Ben Skeggs <[email protected]>
drm/nouveau/i2c/g94-: increase NV_PMGR_DP_AUXCTL_TRANSACTREQ timeout
Tom Rix <[email protected]>
net: sky2: initialize return of gm_phy_read
Xie He <[email protected]>
drivers/net/wan/lapbether: Fixed the value of hard_header_len
Max Filippov <[email protected]>
xtensa: update *pos in cpuinfo_op.next
Max Filippov <[email protected]>
xtensa: fix __sync_fetch_and_{and,or}_4 declarations
Tom Rix <[email protected]>
scsi: scsi_transport_spi: Fix function pointer check
Markus Theil <[email protected]>
mac80211: allow rx of mesh eapol frames with default rx key
Jacky Hu <[email protected]>
pinctrl: amd: fix npins for uart0 in kerncz_groups
-------------
Diffstat:
Makefile | 6 +-- arch/arm64/kernel/debug-monitors.c | 4 +- arch/parisc/include/asm/atomic.h | 2 + arch/x86/math-emu/wm_sqrt.S | 2 +- arch/xtensa/kernel/setup.c | 3 +- arch/xtensa/kernel/xtensa_ksyms.c | 4 +- drivers/base/regmap/regmap-debugfs.c | 6 +++ drivers/base/regmap/regmap.c | 2 +- drivers/dma/ioat/dma.c | 12 +++++ drivers/dma/ioat/dma.h | 2 - drivers/dma/tegra210-adma.c | 5 ++- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c | 4 +- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | 4 +- drivers/hid/hid-apple.c | 18 ++++++++ drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | 8 ++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 5 ++- drivers/net/ethernet/marvell/sky2.c | 2 +- drivers/net/ethernet/smsc/smc91x.c | 4 +- drivers/net/hippi/rrunner.c | 2 +- drivers/net/phy/dp83640.c | 4 ++ drivers/net/usb/ax88172a.c | 1 + drivers/net/wan/lapbether.c | 9 +++- drivers/net/wan/x25_asy.c | 21 ++++++--- drivers/net/wireless/ath/ath9k/hif_usb.c | 52 +++++++++++++++++----- drivers/net/wireless/ath/ath9k/hif_usb.h | 5 +++ drivers/pinctrl/pinctrl-amd.h | 2 +- drivers/scsi/scsi_transport_spi.c | 2 +- drivers/staging/comedi/drivers/addi_apci_1032.c | 20 ++++++--- drivers/staging/comedi/drivers/addi_apci_1500.c | 24 +++++++--- drivers/staging/comedi/drivers/addi_apci_1564.c | 20 ++++++--- drivers/staging/comedi/drivers/ni_6527.c | 2 +- drivers/staging/wlan-ng/prism2usb.c | 16 ++++++- drivers/tty/serial/8250/8250_core.c | 2 +- drivers/tty/serial/8250/8250_mtk.c | 18 ++++++++ drivers/tty/vt/vt.c | 29 +++++++----- drivers/usb/gadget/udc/gr_udc.c | 7 ++- drivers/usb/host/xhci-mtk-sch.c | 4 ++ drivers/usb/host/xhci-pci.c | 3 ++ fs/btrfs/backref.c | 1 + fs/btrfs/volumes.c | 8 ++++ fs/cifs/inode.c | 10 +---- fs/nfs/direct.c | 13 ++---- fs/nfs/file.c | 1 - fs/xfs/libxfs/xfs_bmap.c | 4 ++ include/linux/io-mapping.h | 5 ++- include/linux/tcp.h | 4 +- kernel/events/uprobes.c | 2 +- mm/memcontrol.c | 4 +- net/ax25/af_ax25.c | 10 ++++- net/core/dev.c | 2 +- net/core/net-sysfs.c | 2 +- net/ipv4/tcp_input.c | 11 ++--- net/ipv4/tcp_output.c | 13 +++--- net/ipv4/udp.c | 2 +- net/ipv6/ip6_gre.c | 11 ++--- net/ipv6/udp.c | 2 +- net/mac80211/rx.c | 26 +++++++++++ net/rxrpc/recvmsg.c | 2 +- net/rxrpc/sendmsg.c | 2 +- scripts/decode_stacktrace.sh | 4 +- sound/core/info.c | 4 +- sound/soc/codecs/rt5670.h | 2 +- tools/perf/builtin-script.c | 24 +++++----- tools/perf/tests/attr.c | 4 +- tools/perf/tests/pmu.c | 2 +- tools/perf/util/annotate.c | 17 ++++--- tools/perf/util/cgroup.c | 2 +- tools/perf/util/parse-events.c | 4 +- tools/perf/util/pmu.c | 2 +- tools/perf/util/probe-event.c | 21 ++++++--- tools/perf/util/srcline.c | 16 ++++++- 71 files changed, 415 insertions(+), 158 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/61 pinctrl: amd: fix npins for uart0 in kerncz_groups
From: Jacky Hu <[email protected]>
[ Upstream commit 69339d083dfb7786b0e0b3fc19eaddcf11fabdfb ]
uart0_pins is defined as:
static const unsigned uart0_pins[] = {135, 136, 137, 138, 139};
which npins is wronly specified as 9 later
{
.name = "uart0",
.pins = uart0_pins,
.npins = 9,
},npins should be 5 instead of 9 according to the definition.
--- drivers/pinctrl/pinctrl-amd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-amd.h +1 -1
@@ -250,7 +250,7 @@ static const struct amd_pingroup kerncz_groups[] = { { .name = "uart0", .pins = uart0_pins, - .npins = 9, + .npins = 5, }, { .name = "uart1",
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 2/61 mac80211: allow rx of mesh eapol frames with default rx key
In reply to Greg Kroah-HartmanFrom: Markus Theil <[email protected]>
[ Upstream commit 0b467b63870d9c05c81456aa9bfee894ab2db3b6 ]
Without this patch, eapol frames cannot be received in mesh mode, when 802.1X should be used. Initially only a MGTK is defined, which is found and set as rx->key, when there are no other keys set. ieee80211_drop_unencrypted would then drop these eapol frames, as they are data frames without encryption and there exists some rx->key.
Fix this by differentiating between mesh eapol frames and other data frames with existing rx->key. Allow mesh mesh eapol frames only if they are for our vif address.
With this patch in-place, ieee80211_rx_h_mesh_fwding continues after the ieee80211_drop_unencrypted check and notices, that these eapol frames have to be delivered locally, as they should.
--- net/mac80211/rx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
net/mac80211/rx.c +26 -0
@@ -2098,6 +2098,7 @@ static int ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)static int ieee80211_drop_unencrypted (struct ieee80211_rx_data *rx,__le16 fc) { +struct ieee80211_hdr *hdr = (void *)rx->skb->data;struct sk_buff *skb = rx->skb;struct ieee80211_rx_status *status =IEEE80211_SKB_RXCB (skb);
@@ -2108,6 +2109,31 @@ static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)if (status->flag &RX_FLAG_DECRYPTED )return 0 ; +/* check mesh EAPOL frames first */ +if (unlikely (rx->sta &&ieee80211_vif_is_mesh (&rx->sdata->vif) && +ieee80211_is_data (fc))) { +struct ieee80211s_hdr *mesh_hdr; +u16 hdr_len =ieee80211_hdrlen (fc); +u16 ethertype_offset; +__be16 ethertype; + +if (!ether_addr_equal (hdr->addr1, rx->sdata->vif.addr)) + goto drop_check; + +/* make sure fixed part of mesh header is there, also checks skb len */ +if (!pskb_may_pull (rx->skb, hdr_len +6 )) + goto drop_check; + + mesh_hdr = (struct ieee80211s_hdr *)(skb->data + hdr_len); + ethertype_offset = hdr_len +ieee80211_get_mesh_hdrlen (mesh_hdr) + +sizeof (rfc1042_header); + +if (skb_copy_bits (rx->skb, ethertype_offset, ðertype,2 ) ==0 && + ethertype == rx->sdata->control_port_protocol) +return 0 ; + } + +drop_check:/* Drop unencrypted frames if key is set. */ if (unlikely(!ieee80211_has_protected(fc) && !ieee80211_is_any_nullfunc(fc) &&
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 3/61 scsi: scsi_transport_spi: Fix function pointer check
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 5aee52c44d9170591df65fafa1cd408acc1225ce ]
clang static analysis flags several null function pointer problems.
drivers/scsi/scsi_transport_spi.c:374:1: warning: Called function pointer is null (null dereference) [core.CallAndMessage] spi_transport_max_attr(offset, "%d\n");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reviewing the store_spi_store_max macro
if (i->f->set_##field) return -EINVAL;
should be
if (!i->f->set_##field) return -EINVAL;
--- drivers/scsi/scsi_transport_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_transport_spi.c +1 -1
@@ -353,7 +353,7 @@ store_spi_transport_##field(struct device *dev, \struct spi_transport_attrs *tp \ = (struct spi_transport_attrs *)&starget->starget_data; \ \ - if (i->f->set_##field) \ + if (!i->f->set_##field) \ return -EINVAL; \ val = simple_strtoul(buf, NULL, 0); \ if (val > tp->max_##field) \
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 4/61 xtensa: fix __sync_fetch_and_{and,or}_4 declarations
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
[ Upstream commit 73f9941306d5ce030f3ffc7db425c7b2a798cf8e ]
Building xtensa kernel with gcc-10 produces the following warnings:
arch/xtensa/kernel/xtensa_ksyms.c:90:15: warning: conflicting types
for built-in function ‘__sync_fetch_and_and_4’; expected ‘unsigned int(volatile void *, unsigned int)’ [-Wbuiltin-declaration-mismatch]
arch/xtensa/kernel/xtensa_ksyms.c:96:15: warning: conflicting types
for built-in function ‘__sync_fetch_and_or_4’; expected ‘unsigned int(volatile void *, unsigned int)’ [-Wbuiltin-declaration-mismatch]
Fix declarations of these functions to avoid the warning.
--- arch/xtensa/kernel/xtensa_ksyms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/xtensa/kernel/xtensa_ksyms.c +2 -2
@@ -82,13 +82,13 @@ void __xtensa_libgcc_window_spill(void) }EXPORT_SYMBOL (__xtensa_libgcc_window_spill); -unsigned long __sync_fetch_and_and_4 (unsigned long *p,unsigned long v) +unsigned int __sync_fetch_and_and_4 (volatile void *p,unsigned int v) {BUG (); }EXPORT_SYMBOL (__sync_fetch_and_and_4); -unsigned long __sync_fetch_and_or_4 (unsigned long *p,unsigned long v) +unsigned int __sync_fetch_and_or_4 (volatile void *p,unsigned int v) {BUG (); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 5/61 xtensa: update *pos in cpuinfo_op.next
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
[ Upstream commit 0d5ab144429e8bd80889b856a44d56ab4a5cd59b ]
Increment *pos in the cpuinfo_op.next to fix the following warning triggered by cat /proc/cpuinfo:
seq_file: buggy .next function c_next did not update position index
--- arch/xtensa/kernel/setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/xtensa/kernel/setup.c +2 -1
@@ -830,7 +830,8 @@ c_start(struct seq_file *f, loff_t *pos)static void *c_next (struct seq_file *f,void *v,loff_t *pos) { -return NULL ; + ++*pos; +return c_start (f, pos); } static void
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 6/61 drivers/net/wan/lapbether: Fixed the value of hard_header_len
In reply to Greg Kroah-HartmanFrom: Xie He <[email protected]>
[ Upstream commit 9dc829a135fb5927f1519de11286e2bbb79f5b66 ]
When this driver transmits data,
first this driver will remove a pseudo header of 1 byte, then the lapb module will prepend the LAPB header of 2 or 3 bytes, then this driver will prepend a length field of 2 bytes, then the underlying Ethernet device will prepend its own header.
So, the header length required should be:
-1 + 3 + 2 + "the header length needed by the underlying device".
This patch fixes kernel panic when this driver is used with AF_PACKET SOCK_DGRAM sockets.
--- drivers/net/wan/lapbether.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/wan/lapbether.c +8 -1
@@ -308,7 +308,6 @@ static void lapbeth_setup(struct net_device *dev) dev->netdev_ops = &lapbeth_netdev_ops; dev->destructor = free_netdev; dev->type =ARPHRD_X25 ; - dev->hard_header_len =3 ; dev->mtu =1000 ; dev->addr_len =0 ; }
@@ -329,6 +328,14 @@ static int lapbeth_new_device(struct net_device *dev)if (!ndev) goto out; +/* When transmitting data: +* first this driver removes a pseudo header of 1 byte, +* then the lapb module prepends an LAPB header of at most 3 bytes, +* then this driver prepends a length field of 2 bytes, +* then the underlying Ethernet device prepends its own header. +*/ + ndev->hard_header_len =-1 +3 +2 + dev->hard_header_len; + lapbeth =netdev_priv (ndev); lapbeth->axdev = ndev;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 7/61 net: sky2: initialize return of gm_phy_read
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 28b18e4eb515af7c6661c3995c6e3c34412c2874 ]
clang static analysis flags this garbage return
drivers/net/ethernet/marvell/sky2.c:208:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
return v;
^~~~~~~~static inline u16 gm_phy_read( ...
{
u16 v;
__gm_phy_read(hw, port, reg, &v);
return v;
}__gm_phy_read can return without setting v.
So handle similar to skge.c's gm_phy_read, initialize v.
--- drivers/net/ethernet/marvell/sky2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/sky2.c +1 -1
@@ -215,7 +215,7 @@ io_error:static inline u16 gm_phy_read (struct sky2_hw *hw,unsigned port,u16 reg) { -u16 v; +u16 v =0 ;__gm_phy_read (hw, port, reg, &v);return v; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 8/61 drm/nouveau/i2c/g94-: increase NV_PMGR_DP_AUXCTL_TRANSACTREQ timeout
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit 0156e76d388310a490aeb0f2fbb5b284ded3aecc ]
Tegra TRM says worst-case reply time is 1216us, and this should fix some spurious timeouts that have been popping up.
--- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c | 4 ++-- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c +2 -2
@@ -118,10 +118,10 @@ g94_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,if (retries)udelay (400 ); -/* transaction request, wait up to 1ms for it to complete */ +/* transaction request, wait up to 2ms for it to complete */ nvkm_wr32 (device,0x00e4e4 + base,0x00010000 | ctrl); - timeout =1000 ; + timeout =2000 ; do { ctrl = nvkm_rd32(device, 0x00e4e4 + base); udelay(1);
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c +2 -2
@@ -118,10 +118,10 @@ gm200_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,if (retries)udelay (400 ); -/* transaction request, wait up to 1ms for it to complete */ +/* transaction request, wait up to 2ms for it to complete */ nvkm_wr32 (device,0x00d954 + base,0x00010000 | ctrl); - timeout =1000 ; + timeout =2000 ; do { ctrl = nvkm_rd32(device, 0x00d954 + base); udelay(1);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 9/61 SUNRPC reverting d03727b248d0 ("NFSv4 fix CLOSE not waiting for direct IO compeletion")
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
commit 65caafd0d2145d1dd02072c4ced540624daeab40 upstream.
Reverting commit d03727b248d0 "NFSv4 fix CLOSE not waiting for direct IO compeletion". This patch made it so that fput() by calling inode_dio_done() in nfs_file_release() would wait uninterruptably for any outstanding directIO to the file (but that wait on IO should be killable).
The problem the patch was also trying to address was REMOVE returning ERR_ACCESS because the file is still opened, is supposed to be resolved by server returning ERR_FILE_OPEN and not ERR_ACCESS.
--- fs/nfs/direct.c | 13 ++++--------- fs/nfs/file.c | 1 - 2 files changed, 4 insertions(+), 10 deletions(-)
fs/nfs/direct.c +4 -9
@@ -379,6 +379,8 @@ static void nfs_direct_complete(struct n {struct inode *inode = dreq->inode; +inode_dio_end (inode); +if (dreq->iocb) {long res = (long ) dreq->error;if (dreq->count !=0 ) {
@@ -390,10 +392,7 @@ static void nfs_direct_complete(struct ncomplete (&dreq->completion); -igrab (inode);nfs_direct_req_release (dreq); -inode_dio_end (inode); -iput (inode); }static void nfs_direct_readpage_release (struct nfs_page *req)
@@ -535,10 +534,8 @@ static ssize_t nfs_direct_read_schedule_* generic layer handle the completion. */ if (requested_bytes ==0 ) { -igrab (inode); -nfs_direct_req_release (dreq);inode_dio_end (inode); -iput (inode); +nfs_direct_req_release (dreq);return result <0 ? result : -EIO ; }
@@ -956,10 +953,8 @@ static ssize_t nfs_direct_write_schedule* generic layer handle the completion. */ if (requested_bytes ==0 ) { -igrab (inode); -nfs_direct_req_release (dreq);inode_dio_end (inode); -iput (inode); +nfs_direct_req_release (dreq);return result <0 ? result : -EIO ; }
fs/nfs/file.c +0 -1
@@ -82,7 +82,6 @@ nfs_file_release(struct inode *inode, stdprintk ("NFS: release(%pD2)\n" , filp);nfs_inc_stats (inode,NFSIOS_VFSRELEASE ); -inode_dio_wait (inode);nfs_file_clear_open_context (filp);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 10/61 uprobes: Change handle_swbp() to send SIGTRAP with si_code=SI_KERNEL, to fix GDB regression
In reply to Greg Kroah-HartmanFrom: Oleg Nesterov <[email protected]>
commit fe5ed7ab99c656bd2f5b79b49df0e9ebf2cead8a upstream.
If a tracee is uprobed and it hits int3 inserted by debugger, handle_swbp() does send_sig(SIGTRAP, current, 0) which means si_code == SI_USER. This used to work when this code was written, but then GDB started to validate si_code and now it simply can't use breakpoints if the tracee has an active uprobe:
# cat test.c
void unused_func(void)
{
}
int main(void)
{
return 0;
}# gcc -g test.c -o test # perf probe -x ./test -a unused_func # perf record -e probe_test:unused_func gdb ./test -ex run GNU gdb (GDB) 10.0.50.20200714-git ... Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff7ddf909 in dl_main () from /lib64/ld-linux-x86-64.so.2 (gdb)
The tracee hits the internal breakpoint inserted by GDB to monitor shared library events but GDB misinterprets this SIGTRAP and reports a signal.
Change handle_swbp() to use force_sig(SIGTRAP), this matches do_int3_user() and fixes the problem.
This is the minimal fix for -stable, arch/x86/kernel/uprobes.c is equally wrong; it should use send_sigtrap(TRAP_TRACE) instead of send_sig(SIGTRAP), but this doesn't confuse GDB and needs another x86-specific patch.
--- kernel/events/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/uprobes.c +1 -1
@@ -1885,7 +1885,7 @@ static void handle_swbp(struct pt_regs *if (!uprobe) {if (is_swbp >0 ) {/* No matching uprobe; signal SIGTRAP. */ -send_sig (SIGTRAP , current,0 ); +force_sig (SIGTRAP , current); }else {/* * Either we raced with uprobe_unregister() or we can't
Greg Kroah-Hartman
maintainerPATCH 11/61 ALSA: info: Drop WARN_ON() from buffer NULL sanity check
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 60379ba08532eca861e933b389526a4dc89e0c42 upstream.
snd_info_get_line() has a sanity check of NULL buffer -- both buffer itself being NULL and buffer->buffer being NULL. Basically both checks are valid and necessary, but the problem is that it's with snd_BUG_ON() macro that triggers WARN_ON(). The latter condition (NULL buffer->buffer) can be met arbitrarily by user since the buffer is allocated at the first write, so it means that user can trigger WARN_ON() at will.
This patch addresses it by simply moving buffer->buffer NULL check out of snd_BUG_ON() so that spurious WARNING is no longer triggered.
--- sound/core/info.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/core/info.c +3 -1
@@ -634,7 +634,9 @@ int snd_info_get_line(struct snd_info_bu {int c =-1 ; -if (snd_BUG_ON (!buffer || !buffer->buffer)) +if (snd_BUG_ON (!buffer)) +return 1 ; +if (!buffer->buffer)return 1 ;if (len <=0 || buffer->stop || buffer->error)return 1 ;
Greg Kroah-Hartman
maintainerPATCH 12/61 ASoC: rt5670: Correct RT5670_LDO_SEL_MASK
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 5cacc6f5764e94fa753b2c1f5f7f1f3f74286e82 upstream.
The RT5670_PWR_ANLG1 register has 3 bits to select the LDO voltage, so the correct mask is 0x7 not 0x3.
Because of this wrong mask we were programming the ldo bits to a setting of binary 001 (0x05 & 0x03) instead of binary 101 when moving to SND_SOC_BIAS_PREPARE.
According to the datasheet 001 is a reserved value, so no idea what it did, since the driver was working fine before I guess we got lucky and it does something which is ok.
--- sound/soc/codecs/rt5670.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt5670.h +1 -1
@@ -760,7 +760,7 @@#define RT5670_PWR_VREF2_BIT 4#define RT5670_PWR_FV2 (0x1 << 3)#define RT5670_PWR_FV2_BIT 3 -#define RT5670_LDO_SEL_MASK (0x3) +#define RT5670_LDO_SEL_MASK (0x7)#define RT5670_LDO_SEL_SFT 0/* Power Management for Analog 2 (0x64) */
Greg Kroah-Hartman
maintainerPATCH 13/61 btrfs: fix double free on ulist after backref resolution failure
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 580c079b5766ac706f56eec5c79aee4bf929fef6 upstream.
At btrfs_find_all_roots_safe() we allocate a ulist and set the **roots argument to point to it. However if later we fail due to an error returned by find_parent_nodes(), we free that ulist but leave a dangling pointer in the **roots argument. Upon receiving the error, a caller of this function can attempt to free the same ulist again, resulting in an invalid memory access.
One such scenario is during qgroup accounting:
btrfs_qgroup_account_extents()
--> calls btrfs_find_all_roots() passes &new_roots (a stack allocated
pointer) to btrfs_find_all_roots()
--> btrfs_find_all_roots() just calls btrfs_find_all_roots_safe()
passing &new_roots to it
--> allocates ulist and assigns its address to **roots (which
points to new_roots from btrfs_qgroup_account_extents())
--> find_parent_nodes() returns an error, so we free the ulist
and leave **roots pointing to it after returning
--> btrfs_qgroup_account_extents() sees btrfs_find_all_roots() returned
an error and jumps to the label 'cleanup', which just tries to free again the same ulist
Stack trace example:
------------[ cut here ]------------ BTRFS: tree first key check failed WARNING: CPU: 1 PID: 1763215 at fs/btrfs/disk-io.c:422 btrfs_verify_level_key+0xe0/0x180 [btrfs] Modules linked in: dm_snapshot dm_thin_pool (...) CPU: 1 PID: 1763215 Comm: fsstress Tainted: G W 5.8.0-rc3-btrfs-next-64 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:btrfs_verify_level_key+0xe0/0x180 [btrfs] Code: 28 5b 5d (...) RSP: 0018:ffffb89b473779a0 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff90397759bf08 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000000027 RDI: 00000000ffffffff RBP: ffff9039a419c000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: ffffb89b43301000 R12: 000000000000005e R13: ffffb89b47377a2e R14: ffffb89b473779af R15: 0000000000000000 FS: 00007fc47e1e1000(0000) GS:ffff9039ac200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc47e1df000 CR3: 00000003d9e4e001 CR4: 00000000003606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: read_block_for_search+0xf6/0x350 [btrfs] btrfs_next_old_leaf+0x242/0x650 [btrfs] resolve_indirect_refs+0x7cf/0x9e0 [btrfs] find_parent_nodes+0x4ea/0x12c0 [btrfs] btrfs_find_all_roots_safe+0xbf/0x130 [btrfs] btrfs_qgroup_account_extents+0x9d/0x390 [btrfs] btrfs_commit_transaction+0x4f7/0xb20 [btrfs] btrfs_sync_file+0x3d4/0x4d0 [btrfs] do_fsync+0x38/0x70 __x64_sys_fdatasync+0x13/0x20 do_syscall_64+0x5c/0xe0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7fc47e2d72e3 Code: Bad RIP value. RSP: 002b:00007fffa32098c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004b RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fc47e2d72e3 RDX: 00007fffa3209830 RSI: 00007fffa3209830 RDI: 0000000000000003 RBP: 000000000000072e R08: 0000000000000001 R09: 0000000000000003 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000000003e8 R13: 0000000051eb851f R14: 00007fffa3209970 R15: 00005607c4ac8b50 irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [<ffffffffb8eb5e85>] copy_process+0x755/0x1eb0 softirqs last enabled at (0): [<ffffffffb8eb5e85>] copy_process+0x755/0x1eb0 softirqs last disabled at (0): [<0000000000000000>] 0x0 ---[ end trace 8639237550317b48 ]--- BTRFS error (device sdc): tree first key mismatch detected, bytenr=62324736 parent_transid=94 key expected=(262,108,1351680) has=(259,108,1921024) general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6b6b: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI CPU: 2 PID: 1763215 Comm: fsstress Tainted: G W 5.8.0-rc3-btrfs-next-64 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:ulist_release+0x14/0x60 [btrfs] Code: c7 07 00 (...) RSP: 0018:ffffb89b47377d60 EFLAGS: 00010282 RAX: 6b6b6b6b6b6b6b6b RBX: ffff903959b56b90 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000270024 RDI: ffff9036e2adc840 RBP: ffff9036e2adc848 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff9036e2adc840 R13: 0000000000000015 R14: ffff9039a419ccf8 R15: ffff90395d605840 FS: 00007fc47e1e1000(0000) GS:ffff9039ac600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f8c1c0a51c8 CR3: 00000003d9e4e004 CR4: 00000000003606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ulist_free+0x13/0x20 [btrfs] btrfs_qgroup_account_extents+0xf3/0x390 [btrfs] btrfs_commit_transaction+0x4f7/0xb20 [btrfs] btrfs_sync_file+0x3d4/0x4d0 [btrfs] do_fsync+0x38/0x70 __x64_sys_fdatasync+0x13/0x20 do_syscall_64+0x5c/0xe0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7fc47e2d72e3 Code: Bad RIP value. RSP: 002b:00007fffa32098c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004b RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fc47e2d72e3 RDX: 00007fffa3209830 RSI: 00007fffa3209830 RDI: 0000000000000003 RBP: 000000000000072e R08: 0000000000000001 R09: 0000000000000003 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000000003e8 R13: 0000000051eb851f R14: 00007fffa3209970 R15: 00005607c4ac8b50 Modules linked in: dm_snapshot dm_thin_pool (...) ---[ end trace 8639237550317b49 ]--- RIP: 0010:ulist_release+0x14/0x60 [btrfs] Code: c7 07 00 (...) RSP: 0018:ffffb89b47377d60 EFLAGS: 00010282 RAX: 6b6b6b6b6b6b6b6b RBX: ffff903959b56b90 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000270024 RDI: ffff9036e2adc840 RBP: ffff9036e2adc848 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff9036e2adc840 R13: 0000000000000015 R14: ffff9039a419ccf8 R15: ffff90395d605840 FS: 00007fc47e1e1000(0000) GS:ffff9039ad200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f6a776f7d40 CR3: 00000003d9e4e002 CR4: 00000000003606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Fix this by making btrfs_find_all_roots_safe() set *roots to NULL after it frees the ulist.
--- fs/btrfs/backref.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/backref.c +1 -0
@@ -1550,6 +1550,7 @@ static int __btrfs_find_all_roots(structif (ret <0 && ret != -ENOENT ) {ulist_free (tmp);ulist_free (*roots); + *roots =NULL ;return ret; } node =ulist_next (tmp, &uiter);
Greg Kroah-Hartman
maintainerPATCH 14/61 btrfs: fix mount failure caused by race with umount
In reply to Greg Kroah-HartmanFrom: Boris Burkov <[email protected]>
[ Upstream commit 48cfa61b58a1fee0bc49eef04f8ccf31493b7cdd ]
It is possible to cause a btrfs mount to fail by racing it with a slow umount. The crux of the sequence is generic_shutdown_super not yet calling sop->put_super before btrfs_mount_root calls btrfs_open_devices. If that occurs, btrfs_open_devices will decide the opened counter is non-zero, increment it, and skip resetting fs_devices->total_rw_bytes to
0. From here, mount will call sget which will result in grab_super trying to take the super block umount semaphore. That semaphore will be held by the slow umount, so mount will block. Before up-ing the semaphore, umount will delete the super block, resulting in mount's sget reliably allocating a new one, which causes the mount path to dutifully fill it out, and increment total_rw_bytes a second time, which causes the mount to fail, as we see double the expected bytes.
Here is the sequence laid out in greater detail:
CPU0 CPU1down_write sb->s_umountbtrfs_kill_super
kill_anon_super(sb)
generic_shutdown_super(sb);
shrink_dcache_for_umount(sb);
sync_filesystem(sb);
evict_inodes(sb); // SLOW
btrfs_mount_root
btrfs_scan_one_device
fs_devices = device->fs_devices
fs_info->fs_devices = fs_devices
// fs_devices-opened makes this a no-op
btrfs_open_devices(fs_devices, mode, fs_type)
s = sget(fs_type, test, set, flags, fs_info);
find sb in s_instances
grab_super(sb);
down_write(&s->s_umount); // blocks
sop->put_super(sb)
// sb->fs_devices->opened == 2; no-op
spin_lock(&sb_lock);
hlist_del_init(&sb->s_instances);
spin_unlock(&sb_lock);
up_write(&sb->s_umount);
return 0;
retry lookup
don't find sb in s_instances (deleted by CPU0)
s = alloc_super
return s;
btrfs_fill_super(s, fs_devices, data)
open_ctree // fs_devices total_rw_bytes improperly set!
btrfs_read_chunk_tree
read_one_dev // increment total_rw_bytes again!!
super_total_bytes < fs_devices->total_rw_bytes // ERROR!!!To fix this, we clear total_rw_bytes from within btrfs_read_chunk_tree before the calls to read_one_dev, while holding the sb umount semaphore and the uuid mutex.
To reproduce, it is sufficient to dirty a decent number of inodes, then quickly umount and mount.
for i in $(seq 0 500)
do
dd if=/dev/zero of="/mnt/foo/$i" bs=1M count=1
done
umount /mnt/foo&
mount /mnt/foodoes the trick for me.
--- fs/btrfs/volumes.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/btrfs/volumes.c +8 -0
@@ -6854,6 +6854,14 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)mutex_lock (&uuid_mutex);lock_chunks (root); +/* +* It is possible for mount and umount to race in such a way that +* we execute this code path, but open_fs_devices failed to clear +* total_rw_bytes. We certainly want it cleared before reading the +* device items, so clear it here. +*/ + root->fs_info->fs_devices->total_rw_bytes =0 ; +/* * Read all device items, and then all the chunk items. All * device items are found before any chunk item (their object id
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 15/61 bnxt_en: Fix race when modifying pause settings.
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit 163e9ef63641a02de4c95cd921577265c52e1ce2 ]
The driver was modified to not rely on rtnl lock to protect link settings about 2 years ago. The pause setting was missed when making that change. Fix it by acquiring link_lock mutex before calling bnxt_hwrm_set_pause().
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +4 -1
@@ -1023,8 +1023,11 @@ static int bnxt_set_pauseparam(struct net_device *dev,if (epause->tx_pause) link_info->req_flow_ctrl |=BNXT_LINK_PAUSE_TX ; -if (netif_running (dev)) +if (netif_running (dev)) { +mutex_lock (&bp->link_lock); rc =bnxt_hwrm_set_pause (bp); +mutex_unlock (&bp->link_lock); + }return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 16/61 hippi: Fix a size used in a pci_free_consistent() in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3195c4706b00106aa82c73acd28340fa8fc2bfc1 ]
The size used when calling 'pci_alloc_consistent()' and 'pci_free_consistent()' should match.
Fix it and have it consistent with the corresponding call in 'rr_close()'.
--- drivers/net/hippi/rrunner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hippi/rrunner.c +1 -1
@@ -1250,7 +1250,7 @@ static int rr_open(struct net_device *dev) rrpriv->info =NULL ; }if (rrpriv->rx_ctrl) { -pci_free_consistent (pdev,sizeof (struct ring_ctrl ), +pci_free_consistent (pdev,256 *sizeof (struct ring_ctrl ), rrpriv->rx_ctrl, rrpriv->rx_ctrl_dma); rrpriv->rx_ctrl =NULL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 17/61 ax88172a: fix ax88172a_unbind() failures
In reply to Greg Kroah-HartmanFrom: George Kennedy <[email protected]>
[ Upstream commit c28d9a285668c799eeae2f7f93e929a6028a4d6d ]
If ax88172a_unbind() fails, make sure that the return code is less than zero so that cleanup is done properly and avoid UAF.
--- drivers/net/usb/ax88172a.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/ax88172a.c +1 -0
@@ -217,6 +217,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf) ret =asix_read_cmd (dev,AX_CMD_READ_NODE_ID ,0 ,0 ,ETH_ALEN , buf,0 );if (ret <ETH_ALEN ) {netdev_err (dev->net,"Failed to read MAC address: %d\n" , ret); + ret = -EIO ; goto free; }memcpy (dev->net->dev_addr, buf,ETH_ALEN );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 18/61 net: dp83640: fix SIOCSHWTSTAMP to update the struct with actual configuration
In reply to Greg Kroah-HartmanFrom: Sergey Organov <[email protected]>
[ Upstream commit 473309fb8372365ad211f425bca760af800e10a7 ]
Quoted 1 line
From
Documentation/networking/timestamping.txt:
A driver which supports hardware time stamping shall update the struct with the actual, possibly more permissive configuration.
Do update the struct passed when we upscale the requested time stamping mode.
--- drivers/net/phy/dp83640.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/phy/dp83640.c +4 -0
@@ -1337,6 +1337,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr) dp83640->hwts_rx_en =1 ; dp83640->layer =PTP_CLASS_L4 ; dp83640->version =PTP_CLASS_V1 ; + cfg.rx_filter =HWTSTAMP_FILTER_PTP_V1_L4_EVENT ;break ;case HWTSTAMP_FILTER_PTP_V2_L4_EVENT :case HWTSTAMP_FILTER_PTP_V2_L4_SYNC :
@@ -1344,6 +1345,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr) dp83640->hwts_rx_en =1 ; dp83640->layer =PTP_CLASS_L4 ; dp83640->version =PTP_CLASS_V2 ; + cfg.rx_filter =HWTSTAMP_FILTER_PTP_V2_L4_EVENT ;break ;case HWTSTAMP_FILTER_PTP_V2_L2_EVENT :case HWTSTAMP_FILTER_PTP_V2_L2_SYNC :
@@ -1351,6 +1353,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr) dp83640->hwts_rx_en =1 ; dp83640->layer =PTP_CLASS_L2 ; dp83640->version =PTP_CLASS_V2 ; + cfg.rx_filter =HWTSTAMP_FILTER_PTP_V2_L2_EVENT ;break ;case HWTSTAMP_FILTER_PTP_V2_EVENT :case HWTSTAMP_FILTER_PTP_V2_SYNC :
@@ -1358,6 +1361,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr) dp83640->hwts_rx_en =1 ; dp83640->layer =PTP_CLASS_L4 |PTP_CLASS_L2 ; dp83640->version =PTP_CLASS_V2 ; + cfg.rx_filter =HWTSTAMP_FILTER_PTP_V2_EVENT ;break ;default :return -ERANGE ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 19/61 net: smc91x: Fix possible memory leak in smc_drv_probe()
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit bca9749b1aa23d964d3ab930938af66dbf887f15 ]
If try_toggle_control_gpio() failed in smc_drv_probe(), free_netdev(ndev) should be called to free the ndev created earlier. Otherwise, a memleak will occur.
--- drivers/net/ethernet/smsc/smc91x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/smsc/smc91x.c +2 -2
@@ -2294,7 +2294,7 @@ static int smc_drv_probe(struct platform_device *pdev) ret =try_toggle_control_gpio (&pdev->dev, &lp->power_gpio,"power" ,0 ,0 ,100 );if (ret) -return ret; + goto out_free_netdev;/* * Optional reset GPIO configured? Minimum 100 ns reset needed
@@ -2303,7 +2303,7 @@ static int smc_drv_probe(struct platform_device *pdev) ret =try_toggle_control_gpio (&pdev->dev, &lp->reset_gpio,"reset" ,0 ,0 ,100 );if (ret) -return ret; + goto out_free_netdev;/* * Need to wait for optional EEPROM to load, max 750 us according
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 20/61 scripts/decode_stacktrace: strip basepath from all paths
In reply to Greg Kroah-HartmanFrom: Pi-Hsun Shih <[email protected]>
[ Upstream commit d178770d8d21489abf5bafefcbb6d5243b482e9a ]
Currently the basepath is removed only from the beginning of the string. When the symbol is inlined and there's multiple line outputs of addr2line, only the first line would have basepath removed.
Change to remove the basepath prefix from all lines.
--- scripts/decode_stacktrace.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/decode_stacktrace.sh +2 -2
@@ -76,8 +76,8 @@ parse_symbol() { return fi - # Strip out the base of the path - code=${code#$basepath/} + # Strip out the base of the path on each line + code=$(while read -r line; do echo "${line#$basepath/}"; done <<< "$code") # In the case of inlines, move everything to same line code=${code//$'\n'/' '}
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 21/61 HID: i2c-hid: add Mediacom FlexBook edge13 to descriptor override
In reply to Greg Kroah-HartmanFrom: Federico Ricchiuto <[email protected]>
[ Upstream commit 43e666acb79f3d355dd89bf20f4d25d3b15da13e ]
The Mediacom FlexBook edge13 uses the SIPODEV SP1064 touchpad, which does not supply descriptors, so it has to be added to the override list.
--- drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +8 -0
@@ -373,6 +373,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = { }, .driver_data = (void *)&sipodev_desc }, + { + .ident = "Mediacom FlexBook edge 13", + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"MEDIACOM" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook_edge13-M-FBE13"), + }, + .driver_data = (void *)&sipodev_desc + }, { .ident ="Odys Winbook 13" , .matches = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 22/61 HID: apple: Disable Fn-key key-re-mapping on clone keyboards
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit a5d81646fa294eed57786a9310b06ca48902adf8 ]
The Maxxter KB-BT-001 Bluetooth keyboard, which looks somewhat like the Apple Wireless Keyboard, is using the vendor and product IDs (05AC:0239) of the Apple Wireless Keyboard (2009 ANSI version) <sigh>.
But its F1 - F10 keys are marked as sending F1 - F10, not the special functions hid-apple.c maps them too; and since its descriptors do not contain the HID_UP_CUSTOM | 0x0003 usage apple-hid looks for for the Fn-key, apple_setup_input() never gets called, so F1 - F6 are mapped to key-codes which have not been set in the keybit array causing them to not send any events at all.
The lack of a usage code matching the Fn key in the clone is actually useful as this allows solving this problem in a generic way.
This commits adds a fn_found flag and it adds a input_configured callback which checks if this flag is set once all usages have been mapped. If it is not set, then assume this is a clone and clear the quirks bitmap so that the hid-apple code does not add any special handling to this keyboard.
This fixes F1 - F6 not sending anything at all and F7 - F12 sending the wrong codes on the Maxxter KB-BT-001 Bluetooth keyboard and on similar clones.
--- drivers/hid/hid-apple.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/hid/hid-apple.c +18 -0
@@ -55,6 +55,7 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\")struct apple_sc {unsigned long quirks;unsigned int fn_on; +unsigned int fn_found; DECLARE_BITMAP(pressed_numlock, KEY_CNT); };
@@ -340,12 +341,15 @@ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { + struct apple_sc *asc = hid_get_drvdata(hdev); +if (usage->hid == (HID_UP_CUSTOM |0x0003 ) || usage->hid == (HID_UP_MSVENDOR |0x0003 ) || usage->hid == (HID_UP_HPVENDOR2 |0x0003 )) {/* The fn key on Apple USB keyboards */ set_bit (EV_REP , hi->input->evbit);hid_map_usage_clear (hi, usage, bit, max,EV_KEY ,KEY_FN ); + asc->fn_found = true;apple_setup_input (hi->input);return 1 ; }
@@ -372,6 +376,19 @@ static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi,return 0 ; } +static int apple_input_configured (struct hid_device *hdev, +struct hid_input *hidinput) +{ +struct apple_sc *asc =hid_get_drvdata (hdev); + +if ((asc->quirks &APPLE_HAS_FN ) && !asc->fn_found) { +hid_info (hdev,"Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n" ); + asc->quirks =0 ; + } + +return 0 ; +} +static int apple_probe (struct hid_device *hdev,const struct hid_device_id *id) {
@@ -593,6 +610,7 @@ static struct hid_driver apple_driver = { .event = apple_event, .input_mapping = apple_input_mapping, .input_mapped = apple_input_mapped, + .input_configured = apple_input_configured, };module_hid_driver (apple_driver);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 23/61 dmaengine: tegra210-adma: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 5b78fac4b1ba731cf4177fdbc1e3a4661521bcd0 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/dma/tegra210-adma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +4 -1
@@ -583,6 +583,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc) ret =pm_runtime_get_sync (tdc2dev (tdc));if (ret <0 ) { +pm_runtime_put_noidle (tdc2dev (tdc));free_irq (tdc->irq, tdc);return ret; }
@@ -764,8 +765,10 @@ static int tegra_adma_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev); ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (&pdev->dev); goto rpm_disable; + } ret =tegra_adma_init (tdma);if (ret)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 24/61 regmap: dev_get_regmap_match(): fix string comparison
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
[ Upstream commit e84861fec32dee8a2e62bbaa52cded6b05a2a456 ]
This function is used by dev_get_regmap() to retrieve a regmap for the specified device. If the device has more than one regmap, the name parameter can be used to specify one.
The code here uses a pointer comparison to check for equal strings. This however will probably always fail, as the regmap->name is allocated via kstrdup_const() from the regmap's config->name.
Fix this by using strcmp() instead.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -1239,7 +1239,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data)/* If the user didn't specify a name match any */ if (data) -return (*r)->name == data; +return !strcmp ((*r)->name, data);else return 1 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 25/61 dmaengine: ioat setting ioat timeout as module parameter
In reply to Greg Kroah-HartmanFrom: Leonid Ravich <[email protected]>
[ Upstream commit 87730ccbddcb48478b1b88e88b14e73424130764 ]
DMA transaction time to completion is a function of PCI bandwidth, transaction size and a queue depth. So hard coded value for timeouts might be wrong for some scenarios.
--- drivers/dma/ioat/dma.c | 12 ++++++++++++ drivers/dma/ioat/dma.h | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/dma/ioat/dma.c +12 -0
@@ -38,6 +38,18 @@#include "../dmaengine.h" +int completion_timeout =200 ; +module_param (completion_timeout, int,0644 ); +MODULE_PARM_DESC (completion_timeout, +"set ioat completion timeout [msec] (default 200 [msec])" ); +int idle_timeout =2000 ; +module_param (idle_timeout, int,0644 ); +MODULE_PARM_DESC (idle_timeout, +"set ioat idel timeout [msec] (default 2000 [msec])" ); + +#define IDLE_TIMEOUT msecs_to_jiffies(idle_timeout) +#define COMPLETION_TIMEOUT msecs_to_jiffies(completion_timeout) +static char *chanerr_str[] = {"DMA Transfer Destination Address Error" ,"Next Descriptor Address Error" ,
drivers/dma/ioat/dma.h +0 -2
@@ -111,8 +111,6 @@ struct ioatdma_chan {#define IOAT_RUN 5#define IOAT_CHAN_ACTIVE 6struct timer_list timer; -#define COMPLETION_TIMEOUT msecs_to_jiffies(100) -#define IDLE_TIMEOUT msecs_to_jiffies(2000)#define RESET_DELAY msecs_to_jiffies(100)struct ioatdma_device *ioat_dma;dma_addr_t completion_dma;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 26/61 usb: gadget: udc: gr_udc: fix memleak on error handling path in gr_ep_init()
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit c8f8529e2c4141afa2ebb487ad48e8a6ec3e8c99 ]
gr_ep_init() does not assign the allocated request anywhere if allocation of memory for the buffer fails. This is a memory leak fixed by the given patch.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/usb/gadget/udc/gr_udc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/gr_udc.c +5 -2
@@ -2000,9 +2000,12 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit)if (num ==0 ) { _req =gr_alloc_request (&ep->ep,GFP_ATOMIC ); +if (!_req) +return -ENOMEM ; + buf =devm_kzalloc (dev->dev,PAGE_SIZE ,GFP_DMA |GFP_ATOMIC ); -if (!_req || !buf) { -/* possible _req freed by gr_probe via gr_remove */ +if (!buf) { +gr_free_request (&ep->ep, _req);return -ENOMEM ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 27/61 arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
[ Upstream commit 5afc78551bf5d53279036e0bf63314e35631d79f ]
Rather than open-code test_tsk_thread_flag() at each callsite, simply replace the couple of offenders with calls to test_tsk_thread_flag() directly.
--- arch/arm64/kernel/debug-monitors.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/debug-monitors.c +2 -2
@@ -380,14 +380,14 @@ void user_rewind_single_step(struct task_struct *task)* If single step is active for this thread, then set SPSR.SS * to 1 to avoid returning to the active-pending state. */ -if (test_ti_thread_flag (task_thread_info (task),TIF_SINGLESTEP )) +if (test_tsk_thread_flag (task,TIF_SINGLESTEP ))set_regs_spsr_ss (task_pt_regs (task)); }NOKPROBE_SYMBOL (user_rewind_single_step);void user_fastforward_single_step (struct task_struct *task) { -if (test_ti_thread_flag (task_thread_info (task),TIF_SINGLESTEP )) +if (test_tsk_thread_flag (task,TIF_SINGLESTEP ))clear_regs_spsr_ss (task_pt_regs (task)); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 28/61 x86: math-emu: Fix up cmp insn for clang ias
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 81e96851ea32deb2c921c870eecabf335f598aeb ]
The clang integrated assembler requires the 'cmp' instruction to have a length prefix here:
arch/x86/math-emu/wm_sqrt.S:212:2: error: ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', or 'cmpl')
cmp $0xffffffff,-24(%ebp)
^
Make this a 32-bit comparison, which it was clearly meant to be.
--- arch/x86/math-emu/wm_sqrt.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/math-emu/wm_sqrt.S +1 -1
@@ -208,7 +208,7 @@ sqrt_stage_2_finish: #ifdef PARANOID /* It should be possible to get here only if the arg is ffff....ffff */ - cmp $0xffffffff,FPU_fsqrt_arg_1 + cmpl $0xffffffff,FPU_fsqrt_arg_1 jnz sqrt_stage_2_error #endif /* PARANOID */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 29/61 usb: xhci-mtk: fix the failure of bandwidth allocation
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
commit 5ce1a24dd98c00a57a8fa13660648abf7e08e3ef upstream.
The wMaxPacketSize field of endpoint descriptor may be zero as default value in alternate interface, and they are not actually selected when start stream, so skip them when try to allocate bandwidth.
--- drivers/usb/host/xhci-mtk-sch.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/host/xhci-mtk-sch.c +4 -0
@@ -284,6 +284,10 @@ static bool need_bw_sch(struct usb_host_if (is_fs_or_ls (speed) && !has_tt)return false; +/* skip endpoint with zero maxpkt */ +if (usb_endpoint_maxp (&ep->desc) ==0 ) +return false; +return true; }
Greg Kroah-Hartman
maintainerPATCH 30/61 usb: xhci: Fix ASM2142/ASM3142 DMA addressing
In reply to Greg Kroah-HartmanFrom: Forest Crossman <[email protected]>
commit dbb0897e805f2ab1b8bc358f6c3d878a376b8897 upstream.
The ASM2142/ASM3142 (same PCI IDs) does not support full 64-bit DMA addresses, which can cause silent memory corruption or IOMMU errors on platforms that use the upper bits. Add the XHCI_NO_64BIT_SUPPORT quirk to fix this issue.
--- drivers/usb/host/xhci-pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/host/xhci-pci.c +3 -0
@@ -213,6 +213,9 @@ static void xhci_pci_quirks(struct devicif (pdev->vendor ==PCI_VENDOR_ID_ASMEDIA && pdev->device ==0x1142 ) xhci->quirks |=XHCI_TRUST_TX_LENGTH ; +if (pdev->vendor ==PCI_VENDOR_ID_ASMEDIA && + pdev->device ==0x2142 ) + xhci->quirks |=XHCI_NO_64BIT_SUPPORT ;if (pdev->vendor ==PCI_VENDOR_ID_ASMEDIA && pdev->device ==PCI_DEVICE_ID_ASMEDIA_1042A_XHCI )
Greg Kroah-Hartman
maintainerPATCH 31/61 Revert "cifs: Fix the target file was deleted when rename failed."
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit 0e6705182d4e1b77248a93470d6d7b3013d59b30 upstream.
This reverts commit 9ffad9263b467efd8f8dc7ae1941a0a655a2bab2.
Upon additional testing with older servers, it was found that the original commit introduced a regression when using the old SMB1 dialect and rsyncing over an existing file.
The patch will need to be respun to address this, likely including a larger refactoring of the SMB1 and SMB3 rename code paths to make it less confusing and also to address some additional rename error cases that SMB3 may be able to workaround.
--- fs/cifs/inode.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
fs/cifs/inode.c +2 -8
@@ -1770,7 +1770,6 @@ cifs_rename2(struct inode *source_dir, sFILE_UNIX_BASIC_INFO *info_buf_target;unsigned int xid;int rc, tmprc; -bool new_target =d_really_is_negative (target_dentry);if (flags & ~RENAME_NOREPLACE )return -EINVAL ;
@@ -1847,13 +1846,8 @@ cifs_rename2(struct inode *source_dir, s*/ unlink_target: -/* -* If the target dentry was created during the rename, try -* unlinking it if it's not negative -*/ -if (new_target && -d_really_is_positive (target_dentry) && - (rc == -EACCES || rc == -EEXIST )) { +/* Try unlinking the target dentry if it's not negative */ +if (d_really_is_positive (target_dentry) && (rc == -EACCES || rc == -EEXIST )) {if (d_is_dir (target_dentry)) tmprc =cifs_rmdir (target_dir, target_dentry);else
Greg Kroah-Hartman
maintainerPATCH 32/61 staging: wlan-ng: properly check endpoint types
In reply to Greg Kroah-HartmanFrom: Rustam Kovhaev <[email protected]>
commit faaff9765664009c1c7c65551d32e9ed3b1dda8f upstream.
As syzkaller detected, wlan-ng driver does not do sanity check of endpoints in prism2sta_probe_usb(), add check for xfer direction and type
--- drivers/staging/wlan-ng/prism2usb.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/staging/wlan-ng/prism2usb.c +15 -1
@@ -60,11 +60,25 @@ static int prism2sta_probe_usb(struct us const struct usb_device_id *id) {struct usb_device *dev; - +const struct usb_endpoint_descriptor *epd; +const struct usb_host_interface *iface_desc = interface->cur_altsetting;struct wlandevice *wlandev =NULL ;struct hfa384x *hw =NULL ;int result =0 ; +if (iface_desc->desc.bNumEndpoints !=2 ) { + result = -ENODEV ; + goto failed; + } + + result = -EINVAL ; + epd = &iface_desc->endpoint[1 ].desc; +if (!usb_endpoint_is_bulk_in (epd)) + goto failed; + epd = &iface_desc->endpoint[2 ].desc; +if (!usb_endpoint_is_bulk_out (epd)) + goto failed; + dev =interface_to_usbdev (interface); wlandev =create_wlan ();if (!wlandev) {
Greg Kroah-Hartman
maintainerPATCH 33/61 staging: comedi: addi_apci_1032: check INSN_CONFIG_DIGITAL_TRIG shift
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit 0bd0db42a030b75c20028c7ba6e327b9cb554116 upstream.
The INSN_CONFIG comedi instruction with sub-instruction code INSN_CONFIG_DIGITAL_TRIG includes a base channel in data[3]. This is used as a right shift amount for other bitmask values without being checked. Shift amounts greater than or equal to 32 will result in undefined behavior. Add code to deal with this.
--- drivers/staging/comedi/drivers/addi_apci_1032.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/staging/comedi/drivers/addi_apci_1032.c +14 -6
@@ -115,14 +115,22 @@ static int apci1032_cos_insn_config(stru unsigned int *data) {struct apci1032_private *devpriv = dev->private; -unsigned int shift, oldmask; +unsigned int shift, oldmask, himask, lomask;switch (data[0 ]) {case INSN_CONFIG_DIGITAL_TRIG :if (data[1 ] !=0 )return -EINVAL ; shift = data[3 ]; - oldmask = (1U << shift) -1 ; +if (shift <32 ) { + oldmask = (1U << shift) -1 ; + himask = data[4 ] << shift; + lomask = data[5 ] << shift; + }else { + oldmask =0xffffffffu ; + himask =0 ; + lomask =0 ; + }switch (data[2 ]) {case COMEDI_DIGITAL_TRIG_DISABLE : devpriv->ctrl =0 ;
@@ -145,8 +153,8 @@ static int apci1032_cos_insn_config(stru devpriv->mode2 &= oldmask; }/* configure specified channels */ - devpriv->mode1 |= data[4 ] << shift; - devpriv->mode2 |= data[5 ] << shift; + devpriv->mode1 |= himask; + devpriv->mode2 |= lomask;break ;case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS : if (devpriv->ctrl != (APCI1032_CTRL_INT_ENA |
@@ -163,8 +171,8 @@ static int apci1032_cos_insn_config(stru devpriv->mode2 &= oldmask; }/* configure specified channels */ - devpriv->mode1 |= data[4 ] << shift; - devpriv->mode2 |= data[5 ] << shift; + devpriv->mode1 |= himask; + devpriv->mode2 |= lomask;break ;default :return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 34/61 staging: comedi: ni_6527: fix INSN_CONFIG_DIGITAL_TRIG support
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit f07804ec77d77f8a9dcf570a24154e17747bc82f upstream.
ni6527_intr_insn_config() processes INSN_CONFIG comedi instructions for the "interrupt" subdevice. When data[0] is INSN_CONFIG_DIGITAL_TRIG it is configuring the digital trigger. When data[2] is COMEDI_DIGITAL_TRIG_ENABLE_EDGES it is configuring rising and falling edge detection for the digital trigger, using a base channel number (or shift amount) in data[3], a rising edge bitmask in data[4] and falling edge bitmask in data[5].
If the base channel number (shift amount) is greater than or equal to the number of channels (24) of the digital input subdevice, there are no changes to the rising and falling edges, so the mask of channels to be changed can be set to 0, otherwise the mask of channels to be changed, and the rising and falling edge bitmasks are shifted by the base channel number before calling ni6527_set_edge_detection() to change the appropriate registers. Unfortunately, the code is comparing the base channel (shift amount) to the interrupt subdevice's number of channels
(1) instead of the digital input subdevice's number of channels (24). Fix it by comparing to 32 because all shift amounts for an unsigned int must be less than that and everything from bit 24 upwards is ignored by ni6527_set_edge_detection() anyway.
--- drivers/staging/comedi/drivers/ni_6527.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/ni_6527.c +1 -1
@@ -341,7 +341,7 @@ static int ni6527_intr_insn_config(struccase COMEDI_DIGITAL_TRIG_ENABLE_EDGES :/* check shift amount */ shift = data[3 ]; -if (shift >= s->n_chan) { +if (shift >=32 ) { mask =0 ; rising =0 ; falling =0 ;
Greg Kroah-Hartman
maintainerPATCH 35/61 staging: comedi: addi_apci_1500: check INSN_CONFIG_DIGITAL_TRIG shift
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit fc846e9db67c7e808d77bf9e2ef3d49e3820ce5d upstream.
The INSN_CONFIG comedi instruction with sub-instruction code INSN_CONFIG_DIGITAL_TRIG includes a base channel in data[3]. This is used as a right shift amount for other bitmask values without being checked. Shift amounts greater than or equal to 32 will result in undefined behavior. Add code to deal with this, adjusting the checks for invalid channels so that enabled channel bits that would have been lost by shifting are also checked for validity. Only channels 0 to 15 are valid.
--- drivers/staging/comedi/drivers/addi_apci_1500.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/staging/comedi/drivers/addi_apci_1500.c +19 -5
@@ -461,13 +461,14 @@ static int apci1500_di_cfg_trig(struct cstruct apci1500_private *devpriv = dev->private;unsigned int trig = data[1 ];unsigned int shift = data[3 ]; -unsigned int hi_mask = data[4 ] << shift; -unsigned int lo_mask = data[5 ] << shift; -unsigned int chan_mask = hi_mask | lo_mask; -unsigned int old_mask = (1 << shift) -1 ; +unsigned int hi_mask; +unsigned int lo_mask; +unsigned int chan_mask; +unsigned int old_mask;unsigned int pm;unsigned int pt;unsigned int pp; +unsigned int invalid_chan;if (trig >1 ) { dev_dbg(dev->class_dev,
@@ -475,7 +476,20 @@ static int apci1500_di_cfg_trig(struct creturn -EINVAL ; } -if (chan_mask >0xffff ) { +if (shift <=16 ) { + hi_mask = data[4 ] << shift; + lo_mask = data[5 ] << shift; + old_mask = (1U << shift) -1 ; + invalid_chan = (data[4 ] | data[5 ]) >> (16 - shift); + }else { + hi_mask =0 ; + lo_mask =0 ; + old_mask =0xffff ; + invalid_chan = data[4 ] | data[5 ]; + } + chan_mask = hi_mask | lo_mask; + +if (invalid_chan) {dev_dbg (dev->class_dev,"invalid digital trigger channel\n" );return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 36/61 staging: comedi: addi_apci_1564: check INSN_CONFIG_DIGITAL_TRIG shift
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit 926234f1b8434c4409aa4c53637aa3362ca07cea upstream.
The INSN_CONFIG comedi instruction with sub-instruction code INSN_CONFIG_DIGITAL_TRIG includes a base channel in data[3]. This is used as a right shift amount for other bitmask values without being checked. Shift amounts greater than or equal to 32 will result in undefined behavior. Add code to deal with this.
--- drivers/staging/comedi/drivers/addi_apci_1564.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/staging/comedi/drivers/addi_apci_1564.c +14 -6
@@ -340,14 +340,22 @@ static int apci1564_cos_insn_config(stru unsigned int *data) {struct apci1564_private *devpriv = dev->private; -unsigned int shift, oldmask; +unsigned int shift, oldmask, himask, lomask;switch (data[0 ]) {case INSN_CONFIG_DIGITAL_TRIG :if (data[1 ] !=0 )return -EINVAL ; shift = data[3 ]; - oldmask = (1U << shift) -1 ; +if (shift <32 ) { + oldmask = (1U << shift) -1 ; + himask = data[4 ] << shift; + lomask = data[5 ] << shift; + }else { + oldmask =0xffffffffu ; + himask =0 ; + lomask =0 ; + }switch (data[2 ]) {case COMEDI_DIGITAL_TRIG_DISABLE : devpriv->ctrl =0 ;
@@ -371,8 +379,8 @@ static int apci1564_cos_insn_config(stru devpriv->mode2 &= oldmask; }/* configure specified channels */ - devpriv->mode1 |= data[4 ] << shift; - devpriv->mode2 |= data[5 ] << shift; + devpriv->mode1 |= himask; + devpriv->mode2 |= lomask;break ;case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS : if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA |
@@ -389,8 +397,8 @@ static int apci1564_cos_insn_config(stru devpriv->mode2 &= oldmask; }/* configure specified channels */ - devpriv->mode1 |= data[4 ] << shift; - devpriv->mode2 |= data[5 ] << shift; + devpriv->mode1 |= himask; + devpriv->mode2 |= lomask;break ;default :return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 37/61 serial: 8250: fix null-ptr-deref in serial8250_start_tx()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
commit f4c23a140d80ef5e6d3d1f8f57007649014b60fa upstream.
I got null-ptr-deref in serial8250_start_tx():
[ 78.114630] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 78.123778] Mem abort info: [ 78.126560] ESR = 0x86000007 [ 78.129603] EC = 0x21: IABT (current EL), IL = 32 bits [ 78.134891] SET = 0, FnV = 0 [ 78.137933] EA = 0, S1PTW = 0 [ 78.141064] user pgtable: 64k pages, 48-bit VAs, pgdp=00000027d41a8600 [ 78.147562] [0000000000000000] pgd=00000027893f0003, p4d=00000027893f0003, pud=00000027893f0003, pmd=00000027c9a20003, pte=0000000000000000 [ 78.160029] Internal error: Oops: 86000007 [#1] SMP [ 78.164886] Modules linked in: sunrpc vfat fat aes_ce_blk crypto_simd cryptd aes_ce_cipher crct10dif_ce ghash_ce sha2_ce sha256_arm64 sha1_ce ses enclosure sg sbsa_gwdt ipmi_ssif spi_dw_mmio sch_fq_codel vhost_net tun vhost vhost_iotlb tap ip_tables ext4 mbcache jbd2 ahci hisi_sas_v3_hw libahci hisi_sas_main libsas hns3 scsi_transport_sas hclge libata megaraid_sas ipmi_si hnae3 ipmi_devintf ipmi_msghandler br_netfilter bridge stp llc nvme nvme_core xt_sctp sctp libcrc32c dm_mod nbd [ 78.207383] CPU: 11 PID: 23258 Comm: null-ptr Not tainted 5.8.0-rc6+ #48 [ 78.214056] Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V3.B210.01 03/12/2020 [ 78.222888] pstate: 80400089 (Nzcv daIf +PAN -UAO BTYPE=--) [ 78.228435] pc : 0x0 [ 78.230618] lr : serial8250_start_tx+0x160/0x260 [ 78.235215] sp : ffff800062eefb80 [ 78.238517] x29: ffff800062eefb80 x28: 0000000000000fff [ 78.243807] x27: ffff800062eefd80 x26: ffff202fd83b3000 [ 78.249098] x25: ffff800062eefd80 x24: ffff202fd83b3000 [ 78.254388] x23: ffff002fc5e50be8 x22: 0000000000000002 [ 78.259679] x21: 0000000000000001 x20: 0000000000000000 [ 78.264969] x19: ffffa688827eecc8 x18: 0000000000000000 [ 78.270259] x17: 0000000000000000 x16: 0000000000000000 [ 78.275550] x15: ffffa68881bc67a8 x14: 00000000000002e6 [ 78.280841] x13: ffffa68881bc67a8 x12: 000000000000c539 [ 78.286131] x11: d37a6f4de9bd37a7 x10: ffffa68881cccff0 [ 78.291421] x9 : ffffa68881bc6000 x8 : ffffa688819daa88 [ 78.296711] x7 : ffffa688822a0f20 x6 : ffffa688819e0000 [ 78.302002] x5 : ffff800062eef9d0 x4 : ffffa68881e707a8 [ 78.307292] x3 : 0000000000000000 x2 : 0000000000000002 [ 78.312582] x1 : 0000000000000001 x0 : ffffa688827eecc8 [ 78.317873] Call trace: [ 78.320312] 0x0 [ 78.322147] __uart_start.isra.9+0x64/0x78 [ 78.326229] uart_start+0xb8/0x1c8 [ 78.329620] uart_flush_chars+0x24/0x30 [ 78.333442] n_tty_receive_buf_common+0x7b0/0xc30 [ 78.338128] n_tty_receive_buf+0x44/0x2c8 [ 78.342122] tty_ioctl+0x348/0x11f8 [ 78.345599] ksys_ioctl+0xd8/0xf8 [ 78.348903] __arm64_sys_ioctl+0x2c/0xc8 [ 78.352812] el0_svc_common.constprop.2+0x88/0x1b0 [ 78.357583] do_el0_svc+0x44/0xd0 [ 78.360887] el0_sync_handler+0x14c/0x1d0 [ 78.364880] el0_sync+0x140/0x180 [ 78.368185] Code: bad PC value
SERIAL_PORT_DFNS is not defined on each arch, if it's not defined, serial8250_set_defaults() won't be called in serial8250_isa_init_ports(), so the p->serial_in pointer won't be initialized, and it leads a null-ptr-deref. Fix this problem by calling serial8250_set_defaults() after init uart port.
--- drivers/tty/serial/8250/8250_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +1 -1
@@ -529,6 +529,7 @@ static void __init serial8250_isa_init_p*/ up->mcr_mask = ~ALPHA_KLUDGE_MCR ; up->mcr_force =ALPHA_KLUDGE_MCR ; +serial8250_set_defaults (up); }/* chain base port ops to support Remote Supervisor Adapter */
@@ -552,7 +553,6 @@ static void __init serial8250_isa_init_p port->membase = old_serial_port[i].iomem_base; port->iotype = old_serial_port[i].io_type; port->regshift = old_serial_port[i].iomem_reg_shift; -serial8250_set_defaults (up); port->irqflags |= irqflag;if (serial8250_isa_config !=NULL )
Greg Kroah-Hartman
maintainerPATCH 38/61 serial: 8250_mtk: Fix high-speed baud rates clamping
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
commit 551e553f0d4ab623e2a6f424ab5834f9c7b5229c upstream.
Commit 7b668c064ec3 ("serial: 8250: Fix max baud limit in generic 8250 port") fixed limits of a baud rate setting for a generic 8250 port. In other words since that commit the baud rate has been permitted to be within [uartclk / 16 / UART_DIV_MAX; uartclk / 16], which is absolutely normal for a standard 8250 UART port. But there are custom 8250 ports, which provide extended baud rate limits. In particular the Mediatek 8250 port can work with baud rates up to "uartclk" speed.
Normally that and any other peculiarity is supposed to be handled in a custom set_termios() callback implemented in the vendor-specific 8250-port glue-driver. Currently that is how it's done for the most of the vendor-specific 8250 ports, but for some reason for Mediatek a solution has been spread out to both the glue-driver and to the generic 8250-port code. Due to that a bug has been introduced, which permitted the extended baud rate limit for all even for standard 8250-ports. The bug has been fixed by the commit 7b668c064ec3 ("serial: 8250: Fix max baud limit in generic 8250 port") by narrowing the baud rates limit back down to the normal bounds. Unfortunately by doing so we also broke the Mediatek-specific extended bauds feature.
A fix of the problem described above is twofold. First since we can't get back the extended baud rate limits feature to the generic set_termios() function and that method supports only a standard baud rates range, the requested baud rate must be locally stored before calling it and then restored back to the new termios structure after the generic set_termios() finished its magic business. By doing so we still use the serial8250_do_set_termios() method to set the LCR/MCR/FCR/etc. registers, while the extended baud rate setting procedure will be performed later in the custom Mediatek-specific set_termios() callback. Second since a true baud rate is now fully calculated in the custom set_termios() method we need to locally update the port timeout by calling the uart_update_timeout() function. After the fixes described above are implemented in the 8250_mtk.c driver, the Mediatek 8250-port should get back to normally working with extended baud rates.
--- drivers/tty/serial/8250/8250_mtk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/tty/serial/8250/8250_mtk.c +18 -0
@@ -45,8 +45,21 @@ mtk8250_set_termios(struct uart_port *pounsigned long flags;unsigned int baud, quot; +/* +* Store the requested baud rate before calling the generic 8250 +* set_termios method. Standard 8250 port expects bauds to be +* no higher than (uartclk / 16) so the baud will be clamped if it +* gets out of that bound. Mediatek 8250 port supports speed +* higher than that, therefore we'll get original baud rate back +* after calling the generic set_termios method and recalculate +* the speed later in this method. +*/ + baud =tty_termios_baud_rate (termios); +serial8250_do_set_termios (port, termios, old); +tty_termios_encode_baud_rate (termios, baud, baud); +/* * Mediatek UARTs use an extra highspeed register (UART_MTK_HIGHS) *
@@ -85,6 +98,11 @@ mtk8250_set_termios(struct uart_port *po*/ spin_lock_irqsave (&port->lock, flags); +/* +* Update the per-port timeout. +*/ +uart_update_timeout (port, termios->c_cflag, baud); +/* set DLAB we have cval saved in up->lcr from the call to the core */ serial_port_out (port,UART_LCR , up->lcr |UART_LCR_DLAB );serial_dl_write (up, quot);
Greg Kroah-Hartman
maintainerPATCH 39/61 vt: Reject zero-sized screen buffer size.
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit ce684552a266cb1c7cc2f7e623f38567adec6653 upstream.
syzbot is reporting general protection fault in do_con_write() [1] caused by vc->vc_screenbuf == ZERO_SIZE_PTR caused by vc->vc_screenbuf_size == 0 caused by vc->vc_cols == vc->vc_rows == vc->vc_size_row == 0 caused by fb_set_var() from ioctl(FBIOPUT_VSCREENINFO) on /dev/fb0 , for gotoxy(vc, 0, 0) from reset_terminal() from vc_init() from vc_allocate()
from con_install() from tty_init_dev() from tty_open() on such console
causes vc->vc_pos == 0x10000000e due to
((unsigned long) ZERO_SIZE_PTR) + -1U * 0 + (-1U << 1).
I don't think that a console with 0 column or 0 row makes sense. And it seems that vc_do_resize() does not intend to allow resizing a console to 0 column or 0 row due to
new_cols = (cols ? cols : vc->vc_cols); new_rows = (lines ? lines : vc->vc_rows);
exception.
Theoretically, cols and rows can be any range as long as 0 < cols * rows * 2 <= KMALLOC_MAX_SIZE is satisfied (e.g. cols == 1048576 && rows == 2 is possible) because of
vc->vc_size_row = vc->vc_cols << 1; vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row;
in visual_init() and kzalloc(vc->vc_screenbuf_size) in vc_allocate().
Since we can detect cols == 0 or rows == 0 via screenbuf_size = 0 in visual_init(), we can reject kzalloc(0). Then, vc_allocate() will return an error, and con_write() will not be called on a console with 0 column or 0 row.
We need to make sure that integer overflow in visual_init() won't happen. Since vc_do_resize() restricts cols <= 32767 and rows <= 32767, applying 1 <= cols <= 32767 and 1 <= rows <= 32767 restrictions to vc_allocate() will be practically fine.
This patch does not touch con_init(), for returning -EINVAL there does not help when we are not returning -ENOMEM.
[1] https://syzkaller.appspot.com/bug?extid=017265e8553724e514e8
--- drivers/tty/vt/vt.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/tty/vt/vt.c +18 -11
@@ -765,10 +765,19 @@ static const struct tty_port_operations .destruct = vc_port_destruct, }; +/* +* Change # of rows and columns (0 means unchanged/the size of fg_console) +* [this is to be used together with some user program +* like resize that changes the hardware videomode] +*/ +#define VC_MAXCOL (32767) +#define VC_MAXROW (32767) +int vc_allocate (unsigned int currcons)/* return 0 on success */ {struct vt_notifier_param param;struct vc_data *vc; +int err;WARN_CONSOLE_UNLOCKED ();
@@ -798,6 +807,11 @@ int vc_allocate(unsigned int currcons) /if (!*vc->vc_uni_pagedir_loc)con_set_default_unimap (vc); + err = -EINVAL ; +if (vc->vc_cols >VC_MAXCOL || vc->vc_rows >VC_MAXROW || + vc->vc_screenbuf_size >KMALLOC_MAX_SIZE || !vc->vc_screenbuf_size) + goto err_free; + err = -ENOMEM ; vc->vc_screenbuf =kzalloc (vc->vc_screenbuf_size,GFP_KERNEL );if (!vc->vc_screenbuf) goto err_free;
@@ -815,7 +829,7 @@ int vc_allocate(unsigned int currcons) / err_free:kfree (vc); vc_cons[currcons].d =NULL ; -return -ENOMEM ; +return err; } static inline int resize_screen(struct vc_data *vc, int width, int height,
@@ -830,14 +844,6 @@ static inline int resize_screen(struct vreturn err; } -/* -* Change # of rows and columns (0 means unchanged/the size of fg_console) -* [this is to be used together with some user program -* like resize that changes the hardware videomode] -*/ -#define VC_RESIZE_MAXCOL (32767) -#define VC_RESIZE_MAXROW (32767) -/** * vc_do_resize - resizing method for the tty * @tty: tty being resized
@@ -872,7 +878,7 @@ static int vc_do_resize(struct tty_struc user = vc->vc_resize_user; vc->vc_resize_user =0 ; -if (cols >VC_RESIZE_MAXCOL || lines >VC_RESIZE_MAXROW ) +if (cols >VC_MAXCOL || lines >VC_MAXROW )return -EINVAL ; new_cols = (cols ? cols : vc->vc_cols);
@@ -883,7 +889,7 @@ static int vc_do_resize(struct tty_strucif (new_cols == vc->vc_cols && new_rows == vc->vc_rows)return 0 ; -if (new_screen_size > (4 <<20 )) +if (new_screen_size > (4 <<20 ) || !new_screen_size)return -EINVAL ; newscreen =kzalloc (new_screen_size,GFP_USER );if (!newscreen)
@@ -3033,6 +3039,7 @@ static int __init con_init(void)INIT_WORK (&vc_cons[currcons].SAK_work, vc_SAK);tty_port_init (&vc->port);visual_init (vc, currcons,1 ); +/* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */ vc->vc_screenbuf =kzalloc (vc->vc_screenbuf_size,GFP_NOWAIT );vc_init (vc, vc->vc_rows, vc->vc_cols, currcons || !vc->vc_sw->con_save_screen);
Greg Kroah-Hartman
maintainerPATCH 40/61 Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation
In reply to Greg Kroah-HartmanFrom: Fangrui Song <[email protected]>
commit ca9b31f6bb9c6aa9b4e5f0792f39a97bbffb8c51 upstream.
When CROSS_COMPILE is set (e.g. aarch64-linux-gnu-), if $(CROSS_COMPILE)elfedit is found at /usr/bin/aarch64-linux-gnu-elfedit, GCC_TOOLCHAIN_DIR will be set to /usr/bin/. --prefix= will be set to /usr/bin/ and Clang as of 11 will search for both $(prefix)aarch64-linux-gnu-$needle and $(prefix)$needle.
GCC searchs for $(prefix)aarch64-linux-gnu/$version/$needle, $(prefix)aarch64-linux-gnu/$needle and $(prefix)$needle. In practice, $(prefix)aarch64-linux-gnu/$needle rarely contains executables.
To better model how GCC's -B/--prefix takes in effect in practice, newer Clang (since
https://github.com/llvm/llvm-project/commit/3452a0d8c17f7166f479706b293caf6ac76ffd90)
only searches for $(prefix)$needle. Currently it will find /usr/bin/as instead of /usr/bin/aarch64-linux-gnu-as.
Set --prefix= to $(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) (/usr/bin/aarch64-linux-gnu-) so that newer Clang can find the appropriate cross compiling GNU as (when -no-integrated-as is in effect).
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -505,7 +505,7 @@ ifeq ($(cc-name),clang) ifneq ($(CROSS_COMPILE),) CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) -CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) +CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif ifneq ($(GCC_TOOLCHAIN),)
Greg Kroah-Hartman
maintainerPATCH 41/61 mm/memcg: fix refcount error while moving and swapping
In reply to Greg Kroah-HartmanFrom: Hugh Dickins <[email protected]>
commit 8d22a9351035ef2ff12ef163a1091b8b8cf1e49c upstream.
It was hard to keep a test running, moving tasks between memcgs with move_charge_at_immigrate, while swapping: mem_cgroup_id_get_many()'s refcount is discovered to be 0 (supposedly impossible), so it is then forced to REFCOUNT_SATURATED, and after thousands of warnings in quick succession, the test is at last put out of misery by being OOM killed.
This is because of the way moved_swap accounting was saved up until the task move gets completed in __mem_cgroup_clear_mc(), deferred from when mem_cgroup_move_swap_account() actually exchanged old and new ids. Concurrent activity can free up swap quicker than the task is scanned, bringing id refcount down 0 (which should only be possible when offlining).
Just skip that optimization: do that part of the accounting immediately.
--- mm/memcontrol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/memcontrol.c +2 -2
@@ -4794,7 +4794,6 @@ static void __mem_cgroup_clear_mc(void)if (!mem_cgroup_is_root (mc.to))page_counter_uncharge (&mc.to->memory, mc.moved_swap); -mem_cgroup_id_get_many (mc.to, mc.moved_swap);css_put_many (&mc.to->css, mc.moved_swap); mc.moved_swap =0 ;
@@ -4972,7 +4971,8 @@ put: /* get_mctgt_type() gets the page ent = target.ent;if (!mem_cgroup_move_swap_account (ent, mc.from, mc.to)) { mc.precharge--; -/* we fixup refcnts and charges later. */ +mem_cgroup_id_get_many (mc.to,1 ); +/* we fixup other refcnts and charges later. */ mc.moved_swap++; }break ;
Greg Kroah-Hartman
maintainerPATCH 42/61 io-mapping: indicate mapping failure
In reply to Greg Kroah-HartmanFrom: Michael J. Ruhl <[email protected]>
commit e0b3e0b1a04367fc15c07f44e78361545b55357c upstream.
The !ATOMIC_IOMAP version of io_maping_init_wc will always return success, even when the ioremap fails.
Since the ATOMIC_IOMAP version returns NULL when the init fails, and callers check for a NULL return on error this is unexpected.
During a device probe, where the ioremap failed, a crash can look like this:
BUG: unable to handle page fault for address: 0000000000210000
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
Oops: 0002 [#1] PREEMPT SMP
CPU: 0 PID: 177 Comm:
RIP: 0010:fill_page_dma [i915]
gen8_ppgtt_create [i915]
i915_ppgtt_create [i915]
intel_gt_init [i915]
i915_gem_init [i915]
i915_driver_probe [i915]
pci_device_probe
really_probe
driver_probe_deviceThe remap failure occurred much earlier in the probe. If it had been propagated, the driver would have exited with an error.
Return NULL on ioremap failure.
[[email protected]: detect ioremap_wc() errors earlier]
--- include/linux/io-mapping.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/io-mapping.h +4 -1
@@ -120,9 +120,12 @@ io_mapping_init_wc(struct io_mapping *io resource_size_t base, unsigned long size) { + iomap->iomem =ioremap_wc (base, size); +if (!iomap->iomem) +return NULL ; + iomap->base = base; iomap->size = size; - iomap->iomem =ioremap_wc (base, size);#if defined(pgprot_noncached_wc)/* archs can't agree on a name ... */ iomap->prot =pgprot_noncached_wc (PAGE_KERNEL );#elif defined(pgprot_writecombine)
Greg Kroah-Hartman
maintainerPATCH 43/61 parisc: Add atomic64_set_release() define to avoid CPU soft lockups
In reply to Greg Kroah-HartmanFrom: John David Anglin <[email protected]>
commit be6577af0cef934ccb036445314072e8cb9217b9 upstream.
Stalls are quite frequent with recent kernels. I enabled CONFIG_SOFTLOCKUP_DETECTOR and I caught the following stall:
watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [cc1:22803] CPU: 0 PID: 22803 Comm: cc1 Not tainted 5.6.17+ #3 Hardware name: 9000/800/rp3440 IAOQ[0]: d_alloc_parallel+0x384/0x688 IAOQ[1]: d_alloc_parallel+0x388/0x688 RP(r2): d_alloc_parallel+0x134/0x688 Backtrace: [<000000004036974c>] __lookup_slow+0xa4/0x200 [<0000000040369fc8>] walk_component+0x288/0x458 [<000000004036a9a0>] path_lookupat+0x88/0x198 [<000000004036e748>] filename_lookup+0xa0/0x168 [<000000004036e95c>] user_path_at_empty+0x64/0x80 [<000000004035d93c>] vfs_statx+0x104/0x158 [<000000004035dfcc>] __do_sys_lstat64+0x44/0x80 [<000000004035e5a0>] sys_lstat64+0x20/0x38 [<0000000040180054>] syscall_exit+0x0/0x14
The code was stuck in this loop in d_alloc_parallel:
4037d414: 0e 00 10 dc ldd 0(r16),ret0
4037d418: c7 fc 5f ed bb,< ret0,1f,4037d414 <d_alloc_parallel+0x384>
4037d41c: 08 00 02 40 nopThis is the inner loop of bit_spin_lock which is called by hlist_bl_unlock in d_alloc_parallel:
static inline void bit_spin_lock(int bitnum, unsigned long *addr) {
/*
* Assuming the lock is uncontended, this never enters
* the body of the outer loop. If it is contended, then
* within the inner loop a non-atomic test is used to
* busywait with less bus contention for a good time to
* attempt to acquire the lock bit.
*/
preempt_disable();
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
while (unlikely(test_and_set_bit_lock(bitnum, addr))) {
preempt_enable();
do {
cpu_relax();
} while (test_bit(bitnum, addr));
preempt_disable();
}
#endif
__acquire(bitlock);
}After consideration, I realized that we must be losing bit unlocks. Then, I noticed that we missed defining atomic64_set_release(). Adding this define fixes the stalls in bit operations.
--- arch/parisc/include/asm/atomic.h | 2 ++ 1 file changed, 2 insertions(+)
arch/parisc/include/asm/atomic.h +2 -0
@@ -255,6 +255,8 @@ atomic64_set(atomic64_t *v, s64 i)_atomic_spin_unlock_irqrestore (v, flags); } +#define atomic64_set_release (v, i) atomic64_set((v), (i)) +static __inline__s64 atomic64_read (const atomic64_t *v) {
Greg Kroah-Hartman
maintainerPATCH 44/61 ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb
In reply to Greg Kroah-HartmanFrom: Qiujun Huang <[email protected]>
commit 2bbcaaee1fcbd83272e29f31e2bb7e70d8c49e05 upstream.
In ath9k_hif_usb_rx_cb interface number is assumed to be 0. usb_ifnum_to_if(urb->dev, 0)
But it isn't always true.
The case reported by syzbot:
https://lore.kernel.org/linux-usb/[email protected]
usb 2-1: new high-speed USB device number 2 using dummy_hcd usb 2-1: config 1 has an invalid interface number: 2 but max is 0 usb 2-1: config 1 has no interface number 0
usb 2-1: New USB device found, idVendor=0cf3, idProduct=9271, bcdDevice= 1.08
usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
general protection fault, probably for non-canonical address 0xdffffc0000000015: 0000 [#1] SMP KASAN KASAN: null-ptr-deref in range [0x00000000000000a8-0x00000000000000af] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.0-rc5-syzkaller #0
Call Trace
__usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716 dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966 call_timer_fn+0x195/0x6f0 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x5f9/0x1500 kernel/time/timer.c:1786 __do_softirq+0x21e/0x950 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x178/0x1a0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:546 [inline] smp_apic_timer_interrupt+0x141/0x540 arch/x86/kernel/apic/apic.c:1146 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 48 +++++++++++++++++++++++-------- drivers/net/wireless/ath/ath9k/hif_usb.h | 5 +++ 2 files changed, 42 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +37 -11
@@ -641,9 +641,9 @@ err:static void ath9k_hif_usb_rx_cb (struct urb *urb) { -struct sk_buff *skb = (struct sk_buff *) urb->context; -struct hif_device_usb *hif_dev = -usb_get_intfdata (usb_ifnum_to_if (urb->dev,0 )); +struct rx_buf *rx_buf = (struct rx_buf *)urb->context; +struct hif_device_usb *hif_dev = rx_buf->hif_dev; +struct sk_buff *skb = rx_buf->skb;int ret;if (!skb)
@@ -683,14 +683,15 @@ resubmit:return ; free:kfree_skb (skb); +kfree (rx_buf); }static void ath9k_hif_usb_reg_in_cb (struct urb *urb) { -struct sk_buff *skb = (struct sk_buff *) urb->context; +struct rx_buf *rx_buf = (struct rx_buf *)urb->context; +struct hif_device_usb *hif_dev = rx_buf->hif_dev; +struct sk_buff *skb = rx_buf->skb;struct sk_buff *nskb; -struct hif_device_usb *hif_dev = -usb_get_intfdata (usb_ifnum_to_if (urb->dev,0 ));int ret;if (!skb)
@@ -748,6 +749,7 @@ resubmit:return ; free:kfree_skb (skb); +kfree (rx_buf); urb->context =NULL ; }
@@ -793,7 +795,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(sinit_usb_anchor (&hif_dev->mgmt_submitted);for (i =0 ; i <MAX_TX_URB_NUM ; i++) { - tx_buf =kzalloc (sizeof (struct tx_buf ),GFP_KERNEL ); + tx_buf =kzalloc (sizeof (*tx_buf),GFP_KERNEL );if (!tx_buf) goto err;
@@ -830,8 +832,9 @@ static void ath9k_hif_usb_dealloc_rx_urbstatic int ath9k_hif_usb_alloc_rx_urbs (struct hif_device_usb *hif_dev) { -struct urb *urb =NULL ; +struct rx_buf *rx_buf =NULL ;struct sk_buff *skb =NULL ; +struct urb *urb =NULL ;int i, ret;init_usb_anchor (&hif_dev->rx_submitted);
@@ -839,6 +842,12 @@ static int ath9k_hif_usb_alloc_rx_urbs(sfor (i =0 ; i <MAX_RX_URB_NUM ; i++) { + rx_buf =kzalloc (sizeof (*rx_buf),GFP_KERNEL ); +if (!rx_buf) { + ret = -ENOMEM ; + goto err_rxb; + } +/* Allocate URB */ urb =usb_alloc_urb (0 ,GFP_KERNEL );if (urb ==NULL ) {
@@ -853,11 +862,14 @@ static int ath9k_hif_usb_alloc_rx_urbs(s goto err_skb; } + rx_buf->hif_dev = hif_dev; + rx_buf->skb = skb; +usb_fill_bulk_urb (urb, hif_dev->udev,usb_rcvbulkpipe (hif_dev->udev,USB_WLAN_RX_PIPE ), skb->data,MAX_RX_BUF_SIZE , - ath9k_hif_usb_rx_cb, skb); + ath9k_hif_usb_rx_cb, rx_buf);/* Anchor URB */ usb_anchor_urb (urb, &hif_dev->rx_submitted);
@@ -883,6 +895,8 @@ err_submit: err_skb:usb_free_urb (urb); err_urb: +kfree (rx_buf); +err_rxb:ath9k_hif_usb_dealloc_rx_urbs (hif_dev);return ret; }
@@ -894,14 +908,21 @@ static void ath9k_hif_usb_dealloc_reg_instatic int ath9k_hif_usb_alloc_reg_in_urbs (struct hif_device_usb *hif_dev) { -struct urb *urb =NULL ; +struct rx_buf *rx_buf =NULL ;struct sk_buff *skb =NULL ; +struct urb *urb =NULL ;int i, ret;init_usb_anchor (&hif_dev->reg_in_submitted);for (i =0 ; i <MAX_REG_IN_URB_NUM ; i++) { + rx_buf =kzalloc (sizeof (*rx_buf),GFP_KERNEL ); +if (!rx_buf) { + ret = -ENOMEM ; + goto err_rxb; + } +/* Allocate URB */ urb =usb_alloc_urb (0 ,GFP_KERNEL );if (urb ==NULL ) {
@@ -916,11 +937,14 @@ static int ath9k_hif_usb_alloc_reg_in_ur goto err_skb; } + rx_buf->hif_dev = hif_dev; + rx_buf->skb = skb; +usb_fill_int_urb (urb, hif_dev->udev,usb_rcvintpipe (hif_dev->udev,USB_REG_IN_PIPE ), skb->data,MAX_REG_IN_BUF_SIZE , - ath9k_hif_usb_reg_in_cb, skb,1 ); + ath9k_hif_usb_reg_in_cb, rx_buf,1 );/* Anchor URB */ usb_anchor_urb (urb, &hif_dev->reg_in_submitted);
@@ -946,6 +970,8 @@ err_submit: err_skb:usb_free_urb (urb); err_urb: +kfree (rx_buf); +err_rxb:ath9k_hif_usb_dealloc_reg_in_urbs (hif_dev);return ret; }
drivers/net/wireless/ath/ath9k/hif_usb.h +5 -0
@@ -84,6 +84,11 @@ struct tx_buf {struct list_head list; }; +struct rx_buf { +struct sk_buff *skb; +struct hif_device_usb *hif_dev; +}; +#define HIF_USB_TX_STOP BIT(0)#define HIF_USB_TX_FLUSH BIT(1)
Greg Kroah-Hartman
maintainerPATCH 45/61 ath9k: Fix regression with Atheros 9271
In reply to Greg Kroah-HartmanFrom: Mark O'Donovan <[email protected]>
commit 92f53e2fda8bb9a559ad61d57bfb397ce67ed0ab upstream.
This fix allows ath9k_htc modules to connect to WLAN once again.
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +3 -1
@@ -731,11 +731,13 @@ static void ath9k_hif_usb_reg_in_cb(strureturn ; } + rx_buf->skb = nskb; +usb_fill_int_urb (urb, hif_dev->udev,usb_rcvintpipe (hif_dev->udev,USB_REG_IN_PIPE ), nskb->data,MAX_REG_IN_BUF_SIZE , - ath9k_hif_usb_reg_in_cb, nskb,1 ); + ath9k_hif_usb_reg_in_cb, rx_buf,1 ); } resubmit:
Greg Kroah-Hartman
maintainerPATCH 46/61 AX.25: Fix out-of-bounds read in ax25_connect()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
[ Upstream commit 2f2a7ffad5c6cbf3d438e813cfdc88230e185ba6 ]
Checks on addr_len and fsa->fsa_ax25.sax25_ndigis are insufficient. ax25_connect() can go out of bounds when fsa->fsa_ax25.sax25_ndigis equals to 7 or 8. Fix it.
This issue has been reported as a KMSAN uninit-value bug, because in such a case, ax25_connect() reaches into the uninitialized portion of the struct sockaddr_storage statically allocated in __sys_connect().
It is safe to remove fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS because addr_len is guaranteed to be less than or equal to sizeof(struct full_sockaddr_ax25).
--- net/ax25/af_ax25.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ax25/af_ax25.c +3 -1
@@ -1191,7 +1191,9 @@ static int __must_check ax25_connect(strif (addr_len >sizeof (struct sockaddr_ax25 ) && fsa->fsa_ax25.sax25_ndigis !=0 ) {/* Valid number of digipeaters ? */ -if (fsa->fsa_ax25.sax25_ndigis <1 || fsa->fsa_ax25.sax25_ndigis >AX25_MAX_DIGIS ) { +if (fsa->fsa_ax25.sax25_ndigis <1 || + addr_len <sizeof (struct sockaddr_ax25 ) + +sizeof (ax25_address) * fsa->fsa_ax25.sax25_ndigis) { err = -EINVAL ; goto out_release; }
Greg Kroah-Hartman
maintainerPATCH 47/61 AX.25: Prevent out-of-bounds read in ax25_sendmsg()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
[ Upstream commit 8885bb0621f01a6c82be60a91e5fc0f6e2f71186 ]
Checks on addr_len and usax->sax25_ndigis are insufficient. ax25_sendmsg() can go out of bounds when usax->sax25_ndigis equals to 7 or 8. Fix it.
It is safe to remove usax->sax25_ndigis > AX25_MAX_DIGIS, since addr_len is guaranteed to be less than or equal to sizeof(struct full_sockaddr_ax25)
--- net/ax25/af_ax25.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ax25/af_ax25.c +2 -1
@@ -1512,7 +1512,8 @@ static int ax25_sendmsg(struct socket *sstruct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)usax;/* Valid number of digipeaters ? */ -if (usax->sax25_ndigis <1 || usax->sax25_ndigis >AX25_MAX_DIGIS ) { +if (usax->sax25_ndigis <1 || addr_len <sizeof (struct sockaddr_ax25 ) + +sizeof (ax25_address) * usax->sax25_ndigis) { err = -EINVAL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 48/61 dev: Defer free of skbs in flush_backlog
In reply to Greg Kroah-HartmanFrom: Subash Abhinov Kasiviswanathan <[email protected]>
[ Upstream commit 7df5cb75cfb8acf96c7f2342530eb41e0c11f4c3 ]
IRQs are disabled when freeing skbs in input queue. Use the IRQ safe variant to free skbs here.
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -4392,7 +4392,7 @@ static void flush_backlog(struct work_st skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) {if (skb->dev->reg_state ==NETREG_UNREGISTERING ) {__skb_unlink (skb, &sd->input_pkt_queue); -kfree_skb (skb); +dev_kfree_skb_irq (skb);input_queue_head_incr (sd); } }
Greg Kroah-Hartman
maintainerPATCH 49/61 net-sysfs: add a newline when printing tx_timeout by sysfs
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit 9bb5fbea59f36a589ef886292549ca4052fe676c ]
When I cat 'tx_timeout' by sysfs, it displays as follows. It's better to add a newline for easy reading.
root@syzkaller:~# cat /sys/devices/virtual/net/lo/queues/tx-0/tx_timeout 0root@syzkaller:~#
--- net/core/net-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/net-sysfs.c +1 -1
@@ -1018,7 +1018,7 @@ static ssize_t show_trans_timeout(struct trans_timeout = queue->trans_timeout;spin_unlock_irq (&queue->_xmit_lock); -return sprintf (buf,"%lu" , trans_timeout); +return sprintf (buf, fmt_ulong, trans_timeout); }#ifdef CONFIG_XPS
Greg Kroah-Hartman
maintainerPATCH 50/61 net: udp: Fix wrong clean up for IS_UDPLITE macro
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit b0a422772fec29811e293c7c0e6f991c0fd9241d ]
We can't use IS_UDPLITE to replace udp_sk->pcflag when UDPLITE_RECV_CC is checked.
--- net/ipv4/udp.c | 2 +- net/ipv6/udp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/udp.c +1 -1
@@ -1554,7 +1554,7 @@ int udp_queue_rcv_skb(struct sock *sk, s/* * UDP-Lite specific tests, ignored on UDP sockets */ -if ((is_udplite &UDPLITE_RECV_CC ) &&UDP_SKB_CB (skb)->partial_cov) { +if ((up->pcflag &UDPLITE_RECV_CC ) &&UDP_SKB_CB (skb)->partial_cov) {/* * MIB statistics other than incrementing the error count are
net/ipv6/udp.c +1 -1
@@ -601,7 +601,7 @@ int udpv6_queue_rcv_skb(struct sock *sk,/* * UDP-Lite specific tests, ignored on UDP sockets (see net/ipv4/udp.c). */ -if ((is_udplite &UDPLITE_RECV_CC ) &&UDP_SKB_CB (skb)->partial_cov) { +if ((up->pcflag &UDPLITE_RECV_CC ) &&UDP_SKB_CB (skb)->partial_cov) {if (up->pcrlen ==0 ) {/* full coverage was set */ net_dbg_ratelimited("UDPLITE6: partial coverage %d while full coverage %d requested\n",
Greg Kroah-Hartman
maintainerPATCH 51/61 rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 639f181f0ee20d3249dbc55f740f0167267180f0 ]
rxrpc_sendmsg() returns EPIPE if there's an outstanding error, such as if rxrpc_recvmsg() indicating ENODATA if there's nothing for it to read.
Change rxrpc_recvmsg() to return EAGAIN instead if there's nothing to read as this particular error doesn't get stored in ->sk_err by the networking core.
Also change rxrpc_sendmsg() so that it doesn't fail with delayed receive errors (there's no way for it to report which call, if any, the error was caused by).
--- net/rxrpc/recvmsg.c | 2 +- net/rxrpc/sendmsg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/rxrpc/recvmsg.c +1 -1
@@ -439,7 +439,7 @@ try_again: list_empty(&rx->recvmsg_q) && rx->sk.sk_state != RXRPC_SERVER_LISTENING) {release_sock (&rx->sk); -return -ENODATA ; +return -EAGAIN ; }if (list_empty (&rx->recvmsg_q)) {
net/rxrpc/sendmsg.c +1 -1
@@ -191,7 +191,7 @@ static int rxrpc_send_data(struct rxrpc_/* this should be in poll */ sk_clear_bit (SOCKWQ_ASYNC_NOSPACE , sk); -if (sk->sk_err || (sk->sk_shutdown &SEND_SHUTDOWN )) +if (sk->sk_shutdown &SEND_SHUTDOWN )return -EPIPE ; more = msg->msg_flags &MSG_MORE ;
Greg Kroah-Hartman
maintainerPATCH 52/61 AX.25: Prevent integer overflows in connect and sendmsg
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 17ad73e941b71f3bec7523ea4e9cbc3752461c2d ]
We recently added some bounds checking in ax25_connect() and ax25_sendmsg() and we so we removed the AX25_MAX_DIGIS checks because they were no longer required.
Unfortunately, I believe they are required to prevent integer overflows so I have added them back.
--- net/ax25/af_ax25.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ax25/af_ax25.c +4 -1
@@ -1192,6 +1192,7 @@ static int __must_check ax25_connect(str fsa->fsa_ax25.sax25_ndigis != 0) {/* Valid number of digipeaters ? */ if (fsa->fsa_ax25.sax25_ndigis <1 || + fsa->fsa_ax25.sax25_ndigis >AX25_MAX_DIGIS || addr_len <sizeof (struct sockaddr_ax25 ) +sizeof (ax25_address) * fsa->fsa_ax25.sax25_ndigis) { err = -EINVAL ;
@@ -1512,7 +1513,9 @@ static int ax25_sendmsg(struct socket *sstruct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)usax;/* Valid number of digipeaters ? */ -if (usax->sax25_ndigis <1 || addr_len <sizeof (struct sockaddr_ax25 ) + +if (usax->sax25_ndigis <1 || + usax->sax25_ndigis >AX25_MAX_DIGIS || + addr_len <sizeof (struct sockaddr_ax25 ) +sizeof (ax25_address) * usax->sax25_ndigis) { err = -EINVAL ; goto out;
Greg Kroah-Hartman
maintainerPATCH 53/61 tcp: allow at most one TLP probe per flight
In reply to Greg Kroah-HartmanFrom: Yuchung Cheng <[email protected]>
[ Upstream commit 76be93fc0702322179bb0ea87295d820ee46ad14 ]
Previously TLP may send multiple probes of new data in one flight. This happens when the sender is cwnd limited. After the initial TLP containing new data is sent, the sender receives another ACK that acks partial inflight. It may re-arm another TLP timer to send more, if no further ACK returns before the next TLP timeout (PTO) expires. The sender may send in theory a large amount of TLP until send queue is depleted. This only happens if the sender sees such irregular uncommon ACK pattern. But it is generally undesirable behavior during congestion especially.
The original TLP design restrict only one TLP probe per inflight as published in "Reducing Web Latency: the Virtue of Gentle Aggression", SIGCOMM 2013. This patch changes TLP to send at most one probe per inflight.
Note that if the sender is app-limited, TLP retransmits old data and did not have this issue.
--- include/linux/tcp.h | 4 +++- net/ipv4/tcp_input.c | 11 ++++++----- net/ipv4/tcp_output.c | 13 ++++++++----- 3 files changed, 17 insertions(+), 11 deletions(-)
include/linux/tcp.h +3 -1
@@ -218,6 +218,8 @@ struct tcp_sock {u8 reord;/* reordering detected */ } rack;u16 advmss;/* Advertised MSS */ + u8 tlp_retrans:1, /* TLP is a retransmission */ + unused_1:7; u8 rate_app_limited:1, /* rate_{delivered,interval_us} limited? */ is_sack_reneg:1, /* in recovery from loss with SACK reneg? */ unused:6;
@@ -234,7 +236,7 @@ struct tcp_sock { syn_data_acked:1,/* data in SYN is acked by SYN-ACK */ save_syn:1, /* Save headers of SYN packet */ is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */ -u32 tlp_high_seq;/* snd_nxt at the time of TLP retransmit. */ +u32 tlp_high_seq;/* snd_nxt at the time of TLP */ /* RTT measurement */ u32 srtt_us;/* smoothed round trip time << 3 in usecs */
net/ipv4/tcp_input.c +6 -5
@@ -3566,10 +3566,8 @@ static void tcp_replace_ts_recent(struct } } -/* This routine deals with acks during a TLP episode. -* We mark the end of a TLP episode on receiving TLP dupack or when -* ack is after tlp_high_seq. -* Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe. +/* This routine deals with acks during a TLP episode and ends an episode by +* resetting tlp_high_seq. Ref: TLP algorithm in draft-ietf-tcpm-rack */ static void tcp_process_tlp_ack (struct sock *sk,u32 ack,int flag) {
@@ -3578,7 +3576,10 @@ static void tcp_process_tlp_ack(struct sif (before (ack, tp->tlp_high_seq))return ; -if (flag &FLAG_DSACKING_ACK ) { +if (!tp->tlp_retrans) { +/* TLP of new data has been acknowledged */ + tp->tlp_high_seq =0 ; + }else if (flag &FLAG_DSACKING_ACK ) {/* This DSACK means original and TLP probe arrived; no loss */ tp->tlp_high_seq =0 ; }else if (after (ack, tp->tlp_high_seq)) {
net/ipv4/tcp_output.c +8 -5
@@ -2357,6 +2357,11 @@ void tcp_send_loss_probe(struct sock *skint pcount;int mss =tcp_current_mss (sk); +/* At most one outstanding TLP */ +if (tp->tlp_high_seq) + goto rearm_timer; + + tp->tlp_retrans =0 ; skb =tcp_send_head (sk);if (skb) {if (tcp_snd_wnd_test (tp, skb, mss)) {
@@ -2379,10 +2384,6 @@ void tcp_send_loss_probe(struct sock *skreturn ; } -/* At most one outstanding TLP retransmission. */ -if (tp->tlp_high_seq) - goto rearm_timer; -if (skb_still_in_host_queue (sk, skb)) goto rearm_timer;
@@ -2403,10 +2404,12 @@ void tcp_send_loss_probe(struct sock *skif (__tcp_retransmit_skb (sk, skb,1 )) goto rearm_timer; + tp->tlp_retrans =1 ; + +probe_sent:/* Record snd_nxt for loss detection. */ tp->tlp_high_seq = tp->snd_nxt; -probe_sent:NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPLOSSPROBES );/* Reset s.t. tcp_rearm_rto will restart timer from now */ inet_csk (sk)->icsk_pending =0 ;
Greg Kroah-Hartman
maintainerPATCH 54/61 ip6_gre: fix null-ptr-deref in ip6gre_init_net()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 46ef5b89ec0ecf290d74c4aee844f063933c4da4 ]
KASAN report null-ptr-deref error when register_netdev() failed:
KASAN: null-ptr-deref in range [0x00000000000003c0-0x00000000000003c7] CPU: 2 PID: 422 Comm: ip Not tainted 5.8.0-rc4+ #12 Call Trace: ip6gre_init_net+0x4ab/0x580 ? ip6gre_tunnel_uninit+0x3f0/0x3f0 ops_init+0xa8/0x3c0 setup_net+0x2de/0x7e0 ? rcu_read_lock_bh_held+0xb0/0xb0 ? ops_init+0x3c0/0x3c0 ? kasan_unpoison_shadow+0x33/0x40 ? __kasan_kmalloc.constprop.0+0xc2/0xd0 copy_net_ns+0x27d/0x530 create_new_namespaces+0x382/0xa30 unshare_nsproxy_namespaces+0xa1/0x1d0 ksys_unshare+0x39c/0x780 ? walk_process_tree+0x2a0/0x2a0 ? trace_hardirqs_on+0x4a/0x1b0 ? _raw_spin_unlock_irq+0x1f/0x30 ? syscall_trace_enter+0x1a7/0x330 ? do_syscall_64+0x1c/0xa0 __x64_sys_unshare+0x2d/0x40 do_syscall_64+0x56/0xa0 entry_SYSCALL_64_after_hwframe+0x44/0xa9
ip6gre_tunnel_uninit() has set 'ign->fb_tunnel_dev' to NULL, later access to ign->fb_tunnel_dev cause null-ptr-deref. Fix it by saving 'ign->fb_tunnel_dev' to local variable ndev.
--- net/ipv6/ip6_gre.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/ipv6/ip6_gre.c +6 -5
@@ -1130,15 +1130,16 @@ static void ip6gre_destroy_tunnels(strucstatic int __net_init ip6gre_init_net (struct net *net) {struct ip6gre_net *ign =net_generic (net, ip6gre_net_id); +struct net_device *ndev;int err; - ign->fb_tunnel_dev =alloc_netdev (sizeof (struct ip6_tnl ),"ip6gre0" , -NET_NAME_UNKNOWN , - ip6gre_tunnel_setup); -if (!ign->fb_tunnel_dev) { + ndev =alloc_netdev (sizeof (struct ip6_tnl ),"ip6gre0" , +NET_NAME_UNKNOWN , ip6gre_tunnel_setup); +if (!ndev) { err = -ENOMEM ; goto err_alloc_dev; } + ign->fb_tunnel_dev = ndev;dev_net_set (ign->fb_tunnel_dev, net);/* FB netdevice is special: we have one, and only one per netns. * Allowing to move it to another netns is clearly unsafe.
@@ -1158,7 +1159,7 @@ static int __net_init ip6gre_init_net(streturn 0 ; err_reg_dev: -ip6gre_dev_free (ign->fb_tunnel_dev); +ip6gre_dev_free (ndev); err_alloc_dev:return err; }
Greg Kroah-Hartman
maintainerPATCH 55/61 drivers/net/wan/x25_asy: Fix to make it work
In reply to Greg Kroah-HartmanFrom: Xie He <[email protected]>
[ Upstream commit 8fdcabeac39824fe67480fd9508d80161c541854 ]
This driver is not working because of problems of its receiving code. This patch fixes it to make it work.
When the driver receives an LAPB frame, it should first pass the frame to the LAPB module to process. After processing, the LAPB module passes the data (the packet) back to the driver, the driver should then add a one-byte pseudo header and pass the data to upper layers.
The changes to the "x25_asy_bump" function and the "x25_asy_data_indication" function are to correctly implement this procedure.
Also, the "x25_asy_unesc" function ignores any frame that is shorter than 3 bytes. However the shortest frames are 2-byte long. So we need to change it to allow 2-byte frames to pass.
--- drivers/net/wan/x25_asy.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/net/wan/x25_asy.c +14 -7
@@ -186,7 +186,7 @@ static inline void x25_asy_unlock(structnetif_wake_queue (sl->dev); } -/* Send one completely decapsulated IP datagram to the IP layer. */ +/* Send an LAPB frame to the LAPB module to process. */ static void x25_asy_bump (struct x25_asy *sl) {
@@ -198,13 +198,12 @@ static void x25_asy_bump(struct x25_asy count = sl->rcount; dev->stats.rx_bytes += count; - skb =dev_alloc_skb (count+1 ); + skb =dev_alloc_skb (count);if (skb ==NULL ) {netdev_warn (sl->dev,"memory squeeze, dropping packet\n" ); dev->stats.rx_dropped++;return ; } -skb_push (skb,1 );/* LAPB internal control */ memcpy (skb_put (skb, count), sl->rbuff, count); skb->protocol =x25_type_trans (skb, sl->dev); err =lapb_data_received (skb->dev, skb);
@@ -212,7 +211,6 @@ static void x25_asy_bump(struct x25_asykfree_skb (skb);printk (KERN_DEBUG "x25_asy: data received err - %d\n" , err); }else { -netif_rx (skb); dev->stats.rx_packets++; } }
@@ -358,12 +356,21 @@ static netdev_tx_t x25_asy_xmit(struct s*/ /* -* Called when I frame data arrives. We did the work above - throw it -* at the net layer. +* Called when I frame data arrive. We add a pseudo header for upper +* layers and pass it to upper layers. */ static int x25_asy_data_indication (struct net_device *dev,struct sk_buff *skb) { +if (skb_cow (skb,1 )) { +kfree_skb (skb); +return NET_RX_DROP ; + } +skb_push (skb,1 ); + skb->data[0 ] =X25_IFACE_DATA ; + + skb->protocol =x25_type_trans (skb, dev); +return netif_rx (skb); }
@@ -659,7 +666,7 @@ static void x25_asy_unesc(struct x25_asyswitch (s) {case X25_END :if (!test_and_clear_bit (SLF_ERROR , &sl->flags) && - sl->rcount >2 ) + sl->rcount >=2 )x25_asy_bump (sl);clear_bit (SLF_ESCAPE , &sl->flags); sl->rcount =0 ;
Greg Kroah-Hartman
maintainerPATCH 56/61 regmap: debugfs: check count when read regmap file
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
commit 74edd08a4fbf51d65fd8f4c7d8289cd0f392bd91 upstream.
When executing the following command, we met kernel dump. dmesg -c > /dev/null; cd /sys;
for i in ls /sys/kernel/debug/regmap/* -d; do
echo "Checking regmap in $i"; cat $i/registers;
done && grep -ri "0x02d0" *;
It is because the count value is too big, and kmalloc fails. So add an upper bound check to allow max size PAGE_SIZE << (MAX_ORDER - 1).
--- drivers/base/regmap/regmap-debugfs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/base/regmap/regmap-debugfs.c +6 -0
@@ -204,6 +204,9 @@ static ssize_t regmap_read_debugfs(strucif (*ppos <0 || !count)return -EINVAL ; +if (count > (PAGE_SIZE << (MAX_ORDER -1 ))) + count =PAGE_SIZE << (MAX_ORDER -1 ); + buf =kmalloc (count,GFP_KERNEL );if (!buf)return -ENOMEM ;
@@ -352,6 +355,9 @@ static ssize_t regmap_reg_ranges_read_fiif (*ppos <0 || !count)return -EINVAL ; +if (count > (PAGE_SIZE << (MAX_ORDER -1 ))) + count =PAGE_SIZE << (MAX_ORDER -1 ); + buf =kmalloc (count,GFP_KERNEL );if (!buf)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 57/61 xfs: set format back to extents if xfs_bmap_extents_to_btree
In reply to Greg Kroah-HartmanFrom: Eric Sandeen <[email protected]>
commit 2c4306f719b083d17df2963bc761777576b8ad1b upstream.
If xfs_bmap_extents_to_btree fails in a mode where we call xfs_iroot_realloc(-1) to de-allocate the root, set the format back to extents.
Otherwise we can assume we can dereference ifp->if_broot based on the XFS_DINODE_FMT_BTREE format, and crash.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199423
--- fs/xfs/libxfs/xfs_bmap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/xfs/libxfs/xfs_bmap.c +4 -0
@@ -781,6 +781,8 @@ try_another_ag: *logflagsp =0 ;if ((error =xfs_alloc_vextent (&args))) {xfs_iroot_realloc (ip,-1 , whichfork); +ASSERT (ifp->if_broot ==NULL ); +XFS_IFORK_FMT_SET (ip, whichfork,XFS_DINODE_FMT_EXTENTS );xfs_btree_del_cursor (cur,XFS_BTREE_ERROR );return error; }
@@ -801,6 +803,8 @@ try_another_ag: }if (WARN_ON_ONCE (args.fsbno ==NULLFSBLOCK )) {xfs_iroot_realloc (ip,-1 , whichfork); +ASSERT (ifp->if_broot ==NULL ); +XFS_IFORK_FMT_SET (ip, whichfork,XFS_DINODE_FMT_EXTENTS );xfs_btree_del_cursor (cur,XFS_BTREE_ERROR );return -ENOSPC ; }
Greg Kroah-Hartman
maintainerPATCH 58/61 perf probe: Fix to check blacklist address correctly
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
commit 80526491c2ca6abc028c0f0dbb0707a1f35fb18a upstream.
Fix to check kprobe blacklist address correctly with relocated address by adjusting debuginfo address.
Since the address in the debuginfo is same as objdump, it is different from relocated kernel address with KASLR. Thus, 'perf probe' always misses to catch the blacklisted addresses.
Without this patch, 'perf probe' can not detect the blacklist addresses on a KASLR enabled kernel.
# perf probe kprobe_dispatcher
Failed to write event: Invalid argument
Error: Failed to add events.
#With this patch, it correctly shows the error message.
# perf probe kprobe_dispatcher
kprobe_dispatcher is blacklisted function, skip it.
Probe point 'kprobe_dispatcher' not found.
Error: Failed to add events.
#--- tools/perf/util/probe-event.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
tools/perf/util/probe-event.c +15 -6
@@ -118,7 +118,7 @@ static struct symbol *__find_kernel_funcreturn machine__find_kernel_function (host_machine, addr, mapp); } -static struct ref_reloc_sym *kernel_get_ref_reloc_sym (void ) +static struct ref_reloc_sym *kernel_get_ref_reloc_sym (struct map **pmap) {/* kmap->ref_reloc_sym should be set if host_machine is initialized */ struct kmap *kmap;
@@ -130,6 +130,10 @@ static struct ref_reloc_sym *kernel_get_ kmap =map__kmap (map);if (!kmap)return NULL ; + +if (pmap) + *pmap = map; +return kmap->ref_reloc_sym; }
@@ -141,7 +145,7 @@ static int kernel_get_symbol_address_by_struct map *map;/* ref_reloc_sym is just a label. Need a special fix*/ - reloc_sym =kernel_get_ref_reloc_sym (); + reloc_sym =kernel_get_ref_reloc_sym (NULL );if (reloc_sym &&strcmp (name, reloc_sym->name) ==0 ) *addr = (reloc) ? reloc_sym->addr : reloc_sym->unrelocated_addr;else {
@@ -742,6 +746,7 @@ post_process_kernel_probe_trace_events(s int ntevs) {struct ref_reloc_sym *reloc_sym; +struct map *map;char *tmp;int i, skipped =0 ;
@@ -750,7 +755,7 @@ post_process_kernel_probe_trace_events(sreturn post_process_offline_probe_trace_events (tevs, ntevs, symbol_conf.vmlinux_name); - reloc_sym =kernel_get_ref_reloc_sym (); + reloc_sym =kernel_get_ref_reloc_sym (&map);if (!reloc_sym) {pr_warning ("Relocated base symbol is not found!\n" );return -EINVAL ;
@@ -759,9 +764,13 @@ post_process_kernel_probe_trace_events(sfor (i =0 ; i < ntevs; i++) {if (!tevs[i].point.address || tevs[i].point.retprobe)continue ; -/* If we found a wrong one, mark it by NULL symbol */ +/* +* If we found a wrong one, mark it by NULL symbol. +* Since addresses in debuginfo is same as objdump, we need +* to convert it to addresses on memory. +*/ if (kprobe_warn_out_range (tevs[i].point.symbol, - tevs[i].point.address)) { +map__objdump_2mem (map, tevs[i].point.address))) { tmp =NULL ; skipped++; }else {
@@ -2850,7 +2859,7 @@ static int find_probe_trace_events_from_/* Note that the symbols in the kmodule are not relocated */ if (!pev->uprobes && !pp->retprobe && !pev->target) { - reloc_sym =kernel_get_ref_reloc_sym (); + reloc_sym =kernel_get_ref_reloc_sym (NULL );if (!reloc_sym) {pr_warning ("Relocated base symbol is not found!\n" ); ret = -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 59/61 perf annotate: Use asprintf when formatting objdump command line
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
commit 6810158d526e483868e519befff407b91e76b3db upstream.
We were using a local buffer with an arbitrary size, that would have to get increased to avoid truncation as warned by gcc 8:
util/annotate.c: In function 'symbol__disassemble':
util/annotate.c:1488:4: error: '%s' directive output may be truncated writing up to 4095 bytes into a region of size between 3966 and 8086 [-Werror=format-truncation=]
"%s %s%s --start-address=0x%016" PRIx64
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util/annotate.c:1498:20:
symfs_filename, symfs_filename);
~~~~~~~~~~~~~~
util/annotate.c:1490:50: note: format string is defined here
" -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand",
^~
In file included from /usr/include/stdio.h:861,
from util/color.h:5,
from util/sort.h:8,
from util/annotate.c:14:
/usr/include/bits/stdio2.h:67:10: note: '__builtin___snprintf_chk' output 116 or more bytes (assuming 8331) into a destination of size 8192
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~So switch to asprintf, that will make sure enough space is available.
--- tools/perf/util/annotate.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
tools/perf/util/annotate.c +12 -5
@@ -1302,7 +1302,7 @@ fallback:int symbol__disassemble (struct symbol *sym,struct map *map,size_t privsize) {struct dso *dso = map->dso; -char command[PATH_MAX *2 ]; +char *command;FILE *file;char symfs_filename[PATH_MAX ];struct kcore_extract kce;
@@ -1364,7 +1364,7 @@ int symbol__disassemble(struct symbol *sstrcpy (symfs_filename, tmp); } - snprintf(command, sizeof(command), + err = asprintf(&command, "%s %s%s --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
@@ -1377,12 +1377,17 @@ int symbol__disassemble(struct symbol *s symbol_conf.annotate_src ?"-S" :"" , symfs_filename, symfs_filename); +if (err <0 ) { +pr_err ("Failure allocating memory for the command to run\n" ); + goto out_remove_tmp; + } +pr_debug ("Executing: %s\n" , command); err =-1 ;if (pipe (stdout_fd) <0 ) {pr_err ("Failure creating the pipe to run %s\n" , command); - goto out_remove_tmp; + goto out_free_command; } pid =fork ();
@@ -1409,7 +1414,7 @@ int symbol__disassemble(struct symbol *s* If we were using debug info should retry with * original binary. */ - goto out_remove_tmp; + goto out_free_command; } nline =0 ;
@@ -1432,6 +1437,8 @@ int symbol__disassemble(struct symbol *sfclose (file); err =0 ; +out_free_command: +free (command); out_remove_tmp:close (stdout_fd[0 ]);
@@ -1445,7 +1452,7 @@ out: out_close_stdout:close (stdout_fd[1 ]); - goto out_remove_tmp; + goto out_free_command; }static void insert_source_line (struct rb_root *root,struct source_line *src_line)
Greg Kroah-Hartman
maintainerPATCH 60/61 perf tools: Fix snprint warnings for gcc 8
In reply to Greg Kroah-HartmanFrom: Jiri Olsa <[email protected]>
commit 77f18153c080855e1c3fb520ca31a4e61530121d upstream.
[Add an additional sprintf replacement in tools/perf/builtin-script.c]
With gcc 8 we get new set of snprintf() warnings that breaks the compilation, one example:
tests/mem.c: In function ‘check’:
tests/mem.c:19:48: error: ‘%s’ directive output may be truncated writing \
up to 99 bytes into a region of size 89 [-Werror=format-truncation=]
snprintf(failure, sizeof failure, "unexpected %s", out);
The gcc docs says:
To avoid the warning either use a bigger buffer or handle the function's return value which indicates whether or not its output has been truncated.
Given that all these warnings are harmless, because the code either properly fails due to uncomplete file path or we don't care for truncated output at all, I'm changing all those snprintf() calls to scnprintf(), which actually 'checks' for the snprint return value so the gcc stays silent.
--- tools/perf/builtin-script.c | 24 ++++++++++++------------ tools/perf/tests/attr.c | 4 ++-- tools/perf/tests/pmu.c | 2 +- tools/perf/util/cgroup.c | 2 +- tools/perf/util/parse-events.c | 4 ++-- tools/perf/util/pmu.c | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-)
tools/perf/builtin-script.c +12 -12
@@ -1516,7 +1516,7 @@ static int is_directory(const char *basechar path[PATH_MAX ];struct stat st; -sprintf (path,"%s/%s" , base_path, dent->d_name); +scnprintf (path,PATH_MAX ,"%s/%s" , base_path, dent->d_name);if (stat (path, &st))return 0 ;
@@ -1702,8 +1702,8 @@ static int list_available_scripts(const }for_each_lang (scripts_path, scripts_dir, lang_dirent) { -snprintf (lang_path,MAXPATHLEN ,"%s/%s/bin" , scripts_path, - lang_dirent->d_name); +scnprintf (lang_path,MAXPATHLEN ,"%s/%s/bin" , scripts_path, + lang_dirent->d_name); lang_dir =opendir (lang_path);if (!lang_dir)continue ;
@@ -1712,8 +1712,8 @@ static int list_available_scripts(const script_root =get_script_root (script_dirent,REPORT_SUFFIX );if (script_root) { desc =script_desc__findnew (script_root); -snprintf (script_path,MAXPATHLEN ,"%s/%s" , - lang_path, script_dirent->d_name); +scnprintf (script_path,MAXPATHLEN ,"%s/%s" , + lang_path, script_dirent->d_name);read_script_info (desc, script_path);free (script_root); }
@@ -1749,7 +1749,7 @@ static int check_ev_match(char *dir_nameint match, len;FILE *fp; -sprintf (filename,"%s/bin/%s-record" , dir_name, scriptname); +scnprintf (filename,MAXPATHLEN ,"%s/bin/%s-record" , dir_name, scriptname); fp =fopen (filename,"r" );if (!fp)
@@ -1825,8 +1825,8 @@ int find_scripts(char **scripts_array, c }for_each_lang (scripts_path, scripts_dir, lang_dirent) { -snprintf (lang_path,MAXPATHLEN ,"%s/%s" , scripts_path, - lang_dirent->d_name); +scnprintf (lang_path,MAXPATHLEN ,"%s/%s" , scripts_path, + lang_dirent->d_name);#ifdef NO_LIBPERL if (strstr (lang_path,"perl" ))continue ;
@@ -1881,8 +1881,8 @@ static char *get_script_path(const charreturn NULL ;for_each_lang (scripts_path, scripts_dir, lang_dirent) { -snprintf (lang_path,MAXPATHLEN ,"%s/%s/bin" , scripts_path, - lang_dirent->d_name); +scnprintf (lang_path,MAXPATHLEN ,"%s/%s/bin" , scripts_path, + lang_dirent->d_name); lang_dir =opendir (lang_path);if (!lang_dir)continue ;
@@ -1893,8 +1893,8 @@ static char *get_script_path(const charfree (__script_root);closedir (lang_dir);closedir (scripts_dir); -snprintf (script_path,MAXPATHLEN ,"%s/%s" , - lang_path, script_dirent->d_name); +scnprintf (script_path,MAXPATHLEN ,"%s/%s" , + lang_path, script_dirent->d_name);return strdup (script_path); }free (__script_root);
tools/perf/tests/attr.c +2 -2
@@ -147,8 +147,8 @@ static int run_dir(const char *d, constif (verbose) vcnt++; -snprintf (cmd,3 *PATH_MAX ,PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s" , - d, d, perf, vcnt, v); +scnprintf (cmd,3 *PATH_MAX ,PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s" , + d, d, perf, vcnt, v);return system (cmd) ?TEST_FAIL :TEST_OK ; }
tools/perf/tests/pmu.c +1 -1
@@ -95,7 +95,7 @@ static char *test_format_dir_get(void)struct test_format *format = &test_formats[i];FILE *file; -snprintf (name,PATH_MAX ,"%s/%s" , dir, format->name); +scnprintf (name,PATH_MAX ,"%s/%s" , dir, format->name); file =fopen (name,"w" );if (!file)
tools/perf/util/cgroup.c +1 -1
@@ -64,7 +64,7 @@ static int open_cgroup(char *name)if (cgroupfs_find_mountpoint (mnt,PATH_MAX +1 ))return -1 ; -snprintf (path,PATH_MAX ,"%s/%s" , mnt, name); +scnprintf (path,PATH_MAX ,"%s/%s" , mnt, name); fd =open (path,O_RDONLY );if (fd ==-1 )
tools/perf/util/parse-events.c +2 -2
@@ -195,8 +195,8 @@ struct tracepoint_path *tracepoint_id_tofor_each_event (sys_dirent, evt_dir, evt_dirent) { -snprintf (evt_path,MAXPATHLEN ,"%s/%s/id" , dir_path, - evt_dirent->d_name); +scnprintf (evt_path,MAXPATHLEN ,"%s/%s/id" , dir_path, + evt_dirent->d_name); fd =open (evt_path,O_RDONLY );if (fd <0 )continue ;
tools/perf/util/pmu.c +1 -1
@@ -325,7 +325,7 @@ static int pmu_aliases_parse(char *dir,if (pmu_alias_info_file (name))continue ; -snprintf (path,PATH_MAX ,"%s/%s" , dir, name); +scnprintf (path,PATH_MAX ,"%s/%s" , dir, name); file =fopen (path,"r" );if (!file) {
Greg Kroah-Hartman
maintainerPATCH 61/61 perf: Make perf able to build with latest libbfd
In reply to Greg Kroah-HartmanFrom: Changbin Du <[email protected]>
commit 0ada120c883d4f1f6aafd01cf0fbb10d8bbba015 upstream.
libbfd has changed the bfd_section_* macros to inline functions bfd_section_<field> since 2019-09-18. See below two commits:
o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html
This fix make perf able to build with both old and new libbfd.
--- tools/perf/util/srcline.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
tools/perf/util/srcline.c +15 -1
@@ -86,16 +86,30 @@ static void find_address_in_section(bfdbfd_vma pc, vma;bfd_size_type size;struct a2l_data *a2l = data; +flagword flags;if (a2l->found)return ; -if ((bfd_get_section_flags (abfd, section) &SEC_ALLOC ) ==0 ) +#ifdef bfd_get_section_flags + flags =bfd_get_section_flags (abfd, section); +#else + flags =bfd_section_flags (section); +#endif +if ((flags &SEC_ALLOC ) ==0 )return ; pc = a2l->addr; +#ifdef bfd_get_section_vma vma =bfd_get_section_vma (abfd, section); +#else + vma =bfd_section_vma (section); +#endif +#ifdef bfd_get_section_size size =bfd_get_section_size (section); +#else + size =bfd_section_size (section); +#endif if (pc < vma || pc >= vma + size)return ;
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.232 release. There are 61 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 01 Aug 2020 07:44:05 +0000. Anything received after that time might be too late.
Build results:
total: 171 pass: 171 fail: 0 Qemu test results: total: 386 pass: 386 fail: 0
Guenter
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.232 release. There are 61 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 01 Aug 2020 07:44:05 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.232-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.9:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
30 tests: 30 pass, 0 failLinux version: 4.9.232-rc1-g3c1be84608a0
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.232 release. There are 61 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 01 Aug 2020 07:44:05 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.232-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.9.232-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: 3c1be84608a0c22e5b574396a51ed93a7f3206ba
git describe: v4.9.231-62-g3c1be84608a0
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.231-62-g3c1be84608a0
No regressions (compared to build v4.9.231)
No fixes (compared to build v4.9.231)
Ran 34650 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- juno-r2-compat
- juno-r2-kasan
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
- x86-kasan
Test Suites
-----------
* build
* igt-gpu-tools
* install-android-platform-tools-r2600
* install-android-platform-tools-r2800
* kselftest
* kselftest/drivers
* kselftest/filesystems
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* v4l2-compliance
* kvm-unit-tests
* network-basic-tests
* ltp-open-posix-tests
* kselftest/net
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-native/drivers
* kselftest-vsyscall-mode-native/filesystems
* kselftest-vsyscall-mode-none
* kselftest-vsyscall-mode-none/drivers
* kselftest-vsyscall-mode-none/filesystems
* ssuite
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org