tools: bpf: Use !building_out_of_srctree to determine srctree
Subsystems (20)
Sasha Levin
maintainerPATCH 1/99 tools: bpf: Use !building_out_of_srctree to determine srctree
From: Shuah Khan <[email protected]>
[ Upstream commit 55d554f5d14071f7c2c5dbd88d0a2eb695c97d16 ]
make TARGETS=bpf kselftest fails with:
Makefile:127: tools/build/Makefile.include: No such file or directory
When the bpf tool make is invoked from tools Makefile, srctree is cleared and the current logic check for srctree equals to empty string to determine srctree location from CURDIR.
When the build in invoked from selftests/bpf Makefile, the srctree is set to "." and the same logic used for srctree equals to empty is needed to determine srctree.
Check building_out_of_srctree undefined as the condition for both cases to fix "make TARGETS=bpf kselftest" build failure.
--- tools/bpf/Makefile | 6 +++++- tools/lib/bpf/Makefile | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-)
tools/bpf/Makefile +5 -1
@@ -12,7 +12,11 @@ INSTALL ?= install CFLAGS += -Wall -O2 CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include -ifeq ($(srctree),) +# This will work when bpf is built in tools env. where srctree +# isn't set and when invoked from selftests build, where srctree +# is set to ".". building_out_of_srctree is undefined for in srctree +# builds +ifndef building_out_of_srctree srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) endif
tools/lib/bpf/Makefile +5 -1
@@ -7,7 +7,11 @@ BPF_EXTRAVERSION = 4 MAKEFLAGS += --no-print-directory -ifeq ($(srctree),) +# This will work when bpf is built in tools env. where srctree +# isn't set and when invoked from selftests build, where srctree +# is a ".". building_out_of_srctree is undefined for in srctree +# builds +ifndef building_out_of_srctree srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) srctree := $(patsubst %/,%,$(dir $(srctree)))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/99 iommu/arm-smmu: Free context bitmap in the err path of arm_smmu_init_domain_context
From: Liu Xiang <[email protected]>
[ Upstream commit 6db7bfb431220d78e34d2d0afdb7c12683323588 ]
When alloc_io_pgtable_ops is failed, context bitmap which is just allocated by __arm_smmu_alloc_bitmap should be freed to release the resource.
--- drivers/iommu/arm-smmu.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/arm-smmu.c +1 -0
@@ -936,6 +936,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,return 0 ; out_clear_smmu: +__arm_smmu_free_bitmap (smmu->context_map, cfg->cbndx); smmu_domain->smmu =NULL ; out_unlock:mutex_unlock (&smmu_domain->init_mutex);
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 3/99 iommu/io-pgtable-arm: Correct Mali attributes
In reply to Sasha LevinFrom: Robin Murphy <[email protected]>
[ Upstream commit 52f325f4eb321ea2e8a0779f49a3866be58bc694 ]
Whilst Midgard's MEMATTR follows a similar principle to the VMSA MAIR, the actual attribute values differ, so although it currently appears to work to some degree, we probably shouldn't be using our standard stage 1 MAIR for that. Instead, generate a reasonable MEMATTR with attribute values borrowed from the kbase driver; at this point we'll be overriding or ignoring pretty much all of the LPAE config, so just implement these Mali details in a dedicated allocator instead of pretending to subclass the standard VMSA format.
--- drivers/iommu/io-pgtable-arm.c | 53 +++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 13 deletions(-)
drivers/iommu/io-pgtable-arm.c +40 -13
@@ -167,6 +167,9 @@#define ARM_MALI_LPAE_TTBR_READ_INNER BIT(2)#define ARM_MALI_LPAE_TTBR_SHARE_OUTER BIT(4) +#define ARM_MALI_LPAE_MEMATTR_IMP_DEF 0x88ULL +#define ARM_MALI_LPAE_MEMATTR_WRITE_ALLOC 0x8DULL +/* IOPTE accessors */ #define iopte_deref (pte,d) __va(iopte_to_paddr(pte, d))
@@ -1013,27 +1016,51 @@ arm_32_lpae_alloc_pgtable_s2(struct io_pgtable_cfg *cfg, void *cookie)static struct io_pgtable *arm_mali_lpae_alloc_pgtable (struct io_pgtable_cfg *cfg,void *cookie) { -struct io_pgtable *iop; +struct arm_lpae_io_pgtable *data; + +/* No quirks for Mali (hopefully) */ +if (cfg->quirks) +return NULL ;if (cfg->ias !=48 || cfg->oas >40 )return NULL ; cfg->pgsize_bitmap &= (SZ_4K |SZ_2M |SZ_1G ); - iop =arm_64_lpae_alloc_pgtable_s1 (cfg, cookie); -if (iop) { -u64 mair, ttbr; -/* Copy values as union fields overlap */ - mair = cfg->arm_lpae_s1_cfg.mair[0 ]; - ttbr = cfg->arm_lpae_s1_cfg.ttbr[0 ]; + data =arm_lpae_alloc_pgtable (cfg); +if (!data) +return NULL ; - cfg->arm_mali_lpae_cfg.memattr = mair; - cfg->arm_mali_lpae_cfg.transtab = ttbr | -ARM_MALI_LPAE_TTBR_READ_INNER | -ARM_MALI_LPAE_TTBR_ADRMODE_TABLE ; - } +/* +* MEMATTR: Mali has no actual notion of a non-cacheable type, so the +* best we can do is mimic the out-of-tree driver and hope that the +* "implementation-defined caching policy" is good enough. Similarly, +* we'll use it for the sake of a valid attribute for our 'device' +* index, although callers should never request that in practice. +*/ + cfg->arm_mali_lpae_cfg.memattr = + (ARM_MALI_LPAE_MEMATTR_IMP_DEF + <<ARM_LPAE_MAIR_ATTR_SHIFT (ARM_LPAE_MAIR_ATTR_IDX_NC )) | + (ARM_MALI_LPAE_MEMATTR_WRITE_ALLOC + <<ARM_LPAE_MAIR_ATTR_SHIFT (ARM_LPAE_MAIR_ATTR_IDX_CACHE )) | + (ARM_MALI_LPAE_MEMATTR_IMP_DEF + <<ARM_LPAE_MAIR_ATTR_SHIFT (ARM_LPAE_MAIR_ATTR_IDX_DEV )); -return iop; + data->pgd =__arm_lpae_alloc_pages (data->pgd_size,GFP_KERNEL , cfg); +if (!data->pgd) + goto out_free_data; + +/* Ensure the empty pgd is visible before TRANSTAB can be written */ +wmb (); + + cfg->arm_mali_lpae_cfg.transtab =virt_to_phys (data->pgd) | +ARM_MALI_LPAE_TTBR_READ_INNER | +ARM_MALI_LPAE_TTBR_ADRMODE_TABLE ; +return &data->iop; + +out_free_data: +kfree (data); +return NULL ; }struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s1_init_fns = {
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 4/99 iommu/io-pgtable-arm: Support all Mali configurations
In reply to Sasha LevinFrom: Robin Murphy <[email protected]>
[ Upstream commit 1be08f458d1602275b02f5357ef069957058f3fd ]
In principle, Midgard GPUs supporting smaller VA sizes should only require 3-level pagetables, since level 0 only resolves bits 48:40 of the address. However, the kbase driver does not appear to have any notion of a variable start level, and empirically T720 and T820 rapidly blow up with translation faults unless given a full 4-level table, despite only supporting a 33-bit VA size.
The 'real' IAS value is still valuable in terms of validating addresses on map/unmap, so tweak the allocator to allow smaller values while still forcing the resultant tables to the full 4 levels. As far as I can test, this should make all known Midgard variants happy.
--- drivers/iommu/io-pgtable-arm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iommu/io-pgtable-arm.c +6 -1
@@ -1022,7 +1022,7 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)if (cfg->quirks)return NULL ; -if (cfg->ias !=48 || cfg->oas >40 ) +if (cfg->ias >48 || cfg->oas >40 )return NULL ; cfg->pgsize_bitmap &= (SZ_4K |SZ_2M |SZ_1G );
@@ -1031,6 +1031,11 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)if (!data)return NULL ; +/* Mali seems to need a full 4-level table regardless of IAS */ +if (data->levels <ARM_LPAE_MAX_LEVELS ) { + data->levels =ARM_LPAE_MAX_LEVELS ; + data->pgd_size =sizeof (arm_lpae_iopte); + }/* * MEMATTR: Mali has no actual notion of a non-cacheable type, so the * best we can do is mimic the out-of-tree driver and hope that the
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 5/99 rt2x00: initialize last_reset
In reply to Sasha LevinFrom: Stanislaw Gruszka <[email protected]>
[ Upstream commit c91a9cfe9f6d136172a52ff6e01b3f83ba850c19 ]
Initialize last_reset variable to INITIAL_JIFFIES, otherwise it is not possible to test H/W reset for first 5 minutes of system run.
--- drivers/net/wireless/ralink/rt2x00/rt2x00debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +1 -1
@@ -575,7 +575,7 @@ static ssize_t rt2x00debug_write_restart_hw(struct file *file, {struct rt2x00debug_intf *intf = file->private_data;struct rt2x00_dev *rt2x00dev = intf->rt2x00dev; -static unsigned long last_reset; +static unsigned long last_reset =INITIAL_JIFFIES ;if (!rt2x00_has_cap_restart_hw (rt2x00dev))return -EOPNOTSUPP ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/99 ACPI: HMAT: ACPI_HMAT_MEMORY_PD_VALID is deprecated since ACPI-6.3
In reply to Sasha LevinFrom: Daniel Black <[email protected]>
[ Upstream commit 35b9ad840892d979dbeffe702dae95a3cbefa07b ]
ACPI-6.3 corresponds to when HMAT revision was bumped from 1 to 2. In this version ACPI_HMAT_MEMORY_PD_VALID was deprecated and made reserved.
As such in revision 2+ we shouldn't be testing this flag.
This is as per ACPI-6.3, 5.2.27.3, Table 5-145
"Memory Proximity Domain Attributes Structure"
for Flags.
--- drivers/acpi/hmat/hmat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/hmat/hmat.c +1 -1
@@ -382,7 +382,7 @@ static int __init hmat_parse_proximity_domain(union acpi_subtable_headers *headepr_info ("HMAT: Memory Flags:%04x Processor Domain:%d Memory Domain:%d\n" , p->flags, p->processor_PD, p->memory_PD); -if (p->flags &ACPI_HMAT_MEMORY_PD_VALID ) { +if (p->flags &ACPI_HMAT_MEMORY_PD_VALID && hmat_revision ==1 ) { target =find_mem_target (p->memory_PD);if (!target) {pr_debug ("HMAT: Memory Domain missing from SRAT\n" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 7/99 mac80211_hwsim: fix incorrect dev_alloc_name failure goto
In reply to Sasha LevinFrom: Michael Vassernis <[email protected]>
[ Upstream commit 313c3fe9c2348e7147eca38bb446f295b45403a0 ]
If dev_alloc_name fails, hwsim_mon's memory allocated in alloc_netdev needs to be freed.
Change goto command in dev_alloc_name failure to out_free_mon in order to perform free_netdev.
--- drivers/net/wireless/mac80211_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +1 -1
@@ -3929,7 +3929,7 @@ static int __init init_mac80211_hwsim(void) err =dev_alloc_name (hwsim_mon, hwsim_mon->name);if (err <0 ) {rtnl_unlock (); - goto out_free_radios; + goto out_free_mon; } err =register_netdevice (hwsim_mon);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/99 nvme: fix possible deadlock when nvme_update_formats fails
In reply to Sasha LevinFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 6abff1b9f7b8884a46b7bd80b49e7af0b5625aeb ]
nvme_update_formats may fail to revalidate the namespace and attempt to remove the namespace. This may lead to a deadlock as nvme_ns_remove will attempt to acquire the subsystem lock which is already acquired by the passthru command with effects.
Move the invalid namepsace removal to after the passthru command releases the subsystem lock.
--- drivers/nvme/host/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/nvme/host/core.c +1 -2
@@ -1304,8 +1304,6 @@ static void nvme_update_formats(struct nvme_ctrl *ctrl)if (ns->disk &&nvme_revalidate_disk (ns->disk))nvme_set_queue_dying (ns);up_read (&ctrl->namespaces_rwsem); - -nvme_remove_invalid_namespaces (ctrl,NVME_NSID_ALL ); }static void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects)
@@ -1321,6 +1319,7 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects)nvme_unfreeze (ctrl);nvme_mpath_unfreeze (ctrl->subsys);mutex_unlock (&ctrl->subsys->lock); +nvme_remove_invalid_namespaces (ctrl,NVME_NSID_ALL );mutex_unlock (&ctrl->scan_lock); }if (effects &NVME_CMD_EFFECTS_CCC )
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 9/99 nvme: retain split access workaround for capability reads
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 3a8ecc935efabdad106b5e06d07b150c394b4465 ]
Commit 7fd8930f26be4
"nvme: add a common helper to read Identify Controller data"
has re-introduced an issue that we have attempted to work around in the past, in commit a310acd7a7ea ("NVMe: use split lo_hi_{read,write}q").
The problem is that some PCIe NVMe controllers do not implement 64-bit outbound accesses correctly, which is why the commit above switched to using lo_hi_[read|write]q for all 64-bit BAR accesses occuring in the code.
In the mean time, the NVMe subsystem has been refactored, and now calls into the PCIe support layer for NVMe via a .reg_read64() method, which fails to use lo_hi_readq(), and thus reintroduces the problem that the workaround above aimed to address.
Given that, at the moment, .reg_read64() is only used to read the capability register [which is known to tolerate split reads], let's switch .reg_read64() to lo_hi_readq() as well.
This fixes a boot issue on some ARM boxes with NVMe behind a Synopsys DesignWare PCIe host controller.
--- drivers/nvme/host/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
@@ -2620,7 +2620,7 @@ static int nvme_pci_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val)static int nvme_pci_reg_read64 (struct nvme_ctrl *ctrl,u32 off,u64 *val) { - *val =readq (to_nvme_dev (ctrl)->bar + off); + *val =lo_hi_readq (to_nvme_dev (ctrl)->bar + off);return 0 ; }
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 10/99 net: dsa: b53: Do not clear existing mirrored port mask
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit c763ac436b668d7417f0979430ec0312ede4093d ]
Clearing the existing bitmask of mirrored ports essentially prevents us from capturing more than one port at any given time. This is clearly wrong, do not clear the bitmask prior to setting up the new port.
--- drivers/net/dsa/b53/b53_common.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +0 -1
@@ -1808,7 +1808,6 @@ int b53_mirror_add(struct dsa_switch *ds, int port, loc =B53_EG_MIR_CTL ;b53_read16 (dev,B53_MGMT_PAGE , loc, ®); - reg &= ~MIRROR_MASK ; reg |=BIT (port);b53_write16 (dev,B53_MGMT_PAGE , loc, reg);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 11/99 net: stmmac: selftests: Check if filtering is available before running
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit b870b0f867c77b92d7fd17ace8421904270d3c6a ]
We need to check if the number of available Hash Filters is enough to run the test, otherwise we will get false failures.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +7 -0
@@ -456,6 +456,9 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv)if (ret)return ret; +if (netdev_mc_count (priv->dev) >= priv->hw->multicast_filter_bins) +return -EOPNOTSUPP ; + ret =dev_mc_add (priv->dev, gd_addr);if (ret)return ret;
@@ -533,6 +536,8 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv)if (stmmac_filter_check (priv))return -EOPNOTSUPP ; +if (!priv->hw->multicast_filter_bins) +return -EOPNOTSUPP ;/* Remove all MC addresses */ __dev_mc_unsync (priv->dev,NULL );
@@ -571,6 +576,8 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv)if (stmmac_filter_check (priv))return -EOPNOTSUPP ; +if (!priv->hw->multicast_filter_bins) +return -EOPNOTSUPP ;/* Remove all UC addresses */ __dev_uc_unsync (priv->dev,NULL );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/99 net: stmmac: gmac4+: Not all Unicast addresses may be available
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit 25683bab09a70542b9f8e3e28f79b3369e56701f ]
Some setups may not have all Unicast addresses filters available. Check the number of available filters before trying to setup it.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 -1
@@ -453,7 +453,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, value |=GMAC_PACKET_FILTER_HPF ;/* Handle multiple unicast addresses */ -if (netdev_uc_count (dev) >GMAC_MAX_PERFECT_ADDRESSES ) { +if (netdev_uc_count (dev) > hw->unicast_filter_entries) {/* Switch to promiscuous mode if more than 128 addrs * are required */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 13/99 net: stmmac: selftests: Fix L2 Hash Filter test
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit 2809fc13163f4946d7cde092807bea44bbae4478 ]
With the current MAC addresses hard-coded in the test we can get some false positives as we use the Hash Filtering method. Let's change the MAC addresses in the tests to be unique when hashed.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +2 -2
@@ -447,8 +447,8 @@ static int stmmac_filter_check(struct stmmac_priv *priv)static int stmmac_test_hfilt (struct stmmac_priv *priv) { -unsigned char gd_addr[ETH_ALEN ] = {0x01 ,0x00 ,0xcc ,0xcc ,0xdd ,0xdd }; -unsigned char bd_addr[ETH_ALEN ] = {0x09 ,0x00 ,0xaa ,0xaa ,0xbb ,0xbb }; +unsigned char gd_addr[ETH_ALEN ] = {0x01 ,0xee ,0xdd ,0xcc ,0xbb ,0xaa }; +unsigned char bd_addr[ETH_ALEN ] = {0x01 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 };struct stmmac_packet_attrs attr = { };int ret;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 14/99 ALSA: hda/realtek: Reduce the Headphone static noise on XPS 9350/9360
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 1099f48457d06b816359fb43ac32a4a07e33219b ]
Headphone on XPS 9350/9360 produces a background white noise. The The noise level somehow correlates with "Headphone Mic Boost", when it sets to 1 the noise disappears. However, doing this has a side effect, which also decreases the overall headphone volume so I didn't send the patch upstream.
The noise was bearable back then, but after commit 717f43d81afc ("ALSA:
hda/realtek - Update headset mode for ALC256") the noise exacerbates to a point it starts hurting ears.
So let's use the workaround to set "Headphone Mic Boost" to 1 and lock it so it's not touchable by userspace.
--- sound/pci/hda/patch_realtek.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
sound/pci/hda/patch_realtek.c +21 -3
@@ -5357,6 +5357,17 @@ static void alc271_hp_gate_mic_jack(struct hda_codec *codec, } } +static void alc256_fixup_dell_xps_13_headphone_noise2 (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +if (action !=HDA_FIXUP_ACT_PRE_PROBE ) +return ; + +snd_hda_codec_amp_stereo (codec,0x1a ,HDA_INPUT ,0 ,HDA_AMP_VOLMASK ,1 ); +snd_hda_override_wcaps (codec,0x1a ,get_wcaps (codec,0x1a ) & ~AC_WCAP_IN_AMP ); +} +static void alc269_fixup_limit_int_mic_boost (struct hda_codec *codec,const struct hda_fixup *fix,int action)
@@ -5820,6 +5831,7 @@ enum {ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE ,ALC275_FIXUP_DELL_XPS ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE , +ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2 ,ALC293_FIXUP_LENOVO_SPK_NOISE ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY , ALC255_FIXUP_DELL_SPK_NOISE,
@@ -6547,6 +6559,12 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC255_FIXUP_DELL1_MIC_NO_PRESENCE }, + [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc256_fixup_dell_xps_13_headphone_noise2, + .chained = true, + .chain_id =ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE + }, [ALC293_FIXUP_LENOVO_SPK_NOISE] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_disable_aamix,
@@ -6990,17 +7008,17 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1028 ,0x06de ,"Dell" ,ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK ),SND_PCI_QUIRK (0x1028 ,0x06df ,"Dell" ,ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK ),SND_PCI_QUIRK (0x1028 ,0x06e0 ,"Dell" ,ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK ), -SND_PCI_QUIRK (0x1028 ,0x0704 ,"Dell XPS 13 9350" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE ), +SND_PCI_QUIRK (0x1028 ,0x0704 ,"Dell XPS 13 9350" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2 ),SND_PCI_QUIRK (0x1028 ,0x0706 ,"Dell Inspiron 7559" ,ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER ),SND_PCI_QUIRK (0x1028 ,0x0725 ,"Dell Inspiron 3162" ,ALC255_FIXUP_DELL_SPK_NOISE ),SND_PCI_QUIRK (0x1028 ,0x0738 ,"Dell Precision 5820" ,ALC269_FIXUP_NO_SHUTUP ), -SND_PCI_QUIRK (0x1028 ,0x075b ,"Dell XPS 13 9360" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE ), +SND_PCI_QUIRK (0x1028 ,0x075b ,"Dell XPS 13 9360" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2 ),SND_PCI_QUIRK (0x1028 ,0x075c ,"Dell XPS 27 7760" ,ALC298_FIXUP_SPK_VOLUME ),SND_PCI_QUIRK (0x1028 ,0x075d ,"Dell AIO" ,ALC298_FIXUP_SPK_VOLUME ),SND_PCI_QUIRK (0x1028 ,0x07b0 ,"Dell Precision 7520" ,ALC295_FIXUP_DISABLE_DAC3 ),SND_PCI_QUIRK (0x1028 ,0x0798 ,"Dell Inspiron 17 7000 Gaming" ,ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER ),SND_PCI_QUIRK (0x1028 ,0x080c ,"Dell WYSE" ,ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE ), -SND_PCI_QUIRK (0x1028 ,0x082a ,"Dell XPS 13 9360" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE ), +SND_PCI_QUIRK (0x1028 ,0x082a ,"Dell XPS 13 9360" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2 ),SND_PCI_QUIRK (0x1028 ,0x084b ,"Dell" ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB ),SND_PCI_QUIRK (0x1028 ,0x084e ,"Dell" ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB ), SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 15/99 ALSA: hdac: clear link output stream mapping
In reply to Sasha LevinFrom: Rander Wang <[email protected]>
[ Upstream commit 130bce3afbbbbe585cba8604f2124c28e8d86fb0 ]
Fix potential DMA hang upon starting playback on devices in HDA mode on Intel platforms (Gemini Lake/Whiskey Lake/Comet Lake/Ice Lake). It doesn't affect platforms before Gemini Lake or any Intel device in non-HDA mode.
The reset value for the LOSDIV register is all output streams valid. Clear this register to invalidate non-existent streams when the bus is powered up.
--- include/sound/hda_register.h | 3 +++ sound/hda/ext/hdac_ext_controller.c | 5 +++++ 2 files changed, 8 insertions(+)
include/sound/hda_register.h +3 -0
@@ -264,6 +264,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };#define AZX_REG_ML_LOUTPAY 0x20#define AZX_REG_ML_LINPAY 0x30 +/* bit0 is reserved, with BIT(1) mapping to stream1 */ +#define ML_LOSIDV_STREAM_MASK 0xFFFE +#define ML_LCTL_SCF_MASK 0xF#define AZX_MLCTL_SPA (0x1 << 16)#define AZX_MLCTL_CPA (0x1 << 23)
sound/hda/ext/hdac_ext_controller.c +5 -0
@@ -270,6 +270,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, ret =snd_hdac_ext_bus_link_power_up (link); +/* +* clear the register to invalidate all the output streams +*/ +snd_hdac_updatew (link->ml_addr,AZX_REG_ML_LOSIDV , +ML_LOSIDV_STREAM_MASK ,0 );/* * wait for 521usec for codec to report status * HDA spec section 4.3 - Codec Discovery
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 16/99 rxrpc: Fix call ref leak
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit c48fc11b69e95007109206311b0187a3090591f3 ]
When sendmsg() finds a call to continue on with, if the call is in an inappropriate state, it doesn't release the ref it just got on that call before returning an error.
This causes the following symptom to show up with kasan:
BUG: KASAN: use-after-free in rxrpc_send_keepalive+0x8a2/0x940 net/rxrpc/output.c:635 Read of size 8 at addr ffff888064219698 by task kworker/0:3/11077
where line 635 is:
whdr.epoch = htonl(peer->local->rxnet->epoch);
The local endpoint (which cannot be pinned by the call) has been released, but not the peer (which is pinned by the call).
Fix this by releasing the call in the error path.
--- net/rxrpc/sendmsg.c | 1 + 1 file changed, 1 insertion(+)
net/rxrpc/sendmsg.c +1 -0
@@ -661,6 +661,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)case RXRPC_CALL_SERVER_PREALLOC :case RXRPC_CALL_SERVER_SECURING :case RXRPC_CALL_SERVER_ACCEPTING : +rxrpc_put_call (call, rxrpc_call_put); ret = -EBUSY ; goto error_release_sock;default :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 17/99 rxrpc: Fix trace-after-put looking at the put peer record
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 55f6c98e3674ce16038a1949c3f9ca5a9a99f289 ]
rxrpc_put_peer() calls trace_rxrpc_peer() after it has done the decrement of the refcount - which looks at the debug_id in the peer record. But unless the refcount was reduced to zero, we no longer have the right to look in the record and, indeed, it may be deleted by some other thread.
Fix this by getting the debug_id out before decrementing the refcount and then passing that into the tracepoint.
This can cause the following symptoms:
BUG: KASAN: use-after-free in __rxrpc_put_peer net/rxrpc/peer_object.c:411
[inline]
BUG: KASAN: use-after-free in rxrpc_put_peer+0x685/0x6a0
net/rxrpc/peer_object.c:435
Read of size 8 at addr ffff888097ec0058 by task syz-executor823/24216--- include/trace/events/rxrpc.h | 6 +++--- net/rxrpc/peer_object.c | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-)
include/trace/events/rxrpc.h +3 -3
@@ -519,10 +519,10 @@ TRACE_EVENT(rxrpc_local, ); TRACE_EVENT(rxrpc_peer, - TP_PROTO(struct rxrpc_peer *peer, enum rxrpc_peer_trace op, + TP_PROTO(unsigned int peer_debug_id, enum rxrpc_peer_trace op, int usage, const void *where), - TP_ARGS(peer, op, usage, where), + TP_ARGS(peer_debug_id, op, usage, where), TP_STRUCT__entry( __field(unsigned int, peer )
@@ -532,7 +532,7 @@ TRACE_EVENT(rxrpc_peer, ), TP_fast_assign( - __entry->peer = peer->debug_id; + __entry->peer = peer_debug_id; __entry->op = op; __entry->usage = usage; __entry->where = where;
net/rxrpc/peer_object.c +7 -4
@@ -382,7 +382,7 @@ struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *peer)int n; n =atomic_inc_return (&peer->usage); -trace_rxrpc_peer (peer, rxrpc_peer_got, n, here); +trace_rxrpc_peer (peer->debug_id, rxrpc_peer_got, n, here);return peer; }
@@ -396,7 +396,7 @@ struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *peer)if (peer) {int n =atomic_fetch_add_unless (&peer->usage,1 ,0 );if (n >0 ) -trace_rxrpc_peer (peer, rxrpc_peer_got, n +1 , here); +trace_rxrpc_peer (peer->debug_id, rxrpc_peer_got, n +1 , here);else peer =NULL ; }
@@ -426,11 +426,13 @@ static void __rxrpc_put_peer(struct rxrpc_peer *peer)void rxrpc_put_peer (struct rxrpc_peer *peer) {const void *here =__builtin_return_address (0 ); +unsigned int debug_id;int n;if (peer) { + debug_id = peer->debug_id; n =atomic_dec_return (&peer->usage); -trace_rxrpc_peer (peer, rxrpc_peer_put, n, here); +trace_rxrpc_peer (debug_id, rxrpc_peer_put, n, here);if (n ==0 )__rxrpc_put_peer (peer); }
@@ -443,10 +445,11 @@ void rxrpc_put_peer(struct rxrpc_peer *peer)void rxrpc_put_peer_locked (struct rxrpc_peer *peer) {const void *here =__builtin_return_address (0 ); +unsigned int debug_id = peer->debug_id;int n; n =atomic_dec_return (&peer->usage); -trace_rxrpc_peer (peer, rxrpc_peer_put, n, here); +trace_rxrpc_peer (debug_id, rxrpc_peer_put, n, here);if (n ==0 ) {hash_del_rcu (&peer->hash_link);list_del_init (&peer->keepalive_link);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 18/99 rxrpc: Fix trace-after-put looking at the put connection record
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 4c1295dccc0afe0905b6ca4c62ade7f2406f2cfb ]
rxrpc_put_*conn() calls trace_rxrpc_conn() after they have done the decrement of the refcount - which looks at the debug_id in the connection record. But unless the refcount was reduced to zero, we no longer have the right to look in the record and, indeed, it may be deleted by some other thread.
Fix this by getting the debug_id out before decrementing the refcount and then passing that into the tracepoint.
--- include/trace/events/rxrpc.h | 6 +++--- net/rxrpc/call_accept.c | 2 +- net/rxrpc/conn_client.c | 6 ++++-- net/rxrpc/conn_object.c | 13 +++++++------ net/rxrpc/conn_service.c | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-)
include/trace/events/rxrpc.h +3 -3
@@ -546,10 +546,10 @@ TRACE_EVENT(rxrpc_peer, ); TRACE_EVENT(rxrpc_conn, - TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op, + TP_PROTO(unsigned int conn_debug_id, enum rxrpc_conn_trace op, int usage, const void *where), - TP_ARGS(conn, op, usage, where), + TP_ARGS(conn_debug_id, op, usage, where), TP_STRUCT__entry( __field(unsigned int, conn )
@@ -559,7 +559,7 @@ TRACE_EVENT(rxrpc_conn, ), TP_fast_assign( - __entry->conn = conn->debug_id; + __entry->conn = conn_debug_id; __entry->op = op; __entry->usage = usage; __entry->where = where;
net/rxrpc/call_accept.c +1 -1
@@ -84,7 +84,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx,smp_store_release (&b->conn_backlog_head, (head +1 ) & (size -1 )); -trace_rxrpc_conn (conn, rxrpc_conn_new_service, +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_service,atomic_read (&conn->usage), here); }
net/rxrpc/conn_client.c +4 -2
@@ -212,7 +212,8 @@ rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp)rxrpc_get_local (conn->params.local);key_get (conn->params.key); -trace_rxrpc_conn (conn, rxrpc_conn_new_client,atomic_read (&conn->usage), +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_client, +atomic_read (&conn->usage),__builtin_return_address (0 ));trace_rxrpc_client (conn,-1 , rxrpc_client_alloc);_leave (" = %p" , conn);
@@ -985,11 +986,12 @@ rxrpc_put_one_client_conn(struct rxrpc_connection *conn)void rxrpc_put_client_conn (struct rxrpc_connection *conn) {const void *here =__builtin_return_address (0 ); +unsigned int debug_id = conn->debug_id;int n; do { n = atomic_dec_return(&conn->usage); - trace_rxrpc_conn(conn, rxrpc_conn_put_client, n, here); + trace_rxrpc_conn(debug_id, rxrpc_conn_put_client, n, here); if (n > 0) return; ASSERTCMP(n, >=, 0);
net/rxrpc/conn_object.c +7 -6
@@ -269,7 +269,7 @@ bool rxrpc_queue_conn(struct rxrpc_connection *conn)if (n ==0 )return false;if (rxrpc_queue_work (&conn->processor)) -trace_rxrpc_conn (conn, rxrpc_conn_queued, n +1 , here); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_queued, n +1 , here);else rxrpc_put_connection (conn);return true;
@@ -284,7 +284,7 @@ void rxrpc_see_connection(struct rxrpc_connection *conn)if (conn) {int n =atomic_read (&conn->usage); -trace_rxrpc_conn (conn, rxrpc_conn_seen, n, here); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_seen, n, here); } }
@@ -296,7 +296,7 @@ void rxrpc_get_connection(struct rxrpc_connection *conn)const void *here =__builtin_return_address (0 );int n =atomic_inc_return (&conn->usage); -trace_rxrpc_conn (conn, rxrpc_conn_got, n, here); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_got, n, here); }/*
@@ -310,7 +310,7 @@ rxrpc_get_connection_maybe(struct rxrpc_connection *conn)if (conn) {int n =atomic_fetch_add_unless (&conn->usage,1 ,0 );if (n >0 ) -trace_rxrpc_conn (conn, rxrpc_conn_got, n +1 , here); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_got, n +1 , here);else conn =NULL ; }
@@ -333,10 +333,11 @@ static void rxrpc_set_service_reap_timer(struct rxrpc_net *rxnet,void rxrpc_put_service_conn (struct rxrpc_connection *conn) {const void *here =__builtin_return_address (0 ); +unsigned int debug_id = conn->debug_id;int n; n =atomic_dec_return (&conn->usage); -trace_rxrpc_conn (conn, rxrpc_conn_put_service, n, here); +trace_rxrpc_conn (debug_id, rxrpc_conn_put_service, n, here); ASSERTCMP(n, >=, 0);if (n ==1 ) rxrpc_set_service_reap_timer(conn->params.local->rxnet,
@@ -420,7 +421,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work)*/ if (atomic_cmpxchg (&conn->usage,1 ,0 ) !=1 )continue ; -trace_rxrpc_conn (conn, rxrpc_conn_reap_service,0 ,NULL ); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_reap_service,0 ,NULL );if (rxrpc_conn_is_client (conn))BUG ();
net/rxrpc/conn_service.c +1 -1
@@ -134,7 +134,7 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxnlist_add_tail (&conn->proc_link, &rxnet->conn_proc_list);write_unlock (&rxnet->conn_lock); -trace_rxrpc_conn (conn, rxrpc_conn_new_service, +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_service,atomic_read (&conn->usage),__builtin_return_address (0 )); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 19/99 rxrpc: Fix trace-after-put looking at the put call record
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 48c9e0ec7cbbb7370448f859ccc8e3b7eb69e755 ]
rxrpc_put_call() calls trace_rxrpc_call() after it has done the decrement of the refcount - which looks at the debug_id in the call record. But unless the refcount was reduced to zero, we no longer have the right to look in the record and, indeed, it may be deleted by some other thread.
Fix this by getting the debug_id out before decrementing the refcount and then passing that into the tracepoint.
--- include/trace/events/rxrpc.h | 6 +++--- net/rxrpc/call_accept.c | 2 +- net/rxrpc/call_object.c | 28 +++++++++++++++++----------- 3 files changed, 21 insertions(+), 15 deletions(-)
include/trace/events/rxrpc.h +3 -3
@@ -606,10 +606,10 @@ TRACE_EVENT(rxrpc_client, ); TRACE_EVENT(rxrpc_call, - TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op, + TP_PROTO(unsigned int call_debug_id, enum rxrpc_call_trace op, int usage, const void *where, const void *aux), - TP_ARGS(call, op, usage, where, aux), + TP_ARGS(call_debug_id, op, usage, where, aux), TP_STRUCT__entry( __field(unsigned int, call )
@@ -620,7 +620,7 @@ TRACE_EVENT(rxrpc_call, ), TP_fast_assign( - __entry->call = call->debug_id; + __entry->call = call_debug_id; __entry->op = op; __entry->usage = usage; __entry->where = where;
net/rxrpc/call_accept.c +1 -1
@@ -97,7 +97,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, call->flags |= (1 <<RXRPC_CALL_IS_SERVICE ); call->state =RXRPC_CALL_SERVER_PREALLOC ; -trace_rxrpc_call (call, rxrpc_call_new_service, +trace_rxrpc_call (call->debug_id, rxrpc_call_new_service,atomic_read (&call->usage), here, (const void *)user_call_ID);
net/rxrpc/call_object.c +17 -11
@@ -240,7 +240,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,if (p->intr)__set_bit (RXRPC_CALL_IS_INTR , &call->flags); call->tx_total_len = p->tx_total_len; -trace_rxrpc_call (call, rxrpc_call_new_client,atomic_read (&call->usage), +trace_rxrpc_call (call->debug_id, rxrpc_call_new_client, +atomic_read (&call->usage), here, (const void *)p->user_call_ID);/* We need to protect a partially set up call against the user as we
@@ -290,8 +291,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,if (ret <0 ) goto error; -trace_rxrpc_call (call, rxrpc_call_connected,atomic_read (&call->usage), - here,NULL ); +trace_rxrpc_call (call->debug_id, rxrpc_call_connected, +atomic_read (&call->usage), here,NULL );rxrpc_start_call_timer (call);
@@ -313,8 +314,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, error:__rxrpc_set_call_completion (call,RXRPC_CALL_LOCAL_ERROR ,RX_CALL_DEAD , ret); -trace_rxrpc_call (call, rxrpc_call_error,atomic_read (&call->usage), - here,ERR_PTR (ret)); +trace_rxrpc_call (call->debug_id, rxrpc_call_error, +atomic_read (&call->usage), here,ERR_PTR (ret));rxrpc_release_call (rx, call);mutex_unlock (&call->user_mutex);rxrpc_put_call (call, rxrpc_call_put);
@@ -376,7 +377,8 @@ bool rxrpc_queue_call(struct rxrpc_call *call)if (n ==0 )return false;if (rxrpc_queue_work (&call->processor)) -trace_rxrpc_call (call, rxrpc_call_queued, n +1 , here,NULL ); +trace_rxrpc_call (call->debug_id, rxrpc_call_queued, n +1 , + here,NULL );else rxrpc_put_call (call, rxrpc_call_put_noqueue);return true;
@@ -391,7 +393,8 @@ bool __rxrpc_queue_call(struct rxrpc_call *call)int n =atomic_read (&call->usage); ASSERTCMP(n, >=, 1);if (rxrpc_queue_work (&call->processor)) -trace_rxrpc_call (call, rxrpc_call_queued_ref, n, here,NULL ); +trace_rxrpc_call (call->debug_id, rxrpc_call_queued_ref, n, + here,NULL );else rxrpc_put_call (call, rxrpc_call_put_noqueue);return true;
@@ -406,7 +409,8 @@ void rxrpc_see_call(struct rxrpc_call *call)if (call) {int n =atomic_read (&call->usage); -trace_rxrpc_call (call, rxrpc_call_seen, n, here,NULL ); +trace_rxrpc_call (call->debug_id, rxrpc_call_seen, n, + here,NULL ); } }
@@ -418,7 +422,7 @@ void rxrpc_get_call(struct rxrpc_call *call, enum rxrpc_call_trace op)const void *here =__builtin_return_address (0 );int n =atomic_inc_return (&call->usage); -trace_rxrpc_call (call, op, n, here,NULL ); +trace_rxrpc_call (call->debug_id, op, n, here,NULL ); }/*
@@ -445,7 +449,8 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call)_enter ("{%d,%d}" , call->debug_id,atomic_read (&call->usage)); -trace_rxrpc_call (call, rxrpc_call_release,atomic_read (&call->usage), +trace_rxrpc_call (call->debug_id, rxrpc_call_release, +atomic_read (&call->usage), here, (const void *)call->flags); ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE);
@@ -532,12 +537,13 @@ void rxrpc_put_call(struct rxrpc_call *call, enum rxrpc_call_trace op) {struct rxrpc_net *rxnet = call->rxnet;const void *here =__builtin_return_address (0 ); +unsigned int debug_id = call->debug_id;int n;ASSERT (call !=NULL ); n =atomic_dec_return (&call->usage); -trace_rxrpc_call (call, op, n, here,NULL ); +trace_rxrpc_call (debug_id, op, n, here,NULL ); ASSERTCMP(n, >=, 0);if (n ==0 ) {_debug ("call %d dead" , call->debug_id);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 20/99 rxrpc: rxrpc_peer needs to hold a ref on the rxrpc_local record
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 9ebeddef58c41bd700419cdcece24cf64ce32276 ]
The rxrpc_peer record needs to hold a reference on the rxrpc_local record it points as the peer is used as a base to access information in the rxrpc_local record.
This can cause problems in __rxrpc_put_peer(), where we need the network namespace pointer, and in rxrpc_send_keepalive(), where we need to access the UDP socket, leading to symptoms like:
BUG: KASAN: use-after-free in __rxrpc_put_peer net/rxrpc/peer_object.c:411
[inline]
BUG: KASAN: use-after-free in rxrpc_put_peer+0x685/0x6a0
net/rxrpc/peer_object.c:435
Read of size 8 at addr ffff888097ec0058 by task syz-executor823/24216Fix this by taking a ref on the local record for the peer record.
--- net/rxrpc/peer_object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/rxrpc/peer_object.c +3 -2
@@ -216,7 +216,7 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) peer =kzalloc (sizeof (struct rxrpc_peer ), gfp);if (peer) {atomic_set (&peer->usage,1 ); - peer->local = local; + peer->local =rxrpc_get_local (local);INIT_HLIST_HEAD (&peer->error_targets); peer->service_conns =RB_ROOT ;seqlock_init (&peer->service_conn_lock);
@@ -307,7 +307,6 @@ void rxrpc_new_incoming_peer(struct rxrpc_sock *rx, struct rxrpc_local *local,unsigned long hash_key; hash_key =rxrpc_peer_hash_key (local, &peer->srx); - peer->local = local;rxrpc_init_peer (rx, peer, hash_key);spin_lock (&rxnet->peer_hash_lock);
@@ -417,6 +416,7 @@ static void __rxrpc_put_peer(struct rxrpc_peer *peer)list_del_init (&peer->keepalive_link);spin_unlock_bh (&rxnet->peer_hash_lock); +rxrpc_put_local (peer->local);kfree_rcu (peer, rcu); }
@@ -453,6 +453,7 @@ void rxrpc_put_peer_locked(struct rxrpc_peer *peer)if (n ==0 ) {hash_del_rcu (&peer->hash_link);list_del_init (&peer->keepalive_link); +rxrpc_put_local (peer->local);kfree_rcu (peer, rcu); } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 21/99 nl80211: fix memory leak in nl80211_get_ftm_responder_stats
In reply to Sasha LevinFrom: Navid Emamdoost <[email protected]>
[ Upstream commit 1399c59fa92984836db90538cf92397fe7caaa57 ]
In nl80211_get_ftm_responder_stats, a new skb is created via nlmsg_new named msg. If nl80211hdr_put() fails, then msg should be released. The return statement should be replace by goto to error handling code.
--- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/nl80211.c +1 -1
@@ -13518,7 +13518,7 @@ static int nl80211_get_ftm_responder_stats(struct sk_buff *skb, hdr =nl80211hdr_put (msg, info->snd_portid, info->snd_seq,0 ,NL80211_CMD_GET_FTM_RESPONDER_STATS );if (!hdr) -return -ENOBUFS ; + goto nla_put_failure;if (nla_put_u32 (msg,NL80211_ATTR_IFINDEX , dev->ifindex)) goto nla_put_failure;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 22/99 cfg80211: fix a bunch of RCU issues in multi-bssid code
In reply to Sasha LevinFrom: Sara Sharon <[email protected]>
[ Upstream commit 461c4c2b4c0731d7452bad4e77c0cdbdcea1804c ]
cfg80211_update_notlisted_nontrans() leaves the RCU critical session too early, while still using nontrans_ssid which is RCU protected. In addition, it performs a bunch of RCU pointer update operations such as rcu_access_pointer and rcu_assign_pointer.
The caller, cfg80211_inform_bss_frame_data(), also accesses the RCU pointer without holding the lock.
Just wrap all of this with bss_lock.
--- net/wireless/scan.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
net/wireless/scan.c +13 -10
@@ -1691,8 +1691,7 @@ cfg80211_parse_mbssid_frame_data(struct wiphy *wiphy,static void cfg80211_update_notlisted_nontrans (struct wiphy *wiphy,struct cfg80211_bss *nontrans_bss, -struct ieee80211_mgmt *mgmt,size_t len, -gfp_t gfp) +struct ieee80211_mgmt *mgmt,size_t len) {u8 *ie, *new_ie, *pos;const u8 *nontrans_ssid, *trans_ssid, *mbssid;
@@ -1703,6 +1702,8 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy,const struct cfg80211_bss_ies *old;u8 cpy_len; +lockdep_assert_held (&wiphy_to_rdev (wiphy)->bss_lock); + ie = mgmt->u.probe_resp.variable; new_ie_len = ielen;
@@ -1719,23 +1720,22 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy,if (!mbssid || mbssid < trans_ssid)return ; new_ie_len -= mbssid[1 ]; -rcu_read_lock (); + nontrans_ssid =ieee80211_bss_get_ie (nontrans_bss,WLAN_EID_SSID ); -if (!nontrans_ssid) { -rcu_read_unlock (); +if (!nontrans_ssid)return ; - } + new_ie_len += nontrans_ssid[1 ]; -rcu_read_unlock ();/* generate new ie for nontrans BSS * 1. replace SSID with nontrans BSS' SSID * 2. skip MBSSID IE */ - new_ie =kzalloc (new_ie_len, gfp); + new_ie =kzalloc (new_ie_len,GFP_ATOMIC );if (!new_ie)return ; - new_ies =kzalloc (sizeof (*new_ies) + new_ie_len, gfp); + + new_ies =kzalloc (sizeof (*new_ies) + new_ie_len,GFP_ATOMIC );if (!new_ies) goto out_free;
@@ -1895,6 +1895,8 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,cfg80211_parse_mbssid_frame_data (wiphy, data, mgmt, len, &non_tx_data, gfp); +spin_lock_bh (&wiphy_to_rdev (wiphy)->bss_lock); +/* check if the res has other nontransmitting bss which is not * in MBSSID IE */
@@ -1909,8 +1911,9 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, ies2 =rcu_access_pointer (tmp_bss->ies);if (ies2->tsf < ies1->tsf)cfg80211_update_notlisted_nontrans (wiphy, tmp_bss, - mgmt, len, gfp); + mgmt, len); } +spin_unlock_bh (&wiphy_to_rdev (wiphy)->bss_lock);return res; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 23/99 mac80211: accept deauth frames in IBSS mode
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 95697f9907bfe3eab0ef20265a766b22e27dde64 ]
We can process deauth frames and all, but we drop them very early in the RX path today - this could never have worked.
--- net/mac80211/rx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
net/mac80211/rx.c +10 -1
@@ -3467,9 +3467,18 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)case cpu_to_le16 (IEEE80211_STYPE_PROBE_RESP ):/* process for all: mesh, mlme, ibss */ break ; +case cpu_to_le16 (IEEE80211_STYPE_DEAUTH ): +if (is_multicast_ether_addr (mgmt->da) && + !is_broadcast_ether_addr (mgmt->da)) +return RX_DROP_MONITOR ; + +/* process only for station/IBSS */ +if (sdata->vif.type !=NL80211_IFTYPE_STATION && + sdata->vif.type !=NL80211_IFTYPE_ADHOC ) +return RX_DROP_MONITOR ; +break ;case cpu_to_le16 (IEEE80211_STYPE_ASSOC_RESP ):case cpu_to_le16 (IEEE80211_STYPE_REASSOC_RESP ): -case cpu_to_le16 (IEEE80211_STYPE_DEAUTH ):case cpu_to_le16 (IEEE80211_STYPE_DISASSOC ):if (is_multicast_ether_addr (mgmt->da) && !is_broadcast_ether_addr (mgmt->da))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 24/99 mac80211: fix scan when operating on DFS channels in ETSI domains
In reply to Sasha LevinFrom: Aaron Komisar <[email protected]>
[ Upstream commit dc0c18ed229cdcca283dd78fefa38273ec37a42c ]
In non-ETSI regulatory domains scan is blocked when operating channel is a DFS channel. For ETSI, however, once DFS channel is marked as available after the CAC, this channel will remain available (for some time) even after leaving this channel.
Therefore a scan can be done without any impact on the availability of the DFS channel as no new CAC is required after the scan.
Enable scan in mac80211 in these cases.
--- include/net/cfg80211.h | 8 ++++++++ net/mac80211/scan.c | 30 ++++++++++++++++++++++++++++-- net/wireless/reg.c | 1 + net/wireless/reg.h | 8 -------- 4 files changed, 37 insertions(+), 10 deletions(-)
include/net/cfg80211.h +8 -0
@@ -5446,6 +5446,14 @@ const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,*/ const char *reg_initiator_name (enum nl80211_reg_initiator initiator); +/** +* regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom +* @wiphy: wiphy for which pre-CAC capability is checked. +* +* Pre-CAC is allowed only in some regdomains (notable ETSI). +*/ +bool regulatory_pre_cac_allowed (struct wiphy *wiphy); +/** * DOC: Internal regulatory db functions *
net/mac80211/scan.c +28 -2
@@ -520,10 +520,33 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local,return 0 ; } +static bool __ieee80211_can_leave_ch (struct ieee80211_sub_if_data *sdata) +{ +struct ieee80211_local *local = sdata->local; +struct ieee80211_sub_if_data *sdata_iter; + +if (!ieee80211_is_radar_required (local)) +return true; + +if (!regulatory_pre_cac_allowed (local->hw.wiphy)) +return false; + +mutex_lock (&local->iflist_mtx); +list_for_each_entry (sdata_iter, &local->interfaces, list) { +if (sdata_iter->wdev.cac_started) { +mutex_unlock (&local->iflist_mtx); +return false; + } + } +mutex_unlock (&local->iflist_mtx); + +return true; +} +static bool ieee80211_can_scan (struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata) { -if (ieee80211_is_radar_required (local)) +if (!__ieee80211_can_leave_ch (sdata))return false;if (!list_empty (&local->roc_list))
@@ -630,7 +653,10 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,lockdep_assert_held (&local->mtx); -if (local->scan_req ||ieee80211_is_radar_required (local)) +if (local->scan_req) +return -EBUSY ; + +if (!__ieee80211_can_leave_ch (sdata))return -EBUSY ;if (!ieee80211_can_scan (local, sdata)) {
net/wireless/reg.c +1 -0
@@ -3866,6 +3866,7 @@ bool regulatory_pre_cac_allowed(struct wiphy *wiphy)return pre_cac_allowed; } +EXPORT_SYMBOL (regulatory_pre_cac_allowed); void regulatory_propagate_dfs_state(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
net/wireless/reg.h +0 -8
@@ -155,14 +155,6 @@ bool regulatory_indoor_allowed(void);*/ #define REG_PRE_CAC_EXPIRY_GRACE_MS 2000 -/** -* regulatory_pre_cac_allowed - if pre-CAC allowed in the current dfs domain -* @wiphy: wiphy for which pre-CAC capability is checked. - -* Pre-CAC is allowed only in ETSI domain. -*/ -bool regulatory_pre_cac_allowed (struct wiphy *wiphy); -/** * regulatory_propagate_dfs_state - Propagate DFS channel state to other wiphys * @wiphy - wiphy on which radar is detected and the event will be propagated
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 25/99 llc: fix sk_buff leak in llc_sap_state_process()
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit c6ee11c39fcc1fb55130748990a8f199e76263b4 ]
syzbot reported:
BUG: memory leak
unreferenced object 0xffff888116270800 (size 224):
comm "syz-executor641", pid 7047, jiffies 4294947360 (age 13.860s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 20 e1 2a 81 88 ff ff 00 40 3d 2a 81 88 ff ff . .*.....@=*....
backtrace:
[<000000004d41b4cc>] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline]
[<000000004d41b4cc>] slab_post_alloc_hook mm/slab.h:439 [inline]
[<000000004d41b4cc>] slab_alloc_node mm/slab.c:3269 [inline]
[<000000004d41b4cc>] kmem_cache_alloc_node+0x153/0x2a0 mm/slab.c:3579
[<00000000506a5965>] __alloc_skb+0x6e/0x210 net/core/skbuff.c:198
[<000000001ba5a161>] alloc_skb include/linux/skbuff.h:1058 [inline]
[<000000001ba5a161>] alloc_skb_with_frags+0x5f/0x250 net/core/skbuff.c:5327
[<0000000047d9c78b>] sock_alloc_send_pskb+0x269/0x2a0 net/core/sock.c:2225
[<000000003828fe54>] sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2242
[<00000000e34d94f9>] llc_ui_sendmsg+0x10a/0x540 net/llc/af_llc.c:933
[<00000000de2de3fb>] sock_sendmsg_nosec net/socket.c:652 [inline]
[<00000000de2de3fb>] sock_sendmsg+0x54/0x70 net/socket.c:671
[<000000008fe16e7a>] __sys_sendto+0x148/0x1f0 net/socket.c:1964
[...]The bug is that llc_sap_state_process() always takes an extra reference to the skb, but sometimes neither llc_sap_next_state() nor llc_sap_state_process() itself drops this reference.
Fix it by changing llc_sap_next_state() to never consume a reference to the skb, rather than sometimes do so and sometimes not. Then remove the extra skb_get() and kfree_skb() from llc_sap_state_process().
--- net/llc/llc_s_ac.c | 12 +++++++++--- net/llc/llc_sap.c | 23 ++++++++--------------- 2 files changed, 17 insertions(+), 18 deletions(-)
net/llc/llc_s_ac.c +9 -3
@@ -58,8 +58,10 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb) ev->daddr.lsap, LLC_PDU_CMD);llc_pdu_init_as_ui_cmd (skb); rc =llc_mac_hdr_init (skb, ev->saddr.mac, ev->daddr.mac); -if (likely (!rc)) +if (likely (!rc)) { +skb_get (skb); rc =dev_queue_xmit (skb); + }return rc; }
@@ -81,8 +83,10 @@ int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) ev->daddr.lsap, LLC_PDU_CMD);llc_pdu_init_as_xid_cmd (skb,LLC_XID_NULL_CLASS_2 ,0 ); rc =llc_mac_hdr_init (skb, ev->saddr.mac, ev->daddr.mac); -if (likely (!rc)) +if (likely (!rc)) { +skb_get (skb); rc =dev_queue_xmit (skb); + }return rc; }
@@ -135,8 +139,10 @@ int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb) ev->daddr.lsap, LLC_PDU_CMD);llc_pdu_init_as_test_cmd (skb); rc =llc_mac_hdr_init (skb, ev->saddr.mac, ev->daddr.mac); -if (likely (!rc)) +if (likely (!rc)) { +skb_get (skb); rc =dev_queue_xmit (skb); + }return rc; }
net/llc/llc_sap.c +8 -15
@@ -197,29 +197,22 @@ static int llc_sap_next_state(struct llc_sap *sap, struct sk_buff *skb)* After executing actions of the event, upper layer will be indicated * if needed(on receiving an UI frame). sk can be null for the * datalink_proto case. +* +* This function always consumes a reference to the skb. */ static void llc_sap_state_process (struct llc_sap *sap,struct sk_buff *skb) {struct llc_sap_state_ev *ev =llc_sap_ev (skb); -/* -* We have to hold the skb, because llc_sap_next_state -* will kfree it in the sending path and we need to -* look at the skb->cb, where we encode llc_sap_state_ev. -*/ -skb_get (skb); ev->ind_cfm_flag =0 ;llc_sap_next_state (sap, skb); -if (ev->ind_cfm_flag ==LLC_IND ) { -if (skb->sk->sk_state ==TCP_LISTEN ) -kfree_skb (skb); -else { -llc_save_primitive (skb->sk, skb, ev->prim); -/* queue skb to the user. */ -if (sock_queue_rcv_skb (skb->sk, skb)) -kfree_skb (skb); - } +if (ev->ind_cfm_flag ==LLC_IND && skb->sk->sk_state !=TCP_LISTEN ) { +llc_save_primitive (skb->sk, skb, ev->prim); + +/* queue skb to the user. */ +if (sock_queue_rcv_skb (skb->sk, skb) ==0 ) +return ; }kfree_skb (skb); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 26/99 llc: fix sk_buff leak in llc_conn_service()
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit b74555de21acd791f12c4a1aeaf653dd7ac21133 ]
syzbot reported:
BUG: memory leak
unreferenced object 0xffff88811eb3de00 (size 224):
comm "syz-executor559", pid 7315, jiffies 4294943019 (age 10.300s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 a0 38 24 81 88 ff ff 00 c0 f2 15 81 88 ff ff ..8$............
backtrace:
[<000000008d1c66a1>] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline]
[<000000008d1c66a1>] slab_post_alloc_hook mm/slab.h:439 [inline]
[<000000008d1c66a1>] slab_alloc_node mm/slab.c:3269 [inline]
[<000000008d1c66a1>] kmem_cache_alloc_node+0x153/0x2a0 mm/slab.c:3579
[<00000000447d9496>] __alloc_skb+0x6e/0x210 net/core/skbuff.c:198
[<000000000cdbf82f>] alloc_skb include/linux/skbuff.h:1058 [inline]
[<000000000cdbf82f>] llc_alloc_frame+0x66/0x110 net/llc/llc_sap.c:54
[<000000002418b52e>] llc_conn_ac_send_sabme_cmd_p_set_x+0x2f/0x140 net/llc/llc_c_ac.c:777
[<000000001372ae17>] llc_exec_conn_trans_actions net/llc/llc_conn.c:475 [inline]
[<000000001372ae17>] llc_conn_service net/llc/llc_conn.c:400 [inline]
[<000000001372ae17>] llc_conn_state_process+0x1ac/0x640 net/llc/llc_conn.c:75
[<00000000f27e53c1>] llc_establish_connection+0x110/0x170 net/llc/llc_if.c:109
[<00000000291b2ca0>] llc_ui_connect+0x10e/0x370 net/llc/af_llc.c:477
[<000000000f9c740b>] __sys_connect+0x11d/0x170 net/socket.c:1840
[...]The bug is that most callers of llc_conn_send_pdu() assume it consumes a reference to the skb, when actually due to commit b85ab56c3f81 ("llc:
properly handle dev_queue_xmit() return value") it doesn't.
Revert most of that commit, and instead make the few places that need llc_conn_send_pdu() to *not* consume a reference call skb_get() before.
--- include/net/llc_conn.h | 2 +- net/llc/llc_c_ac.c | 8 ++++++-- net/llc/llc_conn.c | 32 +++++++++----------------------- 3 files changed, 16 insertions(+), 26 deletions(-)
include/net/llc_conn.h +1 -1
@@ -104,7 +104,7 @@ void llc_sk_reset(struct sock *sk);/* Access to a connection */ int llc_conn_state_process (struct sock *sk,struct sk_buff *skb); -int llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb); +void llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb);void llc_conn_rtn_pdu (struct sock *sk,struct sk_buff *skb);void llc_conn_resend_i_pdu_as_cmd (struct sock *sk,u8 nr,u8 first_p_bit);void llc_conn_resend_i_pdu_as_rsp (struct sock *sk,u8 nr,u8 first_f_bit);
net/llc/llc_c_ac.c +6 -2
@@ -372,6 +372,7 @@ int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk, struct sk_buff *skb)llc_pdu_init_as_i_cmd (skb,1 , llc->vS, llc->vR); rc =llc_mac_hdr_init (skb, llc->dev->dev_addr, llc->daddr.mac);if (likely (!rc)) { +skb_get (skb);llc_conn_send_pdu (sk, skb);llc_conn_ac_inc_vs_by_1 (sk, skb); }
@@ -389,7 +390,8 @@ static int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk, struct sk_buff *skb)llc_pdu_init_as_i_cmd (skb,0 , llc->vS, llc->vR); rc =llc_mac_hdr_init (skb, llc->dev->dev_addr, llc->daddr.mac);if (likely (!rc)) { - rc =llc_conn_send_pdu (sk, skb); +skb_get (skb); +llc_conn_send_pdu (sk, skb);llc_conn_ac_inc_vs_by_1 (sk, skb); }return rc;
@@ -406,6 +408,7 @@ int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)llc_pdu_init_as_i_cmd (skb,0 , llc->vS, llc->vR); rc =llc_mac_hdr_init (skb, llc->dev->dev_addr, llc->daddr.mac);if (likely (!rc)) { +skb_get (skb);llc_conn_send_pdu (sk, skb);llc_conn_ac_inc_vs_by_1 (sk, skb); }
@@ -916,7 +919,8 @@ static int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock *sk,llc_pdu_init_as_i_cmd (skb, llc->ack_pf, llc->vS, llc->vR); rc =llc_mac_hdr_init (skb, llc->dev->dev_addr, llc->daddr.mac);if (likely (!rc)) { - rc =llc_conn_send_pdu (sk, skb); +skb_get (skb); +llc_conn_send_pdu (sk, skb);llc_conn_ac_inc_vs_by_1 (sk, skb); }return rc;
net/llc/llc_conn.c +9 -23
@@ -30,7 +30,7 @@#endif static int llc_find_offset (int state,int ev_type); -static int llc_conn_send_pdus (struct sock *sk,struct sk_buff *skb); +static void llc_conn_send_pdus (struct sock *sk);static int llc_conn_service (struct sock *sk,struct sk_buff *skb); static int llc_exec_conn_trans_actions(struct sock *sk, struct llc_conn_state_trans *trans,
@@ -193,11 +193,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)return rc; } -int llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb) +void llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb) {/* queue PDU to send to MAC layer */ skb_queue_tail (&sk->sk_write_queue, skb); -return llc_conn_send_pdus (sk, skb); +llc_conn_send_pdus (sk); }/**
@@ -255,7 +255,7 @@ void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit)if (howmany_resend >0 ) llc->vS = (llc->vS +1 ) %LLC_2_SEQ_NBR_MODULO ;/* any PDUs to re-send are queued up; start sending to MAC */ -llc_conn_send_pdus (sk,NULL ); +llc_conn_send_pdus (sk); out:; }
@@ -296,7 +296,7 @@ void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit)if (howmany_resend >0 ) llc->vS = (llc->vS +1 ) %LLC_2_SEQ_NBR_MODULO ;/* any PDUs to re-send are queued up; start sending to MAC */ -llc_conn_send_pdus (sk,NULL ); +llc_conn_send_pdus (sk); out:; }
@@ -340,16 +340,12 @@ int llc_conn_remove_acked_pdus(struct sock *sk, u8 nr, u16 *how_many_unacked)/** * llc_conn_send_pdus - Sends queued PDUs * @sk: active connection -* @hold_skb: the skb held by caller, or NULL if does not care * -* Sends queued pdus to MAC layer for transmission. When @hold_skb is -* NULL, always return 0. Otherwise, return 0 if @hold_skb is sent -* successfully, or 1 for failure. +* Sends queued pdus to MAC layer for transmission. */ -static int llc_conn_send_pdus (struct sock *sk,struct sk_buff *hold_skb) +static void llc_conn_send_pdus (struct sock *sk) {struct sk_buff *skb; -int ret =0 ;while ((skb =skb_dequeue (&sk->sk_write_queue)) !=NULL ) {struct llc_pdu_sn *pdu =llc_pdu_sn_hdr (skb);
@@ -361,20 +357,10 @@ static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *hold_skb)skb_queue_tail (&llc_sk (sk)->pdu_unack_q, skb);if (!skb2)break ; -dev_queue_xmit (skb2); - }else { -bool is_target = skb == hold_skb; -int rc; - -if (is_target) -skb_get (skb); - rc =dev_queue_xmit (skb); -if (is_target) - ret = rc; + skb = skb2; } +dev_queue_xmit (skb); } - -return ret; }/**
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 27/99 llc: fix another potential sk_buff leak in llc_ui_sendmsg()
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit fc8d5db10cbe1338a52ebc74e7feab9276721774 ]
All callers of llc_conn_state_process() except llc_build_and_send_pkt() (via llc_ui_sendmsg() -> llc_ui_send_data()) assume that it always consumes a reference to the skb. Fix this caller to do the same.
--- net/llc/af_llc.c | 34 ++++++++++++++++++++-------------- net/llc/llc_conn.c | 2 ++ net/llc/llc_if.c | 12 ++++++++---- 3 files changed, 30 insertions(+), 18 deletions(-)
net/llc/af_llc.c +20 -14
@@ -113,22 +113,26 @@ static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr)* * Send data via reliable llc2 connection. * Returns 0 upon success, non-zero if action did not succeed. +* +* This function always consumes a reference to the skb. */ static int llc_ui_send_data (struct sock * sk,struct sk_buff *skb,int noblock) {struct llc_sock * llc =llc_sk (sk); -int rc =0 ;if (unlikely (llc_data_accept_state (llc->state) || llc->remote_busy_flag || llc->p_flag)) {long timeout =sock_sndtimeo (sk, noblock); +int rc; rc =llc_ui_wait_for_busy_core (sk, timeout); +if (rc) { +kfree_skb (skb); +return rc; + } } -if (unlikely (!rc)) - rc =llc_build_and_send_pkt (sk, skb); -return rc; +return llc_build_and_send_pkt (sk, skb); }static void llc_ui_sk_init (struct socket *sock,struct sock *sk)
@@ -899,7 +903,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);int flags = msg->msg_flags;int noblock = flags &MSG_DONTWAIT ; -struct sk_buff *skb; +struct sk_buff *skb =NULL ;size_t size =0 ;int rc = -EINVAL , copied =0 , hdrlen;
@@ -908,10 +912,10 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)lock_sock (sk);if (addr) {if (msg->msg_namelen <sizeof (*addr)) - goto release; + goto out; }else {if (llc_ui_addr_null (&llc->addr)) - goto release; + goto out; addr = &llc->addr; }/* must bind connection to sap if user hasn't done it. */
@@ -919,7 +923,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)/* bind to sap with null dev, exclusive. */ rc =llc_ui_autobind (sock, addr);if (rc) - goto release; + goto out; } hdrlen = llc->dev->hard_header_len +llc_ui_header_len (sk, addr); size = hdrlen + len;
@@ -928,12 +932,12 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) copied = size - hdrlen; rc = -EINVAL ;if (copied <0 ) - goto release; + goto out;release_sock (sk); skb =sock_alloc_send_skb (sk, size, noblock, &rc);lock_sock (sk);if (!skb) - goto release; + goto out; skb->dev = llc->dev; skb->protocol =llc_proto_type (addr->sllc_arphrd);skb_reserve (skb, hdrlen);
@@ -943,29 +947,31 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)if (sk->sk_type ==SOCK_DGRAM || addr->sllc_ua) {llc_build_and_send_ui_pkt (llc->sap, skb, addr->sllc_mac, addr->sllc_sap); + skb =NULL ; goto out; }if (addr->sllc_test) {llc_build_and_send_test_pkt (llc->sap, skb, addr->sllc_mac, addr->sllc_sap); + skb =NULL ; goto out; }if (addr->sllc_xid) {llc_build_and_send_xid_pkt (llc->sap, skb, addr->sllc_mac, addr->sllc_sap); + skb =NULL ; goto out; } rc = -ENOPROTOOPT ;if (!(sk->sk_type ==SOCK_STREAM && !addr->sllc_ua)) goto out; rc =llc_ui_send_data (sk, skb, noblock); + skb =NULL ; out: -if (rc) { -kfree_skb (skb); -release: +kfree_skb (skb); +if (rc)dprintk ("%s: failed sending from %02X to %02X: %d\n" , __func__, llc->laddr.lsap, llc->daddr.lsap, rc); - }release_sock (sk);return rc ? : copied; }
net/llc/llc_conn.c +2 -0
@@ -55,6 +55,8 @@ int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;* (executing it's actions and changing state), upper layer will be * indicated or confirmed, if needed. Returns 0 for success, 1 for * failure. The socket lock has to be held before calling this function. +* +* This function always consumes a reference to the skb. */ int llc_conn_state_process (struct sock *sk,struct sk_buff *skb) {
net/llc/llc_if.c +8 -4
@@ -38,6 +38,8 @@* closed and -EBUSY when sending data is not permitted in this state or * LLC has send an I pdu with p bit set to 1 and is waiting for it's * response. +* +* This function always consumes a reference to the skb. */ int llc_build_and_send_pkt (struct sock *sk,struct sk_buff *skb) {
@@ -46,20 +48,22 @@ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb)struct llc_sock *llc =llc_sk (sk);if (unlikely (llc->state ==LLC_CONN_STATE_ADM )) - goto out; + goto out_free; rc = -EBUSY ;if (unlikely (llc_data_accept_state (llc->state) ||/* data_conn_refuse */ llc->p_flag)) { llc->failed_data_req =1 ; - goto out; + goto out_free; } ev =llc_conn_ev (skb); ev->type =LLC_CONN_EV_TYPE_PRIM ; ev->prim =LLC_DATA_PRIM ; ev->prim_type =LLC_PRIM_TYPE_REQ ; skb->dev = llc->dev; - rc =llc_conn_state_process (sk, skb); -out: +return llc_conn_state_process (sk, skb); + +out_free: +kfree_skb (skb);return rc; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 28/99 llc: fix sk_buff refcounting in llc_conn_state_process()
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit 36453c852816f19947ca482a595dffdd2efa4965 ]
If llc_conn_state_process() sees that llc_conn_service() put the skb on a list, it will drop one fewer references to it. This is wrong because the current behavior is that llc_conn_service() never consumes a reference to the skb.
The code also makes the number of skb references being dropped conditional on which of ind_prim and cfm_prim are nonzero, yet neither of these affects how many references are *acquired*. So there is extra code that tries to fix this up by sometimes taking another reference.
Remove the unnecessary/broken refcounting logic and instead just add an skb_get() before the only two places where an extra reference is actually consumed.
--- net/llc/llc_conn.c | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-)
net/llc/llc_conn.c +6 -27
@@ -64,12 +64,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)struct llc_sock *llc =llc_sk (skb->sk);struct llc_conn_state_ev *ev =llc_conn_ev (skb); -/* -* We have to hold the skb, because llc_conn_service will kfree it in -* the sending path and we need to look at the skb->cb, where we encode -* llc_conn_state_ev. -*/ -skb_get (skb); ev->ind_prim = ev->cfm_prim =0 ;/* * Send event to state machine
@@ -77,21 +71,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) rc =llc_conn_service (skb->sk, skb);if (unlikely (rc !=0 )) {printk (KERN_ERR "%s: llc_conn_service failed\n" , __func__); - goto out_kfree_skb; - } - -if (unlikely (!ev->ind_prim && !ev->cfm_prim)) { -/* indicate or confirm not required */ -if (!skb->next) - goto out_kfree_skb; goto out_skb_put; } -if (unlikely (ev->ind_prim && ev->cfm_prim))/* Paranoia */ -skb_get (skb); -switch (ev->ind_prim) {case LLC_DATA_PRIM : +skb_get (skb);llc_save_primitive (sk, skb,LLC_DATA_PRIM );if (unlikely (sock_queue_rcv_skb (sk, skb))) {/*
@@ -108,6 +93,7 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)* skb->sk pointing to the newly created struct sock in * llc_conn_handler. -acme */ +skb_get (skb);skb_queue_tail (&sk->sk_receive_queue, skb); sk->sk_state_change (sk);break ;
@@ -123,7 +109,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) sk->sk_state_change (sk); } } -kfree_skb (skb);sock_put (sk);break ;case LLC_RESET_PRIM :
@@ -132,14 +117,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)* RESET is not being notified to upper layers for now */ printk (KERN_INFO "%s: received a reset ind!\n" , __func__); -kfree_skb (skb);break ;default : -if (ev->ind_prim) { +if (ev->ind_prim)printk (KERN_INFO "%s: received unknown %d prim!\n" , __func__, ev->ind_prim); -kfree_skb (skb); - }/* No indication */ break ; }
@@ -181,15 +163,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)printk (KERN_INFO "%s: received a reset conf!\n" , __func__);break ;default : -if (ev->cfm_prim) { +if (ev->cfm_prim)printk (KERN_INFO "%s: received unknown %d prim!\n" , __func__, ev->cfm_prim); -break ; - } - goto out_skb_put;/* No confirmation */ +/* No confirmation */ +break ; } -out_kfree_skb: -kfree_skb (skb); out_skb_put:kfree_skb (skb);return rc;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 29/99 selftests/bpf: Set rp_filter in test_flow_dissector
In reply to Sasha LevinFrom: Jiri Benc <[email protected]>
[ Upstream commit fd418b01fe26c2430b1091675cceb3ab2b52e1e0 ]
Many distributions enable rp_filter. However, the flow dissector test generates packets that have 1.1.1.1 set as (inner) source address without this address being reachable. This causes the selftest to fail.
The selftests should not assume a particular initial configuration. Switch off rp_filter.
--- tools/testing/selftests/bpf/test_flow_dissector.sh | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/bpf/test_flow_dissector.sh +3 -0
@@ -63,6 +63,9 @@ fi # Setup tc qdisc add dev lo ingress +echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter +echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter +echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter echo "Testing IPv4..." # Drops all IP/UDP packets coming from port 9
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 30/99 selftests/bpf: More compatible nc options in test_lwt_ip_encap
In reply to Sasha LevinFrom: Jiri Benc <[email protected]>
[ Upstream commit 106c35dda32f8b63f88cad7433f1b8bb0056958a ]
Out of the three nc implementations widely in use, at least two (BSD netcat and nmap-ncat) do not support -l combined with -s. Modify the nc invocation to be accepted by all of them.
--- tools/testing/selftests/bpf/test_lwt_ip_encap.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/test_lwt_ip_encap.sh +3 -3
@@ -314,15 +314,15 @@ test_gso() command -v nc >/dev/null 2>&1 || \ { echo >&2 "nc is not available: skipping TSO tests"; return; } - # listen on IPv*_DST, capture TCP into $TMPFILE + # listen on port 9000, capture TCP into $TMPFILE if [ "${PROTO}" == "IPv4" ] ; then IP_DST=${IPv4_DST} ip netns exec ${NS3} bash -c \ - "nc -4 -l -s ${IPv4_DST} -p 9000 > ${TMPFILE} &" + "nc -4 -l -p 9000 > ${TMPFILE} &" elif [ "${PROTO}" == "IPv6" ] ; then IP_DST=${IPv6_DST} ip netns exec ${NS3} bash -c \ - "nc -6 -l -s ${IPv6_DST} -p 9000 > ${TMPFILE} &" + "nc -6 -l -p 9000 > ${TMPFILE} &" RET=$? else echo " test_gso: unknown PROTO: ${PROTO}"
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 31/99 net_sched: fix backward compatibility for TCA_KIND
In reply to Sasha LevinFrom: Cong Wang <[email protected]>
[ Upstream commit 6f96c3c6904c26cea9ca2726d5d8a9b0b8205b3c ]
Marcelo noticed a backward compatibility issue of TCA_KIND after we move from NLA_STRING to NLA_NUL_STRING, so it is probably too late to change it.
Instead, to make everyone happy, we can just insert a NUL to terminate the string with nla_strlcpy() like we do for TC actions.
--- net/sched/cls_api.c | 36 +++++++++++++++++++++++++++++++++--- net/sched/sch_api.c | 3 +-- 2 files changed, 34 insertions(+), 5 deletions(-)
net/sched/cls_api.c +33 -3
@@ -160,11 +160,22 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp)return TC_H_MAJ (first); } +static bool tcf_proto_check_kind (struct nlattr *kind,char *name) +{ +if (kind) +return nla_strlcpy (name, kind,IFNAMSIZ ) >=IFNAMSIZ ; +memset (name,0 ,IFNAMSIZ ); +return false; +} +static bool tcf_proto_is_unlocked (const char *kind) {const struct tcf_proto_ops *ops;bool ret; +if (strlen (kind) ==0 ) +return false; + ops =tcf_proto_lookup_ops (kind, false,NULL );/* On error return false to take rtnl lock. Proto lookup/create * functions will perform lookup again and properly handle errors.
@@ -1976,6 +1987,7 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, {struct net *net =sock_net (skb->sk);struct nlattr *tca[TCA_MAX +1 ]; +char name[IFNAMSIZ ];struct tcmsg *t;u32 protocol;u32 prio;
@@ -2032,13 +2044,19 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n,if (err)return err; +if (tcf_proto_check_kind (tca[TCA_KIND ], name)) { +NL_SET_ERR_MSG (extack,"Specified TC filter name too long" ); + err = -EINVAL ; + goto errout; + } +/* Take rtnl mutex if rtnl_held was set to true on previous iteration, * block is shared (no qdisc found), qdisc is not unlocked, classifier * type is not specified, classifier is not unlocked. */ if (rtnl_held || (q && !(q->ops->cl_ops->flags &QDISC_CLASS_OPS_DOIT_UNLOCKED )) || - !tca[TCA_KIND ] || !tcf_proto_is_unlocked (nla_data (tca[TCA_KIND ]))) { + !tcf_proto_is_unlocked (name)) { rtnl_held = true;rtnl_lock (); }
@@ -2196,6 +2214,7 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n, {struct net *net =sock_net (skb->sk);struct nlattr *tca[TCA_MAX +1 ]; +char name[IFNAMSIZ ];struct tcmsg *t;u32 protocol;u32 prio;
@@ -2235,13 +2254,18 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n,if (err)return err; +if (tcf_proto_check_kind (tca[TCA_KIND ], name)) { +NL_SET_ERR_MSG (extack,"Specified TC filter name too long" ); + err = -EINVAL ; + goto errout; + }/* Take rtnl mutex if flushing whole chain, block is shared (no qdisc * found), qdisc is not unlocked, classifier type is not specified, * classifier is not unlocked. */ if (!prio || (q && !(q->ops->cl_ops->flags &QDISC_CLASS_OPS_DOIT_UNLOCKED )) || - !tca[TCA_KIND ] || !tcf_proto_is_unlocked (nla_data (tca[TCA_KIND ]))) { + !tcf_proto_is_unlocked (name)) { rtnl_held = true;rtnl_lock (); }
@@ -2349,6 +2373,7 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n, {struct net *net =sock_net (skb->sk);struct nlattr *tca[TCA_MAX +1 ]; +char name[IFNAMSIZ ];struct tcmsg *t;u32 protocol;u32 prio;
@@ -2385,12 +2410,17 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n,if (err)return err; +if (tcf_proto_check_kind (tca[TCA_KIND ], name)) { +NL_SET_ERR_MSG (extack,"Specified TC filter name too long" ); + err = -EINVAL ; + goto errout; + }/* Take rtnl mutex if block is shared (no qdisc found), qdisc is not * unlocked, classifier type is not specified, classifier is not * unlocked. */ if ((q && !(q->ops->cl_ops->flags &QDISC_CLASS_OPS_DOIT_UNLOCKED )) || - !tca[TCA_KIND ] || !tcf_proto_is_unlocked (nla_data (tca[TCA_KIND ]))) { + !tcf_proto_is_unlocked (name)) { rtnl_held = true;rtnl_lock (); }
net/sched/sch_api.c +1 -2
@@ -1390,8 +1390,7 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w) }const struct nla_policy rtm_tca_policy[TCA_MAX +1 ] = { - [TCA_KIND ] = { .type =NLA_NUL_STRING , - .len =IFNAMSIZ -1 }, + [TCA_KIND ] = { .type =NLA_STRING }, [TCA_RATE ] = { .type =NLA_BINARY , .len =sizeof (struct tc_estimator ) }, [TCA_STAB ] = { .type =NLA_NESTED },
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 32/99 net_sched: fix backward compatibility for TCA_ACT_KIND
In reply to Sasha LevinFrom: Cong Wang <[email protected]>
[ Upstream commit 4b793feccae3b06764268377a4030eb774ed924e ]
For TCA_ACT_KIND, we have to keep the backward compatibility too, and rely on nla_strlcpy() to check and terminate the string with a NUL.
Note for TC actions, nla_strcmp() is already used to compare kind strings, so we don't need to fix other places.
--- net/sched/act_api.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/sched/act_api.c +5 -4
@@ -832,8 +832,7 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb) }static const struct nla_policy tcf_action_policy[TCA_ACT_MAX +1 ] = { - [TCA_ACT_KIND ] = { .type =NLA_NUL_STRING , - .len =IFNAMSIZ -1 }, + [TCA_ACT_KIND ] = { .type =NLA_STRING }, [TCA_ACT_INDEX ] = { .type =NLA_U32 }, [TCA_ACT_COOKIE ] = { .type =NLA_BINARY , .len =TC_COOKIE_MAX_SIZE },
@@ -865,8 +864,10 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,NL_SET_ERR_MSG (extack,"TC action kind must be specified" ); goto err_out; } -nla_strlcpy (act_name, kind,IFNAMSIZ ); - +if (nla_strlcpy (act_name, kind,IFNAMSIZ ) >=IFNAMSIZ ) { +NL_SET_ERR_MSG (extack,"TC action name too long" ); + goto err_out; + }if (tb[TCA_ACT_COOKIE ]) { cookie =nla_memdup_cookie (tb);if (!cookie) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 33/99 NFC: pn533: fix use-after-free and memleaks
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ Upstream commit 6af3aa57a0984e061f61308fe181a9a12359fecc ]
The driver would fail to deregister and its class device and free related resources on late probe errors.
--- drivers/nfc/pn533/usb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/nfc/pn533/usb.c +8 -1
@@ -547,18 +547,25 @@ static int pn533_usb_probe(struct usb_interface *interface, rc =pn533_finalize_setup (priv);if (rc) - goto error; + goto err_deregister;usb_set_intfdata (interface, phy);return 0 ; +err_deregister: +pn533_unregister_device (phy->priv); error: +usb_kill_urb (phy->in_urb); +usb_kill_urb (phy->out_urb); +usb_kill_urb (phy->ack_urb); +usb_free_urb (phy->in_urb);usb_free_urb (phy->out_urb);usb_free_urb (phy->ack_urb);usb_put_dev (phy->udev);kfree (in_buf); +kfree (phy->ack_buffer);return rc; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 34/99 ip6erspan: remove the incorrect mtu limit for ip6erspan
In reply to Sasha LevinFrom: Haishuang Yan <[email protected]>
[ Upstream commit 4123f637a5129470ff9d3cb00a5a4e213f2e15cc ]
ip6erspan driver calls ether_setup(), after commit 61e84623ace3 ("net: centralize net_device min/max MTU checking"), the range of mtu is [min_mtu, max_mtu], which is [68, 1500] by default.
It causes the dev mtu of the erspan device to not be greater than 1500, this limit value is not correct for ip6erspan tap device.
--- net/ipv6/ip6_gre.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/ip6_gre.c +1 -0
@@ -2192,6 +2192,7 @@ static void ip6erspan_tap_setup(struct net_device *dev) {ether_setup (dev); + dev->max_mtu =0 ; dev->netdev_ops = &ip6erspan_netdev_ops; dev->needs_free_netdev = true; dev->priv_destructor = ip6gre_dev_free;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 35/99 iwlwifi: mvm: fix race in sync rx queue notification
In reply to Sasha LevinFrom: Naftali Goldstein <[email protected]>
[ Upstream commit a2113cc44d4387a7c3ef3a9082d273524f9230ac ]
Consider the following flow:
1. Driver starts to sync the rx queues due to a delba. mvm->queue_sync_cookie=1.
This rx-queues-sync is synchronous, so it doesn't increment the cookie until all rx queues handle the notification from FW.
2. During this time, driver starts to sync rx queues due to nssn sync required.
The cookie's value is still 1, but it doesn't matter since this rx-queue-sync is non-synchronous so in the notification handler the cookie is ignored.
What _does_ matter is that this flow increments the cookie to 2 immediately.
Remember though that the FW won't start servicing this command until it's done with the previous one.
3. FW is still handling the first command, so it sends a notification with internal_notif->sync=1, and internal_notif->cookie=0, which triggers a WARN_ONCE.
The solution for this race is to only use the mvm->queue_sync_cookie in case of a synchronous sync-rx-queues. This way in step 2 the cookie's value won't change so we avoid the WARN.
The commit in the "fixes" field is the first commit to introduce non-synchronous sending of this command to FW.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +5 -4
@@ -5080,11 +5080,11 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,if (!iwl_mvm_has_new_rx_api (mvm))return ; - notif->cookie = mvm->queue_sync_cookie; - -if (notif->sync) +if (notif->sync) { + notif->cookie = mvm->queue_sync_cookie;atomic_set (&mvm->queue_sync_counter, mvm->trans->num_rx_queues); + } ret =iwl_mvm_notify_rx_queue (mvm, qmask, (u8 *)notif, size, !notif->sync);
@@ -5104,7 +5104,8 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, out:atomic_set (&mvm->queue_sync_counter,0 ); - mvm->queue_sync_cookie++; +if (notif->sync) + mvm->queue_sync_cookie++; }static void iwl_mvm_sync_rx_queues (struct ieee80211_hw *hw)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 36/99 iwlwifi: dbg_ini: fix memory leak in alloc_sgtable
In reply to Sasha LevinFrom: Navid Emamdoost <[email protected]>
[ Upstream commit b4b814fec1a5a849383f7b3886b654a13abbda7d ]
In alloc_sgtable if alloc_page fails, the alocated table should be released.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +1 -0
@@ -643,6 +643,7 @@ static struct scatterlist *alloc_sgtable(int size)if (new_page)__free_page (new_page); } +kfree (table);return NULL ; } alloc_size =min_t (int, size,PAGE_SIZE );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 37/99 iwlwifi: pcie: fix memory leaks in iwl_pcie_ctxt_info_gen3_init
In reply to Sasha LevinFrom: Navid Emamdoost <[email protected]>
[ Upstream commit 0f4f199443faca715523b0659aa536251d8b978f ]
In iwl_pcie_ctxt_info_gen3_init there are cases that the allocated dma memory is leaked in case of error.
DMA memories prph_scratch, prph_info, and ctxt_info_gen3 are allocated and initialized to be later assigned to trans_pcie. But in any error case before such assignment the allocated memories should be released.
First of such error cases happens when iwl_pcie_init_fw_sec fails. Current implementation correctly releases prph_scratch. But in two sunsequent error cases where dma_alloc_coherent may fail, such releases are missing.
This commit adds release for prph_scratch when allocation for prph_info fails, and adds releases for prph_scratch and prph_info when allocation for ctxt_info_gen3 fails.
--- .../intel/iwlwifi/pcie/ctxt-info-gen3.c | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +25 -11
@@ -107,13 +107,9 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,/* allocate ucode sections in dram and set addresses */ ret =iwl_pcie_init_fw_sec (trans, fw, &prph_scratch->dram); -if (ret) { -dma_free_coherent (trans->dev, -sizeof (*prph_scratch), - prph_scratch, - trans_pcie->prph_scratch_dma_addr); -return ret; - } +if (ret) + goto err_free_prph_scratch; +/* Allocate prph information * currently we don't assign to the prph info anything, but it would get
@@ -121,16 +117,20 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, prph_info =dma_alloc_coherent (trans->dev,sizeof (*prph_info), &trans_pcie->prph_info_dma_addr,GFP_KERNEL ); -if (!prph_info) -return -ENOMEM ; +if (!prph_info) { + ret = -ENOMEM ; + goto err_free_prph_scratch; + }/* Allocate context info */ ctxt_info_gen3 =dma_alloc_coherent (trans->dev,sizeof (*ctxt_info_gen3), &trans_pcie->ctxt_info_dma_addr,GFP_KERNEL ); -if (!ctxt_info_gen3) -return -ENOMEM ; +if (!ctxt_info_gen3) { + ret = -ENOMEM ; + goto err_free_prph_info; + } ctxt_info_gen3->prph_info_base_addr =cpu_to_le64 (trans_pcie->prph_info_dma_addr);
@@ -186,6 +186,20 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,iwl_set_bit (trans,CSR_GP_CNTRL ,CSR_AUTO_FUNC_INIT );return 0 ; + +err_free_prph_info: +dma_free_coherent (trans->dev, +sizeof (*prph_info), + prph_info, + trans_pcie->prph_info_dma_addr); + +err_free_prph_scratch: +dma_free_coherent (trans->dev, +sizeof (*prph_scratch), + prph_scratch, + trans_pcie->prph_scratch_dma_addr); +return ret; + }void iwl_pcie_ctxt_info_gen3_free (struct iwl_trans *trans)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 38/99 iwlwifi: exclude GEO SAR support for 3168
In reply to Sasha LevinFrom: Luca Coelho <[email protected]>
[ Upstream commit 12e36d98d3e5acf5fc57774e0a15906d55f30cb9 ]
We currently support two NICs in FW version 29, namely 7265D and 3168. Out of these, only 7265D supports GEO SAR, so adjust the function that checks for it accordingly.
--- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +9 -7
@@ -887,15 +887,17 @@ static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm)* firmware versions. Unfortunately, we don't have a TLV API * flag to rely on, so rely on the major version which is in * the first byte of ucode_ver. This was implemented -* initially on version 38 and then backported to29 and 17. -* The intention was to have it in 36 as well, but not all -* 8000 family got this feature enabled. The 8000 family is -* the only one using version 36, so skip this version -* entirely. +* initially on version 38 and then backported to 17. It was +* also backported to 29, but only for 7265D devices. The +* intention was to have it in 36 as well, but not all 8000 +* family got this feature enabled. The 8000 family is the +* only one using version 36, so skip this version entirely. */ return IWL_UCODE_SERIAL (mvm->fw->ucode_ver) >=38 || -IWL_UCODE_SERIAL (mvm->fw->ucode_ver) ==29 || -IWL_UCODE_SERIAL (mvm->fw->ucode_ver) ==17 ; +IWL_UCODE_SERIAL (mvm->fw->ucode_ver) ==17 || + (IWL_UCODE_SERIAL (mvm->fw->ucode_ver) ==29 && + ((mvm->trans->hw_rev &CSR_HW_REV_TYPE_MSK ) == +CSR_HW_REV_TYPE_7265D )); }int iwl_mvm_get_sar_geo_profile (struct iwl_mvm *mvm)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 39/99 drm/amdgpu/powerplay: fix typo in mvdd table setup
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 598c30dbcc9434706f29a085a8eba4730573bcc2 ]
Polaris and vegam use count for the value rather than level. This looks like a copy paste typo from when the code was adapted from previous asics.
I'm not sure that the SMU actually uses this value, so I don't know that it actually is a bug per se.
--- drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | 2 +- drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 -1
@@ -655,7 +655,7 @@ static int polaris10_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, count =SMU_MAX_SMIO_LEVELS ;for (level =0 ; level < count; level++) { table->SmioTable2.Pattern[level].Voltage = -PP_HOST_TO_SMC_US (data->mvdd_voltage_table.entries[count].value *VOLTAGE_SCALE ); +PP_HOST_TO_SMC_US (data->mvdd_voltage_table.entries[level].value *VOLTAGE_SCALE );/* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/ table->SmioTable2.Pattern[level].Smio = (uint8_t ) level;
drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c +1 -1
@@ -456,7 +456,7 @@ static int vegam_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, count =SMU_MAX_SMIO_LEVELS ;for (level =0 ; level < count; level++) { table->SmioTable2.Pattern[level].Voltage =PP_HOST_TO_SMC_US ( - data->mvdd_voltage_table.entries[count].value *VOLTAGE_SCALE ); + data->mvdd_voltage_table.entries[level].value *VOLTAGE_SCALE );/* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/ table->SmioTable2.Pattern[level].Smio = (uint8_t ) level;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 40/99 net: stmmac: fix length of PTP clock's name string
In reply to Sasha LevinFrom: Antonio Borneo <[email protected]>
[ Upstream commit 5da202c88f8c355ad79bc2e8eb582e6d433060e7 ]
The field "name" in struct ptp_clock_info has a fixed size of 16 chars and is used as zero terminated string by clock_name_show() in drivers/ptp/ptp_sysfs.c
The current initialization value requires 17 chars to fit also the null termination, and this causes overflow to the next bytes in the struct when the string is read as null terminated:
hexdump -C /sys/class/ptp/ptp0/clock_name 00000000 73 74 6d 6d 61 63 5f 70 74 70 5f 63 6c 6f 63 6b |stmmac_ptp_clock| 00000010 a0 ac b9 03 0a |.....|
where the extra 4 bytes (excluding the newline) after the string represent the integer 0x03b9aca0 = 62500000 assigned to the field "max_adj" that follows "name" in the same struct.
There is no strict requirement for the "name" content and in the comment in ptp_clock_kernel.h it's reported it should just be 'A short "friendly name" to identify the clock'.
Replace it with "stmmac ptp".
--- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +1 -1
@@ -164,7 +164,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp,/* structure describing a PTP hardware clock */ static struct ptp_clock_info stmmac_ptp_clock_ops = { .owner =THIS_MODULE , - .name ="stmmac_ptp_clock" , + .name ="stmmac ptp" , .max_adj =62500000 , .n_alarm =0 , .n_ext_ts =0 ,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 41/99 net: stmmac: fix disabling flexible PPS output
In reply to Sasha LevinFrom: Antonio Borneo <[email protected]>
[ Upstream commit 520cf6002147281d1e7b522bb338416b623dcb93 ]
Accordingly to Synopsys documentation [1] and [2], when bit PPSEN0 in register MAC_PPS_CONTROL is set it selects the functionality command in the same register, otherwise selects the functionality control.
Command functionality is required to either enable (command 0x2) and disable (command 0x5) the flexible PPS output, but the bit PPSEN0 is currently set only for enabling.
Set the bit PPSEN0 to properly disable flexible PPS output.
Tested on STM32MP15x, based on dwmac 4.10a.
[1] DWC Ethernet QoS Databook 4.10a October 2014
[2] DWC Ethernet QoS Databook 5.00a September 2017
--- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/dwmac5.c +1 -0
@@ -515,6 +515,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,if (!enable) { val |=PPSCMDx (index,0x5 ); + val |=PPSEN0 ;writel (val, ioaddr +MAC_PPS_CONTROL );return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 42/99 bonding: fix potential NULL deref in bond_update_slave_arr
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit a7137534b597b7c303203e6bc3ed87e87a273bb8 ]
syzbot got a NULL dereference in bond_update_slave_arr() [1], happening after a failure to allocate bond->slave_arr
A workqueue (bond_slave_arr_handler) is supposed to retry the allocation later, but if the slave is removed before the workqueue had a chance to complete, bond->slave_arr can still be NULL.
[1]
Failed to build slave-array.
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN PTI Modules linked in: Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:bond_update_slave_arr.cold+0xc6/0x198 drivers/net/bonding/bond_main.c:4039 RSP: 0018:ffff88018fe33678 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffc9000290b000 RDX: 0000000000000000 RSI: ffffffff82b63037 RDI: ffff88019745ea20 RBP: ffff88018fe33760 R08: ffff880170754280 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: ffff88019745ea00 R14: 0000000000000000 R15: ffff88018fe338b0 FS: 00007febd837d700(0000) GS:ffff8801dad00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000004540a0 CR3: 00000001c242e005 CR4: 00000000001626f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: [<ffffffff82b5b45e>] __bond_release_one+0x43e/0x500 drivers/net/bonding/bond_main.c:1923 [<ffffffff82b5b966>] bond_release drivers/net/bonding/bond_main.c:2039 [inline] [<ffffffff82b5b966>] bond_do_ioctl+0x416/0x870 drivers/net/bonding/bond_main.c:3562 [<ffffffff83ae25f4>] dev_ifsioc+0x6f4/0x940 net/core/dev_ioctl.c:328 [<ffffffff83ae2e58>] dev_ioctl+0x1b8/0xc70 net/core/dev_ioctl.c:495 [<ffffffff83995ffd>] sock_do_ioctl+0x1bd/0x300 net/socket.c:1088 [<ffffffff83996a80>] sock_ioctl+0x300/0x5d0 net/socket.c:1196 [<ffffffff81b124db>] vfs_ioctl fs/ioctl.c:47 [inline] [<ffffffff81b124db>] file_ioctl fs/ioctl.c:501 [inline] [<ffffffff81b124db>] do_vfs_ioctl+0xacb/0x1300 fs/ioctl.c:688 [<ffffffff81b12dc6>] SYSC_ioctl fs/ioctl.c:705 [inline] [<ffffffff81b12dc6>] SyS_ioctl+0xb6/0xe0 fs/ioctl.c:696 [<ffffffff8101ccc8>] do_syscall_64+0x528/0x770 arch/x86/entry/common.c:305 [<ffffffff84400091>] entry_SYSCALL_64_after_hwframe+0x42/0xb7
--- drivers/net/bonding/bond_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +1 -1
@@ -4039,7 +4039,7 @@ int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave)* this to-be-skipped slave to send a packet out. */ old_arr =rtnl_dereference (bond->slave_arr); -for (idx =0 ; idx < old_arr->count; idx++) { +for (idx =0 ; old_arr !=NULL && idx < old_arr->count; idx++) {if (skipslave == old_arr->arr[idx]) { old_arr->arr[idx] = old_arr->arr[old_arr->count-1 ];
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 43/99 sctp: add chunks to sk_backlog when the newsk sk_socket is not set
In reply to Sasha LevinFrom: Xin Long <[email protected]>
[ Upstream commit 819be8108fded0b9e710bbbf81193e52f7bab2f7 ]
This patch is to fix a NULL-ptr deref in selinux_socket_connect_helper:
[...] kasan: GPF could be caused by NULL-ptr deref or user memory access [...] RIP: 0010:selinux_socket_connect_helper+0x94/0x460 [...] Call Trace:
[...] selinux_sctp_bind_connect+0x16a/0x1d0 [...] security_sctp_bind_connect+0x58/0x90 [...] sctp_process_asconf+0xa52/0xfd0 [sctp] [...] sctp_sf_do_asconf+0x785/0x980 [sctp] [...] sctp_do_sm+0x175/0x5a0 [sctp] [...] sctp_assoc_bh_rcv+0x285/0x5b0 [sctp] [...] sctp_backlog_rcv+0x482/0x910 [sctp] [...] __release_sock+0x11e/0x310 [...] release_sock+0x4f/0x180 [...] sctp_accept+0x3f9/0x5a0 [sctp] [...] inet_accept+0xe7/0x720
It was caused by that the 'newsk' sk_socket was not set before going to security sctp hook when processing asconf chunk with SCTP_PARAM_ADD_IP or SCTP_PARAM_SET_PRIMARY:
inet_accept()->
sctp_accept():
lock_sock():
lock listening 'sk'
do_softirq():
sctp_rcv(): <-- [1]
asconf chunk arrives and
enqueued in 'sk' backlog
sctp_sock_migrate():
set asoc's sk to 'newsk'
release_sock():
sctp_backlog_rcv():
lock 'newsk'
sctp_process_asconf() <-- [2]
unlock 'newsk'
sock_graft():
set sk_socket <-- [3]As it shows, at [1] the asconf chunk would be put into the listening 'sk' backlog, as accept() was holding its sock lock. Then at [2] asconf would get processed with 'newsk' as asoc's sk had been set to 'newsk'. However, 'newsk' sk_socket is not set until [3], while selinux_sctp_bind_connect() would deref it, then kernel crashed.
Here to fix it by adding the chunk to sk_backlog until newsk sk_socket is set when .accept() is done.
Note that sk->sk_socket can be NULL when the sock is closed, so SOCK_DEAD flag is also needed to check in sctp_newsk_ready().
Thanks to Ondrej for reviewing the code.
--- include/net/sctp/sctp.h | 5 +++++ net/sctp/input.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-)
include/net/sctp/sctp.h +5 -0
@@ -610,4 +610,9 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize) return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize); } +static inline bool sctp_newsk_ready (const struct sock *sk) +{ +return sock_flag (sk,SOCK_DEAD ) || sk->sk_socket; +} +#endif /* __net_sctp_h__ */
net/sctp/input.c +9 -3
@@ -243,7 +243,7 @@ int sctp_rcv(struct sk_buff *skb)bh_lock_sock (sk); } -if (sock_owned_by_user (sk)) { +if (sock_owned_by_user (sk) || !sctp_newsk_ready (sk)) {if (sctp_add_backlog (sk, skb)) {bh_unlock_sock (sk);sctp_chunk_free (chunk);
@@ -321,7 +321,7 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb)local_bh_disable ();bh_lock_sock (sk); -if (sock_owned_by_user (sk)) { +if (sock_owned_by_user (sk) || !sctp_newsk_ready (sk)) {if (sk_add_backlog (sk, skb, sk->sk_rcvbuf))sctp_chunk_free (chunk);else
@@ -336,7 +336,13 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb)if (backloged)return 0 ; }else { -sctp_inq_push (inqueue, chunk); +if (!sctp_newsk_ready (sk)) { +if (!sk_add_backlog (sk, skb, sk->sk_rcvbuf)) +return 0 ; +sctp_chunk_free (chunk); + }else { +sctp_inq_push (inqueue, chunk); + } } done:
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 44/99 s390/qeth: Fix error handling during VNICC initialization
In reply to Sasha LevinFrom: Alexandra Winter <[email protected]>
[ Upstream commit b528965bcc827dad32a8d21745feaacfc76c9703 ]
Smatch discovered the use of uninitialized variable sup_cmds in error paths.
--- drivers/s390/net/qeth_l2_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/s390/net/qeth_l2_main.c +7 -4
@@ -2035,10 +2035,10 @@ static bool qeth_l2_vnicc_recover_char(struct qeth_card *card, u32 vnicc,static void qeth_l2_vnicc_init (struct qeth_card *card) {u32 *timeout = &card->options.vnicc.learning_timeout; +bool enable, error = false;unsigned int chars_len, i;unsigned long chars_tmp;u32 sup_cmds, vnicc; -bool enable, error;QETH_CARD_TEXT (card,2 ,"vniccini" );/* reset rx_bcast */
@@ -2059,7 +2059,10 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) chars_len =sizeof (card->options.vnicc.sup_chars) *BITS_PER_BYTE ;for_each_set_bit (i, &chars_tmp, chars_len) { vnicc =BIT (i); -qeth_l2_vnicc_query_cmds (card, vnicc, &sup_cmds); +if (qeth_l2_vnicc_query_cmds (card, vnicc, &sup_cmds)) { + sup_cmds =0 ; + error = true; + }if (!(sup_cmds &IPA_VNICC_SET_TIMEOUT ) || !(sup_cmds &IPA_VNICC_GET_TIMEOUT )) card->options.vnicc.getset_timeout_sup &= ~vnicc;
@@ -2068,8 +2071,8 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) card->options.vnicc.set_char_sup &= ~vnicc; }/* enforce assumed default values and recover settings, if changed */ - error =qeth_l2_vnicc_recover_timeout (card,QETH_VNICC_LEARNING , - timeout); + error |=qeth_l2_vnicc_recover_timeout (card,QETH_VNICC_LEARNING , + timeout); chars_tmp = card->options.vnicc.wanted_chars ^QETH_VNICC_DEFAULT ; chars_tmp |=QETH_VNICC_BRIDGE_INVISIBLE ; chars_len =sizeof (card->options.vnicc.wanted_chars) *BITS_PER_BYTE ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 45/99 s390/qeth: Fix initialization of vnicc cmd masks during set online
In reply to Sasha LevinFrom: Alexandra Winter <[email protected]>
[ Upstream commit be40a86c319706f90caca144343c64743c32b953 ]
Without this patch, a command bit in the supported commands mask is only ever set to unsupported during set online. If a command is ever marked as unsupported (e.g. because of error during qeth_l2_vnicc_query_cmds), subsequent successful initialization (offline/online) would not bring it back.
--- drivers/s390/net/qeth_l2_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/s390/net/qeth_l2_main.c +8 -4
@@ -2063,11 +2063,15 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) sup_cmds =0 ; error = true; } -if (!(sup_cmds &IPA_VNICC_SET_TIMEOUT ) || - !(sup_cmds &IPA_VNICC_GET_TIMEOUT )) +if ((sup_cmds &IPA_VNICC_SET_TIMEOUT ) && + (sup_cmds &IPA_VNICC_GET_TIMEOUT )) + card->options.vnicc.getset_timeout_sup |= vnicc; +else card->options.vnicc.getset_timeout_sup &= ~vnicc; -if (!(sup_cmds &IPA_VNICC_ENABLE ) || - !(sup_cmds &IPA_VNICC_DISABLE )) +if ((sup_cmds &IPA_VNICC_ENABLE ) && + (sup_cmds &IPA_VNICC_DISABLE )) + card->options.vnicc.set_char_sup |= vnicc; +else card->options.vnicc.set_char_sup &= ~vnicc; }/* enforce assumed default values and recover settings, if changed */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 46/99 act_mirred: Fix mirred_init_module error handling
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 11c9a7d38af524217efb7a176ad322b97ac2f163 ]
If tcf_register_action failed, mirred_device_notifier should be unregistered.
--- net/sched/act_mirred.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sched/act_mirred.c +5 -1
@@ -479,7 +479,11 @@ static int __init mirred_init_module(void)return err;pr_info ("Mirror/redirect action on\n" ); -return tcf_register_action (&act_mirred_ops, &mirred_net_ops); + err =tcf_register_action (&act_mirred_ops, &mirred_net_ops); +if (err) +unregister_netdevice_notifier (&mirred_device_notifier); + +return err; } static void __exit mirred_cleanup_module(void)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 47/99 net: usb: qmi_wwan: add Telit 0x1050 composition
In reply to Sasha LevinFrom: Daniele Palmas <[email protected]>
[ Upstream commit e0ae2c578d3909e60e9448207f5d83f785f1129f ]
This patch adds support for Telit FN980 0x1050 composition
0x1050: tty, adb, rmnet, tty, tty, tty, tty
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1327,6 +1327,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 48/99 netns: fix NLM_F_ECHO mechanism for RTM_NEWNSID
In reply to Sasha LevinFrom: Nicolas Dichtel <[email protected]>
[ Upstream commit 993e4c929a073595d22c85f59082f0c387e31c21 ]
The flag NLM_F_ECHO aims to reply to the user the message notified to all listeners.
It was not the case with the command RTM_NEWNSID, let's fix this.
--- net/core/net_namespace.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
net/core/net_namespace.c +11 -6
@@ -245,7 +245,8 @@ static int __peernet2id(struct net *net, struct net *peer)return __peernet2id_alloc (net, peer, &no); } -static void rtnl_net_notifyid (struct net *net,int cmd,int id); +static void rtnl_net_notifyid (struct net *net,int cmd,int id,u32 portid, +struct nlmsghdr *nlh);/* This function returns the id of a peer netns. If no id is assigned, one will * be allocated and returned. */
@@ -268,7 +269,7 @@ int peernet2id_alloc(struct net *net, struct net *peer) id =__peernet2id_alloc (net, peer, &alloc);spin_unlock_bh (&net->nsid_lock);if (alloc && id >=0 ) -rtnl_net_notifyid (net,RTM_NEWNSID , id); +rtnl_net_notifyid (net,RTM_NEWNSID , id,0 ,NULL );if (alive)put_net (peer);return id;
@@ -532,7 +533,7 @@ static void unhash_nsid(struct net *net, struct net *last)idr_remove (&tmp->netns_ids, id);spin_unlock_bh (&tmp->nsid_lock);if (id >=0 ) -rtnl_net_notifyid (tmp,RTM_DELNSID , id); +rtnl_net_notifyid (tmp,RTM_DELNSID , id,0 ,NULL );if (tmp == last)break ; }
@@ -764,7 +765,8 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, err =alloc_netid (net, peer, nsid);spin_unlock_bh (&net->nsid_lock);if (err >=0 ) { -rtnl_net_notifyid (net,RTM_NEWNSID , err); +rtnl_net_notifyid (net,RTM_NEWNSID , err,NETLINK_CB (skb).portid, + nlh); err =0 ; }else if (err == -ENOSPC && nsid >=0 ) { err = -EEXIST ;
@@ -1051,9 +1053,12 @@ static int rtnl_net_dumpid(struct sk_buff *skb, struct netlink_callback *cb)return err <0 ? err : skb->len; } -static void rtnl_net_notifyid (struct net *net,int cmd,int id) +static void rtnl_net_notifyid (struct net *net,int cmd,int id,u32 portid, +struct nlmsghdr *nlh) {struct net_fill_args fillargs = { + .portid = portid, + .seq = nlh ? nlh->nlmsg_seq :0 , .cmd = cmd, .nsid = id, };
@@ -1068,7 +1073,7 @@ static void rtnl_net_notifyid(struct net *net, int cmd, int id)if (err <0 ) goto err_out; -rtnl_notify (msg, net,0 ,RTNLGRP_NSID ,NULL ,0 ); +rtnl_notify (msg, net, portid,RTNLGRP_NSID , nlh,0 );return ; err_out:
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 49/99 netfilter: conntrack: avoid possible false sharing
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit e37542ba111f3974dc622ae0a21c1787318de500 ]
As hinted by KCSAN, we need at least one READ_ONCE() to prevent a compiler optimization.
More details on :
https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE#it-may-improve-performance
sysbot report :
BUG: KCSAN: data-race in __nf_ct_refresh_acct / __nf_ct_refresh_acct
read to 0xffff888123eb4f08 of 4 bytes by interrupt on cpu 0:
__nf_ct_refresh_acct+0xd4/0x1b0 net/netfilter/nf_conntrack_core.c:1796 nf_ct_refresh_acct include/net/netfilter/nf_conntrack.h:201 [inline] nf_conntrack_tcp_packet+0xd40/0x3390 net/netfilter/nf_conntrack_proto_tcp.c:1161 nf_conntrack_handle_packet net/netfilter/nf_conntrack_core.c:1633 [inline] nf_conntrack_in+0x410/0xaa0 net/netfilter/nf_conntrack_core.c:1727 ipv4_conntrack_in+0x27/0x40 net/netfilter/nf_conntrack_proto.c:178 nf_hook_entry_hookfn include/linux/netfilter.h:135 [inline] nf_hook_slow+0x83/0x160 net/netfilter/core.c:512 nf_hook include/linux/netfilter.h:260 [inline] NF_HOOK include/linux/netfilter.h:303 [inline] ip_rcv+0x12f/0x1a0 net/ipv4/ip_input.c:523 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5004 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5118 netif_receive_skb_internal+0x59/0x190 net/core/dev.c:5208 napi_skb_finish net/core/dev.c:5671 [inline] napi_gro_receive+0x28f/0x330 net/core/dev.c:5704 receive_buf+0x284/0x30b0 drivers/net/virtio_net.c:1061 virtnet_receive drivers/net/virtio_net.c:1323 [inline] virtnet_poll+0x436/0x7d0 drivers/net/virtio_net.c:1428 napi_poll net/core/dev.c:6352 [inline] net_rx_action+0x3ae/0xa50 net/core/dev.c:6418 __do_softirq+0x115/0x33f kernel/softirq.c:292
write to 0xffff888123eb4f08 of 4 bytes by task 7191 on cpu 1:
__nf_ct_refresh_acct+0xfb/0x1b0 net/netfilter/nf_conntrack_core.c:1797 nf_ct_refresh_acct include/net/netfilter/nf_conntrack.h:201 [inline] nf_conntrack_tcp_packet+0xd40/0x3390 net/netfilter/nf_conntrack_proto_tcp.c:1161 nf_conntrack_handle_packet net/netfilter/nf_conntrack_core.c:1633 [inline] nf_conntrack_in+0x410/0xaa0 net/netfilter/nf_conntrack_core.c:1727 ipv4_conntrack_local+0xbe/0x130 net/netfilter/nf_conntrack_proto.c:200 nf_hook_entry_hookfn include/linux/netfilter.h:135 [inline] nf_hook_slow+0x83/0x160 net/netfilter/core.c:512 nf_hook include/linux/netfilter.h:260 [inline] __ip_local_out+0x1f7/0x2b0 net/ipv4/ip_output.c:114 ip_local_out+0x31/0x90 net/ipv4/ip_output.c:123 __ip_queue_xmit+0x3a8/0xa40 net/ipv4/ip_output.c:532 ip_queue_xmit+0x45/0x60 include/net/ip.h:236 __tcp_transmit_skb+0xdeb/0x1cd0 net/ipv4/tcp_output.c:1158 __tcp_send_ack+0x246/0x300 net/ipv4/tcp_output.c:3685 tcp_send_ack+0x34/0x40 net/ipv4/tcp_output.c:3691 tcp_cleanup_rbuf+0x130/0x360 net/ipv4/tcp.c:1575
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 7191 Comm: syz-fuzzer Not tainted 5.3.0+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/netfilter/nf_conntrack_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_core.c +2 -2
@@ -1793,8 +1793,8 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,if (nf_ct_is_confirmed (ct)) extra_jiffies += nfct_time_stamp; -if (ct->timeout != extra_jiffies) - ct->timeout = extra_jiffies; +if (READ_ONCE (ct->timeout) != extra_jiffies) +WRITE_ONCE (ct->timeout, extra_jiffies); acct:if (do_acct)nf_ct_acct_update (ct, ctinfo, skb->len);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 50/99 tun: remove possible false sharing in tun_flow_update()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 4ffdd22e49f47db543906d75453a0048a53071ab ]
As mentioned in https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE#it-may-improve-performance
a C compiler can legally transform
if (e->queue_index != queue_index)
e->queue_index = queue_index;
to :
e->queue_index = queue_index;
Note that the code using jiffies has no issue, since jiffies has volatile attribute.
if (e->updated != jiffies)
e->updated = jiffies;
--- drivers/net/tun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/tun.c +2 -2
@@ -526,8 +526,8 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, e =tun_flow_find (head, rxhash);if (likely (e)) {/* TODO: keep queueing to old queue until it's empty? */ -if (e->queue_index != queue_index) - e->queue_index = queue_index; +if (READ_ONCE (e->queue_index) != queue_index) +WRITE_ONCE (e->queue_index, queue_index);if (e->updated != jiffies) e->updated = jiffies;sock_rps_record_flow_hash (e->rps_rxhash);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 51/99 net: avoid possible false sharing in sk_leave_memory_pressure()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 503978aca46124cd714703e180b9c8292ba50ba7 ]
As mentioned in https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE#it-may-improve-performance
a C compiler can legally transform :
if (memory_pressure && *memory_pressure)
*memory_pressure = 0;
to :
if (memory_pressure)
*memory_pressure = 0;
--- net/core/sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/sock.c +2 -2
@@ -2331,8 +2331,8 @@ static void sk_leave_memory_pressure(struct sock *sk) }else {unsigned long *memory_pressure = sk->sk_prot->memory_pressure; -if (memory_pressure && *memory_pressure) - *memory_pressure =0 ; +if (memory_pressure &&READ_ONCE (*memory_pressure)) +WRITE_ONCE (*memory_pressure,0 ); } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 52/99 net: add {READ|WRITE}_ONCE() annotations on ->rskq_accept_head
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 60b173ca3d1cd1782bd0096dc17298ec242f6fb1 ]
reqsk_queue_empty() is called from inet_csk_listen_poll() while other cpus might write ->rskq_accept_head value.
Use {READ|WRITE}_ONCE() to avoid compiler tricks
and potential KCSAN splats.
--- drivers/xen/pvcalls-back.c | 2 +- include/net/request_sock.h | 4 ++-- net/ipv4/inet_connection_sock.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/xen/pvcalls-back.c +1 -1
@@ -775,7 +775,7 @@ static int pvcalls_back_poll(struct xenbus_device *dev, mappass->reqcopy = *req; icsk =inet_csk (mappass->sock->sk); queue = &icsk->icsk_accept_queue; - data = queue->rskq_accept_head !=NULL ; + data =READ_ONCE (queue->rskq_accept_head) !=NULL ;if (data) { mappass->reqcopy.cmd =0 ; ret =0 ;
include/net/request_sock.h +2 -2
@@ -185,7 +185,7 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req,static inline bool reqsk_queue_empty (const struct request_sock_queue *queue) { -return queue->rskq_accept_head ==NULL ; +return READ_ONCE (queue->rskq_accept_head) ==NULL ; } static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue,
@@ -197,7 +197,7 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue req = queue->rskq_accept_head;if (req) {sk_acceptq_removed (parent); - queue->rskq_accept_head = req->dl_next; +WRITE_ONCE (queue->rskq_accept_head, req->dl_next);if (queue->rskq_accept_head ==NULL ) queue->rskq_accept_tail =NULL ; }
net/ipv4/inet_connection_sock.c +1 -1
@@ -934,7 +934,7 @@ struct sock *inet_csk_reqsk_queue_add(struct sock *sk, req->sk = child; req->dl_next =NULL ;if (queue->rskq_accept_head ==NULL ) - queue->rskq_accept_head = req; +WRITE_ONCE (queue->rskq_accept_head, req);else queue->rskq_accept_tail->dl_next = req; queue->rskq_accept_tail = req;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 53/99 net/smc: fix SMCD link group creation with VLAN id
In reply to Sasha LevinFrom: Ursula Braun <[email protected]>
[ Upstream commit 29ee2701529e1905c0e948688f9688c68c8d4ea4 ]
If creation of an SMCD link group with VLAN id fails, the initial smc_ism_get_vlan() step has to be reverted as well.
--- net/smc/smc_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/smc/smc_core.c +4 -1
@@ -213,7 +213,7 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini) lgr =kzalloc (sizeof (*lgr),GFP_KERNEL );if (!lgr) { rc =SMC_CLC_DECL_MEM ; - goto out; + goto ism_put_vlan; } lgr->is_smcd = ini->is_smcd; lgr->sync_err =0 ;
@@ -289,6 +289,9 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)smc_llc_link_clear (lnk); free_lgr:kfree (lgr); +ism_put_vlan: +if (ini->is_smcd && ini->vlan_id) +smc_ism_put_vlan (ini->ism_dev, ini->vlan_id); out:if (rc <0 ) {if (rc == -ENOMEM )
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 54/99 net/smc: receive returns without data
In reply to Sasha LevinFrom: Karsten Graul <[email protected]>
[ Upstream commit 882dcfe5a1785c20f45820cbe6fec4b8b647c946 ]
smc_cdc_rxed_any_close_or_senddone() is used as an end condition for the receive loop. This conflicts with smc_cdc_msg_recv_action() which could run in parallel and set the bits checked by smc_cdc_rxed_any_close_or_senddone() before the receive is processed. In that case we could return from receive with no data, although data is available. The same applies to smc_rx_wait().
Fix this by checking for RCV_SHUTDOWN only, which is set in smc_cdc_msg_recv_action() after the receive was actually processed.
--- net/smc/smc_rx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/smc/smc_rx.c +1 -3
@@ -211,8 +211,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, rc =sk_wait_event (sk, timeo, sk->sk_err || sk->sk_shutdown &RCV_SHUTDOWN || -fcrit (conn) || -smc_cdc_rxed_any_close_or_senddone (conn), +fcrit (conn), &wait);remove_wait_queue (sk_sleep (sk), &wait);sk_clear_bit (SOCKWQ_ASYNC_WAITDATA , sk);
@@ -310,7 +309,6 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,smc_rx_update_cons (smc,0 );if (sk->sk_shutdown &RCV_SHUTDOWN || -smc_cdc_rxed_any_close_or_senddone (conn) || conn->local_tx_ctrl.conn_state_flags.peer_conn_abort)break ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 55/99 net/smc: receive pending data after RCV_SHUTDOWN
In reply to Sasha LevinFrom: Karsten Graul <[email protected]>
[ Upstream commit 107529e31a87acd475ff6a0f82745821b8f70fec ]
smc_rx_recvmsg() first checks if data is available, and then if RCV_SHUTDOWN is set. There is a race when smc_cdc_msg_recv_action() runs in between these 2 checks, receives data and sets RCV_SHUTDOWN. In that case smc_rx_recvmsg() would return from receive without to process the available data.
Fix that with a final check for data available if RCV_SHUTDOWN is set. Move the check for data into a function and call it twice. And use the existing helper smc_rx_data_available().
--- net/smc/smc_rx.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
net/smc/smc_rx.c +20 -5
@@ -261,6 +261,18 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len,return -EAGAIN ; } +static bool smc_rx_recvmsg_data_available (struct smc_sock *smc) +{ +struct smc_connection *conn = &smc->conn; + +if (smc_rx_data_available (conn)) +return true; +else if (conn->urg_state ==SMC_URG_VALID ) +/* we received a single urgent Byte - skip */ +smc_rx_update_cons (smc,0 ); +return false; +} +/* smc_rx_recvmsg - receive data from RMBE * @msg: copy data to receive buffer * @pipe: copy data to pipe if set - indicates splice() call
@@ -302,15 +314,18 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,if (read_done >= target || (pipe && read_done))break ; -if (atomic_read (&conn->bytes_to_rcv)) +if (smc_rx_recvmsg_data_available (smc)) goto copy; -else if (conn->urg_state ==SMC_URG_VALID ) -/* we received a single urgent Byte - skip */ -smc_rx_update_cons (smc,0 );if (sk->sk_shutdown &RCV_SHUTDOWN || - conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) + conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) { +/* smc_cdc_msg_recv_action() could have run after +* above smc_rx_recvmsg_data_available() +*/ +if (smc_rx_recvmsg_data_available (smc)) + goto copy;break ; + }if (read_done) { if (sk->sk_err ||
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 56/99 drm/msm/dsi: Implement reset correctly
In reply to Sasha LevinFrom: Jeffrey Hugo <[email protected]>
[ Upstream commit 78e31c42261779a01bc73472d0f65f15378e9de3 ]
On msm8998, vblank timeouts are observed because the DSI controller is not reset properly, which ends up stalling the MDP. This is because the reset logic is not correct per the hardware documentation.
The documentation states that after asserting reset, software should wait some time (no indication of how long), or poll the status register until it returns 0 before deasserting reset.
wmb() is insufficient for this purpose since it just ensures ordering, not timing between writes. Since asserting and deasserting reset occurs on the same register, ordering is already guaranteed by the architecture, making the wmb extraneous.
Since we would define a timeout for polling the status register to avoid a possible infinite loop, lets just use a static delay of 20 ms, since 16.666 ms is the time available to process one frame at 60 fps.
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +4 -2
@@ -26,6 +26,8 @@#include "dsi_cfg.h" #include "msm_kms.h" +#define DSI_RESET_TOGGLE_DELAY_MS 20 +static int dsi_get_version (const void __iomem *base,u32 *major,u32 *minor) {u32 ver;
@@ -986,7 +988,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host)wmb ();/* clocks need to be enabled before reset */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (DSI_RESET_TOGGLE_DELAY_MS );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 ); }
@@ -1396,7 +1398,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host)/* dsi controller can only be reset while clocks are running */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (DSI_RESET_TOGGLE_DELAY_MS );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 );wmb ();/* controller out of reset */ dsi_write (msm_host,REG_DSI_CTRL , data0);
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 57/99 vhost/test: stop device before reset
In reply to Sasha LevinFrom: "Michael S. Tsirkin" <[email protected]>
[ Upstream commit 245cdd9fbd396483d501db83047116e2530f245f ]
When device stop was moved out of reset, test device wasn't updated to stop before reset, this resulted in a use after free. Fix by invoking stop appropriately.
--- drivers/vhost/test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/vhost/test.c +2 -0
@@ -161,6 +161,7 @@ static int vhost_test_release(struct inode *inode, struct file *f)vhost_test_stop (n, &private);vhost_test_flush (n); +vhost_dev_stop (&n->dev);vhost_dev_cleanup (&n->dev);/* We do an extra flush before freeing memory, * since jobs can re-queue themselves. */
@@ -237,6 +238,7 @@ static long vhost_test_reset_owner(struct vhost_test *n) }vhost_test_stop (n, &priv);vhost_test_flush (n); +vhost_dev_stop (&n->dev);vhost_dev_reset_owner (&n->dev, umem); done:mutex_unlock (&n->dev.mutex);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 57/99 vhost/test: stop device before reset
In reply to Sasha LevinFrom: "Michael S. Tsirkin" <[email protected]>
[ Upstream commit 245cdd9fbd396483d501db83047116e2530f245f ]
When device stop was moved out of reset, test device wasn't updated to stop before reset, this resulted in a use after free. Fix by invoking stop appropriately.
--- drivers/vhost/test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/vhost/test.c +2 -0
@@ -161,6 +161,7 @@ static int vhost_test_release(struct inode *inode, struct file *f)vhost_test_stop (n, &private);vhost_test_flush (n); +vhost_dev_stop (&n->dev);vhost_dev_cleanup (&n->dev);/* We do an extra flush before freeing memory, * since jobs can re-queue themselves. */
@@ -237,6 +238,7 @@ static long vhost_test_reset_owner(struct vhost_test *n) }vhost_test_stop (n, &priv);vhost_test_flush (n); +vhost_dev_stop (&n->dev);vhost_dev_reset_owner (&n->dev, umem); done:mutex_unlock (&n->dev.mutex);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 58/99 net/ibmvnic: Fix EOI when running in XIVE mode.
In reply to Sasha LevinFrom: Cédric Le Goater <[email protected]>
[ Upstream commit 11d49ce9f7946dfed4dcf5dbde865c78058b50ab ]
pSeries machines on POWER9 processors can run with the XICS (legacy) interrupt mode or with the XIVE exploitation interrupt mode. These interrupt contollers have different interfaces for interrupt management : XICS uses hcalls and XIVE loads and stores on a page. H_EOI being a XICS interface the enable_scrq_irq() routine can fail when the machine runs in XIVE mode.
Fix that by calling the EOI handler of the interrupt chip.
--- drivers/net/ethernet/ibm/ibmvnic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -5
@@ -2772,12 +2772,10 @@ static int enable_scrq_irq(struct ibmvnic_adapter *adapter,if (adapter->resetting && adapter->reset_reason ==VNIC_RESET_MOBILITY ) { -u64 val = (0xff000000 ) | scrq->hw_irq; +struct irq_desc *desc =irq_to_desc (scrq->irq); +struct irq_chip *chip =irq_desc_get_chip (desc); - rc =plpar_hcall_norets (H_EOI , val); -if (rc) -dev_err (dev,"H_EOI FAILED irq 0x%llx. rc=%ld\n" , - val, rc); + chip->irq_eoi (&desc->irq_data); } rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 59/99 netdevsim: Fix error handling in nsim_fib_init and nsim_fib_exit
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 33902b4a4227877896dd9368ac10f4ca0d100de5 ]
In nsim_fib_init(), if register_fib_notifier failed, nsim_fib_net_ops should be unregistered before return.
In nsim_fib_exit(), unregister_fib_notifier should be called before nsim_fib_net_ops be unregistered, otherwise may cause use-after-free:
BUG: KASAN: use-after-free in nsim_fib_event_nb+0x342/0x570 [netdevsim] Read of size 8 at addr ffff8881daaf4388 by task kworker/0:3/3499 CPU: 0 PID: 3499 Comm: kworker/0:3 Not tainted 5.3.0-rc7+ #30 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 Workqueue: ipv6_addrconf addrconf_dad_work [ipv6] Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xa9/0x10e lib/dump_stack.c:113 print_address_description+0x65/0x380 mm/kasan/report.c:351 __kasan_report+0x149/0x18d mm/kasan/report.c:482 kasan_report+0xe/0x20 mm/kasan/common.c:618 nsim_fib_event_nb+0x342/0x570 [netdevsim] notifier_call_chain+0x52/0xf0 kernel/notifier.c:95 __atomic_notifier_call_chain+0x78/0x140 kernel/notifier.c:185 call_fib_notifiers+0x30/0x60 net/core/fib_notifier.c:30 call_fib6_entry_notifiers+0xc1/0x100 [ipv6] fib6_add+0x92e/0x1b10 [ipv6] __ip6_ins_rt+0x40/0x60 [ipv6] ip6_ins_rt+0x84/0xb0 [ipv6] __ipv6_ifa_notify+0x4b6/0x550 [ipv6] ipv6_ifa_notify+0xa5/0x180 [ipv6] addrconf_dad_completed+0xca/0x640 [ipv6] addrconf_dad_work+0x296/0x960 [ipv6] process_one_work+0x5c0/0xc00 kernel/workqueue.c:2269 worker_thread+0x5c/0x670 kernel/workqueue.c:2415 kthread+0x1d7/0x200 kernel/kthread.c:255 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352 Allocated by task 3388: save_stack+0x19/0x80 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc.constprop.3+0xa0/0xd0 mm/kasan/common.c:493 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:748 [inline] ops_init+0xa9/0x220 net/core/net_namespace.c:127 __register_pernet_operations net/core/net_namespace.c:1135 [inline] register_pernet_operations+0x1d4/0x420 net/core/net_namespace.c:1212 register_pernet_subsys+0x24/0x40 net/core/net_namespace.c:1253 nsim_fib_init+0x12/0x70 [netdevsim] veth_get_link_ksettings+0x2b/0x50 [veth] do_one_initcall+0xd4/0x454 init/main.c:939 do_init_module+0xe0/0x330 kernel/module.c:3490 load_module+0x3c2f/0x4620 kernel/module.c:3841 __do_sys_finit_module+0x163/0x190 kernel/module.c:3931 do_syscall_64+0x72/0x2e0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 3534: save_stack+0x19/0x80 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_slab_free+0x130/0x180 mm/kasan/common.c:455 slab_free_hook mm/slub.c:1423 [inline] slab_free_freelist_hook mm/slub.c:1474 [inline] slab_free mm/slub.c:3016 [inline] kfree+0xe9/0x2d0 mm/slub.c:3957 ops_free net/core/net_namespace.c:151 [inline] ops_free_list.part.7+0x156/0x220 net/core/net_namespace.c:184 ops_free_list net/core/net_namespace.c:182 [inline] __unregister_pernet_operations net/core/net_namespace.c:1165 [inline] unregister_pernet_operations+0x221/0x2a0 net/core/net_namespace.c:1224 unregister_pernet_subsys+0x1d/0x30 net/core/net_namespace.c:1271 nsim_fib_exit+0x11/0x20 [netdevsim] nsim_module_exit+0x16/0x21 [netdevsim] __do_sys_delete_module kernel/module.c:1015 [inline] __se_sys_delete_module kernel/module.c:958 [inline] __x64_sys_delete_module+0x244/0x330 kernel/module.c:958 do_syscall_64+0x72/0x2e0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe
--- drivers/net/netdevsim/fib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/netdevsim/fib.c +2 -1
@@ -241,8 +241,8 @@ static struct pernet_operations nsim_fib_net_ops = {void nsim_fib_exit (void ) { -unregister_pernet_subsys (&nsim_fib_net_ops);unregister_fib_notifier (&nsim_fib_nb); +unregister_pernet_subsys (&nsim_fib_net_ops); }int nsim_fib_init (void )
@@ -258,6 +258,7 @@ int nsim_fib_init(void) err =register_fib_notifier (&nsim_fib_nb, nsim_fib_dump_inconsistent);if (err <0 ) {pr_err ("Failed to register fib notifier\n" ); +unregister_pernet_subsys (&nsim_fib_net_ops); goto err_out; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 60/99 ath10k: fix latency issue for QCA988x
In reply to Sasha LevinFrom: Miaoqing Pan <[email protected]>
[ Upstream commit d79749f7716d9dc32fa2d5075f6ec29aac63c76d ]
(kvalo: cherry picked from commit 1340cc631bd00431e2f174525c971f119df9efa1 in wireless-drivers-next to wireless-drivers as this a frequently reported regression)
Bad latency is found on QCA988x, the issue was introduced by commit 4504f0e5b571 ("ath10k: sdio: workaround firmware UART pin configuration bug"). If uart_pin_workaround is false, this change will set uart pin even if uart_print is false.
Tested HW: QCA9880
Tested FW: 10.2.4-1.0-00037
--- drivers/net/wireless/ath/ath10k/core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +9 -6
@@ -2118,12 +2118,15 @@ static int ath10k_init_uart(struct ath10k *ar)return ret; } -if (!uart_print && ar->hw_params.uart_pin_workaround) { - ret =ath10k_bmi_write32 (ar, hi_dbg_uart_txpin, - ar->hw_params.uart_pin); -if (ret) { -ath10k_warn (ar,"failed to set UART TX pin: %d" , ret); -return ret; +if (!uart_print) { +if (ar->hw_params.uart_pin_workaround) { + ret =ath10k_bmi_write32 (ar, hi_dbg_uart_txpin, + ar->hw_params.uart_pin); +if (ret) { +ath10k_warn (ar,"failed to set UART TX pin: %d" , + ret); +return ret; + } }return 0 ;
Signature · 7 lines
2.20.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 61/99 drm/ttm: fix busy reference in ttm_mem_evict_first
In reply to Sasha LevinFrom: Christian König <[email protected]>
[ Upstream commit 73a88e4ce31055c415f1ddb55e3f08c9393cf4e3 ]
The busy BO might actually be already deleted,
so grab only a list reference.
--- drivers/gpu/drm/ttm/ttm_bo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +2 -2
@@ -874,11 +874,11 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,if (!bo) {if (busy_bo) -ttm_bo_get (busy_bo); +kref_get (&busy_bo->list_kref);spin_unlock (&glob->lru_lock); ret =ttm_mem_evict_wait_busy (busy_bo, ctx, ticket);if (busy_bo) -ttm_bo_put (busy_bo); +kref_put (&busy_bo->list_kref, ttm_bo_release_list);return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 62/99 drm/ttm: fix handling in ttm_bo_add_mem_to_lru
In reply to Sasha LevinFrom: Christian König <[email protected]>
[ Upstream commit 7fbc899ddeaa9aaef0ba646529089149572c84ee ]
We should not add the BO to the swap LRU when the new mem is fixed and the TTM object about to be destroyed.
--- drivers/gpu/drm/ttm/ttm_bo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +3 -2
@@ -184,8 +184,9 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo,list_add_tail (&bo->lru, &man->lru[bo->priority]);kref_get (&bo->list_kref); -if (bo->ttm && !(bo->ttm->page_flags & - (TTM_PAGE_FLAG_SG |TTM_PAGE_FLAG_SWAPPED ))) { +if (!(man->flags &TTM_MEMTYPE_FLAG_FIXED ) && bo->ttm && + !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG | +TTM_PAGE_FLAG_SWAPPED ))) {list_add_tail (&bo->swap, &bdev->glob->swap_lru[bo->priority]);kref_get (&bo->list_kref); }
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 63/99 platform/x86: i2c-multi-instantiate: Fail the probe if no IRQ provided
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 832392db9747b9c95724d37fc6a5dadd3d4ec514 ]
For APIC case of interrupt we don't fail a ->probe() of the driver, which makes kernel to print a lot of warnings from the children.
We have two options here:
- switch to platform_get_irq_optional(), though it won't stop children to be probed and failed
- fail the ->probe() of i2c-multi-instantiate
Since the in reality we never had devices in the wild where IRQ resource is optional, the latter solution suits the best.
--- drivers/platform/x86/i2c-multi-instantiate.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/i2c-multi-instantiate.c +1 -0
@@ -110,6 +110,7 @@ static int i2c_multi_inst_probe(struct platform_device *pdev)if (ret <0 ) {dev_dbg (dev,"Error requesting irq at index %d: %d\n" , inst_data[i].irq_idx, ret); + goto error; } board_info.irq = ret;break ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 64/99 hrtimer: Annotate lockless access to timer->base
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit ff229eee3d897f52bd001c841f2d3cce8853ecdc ]
Followup to commit dd2261ed45aa ("hrtimer: Protect lockless access to timer->base")
lock_hrtimer_base() fetches timer->base without lock exclusion.
Compiler is allowed to read timer->base twice (even if considered dumb) which could end up trying to lock migration_base and return &migration_base.
base = timer->base;
if (likely(base != &migration_base)) { /* compiler reads timer->base again, and now (base == &migration_base)
raw_spin_lock_irqsave(&base->cpu_base->lock, *flags);
if (likely(base == timer->base))
return base; /* == &migration_base ! */Similarly the write sides must use WRITE_ONCE() to avoid store tearing.
--- kernel/time/hrtimer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/time/hrtimer.c +4 -4
@@ -159,7 +159,7 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,struct hrtimer_clock_base *base;for (;;) { - base = timer->base; + base =READ_ONCE (timer->base);if (likely (base != &migration_base)) {raw_spin_lock_irqsave (&base->cpu_base->lock, *flags);if (likely (base == timer->base))
@@ -239,7 +239,7 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base,return base;/* See the comment in lock_hrtimer_base() */ - timer->base = &migration_base; +WRITE_ONCE (timer->base, &migration_base);raw_spin_unlock (&base->cpu_base->lock);raw_spin_lock (&new_base->cpu_base->lock);
@@ -248,10 +248,10 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base,raw_spin_unlock (&new_base->cpu_base->lock);raw_spin_lock (&base->cpu_base->lock); new_cpu_base = this_cpu_base; - timer->base = base; +WRITE_ONCE (timer->base, base); goto again; } - timer->base = new_base; +WRITE_ONCE (timer->base, new_base); }else {if (new_cpu_base != this_cpu_base &&hrtimer_check_target (timer, new_base)) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 65/99 nvme-pci: Free tagset if no IO queues
In reply to Sasha LevinFrom: Keith Busch <[email protected]>
[ Upstream commit 770597ecb2075390c01c425b8b1f551347f1bd70 ]
If a controller becomes degraded after a reset, we will not be able to perform any IO. We currently teardown previously created request queues and namespaces, but we had kept the unusable tagset. Free it after all queues using it have been released.
--- drivers/nvme/host/pci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/nvme/host/pci.c +9 -2
@@ -2438,14 +2438,20 @@ static void nvme_release_prp_pools(struct nvme_dev *dev)dma_pool_destroy (dev->prp_small_pool); } +static void nvme_free_tagset (struct nvme_dev *dev) +{ +if (dev->tagset.tags) +blk_mq_free_tag_set (&dev->tagset); + dev->ctrl.tagset =NULL ; +} +static void nvme_pci_free_ctrl (struct nvme_ctrl *ctrl) {struct nvme_dev *dev =to_nvme_dev (ctrl);nvme_dbbuf_dma_free (dev);put_device (dev->dev); -if (dev->tagset.tags) -blk_mq_free_tag_set (&dev->tagset); +nvme_free_tagset (dev);if (dev->ctrl.admin_q)blk_put_queue (dev->ctrl.admin_q);kfree (dev->queues);
@@ -2564,6 +2570,7 @@ static void nvme_reset_work(struct work_struct *work)nvme_kill_queues (&dev->ctrl);nvme_remove_namespaces (&dev->ctrl); new_state =NVME_CTRL_ADMIN_ONLY ; +nvme_free_tagset (dev); }else {nvme_start_queues (&dev->ctrl);nvme_wait_freeze (&dev->ctrl);
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 66/99 nvme: Prevent resets during paused controller state
In reply to Sasha LevinFrom: Keith Busch <[email protected]>
[ Upstream commit 4c75f877853cfa81b12374a07208e07b077f39b8 ]
A paused controller is doing critical internal activation work in the background. Prevent subsequent controller resets from occurring during this period by setting the controller state to RESETTING first. A helper function, nvme_try_sched_reset_work(), is introduced for these paths so they may continue with scheduling the reset_work after they've completed their uninterruptible critical section.
--- drivers/nvme/host/core.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
drivers/nvme/host/core.c +25 -4
@@ -118,6 +118,21 @@ static void nvme_queue_scan(struct nvme_ctrl *ctrl)queue_work (nvme_wq, &ctrl->scan_work); } +/* +* Use this function to proceed with scheduling reset_work for a controller +* that had previously been set to the resetting state. This is intended for +* code paths that can't be interrupted by other reset attempts. A hot removal +* may prevent this from succeeding. +*/ +static int nvme_try_sched_reset (struct nvme_ctrl *ctrl) +{ +if (ctrl->state !=NVME_CTRL_RESETTING ) +return -EBUSY ; +if (!queue_work (nvme_reset_wq, &ctrl->reset_work)) +return -EBUSY ; +return 0 ; +} +int nvme_reset_ctrl (struct nvme_ctrl *ctrl) {if (!nvme_change_ctrl_state (ctrl,NVME_CTRL_RESETTING ))
@@ -3687,13 +3702,13 @@ static void nvme_fw_act_work(struct work_struct *work)if (time_after (jiffies, fw_act_timeout)) {dev_warn (ctrl->device,"Fw activation timeout, reset controller\n" ); -nvme_reset_ctrl (ctrl); -break ; +nvme_try_sched_reset (ctrl); +return ; }msleep (100 ); } -if (ctrl->state !=NVME_CTRL_LIVE ) +if (!nvme_change_ctrl_state (ctrl,NVME_CTRL_LIVE ))return ;nvme_start_queues (ctrl);
@@ -3713,7 +3728,13 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)nvme_queue_scan (ctrl);break ;case NVME_AER_NOTICE_FW_ACT_STARTING : -queue_work (nvme_wq, &ctrl->fw_act_work); +/* +* We are (ab)using the RESETTING state to prevent subsequent +* recovery actions from interfering with the controller's +* firmware activation. +*/ +if (nvme_change_ctrl_state (ctrl,NVME_CTRL_RESETTING )) +queue_work (nvme_wq, &ctrl->fw_act_work);break ;#ifdef CONFIG_NVME_MULTIPATH case NVME_AER_NOTICE_ANA :
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 67/99 xtensa: fix {get,put}_user() for 64bit values
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 6595d144decec396bf2e2efee27e50634a4b627f ]
First of all, on short copies __copy_{to,from}_user() return the amount of bytes left uncopied, *not* -EFAULT. get_user() and put_user() are expected to return -EFAULT on failure.
Another problem is get_user(v32, (__u64 __user *)p); that should fetch 64bit value and the assign it to v32, truncating it in process. Current code, OTOH, reads 8 bytes of data and stores them at the address of v32, stomping on the 4 bytes that follow v32 itself.
--- arch/xtensa/include/asm/uaccess.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
arch/xtensa/include/asm/uaccess.h +11 -2
@@ -100,7 +100,7 @@ do { \case 4 :__put_user_asm (x, ptr, retval,4 ,"s32i" , __cb);break ; \case 8 : { \ __typeof__(*ptr) __v64 = x; \ - retval =__copy_to_user (ptr, &__v64,8 ); \ + retval =__copy_to_user (ptr, &__v64,8 ) ? -EFAULT :0 ; \break ; \ } \default :__put_user_bad (); \
@@ -198,7 +198,16 @@ do { \case 1 :__get_user_asm (x, ptr, retval,1 ,"l8ui" , __cb);break ;\case 2 :__get_user_asm (x, ptr, retval,2 ,"l16ui" , __cb);break ;\case 4 :__get_user_asm (x, ptr, retval,4 ,"l32i" , __cb);break ;\ -case 8 : retval =__copy_from_user (&x, ptr,8 );break ; \ +case 8 : { \ +u64 __x; \ +if (unlikely (__copy_from_user (&__x, ptr,8 ))) { \ + retval = -EFAULT ; \ + (x) =0 ; \ + }else { \ + (x) = *(__force __typeof__((ptr)))&__x; \ + } \ +break ; \ + } \default : (x) =__get_user_bad (); \ } \ }while (0 )
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 68/99 firmware: dmi: Fix unlikely out-of-bounds read in save_mem_devices
In reply to Sasha LevinFrom: Jean Delvare <[email protected]>
[ Upstream commit 81dde26de9c08bb04c4962a15608778aaffb3cf9 ]
Before reading the Extended Size field, we should ensure it fits in the DMI record. There is already a record length check but it does not cover that field.
It would take a seriously corrupted DMI table to hit that bug, so no need to worry, but we should still fix it.
--- drivers/firmware/dmi_scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/dmi_scan.c +1 -1
@@ -408,7 +408,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) bytes = ~0ull ; else if (size & 0x8000) bytes = (u64)(size &0x7fff ) <<10 ; - else if (size != 0x7fff) + else if (size != 0x7fff || dm->length < 0x20) bytes = (u64 )size <<20 ; else bytes = (u64 )get_unaligned ((u32 *)&d[0x1C ]) <<20 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 69/99 net: aquantia: temperature retrieval fix
In reply to Sasha LevinFrom: Igor Russkikh <[email protected]>
[ Upstream commit 06b0d7fe7e5ff3ba4c7e265ef41135e8bcc232bb ]
Chip temperature is a two byte word, colocated internally with cable length data. We do all readouts from HW memory by dwords, thus we should clear extra high bytes, otherwise temperature output gets weird as soon as we attach a cable to the NIC.
--- .../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +1 -1
@@ -337,7 +337,7 @@ static int aq_fw2x_get_phy_temp(struct aq_hw_s *self, int *temp)/* Convert PHY temperature from 1/256 degree Celsius * to 1/1000 degree Celsius. */ - *temp = temp_res *1000 /256 ; + *temp = (temp_res &0xFFFF ) *1000 /256 ;return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 70/99 net: aquantia: do not pass lro session with invalid tcp checksum
In reply to Sasha LevinFrom: Dmitry Bogdanov <[email protected]>
[ Upstream commit d08b9a0a3ebdf71b0aabe576c7dd48e57e80e0f0 ]
Individual descriptors on LRO TCP session should be checked for CRC errors. It was discovered that HW recalculates L4 checksums on LRO session and does not break it up on bad L4 csum.
Thus, driver should aggregate HW LRO L4 statuses from all individual buffers of LRO session and drop packet if one of the buffers has bad L4 checksum.
--- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_ring.c +2 -1
@@ -313,6 +313,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self,break ; buff->is_error |= buff_->is_error; + buff->is_cso_err |= buff_->is_cso_err; }while (!buff_->is_eop);
@@ -320,7 +321,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self, err =0 ; goto err_exit; } -if (buff->is_error) { +if (buff->is_error || buff->is_cso_err) { buff_ = buff; do { next_ = buff_->next,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 71/99 net: aquantia: correctly handle macvlan and multicast coexistence
In reply to Sasha LevinFrom: Dmitry Bogdanov <[email protected]>
[ Upstream commit 9f051db566da1e8110659ab4ab188af1c2510bb4 ]
macvlan and multicast handling is now mixed up.
The explicit issue is that macvlan interface gets broken (no traffic) after clearing MULTICAST flag on the real interface.
We now do separate logic and consider both ALLMULTI and MULTICAST flags on the device.
--- .../net/ethernet/aquantia/atlantic/aq_main.c | 4 +-- .../net/ethernet/aquantia/atlantic/aq_nic.c | 32 +++++++++---------- .../aquantia/atlantic/hw_atl/hw_atl_b0.c | 7 ++-- 3 files changed, 21 insertions(+), 22 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +1 -3
@@ -194,9 +194,7 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev) {struct aq_nic_s *aq_nic =netdev_priv (ndev); -aq_nic_set_packet_filter (aq_nic, ndev->flags); - -aq_nic_set_multicast_list (aq_nic, ndev); + (void )aq_nic_set_multicast_list (aq_nic, ndev); } static int aq_ndo_vlan_rx_add_vid(struct net_device *ndev, __be16 proto,
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +16 -16
@@ -631,9 +631,12 @@ int aq_nic_set_packet_filter(struct aq_nic_s *self, unsigned int flags)int aq_nic_set_multicast_list (struct aq_nic_s *self,struct net_device *ndev) { -unsigned int packet_filter = self->packet_filter; +const struct aq_hw_ops *hw_ops = self->aq_hw_ops; +struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; +unsigned int packet_filter = ndev->flags;struct netdev_hw_addr *ha =NULL ;unsigned int i =0U ; +int err =0 ; self->mc_list.count =0 ;if (netdev_uc_count (ndev) >AQ_HW_MULTICAST_ADDRESS_MAX ) {
@@ -641,29 +644,26 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) }else {netdev_for_each_uc_addr (ha, ndev) {ether_addr_copy (self->mc_list.ar[i++], ha->addr); - -if (i >=AQ_HW_MULTICAST_ADDRESS_MAX ) -break ; } } -if (i +netdev_mc_count (ndev) >AQ_HW_MULTICAST_ADDRESS_MAX ) { - packet_filter |=IFF_ALLMULTI ; - }else { -netdev_for_each_mc_addr (ha, ndev) { -ether_addr_copy (self->mc_list.ar[i++], ha->addr); - -if (i >=AQ_HW_MULTICAST_ADDRESS_MAX ) -break ; + cfg->is_mc_list_enabled = !!(packet_filter &IFF_MULTICAST ); +if (cfg->is_mc_list_enabled) { +if (i +netdev_mc_count (ndev) >AQ_HW_MULTICAST_ADDRESS_MAX ) { + packet_filter |=IFF_ALLMULTI ; + }else { +netdev_for_each_mc_addr (ha, ndev) { +ether_addr_copy (self->mc_list.ar[i++], + ha->addr); + } } }if (i >0 && i <=AQ_HW_MULTICAST_ADDRESS_MAX ) { - packet_filter |=IFF_MULTICAST ; self->mc_list.count = i; - self->aq_hw_ops->hw_multicast_list_set (self->aq_hw, - self->mc_list.ar, - self->mc_list.count); + err = hw_ops->hw_multicast_list_set (self->aq_hw, + self->mc_list.ar, + self->mc_list.count); }return aq_nic_set_packet_filter (self, packet_filter); }
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +4 -3
@@ -818,14 +818,15 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, cfg->is_vlan_force_promisc);hw_atl_rpfl2multicast_flr_en_set (self, -IS_FILTER_ENABLED (IFF_ALLMULTI ),0 ); +IS_FILTER_ENABLED (IFF_ALLMULTI ) && +IS_FILTER_ENABLED (IFF_MULTICAST ),0 );hw_atl_rpfl2_accept_all_mc_packets_set (self, -IS_FILTER_ENABLED (IFF_ALLMULTI )); +IS_FILTER_ENABLED (IFF_ALLMULTI ) && +IS_FILTER_ENABLED (IFF_MULTICAST ));hw_atl_rpfl2broadcast_en_set (self,IS_FILTER_ENABLED (IFF_BROADCAST )); - cfg->is_mc_list_enabled =IS_FILTER_ENABLED (IFF_MULTICAST );for (i =HW_ATL_B0_MAC_MIN ; i <HW_ATL_B0_MAC_MAX ; ++i) hw_atl_rpfl2_uc_flr_en_set(self,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 72/99 arm64: hibernate: check pgd table allocation
In reply to Sasha LevinFrom: Pavel Tatashin <[email protected]>
[ Upstream commit 8c551f919a73c1dfa690a70a691be1da394145e8 ]
There is a bug in create_safe_exec_page(), when page table is allocated it is not checked that table is allocated successfully:
But it is dereferenced in: pgd_none(READ_ONCE(*pgdp)). Check that allocation was successful.
--- arch/arm64/kernel/hibernate.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm64/kernel/hibernate.c +8 -1
@@ -201,6 +201,7 @@ static int create_safe_exec_page(void *src_start, size_t length, gfp_t mask) {int rc =0 ; +pgd_t *trans_pgd;pgd_t *pgdp;pud_t *pudp;pmd_t *pmdp;
@@ -215,7 +216,13 @@ static int create_safe_exec_page(void *src_start, size_t length,memcpy ((void *)dst, src_start, length);__flush_icache_range (dst, dst + length); - pgdp =pgd_offset_raw (allocator (mask), dst_addr); + trans_pgd =allocator (mask); +if (!trans_pgd) { + rc = -ENOMEM ; + goto out; + } + + pgdp =pgd_offset_raw (trans_pgd, dst_addr);if (pgd_none (READ_ONCE (*pgdp))) { pudp =allocator (mask);if (!pudp) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 73/99 iommu/amd: Fix incorrect PASID decoding from event log
In reply to Sasha LevinFrom: "Suthikulpanit, Suravee" <[email protected]>
[ Upstream commit ec21f17a9437e11bb29e5fa375aa31b472793c15 ]
IOMMU Event Log encodes 20-bit PASID for events:
ILLEGAL_DEV_TABLE_ENTRY
IO_PAGE_FAULT
PAGE_TAB_HARDWARE_ERROR
INVALID_DEVICE_REQUEST
as:
PASID[15:0] = bit 47:32
PASID[19:16] = bit 19:16Note that INVALID_PPR_REQUEST event has different encoding from the rest of the events as the following:
PASID[15:0] = bit 31:16
PASID[19:16] = bit 45:42So, fixes the decoding logic.
--- drivers/iommu/amd_iommu.c | 5 +++-- drivers/iommu/amd_iommu_types.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/iommu/amd_iommu.c +3 -2
@@ -560,7 +560,8 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) retry: type = (event[1 ] >>EVENT_TYPE_SHIFT ) &EVENT_TYPE_MASK ; devid = (event[0 ] >>EVENT_DEVID_SHIFT ) &EVENT_DEVID_MASK ; - pasid =PPR_PASID (*(u64 *)&event[0 ]); + pasid = (event[0 ] &EVENT_DOMID_MASK_HI ) | + (event[1 ] &EVENT_DOMID_MASK_LO ); flags = (event[1 ] >>EVENT_FLAGS_SHIFT ) &EVENT_FLAGS_MASK ; address = (u64)(((u64 )event[3 ]) <<32 ) | event[2 ];
@@ -593,7 +594,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) address, flags);break ;case EVENT_TYPE_PAGE_TAB_ERR : -dev_err (dev,"Event logged [PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x domain=0x%04x address=0x%llx flags=0x%04x]\n" , +dev_err (dev,"Event logged [PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x pasid=0x%04x address=0x%llx flags=0x%04x]\n" ,PCI_BUS_NUM (devid),PCI_SLOT (devid),PCI_FUNC (devid), pasid, address, flags);break ;
drivers/iommu/amd_iommu_types.h +2 -2
@@ -130,8 +130,8 @@#define EVENT_TYPE_INV_PPR_REQ 0x9#define EVENT_DEVID_MASK 0xffff#define EVENT_DEVID_SHIFT 0 -#define EVENT_DOMID_MASK 0xffff -#define EVENT_DOMID_SHIFT 0 +#define EVENT_DOMID_MASK_LO 0xffff +#define EVENT_DOMID_MASK_HI 0xf0000#define EVENT_FLAGS_MASK 0xfff#define EVENT_FLAGS_SHIFT 0x10
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 74/99 nvmet-loop: fix possible leakage during error flow
In reply to Sasha LevinFrom: Max Gurtovoy <[email protected]>
[ Upstream commit 5812d04c4c7455627d8722e04ab99a737cfe9713 ]
During nvme_loop_queue_rq error flow, one must call nvme_cleanup_cmd since it's symmetric to nvme_setup_cmd.
--- drivers/nvme/target/loop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/target/loop.c +3 -1
@@ -157,8 +157,10 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, iod->sg_table.sgl = iod->first_sgl;if (sg_alloc_table_chained (&iod->sg_table,blk_rq_nr_phys_segments (req), - iod->sg_table.sgl,SG_CHUNK_SIZE )) + iod->sg_table.sgl,SG_CHUNK_SIZE )) { +nvme_cleanup_cmd (req);return BLK_STS_RESOURCE ; + } iod->req.sg = iod->sg_table.sgl; iod->req.sg_cnt =blk_rq_map_sg (req->q, req, iod->sg_table.sgl);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 75/99 nvme-tcp: fix possible leakage during error flow
In reply to Sasha LevinFrom: Max Gurtovoy <[email protected]>
[ Upstream commit 28a4cac48c7e897a0b4e7d79a53a8e4fe40337ae ]
During nvme_tcp_setup_cmd_pdu error flow, one must call nvme_cleanup_cmd since it's symmetric to nvme_setup_cmd.
--- drivers/nvme/host/tcp.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/tcp.c +1 -0
@@ -2093,6 +2093,7 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns, ret =nvme_tcp_map_data (queue, rq);if (unlikely (ret)) { +nvme_cleanup_cmd (rq);dev_err (queue->ctrl->ctrl.device,"Failed to map data (%d)\n" , ret);return ret;
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 76/99 rbd: cancel lock_dwork if the wait is interrupted
In reply to Sasha LevinFrom: Dongsheng Yang <[email protected]>
[ Upstream commit 25e6be21230d3208d687dad90b6e43419013c351 ]
There is a warning message in my test with below steps:
# rbd bench --io-type write --io-size 4K --io-threads 1 --io-pattern rand test & # sleep 5 # pkill -9 rbd # rbd map test & # sleep 5 # pkill rbd
The reason is that the rbd_add_acquire_lock() is interruptable, that means, when we kill the waiting on ->acquire_wait, the lock_dwork could be still running.
1. do_rbd_add() 2. lock_dworkrbd_add_acquire_lock()
- queue_delayed_work()
lock_dwork queued
- wait_for_completion_killable_timeout() <-- kill happenrbd_dev_image_unlock() <-- UNLOCKED now, nothing to do.rbd_dev_device_release()rbd_dev_image_release()
- ...
lock successed here
- cancel_delayed_work_sync(&rbd_dev->lock_dwork)
Then when we reach the rbd_dev_free(), WARN_ON is triggered because lock_state is not RBD_LOCK_STATE_UNLOCKED.
To fix it, this commit make sure the lock_dwork was finished before calling rbd_dev_image_unlock().
On the other hand, this would not happend in do_rbd_remove(), because after rbd mapped, lock_dwork will only be queued for IO request, and request will continue unless lock_dwork finished. when we call rbd_dev_image_unlock() in do_rbd_remove(), all requests are done. That means, lock_state should not be locked again after rbd_dev_image_unlock().
[ Cancel lock_dwork in rbd_add_acquire_lock(), only if the wait is
interrupted. ]
--- drivers/block/rbd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/block/rbd.c +6 -3
@@ -6632,10 +6632,13 @@ static int rbd_add_acquire_lock(struct rbd_device *rbd_dev)queue_delayed_work (rbd_dev->task_wq, &rbd_dev->lock_dwork,0 ); ret =wait_for_completion_killable_timeout (&rbd_dev->acquire_wait,ceph_timeout_jiffies (rbd_dev->opts->lock_timeout)); -if (ret >0 ) +if (ret >0 ) { ret = rbd_dev->acquire_err; -else if (!ret) - ret = -ETIMEDOUT ; + }else { +cancel_delayed_work_sync (&rbd_dev->lock_dwork); +if (!ret) + ret = -ETIMEDOUT ; + }if (ret) {rbd_warn (rbd_dev,"failed to acquire exclusive lock: %ld" , ret);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 77/99 sparc64: disable fast-GUP due to unexplained oopses
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
[ Upstream commit 8e0d0ad206f08506c893326ca7c9c3d9cc042cef ]
HAVE_FAST_GUP enables the lockless quick page table walker for simple cases, and is a nice optimization for some random loads that can then use get_user_pages_fast() rather than the more careful page walker.
However, for some unexplained reason, it seems to be subtly broken on sparc64. The breakage is only with some compiler versions and some hardware, and nobody seems to have figured out what triggers it, although there's a simple reprodicer for the problem when it does trigger.
The problem was introduced with the conversion to the generic GUP code in commit 7b9afb86b632 ("sparc64: use the generic get_user_pages_fast code"), but nothing looks obviously wrong in that conversion. It may be a compiler bug that just hits us with the code reorganization. Or it may be something very specific to sparc64.
This disables HAVE_FAST_GUP entirely. That makes things like futexes a bit slower, but at least they work. If we can figure out the trigger, that would be lovely, but it's been three months already..
--- arch/sparc/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/sparc/Kconfig +0 -1
@@ -28,7 +28,6 @@ config SPARC select RTC_DRV_M48T59 select RTC_SYSTOHC select HAVE_ARCH_JUMP_LABEL if SPARC64 - select HAVE_FAST_GUP if SPARC64 select GENERIC_IRQ_SHOW select ARCH_WANT_IPC_PARSE_VERSION select GENERIC_PCI_IOMAP
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 78/99 net: i82596: fix dma_alloc_attr for sni_82596
In reply to Sasha LevinFrom: Thomas Bogendoerfer <[email protected]>
[ Upstream commit 61c1d33daf7b5146f44d4363b3322f8cda6a6c43 ]
Commit 7f683b920479 ("i825xx: switch to switch to dma_alloc_attrs") switched dma allocation over to dma_alloc_attr, but didn't convert the SNI part to request consistent DMA memory. This broke sni_82596 since driver doesn't do dma_cache_sync for performance reasons. Fix this by using different DMA_ATTRs for lasi_82596 and sni_82596.
--- drivers/net/ethernet/i825xx/lasi_82596.c | 4 +++- drivers/net/ethernet/i825xx/lib82596.c | 4 ++-- drivers/net/ethernet/i825xx/sni_82596.c | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/i825xx/lasi_82596.c +3 -1
@@ -96,6 +96,8 @@#define OPT_SWAP_PORT 0x0001/* Need to wordswp on the MPU port */ +#define LIB82596_DMA_ATTR DMA_ATTR_NON_CONSISTENT +#define DMA_WBACK (ndev, addr, len) \ do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0)
@@ -200,7 +202,7 @@ static int __exit lan_remove_chip(struct parisc_device *pdev)unregister_netdev (dev);dma_free_attrs (&pdev->dev,sizeof (struct i596_private ), lp->dma, - lp->dma_addr,DMA_ATTR_NON_CONSISTENT ); + lp->dma_addr,LIB82596_DMA_ATTR );free_netdev (dev);return 0 ; }
drivers/net/ethernet/i825xx/lib82596.c +2 -2
@@ -1065,7 +1065,7 @@ static int i82596_probe(struct net_device *dev) dma =dma_alloc_attrs (dev->dev.parent,sizeof (struct i596_dma ), &lp->dma_addr,GFP_KERNEL , -DMA_ATTR_NON_CONSISTENT ); +LIB82596_DMA_ATTR );if (!dma) {printk (KERN_ERR "%s: Couldn't get shared memory\n" , __FILE__);return -ENOMEM ;
@@ -1087,7 +1087,7 @@ static int i82596_probe(struct net_device *dev) i =register_netdev (dev);if (i) {dma_free_attrs (dev->dev.parent,sizeof (struct i596_dma ), - dma, lp->dma_addr,DMA_ATTR_NON_CONSISTENT ); + dma, lp->dma_addr,LIB82596_DMA_ATTR );return i; }
drivers/net/ethernet/i825xx/sni_82596.c +3 -1
@@ -24,6 +24,8 @@static const char sni_82596_string[] ="snirm_82596" ; +#define LIB82596_DMA_ATTR 0 +#define DMA_WBACK (priv, addr, len) do { } while (0)#define DMA_INV (priv, addr, len) do { } while (0)#define DMA_WBACK_INV (priv, addr, len) do { } while (0)
@@ -152,7 +154,7 @@ static int sni_82596_driver_remove(struct platform_device *pdev)unregister_netdev (dev);dma_free_attrs (dev->dev.parent,sizeof (struct i596_private ), lp->dma, - lp->dma_addr,DMA_ATTR_NON_CONSISTENT ); + lp->dma_addr,LIB82596_DMA_ATTR );iounmap (lp->ca);iounmap (lp->mpu_port);free_netdev (dev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 79/99 net: bcmgenet: Fix RGMII_MODE_EN value for GENET v1/2/3
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit efb86fede98cdc70b674692ff617b1162f642c49 ]
The RGMII_MODE_EN bit value was 0 for GENET versions 1 through 3, and became 6 for GENET v4 and above, account for that difference.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.h | 1 + drivers/net/ethernet/broadcom/genet/bcmmii.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.h +1 -0
@@ -366,6 +366,7 @@ struct bcmgenet_mib_counters {#define EXT_PWR_DOWN_PHY_EN (1 << 20)#define EXT_RGMII_OOB_CTRL 0x0C +#define RGMII_MODE_EN_V123 (1 << 0)#define RGMII_LINK (1 << 4)#define OOB_DISABLE (1 << 5)#define RGMII_MODE_EN (1 << 6)
drivers/net/ethernet/broadcom/genet/bcmmii.c +5 -1
@@ -258,7 +258,11 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)*/ if (priv->ext_phy) { reg =bcmgenet_ext_readl (priv,EXT_RGMII_OOB_CTRL ); - reg |=RGMII_MODE_EN | id_mode_dis; + reg |= id_mode_dis; +if (GENET_IS_V1 (priv) ||GENET_IS_V2 (priv) ||GENET_IS_V3 (priv)) + reg |=RGMII_MODE_EN_V123 ; +else + reg |=RGMII_MODE_EN ;bcmgenet_ext_writel (priv, reg,EXT_RGMII_OOB_CTRL ); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 80/99 net: usb: sr9800: fix uninitialized local variable
In reply to Sasha LevinFrom: Valentin Vidic <[email protected]>
[ Upstream commit 77b6d09f4ae66d42cd63b121af67780ae3d1a5e9 ]
Make sure res does not contain random value if the call to sr_read_cmd fails for some reason.
--- drivers/net/usb/sr9800.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/sr9800.c +1 -1
@@ -336,7 +336,7 @@ static void sr_set_multicast(struct net_device *net)static int sr_mdio_read (struct net_device *net,int phy_id,int loc) {struct usbnet *dev =netdev_priv (net); -__le16 res; +__le16 res =0 ;mutex_lock (&dev->phy_mutex);sr_set_sw_mii (dev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 81/99 md/raid0: fix warning message for parameter default_layout
In reply to Sasha LevinFrom: Song Liu <[email protected]>
[ Upstream commit 3874d73e06c9b9dc15de0b7382fc223986d75571 ]
The message should match the parameter, i.e. raid0.default_layout.
--- drivers/md/raid0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid0.c +1 -1
@@ -151,7 +151,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) }else {pr_err ("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n" ,mdname (mddev)); -pr_err ("md/raid0: please set raid.default_layout to 1 or 2\n" ); +pr_err ("md/raid0: please set raid0.default_layout to 1 or 2\n" ); err = -ENOTSUPP ; goto abort; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 82/99 net: stmmac: disable/enable ptp_ref_clk in suspend/resume flow
In reply to Sasha LevinFrom: Biao Huang <[email protected]>
[ Upstream commit e497c20e203680aba9ccf7bb475959595908ca7e ]
disable ptp_ref_clk in suspend flow, and enable it in resume flow.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8 -4
@@ -4475,8 +4475,10 @@ int stmmac_suspend(struct device *dev)stmmac_mac_set (priv, priv->ioaddr, false);pinctrl_pm_select_sleep_state (priv->device);/* Disable clock in case of PWM is off */ -clk_disable (priv->plat->pclk); -clk_disable (priv->plat->stmmac_clk); +if (priv->plat->clk_ptp_ref) +clk_disable_unprepare (priv->plat->clk_ptp_ref); +clk_disable_unprepare (priv->plat->pclk); +clk_disable_unprepare (priv->plat->stmmac_clk); }mutex_unlock (&priv->lock);
@@ -4539,8 +4541,10 @@ int stmmac_resume(struct device *dev) }else {pinctrl_pm_select_default_state (priv->device);/* enable the clk previously disabled */ -clk_enable (priv->plat->stmmac_clk); -clk_enable (priv->plat->pclk); +clk_prepare_enable (priv->plat->stmmac_clk); +clk_prepare_enable (priv->plat->pclk); +if (priv->plat->clk_ptp_ref) +clk_prepare_enable (priv->plat->clk_ptp_ref);/* reset the phy so that it's ready */ if (priv->mii)stmmac_mdio_reset (priv->mii);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 83/99 stop_machine: Avoid potential race behaviour
In reply to Sasha LevinFrom: Mark Rutland <[email protected]>
[ Upstream commit b1fc5833357524d5d342737913dbe32ff3557bc5 ]
Both multi_cpu_stop() and set_state() access multi_stop_data::state racily using plain accesses. These are subject to compiler transformations which could break the intended behaviour of the code, and this situation is detected by KCSAN on both arm64 and x86 (splats below).
Improve matters by using READ_ONCE() and WRITE_ONCE() to ensure that the compiler cannot elide, replay, or tear loads and stores.
In multi_cpu_stop() the two loads of multi_stop_data::state are expected to be a consistent value, so snapshot the value into a temporary variable to ensure this.
The state transitions are serialized by atomic manipulation of multi_stop_data::num_threads, and other fields in multi_stop_data are not modified while subject to concurrent reads.
KCSAN splat on arm64:
| BUG: KCSAN: data-race in multi_cpu_stop+0xa8/0x198 and set_state+0x80/0xb0 | | write to 0xffff00001003bd00 of 4 bytes by task 24 on cpu 3: | set_state+0x80/0xb0 | multi_cpu_stop+0x16c/0x198 | cpu_stopper_thread+0x170/0x298 | smpboot_thread_fn+0x40c/0x560 | kthread+0x1a8/0x1b0 | ret_from_fork+0x10/0x18 | | read to 0xffff00001003bd00 of 4 bytes by task 14 on cpu 1: | multi_cpu_stop+0xa8/0x198 | cpu_stopper_thread+0x170/0x298 | smpboot_thread_fn+0x40c/0x560 | kthread+0x1a8/0x1b0 | ret_from_fork+0x10/0x18 | | Reported by Kernel Concurrency Sanitizer on: | CPU: 1 PID: 14 Comm: migration/1 Not tainted 5.3.0-00007-g67ab35a199f4-dirty #3 | Hardware name: linux,dummy-virt (DT)
KCSAN splat on x86:
| write to 0xffffb0bac0013e18 of 4 bytes by task 19 on cpu 2: | set_state kernel/stop_machine.c:170 [inline] | ack_state kernel/stop_machine.c:177 [inline] | multi_cpu_stop+0x1a4/0x220 kernel/stop_machine.c:227 | cpu_stopper_thread+0x19e/0x280 kernel/stop_machine.c:516 | smpboot_thread_fn+0x1a8/0x300 kernel/smpboot.c:165 | kthread+0x1b5/0x200 kernel/kthread.c:255 | ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:352 | | read to 0xffffb0bac0013e18 of 4 bytes by task 44 on cpu 7: | multi_cpu_stop+0xb4/0x220 kernel/stop_machine.c:213 | cpu_stopper_thread+0x19e/0x280 kernel/stop_machine.c:516 | smpboot_thread_fn+0x1a8/0x300 kernel/smpboot.c:165 | kthread+0x1b5/0x200 kernel/kthread.c:255 | ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:352 | | Reported by Kernel Concurrency Sanitizer on: | CPU: 7 PID: 44 Comm: migration/7 Not tainted 5.3.0+ #1 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
--- kernel/stop_machine.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/stop_machine.c +6 -4
@@ -7,6 +7,7 @@* Copyright (C) 2010 SUSE Linux Products GmbH * Copyright (C) 2010 Tejun Heo <[email protected]> */ +#include <linux/compiler.h> #include <linux/completion.h> #include <linux/cpu.h> #include <linux/init.h>
@@ -167,7 +168,7 @@ static void set_state(struct multi_stop_data *msdata,/* Reset ack counter. */ atomic_set (&msdata->thread_ack, msdata->num_threads);smp_wmb (); - msdata->state = newstate; +WRITE_ONCE (msdata->state, newstate); }/* Last one to ack a state moves to the next state. */
@@ -186,7 +187,7 @@ void __weak stop_machine_yield(const struct cpumask *cpumask)static int multi_cpu_stop (void *data) {struct multi_stop_data *msdata = data; -enum multi_stop_state curstate =MULTI_STOP_NONE ; +enum multi_stop_state newstate, curstate =MULTI_STOP_NONE ;int cpu =smp_processor_id (), err =0 ;const struct cpumask *cpumask;unsigned long flags;
@@ -210,8 +211,9 @@ static int multi_cpu_stop(void *data) do { /* Chill out and ensure we re-read multi_stop_state. */ stop_machine_yield(cpumask); - if (msdata->state != curstate) { - curstate = msdata->state; + newstate = READ_ONCE(msdata->state); + if (newstate != curstate) { + curstate = newstate; switch (curstate) { case MULTI_STOP_DISABLE_IRQ: local_irq_disable();
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 84/99 usb: hso: obey DMA rules in tiocmget
In reply to Sasha LevinFrom: Oliver Neukum <[email protected]>
[ Upstream commit af0de1303c4e8f44fadd7b4c593f09f22324b04f ]
The serial state information must not be embedded into another data structure, as this interferes with cache handling for DMA on architectures without cache coherence..
That would result in data corruption on some architectures Allocating it separately.
v2: fix syntax error
--- drivers/net/usb/hso.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/usb/hso.c +9 -4
@@ -186,7 +186,7 @@ struct hso_tiocmget {int intr_completed;struct usb_endpoint_descriptor *endp;struct urb *urb; -struct hso_serial_state_notification serial_state_notification; +struct hso_serial_state_notification *serial_state_notification;u16 prev_UART_state_bitmap;struct uart_icount icount; };
@@ -1432,7 +1432,7 @@ static int tiocmget_submit_urb(struct hso_serial *serial,usb_rcvintpipe (usb, tiocmget->endp-> bEndpointAddress &0x7F ), - &tiocmget->serial_state_notification, + tiocmget->serial_state_notification,sizeof (struct hso_serial_state_notification ), tiocmget_intr_callback, serial, tiocmget->endp->bInterval);
@@ -1479,7 +1479,7 @@ static void tiocmget_intr_callback(struct urb *urb)/* wIndex should be the USB interface number of the port to which the * notification applies, which should always be the Modem port. */ - serial_state_notification = &tiocmget->serial_state_notification; + serial_state_notification = tiocmget->serial_state_notification; if (serial_state_notification->bmRequestType != BM_REQUEST_TYPE || serial_state_notification->bNotification != B_NOTIFICATION || le16_to_cpu(serial_state_notification->wValue) != W_VALUE ||
@@ -2565,6 +2565,8 @@ static void hso_free_tiomget(struct hso_serial *serial)usb_free_urb (tiocmget->urb); tiocmget->urb =NULL ; serial->tiocmget =NULL ; +kfree (tiocmget->serial_state_notification); + tiocmget->serial_state_notification =NULL ;kfree (tiocmget); } }
@@ -2615,10 +2617,13 @@ static struct hso_device *hso_create_bulk_serial_device( num_urbs =2 ; serial->tiocmget =kzalloc (sizeof (struct hso_tiocmget ),GFP_KERNEL ); + serial->tiocmget->serial_state_notification + =kzalloc (sizeof (struct hso_serial_state_notification ), +GFP_KERNEL );/* it isn't going to break our heart if serial->tiocmget * allocation fails don't bother checking this. */ -if (serial->tiocmget) { +if (serial->tiocmget && serial->tiocmget->serial_state_notification) { tiocmget = serial->tiocmget; tiocmget->endp = hso_get_ep(interface, USB_ENDPOINT_XFER_INT,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 85/99 dpaa2-eth: add irq for the dpmac connect/disconnect event
In reply to Sasha LevinFrom: Florin Chiculita <[email protected]>
[ Upstream commit 8398b375a9e3f5e4bba9bcdfed152a8a247dee01 ]
Add IRQ for the DPNI endpoint change event, resolving the issue when a dynamically created DPNI gets a randomly generated hw address when the endpoint is a DPMAC object.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 +++++- drivers/net/ethernet/freescale/dpaa2/dpni.h | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +5 -1
@@ -3219,6 +3219,9 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg)if (status &DPNI_IRQ_EVENT_LINK_CHANGED )link_state_update (netdev_priv (net_dev)); +if (status &DPNI_IRQ_EVENT_ENDPOINT_CHANGED ) +set_mac_addr (netdev_priv (net_dev)); +return IRQ_HANDLED ; }
@@ -3244,7 +3247,8 @@ static int setup_irqs(struct fsl_mc_device *ls_dev) } err =dpni_set_irq_mask (ls_dev->mc_io,0 , ls_dev->mc_handle, -DPNI_IRQ_INDEX ,DPNI_IRQ_EVENT_LINK_CHANGED ); +DPNI_IRQ_INDEX ,DPNI_IRQ_EVENT_LINK_CHANGED | +DPNI_IRQ_EVENT_ENDPOINT_CHANGED );if (err <0 ) {dev_err (&ls_dev->dev,"dpni_set_irq_mask(): %d\n" , err); goto free_irq;
drivers/net/ethernet/freescale/dpaa2/dpni.h +4 -1
@@ -133,9 +133,12 @@ int dpni_reset(struct fsl_mc_io *mc_io,*/ #define DPNI_IRQ_INDEX 0/** -* IRQ event - indicates a change in link state +* IRQ events: +* indicates a change in link state +* indicates a change in endpoint */ #define DPNI_IRQ_EVENT_LINK_CHANGED 0x00000001 +#define DPNI_IRQ_EVENT_ENDPOINT_CHANGED 0x00000002 int dpni_set_irq_enable(struct fsl_mc_io *mc_io, u32 cmd_flags,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 86/99 net: stmmac: fix argument to stmmac_pcs_ctrl_ane()
In reply to Sasha LevinFrom: "Ben Dooks (Codethink)" <[email protected]>
[ Upstream commit c9ad4c1049f7e0e8d59e975963dda002af47d93e ]
The stmmac_pcs_ctrl_ane() expects a register address as argument 1, but for some reason the mac_device_info is being passed.
Fix the warning (and possible bug) from sparse:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2613:17: warning: incorrect type in argument 1 (different address spaces)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2613:17: expected void [noderef] <asn:2> *ioaddrdrivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2613:17: got struct mac_device_info *hw
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
@@ -2564,7 +2564,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) }if (priv->hw->pcs) -stmmac_pcs_ctrl_ane (priv, priv->hw,1 , priv->hw->ps,0 ); +stmmac_pcs_ctrl_ane (priv, priv->ioaddr,1 , priv->hw->ps,0 );/* set TX and RX rings length */ stmmac_set_rings_length (priv);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 87/99 net: phy: micrel: Discern KSZ8051 and KSZ8795 PHYs
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 8b95599c55ed24b36cf44a4720067cfe67edbcb4 ]
The KSZ8051 PHY and the KSZ8794/KSZ8795/KSZ8765 switch share exactly the same PHY ID. Since KSZ8051 is higher in the ksphy_driver[] list of PHYs in the micrel PHY driver, it is used even with the KSZ87xx switch. This is wrong, since the KSZ8051 configures registers of the PHY which are not present on the simplified KSZ87xx switch PHYs and misconfigures other registers of the KSZ87xx switch PHYs.
Fortunatelly, it is possible to tell apart the KSZ8051 PHY from the KSZ87xx switch by checking the Basic Status register Bit 0, which is read-only and indicates presence of the Extended Capability Registers. The KSZ8051 PHY has those registers while the KSZ87xx switch does not.
This patch implements simple check for the presence of this bit for both the KSZ8051 PHY and KSZ87xx switch, to let both use the correct PHY driver instance.
--- drivers/net/phy/micrel.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-)
drivers/net/phy/micrel.c +36 -4
@@ -341,6 +341,35 @@ static int ksz8041_config_aneg(struct phy_device *phydev)return genphy_config_aneg (phydev); } +static int ksz8051_ksz8795_match_phy_device (struct phy_device *phydev, +const u32 ksz_phy_id) +{ +int ret; + +if ((phydev->phy_id &MICREL_PHY_ID_MASK ) != ksz_phy_id) +return 0 ; + + ret =phy_read (phydev,MII_BMSR ); +if (ret <0 ) +return ret; + +/* KSZ8051 PHY and KSZ8794/KSZ8795/KSZ8765 switch share the same +* exact PHY ID. However, they can be told apart by the extended +* capability registers presence. The KSZ8051 PHY has them while +* the switch does not. +*/ + ret &=BMSR_ERCAP ; +if (ksz_phy_id ==PHY_ID_KSZ8051 ) +return ret; +else +return !ret; +} + +static int ksz8051_match_phy_device (struct phy_device *phydev) +{ +return ksz8051_ksz8795_match_phy_device (phydev,PHY_ID_KSZ8051 ); +} +static int ksz8081_config_init (struct phy_device *phydev) {/* KSZPHY_OMSO_FACTORY_TEST is set at de-assertion of the reset line
@@ -364,6 +393,11 @@ static int ksz8061_config_init(struct phy_device *phydev)return kszphy_config_init (phydev); } +static int ksz8795_match_phy_device (struct phy_device *phydev) +{ +return ksz8051_ksz8795_match_phy_device (phydev,PHY_ID_KSZ8795 ); +} + static int ksz9021_load_values_from_of(struct phy_device *phydev, const struct device_node *of_node, u16 reg,
@@ -1017,8 +1051,6 @@ static struct phy_driver ksphy_driver[] = { .suspend = genphy_suspend, .resume = genphy_resume, }, { - .phy_id = PHY_ID_KSZ8051, - .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ8051", /* PHY_BASIC_FEATURES */ .driver_data = &ksz8051_type,
@@ -1029,6 +1061,7 @@ static struct phy_driver ksphy_driver[] = { .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, + .match_phy_device = ksz8051_match_phy_device, .suspend = genphy_suspend, .resume = genphy_resume, }, {
@@ -1141,13 +1174,12 @@ static struct phy_driver ksphy_driver[] = { .suspend = genphy_suspend, .resume = genphy_resume, }, { - .phy_id = PHY_ID_KSZ8795, - .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ8795",/* PHY_BASIC_FEATURES */ .config_init = kszphy_config_init, .config_aneg = ksz8873mll_config_aneg, .read_status = ksz8873mll_read_status, + .match_phy_device = ksz8795_match_phy_device, .suspend = genphy_suspend, .resume = genphy_resume, }, {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 88/99 net: phy: micrel: Update KSZ87xx PHY name
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 1d951ba3da67bbc7a9b0e05987e09552c2060e18 ]
The KSZ8795 PHY ID is in fact used by KSZ8794/KSZ8795/KSZ8765 switches. Update the PHY ID and name to reflect that, as this family of switches is commonly refered to as KSZ87xx
--- drivers/net/phy/micrel.c | 4 ++-- include/linux/micrel_phy.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/phy/micrel.c +2 -2
@@ -395,7 +395,7 @@ static int ksz8061_config_init(struct phy_device *phydev)static int ksz8795_match_phy_device (struct phy_device *phydev) { -return ksz8051_ksz8795_match_phy_device (phydev,PHY_ID_KSZ8795 ); +return ksz8051_ksz8795_match_phy_device (phydev,PHY_ID_KSZ87XX ); } static int ksz9021_load_values_from_of(struct phy_device *phydev,
@@ -1174,7 +1174,7 @@ static struct phy_driver ksphy_driver[] = { .suspend = genphy_suspend, .resume = genphy_resume, }, { - .name = "Micrel KSZ8795", + .name = "Micrel KSZ87XX Switch", /* PHY_BASIC_FEATURES */ .config_init = kszphy_config_init, .config_aneg = ksz8873mll_config_aneg,
include/linux/micrel_phy.h +1 -1
@@ -31,7 +31,7 @@#define PHY_ID_KSZ886X 0x00221430#define PHY_ID_KSZ8863 0x00221435 -#define PHY_ID_KSZ8795 0x00221550 +#define PHY_ID_KSZ87XX 0x00221550#define PHY_ID_KSZ9477 0x00221631
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 89/99 x86/hyperv: Set pv_info.name to "Hyper-V"
In reply to Sasha LevinFrom: Andrea Parri <[email protected]>
[ Upstream commit f7c0f50f1857c1cf013466fcea4dc98d116bf456 ]
Michael reported that the x86/hyperv initialization code prints the following dmesg when running in a VM on Hyper-V:
[ 0.000738] Booting paravirtualized kernel on bare hardware
Let the x86/hyperv initialization code set pv_info.name to "Hyper-V" so dmesg reports correctly:
[ 0.000172] Booting paravirtualized kernel on Hyper-V
[ tglx: Folded build fix provided by Yue ]
--- arch/x86/kernel/cpu/mshyperv.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/cpu/mshyperv.c +4 -0
@@ -215,6 +215,10 @@ static void __init ms_hyperv_init_platform(void)int hv_host_info_ecx;int hv_host_info_edx; +#ifdef CONFIG_PARAVIRT + pv_info.name ="Hyper-V" ; +#endif +/* * Extract the features and hints */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 90/99 net: bcmgenet: don't set phydev->link from MAC
In reply to Sasha LevinFrom: Doug Berger <[email protected]>
[ Upstream commit 7de48402faa32298c3551ea32c76ccb4f9d3025d ]
When commit 28b2e0d2cd13 ("net: phy: remove parameter new_link from phy_mac_interrupt()") removed the new_link parameter it set the phydev->link state from the MAC before invoking phy_mac_interrupt().
However, once commit 88d6272acaaa ("net: phy: avoid unneeded MDIO reads in genphy_read_status") was added this initialization prevents the proper determination of the connection parameters by the function genphy_read_status().
This commit removes that initialization to restore the proper functionality.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +1 -3
@@ -2617,10 +2617,8 @@ static void bcmgenet_irq_task(struct work_struct *work)spin_unlock_irq (&priv->lock);/* Link UP/DOWN event */ -if (status &UMAC_IRQ_LINK_EVENT ) { - priv->dev->phydev->link = !!(status &UMAC_IRQ_LINK_UP ); +if (status &UMAC_IRQ_LINK_EVENT )phy_mac_interrupt (priv->dev->phydev); - } }/* bcmgenet_isr1: handle Rx and Tx priority queues */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 91/99 net: phy: bcm7xxx: define soft_reset for 40nm EPHY
In reply to Sasha LevinFrom: Doug Berger <[email protected]>
[ Upstream commit fe586b823372a9f43f90e2c6aa0573992ce7ccb7 ]
The internal 40nm EPHYs use a "Workaround for putting the PHY in IDDQ mode." These PHYs require a soft reset to restore functionality after they are powered back up.
This commit defines the soft_reset function to use genphy_soft_reset during phy_init_hw to accommodate this.
--- drivers/net/phy/bcm7xxx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/phy/bcm7xxx.c +1 -0
@@ -572,6 +572,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \/* PHY_BASIC_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ + .soft_reset = genphy_soft_reset, \ .config_init = bcm7xxx_config_init, \ .suspend = bcm7xxx_suspend, \ .resume = bcm7xxx_config_init, \
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 92/99 net: bcmgenet: reset 40nm EPHY on energy detect
In reply to Sasha LevinFrom: Doug Berger <[email protected]>
[ Upstream commit 25382b991d252aed961cd434176240f9de6bb15f ]
The EPHY integrated into the 40nm Set-Top Box devices can falsely detect energy when connected to a disabled peer interface. When the peer interface is enabled the EPHY will detect and report the link as active, but on occasion may get into a state where it is not able to exchange data with the connected GENET MAC. This issue has not been observed when the link parameters are auto-negotiated; however, it has been observed with a manually configured link.
It has been empirically determined that issuing a soft reset to the EPHY when energy is detected prevents it from getting into this bad state.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +8 -1
@@ -2018,6 +2018,8 @@ static void bcmgenet_link_intr_enable(struct bcmgenet_priv *priv)*/ if (priv->internal_phy) { int0_enable |=UMAC_IRQ_LINK_EVENT ; +if (GENET_IS_V1 (priv) ||GENET_IS_V2 (priv) ||GENET_IS_V3 (priv)) + int0_enable |=UMAC_IRQ_PHY_DET_R ; }else if (priv->ext_phy) { int0_enable |=UMAC_IRQ_LINK_EVENT ; }else if (priv->phy_interface ==PHY_INTERFACE_MODE_MOCA ) {
@@ -2616,9 +2618,14 @@ static void bcmgenet_irq_task(struct work_struct *work) priv->irq0_stat =0 ;spin_unlock_irq (&priv->lock); +if (status &UMAC_IRQ_PHY_DET_R && + priv->dev->phydev->autoneg !=AUTONEG_ENABLE ) +phy_init_hw (priv->dev->phydev); +/* Link UP/DOWN event */ if (status &UMAC_IRQ_LINK_EVENT )phy_mac_interrupt (priv->dev->phydev); + }/* bcmgenet_isr1: handle Rx and Tx priority queues */
@@ -2713,7 +2720,7 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) }/* all other interested interrupts handled in bottom half */ - status &=UMAC_IRQ_LINK_EVENT ; + status &= (UMAC_IRQ_LINK_EVENT |UMAC_IRQ_PHY_DET_R );if (status) {/* Save irq status for bottom-half processing. */ spin_lock_irqsave (&priv->lock, flags);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 93/99 net: usb: lan78xx: Connect PHY before registering MAC
In reply to Sasha LevinFrom: Andrew Lunn <[email protected]>
[ Upstream commit 38b4fe320119859c11b1dc06f6b4987a16344fa1 ]
As soon as the netdev is registers, the kernel can start using the interface. If the driver connects the MAC to the PHY after the netdev is registered, there is a race condition where the interface can be opened without having the PHY connected.
Change the order to close this race condition.
--- drivers/net/usb/lan78xx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/usb/lan78xx.c +6 -6
@@ -3789,10 +3789,14 @@ static int lan78xx_probe(struct usb_interface *intf,/* driver requires remote-wakeup capability during autosuspend. */ intf->needs_remote_wakeup =1 ; + ret =lan78xx_phy_init (dev); +if (ret <0 ) + goto out4; + ret =register_netdev (netdev);if (ret !=0 ) {netif_err (dev, probe, netdev,"couldn't register the device\n" ); - goto out4; + goto out5; }usb_set_intfdata (intf, dev);
@@ -3805,14 +3809,10 @@ static int lan78xx_probe(struct usb_interface *intf,pm_runtime_set_autosuspend_delay (&udev->dev,DEFAULT_AUTOSUSPEND_DELAY ); - ret =lan78xx_phy_init (dev); -if (ret <0 ) - goto out5; -return 0 ; out5: -unregister_netdev (netdev); +phy_disconnect (netdev->phydev); out4:usb_free_urb (dev->urb_intr); out3:
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 94/99 scripts/gdb: fix lx-dmesg when CONFIG_PRINTK_CALLER is set
In reply to Sasha LevinFrom: Joel Colledge <[email protected]>
[ Upstream commit ca210ba32ef7537b02731bfe255ed8eb1e4e2b59 ]
When CONFIG_PRINTK_CALLER is set, struct printk_log contains an additional member caller_id. This affects the offset of the log text. Account for this by using the type information from gdb to determine all the offsets instead of using hardcoded values.
This fixes following error:
(gdb) lx-dmesg
Python Exception <class 'ValueError'> embedded null character:
Error occurred in Python command: embedded null character
The read_u* utility functions now take an offset argument to make them easier to use.
--- scripts/gdb/linux/dmesg.py | 16 ++++++++++++---- scripts/gdb/linux/utils.py | 25 +++++++++++++------------ 2 files changed, 25 insertions(+), 16 deletions(-)
scripts/gdb/linux/dmesg.py +12 -4
@@ -16,6 +16,8 @@ import sys from linux import utils +printk_log_type = utils.CachedType("struct printk_log") + class LxDmesg(gdb.Command): """Print Linux kernel log buffer."""
@@ -42,9 +44,14 @@ class LxDmesg(gdb.Command): b = utils.read_memoryview(inf, log_buf_addr, log_next_idx) log_buf = a.tobytes() + b.tobytes() + length_offset = printk_log_type.get_type()['len'].bitpos // 8 + text_len_offset = printk_log_type.get_type()['text_len'].bitpos // 8 + time_stamp_offset = printk_log_type.get_type()['ts_nsec'].bitpos // 8 + text_offset = printk_log_type.get_type().sizeof + pos = 0 while pos < log_buf.__len__(): - length = utils.read_u16(log_buf[pos + 8:pos + 10]) + length = utils.read_u16(log_buf, pos + length_offset) if length == 0: if log_buf_2nd_half == -1: gdb.write("Corrupted log buffer!\n")
@@ -52,10 +59,11 @@ class LxDmesg(gdb.Command): pos = log_buf_2nd_half continue - text_len = utils.read_u16(log_buf[pos + 10:pos + 12]) - text = log_buf[pos + 16:pos + 16 + text_len].decode( + text_len = utils.read_u16(log_buf, pos + text_len_offset) + text_start = pos + text_offset + text = log_buf[text_start:text_start + text_len].decode( encoding='utf8', errors='replace') - time_stamp = utils.read_u64(log_buf[pos:pos + 8]) + time_stamp = utils.read_u64(log_buf, pos + time_stamp_offset) for line in text.splitlines(): msg = u"[{time:12.6f}] {line}\n".format(
scripts/gdb/linux/utils.py +13 -12
@@ -92,15 +92,16 @@ def read_memoryview(inf, start, length): return memoryview(inf.read_memory(start, length)) -def read_u16(buffer): +def read_u16(buffer, offset): + buffer_val = buffer[offset:offset + 2] value = [0, 0] - if type(buffer[0]) is str: - value[0] = ord(buffer[0]) - value[1] = ord(buffer[1]) + if type(buffer_val[0]) is str: + value[0] = ord(buffer_val[0]) + value[1] = ord(buffer_val[1]) else: - value[0] = buffer[0] - value[1] = buffer[1] + value[0] = buffer_val[0] + value[1] = buffer_val[1] if get_target_endianness() == LITTLE_ENDIAN: return value[0] + (value[1] << 8)
@@ -108,18 +109,18 @@ def read_u16(buffer): return value[1] + (value[0] << 8) -def read_u32(buffer): +def read_u32(buffer, offset): if get_target_endianness() == LITTLE_ENDIAN: - return read_u16(buffer[0:2]) + (read_u16(buffer[2:4]) << 16) + return read_u16(buffer, offset) + (read_u16(buffer, offset + 2) << 16) else: - return read_u16(buffer[2:4]) + (read_u16(buffer[0:2]) << 16) + return read_u16(buffer, offset + 2) + (read_u16(buffer, offset) << 16) -def read_u64(buffer): +def read_u64(buffer, offset): if get_target_endianness() == LITTLE_ENDIAN: - return read_u32(buffer[0:4]) + (read_u32(buffer[4:8]) << 32) + return read_u32(buffer, offset) + (read_u32(buffer, offset + 4) << 32) else: - return read_u32(buffer[4:8]) + (read_u32(buffer[0:4]) << 32) + return read_u32(buffer, offset + 4) + (read_u32(buffer, offset) << 32) target_arch = None
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 95/99 ocfs2: fix error handling in ocfs2_setattr()
In reply to Sasha LevinFrom: Chengguang Xu <[email protected]>
[ Upstream commit ce750f43f5790de74c1644c39d78f684071658d1 ]
Should set transfer_to[USRQUOTA/GRPQUOTA] to NULL on error case before jumping to do dqput().
--- fs/ocfs2/file.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ocfs2/file.c +2 -0
@@ -1226,6 +1226,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) transfer_to[USRQUOTA ] =dqget (sb,make_kqid_uid (attr->ia_uid));if (IS_ERR (transfer_to[USRQUOTA ])) { status =PTR_ERR (transfer_to[USRQUOTA ]); + transfer_to[USRQUOTA ] =NULL ; goto bail_unlock; } }
@@ -1235,6 +1236,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) transfer_to[GRPQUOTA ] =dqget (sb,make_kqid_gid (attr->ia_gid));if (IS_ERR (transfer_to[GRPQUOTA ])) { status =PTR_ERR (transfer_to[GRPQUOTA ]); + transfer_to[GRPQUOTA ] =NULL ; goto bail_unlock; } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 96/99 mm/gup_benchmark: add a missing "w" to getopt string
In reply to Sasha LevinFrom: John Hubbard <[email protected]>
[ Upstream commit 6f24c8d30d08f270b54f4c2cb9b08dfccbe59c57 ]
Even though gup_benchmark.c has code to handle the -w command-line option, the "w" is not part of the getopt string. It looks as if it has been missing the whole time.
On my machine, this leads naturally to the following predictable result:
$ sudo ./gup_benchmark -w ./gup_benchmark: invalid option -- 'w'
...which is fixed with this commit.
--- tools/testing/selftests/vm/gup_benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/gup_benchmark.c +1 -1
@@ -37,7 +37,7 @@ int main(int argc, char **argv)char *file ="/dev/zero" ;char *p; -while ((opt =getopt (argc, argv,"m:r:n:f:tTLUSH" )) !=-1 ) { +while ((opt =getopt (argc, argv,"m:r:n:f:tTLUwSH" )) !=-1 ) {switch (opt) {case 'm' : size =atoi (optarg) *MB ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 97/99 scripts/gdb: fix debugging modules on s390
In reply to Sasha LevinFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 585d730d41120926e3f79a601edad3930fa28366 ]
Currently lx-symbols assumes that module text is always located at module->core_layout->base, but s390 uses the following layout:
+------+ <- module->core_layout->base | GOT | +------+ <- module->core_layout->base + module->arch->plt_offset | PLT | +------+ <- module->core_layout->base + module->arch->plt_offset + | TEXT | module->arch->plt_size +------+
Therefore, when trying to debug modules on s390, all the symbol addresses are skewed by plt_offset + plt_size.
Fix by adding plt_offset + plt_size to module_addr in load_module_symbols().
--- scripts/gdb/linux/symbols.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
scripts/gdb/linux/symbols.py +7 -1
@@ -15,7 +15,7 @@ import gdb import os import re -from linux import modules +from linux import modules, utils if hasattr(gdb, 'Breakpoint'):
@@ -116,6 +116,12 @@ lx-symbols command.""" module_file = self._get_module_file(module_name) if module_file: + if utils.is_target_arch('s390'): + # Module text is preceded by PLT stubs on s390. + module_arch = module['arch'] + plt_offset = int(module_arch['plt_offset']) + plt_size = int(module_arch['plt_size']) + module_addr = hex(int(module_addr, 0) + plt_offset + plt_size) gdb.write("loading @{addr}: {filename}\n".format( addr=module_addr, filename=module_file)) cmdline = "add-symbol-file {filename} {addr}{sections}".format(
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 98/99 net: hns3: fix mis-counting IRQ vector numbers issue
In reply to Sasha LevinFrom: Yonglong Liu <[email protected]>
[ Upstream commit 580a05f9d4ada3bfb689140d0efec1efdb8a48da ]
Currently, the num_msi_left means the vector numbers of NIC, but if the PF supported RoCE, it contains the vector numbers of NIC and RoCE(Not expected).
This may cause interrupts lost in some case, because of the NIC module used the vector resources which belongs to RoCE.
This patch adds a new variable num_nic_msi to store the vector numbers of NIC, and adjust the default TQP numbers and rss_size according to the value of num_nic_msi.
--- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 ++ .../hisilicon/hns3/hns3pf/hclge_main.c | 21 +++++++++++++- .../hisilicon/hns3/hns3pf/hclge_main.h | 1 + .../ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 11 ++++++-- .../hisilicon/hns3/hns3vf/hclgevf_main.c | 28 +++++++++++++++++-- .../hisilicon/hns3/hns3vf/hclgevf_main.h | 1 + 6 files changed, 58 insertions(+), 6 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hnae3.h +2 -0
@@ -32,6 +32,8 @@#define HNAE3_MOD_VERSION "1.0" +#define HNAE3_MIN_VECTOR_NUM 2/* first one for misc, another for IO */ +/* Device IDs */ #define HNAE3_DEV_ID_GE 0xA220#define HNAE3_DEV_ID_25GE 0xA221
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +20 -1
@@ -800,6 +800,9 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev)hnae3_get_field (__le16_to_cpu (req->pf_intr_vector_number),HCLGE_PF_VEC_NUM_M ,HCLGE_PF_VEC_NUM_S ); +/* nic's msix numbers is always equals to the roce's. */ + hdev->num_nic_msi = hdev->num_roce_msi; +/* PF should have NIC vectors and Roce vectors, * NIC vectors are queued before Roce vectors. */
@@ -809,6 +812,15 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev) hdev->num_msi =hnae3_get_field (__le16_to_cpu (req->pf_intr_vector_number),HCLGE_PF_VEC_NUM_M ,HCLGE_PF_VEC_NUM_S ); + + hdev->num_nic_msi = hdev->num_msi; + } + +if (hdev->num_nic_msi <HNAE3_MIN_VECTOR_NUM ) { +dev_err (&hdev->pdev->dev, +"Just %u msi resources, not enough for pf(min:2).\n" , + hdev->num_nic_msi); +return -EINVAL ; }return 0 ;
@@ -1394,6 +1406,10 @@ static int hclge_assign_tqp(struct hclge_vport *vport, u16 num_tqps) kinfo->rss_size =min_t (u16, hdev->rss_size_max, vport->alloc_tqps / hdev->tm_info.num_tc); +/* ensure one to one mapping between irq and queue at default */ + kinfo->rss_size =min_t (u16, kinfo->rss_size, + (hdev->num_nic_msi -1 ) / hdev->tm_info.num_tc); +return 0 ; }
@@ -2172,7 +2188,8 @@ static int hclge_init_msi(struct hclge_dev *hdev)int vectors;int i; - vectors =pci_alloc_irq_vectors (pdev,1 , hdev->num_msi, + vectors =pci_alloc_irq_vectors (pdev,HNAE3_MIN_VECTOR_NUM , + hdev->num_msi,PCI_IRQ_MSI |PCI_IRQ_MSIX );if (vectors <0 ) { dev_err(&pdev->dev,
@@ -2187,6 +2204,7 @@ static int hclge_init_msi(struct hclge_dev *hdev) hdev->num_msi = vectors; hdev->num_msi_left = vectors; + hdev->base_msi_vector = pdev->irq; hdev->roce_base_vector = hdev->base_msi_vector + hdev->roce_base_msix_offset;
@@ -3644,6 +3662,7 @@ static int hclge_get_vector(struct hnae3_handle *handle, u16 vector_num,int alloc =0 ;int i, j; + vector_num =min_t (u16, hdev->num_nic_msi -1 , vector_num); vector_num =min (hdev->num_msi_left, vector_num);for (j =0 ; j < vector_num; j++) {
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +1 -0
@@ -795,6 +795,7 @@ struct hclge_dev {u32 base_msi_vector;u16 *vector_status;int *vector_irq; +u16 num_nic_msi;/* Num of nic vectors for this PF */ u16 num_roce_msi;/* Num of roce vectors for this PF */ int roce_base_vector;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +9 -2
@@ -540,9 +540,16 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport) kinfo->rss_size = kinfo->req_rss_size; }else if (kinfo->rss_size > max_rss_size || (!kinfo->req_rss_size && kinfo->rss_size < max_rss_size)) { +/* if user not set rss, the rss_size should compare with the +* valid msi numbers to ensure one to one map between tqp and +* irq as default. +*/ +if (!kinfo->req_rss_size) + max_rss_size =min_t (u16, max_rss_size, + (hdev->num_nic_msi -1 ) / + kinfo->num_tc); +/* Set to the maximum specification value (max_rss_size). */ -dev_info (&hdev->pdev->dev,"rss changes from %d to %d\n" , - kinfo->rss_size, max_rss_size); kinfo->rss_size = max_rss_size; }
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +25 -3
@@ -411,6 +411,13 @@ static int hclgevf_knic_setup(struct hclgevf_dev *hdev) kinfo->tqp[i] = &hdev->htqp[i].q; } +/* after init the max rss_size and tqps, adjust the default tqp numbers +* and rss size with the actual vector numbers +*/ + kinfo->num_tqps =min_t (u16, hdev->num_nic_msix -1 , kinfo->num_tqps); + kinfo->rss_size =min_t (u16, kinfo->num_tqps / kinfo->num_tc, + kinfo->rss_size); +return 0 ; }
@@ -502,6 +509,7 @@ static int hclgevf_get_vector(struct hnae3_handle *handle, u16 vector_num,int alloc =0 ;int i, j; + vector_num =min_t (u16, hdev->num_nic_msix -1 , vector_num); vector_num =min (hdev->num_msi_left, vector_num);for (j =0 ; j < vector_num; j++) {
@@ -2208,13 +2216,14 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev)int vectors;int i; -if (hnae3_get_bit (hdev->ae_dev->flag,HNAE3_DEV_SUPPORT_ROCE_B )) +if (hnae3_dev_roce_supported (hdev)) vectors =pci_alloc_irq_vectors (pdev, hdev->roce_base_msix_offset +1 , hdev->num_msi,PCI_IRQ_MSIX );else - vectors =pci_alloc_irq_vectors (pdev,1 , hdev->num_msi, + vectors =pci_alloc_irq_vectors (pdev,HNAE3_MIN_VECTOR_NUM , + hdev->num_msi,PCI_IRQ_MSI |PCI_IRQ_MSIX );if (vectors <0 ) {
@@ -2230,6 +2239,7 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) hdev->num_msi = vectors; hdev->num_msi_left = vectors; + hdev->base_msi_vector = pdev->irq; hdev->roce_base_vector = pdev->irq + hdev->roce_base_msix_offset;
@@ -2495,7 +2505,7 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) req = (struct hclgevf_query_res_cmd *)desc.data; -if (hnae3_get_bit (hdev->ae_dev->flag,HNAE3_DEV_SUPPORT_ROCE_B )) { +if (hnae3_dev_roce_supported (hdev)) { hdev->roce_base_msix_offset = hnae3_get_field(__le16_to_cpu(req->msixcap_localid_ba_rocee), HCLGEVF_MSIX_OFT_ROCEE_M,
@@ -2504,6 +2514,9 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev)hnae3_get_field (__le16_to_cpu (req->vf_intr_vector_number),HCLGEVF_VEC_NUM_M ,HCLGEVF_VEC_NUM_S ); +/* nic's msix numbers is always equals to the roce's. */ + hdev->num_nic_msix = hdev->num_roce_msix; +/* VF should have NIC vectors and Roce vectors, NIC vectors * are queued before Roce vectors. The offset is fixed to 64. */
@@ -2513,6 +2526,15 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) hdev->num_msi =hnae3_get_field (__le16_to_cpu (req->vf_intr_vector_number),HCLGEVF_VEC_NUM_M ,HCLGEVF_VEC_NUM_S ); + + hdev->num_nic_msix = hdev->num_msi; + } + +if (hdev->num_nic_msix <HNAE3_MIN_VECTOR_NUM ) { +dev_err (&hdev->pdev->dev, +"Just %u msi resources, not enough for vf(min:2).\n" , + hdev->num_nic_msix); +return -EINVAL ; }return 0 ;
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +1 -0
@@ -265,6 +265,7 @@ struct hclgevf_dev {u16 num_msi;u16 num_msi_left;u16 num_msi_used; +u16 num_nic_msix;/* Num of nic vectors for this VF */ u16 num_roce_msix;/* Num of roce vectors for this VF */ u16 roce_base_msix_offset;int roce_base_vector;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 99/99 net: aquantia: add an error handling in aq_nic_set_multicast_list
In reply to Sasha LevinFrom: Chenwandun <[email protected]>
[ Upstream commit 3d00cf2fbb61212f47a3cf838be51c921366c937 ]
add an error handling in aq_nic_set_multicast_list, it may not work when hw_multicast_list_set error; and at the same time it will remove gcc Wunused-but-set-variable warning.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +2 -0
@@ -664,6 +664,8 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) err = hw_ops->hw_multicast_list_set (self->aq_hw, self->mc_list.ar, self->mc_list.count); +if (err <0 ) +return err; }return aq_nic_set_packet_filter (self, packet_filter); }
Signature · 1 line
2.20.1