1. 07 Dec, 2022 10 commits
    • Max Staudt's avatar
      can: can327: flush TX_work on ldisc .close() · f4a4d121
      Max Staudt authored
      Additionally, remove it from .ndo_stop().
      
      This ensures that the worker is not called after being freed, and that
      the UART TX queue remains active to send final commands when the
      netdev is stopped.
      
      Thanks to Jiri Slaby for finding this in slcan:
      
        https://lore.kernel.org/linux-can/20221201073426.17328-1-jirislaby@kernel.org/
      
      A variant of this patch for slcan, with the flush in .ndo_stop() still
      present, has been tested successfully on physical hardware:
      
        https://bugzilla.suse.com/show_bug.cgi?id=1205597
      
      Fixes: 43da2f07 ("can: can327: CAN/ldisc driver for ELM327 based OBD-II adapters")
      Cc: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
      Cc: Max Staudt <max@enpas.org>
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Cc: Marc Kleine-Budde <mkl@pengutronix.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: linux-can@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMax Staudt <max@enpas.org>
      Link: https://lore.kernel.org/all/20221202160148.282564-1-max@enpas.org
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      f4a4d121
    • Jiri Slaby (SUSE)'s avatar
      can: slcan: fix freed work crash · fb855e9f
      Jiri Slaby (SUSE) authored
      The LTP test pty03 is causing a crash in slcan:
        BUG: kernel NULL pointer dereference, address: 0000000000000008
        #PF: supervisor read access in kernel mode
        #PF: error_code(0x0000) - not-present page
        PGD 0 P4D 0
        Oops: 0000 [#1] PREEMPT SMP NOPTI
        CPU: 0 PID: 348 Comm: kworker/0:3 Not tainted 6.0.8-1-default #1 openSUSE Tumbleweed 9d20364b934f5aab0a9bdf84e8f45cfdfae39dab
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
        Workqueue:  0x0 (events)
        RIP: 0010:process_one_work (/home/rich/kernel/linux/kernel/workqueue.c:706 /home/rich/kernel/linux/kernel/workqueue.c:2185)
        Code: 49 89 ff 41 56 41 55 41 54 55 53 48 89 f3 48 83 ec 10 48 8b 06 48 8b 6f 48 49 89 c4 45 30 e4 a8 04 b8 00 00 00 00 4c 0f 44 e0 <49> 8b 44 24 08 44 8b a8 00 01 00 00 41 83 e5 20 f6 45 10 04 75 0e
        RSP: 0018:ffffaf7b40f47e98 EFLAGS: 00010046
        RAX: 0000000000000000 RBX: ffff9d644e1b8b48 RCX: ffff9d649e439968
        RDX: 00000000ffff8455 RSI: ffff9d644e1b8b48 RDI: ffff9d64764aa6c0
        RBP: ffff9d649e4335c0 R08: 0000000000000c00 R09: ffff9d64764aa734
        R10: 0000000000000007 R11: 0000000000000001 R12: 0000000000000000
        R13: ffff9d649e4335e8 R14: ffff9d64490da780 R15: ffff9d64764aa6c0
        FS:  0000000000000000(0000) GS:ffff9d649e400000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000000000008 CR3: 0000000036424000 CR4: 00000000000006f0
        Call Trace:
         <TASK>
        worker_thread (/home/rich/kernel/linux/kernel/workqueue.c:2436)
        kthread (/home/rich/kernel/linux/kernel/kthread.c:376)
        ret_from_fork (/home/rich/kernel/linux/arch/x86/entry/entry_64.S:312)
      
      Apparently, the slcan's tx_work is freed while being scheduled. While
      slcan_netdev_close() (netdev side) calls flush_work(&sl->tx_work),
      slcan_close() (tty side) does not. So when the netdev is never set UP,
      but the tty is stuffed with bytes and forced to wakeup write, the work
      is scheduled, but never flushed.
      
      So add an additional flush_work() to slcan_close() to be sure the work
      is flushed under all circumstances.
      
      The Fixes commit below moved flush_work() from slcan_close() to
      slcan_netdev_close(). What was the rationale behind it? Maybe we can
      drop the one in slcan_netdev_close()?
      
      I see the same pattern in can327. So it perhaps needs the very same fix.
      
      Fixes: cfcb4465 ("can: slcan: remove legacy infrastructure")
      Link: https://bugzilla.suse.com/show_bug.cgi?id=1205597Reported-by: default avatarRichard Palethorpe <richard.palethorpe@suse.com>
      Tested-by: default avatarPetr Vorel <petr.vorel@suse.com>
      Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Cc: Marc Kleine-Budde <mkl@pengutronix.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: linux-can@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: stable@vger.kernel.org
      Cc: Max Staudt <max@enpas.org>
      Signed-off-by: default avatarJiri Slaby (SUSE) <jirislaby@kernel.org>
      Reviewed-by: default avatarMax Staudt <max@enpas.org>
      Link: https://lore.kernel.org/all/20221201073426.17328-1-jirislaby@kernel.orgSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      fb855e9f
    • Oliver Hartkopp's avatar
      can: af_can: fix NULL pointer dereference in can_rcv_filter · 0acc4423
      Oliver Hartkopp authored
      Analogue to commit 8aa59e35 ("can: af_can: fix NULL pointer
      dereference in can_rx_register()") we need to check for a missing
      initialization of ml_priv in the receive path of CAN frames.
      
      Since commit 4e096a18 ("net: introduce CAN specific pointer in the
      struct net_device") the check for dev->type to be ARPHRD_CAN is not
      sufficient anymore since bonding or tun netdevices claim to be CAN
      devices but do not initialize ml_priv accordingly.
      
      Fixes: 4e096a18 ("net: introduce CAN specific pointer in the struct net_device")
      Reported-by: syzbot+2d7f58292cb5b29eb5ad@syzkaller.appspotmail.com
      Reported-by: default avatarWei Chen <harperchen1110@gmail.com>
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Link: https://lore.kernel.org/all/20221206201259.3028-1-socketcan@hartkopp.net
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      0acc4423
    • Jakub Kicinski's avatar
      Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · 1799c1b8
      Jakub Kicinski authored
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2022-12-05 (i40e)
      
      Michal clears XPS init flag on reset to allow for updated values to be
      written.
      
      Sylwester adds sleep to VF reset to resolve issue of VFs not getting
      resources.
      
      Przemyslaw rejects filters for raw IPv4 or IPv6 l4_4_bytes filters as they
       are not supported.
      
      * '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
        i40e: Disallow ip4 and ip6 l4_4_bytes
        i40e: Fix for VF MAC address 0
        i40e: Fix not setting default xps_cpus after reset
      ====================
      
      Link: https://lore.kernel.org/r/20221205212523.3197565-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1799c1b8
    • Zhengchao Shao's avatar
      net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions() · 78a9ea43
      Zhengchao Shao authored
      When dsa_devlink_region_create failed in sja1105_setup_devlink_regions(),
      priv->regions is not released.
      
      Fixes: bf425b82 ("net: dsa: sja1105: expose static config as devlink region")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20221205012132.2110979-1-shaozhengchao@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      78a9ea43
    • Jakub Kicinski's avatar
      Merge branch 'ipv4-two-bug-fixes' · e40febfb
      Jakub Kicinski authored
      Ido Schimmel says:
      
      ====================
      ipv4: Two small fixes for bugs in IPv4 routing code.
      
      A variation of the second bug was reported by an FRR 5.0 (released
      06/18) user as this version was setting a table ID of 0 for the
      default VRF, unlike iproute2 and newer FRR versions.
      
      The first bug was discovered while fixing the second.
      
      Both bugs are not regressions (never worked) and are not critical
      in my opinion, so the fixes can be applied to net-next, if desired.
      
      No regressions in other tests:
      
       # ./fib_tests.sh
       ...
       Tests passed: 191
       Tests failed:   0
      ====================
      
      Link: https://lore.kernel.org/r/20221204075045.3780097-1-idosch@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e40febfb
    • Ido Schimmel's avatar
      ipv4: Fix incorrect route flushing when table ID 0 is used · c0d99934
      Ido Schimmel authored
      Cited commit added the table ID to the FIB info structure, but did not
      properly initialize it when table ID 0 is used. This can lead to a route
      in the default VRF with a preferred source address not being flushed
      when the address is deleted.
      
      Consider the following example:
      
       # ip address add dev dummy1 192.0.2.1/28
       # ip address add dev dummy1 192.0.2.17/28
       # ip route add 198.51.100.0/24 via 192.0.2.2 src 192.0.2.17 metric 100
       # ip route add table 0 198.51.100.0/24 via 192.0.2.2 src 192.0.2.17 metric 200
       # ip route show 198.51.100.0/24
       198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 100
       198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 200
      
      Both routes are installed in the default VRF, but they are using two
      different FIB info structures. One with a metric of 100 and table ID of
      254 (main) and one with a metric of 200 and table ID of 0. Therefore,
      when the preferred source address is deleted from the default VRF,
      the second route is not flushed:
      
       # ip address del dev dummy1 192.0.2.17/28
       # ip route show 198.51.100.0/24
       198.51.100.0/24 via 192.0.2.2 dev dummy1 src 192.0.2.17 metric 200
      
      Fix by storing a table ID of 254 instead of 0 in the route configuration
      structure.
      
      Add a test case that fails before the fix:
      
       # ./fib_tests.sh -t ipv4_del_addr
      
       IPv4 delete address route tests
           Regular FIB info
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Identical FIB info with different table ID
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Table ID 0
           TEST: Route removed in default VRF when source address deleted      [FAIL]
      
       Tests passed:   8
       Tests failed:   1
      
      And passes after:
      
       # ./fib_tests.sh -t ipv4_del_addr
      
       IPv4 delete address route tests
           Regular FIB info
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Identical FIB info with different table ID
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Table ID 0
           TEST: Route removed in default VRF when source address deleted      [ OK ]
      
       Tests passed:   9
       Tests failed:   0
      
      Fixes: 5a56a0b3 ("net: Don't delete routes in different VRFs")
      Reported-by: default avatarDonald Sharp <sharpd@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c0d99934
    • Ido Schimmel's avatar
      ipv4: Fix incorrect route flushing when source address is deleted · f96a3d74
      Ido Schimmel authored
      Cited commit added the table ID to the FIB info structure, but did not
      prevent structures with different table IDs from being consolidated.
      This can lead to routes being flushed from a VRF when an address is
      deleted from a different VRF.
      
      Fix by taking the table ID into account when looking for a matching FIB
      info. This is already done for FIB info structures backed by a nexthop
      object in fib_find_info_nh().
      
      Add test cases that fail before the fix:
      
       # ./fib_tests.sh -t ipv4_del_addr
      
       IPv4 delete address route tests
           Regular FIB info
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Identical FIB info with different table ID
           TEST: Route removed from VRF when source address deleted            [FAIL]
           TEST: Route in default VRF not removed                              [ OK ]
       RTNETLINK answers: File exists
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [FAIL]
      
       Tests passed:   6
       Tests failed:   2
      
      And pass after:
      
       # ./fib_tests.sh -t ipv4_del_addr
      
       IPv4 delete address route tests
           Regular FIB info
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
           Identical FIB info with different table ID
           TEST: Route removed from VRF when source address deleted            [ OK ]
           TEST: Route in default VRF not removed                              [ OK ]
           TEST: Route removed in default VRF when source address deleted      [ OK ]
           TEST: Route in VRF is not removed by address delete                 [ OK ]
      
       Tests passed:   8
       Tests failed:   0
      
      Fixes: 5a56a0b3 ("net: Don't delete routes in different VRFs")
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f96a3d74
    • Rasmus Villemoes's avatar
      net: fec: properly guard irq coalesce setup · 7e630356
      Rasmus Villemoes authored
      Prior to the Fixes: commit, the initialization code went through the
      same fec_enet_set_coalesce() function as used by ethtool, and that
      function correctly checks whether the current variant has support for
      irq coalescing.
      
      Now that the initialization code instead calls fec_enet_itr_coal_set()
      directly, that call needs to be guarded by a check for the
      FEC_QUIRK_HAS_COALESCE bit.
      
      Fixes: df727d45 (net: fec: don't reset irq coalesce settings to defaults on "ip link up")
      Reported-by: default avatarGreg Ungerer <gregungerer@westnet.com.au>
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20221205204604.869853-1-linux@rasmusvillemoes.dkSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7e630356
    • Hangbin Liu's avatar
      bonding: get correct NA dest address · 1f154f3b
      Hangbin Liu authored
      In commit 4d633d1b ("bonding: fix ICMPv6 header handling when receiving
      IPv6 messages"), there is a copy/paste issue for NA daddr. I found that
      in my testing and fixed it in my local branch. But I forgot to re-format
      the patch and sent the wrong mail.
      
      Fix it by reading the correct dest address.
      
      Fixes: 4d633d1b ("bonding: fix ICMPv6 header handling when receiving IPv6 messages")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Acked-by: default avatarJonathan Toppins <jtoppins@redhat.com>
      Link: https://lore.kernel.org/r/20221206032055.7517-1-liuhangbin@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1f154f3b
  2. 06 Dec, 2022 12 commits
  3. 05 Dec, 2022 10 commits
  4. 04 Dec, 2022 1 commit
  5. 03 Dec, 2022 7 commits