4.19.101-stable review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 4.19.101-stable review
This is the start of the stable review cycle for the 4.19.101 release. There are 55 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 Feb 2020 18:35:06 +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.19.101-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.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.101-rc1
Andrew Murray <[email protected]>
KVM: arm64: Write arch.mdcr_el2 changes since last vcpu_load on VHE
Dave Chinner <[email protected]>
block: fix 32 bit overflow in __blkdev_issue_discard()
Ming Lei <[email protected]>
block: cleanup __blkdev_issue_discard()
Linus Torvalds <[email protected]>
random: try to actively add entropy rather than passively wait for it
Herbert Xu <[email protected]>
crypto: af_alg - Use bh_lock_sock in sk_destruct
Johan Hovold <[email protected]>
rsi: fix non-atomic allocation in completion handler
Johan Hovold <[email protected]>
rsi: fix memory leak on failed URB submission
Johan Hovold <[email protected]>
rsi: fix use-after-free on probe errors
Vincent Guittot <[email protected]>
sched/fair: Fix insertion in rq->leaf_cfs_rq_list
Peter Zijlstra <[email protected]>
sched/fair: Add tmp_alone_branch assertion
Laura Abbott <[email protected]>
usb-storage: Disable UAS on JMicron SATA enclosure
Ben Dooks <[email protected]>
ARM: OMAP2+: SmartReflex: add omap_sr_pdata definition
Logan Gunthorpe <[email protected]>
iommu/amd: Support multiple PCI DMA aliases in IRQ Remapping
Slawomir Pawlowski <[email protected]>
PCI: Add DMA alias quirk for Intel VCA NTB
Pacien TRAN-GIRARD <[email protected]>
platform/x86: dell-laptop: disable kbd backlight on Inspiron 10xx
Rodrigo Rivas Costa <[email protected]>
HID: steam: Fix input device disappearing
Arnd Bergmann <[email protected]>
atm: eni: fix uninitialized variable warning
Dmitry Osipenko <[email protected]>
gpio: max77620: Add missing dependency on GPIOLIB_IRQCHIP
Krzysztof Kozlowski <[email protected]>
net: wan: sdla: Fix cast from pointer to integer of different size
Fenghua Yu <[email protected]>
drivers/net/b44: Change to non-atomic bit operations on pwol_mask
wuxu.wu <[email protected]>
spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls
Andreas Kemnade <[email protected]>
watchdog: rn5t618_wdt: fix module aliases
David Engraf <[email protected]>
watchdog: max77620_wdt: fix potential build errors
Tony Lindgren <[email protected]>
phy: cpcap-usb: Prevent USB line glitches from waking up modem
Bjorn Andersson <[email protected]>
phy: qcom-qmp: Increase PHY ready timeout
Pan Zhang <[email protected]>
drivers/hid/hid-multitouch.c: fix a possible null pointer access.
Pavel Balan <[email protected]>
HID: Add quirk for incorrect input length on Lenovo Y720
Hans de Goede <[email protected]>
HID: ite: Add USB id match for Acer SW5-012 keyboard dock
Priit Laes <[email protected]>
HID: Add quirk for Xin-Mo Dual Controller
Randy Dunlap <[email protected]>
arc: eznps: fix allmodconfig kconfig warning
Aaron Ma <[email protected]>
HID: multitouch: Add LG MELF0410 I2C touchscreen support
Cong Wang <[email protected]>
net_sched: fix ops->bind_class() implementations
Eric Dumazet <[email protected]>
net_sched: ematch: reject invalid TCF_EM_SIMPLE
Johan Hovold <[email protected]>
zd1211rw: fix storage endpoint lookup
Johan Hovold <[email protected]>
rtl8xxxu: fix interface sanity check
Johan Hovold <[email protected]>
brcmfmac: fix interface sanity check
Johan Hovold <[email protected]>
ath9k: fix storage endpoint lookup
Paulo Alcantara (SUSE) <[email protected]>
cifs: Fix memory allocation in __smb2_handle_cancelled_cmd()
Eric Biggers <[email protected]>
crypto: chelsio - fix writing tfm flags to wrong place
Andy Shevchenko <[email protected]>
iio: st_gyro: Correct data for LSM9DS0 gyro
Tomas Winkler <[email protected]>
mei: me: add comet point (lake) H device ids
Lubomir Rintel <[email protected]>
component: do not dereference opaque pointer in debugfs
Lukas Wunner <[email protected]>
serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
Malcolm Priestley <[email protected]>
staging: vt6656: Fix false Tx excessive retries reporting.
Malcolm Priestley <[email protected]>
staging: vt6656: use NULLFUCTION stack on mac80211
Malcolm Priestley <[email protected]>
staging: vt6656: correct packet types for CTS protect, mode.
Colin Ian King <[email protected]>
staging: wlan-ng: ensure error return is actually returned
Andrey Shvetsov <[email protected]>
staging: most: net: fix buffer overflow
Bin Liu <[email protected]>
usb: dwc3: turn off VBUS when leaving host mode
Johan Hovold <[email protected]>
USB: serial: ir-usb: fix IrLAP framing
Johan Hovold <[email protected]>
USB: serial: ir-usb: fix link-speed handling
Johan Hovold <[email protected]>
USB: serial: ir-usb: add missing endpoint sanity check
Heikki Krogerus <[email protected]>
usb: dwc3: pci: add ID for the Intel Comet Lake -V variant
Johan Hovold <[email protected]>
rsi_91x_usb: fix interface sanity check
Johan Hovold <[email protected]>
orinoco_usb: fix interface sanity check
-------------
Diffstat:
Makefile | 4 +- arch/arc/plat-eznps/Kconfig | 2 +- arch/arm64/kvm/debug.c | 6 +- block/blk-lib.c | 23 +--- crypto/af_alg.c | 6 +- drivers/atm/eni.c | 4 +- drivers/base/component.c | 8 +- drivers/char/random.c | 62 ++++++++- drivers/crypto/chelsio/chcr_algo.c | 16 +-- drivers/gpio/Kconfig | 1 + drivers/hid/hid-ids.h | 3 + drivers/hid/hid-ite.c | 3 + drivers/hid/hid-multitouch.c | 5 +- drivers/hid/hid-quirks.c | 1 + drivers/hid/hid-steam.c | 4 + drivers/hid/i2c-hid/i2c-hid-core.c | 16 ++- drivers/iio/gyro/st_gyro_core.c | 75 +++++++++- drivers/iommu/amd_iommu.c | 37 ++++- drivers/misc/mei/hw-me-regs.h | 4 + drivers/misc/mei/pci-me.c | 2 + drivers/net/ethernet/broadcom/b44.c | 9 +- drivers/net/wan/sdla.c | 2 +- drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +- .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 +- .../net/wireless/intersil/orinoco/orinoco_usb.c | 4 +- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- drivers/net/wireless/rsi/rsi_91x_hal.c | 12 +- drivers/net/wireless/rsi/rsi_91x_usb.c | 19 +-- drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 +- drivers/pci/quirks.c | 34 +++++ drivers/phy/motorola/phy-cpcap-usb.c | 18 ++- drivers/phy/qualcomm/phy-qcom-qmp.c | 2 +- drivers/platform/x86/dell-laptop.c | 26 ++++ drivers/spi/spi-dw.c | 15 +- drivers/spi/spi-dw.h | 1 + drivers/staging/most/net/net.c | 10 ++ drivers/staging/vt6656/device.h | 2 + drivers/staging/vt6656/int.c | 6 +- drivers/staging/vt6656/main_usb.c | 1 + drivers/staging/vt6656/rxtx.c | 26 ++-- drivers/staging/wlan-ng/prism2mgmt.c | 2 +- drivers/tty/serial/8250/8250_bcm2835aux.c | 2 +- drivers/usb/dwc3/core.c | 3 + drivers/usb/dwc3/dwc3-pci.c | 4 + drivers/usb/serial/ir-usb.c | 136 +++++++++++++----- drivers/usb/storage/unusual_uas.h | 7 +- drivers/watchdog/Kconfig | 1 + drivers/watchdog/rn5t618_wdt.c | 1 + fs/cifs/smb2misc.c | 2 +- include/linux/power/smartreflex.h | 3 + include/linux/usb/irda.h | 13 +- include/net/pkt_cls.h | 33 +++-- include/net/sch_generic.h | 3 +- kernel/sched/fair.c | 153 +++++++++++++-------- net/sched/cls_basic.c | 11 +- net/sched/cls_bpf.c | 11 +- net/sched/cls_flower.c | 11 +- net/sched/cls_fw.c | 11 +- net/sched/cls_matchall.c | 11 +- net/sched/cls_route.c | 11 +- net/sched/cls_rsvp.h | 11 +- net/sched/cls_tcindex.c | 11 +- net/sched/cls_u32.c | 11 +- net/sched/ematch.c | 3 + net/sched/sch_api.c | 6 +- 65 files changed, 710 insertions(+), 240 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/55 orinoco_usb: fix interface sanity check
From: Johan Hovold <[email protected]>
commit b73e05aa543cf8db4f4927e36952360d71291d41 upstream.
Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface.
Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on.
--- drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intersil/orinoco/orinoco_usb.c +2 -2
@@ -1611,9 +1611,9 @@ static int ezusb_probe(struct usb_interf/* set up the endpoint information */ /* check out the endpoints */ - iface_desc = &interface->altsetting[0 ].desc; + iface_desc = &interface->cur_altsetting->desc;for (i =0 ; i < iface_desc->bNumEndpoints; ++i) { - ep = &interface->altsetting[0 ].endpoint[i].desc; + ep = &interface->cur_altsetting->endpoint[i].desc;if (usb_endpoint_is_bulk_in (ep)) {/* we found a bulk in endpoint */
Greg Kroah-Hartman
maintainerPATCH 2/55 rsi_91x_usb: fix interface sanity check
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 3139b180906af43bc09bd3373fc2338a8271d9d9 upstream.
Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface.
Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on.
--- drivers/net/wireless/rsi/rsi_91x_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_usb.c +1 -1
@@ -117,7 +117,7 @@ static int rsi_find_bulk_in_and_out_endp__le16 buffer_size;int ii, bin_found =0 , bout_found =0 ; - iface_desc = &(interface->altsetting[0 ]); + iface_desc = interface->cur_altsetting;for (ii =0 ; ii < iface_desc->desc.bNumEndpoints; ++ii) { endpoint = &(iface_desc->endpoint[ii].desc);
Greg Kroah-Hartman
maintainerPATCH 3/55 usb: dwc3: pci: add ID for the Intel Comet Lake -V variant
In reply to Greg Kroah-HartmanFrom: Heikki Krogerus <[email protected]>
commit f5ae8869095552e3396ee3e404f9586cc6a828f0 upstream.
There is one more Comet Lake PCH variant, CML-V, that has its own PCI ID.
--- drivers/usb/dwc3/dwc3-pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/dwc3/dwc3-pci.c +4 -0
@@ -34,6 +34,7 @@#define PCI_DEVICE_ID_INTEL_GLK 0x31aa#define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee#define PCI_DEVICE_ID_INTEL_CNPH 0xa36e +#define PCI_DEVICE_ID_INTEL_CNPV 0xa3b0#define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee#define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
@@ -340,6 +341,9 @@ static const struct pci_device_id dwc3_p {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_CNPH ), (kernel_ulong_t) &dwc3_pci_intel_properties, }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPV), + (kernel_ulong_t) &dwc3_pci_intel_properties, }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP), (kernel_ulong_t) &dwc3_pci_intel_properties, },
Greg Kroah-Hartman
maintainerPATCH 4/55 USB: serial: ir-usb: add missing endpoint sanity check
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 2988a8ae7476fe9535ab620320790d1714bdad1d upstream.
Add missing endpoint sanity check to avoid dereferencing a NULL-pointer on open() in case a device lacks a bulk-out endpoint.
Note that prior to commit f4a4cbb2047e ("USB: ir-usb: reimplement using generic framework") the oops would instead happen on open() if the device lacked a bulk-in endpoint and on write() if it lacked a bulk-out endpoint.
--- drivers/usb/serial/ir-usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/ir-usb.c +3 -0
@@ -195,6 +195,9 @@ static int ir_startup(struct usb_serialstruct usb_irda_cs_descriptor *irda_desc;int rates; +if (serial->num_bulk_in <1 || serial->num_bulk_out <1 ) +return -ENODEV ; + irda_desc =irda_usb_find_class_desc (serial,0 );if (!irda_desc) { dev_err(&serial->dev->dev,
Greg Kroah-Hartman
maintainerPATCH 5/55 USB: serial: ir-usb: fix link-speed handling
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 17a0184ca17e288decdca8b2841531e34d49285f upstream.
Commit e0d795e4f36c ("usb: irda: cleanup on ir-usb module") added a USB IrDA header with common defines, but mistakingly switched to using the class-descriptor baud-rate bitmask values for the outbound header.
This broke link-speed handling for rates above 9600 baud, but a device would also be able to operate at the default 9600 baud until a link-speed request was issued (e.g. using the TCGETS ioctl).
--- drivers/usb/serial/ir-usb.c | 20 ++++++++++---------- include/linux/usb/irda.h | 13 ++++++++++++- 2 files changed, 22 insertions(+), 11 deletions(-)
drivers/usb/serial/ir-usb.c +10 -10
@@ -335,34 +335,34 @@ static void ir_set_termios(struct tty_stswitch (baud) {case 2400 : - ir_baud =USB_IRDA_BR_2400 ; + ir_baud =USB_IRDA_LS_2400 ;break ;case 9600 : - ir_baud =USB_IRDA_BR_9600 ; + ir_baud =USB_IRDA_LS_9600 ;break ;case 19200 : - ir_baud =USB_IRDA_BR_19200 ; + ir_baud =USB_IRDA_LS_19200 ;break ;case 38400 : - ir_baud =USB_IRDA_BR_38400 ; + ir_baud =USB_IRDA_LS_38400 ;break ;case 57600 : - ir_baud =USB_IRDA_BR_57600 ; + ir_baud =USB_IRDA_LS_57600 ;break ;case 115200 : - ir_baud =USB_IRDA_BR_115200 ; + ir_baud =USB_IRDA_LS_115200 ;break ;case 576000 : - ir_baud =USB_IRDA_BR_576000 ; + ir_baud =USB_IRDA_LS_576000 ;break ;case 1152000 : - ir_baud =USB_IRDA_BR_1152000 ; + ir_baud =USB_IRDA_LS_1152000 ;break ;case 4000000 : - ir_baud =USB_IRDA_BR_4000000 ; + ir_baud =USB_IRDA_LS_4000000 ;break ;default : - ir_baud =USB_IRDA_BR_9600 ; + ir_baud =USB_IRDA_LS_9600 ; baud =9600 ; }
include/linux/usb/irda.h +12 -1
@@ -119,11 +119,22 @@ struct usb_irda_cs_descriptor {* 6 - 115200 bps * 7 - 576000 bps * 8 - 1.152 Mbps -* 9 - 5 mbps +* 9 - 4 Mbps * 10..15 - Reserved */ #define USB_IRDA_STATUS_LINK_SPEED 0x0f +#define USB_IRDA_LS_NO_CHANGE 0 +#define USB_IRDA_LS_2400 1 +#define USB_IRDA_LS_9600 2 +#define USB_IRDA_LS_19200 3 +#define USB_IRDA_LS_38400 4 +#define USB_IRDA_LS_57600 5 +#define USB_IRDA_LS_115200 6 +#define USB_IRDA_LS_576000 7 +#define USB_IRDA_LS_1152000 8 +#define USB_IRDA_LS_4000000 9 +/* The following is a 4-bit value used only for * outbound header: *
Greg Kroah-Hartman
maintainerPATCH 6/55 USB: serial: ir-usb: fix IrLAP framing
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 38c0d5bdf4973f9f5a888166e9d3e9ed0d32057a upstream.
Commit f4a4cbb2047e ("USB: ir-usb: reimplement using generic framework") switched to using the generic write implementation which may combine multiple write requests into larger transfers. This can break the IrLAP protocol where end-of-frame is determined using the USB short packet mechanism, for example, if multiple frames are sent in rapid succession.
--- drivers/usb/serial/ir-usb.c | 113 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 91 insertions(+), 22 deletions(-)
drivers/usb/serial/ir-usb.c +91 -22
@@ -45,9 +45,10 @@ static int buffer_size;static int xbof =-1 ;static int ir_startup (struct usb_serial *serial); -static int ir_open (struct tty_struct *tty,struct usb_serial_port *port); -static int ir_prepare_write_buffer (struct usb_serial_port *port, -void *dest,size_t size); +static int ir_write (struct tty_struct *tty,struct usb_serial_port *port, +const unsigned char *buf,int count); +static int ir_write_room (struct tty_struct *tty); +static void ir_write_bulk_callback (struct urb *urb);static void ir_process_read_urb (struct urb *urb);static void ir_set_termios (struct tty_struct *tty,struct usb_serial_port *port,struct ktermios *old_termios);
@@ -77,8 +78,9 @@ static struct usb_serial_driver ir_devic .num_ports = 1, .set_termios = ir_set_termios, .attach = ir_startup, - .open = ir_open, - .prepare_write_buffer = ir_prepare_write_buffer, + .write = ir_write, + .write_room = ir_write_room, + .write_bulk_callback = ir_write_bulk_callback, .process_read_urb = ir_process_read_urb, };
@@ -254,35 +256,102 @@ static int ir_startup(struct usb_serialreturn 0 ; } -static int ir_open (struct tty_struct *tty,struct usb_serial_port *port) +static int ir_write (struct tty_struct *tty,struct usb_serial_port *port, +const unsigned char *buf,int count) { -int i; +struct urb *urb =NULL ; +unsigned long flags; +int ret; -for (i =0 ; i <ARRAY_SIZE (port->write_urbs); ++i) - port->write_urbs[i]->transfer_flags =URB_ZERO_PACKET ; +if (port->bulk_out_size ==0 ) +return -EINVAL ; -/* Start reading from the device */ -return usb_serial_generic_open (tty, port); -} +if (count ==0 ) +return 0 ; -static int ir_prepare_write_buffer (struct usb_serial_port *port, -void *dest,size_t size) -{ -unsigned char *buf = dest; -int count; + count =min (count, port->bulk_out_size -1 ); + +spin_lock_irqsave (&port->lock, flags); +if (__test_and_clear_bit (0 , &port->write_urbs_free)) { + urb = port->write_urbs[0 ]; + port->tx_bytes += count; + } +spin_unlock_irqrestore (&port->lock, flags); + +if (!urb) +return 0 ;/* * The first byte of the packet we send to the device contains an -* inbound header which indicates an additional number of BOFs and +* outbound header which indicates an additional number of BOFs and * a baud rate change. * * See section 5.4.2.2 of the USB IrDA spec. */ - *buf = ir_xbof | ir_baud; + *(u8 *)urb->transfer_buffer = ir_xbof | ir_baud; + +memcpy (urb->transfer_buffer +1 , buf, count); + + urb->transfer_buffer_length = count +1 ; + urb->transfer_flags =URB_ZERO_PACKET ; + + ret =usb_submit_urb (urb,GFP_ATOMIC ); +if (ret) { +dev_err (&port->dev,"failed to submit write urb: %d\n" , ret); + +spin_lock_irqsave (&port->lock, flags); +__set_bit (0 , &port->write_urbs_free); + port->tx_bytes -= count; +spin_unlock_irqrestore (&port->lock, flags); + +return ret; + } + +return count; +} + +static void ir_write_bulk_callback (struct urb *urb) +{ +struct usb_serial_port *port = urb->context; +int status = urb->status; +unsigned long flags; + +spin_lock_irqsave (&port->lock, flags); +__set_bit (0 , &port->write_urbs_free); + port->tx_bytes -= urb->transfer_buffer_length -1 ; +spin_unlock_irqrestore (&port->lock, flags); + +switch (status) { +case 0 : +break ; +case -ENOENT : +case -ECONNRESET : +case -ESHUTDOWN : +dev_dbg (&port->dev,"write urb stopped: %d\n" , status); +return ; +case -EPIPE : +dev_err (&port->dev,"write urb stopped: %d\n" , status); +return ; +default : +dev_err (&port->dev,"nonzero write-urb status: %d\n" , status); +break ; + } + +usb_serial_port_softint (port); +} + +static int ir_write_room (struct tty_struct *tty) +{ +struct usb_serial_port *port = tty->driver_data; +int count =0 ; + +if (port->bulk_out_size ==0 ) +return 0 ; + +if (test_bit (0 , &port->write_urbs_free)) + count = port->bulk_out_size -1 ; - count =kfifo_out_locked (&port->write_fifo, buf +1 , size -1 , - &port->lock); -return count +1 ; +return count; }static void ir_process_read_urb (struct urb *urb)
Greg Kroah-Hartman
maintainerPATCH 7/55 usb: dwc3: turn off VBUS when leaving host mode
In reply to Greg Kroah-HartmanFrom: Bin Liu <[email protected]>
commit 09ed259fac621634d51cd986aa8d65f035662658 upstream.
VBUS should be turned off when leaving the host mode.
Set GCTL_PRTCAP to device mode in teardown to de-assert DRVVBUS pin to turn off VBUS power.
--- drivers/usb/dwc3/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/dwc3/core.c +3 -0
@@ -1199,6 +1199,9 @@ static void dwc3_core_exit_mode(struct d/* do nothing */ break ; } + +/* de-assert DRVVBUS for HOST and OTG mode */ +dwc3_set_prtcap (dwc,DWC3_GCTL_PRTCAP_DEVICE ); }static void dwc3_get_properties (struct dwc3 *dwc)
Greg Kroah-Hartman
maintainerPATCH 8/55 staging: most: net: fix buffer overflow
In reply to Greg Kroah-HartmanFrom: Andrey Shvetsov <[email protected]>
commit 4d1356ac12f4d5180d0df345d85ff0ee42b89c72 upstream.
If the length of the socket buffer is 0xFFFFFFFF (max size for an unsigned int), then payload_len becomes 0xFFFFFFF1 after subtracting 14 (ETH_HLEN). Then, mdp_len is set to payload_len + 16 (MDP_HDR_LEN) which overflows and results in a value of 2. These values for payload_len and mdp_len will pass current buffer size checks.
This patch checks if derived from skb->len sum may overflow.
The check is based on the following idea:
For any unsigned V1, V2 and derived unsigned SUM = V1 + V2, V1 + V2 overflows iif SUM < V1.
--- drivers/staging/most/net/net.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/staging/most/net/net.c +10 -0
@@ -81,6 +81,11 @@ static int skb_to_mamac(const struct sk_unsigned int payload_len = skb->len -ETH_HLEN ;unsigned int mdp_len = payload_len +MDP_HDR_LEN ; +if (mdp_len < skb->len) { +pr_err ("drop: too large packet! (%u)\n" , skb->len); +return -EINVAL ; + } +if (mbo->buffer_length < mdp_len) {pr_err ("drop: too small buffer! (%d for %d)\n" , mbo->buffer_length, mdp_len);
@@ -128,6 +133,11 @@ static int skb_to_mep(const struct sk_buu8 *buff = mbo->virt_address;unsigned int mep_len = skb->len +MEP_HDR_LEN ; +if (mep_len < skb->len) { +pr_err ("drop: too large packet! (%u)\n" , skb->len); +return -EINVAL ; + } +if (mbo->buffer_length < mep_len) {pr_err ("drop: too small buffer! (%d for %d)\n" , mbo->buffer_length, mep_len);
Greg Kroah-Hartman
maintainerPATCH 9/55 staging: wlan-ng: ensure error return is actually returned
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
commit 4cc41cbce536876678b35e03c4a8a7bb72c78fa9 upstream.
Currently when the call to prism2sta_ifst fails a netdev_err error is reported, error return variable result is set to -1 but the function always returns 0 for success. Fix this by returning the error value in variable result rather than 0.
Addresses-Coverity: ("Unused value")
--- drivers/staging/wlan-ng/prism2mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wlan-ng/prism2mgmt.c +1 -1
@@ -959,7 +959,7 @@ int prism2mgmt_flashdl_state(struct wlan } } -return 0 ; +return result; }/*----------------------------------------------------------------
Greg Kroah-Hartman
maintainerPATCH 10/55 staging: vt6656: correct packet types for CTS protect, mode.
In reply to Greg Kroah-HartmanFrom: Malcolm Priestley <[email protected]>
commit d971fdd3412f8342747778fb59b8803720ed82b1 upstream.
It appears that the driver still transmits in CTS protect mode even though it is not enabled in mac80211.
That is both packet types PK_TYPE_11GA and PK_TYPE_11GB both use CTS protect. The only difference between them GA does not use B rates.
Find if only B rate in GB or GA in protect mode otherwise transmit packets as PK_TYPE_11A.
--- drivers/staging/vt6656/device.h | 2 ++ drivers/staging/vt6656/rxtx.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/staging/vt6656/device.h +2 -0
@@ -52,6 +52,8 @@#define RATE_AUTO 12#define MAX_RATE 12 +#define VNT_B_RATES (BIT(RATE_1M) | BIT(RATE_2M) |\ + BIT(RATE_5M) | BIT(RATE_11M))/* * device specific
drivers/staging/vt6656/rxtx.c +8 -4
@@ -815,10 +815,14 @@ int vnt_tx_packet(struct vnt_private *prif (info->band ==NL80211_BAND_5GHZ ) { pkt_type =PK_TYPE_11A ; }else { -if (tx_rate->flags &IEEE80211_TX_RC_USE_CTS_PROTECT ) - pkt_type =PK_TYPE_11GB ; -else - pkt_type =PK_TYPE_11GA ; +if (tx_rate->flags &IEEE80211_TX_RC_USE_CTS_PROTECT ) { +if (priv->basic_rates &VNT_B_RATES ) + pkt_type =PK_TYPE_11GB ; +else + pkt_type =PK_TYPE_11GA ; + }else { + pkt_type =PK_TYPE_11A ; + } } }else { pkt_type =PK_TYPE_11B ;
Greg Kroah-Hartman
maintainerPATCH 11/55 staging: vt6656: use NULLFUCTION stack on mac80211
In reply to Greg Kroah-HartmanFrom: Malcolm Priestley <[email protected]>
commit d579c43c82f093e63639151625b2139166c730fd upstream.
It appears that the drivers does not go into power save correctly the NULL data packets are not being transmitted because it not enabled in mac80211.
The driver needs to capture ieee80211_is_nullfunc headers and copy the duration_id to it's own duration data header.
--- drivers/staging/vt6656/main_usb.c | 1 + drivers/staging/vt6656/rxtx.c | 14 +++++--------- 2 files changed, 6 insertions(+), 9 deletions(-)
drivers/staging/vt6656/main_usb.c +1 -0
@@ -978,6 +978,7 @@ vt6656_probe(struct usb_interface *intf,ieee80211_hw_set (priv->hw,RX_INCLUDES_FCS );ieee80211_hw_set (priv->hw,REPORTS_TX_ACK_STATUS );ieee80211_hw_set (priv->hw,SUPPORTS_PS ); +ieee80211_hw_set (priv->hw,PS_NULLFUNC_STACK ); priv->hw->max_signal =100 ;
drivers/staging/vt6656/rxtx.c +5 -9
@@ -278,11 +278,9 @@ static u16 vnt_rxtx_datahead_g(struct vn PK_TYPE_11B, &buf->b);/* Get Duration and TimeStamp */ -if (ieee80211_is_pspoll (hdr->frame_control)) { -__le16 dur =cpu_to_le16 (priv->current_aid |BIT (14 ) |BIT (15 )); - - buf->duration_a = dur; - buf->duration_b = dur; +if (ieee80211_is_nullfunc (hdr->frame_control)) { + buf->duration_a = hdr->duration_id; + buf->duration_b = hdr->duration_id; }else { buf->duration_a =vnt_get_duration_le (priv, tx_context->pkt_type, need_ack);
@@ -371,10 +369,8 @@ static u16 vnt_rxtx_datahead_ab(struct v tx_context->pkt_type, &buf->ab);/* Get Duration and TimeStampOff */ -if (ieee80211_is_pspoll (hdr->frame_control)) { -__le16 dur =cpu_to_le16 (priv->current_aid |BIT (14 ) |BIT (15 )); - - buf->duration = dur; +if (ieee80211_is_nullfunc (hdr->frame_control)) { + buf->duration = hdr->duration_id; }else { buf->duration =vnt_get_duration_le (priv, tx_context->pkt_type, need_ack);
Greg Kroah-Hartman
maintainerPATCH 12/55 staging: vt6656: Fix false Tx excessive retries reporting.
In reply to Greg Kroah-HartmanFrom: Malcolm Priestley <[email protected]>
commit 9dd631fa99dc0a0dfbd191173bf355ba30ea786a upstream.
The driver reporting IEEE80211_TX_STAT_ACK is not being handled correctly. The driver should only report on TSR_TMO flag is not set indicating no transmission errors and when not IEEE80211_TX_CTL_NO_ACK is being requested.
--- drivers/staging/vt6656/int.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/vt6656/int.c +4 -2
@@ -97,9 +97,11 @@ static int vnt_int_report_rate(struct vn info->status.rates[0 ].count = tx_retry; -if (!(tsr & (TSR_TMO |TSR_RETRYTMO ))) { +if (!(tsr &TSR_TMO )) { info->status.rates[0 ].idx = idx; - info->flags |=IEEE80211_TX_STAT_ACK ; + +if (!(info->flags &IEEE80211_TX_CTL_NO_ACK )) + info->flags |=IEEE80211_TX_STAT_ACK ; }ieee80211_tx_status_irqsafe (priv->hw, context->skb);
Greg Kroah-Hartman
maintainerPATCH 13/55 serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit dc76697d7e933d5e299116f219c890568785ea15 upstream.
Unbinding the bcm2835aux UART driver raises the following error if the maximum number of 8250 UARTs is set to 1 (via the 8250.nr_uarts module parameter or CONFIG_SERIAL_8250_RUNTIME_UARTS):
(NULL device *): Removing wrong port: a6f80333 != fa20408b
That's because bcm2835aux_serial_probe() retrieves UART line number 1 from the devicetree and stores it in data->uart.port.line, while serial8250_register_8250_port() instead uses UART line number 0, which is stored in data->line.
On driver unbind, bcm2835aux_serial_remove() uses data->uart.port.line, which contains the wrong number. Fix it.
The issue does not occur if the maximum number of 8250 UARTs is >= 2.
--- drivers/tty/serial/8250/8250_bcm2835aux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_bcm2835aux.c +1 -1
@@ -115,7 +115,7 @@ static int bcm2835aux_serial_remove(stru {struct bcm2835aux_data *data =platform_get_drvdata (pdev); -serial8250_unregister_port (data->uart.port.line); +serial8250_unregister_port (data->line);clk_disable_unprepare (data->clk);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 14/55 component: do not dereference opaque pointer in debugfs
In reply to Greg Kroah-HartmanFrom: Lubomir Rintel <[email protected]>
commit ef9ffc1e5f1ac73ecd2fb3b70db2a3b2472ff2f7 upstream.
The match data does not have to be a struct device pointer, and indeed very often is not. Attempt to treat it as such easily results in a crash.
For the components that are not registered, we don't know which device is missing. Once it it is there, we can use the struct component to get the device and whether it's bound or not.
--- drivers/base/component.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/component.c +4 -4
@@ -74,11 +74,11 @@ static int component_devices_show(structseq_printf (s,"%-40s %20s\n" ,"device name" ,"status" );seq_puts (s,"-------------------------------------------------------------\n" );for (i =0 ; i < match->num; i++) { -struct device *d = (struct device *)match->compare[i].data; +struct component *component = match->compare[i].component; -seq_printf (s,"%-40s %20s\n" ,dev_name (d), - match->compare[i].component ? -"registered" :"not registered" ); +seq_printf (s,"%-40s %20s\n" , + component ?dev_name (component->dev) :"(unknown)" , + component ? (component->bound ?"bound" :"not bound" ) :"not registered" ); }mutex_unlock (&component_mutex);
Greg Kroah-Hartman
maintainerPATCH 15/55 mei: me: add comet point (lake) H device ids
In reply to Greg Kroah-HartmanFrom: Tomas Winkler <[email protected]>
commit 559e575a8946a6561dfe8880de341d4ef78d5994 upstream.
Add Comet Point device IDs for Comet Lake H platforms.
--- drivers/misc/mei/hw-me-regs.h | 4 ++++ drivers/misc/mei/pci-me.c | 2 ++ 2 files changed, 6 insertions(+)
drivers/misc/mei/hw-me-regs.h +4 -0
@@ -141,8 +141,12 @@#define MEI_DEV_ID_CMP_LP 0x02e0/* Comet Point LP */ #define MEI_DEV_ID_CMP_LP_3 0x02e4/* Comet Point LP 3 (iTouch) */ +#define MEI_DEV_ID_CMP_V 0xA3BA/* Comet Point Lake V */ +#define MEI_DEV_ID_CMP_H 0x06e0/* Comet Lake H */ +#define MEI_DEV_ID_CMP_H_3 0x06e4/* Comet Lake H 3 (iTouch) */ +#define MEI_DEV_ID_ICP_LP 0x34E0/* Ice Lake Point LP */ #define MEI_DEV_ID_TGP_LP 0xA0E0/* Tiger Lake Point LP */
drivers/misc/mei/pci-me.c +2 -0
@@ -108,6 +108,8 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP, MEI_ME_PCH12_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP_3, MEI_ME_PCH8_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_V, MEI_ME_PCH12_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H, MEI_ME_PCH12_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H_3, MEI_ME_PCH8_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)},
Greg Kroah-Hartman
maintainerPATCH 16/55 iio: st_gyro: Correct data for LSM9DS0 gyro
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
commit e825070f697abddf3b9b0a675ed0ff1884114818 upstream.
The commit 41c128cb25ce ("iio: st_gyro: Add lsm9ds0-gyro support") assumes that gyro in LSM9DS0 is the same as others with 0xd4 WAI ID, but datasheet tells slight different story, i.e. the first scale factor for the chip is 245 dps, and not 250 dps.
Correct this by introducing a separate settings for LSM9DS0.
Depends-on: 45a4e4220bf4 ("iio: gyro: st_gyro: fix L3GD20H support")
--- drivers/iio/gyro/st_gyro_core.c | 75 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-)
drivers/iio/gyro/st_gyro_core.c +74 -1
@@ -141,7 +141,6 @@ static const struct st_sensor_settings s [2] = LSM330DLC_GYRO_DEV_NAME, [3] = L3G4IS_GYRO_DEV_NAME, [4 ] =LSM330_GYRO_DEV_NAME , - [5 ] =LSM9DS0_GYRO_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, .odr = {
@@ -205,6 +204,80 @@ static const struct st_sensor_settings s }, }, .sim = { + .addr = 0x23, + .value = BIT(0), + }, + .multi_read_bit = true, + .bootime = 2, + }, + { + .wai = 0xd4, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, + .sensors_supported = { + [0] = LSM9DS0_GYRO_DEV_NAME, + }, + .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, + .odr = { + .addr = 0x20, + .mask = GENMASK(7, 6), + .odr_avl = { + { .hz = 95, .value = 0x00, }, + { .hz = 190, .value = 0x01, }, + { .hz = 380, .value = 0x02, }, + { .hz = 760, .value = 0x03, }, + }, + }, + .pw = { + .addr = 0x20, + .mask = BIT(3), + .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE, + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, + }, + .enable_axis = { + .addr = ST_SENSORS_DEFAULT_AXIS_ADDR, + .mask = ST_SENSORS_DEFAULT_AXIS_MASK, + }, + .fs = { + .addr = 0x23, + .mask = GENMASK(5, 4), + .fs_avl = { + [0] = { + .num = ST_GYRO_FS_AVL_245DPS, + .value = 0x00, + .gain = IIO_DEGREE_TO_RAD(8750), + }, + [1] = { + .num = ST_GYRO_FS_AVL_500DPS, + .value = 0x01, + .gain = IIO_DEGREE_TO_RAD(17500), + }, + [2] = { + .num = ST_GYRO_FS_AVL_2000DPS, + .value = 0x02, + .gain = IIO_DEGREE_TO_RAD(70000), + }, + }, + }, + .bdu = { + .addr = 0x23, + .mask = BIT(7), + }, + .drdy_irq = { + .int2 = { + .addr = 0x22, + .mask = BIT(3), + }, + /* + * The sensor has IHL (active low) and open + * drain settings, but only for INT1 and not + * for the DRDY line on INT2. + */ + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = GENMASK(2, 0), + }, + }, + .sim = { .addr = 0x23, .value = BIT(0), },
Greg Kroah-Hartman
maintainerPATCH 17/55 crypto: chelsio - fix writing tfm flags to wrong place
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit bd56cea012fc2d6381e8cd3209510ce09f9de8c9 upstream.
The chelsio crypto driver is casting 'struct crypto_aead' directly to 'struct crypto_tfm', which is incorrect because the crypto_tfm isn't the first field of 'struct crypto_aead'. Consequently, the calls to crypto_tfm_set_flags() are modifying some other field in the struct.
Also, the driver is setting CRYPTO_TFM_RES_BAD_KEY_LEN in ->setauthsize(), not just in ->setkey(). This is incorrect since this flag is for bad key lengths, not for bad authentication tag lengths.
Fix these bugs by removing the broken crypto_tfm_set_flags() calls from ->setauthsize() and by fixing them in ->setkey().
--- drivers/crypto/chelsio/chcr_algo.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/crypto/chelsio/chcr_algo.c +3 -13
@@ -3135,9 +3135,6 @@ static int chcr_gcm_setauthsize(struct c aeadctx->mayverify =VERIFY_SW ;break ;default : - -crypto_tfm_set_flags ((struct crypto_tfm *) tfm, -CRYPTO_TFM_RES_BAD_KEY_LEN );return -EINVAL ; }return crypto_aead_setauthsize (aeadctx->sw_cipher, authsize);
@@ -3162,8 +3159,6 @@ static int chcr_4106_4309_setauthsize(st aeadctx->mayverify =VERIFY_HW ;break ;default : -crypto_tfm_set_flags ((struct crypto_tfm *)tfm, -CRYPTO_TFM_RES_BAD_KEY_LEN );return -EINVAL ; }return crypto_aead_setauthsize (aeadctx->sw_cipher, authsize);
@@ -3204,8 +3199,6 @@ static int chcr_ccm_setauthsize(struct c aeadctx->mayverify =VERIFY_HW ;break ;default : -crypto_tfm_set_flags ((struct crypto_tfm *)tfm, -CRYPTO_TFM_RES_BAD_KEY_LEN );return -EINVAL ; }return crypto_aead_setauthsize (aeadctx->sw_cipher, authsize);
@@ -3230,8 +3223,7 @@ static int chcr_ccm_common_setkey(struct ck_size =CHCR_KEYCTX_CIPHER_KEY_SIZE_256 ; mk_size =CHCR_KEYCTX_MAC_KEY_SIZE_256 ; }else { -crypto_tfm_set_flags ((struct crypto_tfm *)aead, -CRYPTO_TFM_RES_BAD_KEY_LEN ); +crypto_aead_set_flags (aead,CRYPTO_TFM_RES_BAD_KEY_LEN ); aeadctx->enckey_len =0 ;return -EINVAL ; }
@@ -3269,8 +3261,7 @@ static int chcr_aead_rfc4309_setkey(struint error;if (keylen <3 ) { -crypto_tfm_set_flags ((struct crypto_tfm *)aead, -CRYPTO_TFM_RES_BAD_KEY_LEN ); +crypto_aead_set_flags (aead,CRYPTO_TFM_RES_BAD_KEY_LEN ); aeadctx->enckey_len =0 ;return -EINVAL ; }
@@ -3320,8 +3311,7 @@ static int chcr_gcm_setkey(struct crypto }else if (keylen ==AES_KEYSIZE_256 ) { ck_size =CHCR_KEYCTX_CIPHER_KEY_SIZE_256 ; }else { -crypto_tfm_set_flags ((struct crypto_tfm *)aead, -CRYPTO_TFM_RES_BAD_KEY_LEN ); +crypto_aead_set_flags (aead,CRYPTO_TFM_RES_BAD_KEY_LEN );pr_err ("GCM: Invalid key length %d\n" , keylen); ret = -EINVAL ; goto out;
Greg Kroah-Hartman
maintainerPATCH 18/55 cifs: Fix memory allocation in __smb2_handle_cancelled_cmd()
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara (SUSE) <[email protected]>
commit 0a5a98863c9debc02387b3d23c46d187756f5e2b upstream.
__smb2_handle_cancelled_cmd() is called under a spin lock held in cifs_mid_q_entry_release(), so make its memory allocation GFP_ATOMIC.
This issue was observed when running xfstests generic/028:
[ 1722.589204] CIFS VFS: \\192.168.30.26 Cancelling wait for mid 72064 cmd: 5 [ 1722.590687] CIFS VFS: \\192.168.30.26 Cancelling wait for mid 72065 cmd: 17 [ 1722.593529] CIFS VFS: \\192.168.30.26 Cancelling wait for mid 72066 cmd: 6 [ 1723.039014] BUG: sleeping function called from invalid context at mm/slab.h:565 [ 1723.040710] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 30877, name: cifsd [ 1723.045098] CPU: 3 PID: 30877 Comm: cifsd Not tainted 5.5.0-rc4+ #313 [ 1723.046256] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba527-rebuilt.opensuse.org 04/01/2014 [ 1723.048221] Call Trace: [ 1723.048689] dump_stack+0x97/0xe0 [ 1723.049268] ___might_sleep.cold+0xd1/0xe1 [ 1723.050069] kmem_cache_alloc_trace+0x204/0x2b0 [ 1723.051051] __smb2_handle_cancelled_cmd+0x40/0x140 [cifs] [ 1723.052137] smb2_handle_cancelled_mid+0xf6/0x120 [cifs] [ 1723.053247] cifs_mid_q_entry_release+0x44d/0x630 [cifs] [ 1723.054351] ? cifs_reconnect+0x26a/0x1620 [cifs] [ 1723.055325] cifs_demultiplex_thread+0xad4/0x14a0 [cifs] [ 1723.056458] ? cifs_handle_standard+0x2c0/0x2c0 [cifs] [ 1723.057365] ? kvm_sched_clock_read+0x14/0x30 [ 1723.058197] ? sched_clock+0x5/0x10 [ 1723.058838] ? sched_clock_cpu+0x18/0x110 [ 1723.059629] ? lockdep_hardirqs_on+0x17d/0x250 [ 1723.060456] kthread+0x1ab/0x200 [ 1723.061149] ? cifs_handle_standard+0x2c0/0x2c0 [cifs] [ 1723.062078] ? kthread_create_on_node+0xd0/0xd0 [ 1723.062897] ret_from_fork+0x3a/0x50
--- fs/cifs/smb2misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2misc.c +1 -1
@@ -750,7 +750,7 @@ __smb2_handle_cancelled_close(struct cif {struct close_cancelled_open *cancelled; - cancelled =kzalloc (sizeof (*cancelled),GFP_KERNEL ); + cancelled =kzalloc (sizeof (*cancelled),GFP_ATOMIC );if (!cancelled)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 19/55 ath9k: fix storage endpoint lookup
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 0ef332951e856efa89507cdd13ba8f4fb8d4db12 upstream.
Make sure to use the current alternate setting when verifying the storage interface descriptors to avoid submitting an URB to an invalid endpoint.
Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on.
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +1 -1
@@ -1216,7 +1216,7 @@ err_fw:static int send_eject_command (struct usb_interface *interface) {struct usb_device *udev =interface_to_usbdev (interface); -struct usb_host_interface *iface_desc = &interface->altsetting[0 ]; +struct usb_host_interface *iface_desc = interface->cur_altsetting;struct usb_endpoint_descriptor *endpoint;unsigned char *cmd;u8 bulk_out_ep;
Greg Kroah-Hartman
maintainerPATCH 20/55 brcmfmac: fix interface sanity check
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 3428fbcd6e6c0850b1a8b2a12082b7b2aabb3da3 upstream.
Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface.
Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +2 -2
@@ -1357,7 +1357,7 @@ brcmf_usb_probe(struct usb_interface *in goto fail; } - desc = &intf->altsetting[0 ].desc; + desc = &intf->cur_altsetting->desc;if ((desc->bInterfaceClass !=USB_CLASS_VENDOR_SPEC ) || (desc->bInterfaceSubClass !=2 ) || (desc->bInterfaceProtocol !=0xff )) {
@@ -1370,7 +1370,7 @@ brcmf_usb_probe(struct usb_interface *in num_of_eps = desc->bNumEndpoints;for (ep =0 ; ep < num_of_eps; ep++) { - endpoint = &intf->altsetting[0 ].endpoint[ep].desc; + endpoint = &intf->cur_altsetting->endpoint[ep].desc; endpoint_num =usb_endpoint_num (endpoint);if (!usb_endpoint_xfer_bulk (endpoint))continue ;
Greg Kroah-Hartman
maintainerPATCH 21/55 rtl8xxxu: fix interface sanity check
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 39a4281c312f2d226c710bc656ce380c621a2b16 upstream.
Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface.
Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +1 -1
@@ -5921,7 +5921,7 @@ static int rtl8xxxu_parse_usb(struct rtlu8 dir, xtype, num;int ret =0 ; - host_interface = &interface->altsetting[0 ]; + host_interface = interface->cur_altsetting; interface_desc = &host_interface->desc; endpoints = interface_desc->bNumEndpoints;
Greg Kroah-Hartman
maintainerPATCH 22/55 zd1211rw: fix storage endpoint lookup
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 2d68bb2687abb747558b933e80845ff31570a49c upstream.
Make sure to use the current alternate setting when verifying the storage interface descriptors to avoid submitting an URB to an invalid endpoint.
Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on.
--- drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/zydas/zd1211rw/zd_usb.c +1 -1
@@ -1275,7 +1275,7 @@ static void print_id(struct usb_device *static int eject_installer (struct usb_interface *intf) {struct usb_device *udev =interface_to_usbdev (intf); -struct usb_host_interface *iface_desc = &intf->altsetting[0 ]; +struct usb_host_interface *iface_desc = intf->cur_altsetting;struct usb_endpoint_descriptor *endpoint;unsigned char *cmd;u8 bulk_out_ep;
Greg Kroah-Hartman
maintainerPATCH 23/55 net_sched: ematch: reject invalid TCF_EM_SIMPLE
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 55cd9f67f1e45de8517cdaab985fb8e56c0bc1d8 ]
It is possible for malicious userspace to set TCF_EM_SIMPLE bit even for matches that should not have this bit set.
This can fool two places using tcf_em_is_simple()
1) tcf_em_tree_destroy() -> memory leak of em->data if ops->destroy() is NULL
2) tcf_em_tree_dump() wrongly report/leak 4 low-order bytes of a kernel pointer.
BUG: memory leak
unreferenced object 0xffff888121850a40 (size 32):
comm "syz-executor927", pid 7193, jiffies 4294941655 (age 19.840s)
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000f67036ea>] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline]
[<00000000f67036ea>] slab_post_alloc_hook mm/slab.h:586 [inline]
[<00000000f67036ea>] slab_alloc mm/slab.c:3320 [inline]
[<00000000f67036ea>] __do_kmalloc mm/slab.c:3654 [inline]
[<00000000f67036ea>] __kmalloc_track_caller+0x165/0x300 mm/slab.c:3671
[<00000000fab0cc8e>] kmemdup+0x27/0x60 mm/util.c:127
[<00000000d9992e0a>] kmemdup include/linux/string.h:453 [inline]
[<00000000d9992e0a>] em_nbyte_change+0x5b/0x90 net/sched/em_nbyte.c:32
[<000000007e04f711>] tcf_em_validate net/sched/ematch.c:241 [inline]
[<000000007e04f711>] tcf_em_tree_validate net/sched/ematch.c:359 [inline]
[<000000007e04f711>] tcf_em_tree_validate+0x332/0x46f net/sched/ematch.c:300
[<000000007a769204>] basic_set_parms net/sched/cls_basic.c:157 [inline]
[<000000007a769204>] basic_change+0x1d7/0x5f0 net/sched/cls_basic.c:219
[<00000000e57a5997>] tc_new_tfilter+0x566/0xf70 net/sched/cls_api.c:2104
[<0000000074b68559>] rtnetlink_rcv_msg+0x3b2/0x4b0 net/core/rtnetlink.c:5415
[<00000000b7fe53fb>] netlink_rcv_skb+0x61/0x170 net/netlink/af_netlink.c:2477
[<00000000e83a40d0>] rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:5442
[<00000000d62ba933>] netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
[<00000000d62ba933>] netlink_unicast+0x223/0x310 net/netlink/af_netlink.c:1328
[<0000000088070f72>] netlink_sendmsg+0x2c0/0x570 net/netlink/af_netlink.c:1917
[<00000000f70b15ea>] sock_sendmsg_nosec net/socket.c:639 [inline]
[<00000000f70b15ea>] sock_sendmsg+0x54/0x70 net/socket.c:659
[<00000000ef95a9be>] ____sys_sendmsg+0x2d0/0x300 net/socket.c:2330
[<00000000b650f1ab>] ___sys_sendmsg+0x8a/0xd0 net/socket.c:2384
[<0000000055bfa74a>] __sys_sendmsg+0x80/0xf0 net/socket.c:2417
[<000000002abac183>] __do_sys_sendmsg net/socket.c:2426 [inline]
[<000000002abac183>] __se_sys_sendmsg net/socket.c:2424 [inline]
[<000000002abac183>] __x64_sys_sendmsg+0x23/0x30 net/socket.c:2424--- net/sched/ematch.c | 3 +++ 1 file changed, 3 insertions(+)
net/sched/ematch.c +3 -0
@@ -242,6 +242,9 @@ static int tcf_em_validate(struct tcf_pr goto errout;if (em->ops->change) { + err = -EINVAL ; +if (em_hdr->flags &TCF_EM_SIMPLE ) + goto errout; err = em->ops->change (net, data, data_len, em);if (err <0 ) goto errout;
Greg Kroah-Hartman
maintainerPATCH 24/55 net_sched: fix ops->bind_class() implementations
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
[ Upstream commit 2e24cd755552350b94a7617617c6877b8cbcb701 ]
The current implementations of ops->bind_class() are merely searching for classid and updating class in the struct tcf_result, without invoking either of cl_ops->bind_tcf() or cl_ops->unbind_tcf(). This breaks the design of them as qdisc's like cbq use them to count filters too. This is why syzbot triggered the warning in cbq_destroy_class().
In order to fix this, we have to call cl_ops->bind_tcf() and cl_ops->unbind_tcf() like the filter binding path. This patch does so by refactoring out two helper functions __tcf_bind_filter() and __tcf_unbind_filter(), which are lockless and accept a Qdisc pointer, then teaching each implementation to call them correctly.
Note, we merely pass the Qdisc pointer as an opaque pointer to each filter, they only need to pass it down to the helper functions without understanding it at all.
--- include/net/pkt_cls.h | 33 +++++++++++++++++++-------------- include/net/sch_generic.h | 3 ++- net/sched/cls_basic.c | 11 ++++++++--- net/sched/cls_bpf.c | 11 ++++++++--- net/sched/cls_flower.c | 11 ++++++++--- net/sched/cls_fw.c | 11 ++++++++--- net/sched/cls_matchall.c | 11 ++++++++--- net/sched/cls_route.c | 11 ++++++++--- net/sched/cls_rsvp.h | 11 ++++++++--- net/sched/cls_tcindex.c | 11 ++++++++--- net/sched/cls_u32.c | 11 ++++++++--- net/sched/sch_api.c | 6 ++++-- 12 files changed, 97 insertions(+), 44 deletions(-)
include/net/pkt_cls.h +19 -14
@@ -206,31 +206,38 @@ __cls_set_class(unsigned long *clp, unsireturn xchg (clp, cl); } -static inline unsigned long -cls_set_class (struct Qdisc *q,unsigned long *clp,unsigned long cl) +static inline void +__tcf_bind_filter (struct Qdisc *q,struct tcf_result *r,unsigned long base) { -unsigned long old_cl; +unsigned long cl; -sch_tree_lock (q); - old_cl =__cls_set_class (clp, cl); -sch_tree_unlock (q); -return old_cl; + cl = q->ops->cl_ops->bind_tcf (q, base, r->classid); + cl =__cls_set_class (&r->class, cl); +if (cl) + q->ops->cl_ops->unbind_tcf (q, cl); }static inline void tcf_bind_filter (struct tcf_proto *tp,struct tcf_result *r,unsigned long base) {struct Qdisc *q = tp->chain->block->q; -unsigned long cl;/* Check q as it is not set for shared blocks. In that case, * setting class is not supported. */ if (!q)return ; - cl = q->ops->cl_ops->bind_tcf (q, base, r->classid); - cl =cls_set_class (q, &r->class, cl); -if (cl) +sch_tree_lock (q); +__tcf_bind_filter (q, r, base); +sch_tree_unlock (q); +} + +static inline void +__tcf_unbind_filter (struct Qdisc *q,struct tcf_result *r) +{ +unsigned long cl; + +if ((cl =__cls_set_class (&r->class,0 )) !=0 ) q->ops->cl_ops->unbind_tcf (q, cl); }
@@ -238,12 +245,10 @@ static inline void tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r) { struct Qdisc *q = tp->chain->block->q; -unsigned long cl;if (!q)return ; -if ((cl =__cls_set_class (&r->class,0 )) !=0 ) - q->ops->cl_ops->unbind_tcf (q, cl); +__tcf_unbind_filter (q, r); } struct tcf_exts {
include/net/sch_generic.h +2 -1
@@ -273,7 +273,8 @@ struct tcf_proto_ops {int (*reoffload)(struct tcf_proto *tp,bool add,tc_setup_cb_t *cb,void *cb_priv,struct netlink_ext_ack *extack); -void (*bind_class)(void *,u32 ,unsigned long ); +void (*bind_class)(void *,u32 ,unsigned long , +void *,unsigned long ); void * (*tmplt_create)(struct net *net, struct tcf_chain *chain, struct nlattr **tca,
net/sched/cls_basic.c +8 -3
@@ -254,12 +254,17 @@ skip: } } -static void basic_bind_class (void *fh,u32 classid,unsigned long cl) +static void basic_bind_class (void *fh,u32 classid,unsigned long cl,void *q, +unsigned long base) {struct basic_filter *f = fh; -if (f && f->res.classid == classid) - f->res.class = cl; +if (f && f->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &f->res, base); +else +__tcf_unbind_filter (q, &f->res); + } } static int basic_dump(struct net *net, struct tcf_proto *tp, void *fh,
net/sched/cls_bpf.c +8 -3
@@ -627,12 +627,17 @@ nla_put_failure:return -1 ; } -static void cls_bpf_bind_class (void *fh,u32 classid,unsigned long cl) +static void cls_bpf_bind_class (void *fh,u32 classid,unsigned long cl, +void *q,unsigned long base) {struct cls_bpf_prog *prog = fh; -if (prog && prog->res.classid == classid) - prog->res.class = cl; +if (prog && prog->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &prog->res, base); +else +__tcf_unbind_filter (q, &prog->res); + } }static void cls_bpf_walk (struct tcf_proto *tp,struct tcf_walker *arg)
net/sched/cls_flower.c +8 -3
@@ -1942,12 +1942,17 @@ nla_put_failure:return -EMSGSIZE ; } -static void fl_bind_class (void *fh,u32 classid,unsigned long cl) +static void fl_bind_class (void *fh,u32 classid,unsigned long cl,void *q, +unsigned long base) {struct cls_fl_filter *f = fh; -if (f && f->res.classid == classid) - f->res.class = cl; +if (f && f->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &f->res, base); +else +__tcf_unbind_filter (q, &f->res); + } }static struct tcf_proto_ops cls_fl_ops__read_mostly = {
net/sched/cls_fw.c +8 -3
@@ -432,12 +432,17 @@ nla_put_failure:return -1 ; } -static void fw_bind_class (void *fh,u32 classid,unsigned long cl) +static void fw_bind_class (void *fh,u32 classid,unsigned long cl,void *q, +unsigned long base) {struct fw_filter *f = fh; -if (f && f->res.classid == classid) - f->res.class = cl; +if (f && f->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &f->res, base); +else +__tcf_unbind_filter (q, &f->res); + } }static struct tcf_proto_ops cls_fw_ops__read_mostly = {
net/sched/cls_matchall.c +8 -3
@@ -310,12 +310,17 @@ nla_put_failure:return -1 ; } -static void mall_bind_class (void *fh,u32 classid,unsigned long cl) +static void mall_bind_class (void *fh,u32 classid,unsigned long cl,void *q, +unsigned long base) {struct cls_mall_head *head = fh; -if (head && head->res.classid == classid) - head->res.class = cl; +if (head && head->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &head->res, base); +else +__tcf_unbind_filter (q, &head->res); + } }static struct tcf_proto_ops cls_mall_ops__read_mostly = {
net/sched/cls_route.c +8 -3
@@ -645,12 +645,17 @@ nla_put_failure:return -1 ; } -static void route4_bind_class (void *fh,u32 classid,unsigned long cl) +static void route4_bind_class (void *fh,u32 classid,unsigned long cl,void *q, +unsigned long base) {struct route4_filter *f = fh; -if (f && f->res.classid == classid) - f->res.class = cl; +if (f && f->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &f->res, base); +else +__tcf_unbind_filter (q, &f->res); + } }static struct tcf_proto_ops cls_route4_ops__read_mostly = {
net/sched/cls_rsvp.h +8 -3
@@ -736,12 +736,17 @@ nla_put_failure:return -1 ; } -static void rsvp_bind_class (void *fh,u32 classid,unsigned long cl) +static void rsvp_bind_class (void *fh,u32 classid,unsigned long cl,void *q, +unsigned long base) {struct rsvp_filter *f = fh; -if (f && f->res.classid == classid) - f->res.class = cl; +if (f && f->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &f->res, base); +else +__tcf_unbind_filter (q, &f->res); + } }static struct tcf_proto_ops RSVP_OPS __read_mostly = {
net/sched/cls_tcindex.c +8 -3
@@ -652,12 +652,17 @@ nla_put_failure:return -1 ; } -static void tcindex_bind_class (void *fh,u32 classid,unsigned long cl) +static void tcindex_bind_class (void *fh,u32 classid,unsigned long cl, +void *q,unsigned long base) {struct tcindex_filter_result *r = fh; -if (r && r->res.classid == classid) - r->res.class = cl; +if (r && r->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &r->res, base); +else +__tcf_unbind_filter (q, &r->res); + } }static struct tcf_proto_ops cls_tcindex_ops__read_mostly = {
net/sched/cls_u32.c +8 -3
@@ -1315,12 +1315,17 @@ static int u32_reoffload(struct tcf_protreturn 0 ; } -static void u32_bind_class (void *fh,u32 classid,unsigned long cl) +static void u32_bind_class (void *fh,u32 classid,unsigned long cl,void *q, +unsigned long base) {struct tc_u_knode *n = fh; -if (n && n->res.classid == classid) - n->res.class = cl; +if (n && n->res.classid == classid) { +if (cl) +__tcf_bind_filter (q, &n->res, base); +else +__tcf_unbind_filter (q, &n->res); + } } static int u32_dump(struct net *net, struct tcf_proto *tp, void *fh,
net/sched/sch_api.c +4 -2
@@ -1803,8 +1803,9 @@ static int tclass_del_notify(struct netstruct tcf_bind_args {struct tcf_walker w; -u32 classid; +unsigned long base;unsigned long cl; +u32 classid; };static int tcf_node_bind (struct tcf_proto *tp,void *n,struct tcf_walker *arg)
@@ -1815,7 +1816,7 @@ static int tcf_node_bind(struct tcf_protstruct Qdisc *q =tcf_block_q (tp->chain->block);sch_tree_lock (q); - tp->ops->bind_class (n, a->classid, a->cl); + tp->ops->bind_class (n, a->classid, a->cl, q, a->base);sch_tree_unlock (q); }return 0 ;
@@ -1846,6 +1847,7 @@ static void tc_bind_tclass(struct Qdisc arg.w.fn = tcf_node_bind; arg.classid = clid; + arg.base = cl; arg.cl = new_cl; tp->ops->walk (tp, &arg.w); }
Greg Kroah-Hartman
maintainerPATCH 25/55 HID: multitouch: Add LG MELF0410 I2C touchscreen support
In reply to Greg Kroah-HartmanFrom: Aaron Ma <[email protected]>
[ Upstream commit 348b80b273fbf4ce2a307f9e38eadecf37828cad ]
Add multitouch support for LG MELF I2C touchscreen. Apply the same workaround as LG USB touchscreen.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -717,6 +717,7 @@#define USB_DEVICE_ID_LG_MULTITOUCH 0x0064#define USB_DEVICE_ID_LG_MELFAS_MT 0x6007#define I2C_DEVICE_ID_LG_8001 0x8001 +#define I2C_DEVICE_ID_LG_7010 0x7010#define USB_VENDOR_ID_LOGITECH 0x046d#define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
drivers/hid/hid-multitouch.c +3 -0
@@ -1972,6 +1972,9 @@ static const struct hid_device_id mt_devices[] = { { .driver_data = MT_CLS_LG,HID_USB_DEVICE (USB_VENDOR_ID_LG , USB_DEVICE_ID_LG_MELFAS_MT) }, + { .driver_data = MT_CLS_LG, +HID_DEVICE (BUS_I2C ,HID_GROUP_GENERIC , + USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) }, /* MosArt panels */ { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/55 arc: eznps: fix allmodconfig kconfig warning
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 1928b36cfa4df1aeedf5f2644d0c33f3a1fcfd7b ]
Fix kconfig warning for arch/arc/plat-eznps/Kconfig allmodconfig:
WARNING: unmet direct dependencies detected for CLKSRC_NPS
Depends on [n]: GENERIC_CLOCKEVENTS [=y] && !PHYS_ADDR_T_64BIT [=y] Selected by [y]:
- ARC_PLAT_EZNPS [=y]
--- arch/arc/plat-eznps/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/plat-eznps/Kconfig +1 -1
@@ -7,7 +7,7 @@ menuconfig ARC_PLAT_EZNPS bool "\"EZchip\" ARC dev platform" select CPU_BIG_ENDIAN - select CLKSRC_NPS + select CLKSRC_NPS if !PHYS_ADDR_T_64BIT select EZNPS_GIC select EZCHIP_NPS_MANAGEMENT_ENET if ETHERNET help
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 27/55 HID: Add quirk for Xin-Mo Dual Controller
In reply to Greg Kroah-HartmanFrom: Priit Laes <[email protected]>
[ Upstream commit c62f7cd8ed066a93a243643ebf57ca99f754388e ]
Without the quirk, joystick shows up as single controller for both first and second player pads/pins.
--- drivers/hid/hid-quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-quirks.c +1 -0
@@ -175,6 +175,7 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT }, { 0 } };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 28/55 HID: ite: Add USB id match for Acer SW5-012 keyboard dock
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 8f18eca9ebc57d6b150237033f6439242907e0ba ]
The Acer SW5-012 2-in-1 keyboard dock uses a Synaptics S91028 touchpad which is connected to an ITE 8595 USB keyboard controller chip.
This keyboard has the same quirk for its rfkill / airplane mode hotkey as other keyboards with the ITE 8595 chip, it only sends a single release event when pressed and released, it never sends a press event.
This commit adds this keyboards USB id to the hid-ite id-table, fixing the rfkill key not working on this keyboard.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-ite.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -1075,6 +1075,7 @@#define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10#define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3#define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 +#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710#define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
drivers/hid/hid-ite.c +3 -0
@@ -43,6 +43,9 @@ static int ite_event(struct hid_device *hdev, struct hid_field *field,static const struct hid_device_id ite_devices[] = { {HID_USB_DEVICE (USB_VENDOR_ID_ITE ,USB_DEVICE_ID_ITE8595 ) }, {HID_USB_DEVICE (USB_VENDOR_ID_258A ,USB_DEVICE_ID_258A_6A88 ) }, +/* ITE8595 USB kbd ctlr, with Synaptics touchpad connected to it. */ + {HID_USB_DEVICE (USB_VENDOR_ID_SYNAPTICS , +USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 ) }, { } };MODULE_DEVICE_TABLE (hid, ite_devices);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/55 HID: Add quirk for incorrect input length on Lenovo Y720
In reply to Greg Kroah-HartmanFrom: Pavel Balan <[email protected]>
[ Upstream commit fd0913768701612fc2b8ab9c8a5c019133e8d978 ]
Apply it to the Lenovo Y720 gaming laptop I2C peripheral then.
This fixes dmesg being flooded with errors visible on un-suspend in Linux Mint 19 Cinnamon.
Example of error log:
<...>
[ 4.326588] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4) [ 4.326845] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4) [ 4.327095] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4) [ 4.327341] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4) [ 4.327609] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4)
<...>
Example of fixed log (debug on)
<...>
[ 3731.333183] i2c_hid i2c-ITE33D1:00: input: 02 00 [ 3731.333581] i2c_hid i2c-ITE33D1:00: input: 02 00 [ 3731.333842] i2c_hid i2c-ITE33D1:00: input: 02 00 [ 3731.334107] i2c_hid i2c-ITE33D1:00: input: 02 00 [ 3731.334367] i2c_hid i2c-ITE33D1:00: input: 02 00
<...>
--- drivers/hid/hid-ids.h | 1 + drivers/hid/i2c-hid/i2c-hid-core.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/hid/hid-ids.h +1 -0
@@ -620,6 +620,7 @@#define USB_VENDOR_ID_ITE 0x048d#define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386#define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350 +#define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 0x837a#define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396#define USB_DEVICE_ID_ITE8595 0x8595
drivers/hid/i2c-hid/i2c-hid-core.c +13 -3
@@ -52,6 +52,8 @@#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3)#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) +#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6) +/* flags */ #define I2C_HID_STARTED 0
@@ -185,6 +187,8 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_BOGUS_IRQ }, {USB_VENDOR_ID_ALPS_JP ,HID_ANY_ID , I2C_HID_QUIRK_RESET_ON_RESUME }, + { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720, + I2C_HID_QUIRK_BAD_INPUT_SIZE }, { 0, 0 } };
@@ -516,9 +520,15 @@ static void i2c_hid_get_input(struct i2c_hid *ihid) }if ((ret_size > size) || (ret_size <2 )) { -dev_err (&ihid->client->dev,"%s: incomplete report (%d/%d)\n" , - __func__, size, ret_size); -return ; +if (ihid->quirks &I2C_HID_QUIRK_BAD_INPUT_SIZE ) { + ihid->inbuf[0 ] = size &0xff ; + ihid->inbuf[1 ] = size >>8 ; + ret_size = size; + }else { +dev_err (&ihid->client->dev,"%s: incomplete report (%d/%d)\n" , + __func__, size, ret_size); +return ; + } }i2c_hid_dbg (ihid,"input: %*ph\n" , ret_size, ihid->inbuf);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/55 drivers/hid/hid-multitouch.c: fix a possible null pointer access.
In reply to Greg Kroah-HartmanFrom: Pan Zhang <[email protected]>
[ Upstream commit 306d5acbfc66e7cccb4d8f91fc857206b8df80d1 ]
1002 if ((quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) {
1003 struct input_mt_slot *i_slot = &mt->slots[slotnum];
1004
1005 if (input_mt_is_active(i_slot) &&
1006 input_mt_is_used(mt, i_slot))
1007 return -EAGAIN;
1008 }
We previously assumed 'mt' could be null (see line 1002).
The following situation is similar, so add a judgement.
--- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +1 -1
@@ -1007,7 +1007,7 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input, tool =MT_TOOL_DIAL ; else if (unlikely(!confidence_state)) { tool =MT_TOOL_PALM ; -if (!active && +if (!active && mt &&input_mt_is_active (&mt->slots[slotnum])) {/* * The non-confidence was reported for
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 31/55 phy: qcom-qmp: Increase PHY ready timeout
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit cd217ee6867d285ceecd610fa1006975d5c683fa ]
It's typical for the QHP PHY to take slightly above 1ms to initialize, so increase the timeout of the PHY ready check to 10ms - as already done in the downstream PCIe driver.
--- drivers/phy/qualcomm/phy-qcom-qmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp.c +1 -1
@@ -66,7 +66,7 @@/* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */ #define CLAMP_EN BIT(0)/* enables i/o clamp_n */ -#define PHY_INIT_COMPLETE_TIMEOUT 1000 +#define PHY_INIT_COMPLETE_TIMEOUT 10000#define POWER_DOWN_DELAY_US_MIN 10#define POWER_DOWN_DELAY_US_MAX 11
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/55 phy: cpcap-usb: Prevent USB line glitches from waking up modem
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 63078b6ba09e842f09df052c5728857389fddcd2 ]
The micro-USB connector on Motorola Mapphone devices can be muxed between the SoC and the mdm6600 modem. But even when used for the SoC, configuring the PHY with ID pin grounded will wake up the modem from idle state. Looks like the issue is probably caused by line glitches.
We can prevent the glitches by using a previously unknown mode of the GPIO mux to prevent the USB lines from being connected to the moden while configuring the USB PHY, and enable the USB lines after configuring the PHY.
Note that this only prevents waking up mdm6600 as regular USB A-host mode, and does not help when connected to a lapdock. The lapdock specific issue still needs to be debugged separately.
--- drivers/phy/motorola/phy-cpcap-usb.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/phy/motorola/phy-cpcap-usb.c +15 -3
@@ -115,7 +115,7 @@ struct cpcap_usb_ints_state {enum cpcap_gpio_mode {CPCAP_DM_DP ,CPCAP_MDM_RX_TX , -CPCAP_UNKNOWN , +CPCAP_UNKNOWN_DISABLED ,/* Seems to disable USB lines */ CPCAP_OTG_DM_DP , };
@@ -379,7 +379,8 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) {int error; - error =cpcap_usb_gpio_set_mode (ddata,CPCAP_DM_DP ); +/* Disable lines to prevent glitches from waking up mdm6600 */ + error =cpcap_usb_gpio_set_mode (ddata,CPCAP_UNKNOWN_DISABLED );if (error) goto out_err;
@@ -406,6 +407,11 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata)if (error) goto out_err; +/* Enable UART mode */ + error =cpcap_usb_gpio_set_mode (ddata,CPCAP_DM_DP ); +if (error) + goto out_err; +return 0 ; out_err:
@@ -418,7 +424,8 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) {int error; - error =cpcap_usb_gpio_set_mode (ddata,CPCAP_OTG_DM_DP ); +/* Disable lines to prevent glitches from waking up mdm6600 */ + error =cpcap_usb_gpio_set_mode (ddata,CPCAP_UNKNOWN_DISABLED );if (error)return error;
@@ -458,6 +465,11 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata)if (error) goto out_err; +/* Enable USB mode */ + error =cpcap_usb_gpio_set_mode (ddata,CPCAP_OTG_DM_DP ); +if (error) + goto out_err; +return 0 ; out_err:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/55 watchdog: max77620_wdt: fix potential build errors
In reply to Greg Kroah-HartmanFrom: David Engraf <[email protected]>
[ Upstream commit da9e3f4e30a53cd420cf1e6961c3b4110f0f21f0 ]
max77620_wdt uses watchdog core functions. Enable CONFIG_WATCHDOG_CORE to fix potential build errors.
--- drivers/watchdog/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/Kconfig +1 -0
@@ -594,6 +594,7 @@ config MAX63XX_WATCHDOG config MAX77620_WATCHDOG tristate "Maxim Max77620 Watchdog Timer" depends on MFD_MAX77620 || COMPILE_TEST + select WATCHDOG_CORE help This is the driver for the Max77620 watchdog timer. Say 'Y' here to enable the watchdog timer support for
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 34/55 watchdog: rn5t618_wdt: fix module aliases
In reply to Greg Kroah-HartmanFrom: Andreas Kemnade <[email protected]>
[ Upstream commit a76dfb859cd42df6e3d1910659128ffcd2fb6ba2 ]
Platform device aliases were missing so module autoloading did not work.
--- drivers/watchdog/rn5t618_wdt.c | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/rn5t618_wdt.c +1 -0
@@ -193,6 +193,7 @@ static struct platform_driver rn5t618_wdt_driver = {module_platform_driver (rn5t618_wdt_driver); +MODULE_ALIAS ("platform:rn5t618-wdt" );MODULE_AUTHOR ("Beniamino Galvani <[email protected]>" );MODULE_DESCRIPTION ("RN5T618 watchdog driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/55 spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls
In reply to Greg Kroah-HartmanFrom: wuxu.wu <[email protected]>
[ Upstream commit 19b61392c5a852b4e8a0bf35aecb969983c5932d ]
dw_spi_irq() and dw_spi_transfer_one concurrent calls.
I find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null, dw->len==4, and dw->tx_end==1.
When tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one may concurrent visit dw_spi, so I think dw_spi structure lack of protection.
Otherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq, store dw rx/tx instructions and other cores handle irq load dw rx/tx instructions may out of order.
[ 1025.321302] Call trace: ... [ 1025.321319] __crash_kexec+0x98/0x148 [ 1025.321323] panic+0x17c/0x314 [ 1025.321329] die+0x29c/0x2e8 [ 1025.321334] die_kernel_fault+0x68/0x78 [ 1025.321337] __do_kernel_fault+0x90/0xb0 [ 1025.321346] do_page_fault+0x88/0x500 [ 1025.321347] do_translation_fault+0xa8/0xb8 [ 1025.321349] do_mem_abort+0x68/0x118 [ 1025.321351] el1_da+0x20/0x8c [ 1025.321362] dw_writer+0xc8/0xd0 [ 1025.321364] interrupt_transfer+0x60/0x110 [ 1025.321365] dw_spi_irq+0x48/0x70 ...
--- drivers/spi/spi-dw.c | 15 ++++++++++++--- drivers/spi/spi-dw.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-)
drivers/spi/spi-dw.c +12 -3
@@ -179,9 +179,11 @@ static inline u32 rx_max(struct dw_spi *dws)static void dw_writer (struct dw_spi *dws) { -u32 max =tx_max (dws); +u32 max;u16 txw =0 ; +spin_lock (&dws->buf_lock); + max =tx_max (dws);while (max--) {/* Set the tx word if the transfer's original "tx" is not null */ if (dws->tx_end - dws->len) {
@@ -193,13 +195,16 @@ static void dw_writer(struct dw_spi *dws)dw_write_io_reg (dws,DW_SPI_DR , txw); dws->tx += dws->n_bytes; } +spin_unlock (&dws->buf_lock); }static void dw_reader (struct dw_spi *dws) { -u32 max =rx_max (dws); +u32 max;u16 rxw; +spin_lock (&dws->buf_lock); + max =rx_max (dws);while (max--) { rxw =dw_read_io_reg (dws,DW_SPI_DR );/* Care rx only if the transfer's original "rx" is not null */
@@ -211,6 +216,7 @@ static void dw_reader(struct dw_spi *dws) } dws->rx += dws->n_bytes; } +spin_unlock (&dws->buf_lock); }static void int_error_stop (struct dw_spi *dws,const char *msg)
@@ -283,18 +289,20 @@ static int dw_spi_transfer_one(struct spi_controller *master, {struct dw_spi *dws =spi_controller_get_devdata (master);struct chip_data *chip =spi_get_ctldata (spi); +unsigned long flags;u8 imask =0 ;u16 txlevel =0 ;u32 cr0;int ret; dws->dma_mapped =0 ; - +spin_lock_irqsave (&dws->buf_lock, flags); dws->tx = (void *)transfer->tx_buf; dws->tx_end = dws->tx + transfer->len; dws->rx = transfer->rx_buf; dws->rx_end = dws->rx + transfer->len; dws->len = transfer->len; +spin_unlock_irqrestore (&dws->buf_lock, flags);spi_enable_chip (dws,0 );
@@ -485,6 +493,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) dws->type =SSI_MOTO_SPI ; dws->dma_inited =0 ; dws->dma_addr = (dma_addr_t)(dws->paddr +DW_SPI_DR ); +spin_lock_init (&dws->buf_lock);spi_controller_set_devdata (master, dws);
drivers/spi/spi-dw.h +1 -0
@@ -118,6 +118,7 @@ struct dw_spi {size_t len;void *tx;void *tx_end; +spinlock_t buf_lock;void *rx;void *rx_end;int dma_mapped;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/55 drivers/net/b44: Change to non-atomic bit operations on pwol_mask
In reply to Greg Kroah-HartmanFrom: Fenghua Yu <[email protected]>
[ Upstream commit f11421ba4af706cb4f5703de34fa77fba8472776 ]
Atomic operations that span cache lines are super-expensive on x86 (not just to the current processor, but also to other processes as all memory operations are blocked until the operation completes). Upcoming x86 processors have a switch to cause such operations to generate a #AC trap. It is expected that some real time systems will enable this mode in BIOS.
In preparation for this, it is necessary to fix code that may execute atomic instructions with operands that cross cachelines because the #AC trap will crash the kernel.
Since "pwol_mask" is local and never exposed to concurrency, there is no need to set bits in pwol_mask using atomic operations.
Directly operate on the byte which contains the bit instead of using __set_bit() to avoid any big endian concern due to type cast to unsigned long in __set_bit().
--- drivers/net/ethernet/broadcom/b44.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/b44.c +6 -3
@@ -1519,8 +1519,10 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)int ethaddr_bytes =ETH_ALEN ;memset (ppattern + offset,0xff , magicsync); -for (j =0 ; j < magicsync; j++) -set_bit (len++, (unsigned long *) pmask); +for (j =0 ; j < magicsync; j++) { + pmask[len >>3 ] |=BIT (len &7 ); + len++; + }for (j =0 ; j <B44_MAX_PATTERNS ; j++) {if ((B44_PATTERN_SIZE - len) >=ETH_ALEN )
@@ -1532,7 +1534,8 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)for (k =0 ; k< ethaddr_bytes; k++) { ppattern[offset + magicsync + (j *ETH_ALEN ) + k] = macaddr[k]; -set_bit (len++, (unsigned long *) pmask); + pmask[len >>3 ] |=BIT (len &7 ); + len++; } }return len -1 ;
Signature · 1 line
2.20.1
Re: [PATCH 4.19 36/55] drivers/net/b44: Change to non-atomic bit operations on pwol_mask
Quoted 3 lines · Greg Kroah-Hartman
From: Fenghua Yu <[email protected]>
[ Upstream commit
f11421ba4af706cb4f5703de34fa77fba8472776]
This is not suitable for stable. It does not fix anything. It prepares for theoretical bug that author claims might be introduced to BIOS in future... I doubt it, even BIOS authors boot their machines from time to time.
Quoted 6 lines
Atomic operations that span cache lines are super-expensive on x86 (not just to the current processor, but also to other processes as all memory operations are blocked until the operation completes). Upcoming x86 processors have a switch to cause such operations to generate a #AC trap. It is expected that some real time systems will enable this mode in BIOS.
And I wonder if this is even good idea for mainline. x86 architecture is here for long time, and I doubt Intel is going to break it like this. Do you have documentation pointer?
Quoted 3 lines
In preparation for this, it is necessary to fix code that may execute atomic instructions with operands that cross cachelines because the #AC trap will crash the kernel.
How does single bit operation "cross cacheline"? How is this going to impact non-x86 architectures?
Quoted 6 lines
Since "
pwol_mask" is local and never exposed to concurrency, there is no need to set bits inpwol_maskusing atomic operations.Directly operate on the byte which contains the bit instead of using
__set_bit()to avoid any big endian concern due to type cast to unsigned long in__set_bit().
What concerns? Is __set_bit() now useless and are we going to open-code it everywhere? Is set_bit() now unusable on x86?
Pavel
Quoted 40 lines
Suggested-by Peter Zijlstra <[email protected]>Signed-off-by Fenghua Yu <[email protected]>Signed-off-by Tony Luck <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/net/ethernet/broadcom/b44.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/net/ethernet/broadcom/b44.c +6
-3@@ -1519,8 +1519,10 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)int ethaddr_bytes =ETH_ALEN ;memset (ppattern + offset,0xff , magicsync); -for (j =0 ; j < magicsync; j++) -set_bit (len++, (unsigned long *) pmask); +for (j =0 ; j < magicsync; j++) { + pmask[len >>3 ] |=BIT (len &7 ); + len++; + }for (j =0 ; j <B44_MAX_PATTERNS ; j++) {if ((B44_PATTERN_SIZE - len) >=ETH_ALEN )@@ -1532,7 +1534,8 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)for (k =0 ; k< ethaddr_bytes; k++) { ppattern[offset + magicsync + (j *ETH_ALEN ) + k] = macaddr[k]; -set_bit (len++, (unsigned long *) pmask); + pmask[len >>3 ] |=BIT (len &7 ); + len++; } }return len -1 ;Signature · 1 line
2.20.1
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
RE: [PATCH 4.19 36/55] drivers/net/b44: Change to non-atomic bit operations on pwol_mask
From: Pavel Machek
Quoted 19 lines
Sent: 31 January 2020 12:58
Quoted 3 lines · Greg Kroah-Hartman
From: Fenghua Yu <[email protected]>
[ Upstream commit
f11421ba4af706cb4f5703de34fa77fba8472776]This is not suitable for stable. It does not fix anything. It prepares for theoretical bug that author claims might be introduced to BIOS in future... I doubt it, even BIOS authors boot their machines from time to time.
Quoted 6 lines
Atomic operations that span cache lines are super-expensive on x86 (not just to the current processor, but also to other processes as all memory operations are blocked until the operation completes). Upcoming x86 processors have a switch to cause such operations to generate a #AC trap. It is expected that some real time systems will enable this mode in BIOS.
Quoted 3 lines
And I wonder if this is even good idea for mainline. x86 architecture is here for long time, and I doubt Intel is going to break it like this. Do you have documentation pointer?
The fact that locked operations that cross cache line boundaries work at all is because of compatibility with very old processors (which always locked the bus).
Quoted 6 lines
Quoted 3 lines
In preparation for this, it is necessary to fix code that may execute atomic instructions with operands that cross cachelines because the #AC trap will crash the kernel.
How does single bit operation "cross cacheline"? How is this going to impact non-x86 architectures?
The cpu 'bit' instructions used always access a full 'word' of memory at a 'word' offset from the specified base address'
With a 64bit bit offset the 'word' is 64 bits, so if the base address of the array isn't 8 byte aligned the cpu does a misaligned RMW cycle.
Non-x86 architectures probably either:
1) Fault on the mis-aligned transfer.
2) Ignore the 'lock'.
3) Use a software 'array of mutex' to emulate locked bit updates.
4) Any random combination of the above.
Quoted 9 lines
Quoted 6 lines
Since "
pwol_mask" is local and never exposed to concurrency, there is no need to set bits inpwol_maskusing atomic operations.Directly operate on the byte which contains the bit instead of using
__set_bit()to avoid any big endian concern due to type cast to unsigned long in__set_bit().What concerns? Is
__set_bit()now useless and are we going to open-code it everywhere? Isset_bit()now unusable on x86?
Both set_bit() and __set_bit() are defined to work on bitmaps that are defined as 'long[]'.
They are not there because people are too lazy to write foo |= 1 << n.
...
Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/broadcom/b44.c +4
-2memset (ppattern + offset,0xff , magicsync); -for (j =0 ; j < magicsync; j++) -set_bit (len++, (unsigned long *) pmask); +for (j =0 ; j < magicsync; j++) { + pmask[len >>3 ] |=BIT (len &7 ); + len++; + }
Quoted 8 lines
drivers/net/ethernet/broadcom/b44.c static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset) · line 1537
Quoted 8 lines
drivers/net/ethernet/broadcom/b44.c +1
-1for (j =0 ; j <B44_MAX_PATTERNS ; j++) {if ((B44_PATTERN_SIZE - len) >=ETH_ALEN )@@ -1532,7 +1534,8 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)for (k =0 ; k< ethaddr_bytes; k++) { ppattern[offset + magicsync + (j *ETH_ALEN ) + k] = macaddr[k]; -set_bit (len++, (unsigned long *) pmask); + pmask[len >>3 ] |=BIT (len &7 );
In this case I believe the pmask[] is passed to hardware. It is very much an array of bytes initialised in a specific way.
set_bit() (and __set_bit()) would do completely the wrong thing on BE systems.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Re: [PATCH 4.19 36/55] drivers/net/b44: Change to non-atomic bit operations on pwol_mask
In reply to Pavel MachekQuoted 6 lines · Pavel Machek
Quoted 3 lines · Greg Kroah-Hartman
From: Fenghua Yu <[email protected]>
[ Upstream commit
f11421ba4af706cb4f5703de34fa77fba8472776]This is not suitable for stable. It does not fix anything.
It fixes the code for BE at the very least.
Quoted 4 lines
It prepares
for theoretical bug that author claims might be introduced to BIOS in future... I doubt it, even BIOS authors boot their machines from time to time.
BIOS authors might not enable this (optional) feature.
Quoted 10 lines
Quoted 6 lines
Atomic operations that span cache lines are super-expensive on x86 (not just to the current processor, but also to other processes as all memory operations are blocked until the operation completes). Upcoming x86 processors have a switch to cause such operations to generate a #AC trap. It is expected that some real time systems will enable this mode in BIOS.
And I wonder if this is even good idea for mainline. x86 architecture is here for long time, and I doubt Intel is going to break it like this. Do you have documentation pointer?
Or you could, you know, like google it. Try "intel split lock detection". It is a feature the OS can enable which will result in #AC exceptions when memops to LOCK prefixed instructions are not properly aligned (because their performance sucks and it impacts execution across the machine, not just the local CPU).
Quoted 6 lines
Quoted 3 lines
In preparation for this, it is necessary to fix code that may execute atomic instructions with operands that cross cachelines because the #AC trap will crash the kernel.
How does single bit operation "cross cacheline"? How is this going to impact non-x86 architectures?
The actual instruction is "LOCK BTSQ", which is a 64bit wide instruction (LOCK BTSL on 32bit kernels). The memory operand of that instruction is (stupidly IMO) allowed to be non aligned.
Any sane architecture (ie, pretty much everyone else) will already trap when you try unaligned atomic ops (or even unaligned anything for most RISCs).
Quoted 9 lines
Quoted 6 lines
Since "
pwol_mask" is local and never exposed to concurrency, there is no need to set bits inpwol_maskusing atomic operations.Directly operate on the byte which contains the bit instead of using
__set_bit()to avoid any big endian concern due to type cast to unsigned long in__set_bit().What concerns? Is
__set_bit()now useless and are we going to open-code it everywhere? Isset_bit()now unusable on x86?
As David already explained, the bitops are defined on long[], are employed on u8[] here (clue the (unsigned long *) cast) and would do completely the wrong thing on BE.
set_bit() works as advertised when used as specified; on long[].
Re: [PATCH 4.19 36/55] drivers/net/b44: Change to non-atomic bit operations on pwol_mask
In reply to Pavel MachekQuoted 3 lines · Pavel Machek
And I wonder if this is even good idea for mainline. x86 architecture is here for long time, and I doubt Intel is going to break it like this. Do you have documentation pointer?
Intel isn't breaking this legacy behaviour. But it is building h/w that allows s/w to opt-in to a mode that will generate an #AC trap for a split lock. One such processor ("Icelake") is already shipping.
Some Linux use cases (real-time) really, really want to avoid the cost of a split-lock. There's a patch in TIP that will enable this #AC on split-lock mode on processors that support it.
Thus it's a good idea to clean up any places in the kernel that will cause #AC when that mode is enabled. I think mainline should be taking any patches for split lock cleanup.
Stable is a different question. The patch to enable the #AC should not be backported to stable. So the only way an old kernel would hit this would be if the BIOS enabled the #AC. Really that should only happen on a system where the developers have validated that the entire software stack has been checked for split locks.
Is net/b44 a device that is still being included on current systems? Or is it a legacy device that has been superceeded by something else? If there isn't going to be a b44 on an Icelake or newer system, then perhaps we should not worry so much about fixing the driver.
-Tony
Greg Kroah-Hartman
maintainerPATCH 37/55 net: wan: sdla: Fix cast from pointer to integer of different size
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 00c0688cecadbf7ac2f5b4cdb36d912a2d3f0cca ]
Since net_device.mem_start is unsigned long, it should not be cast to int right before casting to pointer. This fixes warning (compile testing on alpha architecture):
drivers/net/wan/sdla.c: In function ‘sdla_transmit’:
drivers/net/wan/sdla.c:711:13: warning:
cast to pointer from integer of different size [-Wint-to-pointer-cast]
--- drivers/net/wan/sdla.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wan/sdla.c +1 -1
@@ -711,7 +711,7 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb,spin_lock_irqsave (&sdla_lock, flags);SDLA_WINDOW (dev, addr); - pbuf = (void *)(((int ) dev->mem_start) + (addr &SDLA_ADDR_MASK )); + pbuf = (void *)(dev->mem_start + (addr &SDLA_ADDR_MASK ));__sdla_write (dev, pbuf->buf_addr, skb->data, skb->len);SDLA_WINDOW (dev, addr); pbuf->opp_flag =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/55 gpio: max77620: Add missing dependency on GPIOLIB_IRQCHIP
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit c5706c7defc79de68a115b5536376298a8fef111 ]
Driver fails to compile in a minimized kernel's configuration because of the missing dependency on GPIOLIB_IRQCHIP.
error: ‘struct gpio_chip’ has no member named ‘irq’
44 | virq = irq_find_mapping(gpio->gpio_chip.irq.domain, offset);
--- drivers/gpio/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/Kconfig +1 -0
@@ -1059,6 +1059,7 @@ config GPIO_MADERA config GPIO_MAX77620 tristate "GPIO support for PMIC MAX77620 and MAX20024" depends on MFD_MAX77620 + select GPIOLIB_IRQCHIP help GPIO driver for MAX77620 and MAX20024 PMIC from Maxim Semiconductor. MAX77620 PMIC has 8 pins that can be configured as GPIOs. The
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 39/55 atm: eni: fix uninitialized variable warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 30780d086a83332adcd9362281201cee7c3d9d19 ]
With -O3, gcc has found an actual unintialized variable stored into an mmio register in two instances:
drivers/atm/eni.c: In function 'discard':drivers/atm/eni.c:465:13: error: 'dma[1]' is used uninitialized in this function [-Werror=uninitialized]
writel(dma[i*2+1],eni_dev->rx_dma+dma_wr*8+4);
^drivers/atm/eni.c:465:13: error: 'dma[3]' is used uninitialized in this function [-Werror=uninitialized]
Change the code to always write zeroes instead.
--- drivers/atm/eni.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/atm/eni.c +2 -2
@@ -372,7 +372,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, here = (eni_vcc->descr+skip) & (eni_vcc->words-1 ); dma[j++] = (here <<MID_DMA_COUNT_SHIFT ) | (vcc->vci <<MID_DMA_VCI_SHIFT ) |MID_DT_JK ; - j++; + dma[j++] =0 ; } here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1 );if (!eff) size += skip;
@@ -445,7 +445,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,if (size != eff) { dma[j++] = (here <<MID_DMA_COUNT_SHIFT ) | (vcc->vci <<MID_DMA_VCI_SHIFT ) |MID_DT_JK ; - j++; + dma[j++] =0 ; }if (!j || j >2 *RX_DMA_BUF ) { printk(KERN_CRIT DEV_LABEL "!j or j too big!!!\n");
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 40/55 HID: steam: Fix input device disappearing
In reply to Greg Kroah-HartmanFrom: Rodrigo Rivas Costa <[email protected]>
[ Upstream commit 20eee6e5af35d9586774e80b6e0b1850e7cc9899 ]
The connected value for wired devices was not properly initialized, it must be set to true upon creation, because wired devices do not generate connection events.
When a raw client (the Steam Client) uses the device, the input device is destroyed. Then, when the raw client finishes, it must be recreated. But since the connected variable was false this never happended.
--- drivers/hid/hid-steam.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hid/hid-steam.c +4 -0
@@ -768,8 +768,12 @@ static int steam_probe(struct hid_device *hdev,if (steam->quirks &STEAM_QUIRK_WIRELESS ) {hid_info (hdev,"Steam wireless receiver connected" ); +/* If using a wireless adaptor ask for connection status */ + steam->connected = false;steam_request_conn_status (steam); }else { +/* A wired connection is always present */ + steam->connected = true; ret =steam_register (steam);if (ret) { hid_err(hdev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 41/55 platform/x86: dell-laptop: disable kbd backlight on Inspiron 10xx
In reply to Greg Kroah-HartmanFrom: Pacien TRAN-GIRARD <[email protected]>
[ Upstream commit 10b65e2915b2fcc606d173e98a972850101fb4c4 ]
This patch adds a quirk disabling keyboard backlight support for the Dell Inspiron 1012 and 1018.
Those models wrongly report supporting keyboard backlight control features (through SMBIOS tokens) even though they're not equipped with a backlit keyboard. This led to broken controls being exposed through sysfs by this driver which froze the system when used.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=107651
--- drivers/platform/x86/dell-laptop.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/platform/x86/dell-laptop.c +26 -0
@@ -37,6 +37,7 @@struct quirk_entry {bool touchpad_led; +bool kbd_led_not_present;bool kbd_led_levels_off_1;bool kbd_missing_ac_tag;
@@ -77,6 +78,10 @@ static struct quirk_entry quirk_dell_latitude_e6410 = { .kbd_led_levels_off_1 = true, }; +static struct quirk_entry quirk_dell_inspiron_1012 = { + .kbd_led_not_present = true, +}; +static struct platform_driver platform_driver = { .driver = { .name ="dell-laptop" ,
@@ -314,6 +319,24 @@ static const struct dmi_system_id dell_quirks[] __initconst = { }, .driver_data = &quirk_dell_latitude_e6410, }, + { + .callback = dmi_matched, + .ident = "Dell Inspiron 1012", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"), + }, + .driver_data = &quirk_dell_inspiron_1012, + }, + { + .callback = dmi_matched, + .ident = "Dell Inspiron 1018", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1018"), + }, + .driver_data = &quirk_dell_inspiron_1012, + }, { } };
@@ -1497,6 +1520,9 @@ static void kbd_init(void) {int ret; +if (quirks && quirks->kbd_led_not_present) +return ; + ret =kbd_init_info ();kbd_init_tokens ();
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 42/55 PCI: Add DMA alias quirk for Intel VCA NTB
In reply to Greg Kroah-HartmanFrom: Slawomir Pawlowski <[email protected]>
[ Upstream commit 56b4cd4b7da9ee95778eb5c8abea49f641ebfd91 ]
Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices exposing computational units via Non Transparent Bridges (NTB, PEX 87xx).
Similarly to MIC x200, we need to add DMA aliases to allow buffer access when IOMMU is enabled.
Add aliases to allow computational unit access to host memory. These aliases mark the whole VCA device as one IOMMU group.
All possible slot numbers (0x20) are used, since we are unable to tell what slot is used on other side. This quirk is intended for both host and computational unit sides. The VCA devices have up to five functions: four for DMA channels and one additional.
--- drivers/pci/quirks.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/pci/quirks.c +34 -0
@@ -3986,6 +3986,40 @@ static void quirk_mic_x200_dma_alias(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2260 , quirk_mic_x200_dma_alias);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2264 , quirk_mic_x200_dma_alias); +/* +* Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices +* exposing computational units via Non Transparent Bridges (NTB, PEX 87xx). +* +* Similarly to MIC x200, we need to add DMA aliases to allow buffer access +* when IOMMU is enabled. These aliases allow computational unit access to +* host memory. These aliases mark the whole VCA device as one IOMMU +* group. +* +* All possible slot numbers (0x20) are used, since we are unable to tell +* what slot is used on other side. This quirk is intended for both host +* and computational unit sides. The VCA devices have up to five functions +* (four for DMA channels and one additional). +*/ +static void quirk_pex_vca_alias (struct pci_dev *pdev) +{ +const unsigned int num_pci_slots =0x20 ; +unsigned int slot; + +for (slot =0 ; slot < num_pci_slots; slot++) { +pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x0 )); +pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x1 )); +pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x2 )); +pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x3 )); +pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x4 )); + } +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2954 , quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2955 , quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2956 , quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2958 , quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2959 , quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x295A , quirk_pex_vca_alias); +/* * The IOMMU and interrupt controller on Broadcom Vulcan/Cavium ThunderX2 are * associated not at the root bus, but at a bridge below. This quirk avoids
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 43/55 iommu/amd: Support multiple PCI DMA aliases in IRQ Remapping
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 3c124435e8dd516df4b2fc983f4415386fd6edae ]
Non-Transparent Bridge (NTB) devices (among others) may have many DMA aliases seeing the hardware will send requests with different device ids depending on their origin across the bridged hardware.
See commit ad281ecf1c7d ("PCI: Add DMA alias quirk for Microsemi Switchtec NTB") for more information on this.
The AMD IOMMU IRQ remapping functionality ignores all PCI aliases for IRQs so if devices send an interrupt from one of their aliases they will be blocked on AMD hardware with the IOMMU enabled.
To fix this, ensure IRQ remapping is enabled for all aliases with MSI interrupts.
This is analogous to the functionality added to the Intel IRQ remapping code in commit 3f0c625c6ae7 ("iommu/vt-d: Allow interrupts from the entire bus for aliased devices")
--- drivers/iommu/amd_iommu.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
drivers/iommu/amd_iommu.c +30 -7
@@ -3709,7 +3709,20 @@ static void set_remap_table_entry(struct amd_iommu *iommu, u16 devid,iommu_flush_dte (iommu, devid); } -static struct irq_remap_table *alloc_irq_table (u16 devid) +static int set_remap_table_entry_alias (struct pci_dev *pdev,u16 alias, +void *data) +{ +struct irq_remap_table *table = data; + + irq_lookup_table[alias] = table; +set_dte_irq_entry (alias, table); + +iommu_flush_dte (amd_iommu_rlookup_table[alias], alias); + +return 0 ; +} + +static struct irq_remap_table *alloc_irq_table (u16 devid,struct pci_dev *pdev) {struct irq_remap_table *table =NULL ;struct irq_remap_table *new_table =NULL ;
@@ -3755,7 +3768,12 @@ static struct irq_remap_table *alloc_irq_table(u16 devid) table = new_table; new_table =NULL ; -set_remap_table_entry (iommu, devid, table); +if (pdev) +pci_for_each_dma_alias (pdev, set_remap_table_entry_alias, + table); +else +set_remap_table_entry (iommu, devid, table); +if (devid != alias)set_remap_table_entry (iommu, alias, table);
@@ -3772,7 +3790,8 @@ out_unlock:return table; } -static int alloc_irq_index (u16 devid,int count,bool align) +static int alloc_irq_index (u16 devid,int count,bool align, +struct pci_dev *pdev) {struct irq_remap_table *table;int index, c, alignment =1 ;
@@ -3782,7 +3801,7 @@ static int alloc_irq_index(u16 devid, int count, bool align)if (!iommu)return -ENODEV ; - table =alloc_irq_table (devid); + table =alloc_irq_table (devid, pdev);if (!table)return -ENODEV ;
@@ -4215,7 +4234,7 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq,struct irq_remap_table *table;struct amd_iommu *iommu; - table =alloc_irq_table (devid); + table =alloc_irq_table (devid,NULL );if (table) {if (!table->min_index) {/*
@@ -4232,11 +4251,15 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq, }else { index = -ENOMEM ; } - }else { + }else if (info->type ==X86_IRQ_ALLOC_TYPE_MSI || + info->type ==X86_IRQ_ALLOC_TYPE_MSIX ) {bool align = (info->type ==X86_IRQ_ALLOC_TYPE_MSI ); - index =alloc_irq_index (devid, nr_irqs, align); + index =alloc_irq_index (devid, nr_irqs, align, info->msi_dev); + }else { + index =alloc_irq_index (devid, nr_irqs, false,NULL ); } +if (index <0 ) {pr_warn ("Failed to allocate IRTE\n" ); ret = index;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 44/55 ARM: OMAP2+: SmartReflex: add omap_sr_pdata definition
In reply to Greg Kroah-HartmanFrom: Ben Dooks <[email protected]>
[ Upstream commit 2079fe6ea8cbd2fb2fbadba911f1eca6c362eb9b ]
The omap_sr_pdata is not declared but is exported, so add a define for it to fix the following warning:
arch/arm/mach-omap2/pdata-quirks.c:609:36: warning: symbol 'omap_sr_pdata' was not declared. Should it be static?
--- include/linux/power/smartreflex.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/power/smartreflex.h +3 -0
@@ -296,6 +296,9 @@ struct omap_sr_data {struct voltagedomain *voltdm; }; + +extern struct omap_sr_data omap_sr_pdata[OMAP_SR_NR ]; +#ifdef CONFIG_POWER_AVS_OMAP /* Smartreflex module enable/disable interface */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 45/55 usb-storage: Disable UAS on JMicron SATA enclosure
In reply to Greg Kroah-HartmanFrom: Laura Abbott <[email protected]>
[ Upstream commit bc3bdb12bbb3492067c8719011576370e959a2e6 ]
Steve Ellis reported incorrect block sizes and alignement offsets with a SATA enclosure. Adding a quirk to disable UAS fixes the problems.
--- drivers/usb/storage/unusual_uas.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/storage/unusual_uas.h +5 -2
@@ -87,12 +87,15 @@ UNUSUAL_DEV(0x2537, 0x1068, 0x0000, 0x9999, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_IGNORE_UAS), -/* Reported-by: Takeo Nakayama <[email protected]> */ +/* +* Initially Reported-by: Takeo Nakayama <[email protected]> +* UAS Ignore Reported by Steven Ellis <[email protected]> +*/ UNUSUAL_DEV (0x357d ,0x7788 ,0x0000 ,0x9999 ,"JMicron" ,"JMS566" ,USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , -US_FL_NO_REPORT_OPCODES ), +US_FL_NO_REPORT_OPCODES |US_FL_IGNORE_UAS ),/* Reported-by: Hans de Goede <[email protected]> */ UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 46/55 sched/fair: Add tmp_alone_branch assertion
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 5d299eabea5a251fbf66e8277704b874bbba92dc upstream.
The magic in list_add_leaf_cfs_rq() requires that at the end of enqueue_task_fair():
rq->tmp_alone_branch == &rq->lead_cfs_rq_list
If this is violated, list integrity is compromised for list entries and the tmp_alone_branch pointer might dangle.
Also, reflow list_add_leaf_cfs_rq() while there. This looses one indentation level and generates a form that's convenient for the next patch.
--- kernel/sched/fair.c | 126 +++++++++++++++++++++++++++++----------------------- 1 file changed, 71 insertions(+), 55 deletions(-)
kernel/sched/fair.c +71 -55
@@ -284,64 +284,69 @@ static inline struct cfs_rq *group_cfs_rstatic inline void list_add_leaf_cfs_rq (struct cfs_rq *cfs_rq) { -if (!cfs_rq->on_list) { -struct rq *rq =rq_of (cfs_rq); -int cpu =cpu_of (rq); +struct rq *rq =rq_of (cfs_rq); +int cpu =cpu_of (rq); + +if (cfs_rq->on_list) +return ; + + cfs_rq->on_list =1 ; + +/* +* Ensure we either appear before our parent (if already +* enqueued) or force our parent to appear after us when it is +* enqueued. The fact that we always enqueue bottom-up +* reduces this to two cases and a special case for the root +* cfs_rq. Furthermore, it also means that we will always reset +* tmp_alone_branch either when the branch is connected +* to a tree or when we reach the top of the tree +*/ +if (cfs_rq->tg->parent && + cfs_rq->tg->parent->cfs_rq[cpu]->on_list) {/* -* Ensure we either appear before our parent (if already -* enqueued) or force our parent to appear after us when it is -* enqueued. The fact that we always enqueue bottom-up -* reduces this to two cases and a special case for the root -* cfs_rq. Furthermore, it also means that we will always reset -* tmp_alone_branch either when the branch is connected -* to a tree or when we reach the beg of the tree +* If parent is already on the list, we add the child +* just before. Thanks to circular linked property of +* the list, this means to put the child at the tail +* of the list that starts by parent. */ -if (cfs_rq->tg->parent && - cfs_rq->tg->parent->cfs_rq[cpu]->on_list) { -/* -* If parent is already on the list, we add the child -* just before. Thanks to circular linked property of -* the list, this means to put the child at the tail -* of the list that starts by parent. -*/ -list_add_tail_rcu (&cfs_rq->leaf_cfs_rq_list, - &(cfs_rq->tg->parent->cfs_rq[cpu]->leaf_cfs_rq_list)); -/* -* The branch is now connected to its tree so we can -* reset tmp_alone_branch to the beginning of the -* list. -*/ - rq->tmp_alone_branch = &rq->leaf_cfs_rq_list; - }else if (!cfs_rq->tg->parent) { -/* -* cfs rq without parent should be put -* at the tail of the list. -*/ -list_add_tail_rcu (&cfs_rq->leaf_cfs_rq_list, - &rq->leaf_cfs_rq_list); -/* -* We have reach the beg of a tree so we can reset -* tmp_alone_branch to the beginning of the list. -*/ - rq->tmp_alone_branch = &rq->leaf_cfs_rq_list; - }else { -/* -* The parent has not already been added so we want to -* make sure that it will be put after us. -* tmp_alone_branch points to the beg of the branch -* where we will add parent. -*/ -list_add_rcu (&cfs_rq->leaf_cfs_rq_list, - rq->tmp_alone_branch); -/* -* update tmp_alone_branch to points to the new beg -* of the branch -*/ - rq->tmp_alone_branch = &cfs_rq->leaf_cfs_rq_list; - } +list_add_tail_rcu (&cfs_rq->leaf_cfs_rq_list, + &(cfs_rq->tg->parent->cfs_rq[cpu]->leaf_cfs_rq_list)); +/* +* The branch is now connected to its tree so we can +* reset tmp_alone_branch to the beginning of the +* list. +*/ + rq->tmp_alone_branch = &rq->leaf_cfs_rq_list; +return ; + } - cfs_rq->on_list =1 ; +if (!cfs_rq->tg->parent) { +/* +* cfs rq without parent should be put +* at the tail of the list. +*/ +list_add_tail_rcu (&cfs_rq->leaf_cfs_rq_list, + &rq->leaf_cfs_rq_list); +/* +* We have reach the top of a tree so we can reset +* tmp_alone_branch to the beginning of the list. +*/ + rq->tmp_alone_branch = &rq->leaf_cfs_rq_list; +return ; } + +/* +* The parent has not already been added so we want to +* make sure that it will be put after us. +* tmp_alone_branch points to the begin of the branch +* where we will add parent. +*/ +list_add_rcu (&cfs_rq->leaf_cfs_rq_list, rq->tmp_alone_branch); +/* +* update tmp_alone_branch to points to the new begin +* of the branch +*/ + rq->tmp_alone_branch = &cfs_rq->leaf_cfs_rq_list; }static inline void list_del_leaf_cfs_rq (struct cfs_rq *cfs_rq)
@@ -352,7 +357,12 @@ static inline void list_del_leaf_cfs_rq( } } -/* Iterate through all leaf cfs_rq's on a runqueue: */ +static inline void assert_list_leaf_cfs_rq (struct rq *rq) +{ +SCHED_WARN_ON (rq->tmp_alone_branch != &rq->leaf_cfs_rq_list); +} + +/* Iterate through all cfs_rq's on a runqueue in bottom-up order */ #define for_each_leaf_cfs_rq (rq, cfs_rq) \ list_for_each_entry_rcu(cfs_rq, &rq->leaf_cfs_rq_list, leaf_cfs_rq_list)
@@ -446,6 +456,10 @@ static inline void list_del_leaf_cfs_rq( { } +static inline void assert_list_leaf_cfs_rq (struct rq *rq) +{ +} +#define for_each_leaf_cfs_rq (rq, cfs_rq) \ for (cfs_rq = &rq->cfs; cfs_rq; cfs_rq = NULL)
@@ -5160,6 +5174,8 @@ enqueue_task_fair(struct rq *rq, structif (!se)add_nr_running (rq,1 ); +assert_list_leaf_cfs_rq (rq); +hrtick_update (rq); }
Greg Kroah-Hartman
maintainerPATCH 47/55 sched/fair: Fix insertion in rq->leaf_cfs_rq_list
In reply to Greg Kroah-HartmanFrom: Vincent Guittot <[email protected]>
commit f6783319737f28e4436a69611853a5a098cbe974 upstream.
Sargun reported a crash:
"I picked up c40f7d74c741a907cfaeb73a7697081881c497d0 sched/fair: Fix
infinite loop in update_blocked_averages() by reverting a9e7f6544b9c and put it on top of 4.19.13. In addition to this, I uninlined list_add_leaf_cfs_rq for debugging.
This revealed a new bug that we didn't get to because we kept getting crashes from the previous issue. When we are running with cgroups that are rapidly changing, with CFS bandwidth control, and in addition using the cpusets cgroup, we see this crash. Specifically, it seems to occur with cgroups that are throttled and we change the allowed cpuset."
The algorithm used to order cfs_rq in rq->leaf_cfs_rq_list assumes that it will walk down to root the 1st time a cfs_rq is used and we will finish to add either a cfs_rq without parent or a cfs_rq with a parent that is already on the list. But this is not always true in presence of throttling. Because a cfs_rq can be throttled even if it has never been used but other CPUs of the cgroup have already used all the bandwdith, we are not sure to go down to the root and add all cfs_rq in the list.
Ensure that all cfs_rq will be added in the list even if they are throttled.
[ mingo: Fix !CGROUPS build. ]
--- kernel/sched/fair.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-)
kernel/sched/fair.c +28 -5
@@ -282,13 +282,13 @@ static inline struct cfs_rq *group_cfs_rreturn grp->my_q; } -static inline void list_add_leaf_cfs_rq (struct cfs_rq *cfs_rq) +static inline bool list_add_leaf_cfs_rq (struct cfs_rq *cfs_rq) {struct rq *rq =rq_of (cfs_rq);int cpu =cpu_of (rq);if (cfs_rq->on_list) -return ; +return rq->tmp_alone_branch == &rq->leaf_cfs_rq_list; cfs_rq->on_list =1 ;
@@ -317,7 +317,7 @@ static inline void list_add_leaf_cfs_rq(* list. */ rq->tmp_alone_branch = &rq->leaf_cfs_rq_list; -return ; +return true; }if (!cfs_rq->tg->parent) {
@@ -332,7 +332,7 @@ static inline void list_add_leaf_cfs_rq(* tmp_alone_branch to the beginning of the list. */ rq->tmp_alone_branch = &rq->leaf_cfs_rq_list; -return ; +return true; }/*
@@ -347,6 +347,7 @@ static inline void list_add_leaf_cfs_rq(* of the branch */ rq->tmp_alone_branch = &cfs_rq->leaf_cfs_rq_list; +return false; }static inline void list_del_leaf_cfs_rq (struct cfs_rq *cfs_rq)
@@ -448,8 +449,9 @@ static inline struct cfs_rq *group_cfs_rreturn NULL ; } -static inline void list_add_leaf_cfs_rq (struct cfs_rq *cfs_rq) +static inline bool list_add_leaf_cfs_rq (struct cfs_rq *cfs_rq) { +return true; }static inline void list_del_leaf_cfs_rq (struct cfs_rq *cfs_rq)
@@ -5019,6 +5021,12 @@ static void __maybe_unused unthrottle_of }#else /* CONFIG_CFS_BANDWIDTH */ + +static inline bool cfs_bandwidth_used (void ) +{ +return false; +} +static inline u64 cfs_rq_clock_task (struct cfs_rq *cfs_rq) {return rq_clock_task (rq_of (cfs_rq));
@@ -5174,6 +5182,21 @@ enqueue_task_fair(struct rq *rq, structif (!se)add_nr_running (rq,1 ); +if (cfs_bandwidth_used ()) { +/* +* When bandwidth control is enabled; the cfs_rq_throttled() +* breaks in the above iteration can result in incomplete +* leaf list maintenance, resulting in triggering the assertion +* below. +*/ +for_each_sched_entity (se) { + cfs_rq =cfs_rq_of (se); + +if (list_add_leaf_cfs_rq (cfs_rq)) +break ; + } + } +assert_list_leaf_cfs_rq (rq);hrtick_update (rq);
Greg Kroah-Hartman
maintainerPATCH 48/55 rsi: fix use-after-free on probe errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 92aafe77123ab478e5f5095878856ab0424910da upstream.
The driver would fail to stop the command timer in most error paths, something which specifically could lead to the timer being freed while still active on I/O errors during probe.
Fix this by making sure that each function starting the timer also stops it in all relevant error paths.
--- drivers/net/wireless/rsi/rsi_91x_hal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/rsi/rsi_91x_hal.c +6 -6
@@ -616,6 +616,7 @@ static int bl_cmd(struct rsi_hw *adapterbl_start_cmd_timer (adapter, timeout); status =bl_write_cmd (adapter, cmd, exp_resp, ®out_val);if (status <0 ) { +bl_stop_cmd_timer (adapter);rsi_dbg (ERR_ZONE ,"%s: Command %s (%0x) writing failed..\n" , __func__, str, cmd);
@@ -731,10 +732,9 @@ static int ping_pong_write(struct rsi_hw } status =bl_cmd (adapter, cmd_req, cmd_resp, str); -if (status) { -bl_stop_cmd_timer (adapter); +if (status)return status; - } +return 0 ; }
@@ -822,10 +822,9 @@ static int auto_fw_upgrade(struct rsi_hw status =bl_cmd (adapter,EOF_REACHED ,FW_LOADING_SUCCESSFUL ,"EOF_REACHED" ); -if (status) { -bl_stop_cmd_timer (adapter); +if (status)return status; - } +rsi_dbg (INFO_ZONE ,"FW loading is done and FW is running..\n" );return 0 ; }
@@ -846,6 +845,7 @@ static int rsi_load_firmware(struct rsi_ status = hif_ops->master_reg_read (adapter,SWBL_REGOUT , ®out_val,2 );if (status <0 ) { +bl_stop_cmd_timer (adapter);rsi_dbg (ERR_ZONE ,"%s: REGOUT read failed\n" , __func__);return status;
Greg Kroah-Hartman
maintainerPATCH 49/55 rsi: fix memory leak on failed URB submission
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 47768297481184932844ab01a86752ba31a38861 upstream.
Make sure to free the skb on failed receive-URB submission (e.g. on disconnect or currently also due to a missing endpoint).
--- drivers/net/wireless/rsi/rsi_91x_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_usb.c +3 -1
@@ -327,8 +327,10 @@ static int rsi_rx_urb_submit(struct rsi_ rx_cb); status =usb_submit_urb (urb,GFP_KERNEL ); -if (status) +if (status) {rsi_dbg (ERR_ZONE ,"%s: Failed in urb submission\n" , __func__); +dev_kfree_skb (skb); + }return status; }
Greg Kroah-Hartman
maintainerPATCH 50/55 rsi: fix non-atomic allocation in completion handler
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit b9b9f9fea21830f85cf0148cd8dce001ae55ead1 upstream.
USB completion handlers are called in atomic context and must specifically not allocate memory using GFP_KERNEL.
--- drivers/net/wireless/rsi/rsi_91x_usb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/rsi/rsi_91x_usb.c +7 -6
@@ -16,6 +16,7 @@*/ #include <linux/module.h> +#include <linux/types.h> #include <net/rsi_91x.h> #include "rsi_usb.h" #include "rsi_hal.h"
@@ -29,7 +30,7 @@ MODULE_PARM_DESC(dev_oper_mode,"9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" "6[AP + BT classic], 14[AP + BT classic + BT LE]"); -static int rsi_rx_urb_submit (struct rsi_hw *adapter,u8 ep_num); +static int rsi_rx_urb_submit (struct rsi_hw *adapter,u8 ep_num,gfp_t flags);/** * rsi_usb_card_write() - This function writes to the USB Card.
@@ -283,7 +284,7 @@ static void rsi_rx_done_handler(struct u status =0 ; out: -if (rsi_rx_urb_submit (dev->priv, rx_cb->ep_num)) +if (rsi_rx_urb_submit (dev->priv, rx_cb->ep_num,GFP_ATOMIC ))rsi_dbg (ERR_ZONE ,"%s: Failed in urb submission" , __func__);if (status)
@@ -296,7 +297,7 @@ out:* * Return: 0 on success, a negative error code on failure. */ -static int rsi_rx_urb_submit (struct rsi_hw *adapter,u8 ep_num) +static int rsi_rx_urb_submit (struct rsi_hw *adapter,u8 ep_num,gfp_t mem_flags) {struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num -1 ];
@@ -326,7 +327,7 @@ static int rsi_rx_urb_submit(struct rsi_ rsi_rx_done_handler, rx_cb); - status =usb_submit_urb (urb,GFP_KERNEL ); + status =usb_submit_urb (urb, mem_flags);if (status) {rsi_dbg (ERR_ZONE ,"%s: Failed in urb submission\n" , __func__);dev_kfree_skb (skb);
@@ -783,12 +784,12 @@ static int rsi_probe(struct usb_interfacrsi_dbg (INIT_ZONE ,"%s: Device Init Done\n" , __func__); } - status =rsi_rx_urb_submit (adapter,WLAN_EP ); + status =rsi_rx_urb_submit (adapter,WLAN_EP ,GFP_KERNEL );if (status) goto err1;if (adapter->priv->coex_mode >1 ) { - status =rsi_rx_urb_submit (adapter,BT_EP ); + status =rsi_rx_urb_submit (adapter,BT_EP ,GFP_KERNEL );if (status) goto err1; }
Greg Kroah-Hartman
maintainerPATCH 51/55 crypto: af_alg - Use bh_lock_sock in sk_destruct
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
commit 37f96694cf73ba116993a9d2d99ad6a75fa7fdb0 upstream.
As af_alg_release_parent may be called from BH context (most notably due to an async request that only completes after socket closure, or as reported here because of an RCU-delayed sk_destruct call), we must use bh_lock_sock instead of lock_sock.
--- crypto/af_alg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
crypto/af_alg.c +4 -2
@@ -139,11 +139,13 @@ void af_alg_release_parent(struct sock * sk = ask->parent; ask =alg_sk (sk); -lock_sock (sk); +local_bh_disable (); +bh_lock_sock (sk); ask->nokey_refcnt -= nokey;if (!last) last = !--ask->refcnt; -release_sock (sk); +bh_unlock_sock (sk); +local_bh_enable ();if (last)sock_put (sk);
Greg Kroah-Hartman
maintainerPATCH 52/55 random: try to actively add entropy rather than passively wait for it
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit 50ee7529ec4500c88f8664560770a7a1b65db72b upstream.
For 5.3 we had to revert a nice ext4 IO pattern improvement, because it caused a bootup regression due to lack of entropy at bootup together with arguably broken user space that was asking for secure random numbers when it really didn't need to.
See commit 72dbcf721566 (Revert "ext4: make __ext4_get_inode_loc plug").
This aims to solve the issue by actively generating entropy noise using the CPU cycle counter when waiting for the random number generator to initialize. This only works when you have a high-frequency time stamp counter available, but that's the case on all modern x86 CPU's, and on most other modern CPU's too.
What we do is to generate jitter entropy from the CPU cycle counter under a somewhat complex load: calling the scheduler while also guaranteeing a certain amount of timing noise by also triggering a timer.
I'm sure we can tweak this, and that people will want to look at other alternatives, but there's been a number of papers written on jitter entropy, and this should really be fairly conservative by crediting one bit of entropy for every timer-induced jump in the cycle counter. Not because the timer itself would be all that unpredictable, but because the interaction between the timer and the loop is going to be.
Even if (and perhaps particularly if) the timer actually happens on another CPU, the cacheline interaction between the loop that reads the cycle counter and the timer itself firing is going to add perturbations to the cycle counter values that get mixed into the entropy pool.
As Thomas pointed out, with a modern out-of-order CPU, even quite simple loops show a fair amount of hard-to-predict timing variability even in the absense of external interrupts. But this tries to take that further by actually having a fairly complex interaction.
This is not going to solve the entropy issue for architectures that have no CPU cycle counter, but it's not clear how (and if) that is solvable, and the hardware in question is largely starting to be irrelevant. And by doing this we can at least avoid some of the even more contentious approaches (like making the entropy waiting time out in order to avoid the possibly unbounded waiting).
--- drivers/char/random.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-)
drivers/char/random.c +61 -1
@@ -1653,6 +1653,56 @@ void get_random_bytes(void *buf, int nby }EXPORT_SYMBOL (get_random_bytes); + +/* +* Each time the timer fires, we expect that we got an unpredictable +* jump in the cycle counter. Even if the timer is running on another +* CPU, the timer activity will be touching the stack of the CPU that is +* generating entropy.. +* +* Note that we don't re-arm the timer in the timer itself - we are +* happy to be scheduled away, since that just makes the load more +* complex, but we do not want the timer to keep ticking unless the +* entropy loop is running. +* +* So the re-arming always happens in the entropy loop itself. +*/ +static void entropy_timer (struct timer_list *t) +{ +credit_entropy_bits (&input_pool,1 ); +} + +/* +* If we have an actual cycle counter, see if we can +* generate enough entropy with timing noise +*/ +static void try_to_generate_entropy (void ) +{ +struct { +unsigned long now; +struct timer_list timer; + } stack; + + stack.now =random_get_entropy (); + +/* Slow counter - or none. Don't even bother */ +if (stack.now ==random_get_entropy ()) +return ; + +timer_setup_on_stack (&stack.timer, entropy_timer,0 ); +while (!crng_ready ()) { +if (!timer_pending (&stack.timer)) +mod_timer (&stack.timer, jiffies+1 ); +mix_pool_bytes (&input_pool, &stack.now,sizeof (stack.now)); +schedule (); + stack.now =random_get_entropy (); + } + +del_timer_sync (&stack.timer); +destroy_timer_on_stack (&stack.timer); +mix_pool_bytes (&input_pool, &stack.now,sizeof (stack.now)); +} +/* * Wait for the urandom pool to be seeded and thus guaranteed to supply * cryptographically secure random numbers. This applies to: the /dev/urandom
@@ -1667,7 +1717,17 @@ int wait_for_random_bytes(void) {if (likely (crng_ready ()))return 0 ; -return wait_event_interruptible (crng_init_wait,crng_ready ()); + +do { +int ret; + ret =wait_event_interruptible_timeout (crng_init_wait,crng_ready (),HZ ); +if (ret) +return ret >0 ?0 : ret; + +try_to_generate_entropy (); + }while (!crng_ready ()); + +return 0 ; }EXPORT_SYMBOL (wait_for_random_bytes);
Greg Kroah-Hartman
maintainerPATCH 53/55 block: cleanup __blkdev_issue_discard()
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
commit ba5d73851e71847ba7f7f4c27a1a6e1f5ab91c79 upstream.
Cleanup __blkdev_issue_discard() a bit:
- remove local variable of 'end_sect'
- remove code block of 'fail'
--- block/blk-lib.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
block/blk-lib.c +6 -17
@@ -52,15 +52,12 @@ int __blkdev_issue_discard(struct block_if ((sector | nr_sects) & bs_mask)return -EINVAL ; -while (nr_sects) { -unsigned int req_sects = nr_sects; -sector_t end_sect; - -if (!req_sects) - goto fail; - req_sects =min (req_sects,bio_allowed_max_sectors (q)); +if (!nr_sects) +return -EINVAL ; - end_sect = sector + req_sects; +while (nr_sects) { + unsigned int req_sects = min_t(unsigned int, nr_sects, +bio_allowed_max_sectors (q)); bio =next_bio (bio,0 , gfp_mask); bio->bi_iter.bi_sector = sector;
@@ -68,8 +65,8 @@ int __blkdev_issue_discard(struct block_bio_set_op_attrs (bio, op,0 ); bio->bi_iter.bi_size = req_sects <<9 ; + sector += req_sects; nr_sects -= req_sects; - sector = end_sect;/* * We can loop for a long time in here, if someone does
@@ -82,14 +79,6 @@ int __blkdev_issue_discard(struct block_ *biop = bio;return 0 ; - -fail: -if (bio) { -submit_bio_wait (bio); -bio_put (bio); - } - *biop =NULL ; -return -EOPNOTSUPP ; }EXPORT_SYMBOL (__blkdev_issue_discard);
Greg Kroah-Hartman
maintainerPATCH 54/55 block: fix 32 bit overflow in __blkdev_issue_discard()
In reply to Greg Kroah-HartmanFrom: Dave Chinner <[email protected]>
commit 4800bf7bc8c725e955fcbc6191cc872f43f506d3 upstream.
A discard cleanup merged into 4.20-rc2 causes fstests xfs/259 to fall into an endless loop in the discard code. The test is creating a device that is exactly 2^32 sectors in size to test mkfs boundary conditions around the 32 bit sector overflow region.
mkfs issues a discard for the entire device size by default, and hence this throws a sector count of 2^32 into blkdev_issue_discard(). It takes the number of sectors to discard as a sector_t - a 64 bit value.
The commit ba5d73851e71 ("block: cleanup __blkdev_issue_discard") takes this sector count and casts it to a 32 bit value before comapring it against the maximum allowed discard size the device has. This truncates away the upper 32 bits, and so if the lower 32 bits of the sector count is zero, it starts issuing discards of length 0. This causes the code to fall into an endless loop, issuing a zero length discards over and over again on the same sector.
Killed pointless WARN_ON().
--- block/blk-lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
block/blk-lib.c +3 -1
@@ -56,9 +56,11 @@ int __blkdev_issue_discard(struct block_return -EINVAL ;while (nr_sects) { - unsigned int req_sects = min_t(unsigned int, nr_sects, +sector_t req_sects =min_t (sector_t, nr_sects,bio_allowed_max_sectors (q)); +WARN_ON_ONCE ((req_sects <<9 ) >UINT_MAX ); + bio =next_bio (bio,0 , gfp_mask); bio->bi_iter.bi_sector = sector;bio_set_dev (bio, bdev);
Greg Kroah-Hartman
maintainerPATCH 55/55 KVM: arm64: Write arch.mdcr_el2 changes since last vcpu_load on VHE
In reply to Greg Kroah-HartmanFrom: Andrew Murray <[email protected]>
commit 4942dc6638b07b5326b6d2faa142635c559e7cd5 upstream.
On VHE systems arch.mdcr_el2 is written to mdcr_el2 at vcpu_load time to set options for self-hosted debug and the performance monitors extension.
Unfortunately the value of arch.mdcr_el2 is not calculated until kvm_arm_setup_debug() in the run loop after the vcpu has been loaded. This means that the initial brief iterations of the run loop use a zero value of mdcr_el2 - until the vcpu is preempted. This also results in a delay between changes to vcpu->guest_debug taking effect.
Fix this by writing to mdcr_el2 in kvm_arm_setup_debug() on VHE systems when a change to arch.mdcr_el2 has been detected.
--- arch/arm64/kvm/debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kvm/debug.c +5 -1
@@ -112,7 +112,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_void kvm_arm_setup_debug (struct kvm_vcpu *vcpu) {bool trap_debug = !(vcpu->arch.flags &KVM_ARM64_DEBUG_DIRTY ); -unsigned long mdscr; +unsigned long mdscr, orig_mdcr_el2 = vcpu->arch.mdcr_el2;trace_kvm_arm_setup_debug (vcpu, vcpu->guest_debug);
@@ -208,6 +208,10 @@ void kvm_arm_setup_debug(struct kvm_vcpuif (vcpu_read_sys_reg (vcpu,MDSCR_EL1 ) & (DBG_MDSCR_KDE |DBG_MDSCR_MDE )) vcpu->arch.flags |=KVM_ARM64_DEBUG_DIRTY ; +/* Write mdcr_el2 changes since vcpu_load on VHE systems */ +if (has_vhe () && orig_mdcr_el2 != vcpu->arch.mdcr_el2) +write_sysreg (vcpu->arch.mdcr_el2, mdcr_el2); +trace_kvm_arm_set_dreg32 ("MDCR_EL2" , vcpu->arch.mdcr_el2);trace_kvm_arm_set_dreg32 ("MDSCR_EL1" ,vcpu_read_sys_reg (vcpu,MDSCR_EL1 )); }
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.101 release. There are 55 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 Feb 2020 18:35:06 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.101-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.101 release. There are 55 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 Feb 2020 18:35:06 +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.19.101-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v4.19:
11 builds: 11 pass, 0 fail
22 boots: 22 pass, 0 fail
32 tests: 32 pass, 0 failLinux version: 4.19.101-rc1-g985d20b62b7c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Cheers
Jon
Signature · 1 line
nvpublic
Hi!
Quoted 7 lines
This is the start of the stable review cycle for the 4.19.101 release. There are 55 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 Feb 2020 18:35:06 +0000. Anything received after that time might be too late.
No problems detected in CIP compile/boot tests:
4.4.213-rc1 also seems to compile ok:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/pipelines/113738982
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerQuoted 7 lines · Pavel Machek
Hi!
Quoted 5 lines
This is the start of the stable review cycle for the 4.19.101 release. There are 55 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.
Quoted 6 lines
Quoted 2 lines
Responses should be made by Sat, 01 Feb 2020 18:35:06 +0000. Anything received after that time might be too late.
No problems detected in CIP compile/boot tests:
Thanks for testing and letting me know.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.101 release. There are 55 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 Feb 2020 18:35:06 +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.19.101-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.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.19.101-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.19.y
git commit: 985d20b62b7cab0f7e2cf0e9253560f494e1a572
git describe: v4.19.100-56-g985d20b62b7c
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.19-oe/build/v4.19.100-56-g985d20b62b7c
No regressions (compared to build v4.19.100)
No fixes (compared to build v4.19.100)
Ran 24206 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-ipc-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* spectre-meltdown-checker-test
* v4l2-compliance
* libhugetlbfs
* ltp-commands-tests
* ltp-dio-tests
* ltp-fs-tests
* ltp-io-tests
* ltp-math-tests
* network-basic-tests
* perf
* ltp-open-posix-tests
* kvm-unit-tests
* ssuite
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.101 release. There are 55 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 Feb 2020 18:35:06 +0000. Anything received after that time might be too late.
Build results:
total: 156 pass: 156 fail: 0 Qemu test results: total: 382 pass: 382 fail: 0
Guenter