Skip to content
Snippets Groups Projects
  1. Mar 06, 2024
    • David Sterba's avatar
      btrfs: dev-replace: properly validate device names · 2886fe30
      David Sterba authored
      commit 9845664b upstream.
      
      There's a syzbot report that device name buffers passed to device
      replace are not properly checked for string termination which could lead
      to a read out of bounds in getname_kernel().
      
      Add a helper that validates both source and target device name buffers.
      For devid as the source initialize the buffer to empty string in case
      something tries to read it later.
      
      This was originally analyzed and fixed in a different way by Edward Adam
      Davis (see links).
      
      Link: https://lore.kernel.org/linux-btrfs/000000000000d1a1d1060cc9c5e7@google.com/
      Link: https://lore.kernel.org/linux-btrfs/tencent_44CA0665C9836EF9EEC80CB9E7E206DF5206@qq.com/
      
      
      CC: stable@vger.kernel.org # 4.19+
      CC: Edward Adam Davis <eadavis@qq.com>
      Reported-and-tested-by: default avatar <syzbot+33f23b49ac24f986c9e8@syzkaller.appspotmail.com>
      Reviewed-by: default avatarBoris Burkov <boris@bur.io>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2886fe30
    • Johannes Berg's avatar
      wifi: nl80211: reject iftype change with mesh ID change · 99eb2159
      Johannes Berg authored
      
      commit f78c1375 upstream.
      
      It's currently possible to change the mesh ID when the
      interface isn't yet in mesh mode, at the same time as
      changing it into mesh mode. This leads to an overwrite
      of data in the wdev->u union for the interface type it
      currently has, causing cfg80211_change_iface() to do
      wrong things when switching.
      
      We could probably allow setting an interface to mesh
      while setting the mesh ID at the same time by doing a
      different order of operations here, but realistically
      there's no userspace that's going to do this, so just
      disallow changes in iftype when setting mesh ID.
      
      Cc: stable@vger.kernel.org
      Fixes: 29cbe68c ("cfg80211/mac80211: add mesh join/leave commands")
      Reported-by: default avatar <syzbot+dd4779978217b1973180@syzkaller.appspotmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99eb2159
    • Alexander Ofitserov's avatar
      gtp: fix use-after-free and null-ptr-deref in gtp_newlink() · e668b92a
      Alexander Ofitserov authored
      
      commit 616d82c3 upstream.
      
      The gtp_link_ops operations structure for the subsystem must be
      registered after registering the gtp_net_ops pernet operations structure.
      
      Syzkaller hit 'general protection fault in gtp_genl_dump_pdp' bug:
      
      [ 1010.702740] gtp: GTP module unloaded
      [ 1010.715877] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
      [ 1010.715888] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
      [ 1010.715895] CPU: 1 PID: 128616 Comm: a.out Not tainted 6.8.0-rc6-std-def-alt1 #1
      [ 1010.715899] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-alt1 04/01/2014
      [ 1010.715908] RIP: 0010:gtp_newlink+0x4d7/0x9c0 [gtp]
      [ 1010.715915] Code: 80 3c 02 00 0f 85 41 04 00 00 48 8b bb d8 05 00 00 e8 ed f6 ff ff 48 89 c2 48 89 c5 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 4f 04 00 00 4c 89 e2 4c 8b 6d 00 48 b8 00 00 00
      [ 1010.715920] RSP: 0018:ffff888020fbf180 EFLAGS: 00010203
      [ 1010.715929] RAX: dffffc0000000000 RBX: ffff88800399c000 RCX: 0000000000000000
      [ 1010.715933] RDX: 0000000000000001 RSI: ffffffff84805280 RDI: 0000000000000282
      [ 1010.715938] RBP: 000000000000000d R08: 0000000000000001 R09: 0000000000000000
      [ 1010.715942] R10: 0000000000000001 R11: 0000000000000001 R12: ffff88800399cc80
      [ 1010.715947] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000400
      [ 1010.715953] FS:  00007fd1509ab5c0(0000) GS:ffff88805b300000(0000) knlGS:0000000000000000
      [ 1010.715958] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 1010.715962] CR2: 0000000000000000 CR3: 000000001c07a000 CR4: 0000000000750ee0
      [ 1010.715968] PKRU: 55555554
      [ 1010.715972] Call Trace:
      [ 1010.715985]  ? __die_body.cold+0x1a/0x1f
      [ 1010.715995]  ? die_addr+0x43/0x70
      [ 1010.716002]  ? exc_general_protection+0x199/0x2f0
      [ 1010.716016]  ? asm_exc_general_protection+0x1e/0x30
      [ 1010.716026]  ? gtp_newlink+0x4d7/0x9c0 [gtp]
      [ 1010.716034]  ? gtp_net_exit+0x150/0x150 [gtp]
      [ 1010.716042]  __rtnl_newlink+0x1063/0x1700
      [ 1010.716051]  ? rtnl_setlink+0x3c0/0x3c0
      [ 1010.716063]  ? is_bpf_text_address+0xc0/0x1f0
      [ 1010.716070]  ? kernel_text_address.part.0+0xbb/0xd0
      [ 1010.716076]  ? __kernel_text_address+0x56/0xa0
      [ 1010.716084]  ? unwind_get_return_address+0x5a/0xa0
      [ 1010.716091]  ? create_prof_cpu_mask+0x30/0x30
      [ 1010.716098]  ? arch_stack_walk+0x9e/0xf0
      [ 1010.716106]  ? stack_trace_save+0x91/0xd0
      [ 1010.716113]  ? stack_trace_consume_entry+0x170/0x170
      [ 1010.716121]  ? __lock_acquire+0x15c5/0x5380
      [ 1010.716139]  ? mark_held_locks+0x9e/0xe0
      [ 1010.716148]  ? kmem_cache_alloc_trace+0x35f/0x3c0
      [ 1010.716155]  ? __rtnl_newlink+0x1700/0x1700
      [ 1010.716160]  rtnl_newlink+0x69/0xa0
      [ 1010.716166]  rtnetlink_rcv_msg+0x43b/0xc50
      [ 1010.716172]  ? rtnl_fdb_dump+0x9f0/0x9f0
      [ 1010.716179]  ? lock_acquire+0x1fe/0x560
      [ 1010.716188]  ? netlink_deliver_tap+0x12f/0xd50
      [ 1010.716196]  netlink_rcv_skb+0x14d/0x440
      [ 1010.716202]  ? rtnl_fdb_dump+0x9f0/0x9f0
      [ 1010.716208]  ? netlink_ack+0xab0/0xab0
      [ 1010.716213]  ? netlink_deliver_tap+0x202/0xd50
      [ 1010.716220]  ? netlink_deliver_tap+0x218/0xd50
      [ 1010.716226]  ? __virt_addr_valid+0x30b/0x590
      [ 1010.716233]  netlink_unicast+0x54b/0x800
      [ 1010.716240]  ? netlink_attachskb+0x870/0x870
      [ 1010.716248]  ? __check_object_size+0x2de/0x3b0
      [ 1010.716254]  netlink_sendmsg+0x938/0xe40
      [ 1010.716261]  ? netlink_unicast+0x800/0x800
      [ 1010.716269]  ? __import_iovec+0x292/0x510
      [ 1010.716276]  ? netlink_unicast+0x800/0x800
      [ 1010.716284]  __sock_sendmsg+0x159/0x190
      [ 1010.716290]  ____sys_sendmsg+0x712/0x880
      [ 1010.716297]  ? sock_write_iter+0x3d0/0x3d0
      [ 1010.716304]  ? __ia32_sys_recvmmsg+0x270/0x270
      [ 1010.716309]  ? lock_acquire+0x1fe/0x560
      [ 1010.716315]  ? drain_array_locked+0x90/0x90
      [ 1010.716324]  ___sys_sendmsg+0xf8/0x170
      [ 1010.716331]  ? sendmsg_copy_msghdr+0x170/0x170
      [ 1010.716337]  ? lockdep_init_map_type+0x2c7/0x860
      [ 1010.716343]  ? lockdep_hardirqs_on_prepare+0x430/0x430
      [ 1010.716350]  ? debug_mutex_init+0x33/0x70
      [ 1010.716360]  ? percpu_counter_add_batch+0x8b/0x140
      [ 1010.716367]  ? lock_acquire+0x1fe/0x560
      [ 1010.716373]  ? find_held_lock+0x2c/0x110
      [ 1010.716384]  ? __fd_install+0x1b6/0x6f0
      [ 1010.716389]  ? lock_downgrade+0x810/0x810
      [ 1010.716396]  ? __fget_light+0x222/0x290
      [ 1010.716403]  __sys_sendmsg+0xea/0x1b0
      [ 1010.716409]  ? __sys_sendmsg_sock+0x40/0x40
      [ 1010.716419]  ? lockdep_hardirqs_on_prepare+0x2b3/0x430
      [ 1010.716425]  ? syscall_enter_from_user_mode+0x1d/0x60
      [ 1010.716432]  do_syscall_64+0x30/0x40
      [ 1010.716438]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
      [ 1010.716444] RIP: 0033:0x7fd1508cbd49
      [ 1010.716452] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d ef 70 0d 00 f7 d8 64 89 01 48
      [ 1010.716456] RSP: 002b:00007fff18872348 EFLAGS: 00000202 ORIG_RAX: 000000000000002e
      [ 1010.716463] RAX: ffffffffffffffda RBX: 000055f72bf0eac0 RCX: 00007fd1508cbd49
      [ 1010.716468] RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000006
      [ 1010.716473] RBP: 00007fff18872360 R08: 00007fff18872360 R09: 00007fff18872360
      [ 1010.716478] R10: 00007fff18872360 R11: 0000000000000202 R12: 000055f72bf0e1b0
      [ 1010.716482] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      [ 1010.716491] Modules linked in: gtp(+) udp_tunnel ib_core uinput af_packet rfkill qrtr joydev hid_generic usbhid hid kvm_intel iTCO_wdt intel_pmc_bxt iTCO_vendor_support kvm snd_hda_codec_generic ledtrig_audio irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel snd_hda_intel nls_utf8 snd_intel_dspcfg nls_cp866 psmouse aesni_intel vfat crypto_simd fat cryptd glue_helper snd_hda_codec pcspkr snd_hda_core i2c_i801 snd_hwdep i2c_smbus xhci_pci snd_pcm lpc_ich xhci_pci_renesas xhci_hcd qemu_fw_cfg tiny_power_button button sch_fq_codel vboxvideo drm_vram_helper drm_ttm_helper ttm vboxsf vboxguest snd_seq_midi snd_seq_midi_event snd_seq snd_rawmidi snd_seq_device snd_timer snd soundcore msr fuse efi_pstore dm_mod ip_tables x_tables autofs4 virtio_gpu virtio_dma_buf drm_kms_helper cec rc_core drm virtio_rng virtio_scsi rng_core virtio_balloon virtio_blk virtio_net virtio_console net_failover failover ahci libahci libata evdev scsi_mod input_leds serio_raw virtio_pci intel_agp
      [ 1010.716674]  virtio_ring intel_gtt virtio [last unloaded: gtp]
      [ 1010.716693] ---[ end trace 04990a4ce61e174b ]---
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlexander Ofitserov <oficerovas@altlinux.org>
      Fixes: 459aa660 ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Link: https://lore.kernel.org/r/20240228114703.465107-1-oficerovas@altlinux.org
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e668b92a
    • Tetsuo Handa's avatar
      tomoyo: fix UAF write bug in tomoyo_write_control() · a23ac178
      Tetsuo Handa authored
      
      commit 2f03fc34 upstream.
      
      Since tomoyo_write_control() updates head->write_buf when write()
      of long lines is requested, we need to fetch head->write_buf after
      head->io_sem is held.  Otherwise, concurrent write() requests can
      cause use-after-free-write and double-free problems.
      
      Reported-by: default avatarSam Sun <samsun1006219@gmail.com>
      Closes: https://lkml.kernel.org/r/CAEkJfYNDspuGxYx5kym8Lvp--D36CMDUErg4rxfWFJuPbbji8g@mail.gmail.com
      
      
      Fixes: bd03a3e4 ("TOMOYO: Add policy namespace support.")
      Cc:  <stable@vger.kernel.org> # Linux 3.1+
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a23ac178
    • Dimitris Vlachos's avatar
      riscv: Sparse-Memory/vmemmap out-of-bounds fix · 8af1c121
      Dimitris Vlachos authored
      
      [ Upstream commit a11dd49d ]
      
      Offset vmemmap so that the first page of vmemmap will be mapped
      to the first page of physical memory in order to ensure that
      vmemmap’s bounds will be respected during
      pfn_to_page()/page_to_pfn() operations.
      The conversion macros will produce correct SV39/48/57 addresses
      for every possible/valid DRAM_BASE inside the physical memory limits.
      
      v2:Address Alex's comments
      
      Suggested-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Signed-off-by: default avatarDimitris Vlachos <dvlachos@ics.forth.gr>
      Reported-by: default avatarDimitris Vlachos <dvlachos@ics.forth.gr>
      Closes: https://lore.kernel.org/linux-riscv/20240202135030.42265-1-csd4492@csd.uoc.gr
      
      
      Fixes: d95f1a54 ("RISC-V: Implement sparsemem")
      Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Link: https://lore.kernel.org/r/20240229191723.32779-1-dvlachos@ics.forth.gr
      
      
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8af1c121
    • David Howells's avatar
      afs: Fix endless loop in directory parsing · 96370ba3
      David Howells authored
      [ Upstream commit 5f7a0764 ]
      
      If a directory has a block with only ".__afsXXXX" files in it (from
      uncompleted silly-rename), these .__afsXXXX files are skipped but without
      advancing the file position in the dir_context.  This leads to
      afs_dir_iterate() repeating the block again and again.
      
      Fix this by making the code that skips the .__afsXXXX file also manually
      advance the file position.
      
      The symptoms are a soft lookup:
      
              watchdog: BUG: soft lockup - CPU#3 stuck for 52s! [check:5737]
              ...
              RIP: 0010:afs_dir_iterate_block+0x39/0x1fd
              ...
               ? watchdog_timer_fn+0x1a6/0x213
              ...
               ? asm_sysvec_apic_timer_interrupt+0x16/0x20
               ? afs_dir_iterate_block+0x39/0x1fd
               afs_dir_iterate+0x10a/0x148
               afs_readdir+0x30/0x4a
               iterate_dir+0x93/0xd3
               __do_sys_getdents64+0x6b/0xd4
      
      This is almost certainly the actual fix for:
      
              https://bugzilla.kernel.org/show_bug.cgi?id=218496
      
      
      
      Fixes: 57e9d49c ("afs: Hide silly-rename files from userspace")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Link: https://lore.kernel.org/r/786185.1708694102@warthog.procyon.org.uk
      
      
      Reviewed-by: default avatarMarc Dionne <marc.dionne@auristor.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: Markus Suvanto <markus.suvanto@gmail.com>
      cc: linux-afs@lists.infradead.org
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      96370ba3
    • Takashi Iwai's avatar
      ALSA: Drop leftover snd-rtctimer stuff from Makefile · 14aacfcd
      Takashi Iwai authored
      [ Upstream commit 4df49712 ]
      
      We forgot to remove the line for snd-rtctimer from Makefile while
      dropping the functionality.  Get rid of the stale line.
      
      Fixes: 34ce71a9 ("ALSA: timer: remove legacy rtctimer")
      Link: https://lore.kernel.org/r/20240221092156.28695-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      14aacfcd
    • Hans de Goede's avatar
      power: supply: bq27xxx-i2c: Do not free non existing IRQ · d7acc4a5
      Hans de Goede authored
      
      [ Upstream commit 2df70149 ]
      
      The bq27xxx i2c-client may not have an IRQ, in which case
      client->irq will be 0. bq27xxx_battery_i2c_probe() already has
      an if (client->irq) check wrapping the request_threaded_irq().
      
      But bq27xxx_battery_i2c_remove() unconditionally calls
      free_irq(client->irq) leading to:
      
      [  190.310742] ------------[ cut here ]------------
      [  190.310843] Trying to free already-free IRQ 0
      [  190.310861] WARNING: CPU: 2 PID: 1304 at kernel/irq/manage.c:1893 free_irq+0x1b8/0x310
      
      Followed by a backtrace when unbinding the driver. Add
      an if (client->irq) to bq27xxx_battery_i2c_remove() mirroring
      probe() to fix this.
      
      Fixes: 444ff007 ("power: supply: bq27xxx: Fix I2C IRQ race on remove")
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20240215155133.70537-1-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d7acc4a5
    • Arnd Bergmann's avatar
      efi/capsule-loader: fix incorrect allocation size · 537e3f49
      Arnd Bergmann authored
      
      [ Upstream commit fccfa646 ]
      
      gcc-14 notices that the allocation with sizeof(void) on 32-bit architectures
      is not enough for a 64-bit phys_addr_t:
      
      drivers/firmware/efi/capsule-loader.c: In function 'efi_capsule_open':
      drivers/firmware/efi/capsule-loader.c:295:24: error: allocation of insufficient size '4' for type 'phys_addr_t' {aka 'long long unsigned int'} with size '8' [-Werror=alloc-size]
        295 |         cap_info->phys = kzalloc(sizeof(void *), GFP_KERNEL);
            |                        ^
      
      Use the correct type instead here.
      
      Fixes: f24c4d47 ("efi/capsule-loader: Reinstate virtual capsule mapping")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      537e3f49
    • Lin Ma's avatar
      rtnetlink: fix error logic of IFLA_BRIDGE_FLAGS writing back · 882a51a1
      Lin Ma authored
      
      [ Upstream commit 743ad091 ]
      
      In the commit d73ef2d6 ("rtnetlink: let rtnl_bridge_setlink checks
      IFLA_BRIDGE_MODE length"), an adjustment was made to the old loop logic
      in the function `rtnl_bridge_setlink` to enable the loop to also check
      the length of the IFLA_BRIDGE_MODE attribute. However, this adjustment
      removed the `break` statement and led to an error logic of the flags
      writing back at the end of this function.
      
      if (have_flags)
          memcpy(nla_data(attr), &flags, sizeof(flags));
          // attr should point to IFLA_BRIDGE_FLAGS NLA !!!
      
      Before the mentioned commit, the `attr` is granted to be IFLA_BRIDGE_FLAGS.
      However, this is not necessarily true fow now as the updated loop will let
      the attr point to the last NLA, even an invalid NLA which could cause
      overflow writes.
      
      This patch introduces a new variable `br_flag` to save the NLA pointer
      that points to IFLA_BRIDGE_FLAGS and uses it to resolve the mentioned
      error logic.
      
      Fixes: d73ef2d6 ("rtnetlink: let rtnl_bridge_setlink checks IFLA_BRIDGE_MODE length")
      Signed-off-by: default avatarLin Ma <linma@zju.edu.cn>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Link: https://lore.kernel.org/r/20240227121128.608110-1-linma@zju.edu.cn
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      882a51a1
    • Ignat Korchagin's avatar
      netfilter: nf_tables: allow NFPROTO_INET in nft_(match/target)_validate() · 80fabcd5
      Ignat Korchagin authored
      [ Upstream commit 7e0f122c ]
      
      Commit d0009eff ("netfilter: nf_tables: validate NFPROTO_* family") added
      some validation of NFPROTO_* families in the nft_compat module, but it broke
      the ability to use legacy iptables modules in dual-stack nftables.
      
      While with legacy iptables one had to independently manage IPv4 and IPv6
      tables, with nftables it is possible to have dual-stack tables sharing the
      rules. Moreover, it was possible to use rules based on legacy iptables
      match/target modules in dual-stack nftables.
      
      As an example, the program from [2] creates an INET dual-stack family table
      using an xt_bpf based rule, which looks like the following (the actual output
      was generated with a patched nft tool as the current nft tool does not parse
      dual stack tables with legacy match rules, so consider it for illustrative
      purposes only):
      
      table inet testfw {
        chain input {
          type filter hook prerouting priority filter; policy accept;
          bytecode counter packets 0 bytes 0 accept
        }
      }
      
      After d0009eff ("netfilter: nf_tables: validate NFPROTO_* family") we get
      EOPNOTSUPP for the above program.
      
      Fix this by allowing NFPROTO_INET for nft_(match/target)_validate(), but also
      restrict the functions to classic iptables hooks.
      
      Changes in v3:
        * clarify that upstream nft will not display such configuration properly and
          that the output was generated with a patched nft tool
        * remove example program from commit description and link to it instead
        * no code changes otherwise
      
      Changes in v2:
        * restrict nft_(match/target)_validate() to classic iptables hooks
        * rewrite example program to use unmodified libnftnl
      
      Fixes: d0009eff ("netfilter: nf_tables: validate NFPROTO_* family")
      Link: https://lore.kernel.org/all/Zc1PfoWN38UuFJRI@calendula/T/#mc947262582c90fec044c7a3398cc92fac7afea72 [1]
      Link: https://lore.kernel.org/all/20240220145509.53357-1-ignat@cloudflare.com/
      
       [2]
      Reported-by: default avatarJordan Griege <jgriege@cloudflare.com>
      Signed-off-by: default avatarIgnat Korchagin <ignat@cloudflare.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      80fabcd5
    • Kai-Heng Feng's avatar
      Bluetooth: Enforce validation on max value of connection interval · e24acaef
      Kai-Heng Feng authored
      [ Upstream commit e4b01951 ]
      
      Right now Linux BT stack cannot pass test case "GAP/CONN/CPUP/BV-05-C
      'Connection Parameter Update Procedure Invalid Parameters Central
      Responder'" in Bluetooth Test Suite revision GAP.TS.p44. [0]
      
      That was revoled by commit c49a8682 ("Bluetooth: validate BLE
      connection interval updates"), but later got reverted due to devices
      like keyboards and mice may require low connection interval.
      
      So only validate the max value connection interval to pass the Test
      Suite, and let devices to request low connection interval if needed.
      
      [0] https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=229869
      
      
      
      Fixes: 68d19d7d ("Revert "Bluetooth: validate BLE connection interval updates"")
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e24acaef
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_event: Fix handling of HCI_EV_IO_CAPA_REQUEST · df193568
      Luiz Augusto von Dentz authored
      [ Upstream commit 7e74aa53 ]
      
      If we received HCI_EV_IO_CAPA_REQUEST while
      HCI_OP_READ_REMOTE_EXT_FEATURES is yet to be responded assume the remote
      does support SSP since otherwise this event shouldn't be generated.
      
      Link: https://lore.kernel.org/linux-bluetooth/CABBYNZ+9UdG1cMZVmdtN3U2aS16AKMCyTARZZyFX7xTEDWcMOw@mail.gmail.com/T/#t
      
      
      Fixes: c7f59461 ("Bluetooth: Fix a refcnt underflow problem for hci_conn")
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      df193568
    • Zijun Hu's avatar
      Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR · 0309b68a
      Zijun Hu authored
      
      [ Upstream commit 61a5ab72 ]
      
      hci_store_wake_reason() wrongly parses event HCI_Connection_Request
      as HCI_Connection_Complete and HCI_Connection_Complete as
      HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
      potential stability issue, fix it by using the correct field.
      
      Fixes: 2f20216c ("Bluetooth: Emit controller suspend and resume events")
      Signed-off-by: default avatarZijun Hu <quic_zijuhu@quicinc.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0309b68a
    • Ying Hsu's avatar
      Bluetooth: Avoid potential use-after-free in hci_error_reset · 6dd0a9df
      Ying Hsu authored
      
      [ Upstream commit 2449007d ]
      
      While handling the HCI_EV_HARDWARE_ERROR event, if the underlying
      BT controller is not responding, the GPIO reset mechanism would
      free the hci_dev and lead to a use-after-free in hci_error_reset.
      
      Here's the call trace observed on a ChromeOS device with Intel AX201:
         queue_work_on+0x3e/0x6c
         __hci_cmd_sync_sk+0x2ee/0x4c0 [bluetooth <HASH:3b4a6>]
         ? init_wait_entry+0x31/0x31
         __hci_cmd_sync+0x16/0x20 [bluetooth <HASH:3b4a 6>]
         hci_error_reset+0x4f/0xa4 [bluetooth <HASH:3b4a 6>]
         process_one_work+0x1d8/0x33f
         worker_thread+0x21b/0x373
         kthread+0x13a/0x152
         ? pr_cont_work+0x54/0x54
         ? kthread_blkcg+0x31/0x31
          ret_from_fork+0x1f/0x30
      
      This patch holds the reference count on the hci_dev while processing
      a HCI_EV_HARDWARE_ERROR event to avoid potential crash.
      
      Fixes: c7741d16 ("Bluetooth: Perform a power cycle when receiving hardware error event")
      Signed-off-by: default avatarYing Hsu <yinghsu@chromium.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6dd0a9df
    • Javier Carrasco's avatar
      net: usb: dm9601: fix wrong return value in dm9601_mdio_read · 6782a54e
      Javier Carrasco authored
      
      [ Upstream commit c68b2c9e ]
      
      The MII code does not check the return value of mdio_read (among
      others), and therefore no error code should be sent. A previous fix to
      the use of an uninitialized variable propagates negative error codes,
      that might lead to wrong operations by the MII library.
      
      An example of such issues is the use of mii_nway_restart by the dm9601
      driver. The mii_nway_restart function does not check the value returned
      by mdio_read, which in this case might be a negative number which could
      contain the exact bit the function checks (BMCR_ANENABLE = 0x1000).
      
      Return zero in case of error, as it is common practice in users of
      mdio_read to avoid wrong uses of the return value.
      
      Fixes: 8f8abb86 ("net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read")
      Signed-off-by: default avatarJavier Carrasco <javier.carrasco.cruz@gmail.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarPeter Korsgaard <peter@korsgaard.com>
      Link: https://lore.kernel.org/r/20240225-dm9601_ret_err-v1-1-02c1d959ea59@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6782a54e
    • Oleksij Rempel's avatar
      lan78xx: enable auto speed configuration for LAN7850 if no EEPROM is detected · c1c7396b
      Oleksij Rempel authored
      
      [ Upstream commit 0e67899a ]
      
      Same as LAN7800, LAN7850 can be used without EEPROM. If EEPROM is not
      present or not flashed, LAN7850 will fail to sync the speed detected by the PHY
      with the MAC. In case link speed is 100Mbit, it will accidentally work,
      otherwise no data can be transferred.
      
      Better way would be to implement link_up callback, or set auto speed
      configuration unconditionally. But this changes would be more intrusive.
      So, for now, set it only if no EEPROM is found.
      
      Fixes: e69647a1 ("lan78xx: Set ASD in MAC_CR when EEE is enabled.")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://lore.kernel.org/r/20240222123839.2816561-1-o.rempel@pengutronix.de
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c1c7396b
    • Eric Dumazet's avatar
      ipv6: fix potential "struct net" leak in inet6_rtm_getaddr() · 810fa7d5
      Eric Dumazet authored
      
      [ Upstream commit 10bfd453 ]
      
      It seems that if userspace provides a correct IFA_TARGET_NETNSID value
      but no IFA_ADDRESS and IFA_LOCAL attributes, inet6_rtm_getaddr()
      returns -EINVAL with an elevated "struct net" refcount.
      
      Fixes: 6ecf4c37 ("ipv6: enable IFA_TARGET_NETNSID for RTM_GETADDR")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: David Ahern <dsahern@kernel.org>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      810fa7d5
    • Yunjian Wang's avatar
      tun: Fix xdp_rxq_info's queue_index when detaching · 906986fe
      Yunjian Wang authored
      
      [ Upstream commit 2a770cdc ]
      
      When a queue(tfile) is detached, we only update tfile's queue_index,
      but do not update xdp_rxq_info's queue_index. This patch fixes it.
      
      Fixes: 8bf5c4ee ("tun: setup xdp_rxq_info")
      Signed-off-by: default avatarYunjian Wang <wangyunjian@huawei.com>
      Link: https://lore.kernel.org/r/1708398727-46308-1-git-send-email-wangyunjian@huawei.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      906986fe
    • Florian Westphal's avatar
      net: ip_tunnel: prevent perpetual headroom growth · 2e95350f
      Florian Westphal authored
      
      [ Upstream commit 5ae1e992 ]
      
      syzkaller triggered following kasan splat:
      BUG: KASAN: use-after-free in __skb_flow_dissect+0x19d1/0x7a50 net/core/flow_dissector.c:1170
      Read of size 1 at addr ffff88812fb4000e by task syz-executor183/5191
      [..]
       kasan_report+0xda/0x110 mm/kasan/report.c:588
       __skb_flow_dissect+0x19d1/0x7a50 net/core/flow_dissector.c:1170
       skb_flow_dissect_flow_keys include/linux/skbuff.h:1514 [inline]
       ___skb_get_hash net/core/flow_dissector.c:1791 [inline]
       __skb_get_hash+0xc7/0x540 net/core/flow_dissector.c:1856
       skb_get_hash include/linux/skbuff.h:1556 [inline]
       ip_tunnel_xmit+0x1855/0x33c0 net/ipv4/ip_tunnel.c:748
       ipip_tunnel_xmit+0x3cc/0x4e0 net/ipv4/ipip.c:308
       __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+0x13d/0x6d0 net/core/dev.c:3564
       __dev_queue_xmit+0x7c1/0x3d60 net/core/dev.c:4349
       dev_queue_xmit include/linux/netdevice.h:3134 [inline]
       neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1592
       ...
       ip_finish_output2+0x833/0x2550 net/ipv4/ip_output.c:235
       ip_finish_output+0x31/0x310 net/ipv4/ip_output.c:323
       ..
       iptunnel_xmit+0x5b4/0x9b0 net/ipv4/ip_tunnel_core.c:82
       ip_tunnel_xmit+0x1dbc/0x33c0 net/ipv4/ip_tunnel.c:831
       ipgre_xmit+0x4a1/0x980 net/ipv4/ip_gre.c:665
       __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+0x13d/0x6d0 net/core/dev.c:3564
       ...
      
      The splat occurs because skb->data points past skb->head allocated area.
      This is because neigh layer does:
        __skb_pull(skb, skb_network_offset(skb));
      
      ... but skb_network_offset() returns a negative offset and __skb_pull()
      arg is unsigned.  IOW, we skb->data gets "adjusted" by a huge value.
      
      The negative value is returned because skb->head and skb->data distance is
      more than 64k and skb->network_header (u16) has wrapped around.
      
      The bug is in the ip_tunnel infrastructure, which can cause
      dev->needed_headroom to increment ad infinitum.
      
      The syzkaller reproducer consists of packets getting routed via a gre
      tunnel, and route of gre encapsulated packets pointing at another (ipip)
      tunnel.  The ipip encapsulation finds gre0 as next output device.
      
      This results in the following pattern:
      
      1). First packet is to be sent out via gre0.
      Route lookup found an output device, ipip0.
      
      2).
      ip_tunnel_xmit for gre0 bumps gre0->needed_headroom based on the future
      output device, rt.dev->needed_headroom (ipip0).
      
      3).
      ip output / start_xmit moves skb on to ipip0. which runs the same
      code path again (xmit recursion).
      
      4).
      Routing step for the post-gre0-encap packet finds gre0 as output device
      to use for ipip0 encapsulated packet.
      
      tunl0->needed_headroom is then incremented based on the (already bumped)
      gre0 device headroom.
      
      This repeats for every future packet:
      
      gre0->needed_headroom gets inflated because previous packets' ipip0 step
      incremented rt->dev (gre0) headroom, and ipip0 incremented because gre0
      needed_headroom was increased.
      
      For each subsequent packet, gre/ipip0->needed_headroom grows until
      post-expand-head reallocations result in a skb->head/data distance of
      more than 64k.
      
      Once that happens, skb->network_header (u16) wraps around when
      pskb_expand_head tries to make sure that skb_network_offset() is unchanged
      after the headroom expansion/reallocation.
      
      After this skb_network_offset(skb) returns a different (and negative)
      result post headroom expansion.
      
      The next trip to neigh layer (or anything else that would __skb_pull the
      network header) makes skb->data point to a memory location outside
      skb->head area.
      
      v2: Cap the needed_headroom update to an arbitarily chosen upperlimit to
      prevent perpetual increase instead of dropping the headroom increment
      completely.
      
      Reported-and-tested-by: default avatar <syzbot+bfde3bef047a81b8fde6@syzkaller.appspotmail.com>
      Closes: https://groups.google.com/g/syzkaller-bugs/c/fL9G6GtWskY/m/VKk_PR5FBAAJ
      
      
      Fixes: 243aad83 ("ip_gre: include route header_len in max_headroom calculation")
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20240220135606.4939-1-fw@strlen.de
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2e95350f
    • Ryosuke Yasuoka's avatar
      netlink: Fix kernel-infoleak-after-free in __skb_datagram_iter · f19d1f98
      Ryosuke Yasuoka authored
      
      [ Upstream commit 661779e1 ]
      
      syzbot reported the following uninit-value access issue [1]:
      
      netlink_to_full_skb() creates a new `skb` and puts the `skb->data`
      passed as a 1st arg of netlink_to_full_skb() onto new `skb`. The data
      size is specified as `len` and passed to skb_put_data(). This `len`
      is based on `skb->end` that is not data offset but buffer offset. The
      `skb->end` contains data and tailroom. Since the tailroom is not
      initialized when the new `skb` created, KMSAN detects uninitialized
      memory area when copying the data.
      
      This patch resolved this issue by correct the len from `skb->end` to
      `skb->len`, which is the actual data offset.
      
      BUG: KMSAN: kernel-infoleak-after-free in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in copy_to_user_iter lib/iov_iter.c:24 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in iterate_ubuf include/linux/iov_iter.h:29 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in iterate_and_advance include/linux/iov_iter.h:271 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in _copy_to_iter+0x364/0x2520 lib/iov_iter.c:186
       instrument_copy_to_user include/linux/instrumented.h:114 [inline]
       copy_to_user_iter lib/iov_iter.c:24 [inline]
       iterate_ubuf include/linux/iov_iter.h:29 [inline]
       iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
       iterate_and_advance include/linux/iov_iter.h:271 [inline]
       _copy_to_iter+0x364/0x2520 lib/iov_iter.c:186
       copy_to_iter include/linux/uio.h:197 [inline]
       simple_copy_to_iter+0x68/0xa0 net/core/datagram.c:532
       __skb_datagram_iter+0x123/0xdc0 net/core/datagram.c:420
       skb_copy_datagram_iter+0x5c/0x200 net/core/datagram.c:546
       skb_copy_datagram_msg include/linux/skbuff.h:3960 [inline]
       packet_recvmsg+0xd9c/0x2000 net/packet/af_packet.c:3482
       sock_recvmsg_nosec net/socket.c:1044 [inline]
       sock_recvmsg net/socket.c:1066 [inline]
       sock_read_iter+0x467/0x580 net/socket.c:1136
       call_read_iter include/linux/fs.h:2014 [inline]
       new_sync_read fs/read_write.c:389 [inline]
       vfs_read+0x8f6/0xe00 fs/read_write.c:470
       ksys_read+0x20f/0x4c0 fs/read_write.c:613
       __do_sys_read fs/read_write.c:623 [inline]
       __se_sys_read fs/read_write.c:621 [inline]
       __x64_sys_read+0x93/0xd0 fs/read_write.c:621
       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 stored to memory at:
       skb_put_data include/linux/skbuff.h:2622 [inline]
       netlink_to_full_skb net/netlink/af_netlink.c:181 [inline]
       __netlink_deliver_tap_skb net/netlink/af_netlink.c:298 [inline]
       __netlink_deliver_tap+0x5be/0xc90 net/netlink/af_netlink.c:325
       netlink_deliver_tap net/netlink/af_netlink.c:338 [inline]
       netlink_deliver_tap_kernel net/netlink/af_netlink.c:347 [inline]
       netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
       netlink_unicast+0x10f1/0x1250 net/netlink/af_netlink.c:1368
       netlink_sendmsg+0x1238/0x13d0 net/netlink/af_netlink.c:1910
       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:
       free_pages_prepare mm/page_alloc.c:1087 [inline]
       free_unref_page_prepare+0xb0/0xa40 mm/page_alloc.c:2347
       free_unref_page_list+0xeb/0x1100 mm/page_alloc.c:2533
       release_pages+0x23d3/0x2410 mm/swap.c:1042
       free_pages_and_swap_cache+0xd9/0xf0 mm/swap_state.c:316
       tlb_batch_pages_flush mm/mmu_gather.c:98 [inline]
       tlb_flush_mmu_free mm/mmu_gather.c:293 [inline]
       tlb_flush_mmu+0x6f5/0x980 mm/mmu_gather.c:300
       tlb_finish_mmu+0x101/0x260 mm/mmu_gather.c:392
       exit_mmap+0x49e/0xd30 mm/mmap.c:3321
       __mmput+0x13f/0x530 kernel/fork.c:1349
       mmput+0x8a/0xa0 kernel/fork.c:1371
       exit_mm+0x1b8/0x360 kernel/exit.c:567
       do_exit+0xd57/0x4080 kernel/exit.c:858
       do_group_exit+0x2fd/0x390 kernel/exit.c:1021
       __do_sys_exit_group kernel/exit.c:1032 [inline]
       __se_sys_exit_group kernel/exit.c:1030 [inline]
       __x64_sys_exit_group+0x3c/0x50 kernel/exit.c:1030
       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
      
      Bytes 3852-3903 of 3904 are uninitialized
      Memory access of size 3904 starts at ffff88812ea1e000
      Data copied to user address 0000000020003280
      
      CPU: 1 PID: 5043 Comm: syz-executor297 Not tainted 6.7.0-rc5-syzkaller-00047-g5bd7ef53ffe5 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
      
      Fixes: 1853c949 ("netlink, mmap: transform mmap skb into full skb on taps")
      Reported-and-tested-by: default avatar <syzbot+34ad5fab48f7bf510349@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=34ad5fab48f7bf510349
      
       [1]
      Signed-off-by: default avatarRyosuke Yasuoka <ryasuoka@redhat.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20240221074053.1794118-1-ryasuoka@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f19d1f98
    • Han Xu's avatar
      mtd: spinand: gigadevice: Fix the get ecc status issue · acd9f6d4
      Han Xu authored
      
      [ Upstream commit 59950610 ]
      
      Some GigaDevice ecc_get_status functions use on-stack buffer for
      spi_mem_op causes spi_mem_check_op failing, fix the issue by using
      spinand scratchbuf.
      
      Fixes: c40c7a99 ("mtd: spinand: Add support for GigaDevice GD5F1GQ4UExxG")
      Signed-off-by: default avatarHan Xu <han.xu@nxp.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20231108150701.593912-1-han.xu@nxp.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      acd9f6d4
    • Reto Schneider's avatar
      mtd: spinand: gigadevice: Support GD5F1GQ5UExxG · 8e3a8675
      Reto Schneider authored
      
      [ Upstream commit 469b9924 ]
      
      The relevant changes to the already existing GD5F1GQ4UExxG support has
      been determined by consulting the GigaDevice product change notice
      AN-0392-10, version 1.0 from November 30, 2020.
      
      As the overlaps are huge, variable names have been generalized
      accordingly.
      
      Apart from the lowered ECC strength (4 instead of 8 bits per 512 bytes),
      the new device ID, and the extra quad IO dummy byte, no changes had to
      be taken into account.
      
      New hardware features are not supported, namely:
       - Power on reset
       - Unique ID
       - Double transfer rate (DTR)
       - Parameter page
       - Random data quad IO
      
      The inverted semantic of the "driver strength" register bits, defaulting
      to 100% instead of 50% for the Q5 devices, got ignored as the driver has
      never touched them anyway.
      
      The no longer supported "read from cache during block erase"
      functionality is not reflected as the current SPI NAND core does not
      support it anyway.
      
      Implementation has been tested on MediaTek MT7688 based GARDENA smart
      Gateways using both, GigaDevice GD5F1GQ5UEYIG and GD5F1GQ4UBYIG.
      
      Signed-off-by: default avatarReto Schneider <reto.schneider@husqvarnagroup.com>
      Reviewed-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
      Reviewed-by: default avatarStefan Roese <sr@denx.de>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20210211113619.3502-1-code@reto-schneider.ch
      
      
      Stable-dep-of: 59950610 ("mtd: spinand: gigadevice: Fix the get ecc status issue")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8e3a8675
    • zhenwei pi's avatar
      crypto: virtio/akcipher - Fix stack overflow on memcpy · 37077ed1
      zhenwei pi authored
      [ Upstream commit c0ec2a71 ]
      
      sizeof(struct virtio_crypto_akcipher_session_para) is less than
      sizeof(struct virtio_crypto_op_ctrl_req::u), copying more bytes from
      stack variable leads stack overflow. Clang reports this issue by
      commands:
      make -j CC=clang-14 mrproper >/dev/null 2>&1
      make -j O=/tmp/crypto-build CC=clang-14 allmodconfig >/dev/null 2>&1
      make -j O=/tmp/crypto-build W=1 CC=clang-14 drivers/crypto/virtio/
        virtio_crypto_akcipher_algs.o
      
      Fixes: 59ca6c93 ("virtio-crypto: implement RSA algorithm")
      Link: https://lore.kernel.org/all/0a194a79-e3a3-45e7-be98-83abd3e1cb7e@roeck-us.net/
      
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      37077ed1
    • Hans de Goede's avatar
      platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names · bf85def4
      Hans de Goede authored
      [ Upstream commit dbcbfd66 ]
      
      On some devices the ACPI name of the touchscreen is e.g. either
      MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
      
      This happens for example on the "Chuwi Hi8 Air" tablet where the initial
      commit's ts_data uses "MSSL1680:00" but the tablets from the github issue
      and linux-hardware.org probe linked below both use "MSSL1680:01".
      
      Replace the strcmp() match on ts_data->acpi_name with a strstarts()
      check to allow using a partial match on just the ACPI HID of "MSSL1680"
      and change the ts_data->acpi_name for the "Chuwi Hi8 Air" accordingly
      to fix the touchscreen not working on models where it is "MSSL1680:01".
      
      Note this drops the length check for I2C_NAME_SIZE. This never was
      necessary since the ACPI names used are never more then 11 chars and
      I2C_NAME_SIZE is 20 so the replaced strncmp() would always stop long
      before reaching I2C_NAME_SIZE.
      
      Link: https://linux-hardware.org/?computer=AC4301C0542A
      Fixes: bbb97d72 ("platform/x86: touchscreen_dmi: Add info for the Chuwi Hi8 Air tablet")
      Closes: https://github.com/onitake/gsl-firmware/issues/91
      
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20240212120608.30469-1-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bf85def4
  2. Mar 01, 2024
Loading