4.9.145-stable review
Greg Kroah-Hartman
maintainercover 4.9.145-stable review
This is the start of the stable review cycle for the 4.9.145 release. There are 51 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 Dec 13 15:15:52 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.145-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.145-rc1
Stefan Agner <[email protected]>
kbuild: allow to use GCC toolchain not in Clang search path
Nick Desaulniers <[email protected]>
kbuild: fix linker feature test macros when cross compiling with Clang
Emmanuel Grumbach <[email protected]>
mac80211: ignore NullFunc frames in the duplicate detection
Felix Fietkau <[email protected]>
mac80211: fix reordering of buffered broadcast packets
Felix Fietkau <[email protected]>
mac80211: ignore tx status for PS stations in ieee80211_tx_status_ext
Ben Greear <[email protected]>
mac80211: Clear beacon_int in ieee80211_do_stop
Vasyl Vavrychuk <[email protected]>
mac80211_hwsim: Timer should be initialized before device registered
Macpaul Lin <[email protected]>
kgdboc: fix KASAN global-out-of-bounds bug in param_set_kgdboc_var()
Chanho Park <[email protected]>
tty: do not set TTY_IO_ERROR flag if console port
Peter Shih <[email protected]>
tty: serial: 8250_mtk: always resume the device in probe.
Young Xiao <[email protected]>
staging: rtl8712: Fix possible buffer overrun
Paulo Alcantara <[email protected]>
cifs: Fix separator when building path from dentry
Greg Kroah-Hartman <[email protected]>
Staging: lustre: remove two build warnings
Stefan Hajnoczi <[email protected]>
vhost/vsock: fix use-after-free in network stack callers
Gao feng <[email protected]>
vsock: lookup and setup guest_cid inside vhost_vsock_lock
Kees Cook <[email protected]>
swiotlb: clean up reporting
Jens Axboe <[email protected]>
sr: pass down correctly sized SCSI sense buffer
Mathias Nyman <[email protected]>
xhci: Prevent U1/U2 link pm states if exit latency is too long
Bin Liu <[email protected]>
dmaengine: cppi41: delete channel from pending list when stop channel
Chuck Lever <[email protected]>
SUNRPC: Fix leak of krb5p encode pages
Halil Pasic <[email protected]>
virtio/s390: fix race in ccw_io_helper()
Halil Pasic <[email protected]>
virtio/s390: avoid race on vcdev->config
Takashi Iwai <[email protected]>
ALSA: hda/realtek - Fix speaker output regression on Thinkpad T570
Takashi Iwai <[email protected]>
ALSA: pcm: Fix interval evaluation with openmin/max
Takashi Iwai <[email protected]>
ALSA: pcm: Call snd_pcm_unlink() conditionally at closing
Chanho Min <[email protected]>
ALSA: pcm: Fix starvation on down_write_nonblock()
Kai-Heng Feng <[email protected]>
ALSA: hda: Add support for AMD Stoney Ridge
Hui Peng <[email protected]>
ALSA: usb-audio: Fix UAF decrement if card has no live interfaces in card.c
Mathias Payer <[email protected]>
USB: check usb_get_extra_descriptor for proper size
Alexander Theissen <[email protected]>
usb: appledisplay: Add 27" Apple Cinema Display
Harry Pan <[email protected]>
usb: quirk: add no-LPM quirk on SanDisk Ultra Flair device
Alexey Brodkin <[email protected]>
ARC: [zebu] Remove CONFIG_INITRAMFS_SOURCE from defconfigs
Tetsuo Handa <[email protected]>
mm: don't warn about allocations which stall for too long
Yangtao Li <[email protected]>
net: amd: add missing of_node_put()
Hangbin Liu <[email protected]>
team: no need to do team_notify_peers or team_mcast_rejoin when disabling port
Pan Bian <[email protected]>
iommu/vt-d: Use memunmap to free memremap
Vincent Chen <[email protected]>
net: faraday: ftmac100: remove netif_running(netdev) check before disabling interrupts
Olof Johansson <[email protected]>
mtd: rawnand: qcom: Namespace prefix some commands
Aya Levin <[email protected]>
net/mlx4: Fix UBSAN warning of signed integer overflow
Tariq Toukan <[email protected]>
net/mlx4_core: Fix uninitialized variable compilation warning
Jack Morgenstein <[email protected]>
net/mlx4_core: Zero out lkey field in SW2HW_MPT fw command
Denis Bolotin <[email protected]>
qed: Fix reading wrong value in loop condition
Denis Bolotin <[email protected]>
qed: Fix PTT leak in qed_drain()
Sudarsana Reddy Kalluru <[email protected]>
bnx2x: Assign unique DMAE channel number for FW DMAE transactions.
Sven Eckelmann <[email protected]>
batman-adv: Expand merged fragment buffer for full packet
Benson Leung <[email protected]>
HID: input: Ignore battery reported by Symbol DS4308
Fabrizio Castro <[email protected]>
can: rcar_can: Fix erroneous registration
Geert Uytterhoeven <[email protected]>
iommu/ipmmu-vmsa: Fix crash on early domain free
Rafał Miłecki <[email protected]>
brcmutil: really fix decoding channel info for 160 MHz bandwidth
Lu Baolu <[email protected]>
iommu/vt-d: Fix NULL pointer dereference in prq_event_thread()
Sakari Ailus <[email protected]>
media: omap3isp: Unregister media device as first
-------------
Diffstat:
Makefile | 12 +++--- arch/arc/configs/zebu_hs_defconfig | 1 - arch/arc/configs/zebu_hs_smp_defconfig | 1 - drivers/dma/cppi41.c | 16 ++++++- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-input.c | 3 ++ drivers/iommu/intel-iommu.c | 2 +- drivers/iommu/intel-svm.c | 2 +- drivers/iommu/ipmmu-vmsa.c | 3 ++ drivers/media/platform/omap3isp/isp.c | 3 +- drivers/mtd/nand/qcom_nandc.c | 32 +++++++------- drivers/net/can/rcar/rcar_can.c | 5 ++- drivers/net/ethernet/amd/sunlance.c | 4 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 7 +++ drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 1 + drivers/net/ethernet/faraday/ftmac100.c | 7 ++- drivers/net/ethernet/mellanox/mlx4/alloc.c | 2 +- drivers/net/ethernet/mellanox/mlx4/mlx4.h | 4 +- drivers/net/ethernet/mellanox/mlx4/mr.c | 1 + drivers/net/ethernet/qlogic/qed/qed_int.c | 2 + drivers/net/ethernet/qlogic/qed/qed_main.c | 2 +- drivers/net/team/team.c | 2 - .../net/wireless/broadcom/brcm80211/brcmutil/d11.c | 3 ++ drivers/net/wireless/mac80211_hwsim.c | 8 ++-- drivers/s390/virtio/virtio_ccw.c | 17 ++++++-- drivers/scsi/sr_ioctl.c | 21 +++------ drivers/staging/lustre/lnet/lnet/config.c | 3 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- drivers/staging/rtl8712/mlme_linux.c | 2 +- drivers/staging/rtl8712/rtl871x_mlme.c | 2 +- drivers/tty/serial/8250/8250_mtk.c | 16 +++---- drivers/tty/serial/kgdboc.c | 4 +- drivers/tty/tty_port.c | 3 +- drivers/usb/core/hub.c | 2 +- drivers/usb/core/quirks.c | 4 ++ drivers/usb/core/usb.c | 6 +-- drivers/usb/host/hwa-hc.c | 2 +- drivers/usb/host/xhci.c | 16 +++++++ drivers/usb/misc/appledisplay.c | 1 + drivers/vhost/vsock.c | 50 +++++++++++++++------- fs/cifs/dir.c | 2 +- include/linux/usb.h | 4 +- include/sound/pcm_params.h | 4 +- lib/swiotlb.c | 20 ++++----- mm/page_alloc.c | 10 ----- net/batman-adv/fragmentation.c | 2 +- net/mac80211/iface.c | 2 + net/mac80211/rx.c | 1 + net/mac80211/status.c | 2 + net/mac80211/tx.c | 4 +- net/sunrpc/auth_gss/auth_gss.c | 4 ++ scripts/Kbuild.include | 5 ++- sound/core/pcm_native.c | 14 +++--- sound/pci/hda/hda_intel.c | 4 ++ sound/pci/hda/patch_realtek.c | 9 ++++ sound/usb/card.c | 5 ++- 56 files changed, 232 insertions(+), 135 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/51 media: omap3isp: Unregister media device as first
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 30efae3d789cd0714ef795545a46749236e29558 ]
While there are issues related to object lifetime management, unregister the media device first when the driver is being unbound. This is slightly safer.
--- drivers/media/platform/omap3isp/isp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/omap3isp/isp.c +2 -1
@@ -1591,6 +1591,8 @@ static void isp_pm_complete(struct device *dev)static void isp_unregister_entities (struct isp_device *isp) { +media_device_unregister (&isp->media_dev); +omap3isp_csi2_unregister_entities (&isp->isp_csi2a);omap3isp_ccp2_unregister_entities (&isp->isp_ccp2);omap3isp_ccdc_unregister_entities (&isp->isp_ccdc);
@@ -1601,7 +1603,6 @@ static void isp_unregister_entities(struct isp_device *isp)omap3isp_stat_unregister_entities (&isp->isp_hist);v4l2_device_unregister (&isp->v4l2_dev); -media_device_unregister (&isp->media_dev);media_device_cleanup (&isp->media_dev); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 2/51 iommu/vt-d: Fix NULL pointer dereference in prq_event_thread()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 19ed3e2dd8549c1a34914e8dad01b64e7837645a ]
When handling page request without pasid event, go to "no_pasid" branch instead of "bad_req". Otherwise, a NULL pointer deference will happen there.
--- drivers/iommu/intel-svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel-svm.c +1 -1
@@ -558,7 +558,7 @@ static irqreturn_t prq_event_thread(int irq, void *d)pr_err ("%s: Page request without PASID: %08llx %08llx\n" , iommu->name, ((unsigned long long *)req)[0 ], ((unsigned long long *)req)[1 ]); - goto bad_req; + goto no_pasid; }if (!svm || svm->pasid != req->pasid) {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 3/51 brcmutil: really fix decoding channel info for 160 MHz bandwidth
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3401d42c7ea2d064d15c66698ff8eb96553179ce ]
Previous commit /adding/ support for 160 MHz chanspecs was incomplete. It didn't set bandwidth info and didn't extract control channel info. As the result it was also using uninitialized "sb" var.
This change has been tested for two chanspecs found to be reported by some devices/firmwares:
1) 60/160 (0xee32)
Before: chnum:50 control_ch_num:36
After: chnum:50 control_ch_num:60
2) 120/160 (0xed72)
Before: chnum:114 control_ch_num:100
After: chnum:114 control_ch_num:120--- drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c +3 -0
@@ -193,6 +193,9 @@ static void brcmu_d11ac_decchspec(struct brcmu_chan *ch) }break ;case BRCMU_CHSPEC_D11AC_BW_160 : + ch->bw =BRCMU_CHAN_BW_160 ; + ch->sb =brcmu_maskget16 (ch->chspec,BRCMU_CHSPEC_D11AC_SB_MASK , +BRCMU_CHSPEC_D11AC_SB_SHIFT );switch (ch->sb) {case BRCMU_CHAN_SB_LLL : ch->control_ch_num -=CH_70MHZ_APART ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 4/51 iommu/ipmmu-vmsa: Fix crash on early domain free
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e5b78f2e349eef5d4fca5dc1cf5a3b4b2cc27abd ]
If iommu_ops.add_device() fails, iommu_ops.domain_free() is still called, leading to a crash, as the domain was only partially initialized:
ipmmu-vmsa e67b0000.mmu: Cannot accommodate DMA translation for IOMMU page tables
sata_rcar ee300000.sata: Unable to initialize IPMMU context
iommu: Failed to add device ee300000.sata to group 0: -22
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000038
...
Call trace:
ipmmu_domain_free+0x1c/0xa0
iommu_group_release+0x48/0x68
kobject_put+0x74/0xe8
kobject_del.part.0+0x3c/0x50
kobject_put+0x60/0xe8
iommu_group_get_for_dev+0xa8/0x1f0
ipmmu_add_device+0x1c/0x40
of_iommu_configure+0x118/0x190Fix this by checking if the domain's context already exists, before trying to destroy it.
--- drivers/iommu/ipmmu-vmsa.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/ipmmu-vmsa.c +3 -0
@@ -372,6 +372,9 @@ static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain)static void ipmmu_domain_destroy_context (struct ipmmu_vmsa_domain *domain) { +if (!domain->mmu) +return ; +/* * Disable the context. Flush the TLB as required when modifying the * context registers.
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 5/51 can: rcar_can: Fix erroneous registration
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 68c8d209cd4337da4fa04c672f0b62bb735969bc ]
Assigning 2 to "renesas,can-clock-select" tricks the driver into registering the CAN interface, even though we don't want that. This patch improves one of the checks to prevent that from happening.
--- drivers/net/can/rcar/rcar_can.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/can/rcar/rcar_can.c +4 -1
@@ -24,6 +24,9 @@#define RCAR_CAN_DRV_NAME "rcar_can" +#define RCAR_SUPPORTED_CLOCKS (BIT(CLKR_CLKP1) | BIT(CLKR_CLKP2) | \ + BIT(CLKR_CLKEXT)) +/* Mailbox configuration: * mailbox 60 - 63 - Rx FIFO mailboxes * mailbox 56 - 59 - Tx FIFO mailboxes
@@ -789,7 +792,7 @@ static int rcar_can_probe(struct platform_device *pdev) goto fail_clk; } -if (clock_select >=ARRAY_SIZE (clock_names)) { +if (!(BIT (clock_select) &RCAR_SUPPORTED_CLOCKS )) { err = -EINVAL ;dev_err (&pdev->dev,"invalid CAN clock selected\n" ); goto fail_clk;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 6/51 HID: input: Ignore battery reported by Symbol DS4308
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 0fd791841a6d67af1155a9c3de54dea51220721e ]
The Motorola/Zebra Symbol DS4308-HD is a handheld USB barcode scanner which does not have a battery, but reports one anyway that always has capacity 2.
Let's apply the IGNORE quirk to prevent it from being treated like a power supply so that userspaces don't get confused that this accessory is almost out of power and warn the user that they need to charge their wired barcode scanner.
Reported here: https://bugs.chromium.org/p/chromium/issues/detail?id=804720
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-input.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -965,6 +965,7 @@#define USB_VENDOR_ID_SYMBOL 0x05e0#define USB_DEVICE_ID_SYMBOL_SCANNER_1 0x0800#define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300 +#define USB_DEVICE_ID_SYMBOL_SCANNER_3 0x1200#define USB_VENDOR_ID_SYNAPTICS 0x06cb#define USB_DEVICE_ID_SYNAPTICS_TP 0x0001
drivers/hid/hid-input.c +3 -0
@@ -324,6 +324,9 @@ static const struct hid_device_id hid_battery_quirks[] = { {HID_BLUETOOTH_DEVICE (USB_VENDOR_ID_ELECOM ,USB_DEVICE_ID_ELECOM_BM084 ), HID_BATTERY_QUIRK_IGNORE }, + { HID_USB_DEVICE(USB_VENDOR_ID_SYMBOL, +USB_DEVICE_ID_SYMBOL_SCANNER_3 ), + HID_BATTERY_QUIRK_IGNORE }, {} };
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 7/51 batman-adv: Expand merged fragment buffer for full packet
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d7d8bbb40a5b1f682ee6589e212934f4c6b8ad60 ]
The complete size ("total_size") of the fragmented packet is stored in the fragment header and in the size of the fragment chain. When the fragments are ready for merge, the skbuff's tail of the first fragment is expanded to have enough room after the data pointer for at least total_size. This means that it gets expanded by total_size - first_skb->len.
But this is ignoring the fact that after expanding the buffer, the fragment header is pulled by from this buffer. Assuming that the tailroom of the buffer was already 0, the buffer after the data pointer of the skbuff is now only total_size - len(fragment_header) large. When the merge function is then processing the remaining fragments, the code to copy the data over to the merged skbuff will cause an skb_over_panic when it tries to actually put enough data to fill the total_size bytes of the packet.
The size of the skb_pull must therefore also be taken into account when the buffer's tailroom is expanded.
--- net/batman-adv/fragmentation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/fragmentation.c +1 -1
@@ -264,7 +264,7 @@ batadv_frag_merge_packets(struct hlist_head *chain)kfree (entry); packet = (struct batadv_frag_packet *)skb_out->data; - size =ntohs (packet->total_size); + size =ntohs (packet->total_size) + hdr_size;/* Make room for the rest of the fragments. */ if (pskb_expand_head (skb_out,0 , size - skb_out->len,GFP_ATOMIC ) <0 ) {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 8/51 bnx2x: Assign unique DMAE channel number for FW DMAE transactions.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 77e461d14ed141253573eeeb4d34eccc51e38328 ]
Driver assigns DMAE channel 0 for FW as part of START_RAMROD command. FW uses this channel for DMAE operations (e.g., TIME_SYNC implementation). Driver also uses the same channel 0 for DMAE operations for some of the PFs (e.g., PF0 on Port0). This could lead to concurrent access to the DMAE channel by FW and driver which is not legal. Hence need to assign unique DMAE id for FW.
Currently following DMAE channels are used by the clients,
MFW - OCBB/OCSD functionality uses DMAE channel 14/15
Driver 0-3 and 8-11 (for PF dmae operations)
4 and 12 (for stats requests)
Assigning unique dmae_id '13' to the FW.
Changes from previous version:
------------------------------
v2: Incorporated the review comments.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 7 +++++++ drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 1 + 2 files changed, 8 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +7 -0
@@ -2187,6 +2187,13 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,#define PMF_DMAE_C (bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \ E1HVN_MAX) +/* Following is the DMAE channel number allocation for the clients. +* MFW: OCBB/OCSD implementations use DMAE channels 14/15 respectively. +* Driver: 0-3 and 8-11 (for PF dmae operations) +* 4 and 12 (for stats requests) +*/ +#define BNX2X_FW_DMAE_C 13/* Channel for FW DMAE operations */ +/* PCIE link and speed */ #define PCICFG_LINK_WIDTH 0x1f00000#define PCICFG_LINK_WIDTH_SHIFT 20
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +1 -0
@@ -6149,6 +6149,7 @@ static inline int bnx2x_func_send_start(struct bnx2x *bp, rdata->sd_vlan_tag =cpu_to_le16 (start_params->sd_vlan_tag); rdata->path_id =BP_PATH (bp); rdata->network_cos_mode = start_params->network_cos_mode; + rdata->dmae_cmd_id =BNX2X_FW_DMAE_C ; rdata->vxlan_dst_port =cpu_to_le16 (start_params->vxlan_dst_port); rdata->geneve_dst_port =cpu_to_le16 (start_params->geneve_dst_port);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 9/51 qed: Fix PTT leak in qed_drain()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9aaa4e8ba12972d674caeefbc5f88d83235dd697 ]
Release PTT before entering error flow.
--- drivers/net/ethernet/qlogic/qed/qed_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_main.c +1 -1
@@ -1395,9 +1395,9 @@ static int qed_drain(struct qed_dev *cdev)return -EBUSY ; } rc =qed_mcp_drain (hwfn, ptt); +qed_ptt_release (hwfn, ptt);if (rc)return rc; -qed_ptt_release (hwfn, ptt); }return 0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 10/51 qed: Fix reading wrong value in loop condition
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ed4eac20dcffdad47709422e0cb925981b056668 ]
The value of "sb_index" is written by the hardware. Reading its value and writing it to "index" must finish before checking the loop condition.
--- drivers/net/ethernet/qlogic/qed/qed_int.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/qlogic/qed/qed_int.c +2 -0
@@ -2135,6 +2135,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn)*/ do { index = p_sb_attn->sb_index; +/* finish reading index before the loop condition */ +dma_rmb (); attn_bits =le32_to_cpu (p_sb_attn->atten_bits); attn_acks =le32_to_cpu (p_sb_attn->atten_ack); }while (index != p_sb_attn->sb_index);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 11/51 net/mlx4_core: Zero out lkey field in SW2HW_MPT fw command
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit bd85fbc2038a1bbe84990b23ff69b6fc81a32b2c ]
When re-registering a user mr, the mpt information for the existing mr when running SRIOV is obtained via the QUERY_MPT fw command. The returned information includes the mpt's lkey.
This retrieved mpt information is used to move the mpt back to hardware ownership in the rereg flow (via the SW2HW_MPT fw command when running SRIOV).
The fw API spec states that for SW2HW_MPT, the lkey field must be zero. Any ConnectX-3 PF driver which checks for strict spec adherence will return failure for SW2HW_MPT if the lkey field is not zero (although the fw in practice ignores this field for SW2HW_MPT).
Thus, in order to conform to the fw API spec, set the lkey field to zero before invoking SW2HW_MPT when running SRIOV.
--- drivers/net/ethernet/mellanox/mlx4/mr.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/mr.c +1 -0
@@ -366,6 +366,7 @@ int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, container_of((void *)mpt_entry, struct mlx4_cmd_mailbox, buf); + (*mpt_entry)->lkey =0 ; err =mlx4_SW2HW_MPT (dev, mailbox, key); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 12/51 net/mlx4_core: Fix uninitialized variable compilation warning
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3ea7e7ea53c9f6ee41cb69a29c375fe9dd9a56a7 ]
Initialize the uid variable to zero to avoid the compilation warning.
--- drivers/net/ethernet/mellanox/mlx4/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/alloc.c +1 -1
@@ -339,7 +339,7 @@ void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc)static u32 __mlx4_alloc_from_zone (struct mlx4_zone_entry *zone,int count,int align,u32 skip_mask,u32 *puid) { -u32 uid; +u32 uid =0 ;u32 res;struct mlx4_zone_allocator *zone_alloc = zone->allocator;struct mlx4_zone_entry *curr_node;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 13/51 net/mlx4: Fix UBSAN warning of signed integer overflow
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a463146e67c848cbab5ce706d6528281b7cded08 ]
UBSAN: Undefined behavior in
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:626:29 signed integer overflow: 1802201963 + 1802201963 cannot be represented in type 'int'
The union of res_reserved and res_port_rsvd[MLX4_MAX_PORTS] monitors granting of reserved resources. The grant operation is calculated and protected, thus both members of the union cannot be negative. Changed type of res_reserved and of res_port_rsvd[MLX4_MAX_PORTS] from signed int to unsigned int, allowing large value.
--- drivers/net/ethernet/mellanox/mlx4/mlx4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/mlx4.h +2 -2
@@ -542,8 +542,8 @@ struct slave_list {struct resource_allocator {spinlock_t alloc_lock;/* protect quotas */ union { -int res_reserved; -int res_port_rsvd[MLX4_MAX_PORTS ]; +unsigned int res_reserved; +unsigned int res_port_rsvd[MLX4_MAX_PORTS ]; };union {int res_free;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 14/51 mtd: rawnand: qcom: Namespace prefix some commands
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 33bf5519ae5dd356b182a94e3622f42860274a38 ]
PAGE_READ is used by RISC-V arch code included through mm headers, and it makes sense to bring in a prefix on these in the driver.
drivers/mtd/nand/raw/qcom_nandc.c:153: warning: "PAGE_READ" redefined
#define PAGE_READ 0x2
In file included from include/linux/memremap.h:7,
from include/linux/mm.h:27,
from include/linux/scatterlist.h:8,
from include/linux/dma-mapping.h:11,
from drivers/mtd/nand/raw/qcom_nandc.c:17:arch/riscv/include/asm/pgtable.h:48: note: this is the location of the previous definition
Caught by riscv allmodconfig.
--- drivers/mtd/nand/qcom_nandc.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/mtd/nand/qcom_nandc.c +16 -16
@@ -142,15 +142,15 @@#define NAND_VERSION_MINOR_SHIFT 16/* NAND OP_CMDs */ -#define PAGE_READ 0x2 -#define PAGE_READ_WITH_ECC 0x3 -#define PAGE_READ_WITH_ECC_SPARE 0x4 -#define PROGRAM_PAGE 0x6 -#define PAGE_PROGRAM_WITH_ECC 0x7 -#define PROGRAM_PAGE_SPARE 0x9 -#define BLOCK_ERASE 0xa -#define FETCH_ID 0xb -#define RESET_DEVICE 0xd +#define OP_PAGE_READ 0x2 +#define OP_PAGE_READ_WITH_ECC 0x3 +#define OP_PAGE_READ_WITH_ECC_SPARE 0x4 +#define OP_PROGRAM_PAGE 0x6 +#define OP_PAGE_PROGRAM_WITH_ECC 0x7 +#define OP_PROGRAM_PAGE_SPARE 0x9 +#define OP_BLOCK_ERASE 0xa +#define OP_FETCH_ID 0xb +#define OP_RESET_DEVICE 0xd/* Default Value for NAND_DEV_CMD_VLD */ #define NAND_DEV_CMD_VLD_VAL (READ_START_VLD | WRITE_START_VLD | \
@@ -425,11 +425,11 @@ static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read)if (read) {if (host->use_ecc) - cmd =PAGE_READ_WITH_ECC |PAGE_ACC |LAST_PAGE ; + cmd =OP_PAGE_READ_WITH_ECC |PAGE_ACC |LAST_PAGE ;else - cmd =PAGE_READ |PAGE_ACC |LAST_PAGE ; + cmd =OP_PAGE_READ |PAGE_ACC |LAST_PAGE ; }else { - cmd =PROGRAM_PAGE |PAGE_ACC |LAST_PAGE ; + cmd =OP_PROGRAM_PAGE |PAGE_ACC |LAST_PAGE ; }if (host->use_ecc) {
@@ -662,7 +662,7 @@ static int nandc_param(struct qcom_nand_host *host)* in use. we configure the controller to perform a raw read of 512 * bytes to read onfi params */ -nandc_set_reg (nandc,NAND_FLASH_CMD ,PAGE_READ |PAGE_ACC |LAST_PAGE ); +nandc_set_reg (nandc,NAND_FLASH_CMD ,OP_PAGE_READ |PAGE_ACC |LAST_PAGE );nandc_set_reg (nandc,NAND_ADDR0 ,0 );nandc_set_reg (nandc,NAND_ADDR1 ,0 ); nandc_set_reg(nandc, NAND_DEV0_CFG0, 0 << CW_PER_PAGE
@@ -715,7 +715,7 @@ static int erase_block(struct qcom_nand_host *host, int page_addr)struct qcom_nand_controller *nandc =get_qcom_nand_controller (chip);nandc_set_reg (nandc,NAND_FLASH_CMD , -BLOCK_ERASE |PAGE_ACC |LAST_PAGE ); +OP_BLOCK_ERASE |PAGE_ACC |LAST_PAGE );nandc_set_reg (nandc,NAND_ADDR0 , page_addr);nandc_set_reg (nandc,NAND_ADDR1 ,0 ); nandc_set_reg(nandc, NAND_DEV0_CFG0,
@@ -746,7 +746,7 @@ static int read_id(struct qcom_nand_host *host, int column)if (column ==-1 )return 0 ; -nandc_set_reg (nandc,NAND_FLASH_CMD ,FETCH_ID ); +nandc_set_reg (nandc,NAND_FLASH_CMD ,OP_FETCH_ID );nandc_set_reg (nandc,NAND_ADDR0 , column);nandc_set_reg (nandc,NAND_ADDR1 ,0 );nandc_set_reg (nandc,NAND_FLASH_CHIP_SELECT ,DM_EN );
@@ -766,7 +766,7 @@ static int reset(struct qcom_nand_host *host)struct nand_chip *chip = &host->chip;struct qcom_nand_controller *nandc =get_qcom_nand_controller (chip); -nandc_set_reg (nandc,NAND_FLASH_CMD ,RESET_DEVICE ); +nandc_set_reg (nandc,NAND_FLASH_CMD ,OP_RESET_DEVICE );nandc_set_reg (nandc,NAND_EXEC_CMD ,1 );write_reg_dma (nandc,NAND_FLASH_CMD ,1 );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 15/51 net: faraday: ftmac100: remove netif_running(netdev) check before disabling interrupts
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 426a593e641ebf0d9288f0a2fcab644a86820220 ]
In the original ftmac100_interrupt(), the interrupts are only disabled when the condition "netif_running(netdev)" is true. However, this condition causes kerenl hang in the following case. When the user requests to disable the network device, kernel will clear the bit __LINK_STATE_START from the dev->state and then call the driver's ndo_stop function. Network device interrupts are not blocked during this process. If an interrupt occurs between clearing __LINK_STATE_START and stopping network device, kernel cannot disable the interrupts due to the condition "netif_running(netdev)" in the ISR. Hence, kernel will hang due to the continuous interruption of the network device.
In order to solve the above problem, the interrupts of the network device should always be disabled in the ISR without being restricted by the condition "netif_running(netdev)".
[V2]
Remove unnecessary curly braces.
--- drivers/net/ethernet/faraday/ftmac100.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/faraday/ftmac100.c +3 -4
@@ -865,11 +865,10 @@ static irqreturn_t ftmac100_interrupt(int irq, void *dev_id)struct net_device *netdev = dev_id;struct ftmac100 *priv =netdev_priv (netdev); -if (likely (netif_running (netdev))) { -/* Disable interrupts for polling */ -ftmac100_disable_all_int (priv); +/* Disable interrupts for polling */ +ftmac100_disable_all_int (priv); +if (likely (netif_running (netdev)))napi_schedule (&priv->napi); - }return IRQ_HANDLED ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 16/51 iommu/vt-d: Use memunmap to free memremap
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 829383e183728dec7ed9150b949cd6de64127809 ]
memunmap() should be used to free the return of memremap(), not iounmap().
--- drivers/iommu/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +1 -1
@@ -3054,7 +3054,7 @@ static int copy_context_table(struct intel_iommu *iommu, }if (old_ce) -iounmap (old_ce); +memunmap (old_ce); ret =0 ;if (devfn <0x80 )
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 17/51 team: no need to do team_notify_peers or team_mcast_rejoin when disabling port
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5ed9dc99107144f83b6c1bb52a69b58875baf540 ]
team_notify_peers() will send ARP and NA to notify peers. team_mcast_rejoin() will send multicast join group message to notify peers. We should do this when enabling/changed to a new port. But it doesn't make sense to do it when a port is disabled.
On the other hand, when we set mcast_rejoin_count to 2, and do a failover, team_port_disable() will increase mcast_rejoin.count_pending to 2 and then team_port_enable() will increase mcast_rejoin.count_pending to 4. We will send 4 mcast rejoin messages at latest, which will make user confused. The same with notify_peers.count.
Fix it by deleting team_notify_peers() and team_mcast_rejoin() in team_port_disable().
--- drivers/net/team/team.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/team/team.c +0 -2
@@ -989,8 +989,6 @@ static void team_port_disable(struct team *team, team->en_port_count--;team_queue_override_port_del (team, port);team_adjust_ops (team); -team_notify_peers (team); -team_mcast_rejoin (team);team_lower_state_changed (port); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 18/51 net: amd: add missing of_node_put()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c44c749d3b6fdfca39002e7e48e03fe9f9fe37a3 ]
of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. This place doesn't do that, so fix it.
--- drivers/net/ethernet/amd/sunlance.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/sunlance.c +3 -1
@@ -1419,7 +1419,7 @@ static int sparc_lance_probe_one(struct platform_device *op, prop =of_get_property (nd,"tpe-link-test?" ,NULL );if (!prop) - goto no_link_test; + goto node_put;if (strcmp (prop,"true" )) { printk(KERN_NOTICE "SunLance: warning: overriding option "
@@ -1428,6 +1428,8 @@ static int sparc_lance_probe_one(struct platform_device *op, "to [email protected]\n");auxio_set_lte (AUXIO_LTE_ON ); } +node_put: +of_node_put (nd); no_link_test: lp->auto_select =1 ; lp->tpe =0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 19/51 mm: dont warn about allocations which stall for too long
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
commit 400e22499dd92613821374c8c6c88c7225359980 upstream.
Commit 63f53dea0c98 ("mm: warn about allocations which stall for too long") was a great step for reducing possibility of silent hang up problem caused by memory allocation stalls. But this commit reverts it, for it is possible to trigger OOM lockup and/or soft lockups when many threads concurrently called warn_alloc() (in order to warn about memory allocation stalls) due to current implementation of printk(), and it is difficult to obtain useful information due to limitation of synchronous warning approach.
Current printk() implementation flushes all pending logs using the context of a thread which called console_unlock(). printk() should be able to flush all pending logs eventually unless somebody continues appending to printk() buffer.
Since warn_alloc() started appending to printk() buffer while waiting for oom_kill_process() to make forward progress when oom_kill_process() is processing pending logs, it became possible for warn_alloc() to force oom_kill_process() loop inside printk(). As a result, warn_alloc() significantly increased possibility of preventing oom_kill_process() from making forward progress.
---------- Pseudo code start ----------
Before warn_alloc() was introduced:
retry:
if (mutex_trylock(&oom_lock)) {
while (atomic_read(&printk_pending_logs) > 0) {
atomic_dec(&printk_pending_logs);
print_one_log();
}
// Send SIGKILL here.
mutex_unlock(&oom_lock)
}
goto retry;After warn_alloc() was introduced:
retry:
if (mutex_trylock(&oom_lock)) {
while (atomic_read(&printk_pending_logs) > 0) {
atomic_dec(&printk_pending_logs);
print_one_log();
}
// Send SIGKILL here.
mutex_unlock(&oom_lock)
} else if (waited_for_10seconds()) {
atomic_inc(&printk_pending_logs);
}
goto retry;---------- Pseudo code end ----------
Although waited_for_10seconds() becomes true once per 10 seconds, unbounded number of threads can call waited_for_10seconds() at the same time. Also, since threads doing waited_for_10seconds() keep doing almost busy loop, the thread doing print_one_log() can use little CPU resource. Therefore, this situation can be simplified like
---------- Pseudo code start ----------
retry:
if (mutex_trylock(&oom_lock)) {
while (atomic_read(&printk_pending_logs) > 0) {
atomic_dec(&printk_pending_logs);
print_one_log();
}
// Send SIGKILL here.
mutex_unlock(&oom_lock)
} else {
atomic_inc(&printk_pending_logs);
}
goto retry;---------- Pseudo code end ----------
when printk() is called faster than print_one_log() can process a log.
One of possible mitigation would be to introduce a new lock in order to make sure that no other series of printk() (either oom_kill_process() or warn_alloc()) can append to printk() buffer when one series of printk() (either oom_kill_process() or warn_alloc()) is already in progress.
Such serialization will also help obtaining kernel messages in readable form.
---------- Pseudo code start ----------
retry:
if (mutex_trylock(&oom_lock)) {
mutex_lock(&oom_printk_lock);
while (atomic_read(&printk_pending_logs) > 0) {
atomic_dec(&printk_pending_logs);
print_one_log();
}
// Send SIGKILL here.
mutex_unlock(&oom_printk_lock);
mutex_unlock(&oom_lock)
} else {
if (mutex_trylock(&oom_printk_lock)) {
atomic_inc(&printk_pending_logs);
mutex_unlock(&oom_printk_lock);
}
}
goto retry;---------- Pseudo code end ----------
But this commit does not go that direction, for we don't want to introduce a new lock dependency, and we unlikely be able to obtain useful information even if we serialized oom_kill_process() and warn_alloc().
Synchronous approach is prone to unexpected results (e.g. too late [1], too frequent [2], overlooked [3]). As far as I know, warn_alloc() never helped with providing information other than "something is going wrong". I want to consider asynchronous approach which can obtain information during stalls with possibly relevant threads (e.g. the owner of oom_lock and kswapd-like threads) and serve as a trigger for actions (e.g. turn on/off tracepoints, ask libvirt daemon to take a memory dump of stalling KVM guest for diagnostic purpose).
This commit temporarily loses ability to report e.g. OOM lockup due to unable to invoke the OOM killer due to !__GFP_FS allocation request. But asynchronous approach will be able to detect such situation and emit warning. Thus, let's remove warn_alloc().
[1] https://bugzilla.kernel.org/show_bug.cgi?id=192981
[2] http://lkml.kernel.org/r/CAM_iQpWuPVGc2ky8M-9yukECtS+zKjiDasNymX7rMcBjBFyM_A@mail.gmail.com
[3] commit db73ee0d46379922 ("mm, vmscan: do not loop on too_many_isolated for ever"))
[Resolved backport conflict due to missing 8225196, a8e9925, 9e80c71 and
9a67f64 in 4.9 -- all of which modified this hunk being removed.]
--- mm/page_alloc.c | 10 ---------- 1 file changed, 10 deletions(-)
mm/page_alloc.c +0 -10
@@ -3530,8 +3530,6 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,enum compact_result compact_result;int compaction_retries;int no_progress_loops; -unsigned long alloc_start = jiffies; -unsigned int stall_timeout =10 *HZ ;unsigned int cpuset_mems_cookie;/*
@@ -3704,14 +3702,6 @@ retry:if (order >PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_REPEAT)) goto nopage; -/* Make sure we know about allocations which stall for too long */ -if (time_after (jiffies, alloc_start + stall_timeout)) { -warn_alloc (gfp_mask, -"page allocation stalls for %ums, order:%u" , -jiffies_to_msecs (jiffies-alloc_start), order); - stall_timeout +=10 *HZ ; - } -if (should_reclaim_retry (gfp_mask, order, ac, alloc_flags, did_some_progress >0 , &no_progress_loops)) goto retry;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 21/51 usb: quirk: add no-LPM quirk on SanDisk Ultra Flair device
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harry Pan <[email protected]>
commit 2f2dde6ba89b1ef1fe23c1138131b315d9aa4019 upstream.
Some lower volume SanDisk Ultra Flair in 16GB, which the VID:PID is in 0781:5591, will aggressively request LPM of U1/U2 during runtime, when using this thumb drive as the OS installation key we found the device will generate failure during U1 exit path making it dropped from the USB bus, this causes a corrupted installation in system at the end.
i.e.,
[ 166.918296] hub 2-0:1.0: state 7 ports 7 chg 0000 evt 0004 [ 166.918327] usb usb2-port2: link state change [ 166.918337] usb usb2-port2: do warm reset [ 166.970039] usb usb2-port2: not warm reset yet, waiting 50ms [ 167.022040] usb usb2-port2: not warm reset yet, waiting 200ms [ 167.276043] usb usb2-port2: status 02c0, change 0041, 5.0 Gb/s [ 167.276050] usb 2-2: USB disconnect, device number 2 [ 167.276058] usb 2-2: unregistering device [ 167.276060] usb 2-2: unregistering interface 2-2:1.0 [ 167.276170] xhci_hcd 0000:00:15.0: shutdown urb ffffa3c7cc695cc0 ep1in-bulk [ 167.284055] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK [ 167.284064] sd 0:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 33 04 90 00 01 00 00
...
Analyzed the USB trace in the link layer we realized it is because of the 6-ms timer of tRecoveryConfigurationTimeout which documented on the USB 3.2 Revision 1.0, the section 7.5.10.4.2 of "Exit from Recovery.Configuration"; device initiates U1 exit -> Recovery.Active -> Recovery.Configuration, then the host timer timeout makes the link transits to eSS.Inactive -> Rx.Detect follows by a Warm Reset.
Interestingly, the other higher volume of SanDisk Ultra Flair sharing the same VID:PID, such as 64GB, would not request LPM during runtime, it sticks at U0 always, thus disabling LPM does not affect those thumb drives at all.
The same odd occures in SanDisk Ultra Fit 16GB, VID:PID in 0781:5583.
--- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/core/quirks.c +4 -0
@@ -188,6 +188,10 @@ static const struct usb_device_id usb_qu/* Midiman M-Audio Keystation 88es */ { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, + /* SanDisk Ultra Fit and Ultra Flair */ + { USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM }, + { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM }, + /* M-Systems Flash Disk Pioneers */ { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
Greg Kroah-Hartman
maintainerPATCH 25/51 ALSA: hda: Add support for AMD Stoney Ridge
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit 3deef52ce10514ccdebba8e8ab85f9cebd0eb3f7 upstream.
It's similar to other AMD audio devices, it also supports D3, which can save some power drain.
--- sound/pci/hda/hda_intel.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/hda_intel.c +4 -0
@@ -2352,6 +2352,10 @@ static const struct pci_device_id azx_id/* AMD Hudson */ { PCI_DEVICE(0x1022, 0x780d), .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, + /* AMD Stoney */ + { PCI_DEVICE(0x1022, 0x157a), + .driver_data =AZX_DRIVER_GENERIC |AZX_DCAPS_PRESET_ATI_SB | + AZX_DCAPS_PM_RUNTIME }, /* AMD Raven */ { PCI_DEVICE(0x1022, 0x15e3), .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
Greg Kroah-Hartman
maintainerPATCH 29/51 ALSA: hda/realtek - Fix speaker output regression on Thinkpad T570
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 54947cd64c1b8290f64bb2958e343c07270e3a58 upstream.
We've got a regression report for some Thinkpad models (at least T570s) which shows the too low speaker output volume. The bisection leaded to the commit 61fcf8ece9b6 ("ALSA: hda/realtek - Enable Thinkpad Dock device for ALC298 platform"), and it's basically adding the two pin configurations for the dock, and looks harmless.
The real culprit seems, though, that the DAC assignment for the speaker pin is implicitly assumed on these devices, i.e. pin NID 0x14 to be coupled with DAC NID 0x03. When more pins are configured by the commit above, the auto-parser changes the DAC assignment, and this resulted in the regression.
As a workaround, just provide the fixed pin / DAC mapping table for this Thinkpad fixup function. It's no generic solution, but the problem itself is pretty much device-specific, so must be good enough.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1554304
--- sound/pci/hda/patch_realtek.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/pci/hda/patch_realtek.c +9 -0
@@ -4489,9 +4489,18 @@ static void alc_fixup_tpt470_dock(struct { 0x19, 0x21a11010 }, /* dock mic */ { } }; +/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise +* the speaker output becomes too low by some reason on Thinkpads with +* ALC298 codec +*/ +static hda_nid_t preferred_pairs[] = { +0x14 ,0x03 ,0x17 ,0x02 ,0x21 ,0x02 , +0 + };struct alc_spec *spec = codec->spec;if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->gen.preferred_dacs = preferred_pairs; spec->parse_flags =HDA_PINCFG_NO_HP_FIXUP ;snd_hda_apply_pincfgs (codec, pincfgs); }else if (action ==HDA_FIXUP_ACT_INIT ) {
Greg Kroah-Hartman
maintainerPATCH 31/51 virtio/s390: fix race in ccw_io_helper()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Halil Pasic <[email protected]>
commit 78b1a52e05c9db11d293342e8d6d8a230a04b4e7 upstream.
While ccw_io_helper() seems like intended to be exclusive in a sense that it is supposed to facilitate I/O for at most one thread at any given time, there is actually nothing ensuring that threads won't pile up at vcdev->wait_q. If they do, all threads get woken up and see the status that belongs to some other request than their own. This can lead to bugs. For an example see:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1788432
This race normally does not cause any problems. The operations provided by struct virtio_config_ops are usually invoked in a well defined sequence, normally don't fail, and are normally used quite infrequent too.
Yet, if some of the these operations are directly triggered via sysfs attributes, like in the case described by the referenced bug, userspace is given an opportunity to force races by increasing the frequency of the given operations.
Let us fix the problem by ensuring, that for each device, we finish processing the previous request before starting with a new one.
Message-Id: <[email protected]>
--- drivers/s390/virtio/virtio_ccw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/s390/virtio/virtio_ccw.c +6 -1
@@ -59,6 +59,7 @@ struct virtio_ccw_device {unsigned int revision;/* Transport revision */ wait_queue_head_t wait_q;spinlock_t lock; +struct mutex io_lock;/* Serializes I/O requests */ struct list_head virtqueues;unsigned long indicators;unsigned long indicators2;
@@ -307,6 +308,7 @@ static int ccw_io_helper(struct virtio_cunsigned long flags;int flag = intparm &VIRTIO_CCW_INTPARM_MASK ; +mutex_lock (&vcdev->io_lock); do { spin_lock_irqsave(get_ccwdev_lock(vcdev->cdev), flags); ret = ccw_device_start(vcdev->cdev, ccw, intparm, 0, 0);
@@ -319,7 +321,9 @@ static int ccw_io_helper(struct virtio_ccpu_relax (); }while (ret == -EBUSY );wait_event (vcdev->wait_q,doing_io (vcdev, flag) ==0 ); -return ret ? ret : vcdev->err; + ret = ret ? ret : vcdev->err; +mutex_unlock (&vcdev->io_lock); +return ret; } static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
@@ -1239,6 +1243,7 @@ static int virtio_ccw_online(struct ccw_init_waitqueue_head (&vcdev->wait_q);INIT_LIST_HEAD (&vcdev->virtqueues);spin_lock_init (&vcdev->lock); +mutex_init (&vcdev->io_lock);spin_lock_irqsave (get_ccwdev_lock (cdev), flags);dev_set_drvdata (&cdev->dev, vcdev);
Greg Kroah-Hartman
maintainerPATCH 32/51 SUNRPC: Fix leak of krb5p encode pages
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 8dae5398ab1ac107b1517e8195ed043d5f422bd0 upstream.
call_encode can be invoked more than once per RPC call. Ensure that each call to gss_wrap_req_priv does not overwrite pointers to previously allocated memory.
--- net/sunrpc/auth_gss/auth_gss.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sunrpc/auth_gss/auth_gss.c +4 -0
@@ -1736,6 +1736,7 @@ priv_release_snd_buf(struct rpc_rqst *rqfor (i=0 ; i < rqstp->rq_enc_pages_num; i++)__free_page (rqstp->rq_enc_pages[i]);kfree (rqstp->rq_enc_pages); + rqstp->rq_release_snd_buf =NULL ; } static int
@@ -1744,6 +1745,9 @@ alloc_enc_pages(struct rpc_rqst *rqstp)struct xdr_buf *snd_buf = &rqstp->rq_snd_buf;int first, last, i; +if (rqstp->rq_release_snd_buf) + rqstp->rq_release_snd_buf (rqstp); +if (snd_buf->page_len ==0 ) { rqstp->rq_enc_pages_num =0 ;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 34/51 xhci: Prevent U1/U2 link pm states if exit latency is too long
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 0472bf06c6fd33c1a18aaead4c8f91e5a03d8d7b upstream.
Don't allow USB3 U1 or U2 if the latency to wake up from the U-state reaches the service interval for a periodic endpoint.
This is according to xhci 1.1 specification section 4.23.5.2 extra note:
"Software shall ensure that a device is prevented from entering a U-state
where its worst case exit latency approaches the ESIT."
Allowing too long exit latencies for periodic endpoint confuses xHC internal scheduling, and new devices may fail to enumerate with a "Not enough bandwidth for new device state" error from the host.
--- drivers/usb/host/xhci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/usb/host/xhci.c +16 -0
@@ -4398,6 +4398,14 @@ static u16 xhci_calculate_u1_timeout(str {unsigned long long timeout_ns; +/* Prevent U1 if service interval is shorter than U1 exit latency */ +if (usb_endpoint_xfer_int (desc) ||usb_endpoint_xfer_isoc (desc)) { +if (xhci_service_interval_to_ns (desc) <= udev->u1_params.mel) { +dev_dbg (&udev->dev,"Disable U1, ESIT shorter than exit latency\n" ); +return USB3_LPM_DISABLED ; + } + } +if (xhci->quirks &XHCI_INTEL_HOST ) timeout_ns =xhci_calculate_intel_u1_timeout (udev, desc);else
@@ -4454,6 +4462,14 @@ static u16 xhci_calculate_u2_timeout(str {unsigned long long timeout_ns; +/* Prevent U2 if service interval is shorter than U2 exit latency */ +if (usb_endpoint_xfer_int (desc) ||usb_endpoint_xfer_isoc (desc)) { +if (xhci_service_interval_to_ns (desc) <= udev->u2_params.mel) { +dev_dbg (&udev->dev,"Disable U2, ESIT shorter than exit latency\n" ); +return USB3_LPM_DISABLED ; + } + } +if (xhci->quirks &XHCI_INTEL_HOST ) timeout_ns =xhci_calculate_intel_u2_timeout (udev, desc);else
Greg Kroah-Hartman
maintainerPATCH 35/51 sr: pass down correctly sized SCSI sense buffer
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
commit f7068114d45ec55996b9040e98111afa56e010fe upstream.
We're casting the CDROM layer request_sense to the SCSI sense buffer, but the former is 64 bytes and the latter is 96 bytes. As we generally allocate these on the stack, we end up blowing up the stack.
Fix this by wrapping the scsi_execute() call with a properly sized sense buffer, and copying back the bits for the CDROM layer.
[bwh: Despite what the "Fixes" field says, a buffer overrun was already
possible if the sense data was really > 64 bytes long. Backported to 4.9:
- We always need to allocate a sense buffer in order to call scsi_normalize_sense()
- Remove the existing conditional heap-allocation of the sense buffer]
--- drivers/scsi/sr_ioctl.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
drivers/scsi/sr_ioctl.c +7 -14
@@ -187,30 +187,25 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)struct scsi_device *SDev;struct scsi_sense_hdr sshdr;int result, err =0 , retries =0 ; -struct request_sense *sense = cgc->sense; +unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE ]; SDev = cd->device; -if (!sense) { - sense =kmalloc (SCSI_SENSE_BUFFERSIZE ,GFP_KERNEL ); -if (!sense) { - err = -ENOMEM ; - goto out; - } - } - retry:if (!scsi_block_when_processing_errors (SDev)) { err = -ENODEV ; goto out; } -memset (sense,0 ,sizeof (*sense)); +memset (sense_buffer,0 ,sizeof (sense_buffer)); result =scsi_execute (SDev, cgc->cmd, cgc->data_direction, - cgc->buffer, cgc->buflen, (char *)sense, + cgc->buffer, cgc->buflen, sense_buffer, cgc->timeout,IOCTL_RETRIES ,0 ,NULL ); -scsi_normalize_sense ((char *)sense,sizeof (*sense), &sshdr); +scsi_normalize_sense (sense_buffer,sizeof (sense_buffer), &sshdr); + +if (cgc->sense) +memcpy (cgc->sense, sense_buffer,sizeof (*cgc->sense));/* Minimal error checking. Ignore cases we know about, and report the rest. */ if (driver_byte (result) !=0 ) {
@@ -261,8 +256,6 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)/* Wake up a process waiting for device */ out: -if (!cgc->sense) -kfree (sense); cgc->stat = err;return err; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 36/51 swiotlb: clean up reporting
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
commit 7d63fb3af87aa67aa7d24466e792f9d7c57d8e79 upstream.
This removes needless use of '%p', and refactors the printk calls to use pr_*() helpers instead.
[bwh: Backported to 4.9:
- Adjust filename
- Remove "swiotlb: " prefix from an additional log message]
--- lib/swiotlb.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
lib/swiotlb.c +9 -11
@@ -17,6 +17,8 @@* 08/12/11 beckyb Add highmem support */ +#define pr_fmt (fmt) "software IO TLB: " fmt +#include <linux/cache.h> #include <linux/dma-mapping.h> #include <linux/mm.h>
@@ -147,20 +149,16 @@ static bool no_iotlb_memory;void swiotlb_print_info (void ) {unsigned long bytes = io_tlb_nslabs <<IO_TLB_SHIFT ; -unsigned char *vstart, *vend;if (no_iotlb_memory) { -pr_warn ("software IO TLB: No low mem\n" ); +pr_warn ("No low mem\n" );return ; } - vstart =phys_to_virt (io_tlb_start); - vend =phys_to_virt (io_tlb_end); - -printk (KERN_INFO "software IO TLB [mem %#010llx-%#010llx] (%luMB) mapped at [%p-%p]\n" , +pr_info ("mapped [mem %#010llx-%#010llx] (%luMB)\n" , (unsigned long long )io_tlb_start, (unsigned long long )io_tlb_end, - bytes >>20 , vstart, vend -1 ); + bytes >>20 ); }int __init swiotlb_init_with_tbl (char *tlb,unsigned long nslabs,int verbose)
@@ -234,7 +232,7 @@ swiotlb_init(int verbose)if (io_tlb_start)memblock_free_early (io_tlb_start,PAGE_ALIGN (io_tlb_nslabs <<IO_TLB_SHIFT )); -pr_warn ("Cannot allocate SWIOTLB buffer" ); +pr_warn ("Cannot allocate buffer" ); no_iotlb_memory = true; }
@@ -276,8 +274,8 @@ swiotlb_late_init_with_default_size(size_t default_size)return -ENOMEM ; }if (order !=get_order (bytes)) { -printk (KERN_WARNING "Warning: only able to allocate %ld MB " -"for software IO TLB\n" , (PAGE_SIZE << order) >>20 ); +pr_warn ("only able to allocate %ld MB\n" , + (PAGE_SIZE << order) >>20 ); io_tlb_nslabs =SLABS_PER_PAGE << order; } rc =swiotlb_late_init_with_tbl (vstart, io_tlb_nslabs);
@@ -691,7 +689,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,return ret; err_warn: -pr_warn ("swiotlb: coherent allocation failed for device %s size=%zu\n" , +pr_warn ("coherent allocation failed for device %s size=%zu\n" ,dev_name (hwdev), size);dump_stack ();
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 37/51 vsock: lookup and setup guest_cid inside vhost_vsock_lock
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 6c083c2b8a0a110cad936bc0a2c089f0d8115175 ]
Multi vsocks may setup the same cid at the same time.
--- drivers/vhost/vsock.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/vhost/vsock.c +17 -8
@@ -50,11 +50,10 @@ static u32 vhost_transport_get_local_cid(void)return VHOST_VSOCK_DEFAULT_HOST_CID ; } -static struct vhost_vsock *vhost_vsock_get (u32 guest_cid) +static struct vhost_vsock *__vhost_vsock_get (u32 guest_cid) {struct vhost_vsock *vsock; -spin_lock_bh (&vhost_vsock_lock);list_for_each_entry (vsock, &vhost_vsock_list, list) {u32 other_cid = vsock->guest_cid;
@@ -63,15 +62,24 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid)continue ;if (other_cid == guest_cid) { -spin_unlock_bh (&vhost_vsock_lock);return vsock; } } -spin_unlock_bh (&vhost_vsock_lock);return NULL ; } +static struct vhost_vsock *vhost_vsock_get (u32 guest_cid) +{ +struct vhost_vsock *vsock; + +spin_lock_bh (&vhost_vsock_lock); + vsock =__vhost_vsock_get (guest_cid); +spin_unlock_bh (&vhost_vsock_lock); + +return vsock; +} +static void vhost_transport_do_send_pkt (struct vhost_vsock *vsock,struct vhost_virtqueue *vq)
@@ -607,11 +615,12 @@ static int vhost_vsock_set_cid(struct vhost_vsock *vsock, u64 guest_cid)return -EINVAL ;/* Refuse if CID is already in use */ - other =vhost_vsock_get (guest_cid); -if (other && other != vsock) -return -EADDRINUSE ; -spin_lock_bh (&vhost_vsock_lock); + other =__vhost_vsock_get (guest_cid); +if (other && other != vsock) { +spin_unlock_bh (&vhost_vsock_lock); +return -EADDRINUSE ; + } vsock->guest_cid = guest_cid;spin_unlock_bh (&vhost_vsock_lock);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 38/51 vhost/vsock: fix use-after-free in network stack callers
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 834e772c8db0c6a275d75315d90aba4ebbb1e249 ]
If the network stack calls .send_pkt()/.cancel_pkt() during .release(), a struct vhost_vsock use-after-free is possible. This occurs because .release() does not wait for other CPUs to stop using struct vhost_vsock.
Switch to an RCU-enabled hashtable (indexed by guest CID) so that .release() can wait for other CPUs by calling synchronize_rcu(). This also eliminates vhost_vsock_lock acquisition in the data path so it could have a positive effect on performance.
This is CVE-2018-14625 "kernel: use-after-free Read in vhost_transport_send_pkt".
--- drivers/vhost/vsock.c | 57 +++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 24 deletions(-)
drivers/vhost/vsock.c +33 -24
@@ -15,6 +15,7 @@#include <net/sock.h> #include <linux/virtio_vsock.h> #include <linux/vhost.h> +#include <linux/hashtable.h> #include <net/af_vsock.h> #include "vhost.h"
@@ -27,14 +28,14 @@ enum {/* Used to track all the vhost_vsock instances on the system. */ static DEFINE_SPINLOCK (vhost_vsock_lock); -static LIST_HEAD (vhost_vsock_list); +static DEFINE_READ_MOSTLY_HASHTABLE(vhost_vsock_hash, 8);struct vhost_vsock {struct vhost_dev dev;struct vhost_virtqueue vqs[2 ]; -/* Link to global vhost_vsock_list, protected by vhost_vsock_lock */ -struct list_head list; +/* Link to global vhost_vsock_hash, writes use vhost_vsock_lock */ +struct hlist_node hash;struct vhost_work send_pkt_work;spinlock_t send_pkt_list_lock;
@@ -50,11 +51,14 @@ static u32 vhost_transport_get_local_cid(void)return VHOST_VSOCK_DEFAULT_HOST_CID ; } -static struct vhost_vsock *__vhost_vsock_get (u32 guest_cid) +/* Callers that dereference the return value must hold vhost_vsock_lock or the +* RCU read lock. +*/ +static struct vhost_vsock *vhost_vsock_get (u32 guest_cid) {struct vhost_vsock *vsock; -list_for_each_entry (vsock, &vhost_vsock_list, list) { +hash_for_each_possible_rcu (vhost_vsock_hash, vsock, hash, guest_cid) {u32 other_cid = vsock->guest_cid;/* Skip instances that have no CID yet */
@@ -69,17 +73,6 @@ static struct vhost_vsock *__vhost_vsock_get(u32 guest_cid)return NULL ; } -static struct vhost_vsock *vhost_vsock_get (u32 guest_cid) -{ -struct vhost_vsock *vsock; - -spin_lock_bh (&vhost_vsock_lock); - vsock =__vhost_vsock_get (guest_cid); -spin_unlock_bh (&vhost_vsock_lock); - -return vsock; -} -static void vhost_transport_do_send_pkt (struct vhost_vsock *vsock,struct vhost_virtqueue *vq)
@@ -206,9 +199,12 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt)struct vhost_virtqueue *vq;int len = pkt->len; +rcu_read_lock (); +/* Find the vhost_vsock according to guest context id */ vsock =vhost_vsock_get (le64_to_cpu (pkt->hdr.dst_cid));if (!vsock) { +rcu_read_unlock ();virtio_transport_free_pkt (pkt);return -ENODEV ; }
@@ -223,6 +219,8 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt)spin_unlock_bh (&vsock->send_pkt_list_lock);vhost_work_queue (&vsock->dev, &vsock->send_pkt_work); + +rcu_read_unlock ();return len; }
@@ -232,12 +230,15 @@ vhost_transport_cancel_pkt(struct vsock_sock *vsk)struct vhost_vsock *vsock;struct virtio_vsock_pkt *pkt, *n;int cnt =0 ; +int ret = -ENODEV ;LIST_HEAD (freeme); +rcu_read_lock (); +/* Find the vhost_vsock according to guest context id */ vsock =vhost_vsock_get (vsk->remote_addr.svm_cid);if (!vsock) -return -ENODEV ; + goto out;spin_lock_bh (&vsock->send_pkt_list_lock);list_for_each_entry_safe (pkt, n, &vsock->send_pkt_list, list) {
@@ -263,7 +264,10 @@ vhost_transport_cancel_pkt(struct vsock_sock *vsk)vhost_poll_queue (&tx_vq->poll); } -return 0 ; + ret =0 ; +out: +rcu_read_unlock (); +return ret; } static struct virtio_vsock_pkt *
@@ -529,10 +533,6 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file)spin_lock_init (&vsock->send_pkt_list_lock);INIT_LIST_HEAD (&vsock->send_pkt_list);vhost_work_init (&vsock->send_pkt_work, vhost_transport_send_pkt_work); - -spin_lock_bh (&vhost_vsock_lock); -list_add_tail (&vsock->list, &vhost_vsock_list); -spin_unlock_bh (&vhost_vsock_lock);return 0 ; out:
@@ -573,9 +573,13 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file)struct vhost_vsock *vsock = file->private_data;spin_lock_bh (&vhost_vsock_lock); -list_del (&vsock->list); +if (vsock->guest_cid) +hash_del_rcu (&vsock->hash);spin_unlock_bh (&vhost_vsock_lock); +/* Wait for other CPUs to finish using vsock */ +synchronize_rcu (); +/* Iterating over all connections for all CIDs to find orphans is * inefficient. Room for improvement here. */ vsock_for_each_connected_socket (vhost_vsock_reset_orphans);
@@ -616,12 +620,17 @@ static int vhost_vsock_set_cid(struct vhost_vsock *vsock, u64 guest_cid)/* Refuse if CID is already in use */ spin_lock_bh (&vhost_vsock_lock); - other =__vhost_vsock_get (guest_cid); + other =vhost_vsock_get (guest_cid);if (other && other != vsock) {spin_unlock_bh (&vhost_vsock_lock);return -EADDRINUSE ; } + +if (vsock->guest_cid) +hash_del_rcu (&vsock->hash); + vsock->guest_cid = guest_cid; +hash_add_rcu (vhost_vsock_hash, &vsock->hash, guest_cid);spin_unlock_bh (&vhost_vsock_lock);return 0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 40/51 cifs: Fix separator when building path from dentry
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
commit c988de29ca161823db6a7125e803d597ef75b49c upstream.
Make sure to use the CIFS_DIR_SEP(cifs_sb) as path separator for prefixpath too. Fixes a bug with smb1 UNIX extensions.
--- fs/cifs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dir.c +1 -1
@@ -163,7 +163,7 @@ cifs_bp_rename_retry:cifs_dbg (FYI ,"using cifs_sb prepath <%s>\n" , cifs_sb->prepath);memcpy (full_path+dfsplen+1 , cifs_sb->prepath, pplen-1 ); - full_path[dfsplen] ='\\' ; + full_path[dfsplen] = dirsep;for (i =0 ; i < pplen-1 ; i++)if (full_path[dfsplen+1 +i] =='/' ) full_path[dfsplen+1 +i] =CIFS_DIR_SEP (cifs_sb);
Greg Kroah-Hartman
maintainerPATCH 43/51 tty: do not set TTY_IO_ERROR flag if console port
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chanho Park <[email protected]>
commit 2a48602615e0a2f563549c7d5c8d507f904cf96e upstream.
Since Commit 761ed4a94582 ('tty: serial_core: convert uart_close to use tty_port_close') and Commit 4dda864d7307 ('tty: serial_core: Fix serial console crash on port shutdown), a serial port which is used as console can be stuck when logging out if there is a remained process. After logged out, agetty will try to grab the serial port but it will be failed because the previous process did not release the port correctly. To fix this, TTY_IO_ERROR bit should not be enabled of tty_port_close if the port is console port.
Reproduce step:
- Run background processes from serial console
$ while true; do sleep 10; done &
- Log out
$ logout -> Stuck
- Read journal log by journalctl | tail
Jan 28 16:07:01 ubuntu systemd[1]: Stopped Serial Getty on ttyAMA0. Jan 28 16:07:01 ubuntu systemd[1]: Started Serial Getty on ttyAMA0. Jan 28 16:07:02 ubuntu agetty[1643]: /dev/ttyAMA0: not a tty
--- drivers/tty/tty_port.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/tty_port.c +2 -1
@@ -531,7 +531,8 @@ void tty_port_close(struct tty_port *porif (tty_port_close_start (port, tty, filp) ==0 )return ;tty_port_shutdown (port, tty); -set_bit (TTY_IO_ERROR , &tty->flags); +if (!port->console) +set_bit (TTY_IO_ERROR , &tty->flags);tty_port_close_end (port, tty);tty_port_tty_set (port,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 48/51 mac80211: fix reordering of buffered broadcast packets
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 9ec1190d065998650fd9260dea8cf3e1f56c0e8c upstream.
If the buffered broadcast queue contains packets, letting new packets bypass that queue can lead to heavy reordering, since the driver is probably throttling transmission of buffered multicast packets after beacons.
Keep buffering packets until the buffer has been cleared (and no client is in powersave mode).
--- net/mac80211/tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac80211/tx.c +2 -2
@@ -434,8 +434,8 @@ ieee80211_tx_h_multicast_ps_buf(struct iif (ieee80211_hw_check (&tx->local->hw,QUEUE_CONTROL )) info->hw_queue = tx->sdata->vif.cab_queue; -/* no stations in PS mode */ -if (!atomic_read (&ps->num_sta_ps)) +/* no stations in PS mode and no buffered packets */ +if (!atomic_read (&ps->num_sta_ps) &&skb_queue_empty (&ps->bc_buf))return TX_CONTINUE ; info->flags |=IEEE80211_TX_CTL_SEND_AFTER_DTIM ;
Greg Kroah-Hartman
maintainerPATCH 20/51 ARC: [zebu] Remove CONFIG_INITRAMFS_SOURCE from defconfigs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Brodkin <[email protected]>
Zebu boards were added in v4.9 and then renamed to "haps" in v4.10.
Thus backporting
commit 64234961c145 (ARC: configs: Remove CONFIG_INITRAMFS_SOURCE from defconfigs) we missed "zebu" defconfigs in v4.9.
Note this is only applicable to "linux-4.9.y"!
Spotted by KerneCI, see [1].
[1] https://storage.kernelci.org/stable/linux-4.9.y/v4.9.144/arc/zebu_hs_smp_defconfig/build.log
--- arch/arc/configs/zebu_hs_defconfig | 1 - arch/arc/configs/zebu_hs_smp_defconfig | 1 - 2 files changed, 2 deletions(-)
arch/arc/configs/zebu_hs_defconfig +0 -1
@@ -11,7 +11,6 @@ CONFIG_NAMESPACES=y # CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="../../arc_initramfs_hs/" CONFIG_EXPERT=y CONFIG_PERF_EVENTS=y # CONFIG_COMPAT_BRK is not set
arch/arc/configs/zebu_hs_smp_defconfig +0 -1
@@ -11,7 +11,6 @@ CONFIG_NAMESPACES=y # CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="../../arc_initramfs_hs/" CONFIG_EMBEDDED=y CONFIG_PERF_EVENTS=y # CONFIG_VM_EVENT_COUNTERS is not set
Greg Kroah-Hartman
maintainerPATCH 22/51 usb: appledisplay: Add 27" Apple Cinema Display
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Theissen <[email protected]>
commit d7859905301880ad3e16272399d26900af3ac496 upstream.
Add another Apple Cinema Display to the list of supported displays.
--- drivers/usb/misc/appledisplay.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/appledisplay.c +1 -0
@@ -64,6 +64,7 @@ static const struct usb_device_id appled { APPLEDISPLAY_DEVICE(0x921c) }, { APPLEDISPLAY_DEVICE(0x921d) }, { APPLEDISPLAY_DEVICE(0x9222) }, + { APPLEDISPLAY_DEVICE(0x9226) }, { APPLEDISPLAY_DEVICE(0x9236) },/* Terminating entry */
Greg Kroah-Hartman
maintainerPATCH 24/51 ALSA: usb-audio: Fix UAF decrement if card has no live interfaces in card.c
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Peng <[email protected]>
commit 5f8cf712582617d523120df67d392059eaf2fc4b upstream.
If a USB sound card reports 0 interfaces, an error condition is triggered and the function usb_audio_probe errors out. In the error path, there was a use-after-free vulnerability where the memory object of the card was first freed, followed by a decrement of the number of active chips. Moving the decrement above the atomic_dec fixes the UAF.
[ The original problem was introduced in 3.1 kernel, while it was
developed in a different form. The Fixes tag below indicates the original commit but it doesn't mean that the patch is applicable cleanly. -- tiwai ]
--- sound/usb/card.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/usb/card.c +4 -1
@@ -644,9 +644,12 @@ static int usb_audio_probe(struct usb_in __error:if (chip) { +/* chip->active is inside the chip->card object, +* decrement before memory is possibly returned. +*/ +atomic_dec (&chip->active);if (!chip->num_interfaces)snd_card_free (chip->card); -atomic_dec (&chip->active); }mutex_unlock (®ister_mutex);return err;
Greg Kroah-Hartman
maintainerPATCH 33/51 dmaengine: cppi41: delete channel from pending list when stop channel
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bin Liu <[email protected]>
commit 59861547ec9a9736e7882f6fb0c096a720ff811a upstream.
The driver defines three states for a cppi channel.
- idle: .chan_busy == 0 && not in .pending list
- pending: .chan_busy == 0 && in .pending list
- busy: .chan_busy == 1 && not in .pending list
There are cases in which the cppi channel could be in the pending state when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend() is called.
cppi41_stop_chan() has a bug for these cases to set channels to idle state. It only checks the .chan_busy flag, but not the .pending list, then later when cppi41_runtime_resume() is called the channels in .pending list will be transitioned to busy state.
Removing channels from the .pending list solves the problem.
--- drivers/dma/cppi41.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/dma/cppi41.c +15 -1
@@ -717,8 +717,22 @@ static int cppi41_stop_chan(struct dma_c desc_phys =lower_32_bits (c->desc_phys); desc_num = (desc_phys - cdd->descs_phys) /sizeof (struct cppi41_desc ); -if (!cdd->chan_busy[desc_num]) +if (!cdd->chan_busy[desc_num]) { +struct cppi41_channel *cc, *_ct; + +/* +* channels might still be in the pendling list if +* cppi41_dma_issue_pending() is called after +* cppi41_runtime_suspend() is called +*/ +list_for_each_entry_safe (cc, _ct, &cdd->pending, node) { +if (cc != c) +continue ; +list_del (&cc->node); +break ; + }return 0 ; + } ret =cppi41_tear_down_chan (c);if (ret)
Greg Kroah-Hartman
maintainerPATCH 39/51 Staging: lustre: remove two build warnings
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[for older kernels only, lustre has been removed from upstream]
When someone writes:
strncpy(dest, source, sizeof(source)); they really are just doing the same thing as: strcpy(dest, source);
but somehow they feel better because they are now using the "safe" version of the string functions. Cargo-cult programming at its finest...
gcc-8 rightfully warns you about doing foolish things like this. Now that the stable kernels are all starting to be built using gcc-8, let's get rid of this warning so that we do not have to gaze at this horror.
To dropt the warning, just convert the code to using strcpy() so that if someone really wants to audit this code and find all of the obvious problems, it will be easier to do so.
--- drivers/staging/lustre/lnet/lnet/config.c | 3 +-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lnet/lnet/config.c +1 -2
@@ -354,8 +354,7 @@ lnet_parse_networks(struct list_head *niCERROR ("Can't allocate net interface name\n" ); goto failed; } -strncpy (ni->ni_interfaces[niface], iface, -strlen (iface)); +strcpy (ni->ni_interfaces[niface], iface); niface++; iface = comma; }while (iface);
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -1
@@ -684,7 +684,7 @@ repeat_fid2path:memmove (ptr +strlen (gf->gf_path) +1 , ptr,strlen (ori_gf->gf_path)); -strncpy (ptr, gf->gf_path,strlen (gf->gf_path)); +strcpy (ptr, gf->gf_path); ptr +=strlen (gf->gf_path); *ptr ='/' ; }
Greg Kroah-Hartman
maintainerPATCH 41/51 staging: rtl8712: Fix possible buffer overrun
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Young Xiao <[email protected]>
commit 300cd664865bed5d50ae0a42fb4e3a6f415e8a10 upstream.
In commit 8b7a13c3f404 ("staging: r8712u: Fix possible buffer overrun") we fix a potential off by one by making the limit smaller. The better fix is to make the buffer larger. This makes it match up with the similar code in other drivers.
--- drivers/staging/rtl8712/mlme_linux.c | 2 +- drivers/staging/rtl8712/rtl871x_mlme.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/mlme_linux.c +1 -1
@@ -158,7 +158,7 @@ void r8712_report_sec_ie(struct _adapter p = buff; p +=sprintf (p,"ASSOCINFO(ReqIEs=" ); len = sec_ie[1 ] +2 ; - len = (len <IW_CUSTOM_MAX ) ? len :IW_CUSTOM_MAX -1 ; + len = (len <IW_CUSTOM_MAX ) ? len :IW_CUSTOM_MAX ;for (i =0 ; i < len; i++) p +=sprintf (p,"%02x" , sec_ie[i]); p +=sprintf (p,")" );
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
@@ -1365,7 +1365,7 @@ sint r8712_restruct_sec_ie(struct _adapt u8 *out_ie, uint in_len) {u8 authmode =0 , match; -u8 sec_ie[255 ], uncst_oui[4 ], bkup_ie[255 ]; +u8 sec_ie[IW_CUSTOM_MAX ], uncst_oui[4 ], bkup_ie[255 ];u8 wpa_oui[4 ] = {0x0 ,0x50 ,0xf2 ,0x01 };uint ielength, cnt, remove_cnt;int iEntry;
Greg Kroah-Hartman
maintainerPATCH 42/51 tty: serial: 8250_mtk: always resume the device in probe.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Shih <[email protected]>
commit 100bc3e2bebf95506da57cbdf5f26b25f6da4c81 upstream.
serial8250_register_8250_port calls uart_config_port, which calls config_port on the port before it tries to power on the port. So we need the port to be on before calling serial8250_register_8250_port. Change the code to always do a runtime resume in probe before registering port, and always do a runtime suspend in remove.
This basically reverts the change in commit 68e5fc4a255a ("tty: serial:
8250_mtk: use pm_runtime callbacks for enabling"), but still use pm_runtime callbacks.
--- drivers/tty/serial/8250/8250_mtk.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/tty/serial/8250/8250_mtk.c +7 -9
@@ -225,17 +225,17 @@ static int mtk8250_probe(struct platformplatform_set_drvdata (pdev, data); -pm_runtime_enable (&pdev->dev); -if (!pm_runtime_enabled (&pdev->dev)) { - err =mtk8250_runtime_resume (&pdev->dev); -if (err) -return err; - } + err =mtk8250_runtime_resume (&pdev->dev); +if (err) +return err; data->line =serial8250_register_8250_port (&uart);if (data->line <0 )return data->line; +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); +return 0 ; }
@@ -246,13 +246,11 @@ static int mtk8250_remove(struct platforpm_runtime_get_sync (&pdev->dev);serial8250_unregister_port (data->line); +mtk8250_runtime_suspend (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_runtime_put_noidle (&pdev->dev); -if (!pm_runtime_status_suspended (&pdev->dev)) -mtk8250_runtime_suspend (&pdev->dev); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 44/51 kgdboc: fix KASAN global-out-of-bounds bug in param_set_kgdboc_var()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Macpaul Lin <[email protected]>
commit dada6a43b0402eba438a17ac86fdc64ac56a4607 upstream.
This patch is trying to fix KE issue due to
"BUG: KASAN: global-out-of-bounds in param_set_kgdboc_var+0x194/0x198" reported by Syzkaller scan."
[26364:syz-executor0][name:report8t]BUG: KASAN: global-out-of-bounds in param_set_kgdboc_var+0x194/0x198 [26364:syz-executor0][name:report&]Read of size 1 at addr ffffff900e44f95f by task syz-executor0/26364 [26364:syz-executor0][name:report&]
[26364:syz-executor0]CPU: 7 PID: 26364 Comm: syz-executor0 Tainted: G W 0 [26364:syz-executor0]Call trace:
[26364:syz-executor0][<ffffff9008095cf8>] dump_bacIctrace+Ox0/0x470 [26364:syz-executor0][<ffffff9008096de0>] show_stack+0x20/0x30 [26364:syz-executor0][<ffffff90089cc9c8>] dump_stack+Oxd8/0x128 [26364:syz-executor0][<ffffff90084edb38>] print_address_description +0x80/0x4a8 [26364:syz-executor0][<ffffff90084ee270>] kasan_report+Ox178/0x390 [26364:syz-executor0][<ffffff90084ee4a0>] _asan_report_loadi_noabort+Ox18/0x20 [26364:syz-executor0][<ffffff9008b092ac>] param_set_kgdboc_var+Ox194/0x198 [26364:syz-executor0][<ffffff900813af64>] param_attr_store+Ox14c/0x270 [26364:syz-executor0][<ffffff90081394c8>] module_attr_store+0x60/0x90 [26364:syz-executor0][<ffffff90086690c0>] sysfs_kl_write+Ox100/0x158 [26364:syz-executor0][<ffffff9008666d84>] kernfs_fop_write+0x27c/0x3a8 [26364:syz-executor0][<ffffff9008508264>] do_loop_readv_writev+0x114/0x1b0 [26364:syz-executor0][<ffffff9008509ac8>] do_readv_writev+0x4f8/0x5e0 [26364:syz-executor0][<ffffff9008509ce4>] vfs_writev+0x7c/Oxb8 [26364:syz-executor0][<ffffff900850ba64>] SyS_writev+Oxcc/0x208 [26364:syz-executor0][<ffffff90080883f0>] elO_svc_naked +0x24/0x28 [26364:syz-executor0][name:report&]
[26364:syz-executor0][name:report&]The buggy address belongs to the variable:
[26364:syz-executor0][name:report&] kgdb_tty_line+Ox3f/0x40 [26364:syz-executor0][name:report&]
[26364:syz-executor0][name:report&]Memory state around the buggy address:
[26364:syz-executor0] ffffff900e44f800: 00 00 00 00 00 04 fa fa fa fa fa fa 00 fa fa fa [26364:syz-executor0] ffffff900e44f880: fa fa fa fa 00 fa fa fa fa fa fa fa 00 fa fa fa [26364:syz-executor0]> ffffff900e44f900: fa fa fa fa 04 fa fa fa fa fa fa fa 00 00 00 00
[26364:syz-executor0][name:report&] ^
[26364:syz-executor0] ffffff900e44f980: 00 fa fa fa fa fa fa fa 04 fa fa fa fa fa fa fa [26364:syz-executor0] ffffff900e44fa00: 04 fa fa fa fa fa fa fa 00 fa fa fa fa fa fa fa [26364:syz-executor0][name:report&]
[26364:syz-executor0][name:panic&]Disabling lock debugging due to kernel taint [26364:syz-executor0]------------[cut here]------------
After checking the source code, we've found there might be an out-of-bounds access to "config[len - 1]" array when the variable "len" is zero.
--- drivers/tty/serial/kgdboc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/kgdboc.c +2 -2
@@ -232,7 +232,7 @@ static void kgdboc_put_char(u8 chr)static int param_set_kgdboc_var (const char *kmessage,struct kernel_param *kp) { -int len =strlen (kmessage); +size_t len =strlen (kmessage);if (len >=MAX_CONFIG_LEN ) {printk (KERN_ERR "kgdboc: config string too long\n" );
@@ -254,7 +254,7 @@ static int param_set_kgdboc_var(const chstrcpy (config, kmessage);/* Chop out \n char as a result of echo */ -if (config[len -1 ] =='\n' ) +if (len && config[len -1 ] =='\n' ) config[len -1 ] ='\0' ;if (configured ==1 )
Greg Kroah-Hartman
maintainerPATCH 45/51 mac80211_hwsim: Timer should be initialized before device registered
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasyl Vavrychuk <[email protected]>
commit a1881c9b8a1edef0a5ae1d5c1b61406fe3402114 upstream.
Otherwise if network manager starts configuring Wi-Fi interface immidiatelly after getting notification of its creation, we will get NULL pointer dereference:
BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffff95ae94c8>] hrtimer_active+0x28/0x50 ... Call Trace: [<ffffffff95ae9997>] ? hrtimer_try_to_cancel+0x27/0x110 [<ffffffff95ae9a95>] ? hrtimer_cancel+0x15/0x20 [<ffffffffc0803bf0>] ? mac80211_hwsim_config+0x140/0x1c0 [mac80211_hwsim]
--- drivers/net/wireless/mac80211_hwsim.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +4 -4
@@ -2633,6 +2633,10 @@ static int mac80211_hwsim_new_radio(struif (param->no_vif)ieee80211_hw_set (hw,NO_AUTO_VIF ); +tasklet_hrtimer_init (&data->beacon_timer, + mac80211_hwsim_beacon, +CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); + err =ieee80211_register_hw (hw);if (err <0 ) { printk(KERN_DEBUG "mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
@@ -2657,10 +2661,6 @@ static int mac80211_hwsim_new_radio(stru data->debugfs, data, &hwsim_simulate_radar); -tasklet_hrtimer_init (&data->beacon_timer, - mac80211_hwsim_beacon, -CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); -spin_lock_bh (&hwsim_radio_lock);list_add_tail (&data->list, &hwsim_radios);spin_unlock_bh (&hwsim_radio_lock);
Greg Kroah-Hartman
maintainerPATCH 46/51 mac80211: Clear beacon_int in ieee80211_do_stop
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Greear <[email protected]>
commit 5c21e8100dfd57c806e833ae905e26efbb87840f upstream.
This fixes stale beacon-int values that would keep a netdev from going up.
To reproduce:
Create two VAP on one radio.
vap1 has beacon-int 100, start it.
vap2 has beacon-int 240, start it (and it will fail
because beacon-int mismatch).
reconfigure vap2 to have beacon-int 100 and start it.
It will fail because the stale beacon-int 240 will be used in the ifup path and hostapd never gets a chance to set the new beacon interval.
--- net/mac80211/iface.c | 2 ++ 1 file changed, 2 insertions(+)
net/mac80211/iface.c +2 -0
@@ -1025,6 +1025,8 @@ static void ieee80211_do_stop(struct ieeif (local->open_count ==0 )ieee80211_clear_tx_pending (local); + sdata->vif.bss_conf.beacon_int =0 ; +/* * If the interface goes down while suspended, presumably because * the device was unplugged and that happens before our resume,
Greg Kroah-Hartman
maintainerPATCH 47/51 mac80211: ignore tx status for PS stations in ieee80211_tx_status_ext
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit a317e65face482371de30246b6494feb093ff7f9 upstream.
Make it behave like regular ieee80211_tx_status calls, except for the lack of filtered frame processing.
This fixes spurious low-ack triggered disconnections with powersave clients connected to an AP.
--- net/mac80211/status.c | 2 ++ 1 file changed, 2 insertions(+)
net/mac80211/status.c +2 -0
@@ -660,6 +660,8 @@ void ieee80211_tx_status_noskb(struct ie/* Track when last TDLS packet was ACKed */ if (test_sta_flag (sta,WLAN_STA_TDLS_PEER_AUTH )) sta->status_stats.last_tdls_pkt_time = jiffies; + }else if (test_sta_flag (sta,WLAN_STA_PS_STA )) { +return ; }else {ieee80211_lost_packet (sta, info); }
Greg Kroah-Hartman
maintainerPATCH 49/51 mac80211: ignore NullFunc frames in the duplicate detection
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 990d71846a0b7281bd933c34d734e6afc7408e7e upstream.
NullFunc packets should never be duplicate just like QoS-NullFunc packets.
We saw a client that enters / exits power save with NullFunc frames (and not with QoS-NullFunc) despite the fact that the association supports HT.
This specific client also re-uses a non-zero sequence number for different NullFunc frames.
At some point, the client had to send a retransmission of the NullFunc frame and we dropped it, leading to a misalignment in the power save state.
Fix this by never consider a NullFunc frame as duplicate, just like we do for QoS NullFunc frames.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=201449
--- net/mac80211/rx.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/rx.c +1 -0
@@ -1230,6 +1230,7 @@ ieee80211_rx_h_check_dup(struct ieee8021return RX_CONTINUE ;if (ieee80211_is_ctl (hdr->frame_control) || +ieee80211_is_nullfunc (hdr->frame_control) ||ieee80211_is_qos_nullfunc (hdr->frame_control) ||is_multicast_ether_addr (hdr->addr1))return RX_CONTINUE ;
Greg Kroah-Hartman
maintainerPATCH 50/51 kbuild: fix linker feature test macros when cross compiling with Clang
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Desaulniers <[email protected]>
(commit 86a9df597cdd564d2d29c65897bcad42519e3678 upstream)
I was not seeing my linker flags getting added when using ld-option when cross compiling with Clang. Upon investigation, this seems to be due to a difference in how GCC vs Clang handle cross compilation.
GCC is configured at build time to support one backend, that is implicit when compiling. Clang is explicit via the use of -target <triple> and ships with all supported backends by default.
GNU Make feature test macros that compile then link will always fail when cross compiling with Clang unless Clang's triple is passed along to the compiler. For example:
$ clang -x c /dev/null -c -o temp.o $ aarch64-linux-android/bin/ld -E temp.o aarch64-linux-android/bin/ld: unknown architecture of input file `temp.o' is incompatible with aarch64 output aarch64-linux-android/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400078 $ echo $? 1
$ clang -target aarch64-linux-android- -x c /dev/null -c -o temp.o $ aarch64-linux-android/bin/ld -E temp.o aarch64-linux-android/bin/ld: warning: cannot find entry symbol _start; defaulting to 00000000004002e4 $ echo $? 0
This causes conditional checks that invoke $(CC) without the target triple, then $(LD) on the result, to always fail.
--- scripts/Kbuild.include | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/Kbuild.include +3 -2
@@ -162,12 +162,13 @@ cc-ifversion = $(shell [ $(cc-version) $ # cc-ldoption # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) cc-ldoption = $(call try-run,\ - $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) # ld-option # Usage: LDFLAGS += $(call ld-option, -X) ld-option = $(call try-run,\ - $(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) + $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -x c /dev/null -c -o "$$TMPO"; \ + $(LD) $(LDFLAGS) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) # ar-option # Usage: KBUILD_ARFLAGS := $(call ar-option,D)
Greg Kroah-Hartman
maintainerPATCH 51/51 kbuild: allow to use GCC toolchain not in Clang search path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Agner <[email protected]>
(commit ef8c4ed9db80261f397f0c0bf723684601ae3b52 upstream)
When using a GCC cross toolchain which is not in a compiled in Clang search path, Clang reverts to the system assembler and linker. This leads to assembler or linker errors, depending on which tool is first used for a given architecture.
It seems that Clang is not searching $PATH for a matching assembler or linker.
Make sure that Clang picks up the correct assembler or linker by passing the cross compilers bin directory as search path.
This allows to use Clang provided by distributions with GCC toolchains not in /usr/bin.
[ND: adjusted to context, due to adjusting the context of my previous backport of upstream's ae6b289a3789]
--- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Makefile +5 -3
@@ -512,13 +512,15 @@ endif ifeq ($(cc-name),clang) ifneq ($(CROSS_COMPILE),) CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%)) -GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..) +GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) +CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) +GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif ifneq ($(GCC_TOOLCHAIN),) CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN) endif -KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) -KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) +KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) +KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
Greg Kroah-Hartman
maintainerPATCH 26/51 ALSA: pcm: Fix starvation on down_write_nonblock()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chanho Min <[email protected]>
commit b888a5f713e4d17faaaff24316585a4eb07f35b7 upstream.
Commit 67ec1072b053 ("ALSA: pcm: Fix rwsem deadlock for non-atomic PCM stream") fixes deadlock for non-atomic PCM stream. But, This patch causes antother stuck.
If writer is RT thread and reader is a normal thread, the reader thread will be difficult to get scheduled. It may not give chance to release readlocks and writer gets stuck for a long time if they are pinned to single cpu.
The deadlock described in the previous commit is because the linux rwsem queues like a FIFO. So, we might need non-FIFO writelock, not non-block one.
My suggestion is that the writer gives reader a chance to be scheduled by using the minimum msleep() instaed of spinning without blocking by writer. Also, The *_nonblock may be changed to *_nonfifo appropriately to this concept.
In terms of performance, when trylock is failed, this minimum periodic msleep will have the same performance as the tick-based schedule()/wake_up_q().
[ Although this has a fairly high performance penalty, the relevant
code path became already rare due to the previous commit ("ALSA:
pcm: Call snd_pcm_unlink() conditionally at closing"). That is, now this unconditional msleep appears only when using linked streams, and this must be a rare case. So we accept this as a quick workaround until finding a more suitable one -- tiwai ]
--- sound/core/pcm_native.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
sound/core/pcm_native.c +6 -5
@@ -35,6 +35,7 @@#include <sound/timer.h> #include <sound/minors.h> #include <linux/uio.h> +#include <linux/delay.h> /* * Compatibility
@@ -78,12 +79,12 @@ static DECLARE_RWSEM(snd_pcm_link_rwsem)* and this may lead to a deadlock when the code path takes read sem * twice (e.g. one in snd_pcm_action_nonatomic() and another in * snd_pcm_stream_lock()). As a (suboptimal) workaround, let writer to -* spin until it gets the lock. +* sleep until all the readers are completed without blocking by writer. */ -static inline void down_write_nonblock (struct rw_semaphore *lock) +static inline void down_write_nonfifo (struct rw_semaphore *lock) {while (!down_write_trylock (lock)) -cond_resched (); +msleep (1 ); }/**
@@ -1825,7 +1826,7 @@ static int snd_pcm_link(struct snd_pcm_s res = -ENOMEM ; goto _nolock; } -down_write_nonblock (&snd_pcm_link_rwsem); +down_write_nonfifo (&snd_pcm_link_rwsem);write_lock_irq (&snd_pcm_link_rwlock); if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || substream->runtime->status->state != substream1->runtime->status->state ||
@@ -1872,7 +1873,7 @@ static int snd_pcm_unlink(struct snd_pcmstruct snd_pcm_substream *s;int res =0 ; -down_write_nonblock (&snd_pcm_link_rwsem); +down_write_nonfifo (&snd_pcm_link_rwsem);write_lock_irq (&snd_pcm_link_rwlock);if (!snd_pcm_stream_linked (substream)) { res = -EALREADY ;
Greg Kroah-Hartman
maintainerPATCH 27/51 ALSA: pcm: Call snd_pcm_unlink() conditionally at closing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit b51abed8355e5556886623b2772fa6b7598d2282 upstream.
Currently the PCM core calls snd_pcm_unlink() always unconditionally at closing a stream. However, since snd_pcm_unlink() invokes the global rwsem down, the lock can be easily contended. More badly, when a thread runs in a high priority RT-FIFO, it may stall at spinning.
Basically the call of snd_pcm_unlink() is required only for the linked streams that are already rare occasion. For normal use cases, this code path is fairly superfluous.
As an optimization (and also as a workaround for the RT problem above in normal situations without linked streams), this patch adds a check before calling snd_pcm_unlink() and calls it only when needed.
--- sound/core/pcm_native.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/pcm_native.c +2 -1
@@ -2225,7 +2225,8 @@ int snd_pcm_hw_constraints_complete(strustatic void pcm_release_private (struct snd_pcm_substream *substream) { -snd_pcm_unlink (substream); +if (snd_pcm_stream_linked (substream)) +snd_pcm_unlink (substream); }void snd_pcm_release_substream (struct snd_pcm_substream *substream)
Greg Kroah-Hartman
maintainerPATCH 28/51 ALSA: pcm: Fix interval evaluation with openmin/max
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 5363857b916c1f48027e9b96ee8be8376bf20811 upstream.
As addressed in alsa-lib (commit b420056604f0), we need to fix the case where the evaluation of PCM interval "(x x+1]" leading to -EINVAL. After applying rules, such an interval may be translated as "(x x+1)".
--- include/sound/pcm_params.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/sound/pcm_params.h +3 -1
@@ -247,11 +247,13 @@ static inline int snd_interval_empty(constatic inline int snd_interval_single (const struct snd_interval *i) {return (i->min == i->max || - (i->min +1 == i->max && i->openmax)); + (i->min +1 == i->max && (i->openmin || i->openmax))); }static inline int snd_interval_value (const struct snd_interval *i) { +if (i->openmin && !i->openmax) +return i->max;return i->min; }
Greg Kroah-Hartman
maintainerPATCH 30/51 virtio/s390: avoid race on vcdev->config
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Halil Pasic <[email protected]>
commit 2448a299ec416a80f699940a86f4a6d9a4f643b1 upstream.
Currently we have a race on vcdev->config in virtio_ccw_get_config() and in virtio_ccw_set_config().
This normally does not cause problems, as these are usually infrequent operations. However, for some devices writing to/reading from the config space can be triggered through sysfs attributes. For these, userspace can force the race by increasing the frequency.
Message-Id: <[email protected]>
--- drivers/s390/virtio/virtio_ccw.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/s390/virtio/virtio_ccw.c +8 -2
@@ -837,6 +837,7 @@ static void virtio_ccw_get_config(structint ret;struct ccw1 *ccw;void *config_area; +unsigned long flags; ccw =kzalloc (sizeof (*ccw),GFP_DMA |GFP_KERNEL );if (!ccw)
@@ -855,11 +856,13 @@ static void virtio_ccw_get_config(structif (ret) goto out_free; +spin_lock_irqsave (&vcdev->lock, flags);memcpy (vcdev->config, config_area, offset + len); -if (buf) -memcpy (buf, &vcdev->config[offset], len);if (vcdev->config_ready < offset + len) vcdev->config_ready = offset + len; +spin_unlock_irqrestore (&vcdev->lock, flags); +if (buf) +memcpy (buf, config_area + offset, len); out_free:kfree (config_area);
@@ -873,6 +876,7 @@ static void virtio_ccw_set_config(structstruct virtio_ccw_device *vcdev =to_vc_device (vdev);struct ccw1 *ccw;void *config_area; +unsigned long flags; ccw =kzalloc (sizeof (*ccw),GFP_DMA |GFP_KERNEL );if (!ccw)
@@ -885,9 +889,11 @@ static void virtio_ccw_set_config(struct/* Make sure we don't overwrite fields. */ if (vcdev->config_ready < offset)virtio_ccw_get_config (vdev,0 ,NULL , offset); +spin_lock_irqsave (&vcdev->lock, flags);memcpy (&vcdev->config[offset], buf, len);/* Write the config area to the host. */ memcpy (config_area, vcdev->config,sizeof (vcdev->config)); +spin_unlock_irqrestore (&vcdev->lock, flags); ccw->cmd_code =CCW_CMD_WRITE_CONF ; ccw->flags =0 ; ccw->count = offset + len;
Greg Kroah-Hartman
maintainerPATCH 23/51 USB: check usb_get_extra_descriptor for proper size
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Payer <[email protected]>
commit 704620afc70cf47abb9d6a1a57f3825d2bca49cf upstream.
When reading an extra descriptor, we need to properly check the minimum and maximum size allowed, to prevent from invalid data being sent by a device.
--- drivers/usb/core/hub.c | 2 +- drivers/usb/core/usb.c | 6 +++--- drivers/usb/host/hwa-hc.c | 2 +- include/linux/usb.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/usb/core/hub.c +1 -1
@@ -2225,7 +2225,7 @@ static int usb_enumerate_device_otg(stru/* descriptor may appear anywhere in config */ err =__usb_get_extra_descriptor (udev->rawdescriptors[0 ],le16_to_cpu (udev->config[0 ].desc.wTotalLength), -USB_DT_OTG , (void **) &desc); +USB_DT_OTG , (void **) &desc,sizeof (*desc));if (err || !(desc->bmAttributes &USB_OTG_HNP ))return 0 ;
drivers/usb/core/usb.c +3 -3
@@ -696,14 +696,14 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_*/ int __usb_get_extra_descriptor (char *buffer,unsigned size, -unsigned char type,void **ptr) +unsigned char type,void **ptr,size_t minsize) {struct usb_descriptor_header *header;while (size >=sizeof (struct usb_descriptor_header )) { header = (struct usb_descriptor_header *)buffer; -if (header->bLength <2 ) { +if (header->bLength <2 || header->bLength > size) { printk(KERN_ERR "%s: bogus descriptor, type %d length %d\n", usbcore_name,
@@ -712,7 +712,7 @@ int __usb_get_extra_descriptor(char *bufreturn -1 ; } -if (header->bDescriptorType == type) { +if (header->bDescriptorType == type && header->bLength >= minsize) { *ptr = header;return 0 ; }
drivers/usb/host/hwa-hc.c +1 -1
@@ -654,7 +654,7 @@ static int hwahc_security_create(struct top = itr + itr_size; result =__usb_get_extra_descriptor (usb_dev->rawdescriptors[index],le16_to_cpu (usb_dev->actconfig->desc.wTotalLength), -USB_DT_SECURITY , (void **) &secd); +USB_DT_SECURITY , (void **) &secd,sizeof (*secd));if (result ==-1 ) {dev_warn (dev,"BUG? WUSB host has no security descriptors\n" );return 0 ;
include/linux/usb.h +2 -2
@@ -336,11 +336,11 @@ struct usb_host_bos { };int __usb_get_extra_descriptor (char *buffer,unsigned size, -unsigned char type,void **ptr); +unsigned char type,void **ptr,size_t min);#define usb_get_extra_descriptor (ifpoint, type, ptr) \ __usb_get_extra_descriptor((ifpoint)->extra, \ (ifpoint)->extralen, \ - type, (void **)ptr) + type, (void **)ptr, sizeof(**(ptr)))/* ----------------------------------------------------------------------- */
stable-rc/linux-4.9.y boot: 102 boots: 0 failed, 95 passed with 6 offline, 1 untried/unknown (v4.9.144-52-g8705173bd0fe)
stable-rc/linux-4.9.y boot: 102 boots: 0 failed, 95 passed with 6 offline, 1 untried/unknown (v4.9.144-52-g8705173bd0fe)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-4.9.y/kernel/v4.9.144-52-g8705173bd0fe/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-4.9.y/kernel/v4.9.144-52-g8705173bd0fe/
Tree: stable-rc
Branch: linux-4.9.y
Git Describe: v4.9.144-52-g8705173bd0fe
Git Commit: 8705173bd0fed9cbde3a23f8b1680e9f997d7019
Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 49 unique boards, 21 SoC families, 13 builds out of 193
Offline Platforms:
arm:
mvebu_v7_defconfig:
armada-xp-openblocks-ax3-4: 1 offline lab
multi_v7_defconfig:
armada-xp-openblocks-ax3-4: 1 offline lab
stih410-b2120: 1 offline lab
tegra30-beaver: 1 offline lab
zynq-zc702: 1 offline lab
tegra_defconfig:
tegra30-beaver: 1 offline lab
---
For more info write to <[email protected]>
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.145 release. There are 51 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 Dec 13 15:15:52 UTC 2018. 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.9.145-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.145 release. There are 51 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 Dec 13 15:15:52 UTC 2018. 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.9.145-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.9.145-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: 8705173bd0fed9cbde3a23f8b1680e9f997d7019
git describe: v4.9.144-52-g8705173bd0fe
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.144-52-g8705173bd0fe
No regressions (compared to build v4.9.144)
No fixes (compared to build v4.9.144)
Ran 21410 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
-----------
* boot
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* spectre-meltdown-checker-test
* ltp-filecaps-tests
* ltp-open-posix-tests
* 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.9.145 release. There are 51 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 Dec 13 15:15:52 UTC 2018. Anything received after that time might be too late.
Build results:
total: 171 pass: 171 fail: 0 Qemu test results: total: 311 pass: 311 fail: 0
Details are available at https://kerneltests.org/builders/.
Guenter