4.14.219-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.14.219-rc1 review
This is the start of the stable review cycle for the 4.14.219 release. There are 30 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 Thu, 04 Feb 2021 13:29:33 +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.14.219-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.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.219-rc1
Pengcheng Yang <[email protected]>
tcp: fix TLP timer not set when CA_STATE changes from DISORDER to OPEN
Ivan Vecera <[email protected]>
team: protect features update by RCU to avoid deadlock
Pan Bian <[email protected]>
NFC: fix possible resource leak
Pan Bian <[email protected]>
NFC: fix resource leak when target index is invalid
Bartosz Golaszewski <[email protected]>
iommu/vt-d: Don't dereference iommu_device if IOMMU_API is not built
David Woodhouse <[email protected]>
iommu/vt-d: Gracefully handle DMAR units with no supported address widths
Andy Lutomirski <[email protected]>
x86/entry/64/compat: Fix "x86/entry/64/compat: Preserve r8-r11 in int $0x80"
Andy Lutomirski <[email protected]>
x86/entry/64/compat: Preserve r8-r11 in int $0x80
Dan Carpenter <[email protected]>
can: dev: prevent potential information leak in can_fill_info()
Johannes Berg <[email protected]>
mac80211: pause TX while changing interface type
Johannes Berg <[email protected]>
iwlwifi: pcie: reschedule in long-running memory reads
Johannes Berg <[email protected]>
iwlwifi: pcie: use jiffies for memory read spin time limit
Kamal Heib <[email protected]>
RDMA/cxgb4: Fix the reported max_recv_sge value
Shmulik Ladkani <[email protected]>
xfrm: Fix oops in xfrm_replay_advance_bmp
Pablo Neira Ayuso <[email protected]>
netfilter: nft_dynset: add timeout extension to template
Max Krummenacher <[email protected]>
ARM: imx: build suspend-imx6.S with arm instruction set
Roger Pau Monne <[email protected]>
xen-blkfront: allow discard-* nodes to be optional
Lorenzo Bianconi <[email protected]>
mt7601u: fix rx buffer refcounting
Lorenzo Bianconi <[email protected]>
mt7601u: fix kernel crash unplugging the device
Andrea Righi <[email protected]>
leds: trigger: fix potential deadlock with libata
David Woodhouse <[email protected]>
xen: Fix XenStore initialisation for XS_LOCAL
Jay Zhou <[email protected]>
KVM: x86: get smi pending status correctly
Like Xu <[email protected]>
KVM: x86/pmu: Fix HW_REF_CPU_CYCLES event pseudo-encoding in intel_arch_events[]
Claudiu Beznea <[email protected]>
drivers: soc: atmel: add null entry at the end of at91_soc_allowed_list[]
Sudeep Holla <[email protected]>
drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs
Giacinto Cifelli <[email protected]>
net: usb: qmi_wwan: added support for Thales Cinterion PLSx3 modem family
Johannes Berg <[email protected]>
wext: fix NULL-ptr-dereference with cfg80211's lack of commit()
Koen Vandeputte <[email protected]>
ARM: dts: imx6qdl-gw52xx: fix duplicate regulator naming
Kai-Heng Feng <[email protected]>
ACPI: sysfs: Prefer "compatible" modalias
Josef Bacik <[email protected]>
nbd: freeze the queue while we're adding connections
-------------
Diffstat:
Makefile | 4 +-- arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | 2 +- arch/arm/mach-imx/suspend-imx6.S | 1 + arch/x86/entry/entry_64_compat.S | 8 ++--- arch/x86/kvm/pmu_intel.c | 2 +- arch/x86/kvm/x86.c | 5 +++ drivers/acpi/device_sysfs.c | 20 ++++------- drivers/block/nbd.c | 8 +++++ drivers/block/xen-blkfront.c | 20 ++++------- drivers/infiniband/hw/cxgb4/qp.c | 2 +- drivers/iommu/dmar.c | 45 +++++++++++++++++-------- drivers/leds/led-triggers.c | 10 +++--- drivers/net/can/dev.c | 2 +- drivers/net/team/team.c | 6 ++-- drivers/net/usb/qmi_wwan.c | 1 + drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 14 ++++---- drivers/net/wireless/mediatek/mt7601u/dma.c | 5 ++- drivers/soc/atmel/soc.c | 13 +++++++ drivers/xen/xenbus/xenbus_probe.c | 31 +++++++++++++++++ include/linux/intel-iommu.h | 2 ++ include/net/tcp.h | 2 +- net/ipv4/tcp_input.c | 10 +++--- net/ipv4/tcp_recovery.c | 5 +-- net/mac80211/ieee80211_i.h | 1 + net/mac80211/iface.c | 6 ++++ net/netfilter/nft_dynset.c | 4 ++- net/nfc/netlink.c | 1 + net/nfc/rawsock.c | 2 +- net/wireless/wext-core.c | 5 +-- net/xfrm/xfrm_input.c | 2 +- tools/testing/selftests/x86/test_syscall_vdso.c | 35 +++++++++++-------- 31 files changed, 181 insertions(+), 93 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/30 nbd: freeze the queue while were adding connections
From: Josef Bacik <[email protected]>
commit b98e762e3d71e893b221f871825dc64694cfb258 upstream.
When setting up a device, we can krealloc the config->socks array to add new sockets to the configuration. However if we happen to get a IO request in at this point even though we aren't setup we could hit a UAF, as we deref config->socks without any locking, assuming that the configuration was setup already and that ->socks is safe to access it as we have a reference on the configuration.
But there's nothing really preventing IO from occurring at this point of the device setup, we don't want to incur the overhead of a lock to access ->socks when it will never change while the device is running. To fix this UAF scenario simply freeze the queue if we are adding sockets. This will protect us from this particular case without adding any additional overhead for the normal running case.
--- drivers/block/nbd.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/block/nbd.c +8 -0
@@ -952,6 +952,12 @@ static int nbd_add_socket(struct nbd_devif (!sock)return err; +/* +* We need to make sure we don't get any errant requests while we're +* reallocating the ->socks array. +*/ +blk_mq_freeze_queue (nbd->disk->queue); +if (!netlink && !nbd->task_setup && !test_bit (NBD_BOUND , &config->runtime_flags)) nbd->task_setup = current;
@@ -990,10 +996,12 @@ static int nbd_add_socket(struct nbd_dev nsock->cookie =0 ; socks[config->num_connections++] = nsock;atomic_inc (&config->live_connections); +blk_mq_unfreeze_queue (nbd->disk->queue);return 0 ; put_socket: +blk_mq_unfreeze_queue (nbd->disk->queue);sockfd_put (sock);return err; }
Greg Kroah-Hartman
maintainerPATCH 2/30 ACPI: sysfs: Prefer "compatible" modalias
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit 36af2d5c4433fb40ee2af912c4ac0a30991aecfc upstream.
Commit 8765c5ba1949 ("ACPI / scan: Rework modalias creation when "compatible" is present") may create two "MODALIAS=" in one uevent file if specific conditions are met.
This breaks systemd-udevd, which assumes each "key" in one uevent file to be unique. The internal implementation of systemd-udevd overwrites the first MODALIAS with the second one, so its kmod rule doesn't load the driver for the first MODALIAS.
So if both the ACPI modalias and the OF modalias are present, use the latter to ensure that there will be only one MODALIAS.
--- drivers/acpi/device_sysfs.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/acpi/device_sysfs.c +6 -14
@@ -259,20 +259,12 @@ int __acpi_device_uevent_modalias(structif (add_uevent_var (env,"MODALIAS=" ))return -ENOMEM ; - len =create_pnp_modalias (adev, &env->buf[env->buflen -1 ], -sizeof (env->buf) - env->buflen); -if (len <0 ) -return len; - - env->buflen += len; -if (!adev->data.of_compatible) -return 0 ; - -if (len >0 &&add_uevent_var (env,"MODALIAS=" )) -return -ENOMEM ; - - len =create_of_modalias (adev, &env->buf[env->buflen -1 ], -sizeof (env->buf) - env->buflen); +if (adev->data.of_compatible) + len =create_of_modalias (adev, &env->buf[env->buflen -1 ], +sizeof (env->buf) - env->buflen); +else + len =create_pnp_modalias (adev, &env->buf[env->buflen -1 ], +sizeof (env->buf) - env->buflen);if (len <0 )return len;
Greg Kroah-Hartman
maintainerPATCH 3/30 ARM: dts: imx6qdl-gw52xx: fix duplicate regulator naming
In reply to Greg Kroah-HartmanFrom: Koen Vandeputte <[email protected]>
commit 5a22747b76ca2384057d8e783265404439d31d7f upstream.
2 regulator descriptions carry identical naming.
This leads to following boot warning:
[ 0.173138] debugfs: Directory 'vdd1p8' with parent 'regulator' already present!
Fix this by renaming the one used for audio.
--- arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl-gw52xx.dtsi +1 -1
@@ -278,7 +278,7 @@ /* VDD_AUD_1P8: Audio codec */ reg_aud_1p8v: ldo3 { - regulator-name = "vdd1p8"; + regulator-name = "vdd1p8a"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-boot-on;
Greg Kroah-Hartman
maintainerPATCH 4/30 wext: fix NULL-ptr-dereference with cfg80211s lack of commit()
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 5122565188bae59d507d90a9a9fd2fd6107f4439 upstream.
Since cfg80211 doesn't implement commit, we never really cared about that code there (and it's configured out w/o CONFIG_WIRELESS_EXT). After all, since it has no commit, it shouldn't return -EIWCOMMIT to indicate commit is needed.
However, EIWCOMMIT is actually an alias for EINPROGRESS, which _can_ happen if e.g. we try to change the frequency but we're already in the process of connecting to some network, and drivers could return that value (or even cfg80211 itself might).
This then causes us to crash because dev->wireless_handlers is NULL but we try to check dev->wireless_handlers->standard[0].
Fix this by also checking dev->wireless_handlers. Also simplify the code a little bit.
--- net/wireless/wext-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/wireless/wext-core.c +3 -2
@@ -898,8 +898,9 @@ out:int call_commit_handler (struct net_device *dev) {#ifdef CONFIG_WIRELESS_EXT -if ((netif_running (dev)) && - (dev->wireless_handlers->standard[0 ] !=NULL )) +if (netif_running (dev) && + dev->wireless_handlers && + dev->wireless_handlers->standard[0 ])/* Call the commit handler on the driver */ return dev->wireless_handlers->standard[0 ](dev,NULL ,NULL ,NULL );
Greg Kroah-Hartman
maintainerPATCH 5/30 net: usb: qmi_wwan: added support for Thales Cinterion PLSx3 modem family
In reply to Greg Kroah-HartmanFrom: Giacinto Cifelli <[email protected]>
commit 7e0e63d09516e96994c879f07c5a3c3269d7015e upstream.
Bus 003 Device 009: ID 1e2d:006f
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x1e2d
idProduct 0x006f
bcdDevice 0.00
iManufacturer 3 Cinterion Wireless Modules iProduct 2 PLSx3 iSerial 4 fa3c1419 bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 303
bNumInterfaces 9
bConfigurationValue 1
iConfiguration 1 Cinterion Configuration
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 1 AT-commands (v.25ter)
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
CDC Header:
bcdCDC 1.10
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Call Management:
bmCapabilities 0x03
call management
use DataInterface
bDataInterface 1
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 2
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 1 AT-commands (v.25ter)
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
CDC Header:
bcdCDC 1.10
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Call Management:
bmCapabilities 0x03
call management
use DataInterface
bDataInterface 3
CDC Union:
bMasterInterface 2
bSlaveInterface 3
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 4
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 1 AT-commands (v.25ter)
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 4
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
CDC Header:
bcdCDC 1.10
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Call Management:
bmCapabilities 0x03
call management
use DataInterface
bDataInterface 5
CDC Union:
bMasterInterface 4
bSlaveInterface 5
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 5
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 6
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 1 AT-commands (v.25ter)
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 6
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
CDC Header:
bcdCDC 1.10
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Call Management:
bmCapabilities 0x03
call management
use DataInterface
bDataInterface 7
CDC Union:
bMasterInterface 6
bSlaveInterface 7
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x87 EP 7 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 7
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x88 EP 8 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 8
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x89 EP 9 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x8a EP 10 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x05 EP 5 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1273,6 +1273,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x0b3c, 0xc00a, 6)}, /* Olivetti Olicard 160 */ {QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)}, /* Olivetti Olicard 500 */ {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ + {QMI_QUIRK_SET_DTR(0x1e2d, 0x006f, 8)}, /* Cinterion PLS83/PLS63 */ {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */ {QMI_FIXED_INTF(0x1e2d, 0x0063, 10)}, /* Cinterion ALASxx (1 RmNet) */ {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */
Greg Kroah-Hartman
maintainerPATCH 6/30 drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs
In reply to Greg Kroah-HartmanFrom: Sudeep Holla <[email protected]>
commit caab13b4960416b9fee83169a758eb0f31e65109 upstream.
Since at91_soc_init is called unconditionally from atmel_soc_device_init, we get the following warning on all non AT91 SoCs:
" AT91: Could not find identification node"
Fix the same by filtering with allowed AT91 SoC list.
--- drivers/soc/atmel/soc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/soc/atmel/soc.c +12 -0
@@ -246,8 +246,20 @@ struct soc_device * __init at91_soc_initreturn soc_dev; } +static const struct of_device_id at91_soc_allowed_list[]__initconst = { + { .compatible ="atmel,at91rm9200" , }, + { .compatible ="atmel,at91sam9" , }, + { .compatible ="atmel,sama5" , }, + { .compatible ="atmel,samv7" , } +}; +static int __init atmel_soc_device_init (void ) { +struct device_node *np =of_find_node_by_path ("/" ); + +if (!of_match_node (at91_soc_allowed_list, np)) +return 0 ; +at91_soc_init (socs);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 7/30 drivers: soc: atmel: add null entry at the end of at91_soc_allowed_list[]
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
commit 680896556805d3ad3fa47f6002b87b3041a45ac2 upstream.
of_match_node() calls __of_match_node() which loops though the entries of matches array. It stops when condition:
(matches->name[0] || matches->type[0] || matches->compatible[0]) is false. Thus, add a null entry at the end of at91_soc_allowed_list[] array.
--- drivers/soc/atmel/soc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/atmel/soc.c +2 -1
@@ -250,7 +250,8 @@ static const struct of_device_id at91_so { .compatible = "atmel,at91rm9200", }, { .compatible = "atmel,at91sam9", }, { .compatible = "atmel,sama5", }, - { .compatible = "atmel,samv7", } + { .compatible = "atmel,samv7", }, + { } }; static int __init atmel_soc_device_init(void)
Greg Kroah-Hartman
maintainerPATCH 8/30 KVM: x86/pmu: Fix HW_REF_CPU_CYCLES event pseudo-encoding in intel_arch_events[]
In reply to Greg Kroah-HartmanFrom: Like Xu <[email protected]>
commit 98dd2f108e448988d91e296173e773b06fb978b8 upstream.
The HW_REF_CPU_CYCLES event on the fixed counter 2 is pseudo-encoded as 0x0300 in the intel_perfmon_event_map[]. Correct its usage.
Message-Id: <[email protected]>
--- arch/x86/kvm/pmu_intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/pmu_intel.c +1 -1
@@ -29,7 +29,7 @@ static struct kvm_event_hw_type_mapping [4] = { 0x2e, 0x41, PERF_COUNT_HW_CACHE_MISSES }, [5] = { 0xc4, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, [6] = { 0xc5, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, - [7] = { 0x00, 0x30, PERF_COUNT_HW_REF_CPU_CYCLES }, + [7] = { 0x00, 0x03, PERF_COUNT_HW_REF_CPU_CYCLES }, };/* mapping between fixed pmc index and intel_arch_events array */
Greg Kroah-Hartman
maintainerPATCH 9/30 KVM: x86: get smi pending status correctly
In reply to Greg Kroah-HartmanFrom: Jay Zhou <[email protected]>
commit 1f7becf1b7e21794fc9d460765fe09679bc9b9e0 upstream.
The injection process of smi has two steps:
Qemu KVM
Step1:
cpu->interrupt_request &= \
~CPU_INTERRUPT_SMI;
kvm_vcpu_ioctl(cpu, KVM_SMI)
call kvm_vcpu_ioctl_smi() and
kvm_make_request(KVM_REQ_SMI, vcpu);Step2:
kvm_vcpu_ioctl(cpu, KVM_RUN, 0)
call process_smi() if kvm_check_request(KVM_REQ_SMI, vcpu) is true, mark vcpu->arch.smi_pending = true;
The vcpu->arch.smi_pending will be set true in step2, unfortunately if vcpu paused between step1 and step2, the kvm_run->immediate_exit will be set and vcpu has to exit to Qemu immediately during step2 before mark vcpu->arch.smi_pending true.
During VM migration, Qemu will get the smi pending status from KVM using KVM_GET_VCPU_EVENTS ioctl at the downtime, then the smi pending status will be lost.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kvm/x86.c +5 -0
@@ -98,6 +98,7 @@ static u64 __read_mostly efer_reserved_bstatic void update_cr8_intercept (struct kvm_vcpu *vcpu);static void process_nmi (struct kvm_vcpu *vcpu); +static void process_smi (struct kvm_vcpu *vcpu);static void enter_smm (struct kvm_vcpu *vcpu);static void __kvm_set_rflags (struct kvm_vcpu *vcpu,unsigned long rflags);
@@ -3290,6 +3291,10 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_ struct kvm_vcpu_events *events) {process_nmi (vcpu); + +if (kvm_check_request (KVM_REQ_SMI , vcpu)) +process_smi (vcpu); +/* * FIXME: pass injected and pending separately. This is only * needed for nested virtualization, whose state cannot be
Greg Kroah-Hartman
maintainerPATCH 10/30 xen: Fix XenStore initialisation for XS_LOCAL
In reply to Greg Kroah-HartmanFrom: David Woodhouse <[email protected]>
commit 5f46400f7a6a4fad635d5a79e2aa5a04a30ffea1 upstream.
In commit 3499ba8198ca ("xen: Fix event channel callback via INTX/GSI") I reworked the triggering of xenbus_probe().
I tried to simplify things by taking out the workqueue based startup triggered from wake_waiting(); the somewhat poorly named xenbus IRQ handler.
I missed the fact that in the XS_LOCAL case (Dom0 starting its own xenstored or xenstore-stubdom, which happens after the kernel is booted completely), that IRQ-based trigger is still actually needed.
So... put it back, except more cleanly. By just spawning a xenbus_probe thread which waits on xb_waitq and runs the probe the first time it gets woken, just as the workqueue-based hack did.
This is actually a nicer approach for *all* the back ends with different interrupt methods, and we can switch them all over to that without the complex conditions for when to trigger it. But not in -rc6. This is the minimal fix for the regression, although it's a step in the right direction instead of doing a partial revert and actually putting the workqueue back. It's also simpler than the workqueue.
--- drivers/xen/xenbus/xenbus_probe.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/xen/xenbus/xenbus_probe.c +31 -0
@@ -705,6 +705,23 @@ static bool xs_hvm_defer_init_for_callba#endif } +static int xenbus_probe_thread (void *unused) +{ +DEFINE_WAIT (w); + +/* +* We actually just want to wait for *any* trigger of xb_waitq, +* and run xenbus_probe() the moment it occurs. +*/ +prepare_to_wait (&xb_waitq, &w,TASK_INTERRUPTIBLE ); +schedule (); +finish_wait (&xb_waitq, &w); + +DPRINTK ("probing" ); +xenbus_probe (); +return 0 ; +} +static int __init xenbus_probe_initcall (void ) {/*
@@ -716,6 +733,20 @@ static int __init xenbus_probe_initcall( !xs_hvm_defer_init_for_callback()))xenbus_probe (); +/* +* For XS_LOCAL, spawn a thread which will wait for xenstored +* or a xenstore-stubdom to be started, then probe. It will be +* triggered when communication starts happening, by waiting +* on xb_waitq. +*/ +if (xen_store_domain_type ==XS_LOCAL ) { +struct task_struct *probe_task; + + probe_task =kthread_run (xenbus_probe_thread,NULL , +"xenbus_probe" ); +if (IS_ERR (probe_task)) +return PTR_ERR (probe_task); + }return 0 ; }device_initcall (xenbus_probe_initcall);
Greg Kroah-Hartman
maintainerPATCH 11/30 leds: trigger: fix potential deadlock with libata
In reply to Greg Kroah-HartmanFrom: Andrea Righi <[email protected]>
commit 27af8e2c90fba242460b01fa020e6e19ed68c495 upstream.
We have the following potential deadlock condition:
========================================================
WARNING: possible irq lock inversion dependency detected 5.10.0-rc2+ #25 Not tainted
--------------------------------------------------------
swapper/3/0 just changed the state of lock:
ffff8880063bd618 (&host->lock){-...}-{2:2}, at: ata_bmdma_interrupt+0x27/0x200 but this lock took another, HARDIRQ-READ-unsafe lock in the past:
(&trig->leddev_list_lock){.+.?}-{2:2}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&trig->leddev_list_lock);
local_irq_disable();
lock(&host->lock);
lock(&trig->leddev_list_lock);
<Interrupt>
lock(&host->lock);*** DEADLOCK ***
no locks held by swapper/3/0.
the shortest dependencies between 2nd lock and 1st lock:
-> (&trig->leddev_list_lock){.+.?}-{2:2} ops: 46 {
HARDIRQ-ON-R at:
lock_acquire+0x15f/0x420
_raw_read_lock+0x42/0x90
led_trigger_event+0x2b/0x70
rfkill_global_led_trigger_worker+0x94/0xb0
process_one_work+0x240/0x560
worker_thread+0x58/0x3d0
kthread+0x151/0x170
ret_from_fork+0x1f/0x30
IN-SOFTIRQ-R at:
lock_acquire+0x15f/0x420
_raw_read_lock+0x42/0x90
led_trigger_event+0x2b/0x70
kbd_bh+0x9e/0xc0
tasklet_action_common.constprop.0+0xe9/0x100
tasklet_action+0x22/0x30
__do_softirq+0xcc/0x46d
run_ksoftirqd+0x3f/0x70
smpboot_thread_fn+0x116/0x1f0
kthread+0x151/0x170
ret_from_fork+0x1f/0x30
SOFTIRQ-ON-R at:
lock_acquire+0x15f/0x420
_raw_read_lock+0x42/0x90
led_trigger_event+0x2b/0x70
rfkill_global_led_trigger_worker+0x94/0xb0
process_one_work+0x240/0x560
worker_thread+0x58/0x3d0
kthread+0x151/0x170
ret_from_fork+0x1f/0x30
INITIAL READ USE at:
lock_acquire+0x15f/0x420
_raw_read_lock+0x42/0x90
led_trigger_event+0x2b/0x70
rfkill_global_led_trigger_worker+0x94/0xb0
process_one_work+0x240/0x560
worker_thread+0x58/0x3d0
kthread+0x151/0x170
ret_from_fork+0x1f/0x30
}
... key at: [<ffffffff83da4c00>] __key.0+0x0/0x10
... acquired at:
_raw_read_lock+0x42/0x90
led_trigger_blink_oneshot+0x3b/0x90
ledtrig_disk_activity+0x3c/0xa0
ata_qc_complete+0x26/0x450
ata_do_link_abort+0xa3/0xe0
ata_port_freeze+0x2e/0x40
ata_hsm_qc_complete+0x94/0xa0
ata_sff_hsm_move+0x177/0x7a0
ata_sff_pio_task+0xc7/0x1b0
process_one_work+0x240/0x560
worker_thread+0x58/0x3d0
kthread+0x151/0x170
ret_from_fork+0x1f/0x30 -> (&host->lock){-...}-{2:2} ops: 69 {
IN-HARDIRQ-W at:
lock_acquire+0x15f/0x420
_raw_spin_lock_irqsave+0x52/0xa0
ata_bmdma_interrupt+0x27/0x200
__handle_irq_event_percpu+0xd5/0x2b0
handle_irq_event+0x57/0xb0
handle_edge_irq+0x8c/0x230
asm_call_irq_on_stack+0xf/0x20
common_interrupt+0x100/0x1c0
asm_common_interrupt+0x1e/0x40
native_safe_halt+0xe/0x10
arch_cpu_idle+0x15/0x20
default_idle_call+0x59/0x1c0
do_idle+0x22c/0x2c0
cpu_startup_entry+0x20/0x30
start_secondary+0x11d/0x150
secondary_startup_64_no_verify+0xa6/0xab
INITIAL USE at:
lock_acquire+0x15f/0x420
_raw_spin_lock_irqsave+0x52/0xa0
ata_dev_init+0x54/0xe0
ata_link_init+0x8b/0xd0
ata_port_alloc+0x1f1/0x210
ata_host_alloc+0xf1/0x130
ata_host_alloc_pinfo+0x14/0xb0
ata_pci_sff_prepare_host+0x41/0xa0
ata_pci_bmdma_prepare_host+0x14/0x30
piix_init_one+0x21f/0x600
local_pci_probe+0x48/0x80
pci_device_probe+0x105/0x1c0
really_probe+0x221/0x490
driver_probe_device+0xe9/0x160
device_driver_attach+0xb2/0xc0
__driver_attach+0x91/0x150
bus_for_each_dev+0x81/0xc0
driver_attach+0x1e/0x20
bus_add_driver+0x138/0x1f0
driver_register+0x91/0xf0
__pci_register_driver+0x73/0x80
piix_init+0x1e/0x2e
do_one_initcall+0x5f/0x2d0
kernel_init_freeable+0x26f/0x2cf
kernel_init+0xe/0x113
ret_from_fork+0x1f/0x30
}
... key at: [<ffffffff83d9fdc0>] __key.6+0x0/0x10
... acquired at:
__lock_acquire+0x9da/0x2370
lock_acquire+0x15f/0x420
_raw_spin_lock_irqsave+0x52/0xa0
ata_bmdma_interrupt+0x27/0x200
__handle_irq_event_percpu+0xd5/0x2b0
handle_irq_event+0x57/0xb0
handle_edge_irq+0x8c/0x230
asm_call_irq_on_stack+0xf/0x20
common_interrupt+0x100/0x1c0
asm_common_interrupt+0x1e/0x40
native_safe_halt+0xe/0x10
arch_cpu_idle+0x15/0x20
default_idle_call+0x59/0x1c0
do_idle+0x22c/0x2c0
cpu_startup_entry+0x20/0x30
start_secondary+0x11d/0x150
secondary_startup_64_no_verify+0xa6/0xabThis lockdep splat is reported after:
commit e918188611f0 ("locking: More accurate annotations for read_lock()")
To clarify:
- read-locks are recursive only in interrupt context (when in_interrupt() returns true)
- after acquiring host->lock in CPU1, another cpu (i.e. CPU2) may call write_lock(&trig->leddev_list_lock) that would be blocked by CPU0 that holds trig->leddev_list_lock in read-mode
- when CPU1 (ata_ac_complete()) tries to read-lock trig->leddev_list_lock, it would be blocked by the write-lock waiter on CPU2 (because we are not in interrupt context, so the read-lock is not recursive)
- at this point if an interrupt happens on CPU0 and ata_bmdma_interrupt() is executed it will try to acquire host->lock, that is held by CPU1, that is currently blocked by CPU2, so:
* CPU0 blocked by CPU1
* CPU1 blocked by CPU2
* CPU2 blocked by CPU0
*** DEADLOCK ***
The deadlock scenario is better represented by the following schema (thanks to Boqun Feng <[email protected]> for the schema and the detailed explanation of the deadlock condition):
CPU 0: CPU 1: CPU 2:
----- ----- -----
led_trigger_event():
read_lock(&trig->leddev_list_lock);
<workqueue>
ata_hsm_qc_complete():
spin_lock_irqsave(&host->lock);
write_lock(&trig->leddev_list_lock);
ata_port_freeze():
ata_do_link_abort():
ata_qc_complete():
ledtrig_disk_activity():
led_trigger_blink_oneshot():
read_lock(&trig->leddev_list_lock);
// ^ not in in_interrupt() context, so could get blocked by CPU 2
<interrupt>
ata_bmdma_interrupt():
spin_lock_irqsave(&host->lock);Fix by using read_lock_irqsave/irqrestore() in led_trigger_event(), so that no interrupt can happen in between, preventing the deadlock condition.
Apply the same change to led_trigger_blink_setup() as well, since the same deadlock scenario can also happen in power_supply_update_bat_leds() -> led_trigger_blink() -> led_trigger_blink_setup() (workqueue context), and potentially prevent other similar usages.
--- drivers/leds/led-triggers.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/leds/led-triggers.c +6 -4
@@ -283,14 +283,15 @@ void led_trigger_event(struct led_trigge enum led_brightness brightness) {struct led_classdev *led_cdev; +unsigned long flags;if (!trig)return ; -read_lock (&trig->leddev_list_lock); +read_lock_irqsave (&trig->leddev_list_lock, flags);list_for_each_entry (led_cdev, &trig->led_cdevs, trig_list)led_set_brightness (led_cdev, brightness); -read_unlock (&trig->leddev_list_lock); +read_unlock_irqrestore (&trig->leddev_list_lock, flags); }EXPORT_SYMBOL_GPL (led_trigger_event);
@@ -301,11 +302,12 @@ static void led_trigger_blink_setup(stru int invert) {struct led_classdev *led_cdev; +unsigned long flags;if (!trig)return ; -read_lock (&trig->leddev_list_lock); +read_lock_irqsave (&trig->leddev_list_lock, flags);list_for_each_entry (led_cdev, &trig->led_cdevs, trig_list) {if (oneshot) led_blink_set_oneshot(led_cdev, delay_on, delay_off,
@@ -313,7 +315,7 @@ static void led_trigger_blink_setup(struelse led_blink_set (led_cdev, delay_on, delay_off); } -read_unlock (&trig->leddev_list_lock); +read_unlock_irqrestore (&trig->leddev_list_lock, flags); } void led_trigger_blink(struct led_trigger *trig,
Greg Kroah-Hartman
maintainerPATCH 12/30 mt7601u: fix kernel crash unplugging the device
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
commit 0acb20a5438c36e0cf2b8bf255f314b59fcca6ef upstream.
The following crash log can occur unplugging the usb dongle since, after the urb poison in mt7601u_free_tx_queue(), usb_submit_urb() will always fail resulting in a skb kfree while the skb has been already queued.
Fix the issue enqueuing the skb only if usb_submit_urb() succeed.
Hardware name: Hewlett-Packard 500-539ng/2B2C, BIOS 80.06 04/01/2015 Workqueue: usb_hub_wq hub_event RIP: 0010:skb_trim+0x2c/0x30 RSP: 0000:ffffb4c88005bba8 EFLAGS: 00010206 RAX: 000000004ad483ee RBX: ffff9a236625dee0 RCX: 000000000000662f RDX: 000000000000000c RSI: 0000000000000000 RDI: ffff9a2343179300 RBP: ffff9a2343179300 R08: 0000000000000001 R09: 0000000000000000 R10: ffff9a23748f7840 R11: 0000000000000001 R12: ffff9a236625e4d4 R13: ffff9a236625dee0 R14: 0000000000001080 R15: 0000000000000008 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fd410a34ef8 CR3: 00000001416ee001 CR4: 00000000001706f0 Call Trace: mt7601u_tx_status+0x3e/0xa0 [mt7601u] mt7601u_dma_cleanup+0xca/0x110 [mt7601u] mt7601u_cleanup+0x22/0x30 [mt7601u] mt7601u_disconnect+0x22/0x60 [mt7601u] usb_unbind_interface+0x8a/0x270 ? kernfs_find_ns+0x35/0xd0 __device_release_driver+0x17a/0x230 device_release_driver+0x24/0x30 bus_remove_device+0xdb/0x140 device_del+0x18b/0x430 ? kobject_put+0x98/0x1d0 usb_disable_device+0xc6/0x1f0 usb_disconnect.cold+0x7e/0x20a hub_event+0xbf3/0x1870 process_one_work+0x1b6/0x350 worker_thread+0x53/0x3e0 ? process_one_work+0x350/0x350 kthread+0x11b/0x140 ? __kthread_bind_mask+0x60/0x60 ret_from_fork+0x22/0x30
--- drivers/net/wireless/mediatek/mt7601u/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt7601u/dma.c +1 -1
@@ -318,7 +318,6 @@ static int mt7601u_dma_submit_tx(struct } e = &q->e[q->end]; - e->skb = skb;usb_fill_bulk_urb (e->urb, usb_dev, snd_pipe, skb->data, skb->len, mt7601u_complete_tx, q); ret =usb_submit_urb (e->urb,GFP_ATOMIC );
@@ -336,6 +335,7 @@ static int mt7601u_dma_submit_tx(struct q->end = (q->end +1 ) % q->entries; q->used++; + e->skb = skb;if (q->used >= q->entries)ieee80211_stop_queue (dev->hw,skb_get_queue_mapping (skb));
Greg Kroah-Hartman
maintainerPATCH 13/30 mt7601u: fix rx buffer refcounting
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
commit d24c790577ef01bfa01da2b131313a38c843a634 upstream.
Fix the following crash due to erroneous page refcounting:
[ 32.445919] BUG: Bad page state in process swapper/1 pfn:11f65a [ 32.447409] page:00000000938f0632 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x11f65a [ 32.449605] flags: 0x8000000000000000() [ 32.450421] raw: 8000000000000000 ffffffff825b0148 ffffea00045ae988 0000000000000000 [ 32.451795] raw: 0000000000000000 0000000000000001 00000000ffffff7f 0000000000000000 [ 32.452999] page dumped because: nonzero mapcount [ 32.453888] Modules linked in: [ 32.454492] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.11.0-rc2+ #1976 [ 32.455695] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-1.fc33 04/01/2014 [ 32.457157] Call Trace: [ 32.457636] <IRQ> [ 32.457993] dump_stack+0x77/0x97 [ 32.458576] bad_page.cold+0x65/0x96 [ 32.459198] get_page_from_freelist+0x46a/0x11f0 [ 32.460008] __alloc_pages_nodemask+0x10a/0x2b0 [ 32.460794] mt7601u_rx_tasklet+0x651/0x720 [ 32.461505] tasklet_action_common.constprop.0+0x6b/0xd0 [ 32.462343] __do_softirq+0x152/0x46c [ 32.462928] asm_call_irq_on_stack+0x12/0x20 [ 32.463610] </IRQ> [ 32.463953] do_softirq_own_stack+0x5b/0x70 [ 32.464582] irq_exit_rcu+0x9f/0xe0 [ 32.465028] common_interrupt+0xae/0x1a0 [ 32.465536] asm_common_interrupt+0x1e/0x40 [ 32.466071] RIP: 0010:default_idle+0x18/0x20 [ 32.468981] RSP: 0018:ffffc90000077f00 EFLAGS: 00000246 [ 32.469648] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000 [ 32.470550] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81aac3dd [ 32.471463] RBP: ffff88810022ab00 R08: 0000000000000001 R09: 0000000000000001 [ 32.472335] R10: 0000000000000046 R11: 0000000000005aa0 R12: 0000000000000000 [ 32.473235] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 32.474139] ? default_idle_call+0x4d/0x200 [ 32.474681] default_idle_call+0x74/0x200 [ 32.475192] do_idle+0x1d5/0x250 [ 32.475612] cpu_startup_entry+0x19/0x20 [ 32.476114] secondary_startup_64_no_verify+0xb0/0xbb [ 32.476765] Disabling lock debugging due to kernel taint
--- drivers/net/wireless/mediatek/mt7601u/dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt7601u/dma.c +1 -2
@@ -160,8 +160,7 @@ mt7601u_rx_process_entry(struct mt7601u_if (new_p) {/* we have one extra ref from the allocator */ -__free_pages (e->p,MT_RX_ORDER ); - +put_page (e->p); e->p = new_p; } }
Greg Kroah-Hartman
maintainerPATCH 14/30 xen-blkfront: allow discard-* nodes to be optional
In reply to Greg Kroah-HartmanFrom: Roger Pau Monne <[email protected]>
commit 0549cd67b01016b579047bce045b386202a8bcfc upstream.
This is inline with the specification described in blkif.h:
* discard-granularity: should be set to the physical block size if node is not present.
* discard-alignment, discard-secure: should be set to 0 if node not present.
This was detected as QEMU would only create the discard-granularity node but not discard-alignment, and thus the setup done in blkfront_setup_discard would fail.
Fix blkfront_setup_discard to not fail on missing nodes, and also fix blkif_set_queue_limits to set the discard granularity to the physical block size if none is specified in xenbus.
--- drivers/block/xen-blkfront.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/block/xen-blkfront.c +7 -13
@@ -937,7 +937,8 @@ static void blkif_set_queue_limits(strucif (info->feature_discard) {queue_flag_set_unlocked (QUEUE_FLAG_DISCARD , rq);blk_queue_max_discard_sectors (rq,get_capacity (gd)); - rq->limits.discard_granularity = info->discard_granularity; + rq->limits.discard_granularity = info->discard_granularity ?: + info->physical_sector_size; rq->limits.discard_alignment = info->discard_alignment;if (info->feature_secdiscard)queue_flag_set_unlocked (QUEUE_FLAG_SECERASE , rq);
@@ -2155,19 +2156,12 @@ static void blkfront_closing(struct blkfstatic void blkfront_setup_discard (struct blkfront_info *info) { -int err; -unsigned int discard_granularity; -unsigned int discard_alignment; - info->feature_discard =1 ; - err =xenbus_gather (XBT_NIL , info->xbdev->otherend, -"discard-granularity" ,"%u" , &discard_granularity, -"discard-alignment" ,"%u" , &discard_alignment, -NULL ); -if (!err) { - info->discard_granularity = discard_granularity; - info->discard_alignment = discard_alignment; - } + info->discard_granularity =xenbus_read_unsigned (info->xbdev->otherend, +"discard-granularity" , +0 ); + info->discard_alignment =xenbus_read_unsigned (info->xbdev->otherend, +"discard-alignment" ,0 ); info->feature_secdiscard = !!xenbus_read_unsigned (info->xbdev->otherend,"discard-secure" ,0 );
Greg Kroah-Hartman
maintainerPATCH 15/30 ARM: imx: build suspend-imx6.S with arm instruction set
In reply to Greg Kroah-HartmanFrom: Max Krummenacher <[email protected]>
commit a88afa46b86ff461c89cc33fc3a45267fff053e8 upstream.
When the kernel is configured to use the Thumb-2 instruction set "suspend-to-memory" fails to resume. Observed on a Colibri iMX6ULL (i.MX 6ULL) and Apalis iMX6 (i.MX 6Q).
It looks like the CPU resumes unconditionally in ARM instruction mode and then chokes on the presented Thumb-2 code it should execute.
Fix this by using the arm instruction set for all code in suspend-imx6.S.
--- arch/arm/mach-imx/suspend-imx6.S | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-imx/suspend-imx6.S +1 -0
@@ -73,6 +73,7 @@ #define MX6Q_CCM_CCR 0x0 .align 3 + .arm .macro sync_l2_cache
Greg Kroah-Hartman
maintainerPATCH 16/30 netfilter: nft_dynset: add timeout extension to template
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 0c5b7a501e7400869ee905b4f7af3d6717802bcb upstream.
Otherwise, the newly create element shows no timeout when listing the ruleset. If the set definition does not specify a default timeout, then the set element only shows the expiration time, but not the timeout. This is a problem when restoring a stateful ruleset listing since it skips the timeout policy entirely.
--- net/netfilter/nft_dynset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/nft_dynset.c +3 -1
@@ -205,8 +205,10 @@ static int nft_dynset_init(const structnft_set_ext_add_length (&priv->tmpl,NFT_SET_EXT_EXPR , priv->expr->ops->size);if (set->flags &NFT_SET_TIMEOUT ) { -if (timeout || set->timeout) +if (timeout || set->timeout) { +nft_set_ext_add (&priv->tmpl,NFT_SET_EXT_TIMEOUT );nft_set_ext_add (&priv->tmpl,NFT_SET_EXT_EXPIRATION ); + } } priv->timeout = timeout;
Greg Kroah-Hartman
maintainerPATCH 17/30 xfrm: Fix oops in xfrm_replay_advance_bmp
In reply to Greg Kroah-HartmanFrom: Shmulik Ladkani <[email protected]>
[ Upstream commit 56ce7c25ae1525d83cf80a880cf506ead1914250 ]
When setting xfrm replay_window to values higher than 32, a rare page-fault occurs in xfrm_replay_advance_bmp:
BUG: unable to handle page fault for address: ffff8af350ad7920 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD ad001067 P4D ad001067 PUD 0 Oops: 0002 [#1] SMP PTI CPU: 3 PID: 30 Comm: ksoftirqd/3 Kdump: loaded Not tainted 5.4.52-050452-generic #202007160732 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014 RIP: 0010:xfrm_replay_advance_bmp+0xbb/0x130 RSP: 0018:ffffa1304013ba40 EFLAGS: 00010206 RAX: 000000000000010d RBX: 0000000000000002 RCX: 00000000ffffff4b RDX: 0000000000000018 RSI: 00000000004c234c RDI: 00000000ffb3dbff RBP: ffffa1304013ba50 R08: ffff8af330ad7920 R09: 0000000007fffffa R10: 0000000000000800 R11: 0000000000000010 R12: ffff8af29d6258c0 R13: ffff8af28b95c700 R14: 0000000000000000 R15: ffff8af29d6258fc FS: 0000000000000000(0000) GS:ffff8af339ac0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff8af350ad7920 CR3: 0000000015ee4000 CR4: 00000000001406e0 Call Trace: xfrm_input+0x4e5/0xa10 xfrm4_rcv_encap+0xb5/0xe0 xfrm4_udp_encap_rcv+0x140/0x1c0
Analysis revealed offending code is when accessing:
replay_esn->bmp[nr] |= (1U << bitnr);
with 'nr' being 0x07fffffa.
This happened in an SMP system when reordering of packets was present; A packet arrived with a "too old" sequence number (outside the window, i.e 'diff > replay_window'), and therefore the following calculation:
bitnr = replay_esn->replay_window - (diff - pos);
yields a negative result, but since bitnr is u32 we get a large unsigned quantity (in crash dump above: 0xffffff4b seen in ecx).
This was supposed to be protected by xfrm_input()'s former call to:
if (x->repl->check(x, skb, seq)) {However, the state's spinlock x->lock is *released* after '->check()' is performed, and gets re-acquired before '->advance()' - which gives a chance for a different core to update the xfrm state, e.g. by advancing 'replay_esn->seq' when it encounters more packets - leading to a 'diff > replay_window' situation when original core continues to xfrm_replay_advance_bmp().
An attempt to fix this issue was suggested in commit bcf66bf54aab ("xfrm: Perform a replay check after return from async codepaths"), by calling 'x->repl->recheck()' after lock is re-acquired, but fix applied only to asyncronous crypto algorithms.
Augment the fix, by *always* calling 'recheck()' - irrespective if we're using async crypto.
--- net/xfrm/xfrm_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_input.c +1 -1
@@ -415,7 +415,7 @@ resume:/* only the first xfrm gets the encap type */ encap_type =0 ; -if (async && x->repl->recheck (x, skb, seq)) { +if (x->repl->recheck (x, skb, seq)) {XFRM_INC_STATS (net,LINUX_MIB_XFRMINSTATESEQERROR ); goto drop_unlock; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 18/30 RDMA/cxgb4: Fix the reported max_recv_sge value
In reply to Greg Kroah-HartmanFrom: Kamal Heib <[email protected]>
[ Upstream commit a372173bf314d374da4dd1155549d8ca7fc44709 ]
The max_recv_sge value is wrongly reported when calling query_qp, This is happening due to a typo when assigning the max_recv_sge value, the value of sq_max_sges was assigned instead of rq_max_sges.
--- drivers/infiniband/hw/cxgb4/qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/cxgb4/qp.c +1 -1
@@ -2117,7 +2117,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; init_attr->cap.max_send_sge = qhp->attr.sq_max_sges; - init_attr->cap.max_recv_sge = qhp->attr.sq_max_sges; + init_attr->cap.max_recv_sge = qhp->attr.rq_max_sges; init_attr->cap.max_inline_data =T4_MAX_SEND_INLINE ; init_attr->sq_sig_type = qhp->sq_sig_all ?IB_SIGNAL_ALL_WR :0 ;return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 19/30 iwlwifi: pcie: use jiffies for memory read spin time limit
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 6701317476bbfb1f341aa935ddf75eb73af784f9 ]
There's no reason to use ktime_get() since we don't need any better precision than jiffies, and since we no longer disable interrupts around this code (when grabbing NIC access), jiffies will work fine. Use jiffies instead of ktime_get().
This cleanup is preparation for the following patch "iwlwifi: pcie: reschedule in long-running memory reads". The code gets simpler with the weird clock use etc. removed before we add cond_resched().
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +2 -6
@@ -1932,7 +1932,7 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr,while (offs < dwords) {/* limit the time we spin here under lock to 1/2s */ -ktime_t timeout =ktime_add_us (ktime_get (),500 *USEC_PER_MSEC ); +unsigned long end = jiffies +HZ /2 ;if (iwl_trans_grab_nic_access (trans, &flags)) { iwl_write32(trans, HBUS_TARG_MEM_RADDR,
@@ -1943,11 +1943,7 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr, HBUS_TARG_MEM_RDAT); offs++; -/* calling ktime_get is expensive so -* do it once in 128 reads -*/ -if (offs %128 ==0 &&ktime_after (ktime_get (), - timeout)) +if (time_after (jiffies, end))break ; }iwl_trans_release_nic_access (trans, &flags);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 20/30 iwlwifi: pcie: reschedule in long-running memory reads
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 3d372c4edfd4dffb7dea71c6b096fb414782b776 ]
If we spin for a long time in memory reads that (for some reason in hardware) take a long time, then we'll eventually get messages such as
watchdog: BUG: soft lockup - CPU#2 stuck for 24s! [kworker/2:2:272]
This is because the reading really does take a very long time, and we don't schedule, so we're hogging the CPU with this task, at least if CONFIG_PREEMPT is not set, e.g. with CONFIG_PREEMPT_VOLUNTARY=y.
Previously I misinterpreted the situation and thought that this was only going to happen if we had interrupts disabled, and then fixed this (which is good anyway, however), but that didn't always help; looking at it again now I realized that the spin unlock will only reschedule if CONFIG_PREEMPT is used.
In order to avoid this issue, change the code to cond_resched() if we've been spinning for too long here.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +7 -1
@@ -1933,6 +1933,7 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr,while (offs < dwords) {/* limit the time we spin here under lock to 1/2s */ unsigned long end = jiffies +HZ /2 ; +bool resched = false;if (iwl_trans_grab_nic_access (trans, &flags)) { iwl_write32(trans, HBUS_TARG_MEM_RADDR,
@@ -1943,10 +1944,15 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr, HBUS_TARG_MEM_RDAT); offs++; -if (time_after (jiffies, end)) +if (time_after (jiffies, end)) { + resched = true;break ; + } }iwl_trans_release_nic_access (trans, &flags); + +if (resched) +cond_resched (); }else {return -EBUSY ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 21/30 mac80211: pause TX while changing interface type
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 054c9939b4800a91475d8d89905827bf9e1ad97a ]
syzbot reported a crash that happened when changing the interface type around a lot, and while it might have been easy to fix just the symptom there, a little deeper investigation found that really the reason is that we allowed packets to be transmitted while in the middle of changing the interface type.
Disallow TX by stopping the queues while changing the type.
--- net/mac80211/ieee80211_i.h | 1 + net/mac80211/iface.c | 6 ++++++ 2 files changed, 7 insertions(+)
net/mac80211/ieee80211_i.h +1 -0
@@ -1047,6 +1047,7 @@ enum queue_stop_reason {IEEE80211_QUEUE_STOP_REASON_FLUSH ,IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN ,IEEE80211_QUEUE_STOP_REASON_RESERVE_TID , +IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE , IEEE80211_QUEUE_STOP_REASONS, };
net/mac80211/iface.c +6 -0
@@ -1559,6 +1559,10 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,if (ret)return ret; +ieee80211_stop_vif_queues (local, sdata, +IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE ); +synchronize_net (); +ieee80211_do_stop (sdata, false);ieee80211_teardown_sdata (sdata);
@@ -1579,6 +1583,8 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, err =ieee80211_do_open (&sdata->wdev, false);WARN (err,"type change: do_open returned %d" , err); +ieee80211_wake_vif_queues (local, sdata, +IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE );return ret; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 22/30 can: dev: prevent potential information leak in can_fill_info()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b552766c872f5b0d90323b24e4c9e8fa67486dd5 ]
The "bec" struct isn't necessarily always initialized. For example, the mcp251xfd_get_berr_counter() function doesn't initialize anything if the interface is down.
--- drivers/net/can/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/dev.c +1 -1
@@ -1102,7 +1102,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) {struct can_priv *priv =netdev_priv (dev);struct can_ctrlmode cm = {.flags = priv->ctrlmode}; -struct can_berr_counter bec; +struct can_berr_counter bec = { };enum can_state state = priv->state;if (priv->do_get_state)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 23/30 x86/entry/64/compat: Preserve r8-r11 in int $0x80
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit 8bb2610bc4967f19672444a7b0407367f1540028 upstream.
32-bit user code that uses int $80 doesn't care about r8-r11. There is, however, some 64-bit user code that intentionally uses int $0x80 to invoke 32-bit system calls. From what I've seen, basically all such code assumes that r8-r15 are all preserved, but the kernel clobbers r8-r11. Since I doubt that there's any code that depends on int $0x80 zeroing r8-r11, change the kernel to preserve them.
I suspect that very little user code is broken by the old clobber, since r8-r11 are only rarely allocated by gcc, and they're clobbered by function calls, so they only way we'd see a problem is if the same function that invokes int $0x80 also spills something important to one of these registers.
The current behavior seems to date back to the historical commit "[PATCH] x86-64 merge for 2.6.4". Before that, all regs were preserved. I can't find any explanation of why this change was made.
Update the test_syscall_vdso_32 testcase as well to verify the new behavior, and it strengthens the test to make sure that the kernel doesn't accidentally permute r8..r15.
--- arch/x86/entry/entry_64_compat.S | 8 ++--- tools/testing/selftests/x86/test_syscall_vdso.c | 35 ++++++++++++++---------- 2 files changed, 25 insertions(+), 18 deletions(-)
arch/x86/entry/entry_64_compat.S +4 -4
@@ -84,13 +84,13 @@ ENTRY(entry_SYSENTER_compat) pushq %rdx /* pt_regs->dx */ pushq %rcx /* pt_regs->cx */ pushq $-ENOSYS /* pt_regs->ax */ - pushq $0 /* pt_regs->r8 = 0 */ + pushq %r8 /* pt_regs->r8 */ xorl %r8d, %r8d /* nospec r8 */ - pushq $0 /* pt_regs->r9 = 0 */ + pushq %r9 /* pt_regs->r9 */ xorl %r9d, %r9d /* nospec r9 */ - pushq $0 /* pt_regs->r10 = 0 */ + pushq %r10 /* pt_regs->r10 */ xorl %r10d, %r10d /* nospec r10 */ - pushq $0 /* pt_regs->r11 = 0 */ + pushq %r11 /* pt_regs->r11 */ xorl %r11d, %r11d /* nospec r11 */ pushq %rbx /* pt_regs->rbx */ xorl %ebx, %ebx /* nospec rbx */
tools/testing/selftests/x86/test_syscall_vdso.c +21 -14
@@ -100,12 +100,19 @@ asm (" shl $32, %r8\n" " orq $0x7f7f7f7f, %r8\n" " movq %r8, %r9\n" -" movq %r8, %r10\n" -" movq %r8, %r11\n" -" movq %r8, %r12\n" -" movq %r8, %r13\n" -" movq %r8, %r14\n" -" movq %r8, %r15\n" +" incq %r9\n" +" movq %r9, %r10\n" +" incq %r10\n" +" movq %r10, %r11\n" +" incq %r11\n" +" movq %r11, %r12\n" +" incq %r12\n" +" movq %r12, %r13\n" +" incq %r13\n" +" movq %r13, %r14\n" +" incq %r14\n" +" movq %r14, %r15\n" +" incq %r15\n" " ret\n" " .code32\n" " .popsection\n"
@@ -128,12 +135,13 @@ int check_regs64(void)int err =0 ;int num =8 ;uint64_t *r64 = ®s64.r8; +uint64_t expected =0x7f7f7f7f7f7f7f7fULL ;if (!kernel_is_64bit)return 0 ; do { - if (*r64 == 0x7f7f7f7f7f7f7f7fULL) + if (*r64 == expected++) continue; /* register did not change */ if (syscall_addr != (long)&int80) { /*
@@ -147,18 +155,17 @@ int check_regs64(void)continue ; } }else { -/* INT80 syscall entrypoint can be used by +/* +* INT80 syscall entrypoint can be used by * 64-bit programs too, unlike SYSCALL/SYSENTER. * Therefore it must preserve R12+ * (they are callee-saved registers in 64-bit C ABI). * -* This was probably historically not intended, -* but R8..11 are clobbered (cleared to 0). -* IOW: they are the only registers which aren't -* preserved across INT80 syscall. +* Starting in Linux 4.17 (and any kernel that +* backports the change), R8..11 are preserved. +* Historically (and probably unintentionally), they +* were clobbered or zeroed. */ -if (*r64 ==0 && num <=11 ) -continue ; }printf ("[FAIL]\tR%d has changed:%016llx\n" , num, *r64); err++;
Greg Kroah-Hartman
maintainerPATCH 24/30 x86/entry/64/compat: Fix "x86/entry/64/compat: Preserve r8-r11 in int $0x80"
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit 22cd978e598618e82c3c3348d2069184f6884182 upstream.
Commit:
8bb2610bc496 ("x86/entry/64/compat: Preserve r8-r11 in int $0x80")
was busted: my original patch had a minor conflict with some of the nospec changes, but "git apply" is very clever and silently accepted the patch by making the same changes to a different function in the same file. There was obviously a huge offset, but "git apply" for some reason doesn't feel any need to say so.
Move the changes to the correct function. Now the test_syscall_vdso_32 selftests passes.
If anyone cares to observe the original problem, try applying the patch at:
to the kernel at 316d097c4cd4e7f2ef50c40cff2db266593c4ec4:
- "git am" and "git apply" accept the patch without any complaints at all
- "patch -p1" at least prints out a message about the huge offset.
--- arch/x86/entry/entry_64_compat.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/x86/entry/entry_64_compat.S +8 -8
@@ -84,13 +84,13 @@ ENTRY(entry_SYSENTER_compat) pushq %rdx /* pt_regs->dx */ pushq %rcx /* pt_regs->cx */ pushq $-ENOSYS /* pt_regs->ax */ - pushq %r8 /* pt_regs->r8 */ + pushq $0 /* pt_regs->r8 = 0 */ xorl %r8d, %r8d /* nospec r8 */ - pushq %r9 /* pt_regs->r9 */ + pushq $0 /* pt_regs->r9 = 0 */ xorl %r9d, %r9d /* nospec r9 */ - pushq %r10 /* pt_regs->r10 */ + pushq $0 /* pt_regs->r10 = 0 */ xorl %r10d, %r10d /* nospec r10 */ - pushq %r11 /* pt_regs->r11 */ + pushq $0 /* pt_regs->r11 = 0 */ xorl %r11d, %r11d /* nospec r11 */ pushq %rbx /* pt_regs->rbx */ xorl %ebx, %ebx /* nospec rbx */
@@ -357,13 +357,13 @@ ENTRY(entry_INT80_compat) pushq %rdx /* pt_regs->dx */ pushq %rcx /* pt_regs->cx */ pushq $-ENOSYS /* pt_regs->ax */ - pushq $0 /* pt_regs->r8 = 0 */ + pushq %r8 /* pt_regs->r8 */ xorl %r8d, %r8d /* nospec r8 */ - pushq $0 /* pt_regs->r9 = 0 */ + pushq %r9 /* pt_regs->r9 */ xorl %r9d, %r9d /* nospec r9 */ - pushq $0 /* pt_regs->r10 = 0 */ + pushq %r10 /* pt_regs->r10*/ xorl %r10d, %r10d /* nospec r10 */ - pushq $0 /* pt_regs->r11 = 0 */ + pushq %r11 /* pt_regs->r11 */ xorl %r11d, %r11d /* nospec r11 */ pushq %rbx /* pt_regs->rbx */ xorl %ebx, %ebx /* nospec rbx */
Greg Kroah-Hartman
maintainerPATCH 25/30 iommu/vt-d: Gracefully handle DMAR units with no supported address widths
In reply to Greg Kroah-HartmanFrom: David Woodhouse <[email protected]>
commit c40aaaac1018ff1382f2d35df5129a6bcea3df6b upstream.
Instead of bailing out completely, such a unit can still be used for interrupt remapping.
[ context change due to moving drivers/iommu/dmar.c to
drivers/iommu/intel/dmar.c ]
--- drivers/iommu/dmar.c | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-)
drivers/iommu/dmar.c +31 -15
@@ -1026,8 +1026,8 @@ static int alloc_iommu(struct dmar_drhd_ {struct intel_iommu *iommu;u32 ver, sts; -int agaw =0 ; -int msagaw =0 ; +int agaw =-1 ; +int msagaw =-1 ;int err;if (!drhd->reg_base_addr) {
@@ -1052,17 +1052,28 @@ static int alloc_iommu(struct dmar_drhd_ } err = -EINVAL ; - agaw =iommu_calculate_agaw (iommu); -if (agaw <0 ) { -pr_err ("Cannot get a valid agaw for iommu (seq_id = %d)\n" , - iommu->seq_id); - goto err_unmap; - } - msagaw =iommu_calculate_max_sagaw (iommu); -if (msagaw <0 ) { -pr_err ("Cannot get a valid max agaw for iommu (seq_id = %d)\n" , - iommu->seq_id); - goto err_unmap; +if (cap_sagaw (iommu->cap) ==0 ) { +pr_info ("%s: No supported address widths. Not attempting DMA translation.\n" , + iommu->name); + drhd->ignored =1 ; + } + +if (!drhd->ignored) { + agaw =iommu_calculate_agaw (iommu); +if (agaw <0 ) { +pr_err ("Cannot get a valid agaw for iommu (seq_id = %d)\n" , + iommu->seq_id); + drhd->ignored =1 ; + } + } +if (!drhd->ignored) { + msagaw =iommu_calculate_max_sagaw (iommu); +if (msagaw <0 ) { +pr_err ("Cannot get a valid max agaw for iommu (seq_id = %d)\n" , + iommu->seq_id); + drhd->ignored =1 ; + agaw =-1 ; + } } iommu->agaw = agaw; iommu->msagaw = msagaw;
@@ -1089,7 +1100,12 @@ static int alloc_iommu(struct dmar_drhd_raw_spin_lock_init (&iommu->register_lock); -if (intel_iommu_enabled) { +/* +* This is only for hotplug; at boot time intel_iommu_enabled won't +* be set yet. When intel_iommu_init() runs, it registers the units +* present at boot time, then sets intel_iommu_enabled. +*/ +if (intel_iommu_enabled && !drhd->ignored) { err =iommu_device_sysfs_add (&iommu->iommu,NULL , intel_iommu_groups,"%s" , iommu->name);
@@ -1118,7 +1134,7 @@ error:static void free_iommu (struct intel_iommu *iommu) { -if (intel_iommu_enabled) { +if (intel_iommu_enabled && iommu->iommu.ops) {iommu_device_unregister (&iommu->iommu);iommu_device_sysfs_remove (&iommu->iommu); }
Greg Kroah-Hartman
maintainerPATCH 26/30 iommu/vt-d: Dont dereference iommu_device if IOMMU_API is not built
In reply to Greg Kroah-HartmanFrom: Bartosz Golaszewski <[email protected]>
commit 9def3b1a07c41e21c68a0eb353e3e569fdd1d2b1 upstream.
Since commit c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths") dmar.c needs struct iommu_device to be selected. We can drop this dependency by not dereferencing struct iommu_device if IOMMU_API is not selected and by reusing the information stored in iommu->drhd->ignored instead.
This fixes the following build error when IOMMU_API is not selected:
drivers/iommu/dmar.c: In function ‘free_iommu’:drivers/iommu/dmar.c:1139:41: error: ‘struct iommu_device’ has no member named ‘ops’
1139 | if (intel_iommu_enabled && iommu->iommu.ops) {
^[ - context change due to moving drivers/iommu/dmar.c to
drivers/iommu/intel/dmar.c
- set the drhr in the iommu like in upstream commit b1012ca8dc4f ("iommu/vt-d: Skip TE disabling on quirky gfx dedicated iommu") ]
--- drivers/iommu/dmar.c | 3 ++- include/linux/intel-iommu.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/iommu/dmar.c +2 -1
@@ -1120,6 +1120,7 @@ static int alloc_iommu(struct dmar_drhd_ } drhd->iommu = iommu; + iommu->drhd = drhd;return 0 ;
@@ -1134,7 +1135,7 @@ error:static void free_iommu (struct intel_iommu *iommu) { -if (intel_iommu_enabled && iommu->iommu.ops) { +if (intel_iommu_enabled && !iommu->drhd->ignored) {iommu_device_unregister (&iommu->iommu);iommu_device_sysfs_remove (&iommu->iommu); }
include/linux/intel-iommu.h +2 -0
@@ -434,6 +434,8 @@ struct intel_iommu {struct iommu_device iommu;/* IOMMU core code handle */ int node;u32 flags;/* Software defined flags */ + +struct dmar_drhd_unit *drhd; }; static inline void __iommu_flush_cache(
Greg Kroah-Hartman
maintainerPATCH 27/30 NFC: fix resource leak when target index is invalid
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
commit 3a30537cee233fb7da302491b28c832247d89bbe upstream.
Goto to the label put_dev instead of the label error to fix potential resource leak on path that the target index is invalid.
--- net/nfc/rawsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/nfc/rawsock.c +1 -1
@@ -117,7 +117,7 @@ static int rawsock_connect(struct socketif (addr->target_idx > dev->target_next_idx -1 || addr->target_idx < dev->target_next_idx - dev->n_targets) { rc = -EINVAL ; - goto error; + goto put_dev; } rc =nfc_activate_target (dev, addr->target_idx, addr->nfc_protocol);
Greg Kroah-Hartman
maintainerPATCH 28/30 NFC: fix possible resource leak
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
commit d8f923c3ab96dbbb4e3c22d1afc1dc1d3b195cd8 upstream.
Put the device to avoid resource leak on path that the polling flag is invalid.
--- net/nfc/netlink.c | 1 + 1 file changed, 1 insertion(+)
net/nfc/netlink.c +1 -0
@@ -884,6 +884,7 @@ static int nfc_genl_stop_poll(struct sk_if (!dev->polling) {device_unlock (&dev->dev); +nfc_put_device (dev);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 29/30 team: protect features update by RCU to avoid deadlock
In reply to Greg Kroah-HartmanFrom: Ivan Vecera <[email protected]>
commit f0947d0d21b219e03940b9be6628a43445c0de7a upstream.
Function __team_compute_features() is protected by team->lock mutex when it is called from team_compute_features() used when features of an underlying device is changed. This causes a deadlock when NETDEV_FEAT_CHANGE notifier for underlying device is fired due to change propagated from team driver (e.g. MTU change). It's because callbacks like team_change_mtu() or team_vlan_rx_{add,del}_vid() protect their port list traversal by team->lock mutex.
Example (r8169 case where this driver disables TSO for certain MTU values):
...
[ 6391.348202] __mutex_lock.isra.6+0x2d0/0x4a0 [ 6391.358602] team_device_event+0x9d/0x160 [team] [ 6391.363756] notifier_call_chain+0x47/0x70 [ 6391.368329] netdev_update_features+0x56/0x60 [ 6391.373207] rtl8169_change_mtu+0x14/0x50 [r8169] [ 6391.378457] dev_set_mtu_ext+0xe1/0x1d0 [ 6391.387022] dev_set_mtu+0x52/0x90 [ 6391.390820] team_change_mtu+0x64/0xf0 [team] [ 6391.395683] dev_set_mtu_ext+0xe1/0x1d0 [ 6391.399963] do_setlink+0x231/0xf50
...
In fact team_compute_features() called from team_device_event() does not need to be protected by team->lock mutex and rcu_read_lock() is sufficient there for port list traversal.
--- drivers/net/team/team.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/team/team.c +3 -3
@@ -1002,7 +1002,8 @@ static void __team_compute_features(struunsigned int dst_release_flag =IFF_XMIT_DST_RELEASE |IFF_XMIT_DST_RELEASE_PERM ; -list_for_each_entry (port, &team->port_list, list) { +rcu_read_lock (); +list_for_each_entry_rcu (port, &team->port_list, list) { vlan_features =netdev_increment_features (vlan_features, port->dev->vlan_features,TEAM_VLAN_FEATURES );
@@ -1016,6 +1017,7 @@ static void __team_compute_features(struif (port->dev->hard_header_len > max_hard_header_len) max_hard_header_len = port->dev->hard_header_len; } +rcu_read_unlock (); team->dev->vlan_features = vlan_features; team->dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
@@ -1030,9 +1032,7 @@ static void __team_compute_features(strustatic void team_compute_features (struct team *team) { -mutex_lock (&team->lock);__team_compute_features (team); -mutex_unlock (&team->lock);netdev_change_features (team->dev); }
Greg Kroah-Hartman
maintainerPATCH 30/30 tcp: fix TLP timer not set when CA_STATE changes from DISORDER to OPEN
In reply to Greg Kroah-HartmanFrom: Pengcheng Yang <[email protected]>
commit 62d9f1a6945ba69c125e548e72a36d203b30596e upstream.
Upon receiving a cumulative ACK that changes the congestion state from Disorder to Open, the TLP timer is not set. If the sender is app-limited, it can only wait for the RTO timer to expire and retransmit.
The reason for this is that the TLP timer is set before the congestion state changes in tcp_ack(), so we delay the time point of calling tcp_set_xmit_timer() until after tcp_fastretrans_alert() returns and remove the FLAG_SET_XMIT_TIMER from ack_flag when the RACK reorder timer is set.
This commit has two additional benefits:
1) Make sure to reset RTO according to RFC6298 when receiving ACK, to avoid spurious RTO caused by RTO timer early expires.
2) Reduce the xmit timer reschedule once per ACK when the RACK reorder timer is set.
--- include/net/tcp.h | 2 +- net/ipv4/tcp_input.c | 10 ++++++---- net/ipv4/tcp_recovery.c | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-)
include/net/tcp.h +1 -1
@@ -1969,7 +1969,7 @@ void tcp_v4_init(void);void tcp_init (void );/* tcp_recovery.c */ -extern void tcp_rack_mark_lost (struct sock *sk); +extern bool tcp_rack_mark_lost (struct sock *sk);extern void tcp_rack_advance (struct tcp_sock *tp,u8 sacked,u32 end_seq,u64 xmit_time);extern void tcp_rack_reo_timeout (struct sock *sk);
net/ipv4/tcp_input.c +6 -4
@@ -2803,7 +2803,8 @@ static void tcp_rack_identify_loss(strucif (sysctl_tcp_recovery &TCP_RACK_LOSS_DETECTION ) {u32 prior_retrans = tp->retrans_out; -tcp_rack_mark_lost (sk); +if (tcp_rack_mark_lost (sk)) + *ack_flag &= ~FLAG_SET_XMIT_TIMER ;if (prior_retrans > tp->retrans_out) *ack_flag |=FLAG_LOST_RETRANS ; }
@@ -3688,15 +3689,16 @@ static int tcp_ack(struct sock *sk, consif (tp->tlp_high_seq)tcp_process_tlp_ack (sk, ack, flag); -/* If needed, reset TLP/RTO timer; RACK may later override this. */ -if (flag &FLAG_SET_XMIT_TIMER ) -tcp_set_xmit_timer (sk);if (tcp_ack_is_dubious (sk, flag)) { is_dupack = !(flag & (FLAG_SND_UNA_ADVANCED |FLAG_NOT_DUP ));tcp_fastretrans_alert (sk, acked, is_dupack, &flag, &rexmit); } +/* If needed, reset TLP/RTO timer when RACK doesn't set. */ +if (flag &FLAG_SET_XMIT_TIMER ) +tcp_set_xmit_timer (sk); +if ((flag &FLAG_FORWARD_PROGRESS ) || !(flag &FLAG_NOT_DUP ))sk_dst_confirm (sk);
net/ipv4/tcp_recovery.c +3 -2
@@ -102,13 +102,13 @@ static void tcp_rack_detect_loss(struct } } -void tcp_rack_mark_lost (struct sock *sk) +bool tcp_rack_mark_lost (struct sock *sk) {struct tcp_sock *tp =tcp_sk (sk);u32 timeout;if (!tp->rack.advanced) -return ; +return false;/* Reset the advanced flag to avoid unnecessary queue scanning */ tp->rack.advanced =0 ;
@@ -118,6 +118,7 @@ void tcp_rack_mark_lost(struct sock *sk)inet_csk_reset_xmit_timer (sk,ICSK_TIME_REO_TIMEOUT , timeout,inet_csk (sk)->icsk_rto); } +return !!timeout; }/* Record the most recently (re)sent time among the (s)acked packets
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.219 release. There are 30 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 Thu, 04 Feb 2021 13:29:33 +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.14.219-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
30 tests: 30 pass, 0 failLinux version: 4.14.219-rc1-g17dd434cff6b
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.219 release. There are 30 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 Thu, 04 Feb 2021 13:29:33 +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.14.219-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.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.14.219-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: 17dd434cff6bcaf79221b1a890a9df7ea23a3bd7
git describe: v4.14.218-31-g17dd434cff6b
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.14.y/build/v4.14.218-31-g17dd434cff6b
No regressions (compared to build v4.14.218)
No fixes (compared to build v4.14.218)
Ran 43689 total tests in the following environments and test suites.
Environments
--------------
- arm
- arm64
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-64k_page_size
- juno-r2 - arm64
- juno-r2-compat
- juno-r2-kasan
- mips
- qemu-arm64-kasan
- qemu-x86_64-kasan
- qemu_arm
- qemu_arm64
- qemu_arm64-compat
- qemu_i386
- qemu_x86_64
- qemu_x86_64-compat
- sparc
- x15 - arm
- x86_64
- x86-kasan
- x86_64
Test Suites
-----------
* build
* linux-log-parser
* install-android-platform-tools-r2600
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-ptrace
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-zram
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* fwts
* libhugetlbfs
* ltp-commands-tests
* ltp-math-tests
* ltp-tracing-tests
* network-basic-tests
* v4l2-compliance
* kselftest-kvm
* kselftest-vm
* kselftest-x86
* ltp-fs-tests
* ltp-open-posix-tests
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kvm-unit-tests
* rcutorture
* ssuite
* kselftest-kexec
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.14.219 release. There are 30 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 Thu, 04 Feb 2021 13:29:33 +0000. Anything received after that time might be too late.
Build results:
total: 168 pass: 168 fail: 0 Qemu test results: total: 404 pass: 404 fail: 0
Guenter