Skip to content
  1. Dec 14, 2023
    • Eric Dumazet's avatar
      ipv6: fix potential NULL deref in fib6_add() · 22a9d504
      Eric Dumazet authored
      [ Upstream commit 75475bb5 ]
      
      If fib6_find_prefix() returns NULL, we should silently fallback
      using fib6_null_entry regardless of RT6_DEBUG value.
      
      syzbot reported:
      
      WARNING: CPU: 0 PID: 5477 at net/ipv6/ip6_fib.c:1516 fib6_add+0x310d/0x3fa0 net/ipv6/ip6_fib.c:1516
      Modules linked in:
      CPU: 0 PID: 5477 Comm: syz-executor.0 Not tainted 6.7.0-rc2-syzkaller-00029-g9b6de136b5f0 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
      RIP: 0010:fib6_add+0x310d/0x3fa0 net/ipv6/ip6_fib.c:1516
      Code: 00 48 8b 54 24 68 e8 42 22 00 00 48 85 c0 74 14 49 89 c6 e8 d5 d3 c2 f7 eb 5d e8 ce d3 c2 f7 e9 ca 00 00 00 e8 c4 d3 c2 f7 90 <0f> 0b 90 48 b8 00 00 00 00 00 fc ff df 48 8b 4c 24 38 80 3c 01 00
      RSP: 0018:ffffc90005067740 EFLAGS: 00010293
      RAX: ffffffff89cba5bc RBX: ffffc90005067ab0 RCX: ffff88801a2e9dc0
      RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
      RBP: ffffc90005067980 R08: ffffffff89cbca85 R09: 1ffff110040d4b85
      R10: dffffc0000000000 R11: ffffed10040d4b86 R12: 00000000ffffffff
      R13: 1ffff110051c3904 R14: ffff8880206a5c00 R15: ffff888028e1c820
      FS: 00007f763783c6c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f763783bff8 CR3: 000000007f74d000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <TASK>
      __ip6_ins_rt net/ipv6/route.c:1303 [inline]
      ip6_route_add+0x88/0x120 net/ipv6/route.c:3847
      ipv6_route_ioctl+0x525/0x7b0 net/ipv6/route.c:4467
      inet6_ioctl+0x21a/0x270 net/ipv6/af_inet6.c:575
      sock_do_ioctl+0x152/0x460 net/socket.c:1220
      sock_ioctl+0x615/0x8c0 net/socket.c:1339
      vfs_ioctl fs/ioctl.c:51 [inline]
      __do_sys_ioctl fs/ioctl.c:871 [inline]
      __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:857
      do_syscall_x64 arch/x86/entry/common.c:51 [inline]
      do_syscall_64+0x45/0x110 arch/x86/entry/common.c:82
      
      Fixes: 7bbfe00e
      
       ("ipv6: fix general protection fault in fib6_add()")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Wei Wang <weiwan@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20231129160630.3509216-1-edumazet@google.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      22a9d504
    • YuanShang's avatar
      drm/amdgpu: correct chunk_ptr to a pointer to chunk. · c28ff7e0
      YuanShang authored
      [ Upstream commit 50d51374
      
       ]
      
      The variable "chunk_ptr" should be a pointer pointing
      to a struct drm_amdgpu_cs_chunk instead of to a pointer
      of that.
      
      Signed-off-by: default avatarYuanShang <YuanShang.Mao@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c28ff7e0
    • Masahiro Yamada's avatar
      kconfig: fix memory leak from range properties · 19f67233
      Masahiro Yamada authored
      [ Upstream commit ae1eff03
      
       ]
      
      Currently, sym_validate_range() duplicates the range string using
      xstrdup(), which is overwritten by a subsequent sym_calc_value() call.
      It results in a memory leak.
      
      Instead, only the pointer should be copied.
      
      Below is a test case, with a summary from Valgrind.
      
      [Test Kconfig]
      
        config FOO
                int "foo"
                range 10 20
      
      [Test .config]
      
        CONFIG_FOO=0
      
      [Before]
      
        LEAK SUMMARY:
           definitely lost: 3 bytes in 1 blocks
           indirectly lost: 0 bytes in 0 blocks
             possibly lost: 0 bytes in 0 blocks
           still reachable: 17,465 bytes in 21 blocks
                suppressed: 0 bytes in 0 blocks
      
      [After]
      
        LEAK SUMMARY:
           definitely lost: 0 bytes in 0 blocks
           indirectly lost: 0 bytes in 0 blocks
             possibly lost: 0 bytes in 0 blocks
           still reachable: 17,462 bytes in 20 blocks
                suppressed: 0 bytes in 0 blocks
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      19f67233
    • Alex Pakhunov's avatar
      tg3: Increment tx_dropped in tg3_tso_bug() · 7412dfba
      Alex Pakhunov authored
      [ Upstream commit 17dd5efe
      
       ]
      
      tg3_tso_bug() drops a packet if it cannot be segmented for any reason.
      The number of discarded frames should be incremented accordingly.
      
      Signed-off-by: default avatarAlex Pakhunov <alexey.pakhunov@spacex.com>
      Signed-off-by: default avatarVincent Wong <vincent.wong2@spacex.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Link: https://lore.kernel.org/r/20231113182350.37472-2-alexey.pakhunov@spacex.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7412dfba
    • Alex Pakhunov's avatar
      tg3: Move the [rt]x_dropped counters to tg3_napi · dbd59898
      Alex Pakhunov authored
      [ Upstream commit 907d1bdb
      
       ]
      
      This change moves [rt]x_dropped counters to tg3_napi so that they can be
      updated by a single writer, race-free.
      
      Signed-off-by: default avatarAlex Pakhunov <alexey.pakhunov@spacex.com>
      Signed-off-by: default avatarVincent Wong <vincent.wong2@spacex.com>
      Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231113182350.37472-1-alexey.pakhunov@spacex.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dbd59898
    • Jozsef Kadlecsik's avatar
      netfilter: ipset: fix race condition between swap/destroy and kernel side add/del/test · a12606e5
      Jozsef Kadlecsik authored
      [ Upstream commit 28628fa9
      
       ]
      
      Linkui Xiao reported that there's a race condition when ipset swap and destroy is
      called, which can lead to crash in add/del/test element operations. Swap then
      destroy are usual operations to replace a set with another one in a production
      system. The issue can in some cases be reproduced with the script:
      
      ipset create hash_ip1 hash:net family inet hashsize 1024 maxelem 1048576
      ipset add hash_ip1 172.20.0.0/16
      ipset add hash_ip1 192.168.0.0/16
      iptables -A INPUT -m set --match-set hash_ip1 src -j ACCEPT
      while [ 1 ]
      do
      	# ... Ongoing traffic...
              ipset create hash_ip2 hash:net family inet hashsize 1024 maxelem 1048576
              ipset add hash_ip2 172.20.0.0/16
              ipset swap hash_ip1 hash_ip2
              ipset destroy hash_ip2
              sleep 0.05
      done
      
      In the race case the possible order of the operations are
      
      	CPU0			CPU1
      	ip_set_test
      				ipset swap hash_ip1 hash_ip2
      				ipset destroy hash_ip2
      	hash_net_kadt
      
      Swap replaces hash_ip1 with hash_ip2 and then destroy removes hash_ip2 which
      is the original hash_ip1. ip_set_test was called on hash_ip1 and because destroy
      removed it, hash_net_kadt crashes.
      
      The fix is to force ip_set_swap() to wait for all readers to finish accessing the
      old set pointers by calling synchronize_rcu().
      
      The first version of the patch was written by Linkui Xiao <xiaolinkui@kylinos.cn>.
      
      v2: synchronize_rcu() is moved into ip_set_swap() in order not to burden
          ip_set_destroy() unnecessarily when all sets are destroyed.
      v3: Florian Westphal pointed out that all netfilter hooks run with rcu_read_lock() held
          and em_ipset.c wraps the entire ip_set_test() in rcu read lock/unlock pair.
          So there's no need to extend the rcu read locked area in ipset itself.
      
      Closes: https://lore.kernel.org/all/69e7963b-e7f8-3ad0-210-7b86eebf7f78@netfilter.org/
      Reported by: Linkui Xiao <xiaolinkui@kylinos.cn>
      Signed-off-by: default avatarJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a12606e5
    • Thomas Gleixner's avatar
      hrtimers: Push pending hrtimers away from outgoing CPU earlier · 9a2fc41a
      Thomas Gleixner authored
      [ Upstream commit 5c0930cc ]
      
      2b8272ff
      
       ("cpu/hotplug: Prevent self deadlock on CPU hot-unplug")
      solved the straight forward CPU hotplug deadlock vs. the scheduler
      bandwidth timer. Yu discovered a more involved variant where a task which
      has a bandwidth timer started on the outgoing CPU holds a lock and then
      gets throttled. If the lock required by one of the CPU hotplug callbacks
      the hotplug operation deadlocks because the unthrottling timer event is not
      handled on the dying CPU and can only be recovered once the control CPU
      reaches the hotplug state which pulls the pending hrtimers from the dead
      CPU.
      
      Solve this by pushing the hrtimers away from the dying CPU in the dying
      callbacks. Nothing can queue a hrtimer on the dying CPU at that point because
      all other CPUs spin in stop_machine() with interrupts disabled and once the
      operation is finished the CPU is marked offline.
      
      Reported-by: default avatarYu Liao <liaoyu15@huawei.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarLiu Tie <liutie4@huawei.com>
      Link: https://lore.kernel.org/r/87a5rphara.ffs@tglx
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9a2fc41a
    • Evgeny Novikov's avatar
      media: davinci: vpif_capture: fix potential double free · 9d72eb94
      Evgeny Novikov authored
      [ Upstream commit 602649ea
      
       ]
      
      In case of errors vpif_probe_complete() releases memory for vpif_obj.sd
      and unregisters the V4L2 device. But then this is done again by
      vpif_probe() itself. The patch removes the cleaning from
      vpif_probe_complete().
      
      Found by Linux Driver Verification project (linuxtesting.org).
      
      Signed-off-by: default avatarEvgeny Novikov <novikov@ispras.ru>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9d72eb94
    • Uwe Kleine-König's avatar
      spi: imx: mx51-ecspi: Move some initialisation to prepare_message hook. · aca301ec
      Uwe Kleine-König authored
      [ Upstream commit 00b80ac9
      
       ]
      
      The relevant difference between prepare_message and config is that the
      former is run before the CS signal is asserted. So the polarity of the
      CLK line must be configured in prepare_message as an edge generated by
      config might already result in a latch of the MOSI line.
      
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aca301ec
    • Robin Gong's avatar
      spi: imx: correct wml as the last sg length · 22dae467
      Robin Gong authored
      [ Upstream commit 5ba5a373
      
       ]
      
      Correct wml as the last rx sg length instead of the whole transfer
      length. Otherwise, mtd_stresstest will be failed as below:
      
      insmod mtd_stresstest.ko dev=0
      =================================================
      mtd_stresstest: MTD device: 0
      mtd_stresstest: not NAND flash, assume page size is 512 bytes.
      mtd_stresstest: MTD device size 4194304, eraseblock size 65536, page size 512, count of eraseblocks 64, pa0
      mtd_stresstest: doing operations
      mtd_stresstest: 0 operations done
      mtd_test: mtd_read from 1ff532, size 880
      mtd_test: mtd_read from 20c267, size 64998
      spi_master spi0: I/O Error in DMA RX
      m25p80 spi0.0: SPI transfer failed: -110
      spi_master spi0: failed to transfer one message from queue
      mtd_test: error: read failed at 0x20c267
      mtd_stresstest: error -110 occurred
      =================================================
      insmod: ERROR: could not insert module mtd_stresstest.ko: Connection timed out
      
      Signed-off-by: default avatarRobin Gong <yibin.gong@nxp.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Stable-dep-of: 00b80ac9
      
       ("spi: imx: mx51-ecspi: Move some initialisation to prepare_message hook.")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      22dae467
    • Robin Gong's avatar
      spi: imx: move wml setting to later than setup_transfer · ab6d0ef9
      Robin Gong authored
      [ Upstream commit 987a2dfe
      
       ]
      
      Current dynamic burst length is based on the whole transfer length,
      that's ok if there is only one sg, but is not right in case multi sgs
      in one transfer,because the tail data should be based on the last sg
      length instead of the whole transfer length. Move wml setting for DMA
      to the later place, thus, the next patch could get the right last sg
      length for wml setting. This patch is a preparation one, no any
      function change involved.
      
      Signed-off-by: default avatarRobin Gong <yibin.gong@nxp.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Stable-dep-of: 00b80ac9
      
       ("spi: imx: mx51-ecspi: Move some initialisation to prepare_message hook.")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ab6d0ef9
    • Uwe Kleine-König's avatar
      spi: imx: add a device specific prepare_message callback · f79a0c28
      Uwe Kleine-König authored
      [ Upstream commit e697271c
      
       ]
      
      This is just preparatory work which allows to move some initialisation
      that currently is done in the per transfer hook .config to an earlier
      point in time in the next few patches. There is no change in behaviour
      introduced by this patch.
      
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f79a0c28
  2. Dec 08, 2023