Skip to content
  1. Jun 21, 2023
    • Aleksandr Loktionov's avatar
      igb: fix nvm.ops.read() error handling · 8c3446ab
      Aleksandr Loktionov authored
      [ Upstream commit 48a821fd ]
      
      Add error handling into igb_set_eeprom() function, in case
      nvm.ops.read() fails just quit with error code asap.
      
      Fixes: 9d5c8243
      
       ("igb: PCI-Express 82575 Gigabit Ethernet driver")
      Signed-off-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8c3446ab
    • Dan Carpenter's avatar
      sctp: fix an error code in sctp_sf_eat_auth() · 221281d6
      Dan Carpenter authored
      [ Upstream commit 75e6def3 ]
      
      The sctp_sf_eat_auth() function is supposed to enum sctp_disposition
      values and returning a kernel error code will cause issues in the
      caller.  Change -ENOMEM to SCTP_DISPOSITION_NOMEM.
      
      Fixes: 65b07e5d
      
       ("[SCTP]: API updates to suport SCTP-AUTH extensions.")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Acked-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      221281d6
    • Hangbin Liu's avatar
      ipvlan: fix bound dev checking for IPv6 l3s mode · 5c47ed7f
      Hangbin Liu authored
      [ Upstream commit ce57adc2 ]
      
      The commit 59a0b022 ("ipvlan: Make skb->skb_iif track skb->dev for l3s
      mode") fixed ipvlan bonded dev checking by updating skb skb_iif. This fix
      works for IPv4, as in raw_v4_input() the dif is from inet_iif(skb), which
      is skb->skb_iif when there is no route.
      
      But for IPv6, the fix is not enough, because in ipv6_raw_deliver() ->
      raw_v6_match(), the dif is inet6_iif(skb), which is returns IP6CB(skb)->iif
      instead of skb->skb_iif if it's not a l3_slave. To fix the IPv6 part
      issue. Let's set IP6CB(skb)->iif to correct ifindex.
      
      BTW, ipvlan handles NS/NA specifically. Since it works fine, I will not
      reset IP6CB(skb)->iif when addr->atype is IPVL_ICMPV6.
      
      Fixes: c675e06a
      
       ("ipvlan: decouple l3s mode dependencies from other modes")
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=2196710
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5c47ed7f
    • Saravanan Vajravel's avatar
      IB/isert: Fix incorrect release of isert connection · 3c97f2c9
      Saravanan Vajravel authored
      [ Upstream commit 699826f4 ]
      
      The ib_isert module is releasing the isert connection both in
      isert_wait_conn() handler as well as isert_free_conn() handler.
      In isert_wait_conn() handler, it is expected to wait for iSCSI
      session logout operation to complete. It should free the isert
      connection only in isert_free_conn() handler.
      
      When a bunch of iSER target is cleared, this issue can lead to
      use-after-free memory issue as isert conn is twice released
      
      Fixes: b02efbfc
      
       ("iser-target: Fix implicit termination of connections")
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarSaravanan Vajravel <saravanan.vajravel@broadcom.com>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Link: https://lore.kernel.org/r/20230606102531.162967-4-saravanan.vajravel@broadcom.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3c97f2c9
    • Saravanan Vajravel's avatar
      IB/isert: Fix possible list corruption in CMA handler · da6ae4aa
      Saravanan Vajravel authored
      [ Upstream commit 7651e2d6 ]
      
      When ib_isert module receives connection error event, it is
      releasing the isert session and removes corresponding list
      node but it doesn't take appropriate mutex lock to remove
      the list node.  This can lead to linked  list corruption
      
      Fixes: bd379220
      
       ("iser-target: Fix pending connections handling in target stack shutdown sequnce")
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Signed-off-by: default avatarSaravanan Vajravel <saravanan.vajravel@broadcom.com>
      Link: https://lore.kernel.org/r/20230606102531.162967-3-saravanan.vajravel@broadcom.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      da6ae4aa
    • Saravanan Vajravel's avatar
      IB/isert: Fix dead lock in ib_isert · 2b6f8817
      Saravanan Vajravel authored
      [ Upstream commit 691b0480 ]
      
      - When a iSER session is released, ib_isert module is taking a mutex
        lock and releasing all pending connections. As part of this, ib_isert
        is destroying rdma cm_id. To destroy cm_id, rdma_cm module is sending
        CM events to CMA handler of ib_isert. This handler is taking same
        mutex lock. Hence it leads to deadlock between ib_isert & rdma_cm
        modules.
      
      - For fix, created local list of pending connections and release the
        connection outside of mutex lock.
      
      Calltrace:
      ---------
      [ 1229.791410] INFO: task kworker/10:1:642 blocked for more than 120 seconds.
      [ 1229.791416]       Tainted: G           OE    --------- -  - 4.18.0-372.9.1.el8.x86_64 #1
      [ 1229.791418] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [ 1229.791419] task:kworker/10:1    state:D stack:    0 pid:  642 ppid:     2 flags:0x80004000
      [ 1229.791424] Workqueue: ib_cm cm_work_handler [ib_cm]
      [ 1229.791436] Call Trace:
      [ 1229.791438]  __schedule+0x2d1/0x830
      [ 1229.791445]  ? select_idle_sibling+0x23/0x6f0
      [ 1229.791449]  schedule+0x35/0xa0
      [ 1229.791451]  schedule_preempt_disabled+0xa/0x10
      [ 1229.791453]  __mutex_lock.isra.7+0x310/0x420
      [ 1229.791456]  ? select_task_rq_fair+0x351/0x990
      [ 1229.791459]  isert_cma_handler+0x224/0x330 [ib_isert]
      [ 1229.791463]  ? ttwu_queue_wakelist+0x159/0x170
      [ 1229.791466]  cma_cm_event_handler+0x25/0xd0 [rdma_cm]
      [ 1229.791474]  cma_ib_handler+0xa7/0x2e0 [rdma_cm]
      [ 1229.791478]  cm_process_work+0x22/0xf0 [ib_cm]
      [ 1229.791483]  cm_work_handler+0xf4/0xf30 [ib_cm]
      [ 1229.791487]  ? move_linked_works+0x6e/0xa0
      [ 1229.791490]  process_one_work+0x1a7/0x360
      [ 1229.791491]  ? create_worker+0x1a0/0x1a0
      [ 1229.791493]  worker_thread+0x30/0x390
      [ 1229.791494]  ? create_worker+0x1a0/0x1a0
      [ 1229.791495]  kthread+0x10a/0x120
      [ 1229.791497]  ? set_kthread_struct+0x40/0x40
      [ 1229.791499]  ret_from_fork+0x1f/0x40
      
      [ 1229.791739] INFO: task targetcli:28666 blocked for more than 120 seconds.
      [ 1229.791740]       Tainted: G           OE    --------- -  - 4.18.0-372.9.1.el8.x86_64 #1
      [ 1229.791741] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [ 1229.791742] task:targetcli       state:D stack:    0 pid:28666 ppid:  5510 flags:0x00004080
      [ 1229.791743] Call Trace:
      [ 1229.791744]  __schedule+0x2d1/0x830
      [ 1229.791746]  schedule+0x35/0xa0
      [ 1229.791748]  schedule_preempt_disabled+0xa/0x10
      [ 1229.791749]  __mutex_lock.isra.7+0x310/0x420
      [ 1229.791751]  rdma_destroy_id+0x15/0x20 [rdma_cm]
      [ 1229.791755]  isert_connect_release+0x115/0x130 [ib_isert]
      [ 1229.791757]  isert_free_np+0x87/0x140 [ib_isert]
      [ 1229.791761]  iscsit_del_np+0x74/0x120 [iscsi_target_mod]
      [ 1229.791776]  lio_target_np_driver_store+0xe9/0x140 [iscsi_target_mod]
      [ 1229.791784]  configfs_write_file+0xb2/0x110
      [ 1229.791788]  vfs_write+0xa5/0x1a0
      [ 1229.791792]  ksys_write+0x4f/0xb0
      [ 1229.791794]  do_syscall_64+0x5b/0x1a0
      [ 1229.791798]  entry_SYSCALL_64_after_hwframe+0x65/0xca
      
      Fixes: bd379220
      
       ("iser-target: Fix pending connections handling in target stack shutdown sequnce")
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Signed-off-by: default avatarSaravanan Vajravel <saravanan.vajravel@broadcom.com>
      Link: https://lore.kernel.org/r/20230606102531.162967-2-saravanan.vajravel@broadcom.com
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2b6f8817
    • Yishai Hadas's avatar
      IB/uverbs: Fix to consider event queue closing also upon non-blocking mode · 2f9d2634
      Yishai Hadas authored
      [ Upstream commit 62fab312 ]
      
      Fix ib_uverbs_event_read() to consider event queue closing also upon
      non-blocking mode.
      
      Once the queue is closed (e.g. hot-plug flow) all the existing events
      are cleaned-up as part of ib_uverbs_free_event_queue().
      
      An application that uses the non-blocking FD mode should get -EIO in
      that case to let it knows that the device was removed already.
      
      Otherwise, it can loose the indication that the device was removed and
      won't recover.
      
      As part of that, refactor the code to have a single flow with regards to
      'is_closed' for both blocking and non-blocking modes.
      
      Fixes: 14e23bd6
      
       ("RDMA/core: Fix locking in ib_uverbs_event_read")
      Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: default avatarYishai Hadas <yishaih@nvidia.com>
      Link: https://lore.kernel.org/r/97b00116a1e1e13f8dc4ec38a5ea81cf8c030210.1685960567.git.leon@kernel.org
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2f9d2634
    • Mark Zhang's avatar
      RDMA/cma: Always set static rate to 0 for RoCE · 6cccdbc9
      Mark Zhang authored
      [ Upstream commit 58030c76 ]
      
      Set static rate to 0 as it should be discovered by path query and
      has no meaning for RoCE.
      This also avoid of using the rtnl lock and ethtool API, which is
      a bottleneck when try to setup many rdma-cm connections at the same
      time, especially with multiple processes.
      
      Fixes: 3c86aa70
      
       ("RDMA/cm: Add RDMA CM support for IBoE devices")
      Signed-off-by: default avatarMark Zhang <markzhang@nvidia.com>
      Link: https://lore.kernel.org/r/f72a4f8b667b803aee9fa794069f61afb5839ce4.1685960567.git.leon@kernel.org
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6cccdbc9
    • Maher Sanalla's avatar
      RDMA/mlx5: Initiate dropless RQ for RAW Ethernet functions · f49abbb2
      Maher Sanalla authored
      [ Upstream commit ee4d269e ]
      
      Delay drop data is initiated for PFs that have the capability of
      rq_delay_drop and are in roce profile.
      
      However, PFs with RAW ethernet profile do not initiate delay drop data
      on function load, causing kernel panic if delay drop struct members are
      accessed later on in case a dropless RQ is created.
      
      Thus, stage the delay drop initialization as part of RAW ethernet
      PF loading process.
      
      Fixes: b5ca15ad
      
       ("IB/mlx5: Add proper representors support")
      Signed-off-by: default avatarMaher Sanalla <msanalla@nvidia.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Link: https://lore.kernel.org/r/2e9d386785043d48c38711826eb910315c1de141.1685960567.git.leon@kernel.org
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f49abbb2
    • Satha Rao's avatar
      octeontx2-af: fixed resource availability check · aa277d5c
      Satha Rao authored
      [ Upstream commit 4e635f9d ]
      
      txschq_alloc response have two different arrays to store continuous
      and non-continuous schedulers of each level. Requested count should
      be checked for each array separately.
      
      Fixes: 5d9b976d
      
       ("octeontx2-af: Support fixed transmit scheduler topology")
      Signed-off-by: default avatarSatha Rao <skoteshwar@marvell.com>
      Signed-off-by: default avatarSunil Kovvuri Goutham <sgoutham@marvell.com>
      Signed-off-by: default avatarNaveen Mamindlapalli <naveenm@marvell.com>
      Reviewed-by: default avatarSridhar Samudrala <sridhar.samudrala@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aa277d5c
    • Ahmed Zaki's avatar
      iavf: remove mask from iavf_irq_enable_queues() · 0fb48a2a
      Ahmed Zaki authored
      [ Upstream commit c37cf54c ]
      
      Enable more than 32 IRQs by removing the u32 bit mask in
      iavf_irq_enable_queues(). There is no need for the mask as there are no
      callers that select individual IRQs through the bitmask. Also, if the PF
      allocates more than 32 IRQs, this mask will prevent us from using all of
      them.
      
      Modify the comment in iavf_register.h to show that the maximum number
      allowed for the IRQ index is 63 as per the iAVF standard 1.0 [1].
      
      link: [1] https://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/ethernet-adaptive-virtual-function-hardware-spec.pdf
      Fixes: 5eae00c5
      
       ("i40evf: main driver core")
      Signed-off-by: default avatarAhmed Zaki <ahmed.zaki@intel.com>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20230608200226.451861-1-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0fb48a2a
    • Zhu Yanjun's avatar
      RDMA/rxe: Fix the use-before-initialization error of resp_pkts · 079a9591
      Zhu Yanjun authored
      [ Upstream commit 2a62b621 ]
      
      In the following:
      
        Call Trace:
         <TASK>
         __dump_stack lib/dump_stack.c:88 [inline]
         dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
         assign_lock_key kernel/locking/lockdep.c:982 [inline]
         register_lock_class+0xdb6/0x1120 kernel/locking/lockdep.c:1295
         __lock_acquire+0x10a/0x5df0 kernel/locking/lockdep.c:4951
         lock_acquire kernel/locking/lockdep.c:5691 [inline]
         lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656
         __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
         _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
         skb_dequeue+0x20/0x180 net/core/skbuff.c:3639
         drain_resp_pkts drivers/infiniband/sw/rxe/rxe_comp.c:555 [inline]
         rxe_completer+0x250d/0x3cc0 drivers/infiniband/sw/rxe/rxe_comp.c:652
         rxe_qp_do_cleanup+0x1be/0x820 drivers/infiniband/sw/rxe/rxe_qp.c:761
         execute_in_process_context+0x3b/0x150 kernel/workqueue.c:3473
         __rxe_cleanup+0x21e/0x370 drivers/infiniband/sw/rxe/rxe_pool.c:233
         rxe_create_qp+0x3f6/0x5f0 drivers/infiniband/sw/rxe/rxe_verbs.c:583
      
      This is a use-before-initialization problem.
      
      It happens because rxe_qp_do_cleanup is called during error unwind before
      the struct has been fully initialized.
      
      Move the initialization of the skb earlier.
      
      Fixes: 8700e3e7
      
       ("Soft RoCE driver")
      Link: https://lore.kernel.org/r/20230602035408.741534-1-yanjun.zhu@intel.com
      Reported-by: default avatar <syzbot+eba589d8f49c73d356da@syzkaller.appspotmail.com>
      Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      079a9591
    • Bob Pearson's avatar
      RDMA/rxe: Removed unused name from rxe_task struct · 089a0e83
      Bob Pearson authored
      [ Upstream commit de669ae8
      
       ]
      
      The name field in struct rxe_task is never used. This patch removes it.
      
      Link: https://lore.kernel.org/r/20221021200118.2163-4-rpearsonhpe@gmail.com
      Signed-off-by: default avatarIan Ziemba <ian.ziemba@hpe.com>
      Signed-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Stable-dep-of: 2a62b621
      
       ("RDMA/rxe: Fix the use-before-initialization error of resp_pkts")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      089a0e83
    • Zhu Yanjun's avatar
      RDMA/rxe: Remove the unused variable obj · 6205c0d9
      Zhu Yanjun authored
      [ Upstream commit f0785358
      
       ]
      
      The member variable obj in struct rxe_task is not needed.
      So remove it to save memory.
      
      Link: https://lore.kernel.org/r/20220822011615.805603-4-yanjun.zhu@linux.dev
      Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
      Reviewed-by: default avatarLi Zhijian <lizhijian@fujitsu.com>
      Reviewed-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Stable-dep-of: 2a62b621
      
       ("RDMA/rxe: Fix the use-before-initialization error of resp_pkts")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6205c0d9
    • Lee Jones's avatar
      net/sched: cls_u32: Fix reference counter leak leading to overflow · af6eaa57
      Lee Jones authored
      [ Upstream commit 04c55383 ]
      
      In the event of a failure in tcf_change_indev(), u32_set_parms() will
      immediately return without decrementing the recently incremented
      reference counter.  If this happens enough times, the counter will
      rollover and the reference freed, leading to a double free which can be
      used to do 'bad things'.
      
      In order to prevent this, move the point of possible failure above the
      point where the reference counter is incremented.  Also save any
      meaningful return values to be applied to the return data at the
      appropriate point in time.
      
      This issue was caught with KASAN.
      
      Fixes: 705c7091
      
       ("net: sched: cls_u32: no need to call tcf_exts_change for newly allocated struct")
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarLee Jones <lee@kernel.org>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      af6eaa57
    • Guillaume Nault's avatar
      ping6: Fix send to link-local addresses with VRF. · 5852d17a
      Guillaume Nault authored
      [ Upstream commit 91ffd1ba
      
       ]
      
      Ping sockets can't send packets when they're bound to a VRF master
      device and the output interface is set to a slave device.
      
      For example, when net.ipv4.ping_group_range is properly set, so that
      ping6 can use ping sockets, the following kind of commands fails:
        $ ip vrf exec red ping6 fe80::854:e7ff:fe88:4bf1%eth1
      
      What happens is that sk->sk_bound_dev_if is set to the VRF master
      device, but 'oif' is set to the real output device. Since both are set
      but different, ping_v6_sendmsg() sees their value as inconsistent and
      fails.
      
      Fix this by allowing 'oif' to be a slave device of ->sk_bound_dev_if.
      
      This fixes the following kselftest failure:
        $ ./fcnal-test.sh -t ipv6_ping
        [...]
        TEST: ping out, vrf device+address bind - ns-B IPv6 LLA        [FAIL]
      
      Reported-by: default avatarMirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
      Closes: https://lore.kernel.org/netdev/b6191f90-ffca-dbca-7d06-88a9788def9c@alu.unizg.hr/
      Tested-by: default avatarMirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
      Fixes: 5e457896
      
       ("net: ipv6: Fix ping to link-local addresses.")
      Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/6c8b53108816a8d0d5705ae37bdc5a8322b5e3d9.1686153846.git.gnault@redhat.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5852d17a
    • Wei Fang's avatar
      net: enetc: correct the indexes of highest and 2nd highest TCs · 9e666a77
      Wei Fang authored
      [ Upstream commit 21225873 ]
      
      For ENETC hardware, the TCs are numbered from 0 to N-1, where N
      is the number of TCs. Numerically higher TC has higher priority.
      It's obvious that the highest priority TC index should be N-1 and
      the 2nd highest priority TC index should be N-2.
      
      However, the previous logic uses netdev_get_prio_tc_map() to get
      the indexes of highest priority and 2nd highest priority TCs, it
      does not make sense and is incorrect to give a "tc" argument to
      netdev_get_prio_tc_map(). So the driver may get the wrong indexes
      of the two highest priotiry TCs which would lead to failed to set
      the CBS for the two highest priotiry TCs.
      
      e.g.
      $ tc qdisc add dev eno0 parent root handle 100: mqprio num_tc 6 \
      	map 0 0 1 1 2 3 4 5 queues 1@0 1@1 1@2 1@3 2@4 2@6 hw 1
      $ tc qdisc replace dev eno0 parent 100:6 cbs idleslope 100000 \
      	sendslope -900000 hicredit 12 locredit -113 offload 1
      $ Error: Specified device failed to setup cbs hardware offload.
        ^^^^^
      
      In this example, the previous logic deems the indexes of the two
      highest priotiry TCs should be 3 and 2. Actually, the indexes are
      5 and 4, because the number of TCs is 6. So it would be failed to
      configure the CBS for the two highest priority TCs.
      
      Fixes: c431047c
      
       ("enetc: add support Credit Based Shaper(CBS) for hardware offload")
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9e666a77
    • Pablo Neira Ayuso's avatar
      netfilter: nfnetlink: skip error delivery on batch in case of ENOMEM · 1200af82
      Pablo Neira Ayuso authored
      [ Upstream commit a1a64a15 ]
      
      If caller reports ENOMEM, then stop iterating over the batch and send a
      single netlink message to userspace to report OOM.
      
      Fixes: cbb8125e
      
       ("netfilter: nfnetlink: deliver netlink errors on batch completion")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1200af82
    • Vladimir Oltean's avatar
      spi: fsl-dspi: avoid SCK glitches with continuous transfers · af42c4fd
      Vladimir Oltean authored
      [ Upstream commit c5c31fb7 ]
      
      The DSPI controller has configurable timing for
      
      (a) tCSC: the interval between the assertion of the chip select and the
          first clock edge
      
      (b) tASC: the interval between the last clock edge and the deassertion
          of the chip select
      
      What is a bit surprising, but is documented in the figure "Example of
      continuous transfer (CPHA=1, CONT=1)" in the datasheet, is that when the
      chip select stays asserted between multiple TX FIFO writes, the tCSC and
      tASC times still apply. With CONT=1, chip select remains asserted, but
      SCK takes a break and goes to the idle state for tASC + tCSC ns.
      
      In other words, the default values (of 0 and 0 ns) result in SCK
      glitches where the SCK transition to the idle state, as well as the SCK
      transition from the idle state, will have no delay in between, and it
      may appear that a SCK cycle has simply gone missing. The resulting
      timing violation might cause data corruption in many peripherals, as
      their chip select is asserted.
      
      The driver has device tree bindings for tCSC ("fsl,spi-cs-sck-delay")
      and tASC ("fsl,spi-sck-cs-delay"), but these are only specified to apply
      when the chip select toggles in the first place, and this timing
      characteristic depends on each peripheral. Many peripherals do not have
      explicit timing requirements, so many device trees do not have these
      properties present at all.
      
      Nonetheless, the lack of SCK glitches is a common sense requirement, and
      since the SCK stays in the idle state during transfers for tCSC+tASC ns,
      and that in itself should look like half a cycle, then let's ensure that
      tCSC and tASC are at least a quarter of a SCK period, such that their
      sum is at least half of one.
      
      Fixes: 95bf15f3
      
       ("spi: fsl-dspi: Add ~50ns delay between cs and sck")
      Reported-by: default avatarLisa Chen (陈敏捷) <minjie.chen@geekplus.com>
      Debugged-by: default avatarLisa Chen (陈敏捷) <minjie.chen@geekplus.com>
      Tested-by: default avatarLisa Chen (陈敏捷) <minjie.chen@geekplus.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20230529223402.1199503-1-vladimir.oltean@nxp.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      af42c4fd
    • Li Zhijian's avatar
      RDMA/rtrs: Fix the last iu->buf leak in err path · cb6ec51d
      Li Zhijian authored
      [ Upstream commit 3bf3a7c6 ]
      
      The last iu->buf will leak if ib_dma_mapping_error() fails.
      
      Fixes: c0894b3e
      
       ("RDMA/rtrs: core: lib functions shared between client and server modules")
      Link: https://lore.kernel.org/r/1682384563-2-3-git-send-email-lizhijian@fujitsu.com
      Signed-off-by: default avatarLi Zhijian <lizhijian@fujitsu.com>
      Acked-by: default avatarGuoqing Jiang <guoqing.jiang@linux.dev>
      Acked-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cb6ec51d
    • Elson Roy Serrao's avatar
      usb: dwc3: gadget: Reset num TRBs before giving back the request · 26293251
      Elson Roy Serrao authored
      commit 00f8205f upstream.
      
      Consider a scenario where cable disconnect happens when there is an active
      usb reqest queued to the UDC. As part of the disconnect we would issue an
      end transfer with no interrupt-on-completion before giving back this
      request. Since we are giving back the request without skipping TRBs the
      num_trbs field of dwc3_request still holds the stale value previously used.
      Function drivers re-use same request for a given bind-unbind session and
      hence their dwc3_request context gets preserved across cable
      disconnect/connect. When such a request gets re-queued after cable connect,
      we would increase the num_trbs field on top of the previous stale value
      thus incorrectly representing the number of TRBs used. Fix this by
      resetting num_trbs field before giving back the request.
      
      Fixes: 09fe1f8d
      
       ("usb: dwc3: gadget: track number of TRBs per request")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarElson Roy Serrao <quic_eserrao@quicinc.com>
      Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Message-ID: <1685654850-8468-1-git-send-email-quic_eserrao@quicinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      26293251
    • Bernhard Seibold's avatar
      serial: lantiq: add missing interrupt ack · f4bc4169
      Bernhard Seibold authored
      commit 30632003 upstream.
      
      Currently, the error interrupt is never acknowledged, so once active it
      will stay active indefinitely, causing the handler to be called in an
      infinite loop.
      
      Fixes: 2f0fc415
      
       ("SERIAL: Lantiq: Add driver for MIPS Lantiq SOCs.")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarBernhard Seibold <mail@bernhard-seibold.de>
      Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Message-ID: <20230602133029.546-1-mail@bernhard-seibold.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4bc4169
    • Jerry Meng's avatar
      USB: serial: option: add Quectel EM061KGL series · 0b6e6501
      Jerry Meng authored
      commit f1832e2b
      
       upstream.
      
      Add support for Quectel EM061KGL series which are based on Qualcomm
      SDX12 chip:
      
      EM061KGL_LTA(0x2c7c / 0x0123): MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      EM061KGL_LMS(0x2c7c / 0x0124): MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      EM061KGL_LWW(0x2c7c / 0x6008): MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      EM061KGL_LCN(0x2c7c / 0x6009): MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      
      Above products use the exact same interface layout and
      option driver is for interfaces DIAG, NMEA and AT.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  5 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=6008 Rev= 5.04
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM061K-GL
      S:  SerialNumber=f6fa08b6
      C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
      E:  Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarJerry Meng <jerry-meng@foxmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b6e6501
    • Stephen Hemminger's avatar
      Remove DECnet support from kernel · 1c004b37
      Stephen Hemminger authored
      commit 1202cdd6
      
       upstream.
      
      DECnet is an obsolete network protocol that receives more attention
      from kernel janitors than users. It belongs in computer protocol
      history museum not in Linux kernel.
      
      It has been "Orphaned" in kernel since 2010. The iproute2 support
      for DECnet was dropped in 5.0 release. The documentation link on
      Sourceforge says it is abandoned there as well.
      
      Leave the UAPI alone to keep userspace programs compiling.
      This means that there is still an empty neighbour table
      for AF_DECNET.
      
      The table of /proc/sys/net entries was updated to match
      current directories and reformatted to be alphabetical.
      
      Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Acked-by: default avatarDavid Ahern <dsahern@kernel.org>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c004b37
    • Edson Juliano Drosdeck's avatar
      ALSA: hda/realtek: Add a quirk for Compaq N14JP6 · e9d38498
      Edson Juliano Drosdeck authored
      commit a2a87148
      
       upstream.
      
      Add a quirk for Compaq N14JP6 to fixup ALC897 headset MIC no sound.
      
      Signed-off-by: default avatarEdson Juliano Drosdeck <edson.drosdeck@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230609201058.523499-1-edson.drosdeck@gmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9d38498
    • Wes Huang's avatar
      net: usb: qmi_wwan: add support for Compal RXM-G1 · 1148d4ca
      Wes Huang authored
      commit 86319919
      
       upstream.
      
      Add support for Compal RXM-G1 which is based on Qualcomm SDX55 chip.
      This patch adds support for two compositions:
      
      0x9091: DIAG + MODEM + QMI_RMNET + ADB
      0x90db: DIAG + DUN + RMNET + DPL + QDSS(Trace) + ADB
      
      T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=05c6 ProdID=9091 Rev= 4.14
      S:  Manufacturer=QCOM
      S:  Product=SDXPRAIRIE-MTP _SN:719AB680
      S:  SerialNumber=719ab680
      C:* #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=896mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none)
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=84(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=05c6 ProdID=90db Rev= 4.14
      S:  Manufacturer=QCOM
      S:  Product=SDXPRAIRIE-MTP _SN:719AB680
      S:  SerialNumber=719ab680
      C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=896mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none)
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=84(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=8f(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarWes Huang <wes.huang@moxa.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/20230608030141.3546-1-wes.huang@moxa.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1148d4ca
    • Edward Srouji's avatar
      RDMA/uverbs: Restrict usage of privileged QKEYs · d7acfd52
      Edward Srouji authored
      commit 0cadb4db upstream.
      
      According to the IB specification rel-1.6, section 3.5.3:
      "QKEYs with the most significant bit set are considered controlled
      QKEYs, and a HCA does not allow a consumer to arbitrarily specify a
      controlled QKEY."
      
      Thus, block non-privileged users from setting such a QKEY.
      
      Cc: stable@vger.kernel.org
      Fixes: bc38a6ab
      
       ("[PATCH] IB uverbs: core implementation")
      Signed-off-by: default avatarEdward Srouji <edwards@nvidia.com>
      Link: https://lore.kernel.org/r/c00c809ddafaaf87d6f6cb827978670989a511b3.1685960567.git.leon@kernel.org
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7acfd52
    • Dave Airlie's avatar
      nouveau: fix client work fence deletion race · 96e14c91
      Dave Airlie authored
      commit c8a5d5ea upstream.
      
      This seems to have existed for ever but is now more apparant after
      commit 9bff18d1
      
       ("drm/ttm: use per BO cleanup workers")
      
      My analysis: two threads are running, one in the irq signalling the
      fence, in dma_fence_signal_timestamp_locked, it has done the
      DMA_FENCE_FLAG_SIGNALLED_BIT setting, but hasn't yet reached the
      callbacks.
      
      The second thread in nouveau_cli_work_ready, where it sees the fence is
      signalled, so then puts the fence, cleanups the object and frees the
      work item, which contains the callback.
      
      Thread one goes again and tries to call the callback and causes the
      use-after-free.
      
      Proposed fix: lock the fence signalled check in nouveau_cli_work_ready,
      so either the callbacks are done or the memory is freed.
      
      Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
      Fixes: 11e451e7
      
       ("drm/nouveau: remove fence wait code from deferred client work handler")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Link: https://lore.kernel.org/dri-devel/20230615024008.1600281-1-airlied@gmail.com/
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      96e14c91
    • Ricardo Ribalda's avatar
      powerpc/purgatory: remove PGO flags · f1f7117b
      Ricardo Ribalda authored
      commit 20188bac upstream.
      
      If profile-guided optimization is enabled, the purgatory ends up with
      multiple .text sections.  This is not supported by kexec and crashes the
      system.
      
      Link: https://lkml.kernel.org/r/20230321-kexec_clang16-v7-3-b05c520b7296@chromium.org
      Fixes: 93045705
      
       ("kernel/kexec_file.c: split up __kexec_load_puragory")
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: <stable@vger.kernel.org>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmer@rivosinc.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Philipp Rudo <prudo@redhat.com>
      Cc: Ross Zwisler <zwisler@google.com>
      Cc: Simon Horman <horms@kernel.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Rix <trix@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1f7117b
    • Ricardo Ribalda's avatar
      x86/purgatory: remove PGO flags · 26c80741
      Ricardo Ribalda authored
      commit 97b6b9cb upstream.
      
      If profile-guided optimization is enabled, the purgatory ends up with
      multiple .text sections.  This is not supported by kexec and crashes the
      system.
      
      Link: https://lkml.kernel.org/r/20230321-kexec_clang16-v7-2-b05c520b7296@chromium.org
      Fixes: 93045705
      
       ("kernel/kexec_file.c: split up __kexec_load_puragory")
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Cc: <stable@vger.kernel.org>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmer@rivosinc.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Philipp Rudo <prudo@redhat.com>
      Cc: Ross Zwisler <zwisler@google.com>
      Cc: Simon Horman <horms@kernel.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Rix <trix@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      26c80741
    • Ricardo Ribalda's avatar
      kexec: support purgatories with .text.hot sections · f368aed4
      Ricardo Ribalda authored
      commit 8652d44f upstream.
      
      Patch series "kexec: Fix kexec_file_load for llvm16 with PGO", v7.
      
      When upreving llvm I realised that kexec stopped working on my test
      platform.
      
      The reason seems to be that due to PGO there are multiple .text sections
      on the purgatory, and kexec does not supports that.
      
      
      This patch (of 4):
      
      Clang16 links the purgatory text in two sections when PGO is in use:
      
        [ 1] .text             PROGBITS         0000000000000000  00000040
             00000000000011a1  0000000000000000  AX       0     0     16
        [ 2] .rela.text        RELA             0000000000000000  00003498
             0000000000000648  0000000000000018   I      24     1     8
        ...
        [17] .text.hot.        PROGBITS         0000000000000000  00003220
             000000000000020b  0000000000000000  AX       0     0     1
        [18] .rela.text.hot.   RELA             0000000000000000  00004428
             0000000000000078  0000000000000018   I      24    17     8
      
      And both of them have their range [sh_addr ... sh_addr+sh_size] on the
      area pointed by `e_entry`.
      
      This causes that image->start is calculated twice, once for .text and
      another time for .text.hot. The second calculation leaves image->start
      in a random location.
      
      Because of this, the system crashes immediately after:
      
      kexec_core: Starting new kernel
      
      Link: https://lkml.kernel.org/r/20230321-kexec_clang16-v7-0-b05c520b7296@chromium.org
      Link: https://lkml.kernel.org/r/20230321-kexec_clang16-v7-1-b05c520b7296@chromium.org
      Fixes: 93045705
      
       ("kernel/kexec_file.c: split up __kexec_load_puragory")
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Reviewed-by: default avatarRoss Zwisler <zwisler@google.com>
      Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Reviewed-by: default avatarPhilipp Rudo <prudo@redhat.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmer@rivosinc.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Simon Horman <horms@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Rix <trix@redhat.com>
      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>
      f368aed4
    • Ryusuke Konishi's avatar
      nilfs2: fix possible out-of-bounds segment allocation in resize ioctl · 7e78b914
      Ryusuke Konishi authored
      commit fee5eaec upstream.
      
      Syzbot reports that in its stress test for resize ioctl, the log writing
      function nilfs_segctor_do_construct hits a WARN_ON in
      nilfs_segctor_truncate_segments().
      
      It turned out that there is a problem with the current implementation of
      the resize ioctl, which changes the writable range on the device (the
      range of allocatable segments) at the end of the resize process.
      
      This order is necessary for file system expansion to avoid corrupting the
      superblock at trailing edge.  However, in the case of a file system
      shrink, if log writes occur after truncating out-of-bounds trailing
      segments and before the resize is complete, segments may be allocated from
      the truncated space.
      
      The userspace resize tool was fine as it limits the range of allocatable
      segments before performing the resize, but it can run into this issue if
      the resize ioctl is called alone.
      
      Fix this issue by changing nilfs_sufile_resize() to update the range of
      allocatable segments immediately after successful truncation of segment
      space in case of file system shrink.
      
      Link: https://lkml.kernel.org/r/20230524094348.3784-1-konishi.ryusuke@gmail.com
      Fixes: 4e33f9ea
      
       ("nilfs2: implement resize ioctl")
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+33494cd0df2ec2931851@syzkaller.appspotmail.com>
      Closes: https://lkml.kernel.org/r/0000000000005434c405fbbafdc5@google.com
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      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>
      7e78b914
    • Ryusuke Konishi's avatar
      nilfs2: fix incomplete buffer cleanup in nilfs_btnode_abort_change_key() · 902fcec0
      Ryusuke Konishi authored
      commit 2f012f2b
      
       upstream.
      
      A syzbot fault injection test reported that nilfs_btnode_create_block, a
      helper function that allocates a new node block for b-trees, causes a
      kernel BUG for disk images where the file system block size is smaller
      than the page size.
      
      This was due to unexpected flags on the newly allocated buffer head, and
      it turned out to be because the buffer flags were not cleared by
      nilfs_btnode_abort_change_key() after an error occurred during a b-tree
      update operation and the buffer was later reused in that state.
      
      Fix this issue by using nilfs_btnode_delete() to abandon the unused
      preallocated buffer in nilfs_btnode_abort_change_key().
      
      Link: https://lkml.kernel.org/r/20230513102428.10223-1-konishi.ryusuke@gmail.com
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+b0a35a5c1f7e846d3b09@syzkaller.appspotmail.com>
      Closes: https://lkml.kernel.org/r/000000000000d1d6c205ebc4d512@google.com
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      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>
      902fcec0
    • Janne Grunau's avatar
      nios2: dts: Fix tse_mac "max-frame-size" property · d59293f0
      Janne Grunau authored
      commit 85041e12 upstream.
      
      The given value of 1518 seems to refer to the layer 2 ethernet frame
      size without 802.1Q tag. Actual use of the "max-frame-size" including in
      the consumer of the "altr,tse-1.0" compatible is the MTU.
      
      Fixes: 95acd4c7 ("nios2: Device tree support")
      Fixes: 61c610ec
      
       ("nios2: Add Max10 device tree")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJanne Grunau <j@jannau.net>
      Signed-off-by: default avatarDinh Nguyen <dinguyen@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d59293f0
    • Luís Henriques's avatar
      ocfs2: check new file size on fallocate call · 2847d9ee
      Luís Henriques authored
      commit 26a6ffff
      
       upstream.
      
      When changing a file size with fallocate() the new size isn't being
      checked.  In particular, the FSIZE ulimit isn't being checked, which makes
      fstest generic/228 fail.  Simply adding a call to inode_newsize_ok() fixes
      this issue.
      
      Link: https://lkml.kernel.org/r/20230529152645.32680-1-lhenriques@suse.de
      Signed-off-by: default avatarLuís Henriques <lhenriques@suse.de>
      Reviewed-by: default avatarMark Fasheh <mark@fasheh.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      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>
      2847d9ee
    • Luís Henriques's avatar
      ocfs2: fix use-after-free when unmounting read-only filesystem · e73b135f
      Luís Henriques authored
      commit 50d92788
      
       upstream.
      
      It's trivial to trigger a use-after-free bug in the ocfs2 quotas code using
      fstest generic/452.  After a read-only remount, quotas are suspended and
      ocfs2_mem_dqinfo is freed through ->ocfs2_local_free_info().  When unmounting
      the filesystem, an UAF access to the oinfo will eventually cause a crash.
      
      BUG: KASAN: slab-use-after-free in timer_delete+0x54/0xc0
      Read of size 8 at addr ffff8880389a8208 by task umount/669
      ...
      Call Trace:
       <TASK>
       ...
       timer_delete+0x54/0xc0
       try_to_grab_pending+0x31/0x230
       __cancel_work_timer+0x6c/0x270
       ocfs2_disable_quotas.isra.0+0x3e/0xf0 [ocfs2]
       ocfs2_dismount_volume+0xdd/0x450 [ocfs2]
       generic_shutdown_super+0xaa/0x280
       kill_block_super+0x46/0x70
       deactivate_locked_super+0x4d/0xb0
       cleanup_mnt+0x135/0x1f0
       ...
       </TASK>
      
      Allocated by task 632:
       kasan_save_stack+0x1c/0x40
       kasan_set_track+0x21/0x30
       __kasan_kmalloc+0x8b/0x90
       ocfs2_local_read_info+0xe3/0x9a0 [ocfs2]
       dquot_load_quota_sb+0x34b/0x680
       dquot_load_quota_inode+0xfe/0x1a0
       ocfs2_enable_quotas+0x190/0x2f0 [ocfs2]
       ocfs2_fill_super+0x14ef/0x2120 [ocfs2]
       mount_bdev+0x1be/0x200
       legacy_get_tree+0x6c/0xb0
       vfs_get_tree+0x3e/0x110
       path_mount+0xa90/0xe10
       __x64_sys_mount+0x16f/0x1a0
       do_syscall_64+0x43/0x90
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      Freed by task 650:
       kasan_save_stack+0x1c/0x40
       kasan_set_track+0x21/0x30
       kasan_save_free_info+0x2a/0x50
       __kasan_slab_free+0xf9/0x150
       __kmem_cache_free+0x89/0x180
       ocfs2_local_free_info+0x2ba/0x3f0 [ocfs2]
       dquot_disable+0x35f/0xa70
       ocfs2_susp_quotas.isra.0+0x159/0x1a0 [ocfs2]
       ocfs2_remount+0x150/0x580 [ocfs2]
       reconfigure_super+0x1a5/0x3a0
       path_mount+0xc8a/0xe10
       __x64_sys_mount+0x16f/0x1a0
       do_syscall_64+0x43/0x90
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      Link: https://lkml.kernel.org/r/20230522102112.9031-1-lhenriques@suse.de
      Signed-off-by: default avatarLuís Henriques <lhenriques@suse.de>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Tested-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      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>
      e73b135f
    • Benjamin Segall's avatar
      epoll: ep_autoremove_wake_function should use list_del_init_careful · 370f5d98
      Benjamin Segall authored
      commit 2192bba0 upstream.
      
      autoremove_wake_function uses list_del_init_careful, so should epoll's
      more aggressive variant.  It only doesn't because it was copied from an
      older wait.c rather than the most recent.
      
      [bsegall@google.com: add comment]
        Link: https://lkml.kernel.org/r/xm26bki0ulsr.fsf_-_@google.com
      Link: https://lkml.kernel.org/r/xm26pm6hvfer.fsf@google.com
      Fixes: a16ceb13
      
       ("epoll: autoremove wakers even more aggressively")
      Signed-off-by: default avatarBen Segall <bsegall@google.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christian Brauner <brauner@kernel.org>
      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>
      370f5d98
    • Jens Axboe's avatar
      io_uring: hold uring mutex around poll removal · 4716c73b
      Jens Axboe authored
      Snipped from commit 9ca9fb24
      
       upstream.
      
      While reworking the poll hashing in the v6.0 kernel, we ended up
      grabbing the ctx->uring_lock in poll update/removal. This also fixed
      a bug with linked timeouts racing with timeout expiry and poll
      removal.
      
      Bring back just the locking fix for that.
      
      Reported-and-tested-by: default avatarQuerijn Voet <querijnqyn@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4716c73b
    • Marc Zyngier's avatar
      irqchip/gic: Correctly validate OF quirk descriptors · 93a68acc
      Marc Zyngier authored
      [ Upstream commit 91539341
      
       ]
      
      When checking for OF quirks, make sure either 'compatible' or 'property'
      is set, and give up otherwise.
      
      This avoids non-OF quirks being randomly applied as they don't have any
      of the OF data that need checking.
      
      Cc: Douglas Anderson <dianders@chromium.org>
      Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Fixes: 44bd78dd
      
       ("irqchip/gic-v3: Disable pseudo NMIs on Mediatek devices w/ firmware issues")
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      93a68acc
    • Sukrut Bellary's avatar
      drm:amd:amdgpu: Fix missing buffer object unlock in failure path · 2a2641a8
      Sukrut Bellary authored
      [ Upstream commit 60ecaaf5
      
       ]
      
      smatch warning -
      1) drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:3615 gfx_v9_0_kiq_resume()
      warn: inconsistent returns 'ring->mqd_obj->tbo.base.resv'.
      
      2) drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:6901 gfx_v10_0_kiq_resume()
      warn: inconsistent returns 'ring->mqd_obj->tbo.base.resv'.
      
      Signed-off-by: default avatarSukrut Bellary <sukrut.bellary@linux.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2a2641a8