5.4.273-rc1 review
Subsystems (3)
Sasha Levin
maintainerPATCH 152/183 ALSA: usb-audio: Stop parsing channels bits when all channels are found.
In reply to Sasha LevinFrom: Johan Carlsson <[email protected]>
[ Upstream commit a39d51ff1f52cd0b6fe7d379ac93bd8b4237d1b7 ]
If a usb audio device sets more bits than the amount of channels it could write outside of the map array.
Message-ID: <[email protected]>
--- sound/usb/stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/usb/stream.c +4 -1
@@ -301,9 +301,12 @@ static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits, c =0 ;if (bits) { -for (; bits && *maps; maps++, bits >>=1 ) +for (; bits && *maps; maps++, bits >>=1 ) {if (bits &1 ) chmap->map[c++] = *maps; +if (c == chmap->channels) +break ; + } }else {/* If we're missing wChannelConfig, then guess something to make sure the channel map is not skipped entirely */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 153/183 scsi: csiostor: Avoid function pointer casts
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 9f3dbcb5632d6876226031d552ef6163bb3ad215 ]
csiostor uses function pointer casts to keep the csio_ln_ev state machine hidden, but this causes warnings about control flow integrity (KCFI) violations in clang-16 and higher:
drivers/scsi/csiostor/csio_lnode.c:1098:33: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1098 | return (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_ready));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1369:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1369 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_uninit)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1373:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1373 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_ready)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1377:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1377 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_offline)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Move the enum into a shared header so the correct types can be used without the need for casts.
--- drivers/scsi/csiostor/csio_defs.h | 18 ++++++++++++++++-- drivers/scsi/csiostor/csio_lnode.c | 8 ++++---- drivers/scsi/csiostor/csio_lnode.h | 13 ------------- 3 files changed, 20 insertions(+), 19 deletions(-)
drivers/scsi/csiostor/csio_defs.h +16 -2
@@ -73,7 +73,21 @@ csio_list_deleted(struct list_head *list)#define csio_list_prev (elem) (((struct list_head *)(elem))->prev)/* State machine */ -typedef void (*csio_sm_state_t )(void *,uint32_t ); +struct csio_lnode ; + +/* State machine evets */ +enum csio_ln_ev { +CSIO_LNE_NONE = (uint32_t )0 , +CSIO_LNE_LINKUP , +CSIO_LNE_FAB_INIT_DONE , +CSIO_LNE_LINK_DOWN , +CSIO_LNE_DOWN_LINK , +CSIO_LNE_LOGO , +CSIO_LNE_CLOSE , +CSIO_LNE_MAX_EVENT , +}; + +typedef void (*csio_sm_state_t )(struct csio_lnode *ln,enum csio_ln_ev evt);struct csio_sm {struct list_head sm_list;
@@ -83,7 +97,7 @@ struct csio_sm {static inline void csio_set_state (void *smp,void *state) { - ((struct csio_sm *)smp)->sm_state = (csio_sm_state_t )state; + ((struct csio_sm *)smp)->sm_state = state; } static inline void
drivers/scsi/csiostor/csio_lnode.c +4 -4
@@ -1095,7 +1095,7 @@ csio_handle_link_down(struct csio_hw *hw, uint8_t portid, uint32_t fcfi,int csio_is_lnode_ready (struct csio_lnode *ln) { -return (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_ready)); +return (csio_get_state (ln) == csio_lns_ready); }/*****************************************************************************/
@@ -1367,15 +1367,15 @@ csio_free_fcfinfo(struct kref *kref)void csio_lnode_state_to_str (struct csio_lnode *ln,int8_t *str) { -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_uninit)) { +if (csio_get_state (ln) == csio_lns_uninit) {strcpy (str,"UNINIT" );return ; } -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_ready)) { +if (csio_get_state (ln) == csio_lns_ready) {strcpy (str,"READY" );return ; } -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_offline)) { +if (csio_get_state (ln) == csio_lns_offline) {strcpy (str,"OFFLINE" );return ; }
drivers/scsi/csiostor/csio_lnode.h +0 -13
@@ -53,19 +53,6 @@extern int csio_fcoe_rnodes;extern int csio_fdmi_enable; -/* State machine evets */ -enum csio_ln_ev { -CSIO_LNE_NONE = (uint32_t )0 , -CSIO_LNE_LINKUP , -CSIO_LNE_FAB_INIT_DONE , -CSIO_LNE_LINK_DOWN , -CSIO_LNE_DOWN_LINK , -CSIO_LNE_LOGO , -CSIO_LNE_CLOSE , -CSIO_LNE_MAX_EVENT , -}; - -struct csio_fcf_info {struct list_head list;uint8_t priority;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 154/183 RDMA/device: Fix a race between mad_client and cm_client init
In reply to Sasha LevinFrom: Shifeng Li <[email protected]>
[ Upstream commit 7a8bccd8b29c321ac181369b42b04fecf05f98e2 ]
The mad_client will be initialized in enable_device_and_get(), while the devices_rwsem will be downgraded to a read semaphore. There is a window that leads to the failed initialization for cm_client, since it can not get matched mad port from ib_mad_port_list, and the matched mad port will be added to the list after that.
mad_client | cm_client ------------------|-------------------------------------------------------- ib_register_device|
enable_device_and_getdown_write(&devices_rwsem)xa_set_mark(&devices, DEVICE_REGISTERED)downgrade_write(&devices_rwsem)
|
|ib_cm_init
|ib_register_client(&cm_client)
|down_read(&devices_rwsem)
|xa_for_each_marked (&devices, DEVICE_REGISTERED)
|add_client_context
|cm_add_one
|ib_register_mad_agent
|ib_get_mad_port
|__ib_get_mad_port
|list_for_each_entry(entry, &ib_mad_port_list, port_list)
|return NULL
|up_read(&devices_rwsem)
|
add_client_context|
ib_mad_init_device|
ib_mad_port_open |
list_add_tail(&port_priv->port_list, &ib_mad_port_list)
up_read(&devices_rwsem)
|Fix it by using down_write(&devices_rwsem) in ib_register_client().
--- drivers/infiniband/core/device.c | 37 +++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-)
drivers/infiniband/core/device.c +22 -15
@@ -1700,7 +1700,7 @@ static int assign_client_id(struct ib_client *client) {int ret; -down_write (&clients_rwsem); +lockdep_assert_held (&clients_rwsem);/* * The add/remove callbacks must be called in FIFO/LIFO order. To * achieve this we assign client_ids so they are sorted in
@@ -1709,14 +1709,11 @@ static int assign_client_id(struct ib_client *client) client->client_id = highest_client_id; ret =xa_insert (&clients, client->client_id, client,GFP_KERNEL );if (ret) - goto out; +return ret; highest_client_id++;xa_set_mark (&clients, client->client_id,CLIENT_REGISTERED ); - -out: -up_write (&clients_rwsem); -return ret; +return 0 ; }static void remove_client_id (struct ib_client *client)
@@ -1746,25 +1743,35 @@ int ib_register_client(struct ib_client *client) {struct ib_device *device;unsigned long index; +bool need_unreg = false;int ret;refcount_set (&client->uses,1 );init_completion (&client->uses_zero); + +/* +* The devices_rwsem is held in write mode to ensure that a racing +* ib_register_device() sees a consisent view of clients and devices. +*/ +down_write (&devices_rwsem); +down_write (&clients_rwsem); ret =assign_client_id (client);if (ret) -return ret; + goto out; -down_read (&devices_rwsem); + need_unreg = true; xa_for_each_marked (&devices, index, device, DEVICE_REGISTERED) { ret =add_client_context (device, client); -if (ret) { -up_read (&devices_rwsem); -ib_unregister_client (client); -return ret; - } +if (ret) + goto out; } -up_read (&devices_rwsem); -return 0 ; + ret =0 ; +out: +up_write (&clients_rwsem); +up_write (&devices_rwsem); +if (need_unreg && ret) +ib_unregister_client (client); +return ret; }EXPORT_SYMBOL (ib_register_client);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 155/183 scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit b69600231f751304db914c63b937f7098ed2895c ]
Some callback functions used here take a boolean argument, others take a status argument. This breaks KCFI type checking, so clang now warns about the function pointer cast:
drivers/scsi/bfa/bfad_bsg.c:2138:29: error: cast from 'void (*)(void *, enum bfa_status)' to 'bfa_cb_cbfn_t' (aka 'void (*)(void *, enum bfa_boolean)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
Assuming the code is actually correct here and the callers always match the argument types of the callee, rework this to replace the explicit cast with a union of the two pointer types. This does not change the behavior of the code, so if something is actually broken here, a larger rework may be necessary.
--- drivers/scsi/bfa/bfa.h | 9 ++++++++- drivers/scsi/bfa/bfa_core.c | 4 +--- drivers/scsi/bfa/bfa_ioc.h | 8 ++++++-- drivers/scsi/bfa/bfad_bsg.c | 11 ++++------- 4 files changed, 19 insertions(+), 13 deletions(-)
drivers/scsi/bfa/bfa.h +8 -1
@@ -20,7 +20,6 @@struct bfa_s ;typedef void (*bfa_isr_func_t ) (struct bfa_s *bfa,struct bfi_msg_s *m); -typedef void (*bfa_cb_cbfn_status_t ) (void *cbarg,bfa_status_t status);/* * Interrupt message handlers
@@ -437,4 +436,12 @@ struct bfa_cb_pending_q_s { (__qe)->data = (__data); \ } while (0) +#define bfa_pending_q_init_status (__qe, __cbfn, __cbarg, __data) do { \ + bfa_q_qe_init(&((__qe)->hcb_qe.qe)); \ + (__qe)->hcb_qe.cbfn_status = (__cbfn); \ + (__qe)->hcb_qe.cbarg = (__cbarg); \ + (__qe)->hcb_qe.pre_rmv = BFA_TRUE; \ + (__qe)->data = (__data); \ +} while (0) +#endif /* __BFA_H__ */
drivers/scsi/bfa/bfa_core.c +1 -3
@@ -1907,15 +1907,13 @@ bfa_comp_process(struct bfa_s *bfa, struct list_head *comp_q)struct list_head *qe;struct list_head *qen;struct bfa_cb_qe_s *hcb_qe; -bfa_cb_cbfn_status_t cbfn;list_for_each_safe (qe, qen, comp_q) { hcb_qe = (struct bfa_cb_qe_s *) qe;if (hcb_qe->pre_rmv) {/* qe is invalid after return, dequeue before cbfn() */ list_del (qe); - cbfn = (bfa_cb_cbfn_status_t)(hcb_qe->cbfn); -cbfn (hcb_qe->cbarg, hcb_qe->fw_status); + hcb_qe->cbfn_status (hcb_qe->cbarg, hcb_qe->fw_status); }else hcb_qe->cbfn (hcb_qe->cbarg,BFA_TRUE ); }
drivers/scsi/bfa/bfa_ioc.h +6 -2
@@ -361,14 +361,18 @@ struct bfa_reqq_wait_s {void *cbarg; }; -typedef void (*bfa_cb_cbfn_t ) (void *cbarg,bfa_boolean_t complete); +typedef void (*bfa_cb_cbfn_t ) (void *cbarg,bfa_boolean_t complete); +typedef void (*bfa_cb_cbfn_status_t ) (void *cbarg,bfa_status_t status);/* * Generic BFA callback element. */ struct bfa_cb_qe_s {struct list_head qe; -bfa_cb_cbfn_t cbfn; +union { +bfa_cb_cbfn_status_t cbfn_status; +bfa_cb_cbfn_t cbfn; + };bfa_boolean_t once;bfa_boolean_t pre_rmv;/* set for stack based qe(s) */ bfa_status_t fw_status;/* to access fw status in comp proc */
drivers/scsi/bfa/bfad_bsg.c +4 -7
@@ -2135,8 +2135,7 @@ bfad_iocmd_fcport_get_stats(struct bfad_s *bfad, void *cmd)struct bfa_cb_pending_q_s cb_qe;init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp, &iocmd->stats); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp, &iocmd->stats);spin_lock_irqsave (&bfad->bfad_lock, flags); iocmd->status =bfa_fcport_get_stats (&bfad->bfa, &cb_qe);spin_unlock_irqrestore (&bfad->bfad_lock, flags);
@@ -2159,7 +2158,7 @@ bfad_iocmd_fcport_reset_stats(struct bfad_s *bfad, void *cmd)struct bfa_cb_pending_q_s cb_qe;init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, &fcomp,NULL ); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp,NULL );spin_lock_irqsave (&bfad->bfad_lock, flags); iocmd->status =bfa_fcport_clear_stats (&bfad->bfa, &cb_qe);
@@ -2443,8 +2442,7 @@ bfad_iocmd_qos_get_stats(struct bfad_s *bfad, void *cmd)struct bfa_fcport_s *fcport =BFA_FCPORT_MOD (&bfad->bfa);init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp, &iocmd->stats); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp, &iocmd->stats);spin_lock_irqsave (&bfad->bfad_lock, flags);WARN_ON (!bfa_ioc_get_fcmode (&bfad->bfa.ioc));
@@ -2474,8 +2472,7 @@ bfad_iocmd_qos_reset_stats(struct bfad_s *bfad, void *cmd)struct bfa_fcport_s *fcport =BFA_FCPORT_MOD (&bfad->bfa);init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp,NULL ); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp,NULL );spin_lock_irqsave (&bfad->bfad_lock, flags);WARN_ON (!bfa_ioc_get_fcmode (&bfad->bfa.ioc));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 156/183 net: sunrpc: Fix an off by one in rpc_sockaddr2uaddr()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d6f4de70f73a106986ee315d7d512539f2f3303a ]
The intent is to check if the strings' are truncated or not. So, >= should be used instead of >, because strlcat() and snprintf() return the length of the output, excluding the trailing NULL.
--- net/sunrpc/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/addr.c +2 -2
@@ -288,10 +288,10 @@ char *rpc_sockaddr2uaddr(const struct sockaddr *sap, gfp_t gfp_flags) }if (snprintf (portbuf,sizeof (portbuf), -".%u.%u" , port >>8 , port &0xff ) > (int )sizeof (portbuf)) +".%u.%u" , port >>8 , port &0xff ) >= (int )sizeof (portbuf))return NULL ; -if (strlcat (addrbuf, portbuf,sizeof (addrbuf)) >sizeof (addrbuf)) +if (strlcat (addrbuf, portbuf,sizeof (addrbuf)) >=sizeof (addrbuf))return NULL ;return kstrdup (addrbuf, gfp_flags);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 157/183 watchdog: stm32_iwdg: initialize default timeout
In reply to Sasha LevinFrom: Ben Wolsieffer <[email protected]>
[ Upstream commit dbd7c0088b7f44aa0b9276ed3449df075a7b5b54 ]
The driver never sets a default timeout value, therefore it is initialized to zero. When CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is enabled, the watchdog is started during probe. The kernel is supposed to automatically ping the watchdog from this point until userspace takes over, but this does not happen if the configured timeout is zero. A zero timeout causes watchdog_need_worker() to return false, so the heartbeat worker does not run and the system therefore resets soon after the driver is probed.
This patch fixes this by setting an arbitrary non-zero default timeout. The default could be read from the hardware instead, but I didn't see any reason to add this complexity.
This has been tested on an STM32F746.
--- drivers/watchdog/stm32_iwdg.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/watchdog/stm32_iwdg.c +3 -0
@@ -21,6 +21,8 @@#include <linux/platform_device.h> #include <linux/watchdog.h> +#define DEFAULT_TIMEOUT 10 +/* IWDG registers */ #define IWDG_KR 0x00/* Key register */ #define IWDG_PR 0x04/* Prescaler Register */
@@ -254,6 +256,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev) wdd->parent = dev; wdd->info = &stm32_iwdg_info; wdd->ops = &stm32_iwdg_ops; + wdd->timeout =DEFAULT_TIMEOUT ; wdd->min_timeout =DIV_ROUND_UP ((RLR_MIN +1 ) *PR_MIN , wdt->rate); wdd->max_hw_heartbeat_ms = ((RLR_MAX +1 ) * wdt->data->max_prescaler *1000 ) / wdt->rate;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 158/183 NFS: Fix an off by one in root_nfs_cat()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 698ad1a538da0b6bf969cfee630b4e3a026afb87 ]
The intent is to check if 'dest' is truncated or not. So, >= should be used instead of >, because strlcat() returns the length of 'dest' and 'src' excluding the trailing NULL.
--- fs/nfs/nfsroot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfsroot.c +2 -2
@@ -169,10 +169,10 @@ static int __init root_nfs_cat(char *dest, const char *src,size_t len =strlen (dest);if (len && dest[len -1 ] !=',' ) -if (strlcat (dest,"," , destlen) > destlen) +if (strlcat (dest,"," , destlen) >= destlen)return -1 ; -if (strlcat (dest, src, destlen) > destlen) +if (strlcat (dest, src, destlen) >= destlen)return -1 ;return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 159/183 afs: Revert "afs: Hide silly-rename files from userspace"
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 0aec3847d044273733285dcff90afda89ad461d2 ]
This reverts commit 57e9d49c54528c49b8bffe6d99d782ea051ea534.
This undoes the hiding of .__afsXXXX silly-rename files. The problem with hiding them is that rm can't then manually delete them.
This also reverts commit 5f7a07646655fb4108da527565dcdc80124b14c4 ("afs: Fix endless loop in directory parsing") as that's a bugfix for the above.
--- fs/afs/dir.c | 10 ---------- 1 file changed, 10 deletions(-)
fs/afs/dir.c +0 -10
@@ -421,16 +421,6 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode,continue ; } -/* Don't expose silly rename entries to userspace. */ -if (nlen >6 && - dire->u.name[0 ] =='.' && - ctx->actor != afs_lookup_filldir && - ctx->actor != afs_lookup_one_filldir && -memcmp (dire->u.name,".__afs" ,6 ) ==0 ) { - ctx->pos = blkoff + next *sizeof (union afs_xdr_dirent ); -continue ; - } -/* found the next entry */ if (!dir_emit(ctx, dire->u.name, nlen, ntohl(dire->u.vnode),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 160/183 usb: phy: generic: Get the vbus supply
In reply to Sasha LevinFrom: Sean Anderson <[email protected]>
[ Upstream commit 03e607cbb2931374db1825f371e9c7f28526d3f4 ]
While support for working with a vbus was added, the regulator was never actually gotten (despite what was documented). Fix this by actually getting the supply from the device tree.
--- drivers/usb/phy/phy-generic.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/phy/phy-generic.c +7 -0
@@ -283,6 +283,13 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,return -EPROBE_DEFER ; } + nop->vbus_draw =devm_regulator_get_exclusive (dev,"vbus" ); +if (PTR_ERR (nop->vbus_draw) == -ENODEV ) + nop->vbus_draw =NULL ; +if (IS_ERR (nop->vbus_draw)) +return dev_err_probe (dev,PTR_ERR (nop->vbus_draw), +"could not get vbus regulator\n" ); + nop->dev = dev; nop->phy.dev = nop->dev; nop->phy.label ="nop-xceiv" ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 161/183 tty: vt: fix 20 vs 0x20 typo in EScsiignore
In reply to Sasha LevinFrom: "Jiri Slaby (SUSE)" <[email protected]>
[ Upstream commit 0e6a92f67c8a94707f7bb27ac29e2bdf3e7c167d ]
The if (c >= 20 && c <= 0x3f) test added in commit 7a99565f8732 is wrong. 20 is DC4 in ascii and it makes no sense to consider that as the bottom limit. Instead, it should be 0x20 as in the other test in the commit above. This is supposed to NOT change anything as we handle interesting 20-0x20 asciis far before this if.
So for sakeness, change to 0x20 (which is SPACE).
--- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/vt/vt.c +1 -1
@@ -2508,7 +2508,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) }return ;case EScsiignore: -if (c >=20 && c <=0x3f ) +if (c >=0x20 && c <=0x3f )return ; vc->vc_state = ESnormal;return ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 162/183 serial: max310x: fix syntax error in IRQ error message
In reply to Sasha LevinFrom: Hugo Villeneuve <[email protected]>
[ Upstream commit 8ede8c6f474255b2213cccd7997b993272a8e2f9 ]
Replace g with q.
Helpful when grepping thru source code or logs for "request" keyword.
--- drivers/tty/serial/max310x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/max310x.c +1 -1
@@ -1460,7 +1460,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devtyif (!ret)return 0 ; -dev_err (dev,"Unable to reguest IRQ %i\n" , irq); +dev_err (dev,"Unable to request IRQ %i\n" , irq); out_uart:for (i =0 ; i < devtype->nr; i++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 163/183 tty: serial: samsung: fix tx_empty() to return TIOCSER_TEMT
In reply to Sasha LevinFrom: Tudor Ambarus <[email protected]>
[ Upstream commit 314c2b399288f0058a8c5b6683292cbde5f1531b ]
The core expects for tx_empty() either TIOCSER_TEMT when the tx is empty or 0 otherwise. s3c24xx_serial_txempty_nofifo() might return 0x4, and at least uart_get_lsr_info() tries to clear exactly TIOCSER_TEMT (BIT(1)). Fix tx_empty() to return TIOCSER_TEMT.
--- drivers/tty/serial/samsung.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/samsung.c +2 -3
@@ -800,11 +800,10 @@ static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port)if ((ufstat & info->tx_fifomask) !=0 || (ufstat & info->tx_fifofull))return 0 ; - -return 1 ; +return TIOCSER_TEMT ; } -return s3c24xx_serial_txempty_nofifo (port); +return s3c24xx_serial_txempty_nofifo (port) ?TIOCSER_TEMT :0 ; }/* no modem control lines */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 164/183 kconfig: fix infinite loop when expanding a macro at the end of file
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit af8bbce92044dc58e4cc039ab94ee5d470a621f5 ]
A macro placed at the end of a file with no newline causes an infinite loop.
[Test Kconfig]
$(info,hello)
\ No newline at end of file
I realized that flex-provided input() returns 0 instead of EOF when it reaches the end of a file.
--- scripts/kconfig/lexer.l | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
scripts/kconfig/lexer.l +5 -2
@@ -305,8 +305,11 @@ static char *expand_token(const char *in, size_t n) new_string(); append_string(in, n); - /* get the whole line because we do not know the end of token. */ - while ((c = input()) != EOF) { + /* + * get the whole line because we do not know the end of token. + * input() returns 0 (not EOF!) when it reachs the end of file. + */ + while ((c = input()) != 0) { if (c == '\n') { unput(c); break;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 165/183 rtc: mt6397: select IRQ_DOMAIN instead of depending on it
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 544c42f798e1651dcb04fb0395219bf0f1c2607e ]
IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set it directly thru "make *config", so drivers should select it instead of depending on it if they need it.
Relying on it being set for a dependency is risky.
Consistently using "select" or "depends on" can also help reduce Kconfig circular dependency issues.
Therefore, change the use of "depends on" for IRQ_DOMAIN to "select" for RTC_DRV_MT6397.
--- drivers/rtc/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/rtc/Kconfig +2 -1
@@ -1811,7 +1811,8 @@ config RTC_DRV_MOXART config RTC_DRV_MT6397 tristate "MediaTek PMIC based RTC" - depends on MFD_MT6397 || (COMPILE_TEST && IRQ_DOMAIN) + depends on MFD_MT6397 || COMPILE_TEST + select IRQ_DOMAIN help This selects the MediaTek(R) RTC driver. RTC is part of MediaTek MT6397 PMIC. You should enable MT6397 PMIC MFD before select
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 166/183 serial: 8250_exar: Don't remove GPIO device on suspend
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 73b5a5c00be39e23b194bad10e1ea8bb73eee176 ]
It seems a copy&paste mistake that suspend callback removes the GPIO device. There is no counterpart of this action, means once suspended there is no more GPIO device available untile full unbind-bind cycle is performed. Remove suspicious GPIO device removal in suspend.
--- drivers/tty/serial/8250/8250_exar.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/tty/serial/8250/8250_exar.c +1 -4
@@ -639,6 +639,7 @@ static void exar_pci_remove(struct pci_dev *pcidev)for (i =0 ; i < priv->nr; i++)serial8250_unregister_port (priv->line[i]); +/* Ensure that every init quirk is properly torn down */ if (priv->board->exit) priv->board->exit (pcidev); }
@@ -653,10 +654,6 @@ static int __maybe_unused exar_suspend(struct device *dev)if (priv->line[i] >=0 )serial8250_suspend_port (priv->line[i]); -/* Ensure that every init quirk is properly torn down */ -if (priv->board->exit) - priv->board->exit (pcidev); -return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 167/183 staging: greybus: fix get_channel_from_mode() failure path
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 34164202a5827f60a203ca9acaf2d9f7d432aac8 ]
The get_channel_from_mode() function is supposed to return the channel which matches the mode. But it has a bug where if it doesn't find a matching channel then it returns the last channel. It should return NULL instead.
Also remove an unnecessary NULL check on "channel".
--- drivers/staging/greybus/light.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/greybus/light.c +4 -4
@@ -100,15 +100,15 @@ static struct led_classdev *get_channel_cdev(struct gb_channel *channel)static struct gb_channel *get_channel_from_mode (struct gb_light *light,u32 mode) { -struct gb_channel *channel =NULL ; +struct gb_channel *channel;int i;for (i =0 ; i < light->channels_count; i++) { channel = &light->channels[i]; -if (channel && channel->mode == mode) -break ; +if (channel->mode == mode) +return channel; } -return channel; +return NULL ; } static int __gb_lights_flash_intensity_set(struct gb_channel *channel,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 168/183 usb: gadget: net2272: Use irqflags in the call to net2272_probe_fin
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 600556809f04eb3bbccd05218215dcd7b285a9a9 ]
Currently the variable irqflags is being set but is not being used, it appears it should be used in the call to net2272_probe_fin rather than IRQF_TRIGGER_LOW being used. Kudos to Uwe Kleine-König for suggesting the fix.
Cleans up clang scan build warning:drivers/usb/gadget/udc/net2272.c:2610:15: warning: variable 'irqflags' set but not used [-Wunused-but-set-variable]
--- drivers/usb/gadget/udc/net2272.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/net2272.c +1 -1
@@ -2632,7 +2632,7 @@ net2272_plat_probe(struct platform_device *pdev) goto err_req; } - ret =net2272_probe_fin (dev,IRQF_TRIGGER_LOW ); + ret =net2272_probe_fin (dev, irqflags);if (ret) goto err_io;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 169/183 octeontx2-af: Use matching wake_up API variant in CGX command interface
In reply to Sasha LevinFrom: Linu Cherian <[email protected]>
[ Upstream commit e642921dfeed1e15e73f78f2c3b6746f72b6deb2 ]
Use wake_up API instead of wake_up_interruptible, since wait_event_timeout API is used for waiting on command completion.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +1 -1
@@ -582,7 +582,7 @@ static irqreturn_t cgx_fwi_event_handler(int irq, void *data)/* Release thread waiting for completion */ lmac->cmd_pend = false; -wake_up_interruptible (&lmac->wq_cmd_cmplt); +wake_up (&lmac->wq_cmd_cmplt);break ;case CGX_EVT_ASYNC :if (cgx_event_is_linkevent (event))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 170/183 s390/vtime: fix average steal time calculation
In reply to Sasha LevinFrom: Mete Durlu <[email protected]>
[ Upstream commit 367c50f78451d3bd7ad70bc5c89f9ba6dec46ca9 ]
Current average steal timer calculation produces volatile and inflated values. The only user of this value is KVM so far and it uses that to decide whether or not to yield the vCPU which is seeing steal time. KVM compares average steal timer to a threshold and if the threshold is past then it does not allow CPU polling and yields it to host, else it keeps the CPU by polling.
Since KVM's steal time threshold is very low by default (%10) it most likely is not effected much by the bloated average steal timer values because the operating region is pretty small. However there might be new users in the future who might rely on this number. Fix average steal timer calculation by changing the formula from:
avg_steal_timer = avg_steal_timer / 2 + steal_timer;
to the following:
avg_steal_timer = (avg_steal_timer + steal_timer) / 2;
This ensures that avg_steal_timer is actually a naive average of steal timer values. It now closely follows steal timer values but of course in a smoother manner.
--- arch/s390/kernel/vtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/vtime.c +2 -2
@@ -214,13 +214,13 @@ void vtime_flush(struct task_struct *tsk)virt_timer_expire (); steal = S390_lowcore.steal_timer; - avg_steal = S390_lowcore.avg_steal_timer /2 ; + avg_steal = S390_lowcore.avg_steal_timer;if ((s64 ) steal >0 ) { S390_lowcore.steal_timer =0 ;account_steal_time (cputime_to_nsecs (steal)); avg_steal += steal; } - S390_lowcore.avg_steal_timer = avg_steal; + S390_lowcore.avg_steal_timer = avg_steal /2 ; }/*
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 171/183 hsr: Fix uninit-value access in hsr_get_node()
In reply to Sasha LevinFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit ddbec99f58571301679addbc022256970ca3eac6 ]
KMSAN reported the following uninit-value access issue [1]:
=====================================================
BUG: KMSAN: uninit-value in hsr_get_node+0xa2e/0xa40 net/hsr/hsr_framereg.c:246 hsr_get_node+0xa2e/0xa40 net/hsr/hsr_framereg.c:246 fill_frame_info net/hsr/hsr_forward.c:577 [inline] hsr_forward_skb+0xe12/0x30e0 net/hsr/hsr_forward.c:615 hsr_dev_xmit+0x1a1/0x270 net/hsr/hsr_device.c:223 __netdev_start_xmit include/linux/netdevice.h:4940 [inline] netdev_start_xmit include/linux/netdevice.h:4954 [inline] xmit_one net/core/dev.c:3548 [inline] dev_hard_start_xmit+0x247/0xa10 net/core/dev.c:3564 __dev_queue_xmit+0x33b8/0x5130 net/core/dev.c:4349 dev_queue_xmit include/linux/netdevice.h:3134 [inline] packet_xmit+0x9c/0x6b0 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3087 [inline] packet_sendmsg+0x8b1d/0x9f30 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768 slab_alloc_node mm/slub.c:3478 [inline] kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560 __alloc_skb+0x318/0x740 net/core/skbuff.c:651 alloc_skb include/linux/skbuff.h:1286 [inline] alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6334 sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2787 packet_alloc_skb net/packet/af_packet.c:2936 [inline] packet_snd net/packet/af_packet.c:3030 [inline] packet_sendmsg+0x70e8/0x9f30 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b CPU: 1 PID: 5033 Comm: syz-executor334 Not tainted 6.7.0-syzkaller-00562-g9f8413c4a66f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 =====================================================
If the packet type ID field in the Ethernet header is either ETH_P_PRP or ETH_P_HSR, but it is not followed by an HSR tag, hsr_get_skb_sequence_nr() reads an invalid value as a sequence number. This causes the above issue.
This patch fixes the issue by returning NULL if the Ethernet header is not followed by an HSR tag.
--- net/hsr/hsr_framereg.c | 4 ++++ 1 file changed, 4 insertions(+)
net/hsr/hsr_framereg.c +4 -0
@@ -198,6 +198,10 @@ struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,if (ethhdr->h_proto ==htons (ETH_P_PRP ) || ethhdr->h_proto ==htons (ETH_P_HSR )) { +/* Check if skb contains hsr_ethhdr */ +if (skb->mac_len <sizeof (struct hsr_ethhdr )) +return NULL ; +/* Use the existing sequence_nr from the tag as starting point * for filtering duplicate frames. */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 172/183 packet: annotate data-races around ignore_outgoing
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 6ebfad33161afacb3e1e59ed1c2feefef70f9f97 ]
ignore_outgoing is read locklessly from dev_queue_xmit_nit() and packet_getsockopt()
Add appropriate READ_ONCE()/WRITE_ONCE() annotations.
syzbot reported:
BUG: KCSAN: data-race in dev_queue_xmit_nit / packet_setsockopt
write to 0xffff888107804542 of 1 bytes by task 22618 on cpu 0:
packet_setsockopt+0xd83/0xfd0 net/packet/af_packet.c:4003 do_sock_setsockopt net/socket.c:2311 [inline] __sys_setsockopt+0x1d8/0x250 net/socket.c:2334 __do_sys_setsockopt net/socket.c:2343 [inline] __se_sys_setsockopt net/socket.c:2340 [inline] __x64_sys_setsockopt+0x66/0x80 net/socket.c:2340 do_syscall_64+0xd3/0x1d0 entry_SYSCALL_64_after_hwframe+0x6d/0x75
read to 0xffff888107804542 of 1 bytes by task 27 on cpu 1:
dev_queue_xmit_nit+0x82/0x620 net/core/dev.c:2248 xmit_one net/core/dev.c:3527 [inline] dev_hard_start_xmit+0xcc/0x3f0 net/core/dev.c:3547 __dev_queue_xmit+0xf24/0x1dd0 net/core/dev.c:4335 dev_queue_xmit include/linux/netdevice.h:3091 [inline] batadv_send_skb_packet+0x264/0x300 net/batman-adv/send.c:108 batadv_send_broadcast_skb+0x24/0x30 net/batman-adv/send.c:127 batadv_iv_ogm_send_to_if net/batman-adv/bat_iv_ogm.c:392 [inline] batadv_iv_ogm_emit net/batman-adv/bat_iv_ogm.c:420 [inline] batadv_iv_send_outstanding_bat_ogm_packet+0x3f0/0x4b0 net/batman-adv/bat_iv_ogm.c:1700 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0x465/0x990 kernel/workqueue.c:3335 worker_thread+0x526/0x730 kernel/workqueue.c:3416 kthread+0x1d1/0x210 kernel/kthread.c:388 ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
value changed: 0x00 -> 0x01
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 27 Comm: kworker/u8:1 Tainted: G W 6.8.0-syzkaller-08073-g480e035fc4c7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024 Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet
--- net/core/dev.c | 2 +- net/packet/af_packet.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
net/core/dev.c +1 -1
@@ -1940,7 +1940,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)rcu_read_lock (); again:list_for_each_entry_rcu (ptype, ptype_list, list) { -if (ptype->ignore_outgoing) +if (READ_ONCE (ptype->ignore_outgoing))continue ;/* Never send packets back to the socket
net/packet/af_packet.c +2 -2
@@ -3921,7 +3921,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optvif (val <0 || val >1 )return -EINVAL ; - po->prot_hook.ignore_outgoing = !!val; +WRITE_ONCE (po->prot_hook.ignore_outgoing, !!val);return 0 ; }case PACKET_TX_HAS_OFF :
@@ -4053,7 +4053,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, 0);break ;case PACKET_IGNORE_OUTGOING : - val = po->prot_hook.ignore_outgoing; + val =READ_ONCE (po->prot_hook.ignore_outgoing);break ;case PACKET_ROLLOVER_STATS :if (!po->rollover)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 173/183 rds: introduce acquire/release ordering in acquire/release_in_xmit()
In reply to Sasha LevinFrom: Yewon Choi <[email protected]>
[ Upstream commit 1422f28826d2a0c11e5240b3e951c9e214d8656e ]
acquire/release_in_xmit() work as bit lock in rds_send_xmit(), so they are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on top of this, following smp_mb__after_atomic() does not guarantee release ordering (memory barrier actually should be placed before clear_bit()).
Instead, we use clear_bit_unlock/test_and_set_bit_lock() here.
--- net/rds/send.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/rds/send.c +2 -3
@@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(rds_send_path_reset);static int acquire_in_xmit (struct rds_conn_path *cp) { -return test_and_set_bit (RDS_IN_XMIT , &cp->cp_flags) ==0 ; +return test_and_set_bit_lock (RDS_IN_XMIT , &cp->cp_flags) ==0 ; }static void release_in_xmit (struct rds_conn_path *cp) { -clear_bit (RDS_IN_XMIT , &cp->cp_flags); -smp_mb__after_atomic (); +clear_bit_unlock (RDS_IN_XMIT , &cp->cp_flags);/* * We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 174/183 hsr: Handle failures in module init
In reply to Sasha LevinFrom: Felix Maurer <[email protected]>
[ Upstream commit 3cf28cd492308e5f63ed00b29ea03ca016264376 ]
A failure during registration of the netdev notifier was not handled at all. A failure during netlink initialization did not unregister the netdev notifier.
Handle failures of netdev notifier registration and netlink initialization. Both functions should only return negative values on failure and thereby lead to the hsr module not being loaded.
--- net/hsr/hsr_main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/hsr/hsr_main.c +11 -4
@@ -113,14 +113,21 @@ static struct notifier_block hsr_nb = {static int __init hsr_init (void ) { -int res; +int err;BUILD_BUG_ON (sizeof (struct hsr_tag ) !=HSR_HLEN ); -register_netdevice_notifier (&hsr_nb); - res =hsr_netlink_init (); + err =register_netdevice_notifier (&hsr_nb); +if (err) +return err; + + err =hsr_netlink_init (); +if (err) { +unregister_netdevice_notifier (&hsr_nb); +return err; + } -return res; +return 0 ; } static void __exit hsr_exit(void)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 175/183 net/bnx2x: Prevent access to a freed page in page_pool
In reply to Sasha LevinFrom: Thinh Tran <[email protected]>
[ Upstream commit d27e2da94a42655861ca4baea30c8cd65546f25d ]
Fix race condition leading to system crash during EEH error handling
During EEH error recovery, the bnx2x driver's transmit timeout logic could cause a race condition when handling reset tasks. The bnx2x_tx_timeout() schedules reset tasks via bnx2x_sp_rtnl_task(), which ultimately leads to bnx2x_nic_unload(). In bnx2x_nic_unload() SGEs are freed using bnx2x_free_rx_sge_range(). However, this could overlap with the EEH driver's attempt to reset the device using bnx2x_io_slot_reset(), which also tries to free SGEs. This race condition can result in system crashes due to accessing freed memory locations in bnx2x_free_rx_sge()
799 static inline void bnx2x_free_rx_sge(struct bnx2x *bp,
800 struct bnx2x_fastpath *fp, u16 index)
801 {
802 struct sw_rx_page *sw_buf = &fp->rx_page_ring[index];
803 struct page *page = sw_buf->page;
....
where sw_buf was set to NULL after the call to dma_unmap_page() by the preceding thread.
EEH: Beginning: 'slot_reset'
PCI 0011:01:00.0#10000: EEH: Invoking bnx2x->slot_reset()
bnx2x: [bnx2x_io_slot_reset:14228(eth1)]IO slot reset initializing...
bnx2x 0011:01:00.0: enabling device (0140 -> 0142)
bnx2x: [bnx2x_io_slot_reset:14244(eth1)]IO slot reset --> driver unload
Kernel attempted to read user page (0) - exploit attempt? (uid: 0)
BUG: Kernel NULL pointer dereference on read at 0x00000000
Faulting instruction address: 0xc0080000025065fc
Oops: Kernel access of bad area, sig: 11 [#1]
.....
Call Trace:
[c000000003c67a20] [c00800000250658c] bnx2x_io_slot_reset+0x204/0x610 [bnx2x] (unreliable)
[c000000003c67af0] [c0000000000518a8] eeh_report_reset+0xb8/0xf0
[c000000003c67b60] [c000000000052130] eeh_pe_report+0x180/0x550
[c000000003c67c70] [c00000000005318c] eeh_handle_normal_event+0x84c/0xa60
[c000000003c67d50] [c000000000053a84] eeh_event_handler+0xf4/0x170
[c000000003c67da0] [c000000000194c58] kthread+0x1c8/0x1d0
[c000000003c67e10] [c00000000000cf64] ret_from_kernel_thread+0x5c/0x64To solve this issue, we need to verify page pool allocations before freeing.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +3 -3
@@ -1004,9 +1004,6 @@ static inline void bnx2x_set_fw_mac_addr(__le16 *fw_hi, __le16 *fw_mid,static inline void bnx2x_free_rx_mem_pool (struct bnx2x *bp,struct bnx2x_alloc_pool *pool) { -if (!pool->page) -return ; -put_page (pool->page); pool->page =NULL ;
@@ -1017,6 +1014,9 @@ static inline void bnx2x_free_rx_sge_range(struct bnx2x *bp, {int i; +if (!fp->page_pool.page) +return ; +if (fp->mode ==TPA_MODE_DISABLED )return ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 176/183 octeontx2-af: Use separate handlers for interrupts
In reply to Sasha LevinFrom: Subbaraya Sundeep <[email protected]>
[ Upstream commit 50e60de381c342008c0956fd762e1c26408f372c ]
For PF to AF interrupt vector and VF to AF vector same interrupt handler is registered which is causing race condition. When two interrupts are raised to two CPUs at same time then two cores serve same event corrupting the data.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +14 -3
@@ -1708,10 +1708,9 @@ static void rvu_queue_work(struct mbox_wq_info *mw, int first, } } -static irqreturn_t rvu_mbox_intr_handler (int irq,void *rvu_irq) +static irqreturn_t rvu_mbox_pf_intr_handler (int irq,void *rvu_irq) {struct rvu *rvu = (struct rvu *)rvu_irq; -int vfs = rvu->vfs;u64 intr; intr =rvu_read64 (rvu,BLKADDR_RVUM ,RVU_AF_PFAF_MBOX_INT );
@@ -1723,6 +1722,18 @@ static irqreturn_t rvu_mbox_intr_handler(int irq, void *rvu_irq)rvu_queue_work (&rvu->afpf_wq_info,0 , rvu->hw->total_pfs, intr); +return IRQ_HANDLED ; +} + +static irqreturn_t rvu_mbox_intr_handler (int irq,void *rvu_irq) +{ +struct rvu *rvu = (struct rvu *)rvu_irq; +int vfs = rvu->vfs; +u64 intr; + +/* Sync with mbox memory region */ +rmb (); +/* Handle VF interrupts */ if (vfs >64 ) { intr =rvupf_read64 (rvu,RVU_PF_VFPF_MBOX_INTX (1 ));
@@ -2035,7 +2046,7 @@ static int rvu_register_interrupts(struct rvu *rvu)/* Register mailbox interrupt handler */ sprintf (&rvu->irq_name[RVU_AF_INT_VEC_MBOX *NAME_SIZE ],"RVUAF Mbox" ); ret =request_irq (pci_irq_vector (rvu->pdev,RVU_AF_INT_VEC_MBOX ), - rvu_mbox_intr_handler,0 , + rvu_mbox_pf_intr_handler,0 , &rvu->irq_name[RVU_AF_INT_VEC_MBOX *NAME_SIZE ], rvu);if (ret) { dev_err(rvu->dev,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 177/183 ARM: dts: sun8i-h2-plus-bananapi-m2-zero: add regulator nodes vcc-dram and vcc1v2
In reply to Sasha LevinFrom: Michael Klein <[email protected]>
[ Upstream commit 23e85be1ec81647374055f731488cc9a7c013a5c ]
Add regulator nodes vcc-dram and vcc1v2 to the devicetree. These regulators correspond to U4 and U5 in the schematics:
http://forum.banana-pi.org/t/bpi-m2-zero-schematic-diagram-public/4111
Stable-dep-of: 4a0e7f2decbf ("netfilter: nf_tables: do not compare internal table flags on updates")
--- .../dts/sun8i-h2-plus-bananapi-m2-zero.dts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +24 -0
@@ -62,6 +62,30 @@ reg_vdd_cpux: vdd-cpux-regulator { states = <1100000 0>, <1300000 1>; }; + reg_vcc_dram: vcc-dram { + compatible = "regulator-fixed"; + regulator-name = "vcc-dram"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */ + vin-supply = <®_vcc5v0>; + }; + + reg_vcc1v2: vcc1v2 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v2"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ + vin-supply = <®_vcc5v0>; + }; + wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
Signature · 1 line
2.43.0
Re: [PATCH 5.4 177/183] ARM: dts: sun8i-h2-plus-bananapi-m2-zero: add regulator nodes vcc-dram and vcc1v2
Hi!
Quoted 7 lines
From: Michael Klein <[email protected]>
[ Upstream commit
23e85be1ec81647374055f731488cc9a7c013a5c]Add regulator nodes vcc-dram and vcc1v2 to the devicetree. These regulators correspond to U4 and U5 in the schematics:
Quoted 7 lines
http://forum.banana-pi.org/t/bpi-m2-zero-schematic-diagram-public/4111
Signed-off-by Michael Klein <[email protected]>Signed-off-by Maxime Ripard <[email protected]>Stable-dep-of:
4a0e7f2decbf("netfilter:nf_tables: do not compare internal table flags on updates")
Iti s hard to believe dts update is dependency of netfilter core change. Please investigate and drop.
Best regards,
Pavel
Quoted 39 lines
--- .../dts/sun8i-h2-plus-bananapi-m2-zero.dts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+)arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +24
-0@@ -62,6 +62,30 @@ reg_vdd_cpux: vdd-cpux-regulator { states = <1100000 0>, <1300000 1>; }; + reg_vcc_dram: vcc-dram { + compatible = "regulator-fixed"; + regulator-name = "vcc-dram"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */ + vin-supply = <®_vcc5v0>; + }; + + reg_vcc1v2: vcc1v2 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v2"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ + vin-supply = <®_vcc5v0>; + }; + wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Sasha Levin
maintainerPATCH 178/183 netfilter: nf_tables: do not compare internal table flags on updates
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 4a0e7f2decbf9bd72461226f1f5f7dcc4b08f139 ]
Restore skipping transaction if table update does not modify flags.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -916,7 +916,7 @@ static int nf_tables_updtable(struct nft_ctx *ctx)if (flags & ~NFT_TABLE_F_DORMANT )return -EINVAL ; -if (flags == ctx->table->flags) +if (flags == (ctx->table->flags &NFT_TABLE_F_MASK ))return 0 ;/* No dormant off/on/off/on games in single transaction */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 179/183 rcu: add a helper to report consolidated flavor QS
In reply to Sasha LevinFrom: Yan Zhai <[email protected]>
[ Upstream commit 1a77557d48cff187a169c2aec01c0dd78a5e7e50 ]
When under heavy load, network processing can run CPU-bound for many tens of seconds. Even in preemptible kernels (non-RT kernel), this can block RCU Tasks grace periods, which can cause trace-event removal to take more than a minute, which is unacceptably long.
This commit therefore creates a new helper function that passes through both RCU and RCU-Tasks quiescent states every 100 milliseconds. This hard-coded value suffices for current workloads.
Stable-dep-of: 00bf63122459 ("bpf: report RCU QS in cpumap kthread")
--- include/linux/rcupdate.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
include/linux/rcupdate.h +31 -0
@@ -164,6 +164,37 @@ do { \cond_resched (); \ }while (0 ) +/** +* rcu_softirq_qs_periodic - Report RCU and RCU-Tasks quiescent states +* @old_ts: jiffies at start of processing. +* +* This helper is for long-running softirq handlers, such as NAPI threads in +* networking. The caller should initialize the variable passed in as @old_ts +* at the beginning of the softirq handler. When invoked frequently, this macro +* will invoke rcu_softirq_qs() every 100 milliseconds thereafter, which will +* provide both RCU and RCU-Tasks quiescent states. Note that this macro +* modifies its old_ts argument. +* +* Because regions of code that have disabled softirq act as RCU read-side +* critical sections, this macro should be invoked with softirq (and +* preemption) enabled. +* +* The macro is not needed when CONFIG_PREEMPT_RT is defined. RT kernels would +* have more chance to invoke schedule() calls and provide necessary quiescent +* states. As a contrast, calling cond_resched() only won't achieve the same +* effect because cond_resched() does not provide RCU-Tasks quiescent states. + */ +#define rcu_softirq_qs_periodic (old_ts) \ +do { \ + if (!IS_ENABLED(CONFIG_PREEMPT_RT) && \ + time_after(jiffies, (old_ts) + HZ / 10)) { \ + preempt_disable(); \ + rcu_softirq_qs(); \ + preempt_enable(); \ + (old_ts) = jiffies; \ + } \ +} while (0) +/* * Infrastructure to implement the synchronize_() primitives in * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 180/183 bpf: report RCU QS in cpumap kthread
In reply to Sasha LevinFrom: Yan Zhai <[email protected]>
[ Upstream commit 00bf63122459e87193ee7f1bc6161c83a525569f ]
When there are heavy load, cpumap kernel threads can be busy polling packets from redirect queues and block out RCU tasks from reaching quiescent states. It is insufficient to just call cond_resched() in such context. Periodically raise a consolidated RCU QS before cond_resched fixes the problem.
--- kernel/bpf/cpumap.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/bpf/cpumap.c +3 -0
@@ -249,6 +249,7 @@ static void put_cpu_map_entry(struct bpf_cpu_map_entry *rcpu)static int cpu_map_kthread_run (void *data) {struct bpf_cpu_map_entry *rcpu = data; +unsigned long last_qs = jiffies;set_current_state (TASK_INTERRUPTIBLE );
@@ -271,10 +272,12 @@ static int cpu_map_kthread_run(void *data)if (__ptr_ring_empty (rcpu->queue)) {schedule (); sched =1 ; + last_qs = jiffies; }else {__set_current_state (TASK_RUNNING ); } }else { +rcu_softirq_qs_periodic (last_qs); sched =cond_resched (); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 181/183 spi: spi-mt65xx: Fix NULL pointer access in interrupt handler
In reply to Sasha LevinFrom: Fei Shao <[email protected]>
[ Upstream commit a20ad45008a7c82f1184dc6dee280096009ece55 ]
The TX buffer in spi_transfer can be a NULL pointer, so the interrupt handler may end up writing to the invalid memory and cause crashes.
Add a check to trans->tx_buf before using it.
--- drivers/spi/spi-mt65xx.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/spi/spi-mt65xx.c +12 -10
@@ -559,17 +559,19 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) mdata->xfer_len =min (MTK_SPI_MAX_FIFO_SIZE , len);mtk_spi_setup_packet (master); - cnt = mdata->xfer_len /4 ; -iowrite32_rep (mdata->base +SPI_TX_DATA_REG , - trans->tx_buf + mdata->num_xfered, cnt); +if (trans->tx_buf) { + cnt = mdata->xfer_len /4 ; +iowrite32_rep (mdata->base +SPI_TX_DATA_REG , + trans->tx_buf + mdata->num_xfered, cnt); - remainder = mdata->xfer_len %4 ; -if (remainder >0 ) { - reg_val =0 ; -memcpy (®_val, - trans->tx_buf + (cnt *4 ) + mdata->num_xfered, - remainder); -writel (reg_val, mdata->base +SPI_TX_DATA_REG ); + remainder = mdata->xfer_len %4 ; +if (remainder >0 ) { + reg_val =0 ; +memcpy (®_val, + trans->tx_buf + (cnt *4 ) + mdata->num_xfered, + remainder); +writel (reg_val, mdata->base +SPI_TX_DATA_REG ); + } }mtk_spi_enable_transfer (master);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 182/183 regmap: Add missing map->bus check
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 5c422f0b970d287efa864b8390a02face404db5d ]
The map->bus can be NULL here, add the missing NULL pointer check.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -1648,7 +1648,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, map->format.reg_bytes + map->format.pad_bytes + val_len); - else if (map->bus->gather_write) + else if (map->bus && map->bus->gather_write) ret = map->bus->gather_write(map->bus_context, map->work_buf, map->format.reg_bytes + map->format.pad_bytes,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 183/183 Linux 5.4.273-rc1
In reply to Sasha Levin--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 4 -SUBLEVEL = 272 -EXTRAVERSION = +SUBLEVEL = 273 +EXTRAVERSION = -rc1 NAME = Kleptomaniac Octopus # *DOCUMENTATION*
Signature · 1 line
2.43.0
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.4.273 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
This fails to build:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/1225692754
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany