cgroup-v1: cgroup_pidlist_next should update position index
Subsystems (8)
Sasha Levin
maintainerPATCH 1/84 cgroup-v1: cgroup_pidlist_next should update position index
From: Vasily Averin <[email protected]>
[ Upstream commit db8dd9697238be70a6b4f9d0284cd89f59c0e070 ]
if seq_file .next fuction does not change position index, read after some lseek can generate unexpected output.
# mount | grep cgroup # dd if=/mnt/cgroup.procs bs=1 # normal output ... 1294 1295 1296 1304 1382 584+0 records in 584+0 records out 584 bytes copied
dd: /mnt/cgroup.procs: cannot skip to specified offset 83 <<< generates end of last line
1383 <<< ... and whole last line once again 0+1 records in
0+1 records out
8 bytes copied
dd: /mnt/cgroup.procs: cannot skip to specified offset 1386 <<< generates last line anyway
0+1 records in
0+1 records out
5 bytes copied
https://bugzilla.kernel.org/show_bug.cgi?id=206283
--- kernel/cgroup/cgroup-v1.c | 1 + 1 file changed, 1 insertion(+)
kernel/cgroup/cgroup-v1.c +1 -0
@@ -473,6 +473,7 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos)*/ p++;if (p >= end) { + (*pos)++;return NULL ; }else { *pos = *p;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/84 cgroup: Iterate tasks that did not finish do_exit()
From: Michal Koutný <[email protected]>
[ Upstream commit 9c974c77246460fa6a92c18554c3311c8c83c160 ]
PF_EXITING is set earlier than actual removal from css_set when a task is exitting. This can confuse cgroup.procs readers who see no PF_EXITING tasks, however, rmdir is checking against css_set membership so it can transitionally fail with EBUSY.
Fix this by listing tasks that weren't unlinked from css_set active lists.
It may happen that other users of the task iterator (without CSS_TASK_ITER_PROCS) spot a PF_EXITING task before cgroup_exit(). This is equal to the state before commit c03cd7738a83 ("cgroup: Include dying leaders with live threads in PROCS iterations") but it may be reviewed later.
--- include/linux/cgroup.h | 1 + kernel/cgroup/cgroup.c | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-)
include/linux/cgroup.h +1 -0
@@ -62,6 +62,7 @@ struct css_task_iter {struct list_head *mg_tasks_head;struct list_head *dying_tasks_head; +struct list_head *cur_tasks_head;struct css_set *cur_cset;struct css_set *cur_dcset;struct task_struct *cur_task;
kernel/cgroup/cgroup.c +16 -7
@@ -4405,12 +4405,16 @@ static void css_task_iter_advance_css_set(struct css_task_iter *it) } }while (!css_set_populated (cset) &&list_empty (&cset->dying_tasks)); -if (!list_empty (&cset->tasks)) +if (!list_empty (&cset->tasks)) { it->task_pos = cset->tasks.next; -else if (!list_empty (&cset->mg_tasks)) + it->cur_tasks_head = &cset->tasks; + }else if (!list_empty (&cset->mg_tasks)) { it->task_pos = cset->mg_tasks.next; -else + it->cur_tasks_head = &cset->mg_tasks; + }else { it->task_pos = cset->dying_tasks.next; + it->cur_tasks_head = &cset->dying_tasks; + } it->tasks_head = &cset->tasks; it->mg_tasks_head = &cset->mg_tasks;
@@ -4468,10 +4472,14 @@ static void css_task_iter_advance(struct css_task_iter *it)else it->task_pos = it->task_pos->next; -if (it->task_pos == it->tasks_head) +if (it->task_pos == it->tasks_head) { it->task_pos = it->mg_tasks_head->next; -if (it->task_pos == it->mg_tasks_head) + it->cur_tasks_head = it->mg_tasks_head; + } +if (it->task_pos == it->mg_tasks_head) { it->task_pos = it->dying_tasks_head->next; + it->cur_tasks_head = it->dying_tasks_head; + }if (it->task_pos == it->dying_tasks_head)css_task_iter_advance_css_set (it); }else {
@@ -4490,11 +4498,12 @@ static void css_task_iter_advance(struct css_task_iter *it) goto repeat;/* and dying leaders w/o live member threads */ -if (!atomic_read (&task->signal->live)) +if (it->cur_tasks_head == it->dying_tasks_head && + !atomic_read (&task->signal->live)) goto repeat; }else {/* skip all dying ones */ -if (task->flags &PF_EXITING ) +if (it->cur_tasks_head == it->dying_tasks_head) goto repeat; } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 3/84 iwlwifi: mvm: Do not require PHY_SKU NVM section for 3168 devices
In reply to Sasha LevinFrom: Dan Moulding <[email protected]>
[ Upstream commit a9149d243f259ad8f02b1e23dfe8ba06128f15e1 ]
The logic for checking required NVM sections was recently fixed in commit b3f20e098293 ("iwlwifi: mvm: fix NVM check for 3168 devices"). However, with that fixed the else is now taken for 3168 devices and within the else clause there is a mandatory check for the PHY_SKU section. This causes the parsing to fail for 3168 devices.
The PHY_SKU section is really only mandatory for the IWL_NVM_EXT layout (the phy_sku parameter of iwl_parse_nvm_data is only used when the NVM type is IWL_NVM_EXT). So this changes the PHY_SKU section check so that it's only mandatory for IWL_NVM_EXT.
--- drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +2 -1
@@ -308,7 +308,8 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm) }/* PHY_SKU section is mandatory in B0 */ -if (!mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU ].data) { +if (mvm->trans->cfg->nvm_type ==IWL_NVM_EXT && + !mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU ].data) {IWL_ERR (mvm,"Can't parse phy_sku in B0, empty sections\n" );return NULL ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/84 clk: imx8mn: Fix incorrect clock defines
In reply to Sasha LevinFrom: Anson Huang <[email protected]>
[ Upstream commit 5eb40257047fb11085d582b7b9ccd0bffe900726 ]
IMX8MN_CLK_I2C4 and IMX8MN_CLK_UART1's index definitions are incorrect, fix them.
--- include/dt-bindings/clock/imx8mn-clock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/dt-bindings/clock/imx8mn-clock.h +2 -2
@@ -122,8 +122,8 @@#define IMX8MN_CLK_I2C1 105#define IMX8MN_CLK_I2C2 106#define IMX8MN_CLK_I2C3 107 -#define IMX8MN_CLK_I2C4 118 -#define IMX8MN_CLK_UART1 119 +#define IMX8MN_CLK_I2C4 108 +#define IMX8MN_CLK_UART1 109#define IMX8MN_CLK_UART2 110#define IMX8MN_CLK_UART3 111#define IMX8MN_CLK_UART4 112
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/84 batman-adv: Don't schedule OGM for disabled interface
In reply to Sasha LevinFrom: Sven Eckelmann <[email protected]>
[ Upstream commit 8e8ce08198de193e3d21d42e96945216e3d9ac7f ]
A transmission scheduling for an interface which is currently dropped by batadv_iv_ogm_iface_disable could still be in progress. The B.A.T.M.A.N. V is simply cancelling the workqueue item in an synchronous way but this is not possible with B.A.T.M.A.N. IV because the OGM submissions are intertwined.
Instead it has to stop submitting the OGM when it detect that the buffer pointer is set to NULL.
--- net/batman-adv/bat_iv_ogm.c | 4 ++++ 1 file changed, 4 insertions(+)
net/batman-adv/bat_iv_ogm.c +4 -0
@@ -789,6 +789,10 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)lockdep_assert_held (&hard_iface->bat_iv.ogm_buff_mutex); +/* interface already disabled by batadv_iv_ogm_iface_disable */ +if (!*ogm_buff) +return ; +/* the interface gets activated here to avoid race conditions between * the moment of activating the interface in * hardif_activate_interface() where the originator mac is set and
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/84 pinctrl: meson-gxl: fix GPIOX sdio pins
In reply to Sasha LevinFrom: Nicolas Belin <[email protected]>
[ Upstream commit dc7a06b0dbbafac8623c2b7657e61362f2f479a7 ]
In the gxl driver, the sdio cmd and clk pins are inverted. It has not caused any issue so far because devices using these pins always take both pins so the resulting configuration is OK.
--- drivers/pinctrl/meson/pinctrl-meson-gxl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/meson/pinctrl-meson-gxl.c +2 -2
@@ -147,8 +147,8 @@ static const unsigned int sdio_d0_pins[] = { GPIOX_0 };static const unsigned int sdio_d1_pins[] = {GPIOX_1 };static const unsigned int sdio_d2_pins[] = {GPIOX_2 };static const unsigned int sdio_d3_pins[] = {GPIOX_3 }; -static const unsigned int sdio_cmd_pins[] = {GPIOX_4 }; -static const unsigned int sdio_clk_pins[] = {GPIOX_5 }; +static const unsigned int sdio_clk_pins[] = {GPIOX_4 }; +static const unsigned int sdio_cmd_pins[] = {GPIOX_5 };static const unsigned int sdio_irq_pins[] = {GPIOX_7 };static const unsigned int nand_ce0_pins[] = {BOOT_8 };
Signature · 7 lines
2.20.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 7/84 pinctrl: imx: scu: Align imx sc msg structs to 4
In reply to Sasha LevinFrom: Leonard Crestez <[email protected]>
[ Upstream commit 4c48e549f39f8ed10cf8a0b6cb96f5eddf0391ce ]
The imx SC api strongly assumes that messages are composed out of 4-bytes words but some of our message structs have odd sizeofs.
This produces many oopses with CONFIG_KASAN=y.
Fix by marking with __aligned(4).
--- drivers/pinctrl/freescale/pinctrl-scu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/freescale/pinctrl-scu.c +2 -2
@@ -23,12 +23,12 @@ struct imx_sc_msg_req_pad_set {struct imx_sc_rpc_msg hdr;u32 val;u16 pad; -} __packed; +} __packed__aligned(4) ;struct imx_sc_msg_req_pad_get {struct imx_sc_rpc_msg hdr;u16 pad; -} __packed; +} __packed__aligned(4) ;struct imx_sc_msg_resp_pad_get {struct imx_sc_rpc_msg hdr;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/84 nfs: add minor version to nfs_server_key for fscache
In reply to Sasha LevinFrom: Scott Mayhew <[email protected]>
[ Upstream commit 55dee1bc0d72877b99805e42e0205087e98b9edd ]
An NFS client that mounts multiple exports from the same NFS server with higher NFSv4 versions disabled (i.e. 4.2) and without forcing a specific NFS version results in fscache index cookie collisions and the following messages:
[ 570.004348] FS-Cache: Duplicate cookie detected
Each nfs_client structure should have its own fscache index cookie, so add the minorversion to nfs_server_key.
--- fs/nfs/client.c | 1 + fs/nfs/fscache.c | 2 ++ fs/nfs/nfs4client.c | 1 - 3 files changed, 3 insertions(+), 1 deletion(-)
fs/nfs/client.c +1 -0
@@ -153,6 +153,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)if ((clp =kzalloc (sizeof (*clp),GFP_KERNEL )) ==NULL ) goto error_0; + clp->cl_minorversion = cl_init->minorversion; clp->cl_nfs_mod = cl_init->nfs_mod;if (!try_module_get (clp->cl_nfs_mod->owner)) goto error_dealloc;
fs/nfs/fscache.c +2 -0
@@ -31,6 +31,7 @@ static DEFINE_SPINLOCK(nfs_fscache_keys_lock);struct nfs_server_key {struct {uint16_t nfsversion;/* NFS protocol version */ +uint32_t minorversion;/* NFSv4 minor version */ uint16_t family;/* address family */ __be16 port;/* IP port */ } hdr;
@@ -55,6 +56,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp)memset (&key,0 ,sizeof (key)); key.hdr.nfsversion = clp->rpc_ops->version; + key.hdr.minorversion = clp->cl_minorversion; key.hdr.family = clp->cl_addr.ss_family;switch (clp->cl_addr.ss_family) {
fs/nfs/nfs4client.c +0 -1
@@ -216,7 +216,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)INIT_LIST_HEAD (&clp->cl_ds_clients);rpc_init_wait_queue (&clp->cl_rpcwaitq,"NFS client" ); clp->cl_state =1 <<NFS4CLNT_LEASE_EXPIRED ; - clp->cl_minorversion = cl_init->minorversion; clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion]; clp->cl_mig_gen =1 ;#if IS_ENABLED (CONFIG_NFS_V4_1 )
Signature · 1 line
2.20.1