Skip to content
Snippets Groups Projects
  1. Jan 11, 2025
  2. Jan 10, 2025
    • Greg Kroah-Hartman's avatar
      Merge 5.10.233 into android12-5.10-lts · e36dd359
      Greg Kroah-Hartman authored
      
      Changes in 5.10.233
      	net: sched: fix ordering of qlen adjustment
      	PCI/AER: Disable AER service on suspend
      	PCI: Use preserve_config in place of pci_flags
      	MIPS: Loongson64: DTS: Fix msi node for ls7a
      	ALSA: usb: Fix UBSAN warning in parse_audio_unit()
      	PCI: Add ACS quirk for Broadcom BCM5760X NIC
      	usb: cdns3: Add quirk flag to enable suspend residency
      	usb: dwc2: gadget: Don't write invalid mapped sg entries into dma_desc with iommu enabled
      	i2c: pnx: Fix timeout in wait functions
      	erofs: fix order >= MAX_ORDER warning due to crafted negative i_size
      	erofs: fix incorrect symlink detection in fast symlink
      	net/smc: check sndbuf_space again after NOSPACE flag is set in smc_poll
      	net/smc: check iparea_offset and ipv6_prefixes_cnt when receiving proposal msg
      	net/smc: check return value of sock_recvmsg when draining clc data
      	netdevsim: switch to memdup_user_nul()
      	netdevsim: prevent bad user input in nsim_dev_health_break_write()
      	ionic: use ee->offset when returning sprom data
      	net: hinic: Fix cleanup in create_rxqs/txqs()
      	net: ethernet: bgmac-platform: fix an OF node reference leak
      	netfilter: ipset: Fix for recursive locking warning
      	mmc: sdhci-tegra: Remove SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC quirk
      	chelsio/chtls: prevent potential integer overflow on 32bit
      	i2c: riic: Always round-up when calculating bus period
      	efivarfs: Fix error on non-existent file
      	USB: serial: option: add TCL IK512 MBIM & ECM
      	USB: serial: option: add MeiG Smart SLM770A
      	USB: serial: option: add Netprisma LCUK54 modules for WWAN Ready
      	USB: serial: option: add MediaTek T7XX compositions
      	USB: serial: option: add Telit FE910C04 rmnet compositions
      	hwmon: (tmp513) Fix interpretation of values of Temperature Result and Limit Registers
      	sh: clk: Fix clk_enable() to return 0 on NULL clk
      	zram: refuse to use zero sized block device as backing device
      	btrfs: tree-checker: reject inline extent items with 0 ref count
      	Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet
      	NFS/pnfs: Fix a live lock between recalled layouts and layoutget
      	of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one()
      	nilfs2: prevent use of deleted inode
      	udmabuf: also check for F_SEAL_FUTURE_WRITE
      	of: Fix error path in of_parse_phandle_with_args_map()
      	of: Fix refcount leakage for OF node returned by __of_get_dma_parent()
      	ceph: validate snapdirname option length when mounting
      	epoll: Add synchronous wakeup support for ep_poll_callback
      	media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg
      	mm/vmstat: fix a W=1 clang compiler warning
      	tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress()
      	bpf: Check negative offsets in __bpf_skb_min_len()
      	nfsd: restore callback functionality for NFSv4.0
      	mtd: diskonchip: Cast an operand to prevent potential overflow
      	phy: core: Fix an OF node refcount leakage in _of_phy_get()
      	phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup()
      	phy: core: Fix that API devm_phy_put() fails to release the phy
      	phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider
      	phy: core: Fix that API devm_phy_destroy() fails to destroy the phy
      	dmaengine: mv_xor: fix child node refcount handling in early exit
      	dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset
      	mtd: rawnand: fix double free in atmel_pmecc_create_user()
      	tracing/kprobe: Make trace_kprobe's module callback called after jump_label update
      	watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04
      	scsi: qla1280: Fix hw revision numbering for ISP1020/1040
      	scsi: megaraid_sas: Fix for a potential deadlock
      	ALSA: hda/conexant: fix Z60MR100 startup pop issue
      	regmap: Use correct format specifier for logging range errors
      	platform/x86: asus-nb-wmi: Ignore unknown event 0xCF
      	scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time
      	scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error
      	virtio-blk: don't keep queue frozen during system suspend
      	MIPS: Probe toolchain support of -msym32
      	skbuff: introduce skb_expand_head()
      	ipv6: use skb_expand_head in ip6_finish_output2
      	ipv6: use skb_expand_head in ip6_xmit
      	ipv6: fix possible UAF in ip6_finish_output2()
      	bpf: Check validity of link->type in bpf_link_show_fdinfo()
      	bpf: fix recursive lock when verdict program return SK_PASS
      	drm/dp_mst: Fix MST sideband message body length check
      	arm64: mm: Rename asid2idx() to ctxid2asid()
      	arm64: Ensure bits ASID[15:8] are masked out when the kernel uses 8-bit ASIDs
      	tracing: Constify string literal data member in struct trace_event_call
      	power: supply: gpio-charger: Fix set charge current limits
      	btrfs: avoid monopolizing a core when activating a swap file
      	nfsd: cancel nfsd_shrinker_work using sync mode in nfs4_state_shutdown_net
      	skb_expand_head() adjust skb->truesize incorrectly
      	ipv6: prevent possible UAF in ip6_xmit()
      	x86/hyperv: Fix hv tsc page based sched_clock for hibernation
      	selinux: ignore unknown extended permissions
      	thunderbolt: Add support for Intel Alder Lake
      	thunderbolt: Add support for Intel Raptor Lake
      	thunderbolt: Add support for Intel Meteor Lake
      	thunderbolt: Add Intel Barlow Ridge PCI ID
      	thunderbolt: Add support for Intel Lunar Lake
      	thunderbolt: Add support for Intel Panther Lake-M/P
      	net/mlx5: Make API mlx5_core_is_ecpf accept const pointer
      	RDMA/mlx5: Enforce same type port association for multiport RoCE
      	RDMA/bnxt_re: Add check for path mtu in modify_qp
      	RDMA/bnxt_re: Fix reporting hw_ver in query_device
      	RDMA/bnxt_re: Fix max_qp_wrs reported
      	RDMA/bnxt_re: Fix the locking while accessing the QP table
      	drm/bridge: adv7511_audio: Update Audio InfoFrame properly
      	netrom: check buffer length before accessing it
      	netfilter: nft_set_hash: unaligned atomic read on struct nft_set_ext
      	net: llc: reset skb->transport_header
      	ALSA: usb-audio: US16x08: Initialize array before use
      	eth: bcmsysport: fix call balance of priv->clk handling routines
      	RDMA/rtrs: Ensure 'ib_sge list' is accessible
      	af_packet: fix vlan_get_tci() vs MSG_PEEK
      	af_packet: fix vlan_get_protocol_dgram() vs MSG_PEEK
      	ila: serialize calls to nf_register_net_hooks()
      	dmaengine: dw: Select only supported masters for ACPI devices
      	btrfs: switch extent buffer tree lock to rw_semaphore
      	btrfs: locking: remove all the blocking helpers
      	btrfs: rename and export __btrfs_cow_block()
      	btrfs: fix use-after-free when COWing tree bock and tracing is enabled
      	kernel: Initialize cpumask before parsing
      	tracing: Prevent bad count for tracing_cpumask_write
      	wifi: mac80211: wake the queues in case of failure in resume
      	btrfs: flush delalloc workers queue before stopping cleaner kthread during unmount
      	sound: usb: format: don't warn that raw DSD is unsupported
      	bpf: fix potential error return
      	net: usb: qmi_wwan: add Telit FE910C04 compositions
      	irqchip/gic: Correct declaration of *percpu_base pointer in union gic_base
      	ARC: build: Try to guess GCC variant of cross compiler
      	btrfs: locking: remove the recursion handling code
      	btrfs: don't set lock_owner when locking extent buffer for reading
      	modpost: fix input MODULE_DEVICE_TABLE() built for 64-bit on 32-bit host
      	modpost: fix the missed iteration for the max bit in do_input()
      	RDMA/uverbs: Prevent integer overflow issue
      	pinctrl: mcp23s08: Fix sleeping in atomic context due to regmap locking
      	sky2: Add device ID 11ab:4373 for Marvell 88E8075
      	net/sctp: Prevent autoclose integer overflow in sctp_association_init()
      	drm: adv7511: Drop dsi single lane support
      	mm: vmscan: account for free pages to prevent infinite Loop in throttle_direct_reclaim()
      	Linux 5.10.233
      
      Change-Id: I44b140d83b01d2d88895bca7fb897c6e3ce65027
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      e36dd359
  3. Jan 09, 2025
    • Greg Kroah-Hartman's avatar
    • Seiji Nishikawa's avatar
      mm: vmscan: account for free pages to prevent infinite Loop in throttle_direct_reclaim() · d675fefb
      Seiji Nishikawa authored
      commit 6aaced5a upstream.
      
      The task sometimes continues looping in throttle_direct_reclaim() because
      allow_direct_reclaim(pgdat) keeps returning false.
      
       #0 [ffff80002cb6f8d0] __switch_to at ffff8000080095ac
       #1 [ffff80002cb6f900] __schedule at ffff800008abbd1c
       #2 [ffff80002cb6f990] schedule at ffff800008abc50c
       #3 [ffff80002cb6f9b0] throttle_direct_reclaim at ffff800008273550
       #4 [ffff80002cb6fa20] try_to_free_pages at ffff800008277b68
       #5 [ffff80002cb6fae0] __alloc_pages_nodemask at ffff8000082c4660
       #6 [ffff80002cb6fc50] alloc_pages_vma at ffff8000082e4a98
       #7 [ffff80002cb6fca0] do_anonymous_page at ffff80000829f5a8
       #8 [ffff80002cb6fce0] __handle_mm_fault at ffff8000082a5974
       #9 [ffff80002cb6fd90] handle_mm_fault at ffff8000082a5bd4
      
      At this point, the pgdat contains the following two zones:
      
              NODE: 4  ZONE: 0  ADDR: ffff00817fffe540  NAME: "DMA32"
                SIZE: 20480  MIN/LOW/HIGH: 11/28/45
                VM_STAT:
                      NR_FREE_PAGES: 359
              NR_ZONE_INACTIVE_ANON: 18813
                NR_ZONE_ACTIVE_ANON: 0
              NR_ZONE_INACTIVE_FILE: 50
                NR_ZONE_ACTIVE_FILE: 0
                NR_ZONE_UNEVICTABLE: 0
              NR_ZONE_WRITE_PENDING: 0
                           NR_MLOCK: 0
                          NR_BOUNCE: 0
                         NR_ZSPAGES: 0
                  NR_FREE_CMA_PAGES: 0
      
              NODE: 4  ZONE: 1  ADDR: ffff00817fffec00  NAME: "Normal"
                SIZE: 8454144  PRESENT: 98304  MIN/LOW/HIGH: 68/166/264
                VM_STAT:
                      NR_FREE_PAGES: 146
              NR_ZONE_INACTIVE_ANON: 94668
                NR_ZONE_ACTIVE_ANON: 3
              NR_ZONE_INACTIVE_FILE: 735
                NR_ZONE_ACTIVE_FILE: 78
                NR_ZONE_UNEVICTABLE: 0
              NR_ZONE_WRITE_PENDING: 0
                           NR_MLOCK: 0
                          NR_BOUNCE: 0
                         NR_ZSPAGES: 0
                  NR_FREE_CMA_PAGES: 0
      
      In allow_direct_reclaim(), while processing ZONE_DMA32, the sum of
      inactive/active file-backed pages calculated in zone_reclaimable_pages()
      based on the result of zone_page_state_snapshot() is zero.
      
      Additionally, since this system lacks swap, the calculation of inactive/
      active anonymous pages is skipped.
      
              crash> p nr_swap_pages
              nr_swap_pages = $1937 = {
                counter = 0
              }
      
      As a result, ZONE_DMA32 is deemed unreclaimable and skipped, moving on to
      the processing of the next zone, ZONE_NORMAL, despite ZONE_DMA32 having
      free pages significantly exceeding the high watermark.
      
      The problem is that the pgdat->kswapd_failures hasn't been incremented.
      
              crash> px ((struct pglist_data *) 0xffff00817fffe540)->kswapd_failures
              $1935 = 0x0
      
      This is because the node deemed balanced.  The node balancing logic in
      balance_pgdat() evaluates all zones collectively.  If one or more zones
      (e.g., ZONE_DMA32) have enough free pages to meet their watermarks, the
      entire node is deemed balanced.  This causes balance_pgdat() to exit early
      before incrementing the kswapd_failures, as it considers the overall
      memory state acceptable, even though some zones (like ZONE_NORMAL) remain
      under significant pressure.
      
      
      The patch ensures that zone_reclaimable_pages() includes free pages
      (NR_FREE_PAGES) in its calculation when no other reclaimable pages are
      available (e.g., file-backed or anonymous pages).  This change prevents
      zones like ZONE_DMA32, which have sufficient free pages, from being
      mistakenly deemed unreclaimable.  By doing so, the patch ensures proper
      node balancing, avoids masking pressure on other zones like ZONE_NORMAL,
      and prevents infinite loops in throttle_direct_reclaim() caused by
      allow_direct_reclaim(pgdat) repeatedly returning false.
      
      
      The kernel hangs due to a task stuck in throttle_direct_reclaim(), caused
      by a node being incorrectly deemed balanced despite pressure in certain
      zones, such as ZONE_NORMAL.  This issue arises from
      zone_reclaimable_pages() returning 0 for zones without reclaimable file-
      backed or anonymous pages, causing zones like ZONE_DMA32 with sufficient
      free pages to be skipped.
      
      The lack of swap or reclaimable pages results in ZONE_DMA32 being ignored
      during reclaim, masking pressure in other zones.  Consequently,
      pgdat->kswapd_failures remains 0 in balance_pgdat(), preventing fallback
      mechanisms in allow_direct_reclaim() from being triggered, leading to an
      infinite loop in throttle_direct_reclaim().
      
      This patch modifies zone_reclaimable_pages() to account for free pages
      (NR_FREE_PAGES) when no other reclaimable pages exist.  This ensures zones
      with sufficient free pages are not skipped, enabling proper balancing and
      reclaim behavior.
      
      [akpm@linux-foundation.org: coding-style cleanups]
      Link: https://lkml.kernel.org/r/20241130164346.436469-1-snishika@redhat.com
      Link: https://lkml.kernel.org/r/20241130161236.433747-2-snishika@redhat.com
      
      
      Fixes: 5a1c84b4 ("mm: remove reclaim and compaction retry approximations")
      Signed-off-by: default avatarSeiji Nishikawa <snishika@redhat.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d675fefb
    • Biju Das's avatar
    • Nikolay Kuratov's avatar
      net/sctp: Prevent autoclose integer overflow in sctp_association_init() · 081bdb3a
      Nikolay Kuratov authored
      
      commit 4e86729d upstream.
      
      While by default max_autoclose equals to INT_MAX / HZ, one may set
      net.sctp.max_autoclose to UINT_MAX. There is code in
      sctp_association_init() that can consequently trigger overflow.
      
      Cc: stable@vger.kernel.org
      Fixes: 9f70f46b ("sctp: properly latch and use autoclose value from sock to association")
      Signed-off-by: default avatarNikolay Kuratov <kniv@yandex-team.ru>
      Acked-by: default avatarXin Long <lucien.xin@gmail.com>
      Link: https://patch.msgid.link/20241219162114.2863827-1-kniv@yandex-team.ru
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      081bdb3a
    • Pascal Hambourg's avatar
      sky2: Add device ID 11ab:4373 for Marvell 88E8075 · 5a1dd20a
      Pascal Hambourg authored
      
      commit 03c8d0af upstream.
      
      A Marvell 88E8075 ethernet controller has this device ID instead of
      11ab:4370 and works fine with the sky2 driver.
      
      Signed-off-by: default avatarPascal Hambourg <pascal@plouf.fr.eu.org>
      Cc: stable@vger.kernel.org
      Link: https://patch.msgid.link/10165a62-99fb-4be6-8c64-84afd6234085@plouf.fr.eu.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a1dd20a
    • Evgenii Shatokhin's avatar
      pinctrl: mcp23s08: Fix sleeping in atomic context due to regmap locking · c55d1863
      Evgenii Shatokhin authored
      
      commit a37eecb7 upstream.
      
      If a device uses MCP23xxx IO expander to receive IRQs, the following
      bug can happen:
      
        BUG: sleeping function called from invalid context
          at kernel/locking/mutex.c:283
        in_atomic(): 1, irqs_disabled(): 1, non_block: 0, ...
        preempt_count: 1, expected: 0
        ...
        Call Trace:
        ...
        __might_resched+0x104/0x10e
        __might_sleep+0x3e/0x62
        mutex_lock+0x20/0x4c
        regmap_lock_mutex+0x10/0x18
        regmap_update_bits_base+0x2c/0x66
        mcp23s08_irq_set_type+0x1ae/0x1d6
        __irq_set_trigger+0x56/0x172
        __setup_irq+0x1e6/0x646
        request_threaded_irq+0xb6/0x160
        ...
      
      We observed the problem while experimenting with a touchscreen driver which
      used MCP23017 IO expander (I2C).
      
      The regmap in the pinctrl-mcp23s08 driver uses a mutex for protection from
      concurrent accesses, which is the default for regmaps without .fast_io,
      .disable_locking, etc.
      
      mcp23s08_irq_set_type() calls regmap_update_bits_base(), and the latter
      locks the mutex.
      
      However, __setup_irq() locks desc->lock spinlock before calling these
      functions. As a result, the system tries to lock the mutex whole holding
      the spinlock.
      
      It seems, the internal regmap locks are not needed in this driver at all.
      mcp->lock seems to protect the regmap from concurrent accesses already,
      except, probably, in mcp_pinconf_get/set.
      
      mcp23s08_irq_set_type() and mcp23s08_irq_mask/unmask() are called under
      chip_bus_lock(), which calls mcp23s08_irq_bus_lock(). The latter takes
      mcp->lock and enables regmap caching, so that the potentially slow I2C
      accesses are deferred until chip_bus_unlock().
      
      The accesses to the regmap from mcp23s08_probe_one() do not need additional
      locking.
      
      In all remaining places where the regmap is accessed, except
      mcp_pinconf_get/set(), the driver already takes mcp->lock.
      
      This patch adds locking in mcp_pinconf_get/set() and disables internal
      locking in the regmap config. Among other things, it fixes the sleeping
      in atomic context described above.
      
      Fixes: 8f38910b ("pinctrl: mcp23s08: switch to regmap caching")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarEvgenii Shatokhin <e.shatokhin@yadro.com>
      Link: https://lore.kernel.org/20241209074659.1442898-1-e.shatokhin@yadro.com
      
      
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c55d1863
    • Dan Carpenter's avatar
      RDMA/uverbs: Prevent integer overflow issue · 42a6eb4e
      Dan Carpenter authored
      
      commit d0257e08 upstream.
      
      In the expression "cmd.wqe_size * cmd.wr_count", both variables are u32
      values that come from the user so the multiplication can lead to integer
      wrapping.  Then we pass the result to uverbs_request_next_ptr() which also
      could potentially wrap.  The "cmd.sge_count * sizeof(struct ib_uverbs_sge)"
      multiplication can also overflow on 32bit systems although it's fine on
      64bit systems.
      
      This patch does two things.  First, I've re-arranged the condition in
      uverbs_request_next_ptr() so that the use controlled variable "len" is on
      one side of the comparison by itself without any math.  Then I've modified
      all the callers to use size_mul() for the multiplications.
      
      Fixes: 67cdb40c ("[IB] uverbs: Implement more commands")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Link: https://patch.msgid.link/b8765ab3-c2da-4611-aae0-ddd6ba173d23@stanley.mountain
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42a6eb4e
    • Masahiro Yamada's avatar
      modpost: fix the missed iteration for the max bit in do_input() · 50804bd9
      Masahiro Yamada authored
      
      [ Upstream commit bf36b4bf ]
      
      This loop should iterate over the range from 'min' to 'max' inclusively.
      The last interation is missed.
      
      Fixes: 1d8f430c ("[PATCH] Input: add modalias support")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      50804bd9
    • Masahiro Yamada's avatar
      modpost: fix input MODULE_DEVICE_TABLE() built for 64-bit on 32-bit host · 0cd78baf
      Masahiro Yamada authored
      
      [ Upstream commit 77dc55a9 ]
      
      When building a 64-bit kernel on a 32-bit build host, incorrect
      input MODULE_ALIAS() entries may be generated.
      
      For example, when compiling a 64-bit kernel with CONFIG_INPUT_MOUSEDEV=m
      on a 64-bit build machine, you will get the correct output:
      
        $ grep MODULE_ALIAS drivers/input/mousedev.mod.c
        MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*110,*r*0,*1,*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*r*8,*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*14A,*r*a*0,*1,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*145,*r*a*0,*1,*18,*1C,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*110,*r*a*0,*1,*m*l*s*f*w*");
      
      However, building the same kernel on a 32-bit machine results in
      incorrect output:
      
        $ grep MODULE_ALIAS drivers/input/mousedev.mod.c
        MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*110,*130,*r*0,*1,*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*r*8,*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*14A,*16A,*r*a*0,*1,*20,*21,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*145,*165,*r*a*0,*1,*18,*1C,*20,*21,*38,*3C,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*110,*130,*r*a*0,*1,*20,*21,*m*l*s*f*w*");
      
      A similar issue occurs with CONFIG_INPUT_JOYDEV=m. On a 64-bit build
      machine, the output is:
      
        $ grep MODULE_ALIAS drivers/input/joydev.mod.c
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*2,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*120,*r*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*130,*r*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*2C0,*r*a*m*l*s*f*w*");
      
      However, on a 32-bit machine, the output is incorrect:
      
        $ grep MODULE_ALIAS drivers/input/joydev.mod.c
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*2,*22,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*11F,*13F,*r*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*11F,*13F,*r*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*2C0,*2E0,*r*a*m*l*s*f*w*");
      
      When building a 64-bit kernel, BITS_PER_LONG is defined as 64. However,
      on a 32-bit build machine, the constant 1L is a signed 32-bit value.
      Left-shifting it beyond 32 bits causes wraparound, and shifting by 31
      or 63 bits makes it a negative value.
      
      The fix in commit e0e92632 ("[PATCH] PATCH: 1 line 2.6.18 bugfix:
      modpost-64bit-fix.patch") is incorrect; it only addresses cases where
      a 64-bit kernel is built on a 64-bit build machine, overlooking cases
      on a 32-bit build machine.
      
      Using 1ULL ensures a 64-bit width on both 32-bit and 64-bit machines,
      avoiding the wraparound issue.
      
      Fixes: e0e92632 ("[PATCH] PATCH: 1 line 2.6.18 bugfix: modpost-64bit-fix.patch")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Stable-dep-of: bf36b4bf ("modpost: fix the missed iteration for the max bit in do_input()")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0cd78baf
    • Zygo Blaxell's avatar
      btrfs: don't set lock_owner when locking extent buffer for reading · d5a30a61
      Zygo Blaxell authored
      
      [ Upstream commit 97e86631 ]
      
      In 196d59ab "btrfs: switch extent buffer tree lock to rw_semaphore"
      the functions for tree read locking were rewritten, and in the process
      the read lock functions started setting eb->lock_owner = current->pid.
      Previously lock_owner was only set in tree write lock functions.
      
      Read locks are shared, so they don't have exclusive ownership of the
      underlying object, so setting lock_owner to any single value for a
      read lock makes no sense.  It's mostly harmless because write locks
      and read locks are mutually exclusive, and none of the existing code
      in btrfs (btrfs_init_new_buffer and print_eb_refs_lock) cares what
      nonsense is written in lock_owner when no writer is holding the lock.
      
      KCSAN does care, and will complain about the data race incessantly.
      Remove the assignments in the read lock functions because they're
      useless noise.
      
      Fixes: 196d59ab ("btrfs: switch extent buffer tree lock to rw_semaphore")
      CC: stable@vger.kernel.org # 5.15+
      Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarZygo Blaxell <ce3g8jdj@umail.furryterror.org>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d5a30a61
    • Josef Bacik's avatar
      btrfs: locking: remove the recursion handling code · 51b03b74
      Josef Bacik authored
      
      [ Upstream commit 4048daed ]
      
      Now that we're no longer using recursion, rip out all of the supporting
      code.  Follow up patches will clean up the callers of these functions.
      
      The extent_buffer::lock_owner is still retained as it allows safety
      checks in btrfs_init_new_buffer for the case that the free space cache
      is corrupted and we try to allocate a block that we are currently using
      and have locked in the path.
      
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Stable-dep-of: 97e86631 ("btrfs: don't set lock_owner when locking extent buffer for reading")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      51b03b74
    • Leon Romanovsky's avatar
      ARC: build: Try to guess GCC variant of cross compiler · 20d96aa6
      Leon Romanovsky authored
      [ Upstream commit 824927e8 ]
      
      ARC GCC compiler is packaged starting from Fedora 39i and the GCC
      variant of cross compile tools has arc-linux-gnu- prefix and not
      arc-linux-. This is causing that CROSS_COMPILE variable is left unset.
      
      This change allows builds without need to supply CROSS_COMPILE argument
      if distro package is used.
      
      Before this change:
      $ make -j 128 ARCH=arc W=1 drivers/infiniband/hw/mlx4/
        gcc: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead
        gcc: error: unrecognized command-line option ‘-mmedium-calls’
        gcc: error: unrecognized command-line option ‘-mlock’
        gcc: error: unrecognized command-line option ‘-munaligned-access’
      
      [1] https://packages.fedoraproject.org/pkgs/cross-gcc/gcc-arc-linux-gnu/index.html
      
      
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      20d96aa6
    • Uros Bizjak's avatar
      irqchip/gic: Correct declaration of *percpu_base pointer in union gic_base · 58713417
      Uros Bizjak authored
      
      [ Upstream commit a1855f1b ]
      
      percpu_base is used in various percpu functions that expect variable in
      __percpu address space. Correct the declaration of percpu_base to
      
      void __iomem * __percpu *percpu_base;
      
      to declare the variable as __percpu pointer.
      
      The patch fixes several sparse warnings:
      
      irq-gic.c:1172:44: warning: incorrect type in assignment (different address spaces)
      irq-gic.c:1172:44:    expected void [noderef] __percpu *[noderef] __iomem *percpu_base
      irq-gic.c:1172:44:    got void [noderef] __iomem *[noderef] __percpu *
      ...
      irq-gic.c:1231:43: warning: incorrect type in argument 1 (different address spaces)
      irq-gic.c:1231:43:    expected void [noderef] __percpu *__pdata
      irq-gic.c:1231:43:    got void [noderef] __percpu *[noderef] __iomem *percpu_base
      
      There were no changes in the resulting object files.
      
      Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/all/20241213145809.2918-2-ubizjak@gmail.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      58713417
    • Daniele Palmas's avatar
      net: usb: qmi_wwan: add Telit FE910C04 compositions · af37dc1f
      Daniele Palmas authored
      
      [ Upstream commit 3b58b53a ]
      
      Add the following Telit FE910C04 compositions:
      
      0x10c0: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
      T:  Bus=02 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 13 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10c0 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FE910
      S:  SerialNumber=f71b8b32
      C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      0x10c4: rmnet + tty (AT) + tty (AT) + tty (diag)
      T:  Bus=02 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 14 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10c4 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FE910
      S:  SerialNumber=f71b8b32
      C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      0x10c8: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
      T:  Bus=02 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#= 17 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10c8 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FE910
      S:  SerialNumber=f71b8b32
      C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Link: https://patch.msgid.link/20241209151821.3688829-1-dnlplm@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      af37dc1f
    • Anton Protopopov's avatar
      bpf: fix potential error return · e529b468
      Anton Protopopov authored
      
      [ Upstream commit c4441ca8 ]
      
      The bpf_remove_insns() function returns WARN_ON_ONCE(error), where
      error is a result of bpf_adj_branches(), and thus should be always 0
      However, if for any reason it is not 0, then it will be converted to
      boolean by WARN_ON_ONCE and returned to user space as 1, not an actual
      error value. Fix this by returning the original err after the WARN check.
      
      Signed-off-by: default avatarAnton Protopopov <aspsk@isovalent.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20241210114245.836164-1-aspsk@isovalent.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e529b468
    • Adrian Ratiu's avatar
      sound: usb: format: don't warn that raw DSD is unsupported · 6f3ce0ee
      Adrian Ratiu authored
      
      [ Upstream commit b50a3e98 ]
      
      UAC 2 & 3 DAC's set bit 31 of the format to signal support for a
      RAW_DATA type, typically used for DSD playback.
      
      This is correctly tested by (format & UAC*_FORMAT_TYPE_I_RAW_DATA),
      fp->dsd_raw = true; and call snd_usb_interface_dsd_format_quirks(),
      however a confusing and unnecessary message gets printed because
      the bit is not properly tested in the last "unsupported" if test:
      if (format & ~0x3F) { ... }
      
      For example the output:
      
      usb 7-1: new high-speed USB device number 5 using xhci_hcd
      usb 7-1: New USB device found, idVendor=262a, idProduct=9302, bcdDevice=0.01
      usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6
      usb 7-1: Product: TC44C
      usb 7-1: Manufacturer: TC44C
      usb 7-1: SerialNumber: 5000000001
      hid-generic 0003:262A:9302.001E: No inputs registered, leaving
      hid-generic 0003:262A:9302.001E: hidraw6: USB HID v1.00 Device [DDHIFI TC44C] on usb-0000:08:00.3-1/input0
      usb 7-1: 2:4 : unsupported format bits 0x100000000
      
      This last "unsupported format" is actually wrong: we know the
      format is a RAW_DATA which we assume is DSD, so there is no need
      to print the confusing message.
      
      This we unset bit 31 of the format after recognizing it, to avoid
      the message.
      
      Suggested-by: default avatarTakashi Iwai <tiwai@suse.com>
      Signed-off-by: default avatarAdrian Ratiu <adrian.ratiu@collabora.com>
      Link: https://patch.msgid.link/20241209090529.16134-2-adrian.ratiu@collabora.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6f3ce0ee
    • Filipe Manana's avatar
      btrfs: flush delalloc workers queue before stopping cleaner kthread during unmount · a2718ed1
      Filipe Manana authored
      
      [ Upstream commit f10bef73 ]
      
      During the unmount path, at close_ctree(), we first stop the cleaner
      kthread, using kthread_stop() which frees the associated task_struct, and
      then stop and destroy all the work queues. However after we stopped the
      cleaner we may still have a worker from the delalloc_workers queue running
      inode.c:submit_compressed_extents(), which calls btrfs_add_delayed_iput(),
      which in turn tries to wake up the cleaner kthread - which was already
      destroyed before, resulting in a use-after-free on the task_struct.
      
      Syzbot reported this with the following stack traces:
      
        BUG: KASAN: slab-use-after-free in __lock_acquire+0x78/0x2100 kernel/locking/lockdep.c:5089
        Read of size 8 at addr ffff8880259d2818 by task kworker/u8:3/52
      
        CPU: 1 UID: 0 PID: 52 Comm: kworker/u8:3 Not tainted 6.13.0-rc1-syzkaller-00002-gcdd30ebb1b9f #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
        Workqueue: btrfs-delalloc btrfs_work_helper
        Call Trace:
         <TASK>
         __dump_stack lib/dump_stack.c:94 [inline]
         dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
         print_address_description mm/kasan/report.c:378 [inline]
         print_report+0x169/0x550 mm/kasan/report.c:489
         kasan_report+0x143/0x180 mm/kasan/report.c:602
         __lock_acquire+0x78/0x2100 kernel/locking/lockdep.c:5089
         lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
         __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
         _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
         class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:551 [inline]
         try_to_wake_up+0xc2/0x1470 kernel/sched/core.c:4205
         submit_compressed_extents+0xdf/0x16e0 fs/btrfs/inode.c:1615
         run_ordered_work fs/btrfs/async-thread.c:288 [inline]
         btrfs_work_helper+0x96f/0xc40 fs/btrfs/async-thread.c:324
         process_one_work kernel/workqueue.c:3229 [inline]
         process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310
         worker_thread+0x870/0xd30 kernel/workqueue.c:3391
         kthread+0x2f0/0x390 kernel/kthread.c:389
         ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
         ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
         </TASK>
      
        Allocated by task 2:
         kasan_save_stack mm/kasan/common.c:47 [inline]
         kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
         unpoison_slab_object mm/kasan/common.c:319 [inline]
         __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
         kasan_slab_alloc include/linux/kasan.h:250 [inline]
         slab_post_alloc_hook mm/slub.c:4104 [inline]
         slab_alloc_node mm/slub.c:4153 [inline]
         kmem_cache_alloc_node_noprof+0x1d9/0x380 mm/slub.c:4205
         alloc_task_struct_node kernel/fork.c:180 [inline]
         dup_task_struct+0x57/0x8c0 kernel/fork.c:1113
         copy_process+0x5d1/0x3d50 kernel/fork.c:2225
         kernel_clone+0x223/0x870 kernel/fork.c:2807
         kernel_thread+0x1bc/0x240 kernel/fork.c:2869
         create_kthread kernel/kthread.c:412 [inline]
         kthreadd+0x60d/0x810 kernel/kthread.c:767
         ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
         ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
      
        Freed by task 24:
         kasan_save_stack mm/kasan/common.c:47 [inline]
         kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
         kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582
         poison_slab_object mm/kasan/common.c:247 [inline]
         __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
         kasan_slab_free include/linux/kasan.h:233 [inline]
         slab_free_hook mm/slub.c:2338 [inline]
         slab_free mm/slub.c:4598 [inline]
         kmem_cache_free+0x195/0x410 mm/slub.c:4700
         put_task_struct include/linux/sched/task.h:144 [inline]
         delayed_put_task_struct+0x125/0x300 kernel/exit.c:227
         rcu_do_batch kernel/rcu/tree.c:2567 [inline]
         rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
         handle_softirqs+0x2d4/0x9b0 kernel/softirq.c:554
         run_ksoftirqd+0xca/0x130 kernel/softirq.c:943
         smpboot_thread_fn+0x544/0xa30 kernel/smpboot.c:164
         kthread+0x2f0/0x390 kernel/kthread.c:389
         ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
         ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
      
        Last potentially related work creation:
         kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47
         __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:544
         __call_rcu_common kernel/rcu/tree.c:3086 [inline]
         call_rcu+0x167/0xa70 kernel/rcu/tree.c:3190
         context_switch kernel/sched/core.c:5372 [inline]
         __schedule+0x1803/0x4be0 kernel/sched/core.c:6756
         __schedule_loop kernel/sched/core.c:6833 [inline]
         schedule+0x14b/0x320 kernel/sched/core.c:6848
         schedule_timeout+0xb0/0x290 kernel/time/sleep_timeout.c:75
         do_wait_for_common kernel/sched/completion.c:95 [inline]
         __wait_for_common kernel/sched/completion.c:116 [inline]
         wait_for_common kernel/sched/completion.c:127 [inline]
         wait_for_completion+0x355/0x620 kernel/sched/completion.c:148
         kthread_stop+0x19e/0x640 kernel/kthread.c:712
         close_ctree+0x524/0xd60 fs/btrfs/disk-io.c:4328
         generic_shutdown_super+0x139/0x2d0 fs/super.c:642
         kill_anon_super+0x3b/0x70 fs/super.c:1237
         btrfs_kill_super+0x41/0x50 fs/btrfs/super.c:2112
         deactivate_locked_super+0xc4/0x130 fs/super.c:473
         cleanup_mnt+0x41f/0x4b0 fs/namespace.c:1373
         task_work_run+0x24f/0x310 kernel/task_work.c:239
         ptrace_notify+0x2d2/0x380 kernel/signal.c:2503
         ptrace_report_syscall include/linux/ptrace.h:415 [inline]
         ptrace_report_syscall_exit include/linux/ptrace.h:477 [inline]
         syscall_exit_work+0xc7/0x1d0 kernel/entry/common.c:173
         syscall_exit_to_user_mode_prepare kernel/entry/common.c:200 [inline]
         __syscall_exit_to_user_mode_work kernel/entry/common.c:205 [inline]
         syscall_exit_to_user_mode+0x24a/0x340 kernel/entry/common.c:218
         do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
         entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
        The buggy address belongs to the object at ffff8880259d1e00
         which belongs to the cache task_struct of size 7424
        The buggy address is located 2584 bytes inside of
         freed 7424-byte region [ffff8880259d1e00, ffff8880259d3b00)
      
        The buggy address belongs to the physical page:
        page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x259d0
        head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
        memcg:ffff88802f4b56c1
        flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
        page_type: f5(slab)
        raw: 00fff00000000040 ffff88801bafe500 dead000000000100 dead000000000122
        raw: 0000000000000000 0000000000040004 00000001f5000000 ffff88802f4b56c1
        head: 00fff00000000040 ffff88801bafe500 dead000000000100 dead000000000122
        head: 0000000000000000 0000000000040004 00000001f5000000 ffff88802f4b56c1
        head: 00fff00000000003 ffffea0000967401 ffffffffffffffff 0000000000000000
        head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
        page dumped because: kasan: bad access detected
        page_owner tracks the page as allocated
        page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 12, tgid 12 (kworker/u8:1), ts 7328037942, free_ts 0
         set_page_owner include/linux/page_owner.h:32 [inline]
         post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1556
         prep_new_page mm/page_alloc.c:1564 [inline]
         get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3474
         __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4751
         alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
         alloc_slab_page+0x6a/0x140 mm/slub.c:2408
         allocate_slab+0x5a/0x2f0 mm/slub.c:2574
         new_slab mm/slub.c:2627 [inline]
         ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3815
         __slab_alloc+0x58/0xa0 mm/slub.c:3905
         __slab_alloc_node mm/slub.c:3980 [inline]
         slab_alloc_node mm/slub.c:4141 [inline]
         kmem_cache_alloc_node_noprof+0x269/0x380 mm/slub.c:4205
         alloc_task_struct_node kernel/fork.c:180 [inline]
         dup_task_struct+0x57/0x8c0 kernel/fork.c:1113
         copy_process+0x5d1/0x3d50 kernel/fork.c:2225
         kernel_clone+0x223/0x870 kernel/fork.c:2807
         user_mode_thread+0x132/0x1a0 kernel/fork.c:2885
         call_usermodehelper_exec_work+0x5c/0x230 kernel/umh.c:171
         process_one_work kernel/workqueue.c:3229 [inline]
         process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310
         worker_thread+0x870/0xd30 kernel/workqueue.c:3391
        page_owner free stack trace missing
      
        Memory state around the buggy address:
         ffff8880259d2700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
         ffff8880259d2780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        >ffff8880259d2800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                    ^
         ffff8880259d2880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
         ffff8880259d2900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
        ==================================================================
      
      Fix this by flushing the delalloc workers queue before stopping the
      cleaner kthread.
      
      Reported-by: default avatar <syzbot+b7cf50a0c173770dcb14@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/linux-btrfs/674ed7e8.050a0220.48a03.0031.GAE@google.com/
      
      
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a2718ed1
    • Emmanuel Grumbach's avatar
      wifi: mac80211: wake the queues in case of failure in resume · 12a6e304
      Emmanuel Grumbach authored
      
      [ Upstream commit 220bf000 ]
      
      In case we fail to resume, we'll WARN with
      "Hardware became unavailable during restart." and we'll wait until user
      space does something. It'll typically bring the interface down and up to
      recover. This won't work though because the queues are still stopped on
      IEEE80211_QUEUE_STOP_REASON_SUSPEND reason.
      Make sure we clear that reason so that we give a chance to the recovery
      to succeed.
      
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219447
      
      
      Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
      Link: https://patch.msgid.link/20241119173108.cd628f560f97.I76a15fdb92de450e5329940125f3c58916be3942@changeid
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      12a6e304
    • Lizhi Xu's avatar
      tracing: Prevent bad count for tracing_cpumask_write · 2558d753
      Lizhi Xu authored
      [ Upstream commit 98feccbf ]
      
      If a large count is provided, it will trigger a warning in bitmap_parse_user.
      Also check zero for it.
      
      Cc: stable@vger.kernel.org
      Fixes: 9e01c1b7 ("cpumask: convert kernel trace functions")
      Link: https://lore.kernel.org/20241216073238.2573704-1-lizhi.xu@windriver.com
      
      
      Reported-by: default avatar <syzbot+0aecfd34fb878546f3fd@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=0aecfd34fb878546f3fd
      
      
      Tested-by: default avatar <syzbot+0aecfd34fb878546f3fd@syzkaller.appspotmail.com>
      Signed-off-by: default avatarLizhi Xu <lizhi.xu@windriver.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2558d753
    • Tetsuo Handa's avatar
      kernel: Initialize cpumask before parsing · 1bf53a21
      Tetsuo Handa authored
      
      [ Upstream commit c5e3a411 ]
      
      KMSAN complains that new_value at cpumask_parse_user() from
      write_irq_affinity() from irq_affinity_proc_write() is uninitialized.
      
        [  148.133411][ T5509] =====================================================
        [  148.135383][ T5509] BUG: KMSAN: uninit-value in find_next_bit+0x325/0x340
        [  148.137819][ T5509]
        [  148.138448][ T5509] Local variable ----new_value.i@irq_affinity_proc_write created at:
        [  148.140768][ T5509]  irq_affinity_proc_write+0xc3/0x3d0
        [  148.142298][ T5509]  irq_affinity_proc_write+0xc3/0x3d0
        [  148.143823][ T5509] =====================================================
      
      Since bitmap_parse() from cpumask_parse_user() calls find_next_bit(),
      any alloc_cpumask_var() + cpumask_parse_user() sequence has possibility
      that find_next_bit() accesses uninitialized cpu mask variable. Fix this
      problem by replacing alloc_cpumask_var() with zalloc_cpumask_var().
      
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Link: https://lore.kernel.org/r/20210401055823.3929-1-penguin-kernel@I-love.SAKURA.ne.jp
      
      
      Stable-dep-of: 98feccbf ("tracing: Prevent bad count for tracing_cpumask_write")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1bf53a21
    • Filipe Manana's avatar
      btrfs: fix use-after-free when COWing tree bock and tracing is enabled · ba5120a2
      Filipe Manana authored
      
      [ Upstream commit 44f52bbe ]
      
      When a COWing a tree block, at btrfs_cow_block(), and we have the
      tracepoint trace_btrfs_cow_block() enabled and preemption is also enabled
      (CONFIG_PREEMPT=y), we can trigger a use-after-free in the COWed extent
      buffer while inside the tracepoint code. This is because in some paths
      that call btrfs_cow_block(), such as btrfs_search_slot(), we are holding
      the last reference on the extent buffer @buf so btrfs_force_cow_block()
      drops the last reference on the @buf extent buffer when it calls
      free_extent_buffer_stale(buf), which schedules the release of the extent
      buffer with RCU. This means that if we are on a kernel with preemption,
      the current task may be preempted before calling trace_btrfs_cow_block()
      and the extent buffer already released by the time trace_btrfs_cow_block()
      is called, resulting in a use-after-free.
      
      Fix this by moving the trace_btrfs_cow_block() from btrfs_cow_block() to
      btrfs_force_cow_block() before the COWed extent buffer is freed.
      This also has a side effect of invoking the tracepoint in the tree defrag
      code, at defrag.c:btrfs_realloc_node(), since btrfs_force_cow_block() is
      called there, but this is fine and it was actually missing there.
      
      Reported-by: default avatar <syzbot+8517da8635307182c8a5@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/linux-btrfs/6759a9b9.050a0220.1ac542.000d.GAE@google.com/
      
      
      CC: stable@vger.kernel.org # 5.4+
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba5120a2
    • Filipe Manana's avatar
      btrfs: rename and export __btrfs_cow_block() · bf267f2f
      Filipe Manana authored
      
      [ Upstream commit 95f93bc4 ]
      
      Rename and export __btrfs_cow_block() as btrfs_force_cow_block(). This is
      to allow to move defrag specific code out of ctree.c and into defrag.c in
      one of the next patches.
      
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Stable-dep-of: 44f52bbe ("btrfs: fix use-after-free when COWing tree bock and tracing is enabled")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bf267f2f
    • Josef Bacik's avatar
      btrfs: locking: remove all the blocking helpers · 1817e3e8
      Josef Bacik authored
      
      [ Upstream commit ac5887c8 ]
      
      Now that we're using a rw_semaphore we no longer need to indicate if a
      lock is blocking or not, nor do we need to flip the entire path from
      blocking to spinning.  Remove these helpers and all the places they are
      called.
      
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Stable-dep-of: 44f52bbe ("btrfs: fix use-after-free when COWing tree bock and tracing is enabled")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1817e3e8
    • Josef Bacik's avatar
      btrfs: switch extent buffer tree lock to rw_semaphore · 4da6be8e
      Josef Bacik authored
      
      [ Upstream commit 196d59ab ]
      
      Historically we've implemented our own locking because we wanted to be
      able to selectively spin or sleep based on what we were doing in the
      tree.  For instance, if all of our nodes were in cache then there's
      rarely a reason to need to sleep waiting for node locks, as they'll
      likely become available soon.  At the time this code was written the
      rw_semaphore didn't do adaptive spinning, and thus was orders of
      magnitude slower than our home grown locking.
      
      However now the opposite is the case.  There are a few problems with how
      we implement blocking locks, namely that we use a normal waitqueue and
      simply wake everybody up in reverse sleep order.  This leads to some
      suboptimal performance behavior, and a lot of context switches in highly
      contended cases.  The rw_semaphores actually do this properly, and also
      have adaptive spinning that works relatively well.
      
      The locking code is also a bit of a bear to understand, and we lose the
      benefit of lockdep for the most part because the blocking states of the
      lock are simply ad-hoc and not mapped into lockdep.
      
      So rework the locking code to drop all of this custom locking stuff, and
      simply use a rw_semaphore for everything.  This makes the locking much
      simpler for everything, as we can now drop a lot of cruft and blocking
      transitions.  The performance numbers vary depending on the workload,
      because generally speaking there doesn't tend to be a lot of contention
      on the btree.  However, on my test system which is an 80 core single
      socket system with 256GiB of RAM and a 2TiB NVMe drive I get the
      following results (with all debug options off):
      
        dbench 200 baseline
        Throughput 216.056 MB/sec  200 clients  200 procs  max_latency=1471.197 ms
      
        dbench 200 with patch
        Throughput 737.188 MB/sec  200 clients  200 procs  max_latency=714.346 ms
      
      Previously we also used fs_mark to test this sort of contention, and
      those results are far less impressive, mostly because there's not enough
      tasks to really stress the locking
      
        fs_mark -d /d[0-15] -S 0 -L 20 -n 100000 -s 0 -t 16
      
        baseline
          Average Files/sec:     160166.7
          p50 Files/sec:         165832
          p90 Files/sec:         123886
          p99 Files/sec:         123495
      
          real    3m26.527s
          user    2m19.223s
          sys     48m21.856s
      
        patched
          Average Files/sec:     164135.7
          p50 Files/sec:         171095
          p90 Files/sec:         122889
          p99 Files/sec:         113819
      
          real    3m29.660s
          user    2m19.990s
          sys     44m12.259s
      
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Stable-dep-of: 44f52bbe ("btrfs: fix use-after-free when COWing tree bock and tracing is enabled")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4da6be8e
    • Andy Shevchenko's avatar
      dmaengine: dw: Select only supported masters for ACPI devices · 42d7147c
      Andy Shevchenko authored
      
      [ Upstream commit f0e870a0 ]
      
      The recently submitted fix-commit revealed a problem in the iDMA 32-bit
      platform code. Even though the controller supported only a single master
      the dw_dma_acpi_filter() method hard-coded two master interfaces with IDs
      0 and 1. As a result the sanity check implemented in the commit
      b336268d ("dmaengine: dw: Add peripheral bus width verification")
      got incorrect interface data width and thus prevented the client drivers
      from configuring the DMA-channel with the EINVAL error returned. E.g.,
      the next error was printed for the PXA2xx SPI controller driver trying
      to configure the requested channels:
      
      > [  164.525604] pxa2xx_spi_pci 0000:00:07.1: DMA slave config failed
      > [  164.536105] pxa2xx_spi_pci 0000:00:07.1: failed to get DMA TX descriptor
      > [  164.543213] spidev spi-SPT0001:00: SPI transfer failed: -16
      
      The problem would have been spotted much earlier if the iDMA 32-bit
      controller supported more than one master interfaces. But since it
      supports just a single master and the iDMA 32-bit specific code just
      ignores the master IDs in the CTLLO preparation method, the issue has
      been gone unnoticed so far.
      
      Fix the problem by specifying the default master ID for both memory
      and peripheral devices in the driver data. Thus the issue noticed for
      the iDMA 32-bit controllers will be eliminated and the ACPI-probed
      DW DMA controllers will be configured with the correct master ID by
      default.
      
      Cc: stable@vger.kernel.org
      Fixes: b336268d ("dmaengine: dw: Add peripheral bus width verification")
      Fixes: 199244d6 ("dmaengine: dw: add support of iDMA 32-bit hardware")
      Reported-by: default avatarFerry Toth <fntoth@gmail.com>
      Closes: https://lore.kernel.org/dmaengine/ZuXbCKUs1iOqFu51@black.fi.intel.com/
      
      
      Reported-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Closes: https://lore.kernel.org/dmaengine/ZuXgI-VcHpMgbZ91@black.fi.intel.com/
      
      
      Tested-by: default avatarFerry Toth <fntoth@gmail.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20241104095142.157925-1-andriy.shevchenko@linux.intel.com
      
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      42d7147c
    • Eric Dumazet's avatar
      ila: serialize calls to nf_register_net_hooks() · d3017895
      Eric Dumazet authored
      
      [ Upstream commit 260466b5 ]
      
      syzbot found a race in ila_add_mapping() [1]
      
      commit 031ae728 ("ila: call nf_unregister_net_hooks() sooner")
      attempted to fix a similar issue.
      
      Looking at the syzbot repro, we have concurrent ILA_CMD_ADD commands.
      
      Add a mutex to make sure at most one thread is calling nf_register_net_hooks().
      
      [1]
       BUG: KASAN: slab-use-after-free in rht_key_hashfn include/linux/rhashtable.h:159 [inline]
       BUG: KASAN: slab-use-after-free in __rhashtable_lookup.constprop.0+0x426/0x550 include/linux/rhashtable.h:604
      Read of size 4 at addr ffff888028f40008 by task dhcpcd/5501
      
      CPU: 1 UID: 0 PID: 5501 Comm: dhcpcd Not tainted 6.13.0-rc4-syzkaller-00054-gd6ef8b40d075 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
      Call Trace:
       <IRQ>
        __dump_stack lib/dump_stack.c:94 [inline]
        dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
        print_address_description mm/kasan/report.c:378 [inline]
        print_report+0xc3/0x620 mm/kasan/report.c:489
        kasan_report+0xd9/0x110 mm/kasan/report.c:602
        rht_key_hashfn include/linux/rhashtable.h:159 [inline]
        __rhashtable_lookup.constprop.0+0x426/0x550 include/linux/rhashtable.h:604
        rhashtable_lookup include/linux/rhashtable.h:646 [inline]
        rhashtable_lookup_fast include/linux/rhashtable.h:672 [inline]
        ila_lookup_wildcards net/ipv6/ila/ila_xlat.c:127 [inline]
        ila_xlat_addr net/ipv6/ila/ila_xlat.c:652 [inline]
        ila_nf_input+0x1ee/0x620 net/ipv6/ila/ila_xlat.c:185
        nf_hook_entry_hookfn include/linux/netfilter.h:154 [inline]
        nf_hook_slow+0xbb/0x200 net/netfilter/core.c:626
        nf_hook.constprop.0+0x42e/0x750 include/linux/netfilter.h:269
        NF_HOOK include/linux/netfilter.h:312 [inline]
        ipv6_rcv+0xa4/0x680 net/ipv6/ip6_input.c:309
        __netif_receive_skb_one_core+0x12e/0x1e0 net/core/dev.c:5672
        __netif_receive_skb+0x1d/0x160 net/core/dev.c:5785
        process_backlog+0x443/0x15f0 net/core/dev.c:6117
        __napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:6883
        napi_poll net/core/dev.c:6952 [inline]
        net_rx_action+0xa94/0x1010 net/core/dev.c:7074
        handle_softirqs+0x213/0x8f0 kernel/softirq.c:561
        __do_softirq kernel/softirq.c:595 [inline]
        invoke_softirq kernel/softirq.c:435 [inline]
        __irq_exit_rcu+0x109/0x170 kernel/softirq.c:662
        irq_exit_rcu+0x9/0x30 kernel/softirq.c:678
        instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline]
        sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049
      
      Fixes: 7f00feaf ("ila: Add generic ILA translation facility")
      Reported-by: default avatar <syzbot+47e761d22ecf745f72b9@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/netdev/6772c9ae.050a0220.2f3838.04c7.GAE@google.com/T/#u
      
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Florian Westphal <fw@strlen.de>
      Cc: Tom Herbert <tom@herbertland.com>
      Link: https://patch.msgid.link/20241230162849.2795486-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d3017895
    • Eric Dumazet's avatar
      af_packet: fix vlan_get_protocol_dgram() vs MSG_PEEK · 0d3fa6c3
      Eric Dumazet authored
      
      [ Upstream commit f91a5b80 ]
      
      Blamed commit forgot MSG_PEEK case, allowing a crash [1] as found
      by syzbot.
      
      Rework vlan_get_protocol_dgram() to not touch skb at all,
      so that it can be used from many cpus on the same skb.
      
      Add a const qualifier to skb argument.
      
      [1]
      skbuff: skb_under_panic: text:ffffffff8a8ccd05 len:29 put:14 head:ffff88807fc8e400 data:ffff88807fc8e3f4 tail:0x11 end:0x140 dev:<NULL>
      ------------[ cut here ]------------
       kernel BUG at net/core/skbuff.c:206 !
      Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
      CPU: 1 UID: 0 PID: 5892 Comm: syz-executor883 Not tainted 6.13.0-rc4-syzkaller-00054-gd6ef8b40d075 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
       RIP: 0010:skb_panic net/core/skbuff.c:206 [inline]
       RIP: 0010:skb_under_panic+0x14b/0x150 net/core/skbuff.c:216
      Code: 0b 8d 48 c7 c6 86 d5 25 8e 48 8b 54 24 08 8b 0c 24 44 8b 44 24 04 4d 89 e9 50 41 54 41 57 41 56 e8 5a 69 79 f7 48 83 c4 20 90 <0f> 0b 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3
      RSP: 0018:ffffc900038d7638 EFLAGS: 00010282
      RAX: 0000000000000087 RBX: dffffc0000000000 RCX: 609ffd18ea660600
      RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
      RBP: ffff88802483c8d0 R08: ffffffff817f0a8c R09: 1ffff9200071ae60
      R10: dffffc0000000000 R11: fffff5200071ae61 R12: 0000000000000140
      R13: ffff88807fc8e400 R14: ffff88807fc8e3f4 R15: 0000000000000011
      FS:  00007fbac5e006c0(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fbac5e00d58 CR3: 000000001238e000 CR4: 00000000003526f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
        skb_push+0xe5/0x100 net/core/skbuff.c:2636
        vlan_get_protocol_dgram+0x165/0x290 net/packet/af_packet.c:585
        packet_recvmsg+0x948/0x1ef0 net/packet/af_packet.c:3552
        sock_recvmsg_nosec net/socket.c:1033 [inline]
        sock_recvmsg+0x22f/0x280 net/socket.c:1055
        ____sys_recvmsg+0x1c6/0x480 net/socket.c:2803
        ___sys_recvmsg net/socket.c:2845 [inline]
        do_recvmmsg+0x426/0xab0 net/socket.c:2940
        __sys_recvmmsg net/socket.c:3014 [inline]
        __do_sys_recvmmsg net/socket.c:3037 [inline]
        __se_sys_recvmmsg net/socket.c:3030 [inline]
        __x64_sys_recvmmsg+0x199/0x250 net/socket.c:3030
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
      Fixes: 79eecf63 ("af_packet: Handle outgoing VLAN packets without hardware offloading")
      Reported-by: default avatar <syzbot+74f70bb1cb968bf09e4f@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/netdev/6772c485.050a0220.2f3838.04c5.GAE@google.com/T/#u
      
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Chengen Du <chengen.du@canonical.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://patch.msgid.link/20241230161004.2681892-2-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0d3fa6c3
    • Eric Dumazet's avatar
      af_packet: fix vlan_get_tci() vs MSG_PEEK · fa57f07b
      Eric Dumazet authored
      
      [ Upstream commit 77ee7a6d ]
      
      Blamed commit forgot MSG_PEEK case, allowing a crash [1] as found
      by syzbot.
      
      Rework vlan_get_tci() to not touch skb at all,
      so that it can be used from many cpus on the same skb.
      
      Add a const qualifier to skb argument.
      
      [1]
      skbuff: skb_under_panic: text:ffffffff8a8da482 len:32 put:14 head:ffff88807a1d5800 data:ffff88807a1d5810 tail:0x14 end:0x140 dev:<NULL>
      ------------[ cut here ]------------
       kernel BUG at net/core/skbuff.c:206 !
      Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
      CPU: 0 UID: 0 PID: 5880 Comm: syz-executor172 Not tainted 6.13.0-rc3-syzkaller-00762-g9268abe611b0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
       RIP: 0010:skb_panic net/core/skbuff.c:206 [inline]
       RIP: 0010:skb_under_panic+0x14b/0x150 net/core/skbuff.c:216
      Code: 0b 8d 48 c7 c6 9e 6c 26 8e 48 8b 54 24 08 8b 0c 24 44 8b 44 24 04 4d 89 e9 50 41 54 41 57 41 56 e8 3a 5a 79 f7 48 83 c4 20 90 <0f> 0b 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3
      RSP: 0018:ffffc90003baf5b8 EFLAGS: 00010286
      RAX: 0000000000000087 RBX: dffffc0000000000 RCX: 8565c1eec37aa000
      RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
      RBP: ffff88802616fb50 R08: ffffffff817f0a4c R09: 1ffff92000775e50
      R10: dffffc0000000000 R11: fffff52000775e51 R12: 0000000000000140
      R13: ffff88807a1d5800 R14: ffff88807a1d5810 R15: 0000000000000014
      FS:  00007fa03261f6c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007ffd65753000 CR3: 0000000031720000 CR4: 00000000003526f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
        skb_push+0xe5/0x100 net/core/skbuff.c:2636
        vlan_get_tci+0x272/0x550 net/packet/af_packet.c:565
        packet_recvmsg+0x13c9/0x1ef0 net/packet/af_packet.c:3616
        sock_recvmsg_nosec net/socket.c:1044 [inline]
        sock_recvmsg+0x22f/0x280 net/socket.c:1066
        ____sys_recvmsg+0x1c6/0x480 net/socket.c:2814
        ___sys_recvmsg net/socket.c:2856 [inline]
        do_recvmmsg+0x426/0xab0 net/socket.c:2951
        __sys_recvmmsg net/socket.c:3025 [inline]
        __do_sys_recvmmsg net/socket.c:3048 [inline]
        __se_sys_recvmmsg net/socket.c:3041 [inline]
        __x64_sys_recvmmsg+0x199/0x250 net/socket.c:3041
        do_syscall_x64 arch/x86/entry/common.c:52 [inline]
        do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
      
      Fixes: 79eecf63 ("af_packet: Handle outgoing VLAN packets without hardware offloading")
      Reported-by: default avatar <syzbot+8400677f3fd43f37d3bc@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/netdev/6772c485.050a0220.2f3838.04c6.GAE@google.com/T/#u
      
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Chengen Du <chengen.du@canonical.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://patch.msgid.link/20241230161004.2681892-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fa57f07b
    • Li Zhijian's avatar
      RDMA/rtrs: Ensure 'ib_sge list' is accessible · 7eaa71f5
      Li Zhijian authored
      [ Upstream commit fb514b31 ]
      
      Move the declaration of the 'ib_sge list' variable outside the
      'always_invalidate' block to ensure it remains accessible for use
      throughout the function.
      
      Previously, 'ib_sge list' was declared within the 'always_invalidate'
      block, limiting its accessibility, then caused a
      'BUG: kernel NULL pointer dereference'[1].
       ? __die_body.cold+0x19/0x27
       ? page_fault_oops+0x15a/0x2d0
       ? search_module_extables+0x19/0x60
       ? search_bpf_extables+0x5f/0x80
       ? exc_page_fault+0x7e/0x180
       ? asm_exc_page_fault+0x26/0x30
       ? memcpy_orig+0xd5/0x140
       rxe_mr_copy+0x1c3/0x200 [rdma_rxe]
       ? rxe_pool_get_index+0x4b/0x80 [rdma_rxe]
       copy_data+0xa5/0x230 [rdma_rxe]
       rxe_requester+0xd9b/0xf70 [rdma_rxe]
       ? finish_task_switch.isra.0+0x99/0x2e0
       rxe_sender+0x13/0x40 [rdma_rxe]
       do_task+0x68/0x1e0 [rdma_rxe]
       process_one_work+0x177/0x330
       worker_thread+0x252/0x390
       ? __pfx_worker_thread+0x10/0x10
      
      This change ensures the variable is available for subsequent operations
      that require it.
      
      [1] https://lore.kernel.org/linux-rdma/6a1f3e8f-deb0-49f9-bc69-a9b03ecfcda7@fujitsu.com/
      
      
      
      Fixes: 9cb83748 ("RDMA/rtrs: server: main functionality")
      Signed-off-by: default avatarLi Zhijian <lizhijian@fujitsu.com>
      Link: https://patch.msgid.link/20241231013416.1290920-1-lizhijian@fujitsu.com
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7eaa71f5
    • Vitalii Mordan's avatar
      eth: bcmsysport: fix call balance of priv->clk handling routines · 925f2be4
      Vitalii Mordan authored
      
      [ Upstream commit b255ef45 ]
      
      Check the return value of clk_prepare_enable to ensure that priv->clk has
      been successfully enabled.
      
      If priv->clk was not enabled during bcm_sysport_probe, bcm_sysport_resume,
      or bcm_sysport_open, it must not be disabled in any subsequent execution
      paths.
      
      Fixes: 31bc72d9 ("net: systemport: fetch and use clock resources")
      Signed-off-by: default avatarVitalii Mordan <mordan@ispras.ru>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Link: https://patch.msgid.link/20241227123007.2333397-1-mordan@ispras.ru
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      925f2be4
    • Tanya Agarwal's avatar
      ALSA: usb-audio: US16x08: Initialize array before use · 9c76fb57
      Tanya Agarwal authored
      [ Upstream commit b06a6187 ]
      
      Initialize meter_urb array before use in mixer_us16x08.c.
      
      CID 1410197: (#1 of 1): Uninitialized scalar variable (UNINIT)
      uninit_use_in_call: Using uninitialized value *meter_urb when
      calling get_meter_levels_from_urb.
      
      Coverity Link:
      https://scan7.scan.coverity.com/#/project-view/52849/11354?selectedIssue=1410197
      
      
      
      Fixes: d2bb390a ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
      Signed-off-by: default avatarTanya Agarwal <tanyaagarwal25699@gmail.com>
      Link: https://patch.msgid.link/20241229060240.1642-1-tanyaagarwal25699@gmail.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9c76fb57
    • Antonio Pastor's avatar
      net: llc: reset skb->transport_header · 0f67a980
      Antonio Pastor authored
      
      [ Upstream commit a024e377 ]
      
      802.2+LLC+SNAP frames received by napi_complete_done with GRO and DSA
      have skb->transport_header set two bytes short, or pointing 2 bytes
      before network_header & skb->data. As snap_rcv expects transport_header
      to point to SNAP header (OID:PID) after LLC processing advances offset
      over LLC header (llc_rcv & llc_fixup_skb), code doesn't find a match
      and packet is dropped.
      
      Between napi_complete_done and snap_rcv, transport_header is not used
      until __netif_receive_skb_core, where originally it was being reset.
      Commit fda55eca ("net: introduce skb_transport_header_was_set()")
      only does so if not set, on the assumption the value was set correctly
      by GRO (and also on assumption that "network stacks usually reset the
      transport header anyway"). Afterwards it is moved forward by
      llc_fixup_skb.
      
      Locally generated traffic shows up at __netif_receive_skb_core with no
      transport_header set and is processed without issue. On a setup with
      GRO but no DSA, transport_header and network_header are both set to
      point to skb->data which is also correct.
      
      As issue is LLC specific, to avoid impacting non-LLC traffic, and to
      follow up on original assumption made on previous code change,
      llc_fixup_skb to reset the offset after skb pull. llc_fixup_skb
      assumes the LLC header is at skb->data, and by definition SNAP header
      immediately follows.
      
      Fixes: fda55eca ("net: introduce skb_transport_header_was_set()")
      Signed-off-by: default avatarAntonio Pastor <antonio.pastor@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20241225010723.2830290-1-antonio.pastor@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0f67a980
    • Pablo Neira Ayuso's avatar
      netfilter: nft_set_hash: unaligned atomic read on struct nft_set_ext · 6a14b460
      Pablo Neira Ayuso authored
      
      [ Upstream commit 542ed814 ]
      
      Access to genmask field in struct nft_set_ext results in unaligned
      atomic read:
      
      [   72.130109] Unable to handle kernel paging request at virtual address ffff0000c2bb708c
      [   72.131036] Mem abort info:
      [   72.131213]   ESR = 0x0000000096000021
      [   72.131446]   EC = 0x25: DABT (current EL), IL = 32 bits
      [   72.132209]   SET = 0, FnV = 0
      [   72.133216]   EA = 0, S1PTW = 0
      [   72.134080]   FSC = 0x21: alignment fault
      [   72.135593] Data abort info:
      [   72.137194]   ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000
      [   72.142351]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
      [   72.145989]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
      [   72.150115] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000237d27000
      [   72.154893] [ffff0000c2bb708c] pgd=0000000000000000, p4d=180000023ffff403, pud=180000023f84b403, pmd=180000023f835403,
      +pte=0068000102bb7707
      [   72.163021] Internal error: Oops: 0000000096000021 [#1] SMP
      [...]
      [   72.170041] CPU: 7 UID: 0 PID: 54 Comm: kworker/7:0 Tainted: G            E      6.13.0-rc3+ #2
      [   72.170509] Tainted: [E]=UNSIGNED_MODULE
      [   72.170720] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-stable202302-for-qemu 03/01/2023
      [   72.171192] Workqueue: events_power_efficient nft_rhash_gc [nf_tables]
      [   72.171552] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
      [   72.171915] pc : nft_rhash_gc+0x200/0x2d8 [nf_tables]
      [   72.172166] lr : nft_rhash_gc+0x128/0x2d8 [nf_tables]
      [   72.172546] sp : ffff800081f2bce0
      [   72.172724] x29: ffff800081f2bd40 x28: ffff0000c2bb708c x27: 0000000000000038
      [   72.173078] x26: ffff0000c6780ef0 x25: ffff0000c643df00 x24: ffff0000c6778f78
      [   72.173431] x23: 000000000000001a x22: ffff0000c4b1f000 x21: ffff0000c6780f78
      [   72.173782] x20: ffff0000c2bb70dc x19: ffff0000c2bb7080 x18: 0000000000000000
      [   72.174135] x17: ffff0000c0a4e1c0 x16: 0000000000003000 x15: 0000ac26d173b978
      [   72.174485] x14: ffffffffffffffff x13: 0000000000000030 x12: ffff0000c6780ef0
      [   72.174841] x11: 0000000000000000 x10: ffff800081f2bcf8 x9 : ffff0000c3000000
      [   72.175193] x8 : 00000000000004be x7 : 0000000000000000 x6 : 0000000000000000
      [   72.175544] x5 : 0000000000000040 x4 : ffff0000c3000010 x3 : 0000000000000000
      [   72.175871] x2 : 0000000000003a98 x1 : ffff0000c2bb708c x0 : 0000000000000004
      [   72.176207] Call trace:
      [   72.176316]  nft_rhash_gc+0x200/0x2d8 [nf_tables] (P)
      [   72.176653]  process_one_work+0x178/0x3d0
      [   72.176831]  worker_thread+0x200/0x3f0
      [   72.176995]  kthread+0xe8/0xf8
      [   72.177130]  ret_from_fork+0x10/0x20
      [   72.177289] Code: 54fff984 d503201f d2800080 91003261 (f820303f)
      [   72.177557] ---[ end trace 0000000000000000 ]---
      
      Align struct nft_set_ext to word size to address this and
      documentation it.
      
      pahole reports that this increases the size of elements for rhash and
      pipapo in 8 bytes on x86_64.
      
      Fixes: 7ffc7481 ("netfilter: nft_set_hash: skip duplicated elements pending gc run")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6a14b460
    • Ilya Shchipletsov's avatar
      netrom: check buffer length before accessing it · cf6befa7
      Ilya Shchipletsov authored
      
      [ Upstream commit a4fd163a ]
      
      Syzkaller reports an uninit value read from ax25cmp when sending raw message
      through ieee802154 implementation.
      
      =====================================================
      BUG: KMSAN: uninit-value in ax25cmp+0x3a5/0x460 net/ax25/ax25_addr.c:119
       ax25cmp+0x3a5/0x460 net/ax25/ax25_addr.c:119
       nr_dev_get+0x20e/0x450 net/netrom/nr_route.c:601
       nr_route_frame+0x1a2/0xfc0 net/netrom/nr_route.c:774
       nr_xmit+0x5a/0x1c0 net/netrom/nr_dev.c:144
       __netdev_start_xmit include/linux/netdevice.h:4940 [inline]
       netdev_start_xmit include/linux/netdevice.h:4954 [inline]
       xmit_one net/core/dev.c:3548 [inline]
       dev_hard_start_xmit+0x247/0xa10 net/core/dev.c:3564
       __dev_queue_xmit+0x33b8/0x5130 net/core/dev.c:4349
       dev_queue_xmit include/linux/netdevice.h:3134 [inline]
       raw_sendmsg+0x654/0xc10 net/ieee802154/socket.c:299
       ieee802154_sock_sendmsg+0x91/0xc0 net/ieee802154/socket.c:96
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg net/socket.c:745 [inline]
       ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2584
       ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2638
       __sys_sendmsg net/socket.c:2667 [inline]
       __do_sys_sendmsg net/socket.c:2676 [inline]
       __se_sys_sendmsg net/socket.c:2674 [inline]
       __x64_sys_sendmsg+0x307/0x490 net/socket.c:2674
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b
      
      Uninit was created at:
       slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768
       slab_alloc_node mm/slub.c:3478 [inline]
       kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523
       kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560
       __alloc_skb+0x318/0x740 net/core/skbuff.c:651
       alloc_skb include/linux/skbuff.h:1286 [inline]
       alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6334
       sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2780
       sock_alloc_send_skb include/net/sock.h:1884 [inline]
       raw_sendmsg+0x36d/0xc10 net/ieee802154/socket.c:282
       ieee802154_sock_sendmsg+0x91/0xc0 net/ieee802154/socket.c:96
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg net/socket.c:745 [inline]
       ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2584
       ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2638
       __sys_sendmsg net/socket.c:2667 [inline]
       __do_sys_sendmsg net/socket.c:2676 [inline]
       __se_sys_sendmsg net/socket.c:2674 [inline]
       __x64_sys_sendmsg+0x307/0x490 net/socket.c:2674
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b
      
      CPU: 0 PID: 5037 Comm: syz-executor166 Not tainted 6.7.0-rc7-syzkaller-00003-gfbafc3e621c3 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
      =====================================================
      
      This issue occurs because the skb buffer is too small, and it's actual
      allocation is aligned. This hides an actual issue, which is that nr_route_frame
      does not validate the buffer size before using it.
      
      Fix this issue by checking skb->len before accessing any fields in skb->data.
      
      Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Co-developed-by: default avatarNikita Marushkin <hfggklm@gmail.com>
      Signed-off-by: default avatarNikita Marushkin <hfggklm@gmail.com>
      Signed-off-by: default avatarIlya Shchipletsov <rabbelkin@mail.ru>
      Link: https://patch.msgid.link/20241219082308.3942-1-rabbelkin@mail.ru
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cf6befa7
    • Stefan Ekenberg's avatar
      drm/bridge: adv7511_audio: Update Audio InfoFrame properly · 60e64b62
      Stefan Ekenberg authored
      
      [ Upstream commit 902806ba ]
      
      AUDIO_UPDATE bit (Bit 5 of MAIN register 0x4A) needs to be set to 1
      while updating Audio InfoFrame information and then set to 0 when done.
      Otherwise partially updated Audio InfoFrames could be sent out. Two
      cases where this rule were not followed are fixed:
       - In adv7511_hdmi_hw_params() make sure AUDIO_UPDATE bit is updated
         before/after setting ADV7511_REG_AUDIO_INFOFRAME.
       - In audio_startup() use the correct register for clearing
         AUDIO_UPDATE bit.
      
      The problem with corrupted audio infoframes were discovered by letting
      a HDMI logic analyser check the output of ADV7535.
      
      Note that this patchs replaces writing REG_GC(1) with
      REG_INFOFRAME_UPDATE. Bit 5 of REG_GC(1) is positioned within field
      GC_PP[3:0] and that field doesn't control audio infoframe and is read-
      only. My conclusion therefore was that the author if this code meant to
      clear bit 5 of REG_INFOFRAME_UPDATE from the very beginning.
      
      Tested-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
      Fixes: 53c515be ("drm/bridge: adv7511: Add Audio support")
      Signed-off-by: default avatarStefan Ekenberg <stefan.ekenberg@axis.com>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20241119-adv7511-audio-info-frame-v4-1-4ae68e76c89c@axis.com
      
      
      Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      60e64b62
    • Selvin Xavier's avatar
      RDMA/bnxt_re: Fix the locking while accessing the QP table · bbcbb83a
      Selvin Xavier authored
      
      [ Upstream commit 9272cba0 ]
      
      QP table handling is synchronized with destroy QP and Async
      event from the HW. The same needs to be synchronized
      during create_qp also. Use the same lock in create_qp also.
      
      Fixes: 76d3ddff ("RDMA/bnxt_re: synchronize the qp-handle table array")
      Fixes: f218d67e ("RDMA/bnxt_re: Allow posting when QPs are in error")
      Fixes: 84cf229f ("RDMA/bnxt_re: Fix the qp table indexing")
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Link: https://patch.msgid.link/20241217102649.1377704-6-kalesh-anakkur.purayil@broadcom.com
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bbcbb83a
    • Selvin Xavier's avatar
      RDMA/bnxt_re: Fix max_qp_wrs reported · 070d214c
      Selvin Xavier authored
      [ Upstream commit c63e1c4d ]
      
      While creating qps, the driver adds one extra entry to the sq size passed
      by the ULPs in order to avoid queue full condition.  When ULPs creates QPs
      with max_qp_wr reported, driver creates QP with 1 more than the max_wqes
      supported by HW. Create QP fails in this case. To avoid this error, reduce
      1 entry in max_qp_wqes and report it to the stack.
      
      Link: https://lore.kernel.org/r/1606741986-16477-1-git-send-email-selvin.xavier@broadcom.com
      
      
      Signed-off-by: default avatarDevesh Sharma <devesh.sharma@broadcom.com>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      070d214c
    • Kalesh AP's avatar
      RDMA/bnxt_re: Fix reporting hw_ver in query_device · cff07807
      Kalesh AP authored
      
      [ Upstream commit 7179fe00 ]
      
      Driver currently populates subsystem_device id in the
      "hw_ver" field of ib_attr structure in query_device.
      
      Updated to populate PCI revision ID.
      
      Fixes: 1ac5a404 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
      Reviewed-by: default avatarPreethi G <preethi.gurusiddalingeswaraswamy@broadcom.com>
      Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Link: https://patch.msgid.link/20241211083931.968831-6-kalesh-anakkur.purayil@broadcom.com
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cff07807
Loading