5.10.180-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 303/381 crypto: ccp - Clear PSP interrupt status register before calling handler
In reply to Greg Kroah-HartmanFrom: Jeremi Piotrowski <[email protected]>
[ Upstream commit 45121ad4a1750ca47ce3f32bd434bdb0cdbf0043 ]
The PSP IRQ is edge-triggered (MSI or MSI-X) in all cases supported by the psp module so clear the interrupt status register early in the handler to prevent missed interrupts. sev_irq_handler() calls wake_up() on a wait queue, which can result in a new command being submitted from a different CPU. This then races with the clearing of isr and can result in missed interrupts. A missed interrupt results in a command waiting until it times out, which results in the psp being declared dead.
This is unlikely on bare metal, but has been observed when running virtualized. In the cases where this is observed, sev->cmdresp_reg has PSP_CMDRESP_RESP set which indicates that the command was processed correctly but no interrupt was asserted.
The full sequence of events looks like this:
CPU 1: submits SEV cmd #1 CPU 1: calls wait_event_timeout() CPU 0: enters psp_irq_handler() CPU 0: calls sev_handler()->wake_up() CPU 1: wakes up; finishes processing cmd #1 CPU 1: submits SEV cmd #2 CPU 1: calls wait_event_timeout() PSP: finishes processing cmd #2; interrupt status is still set; no interrupt CPU 0: clears intsts CPU 0: exits psp_irq_handler() CPU 1: wait_event_timeout() times out; psp_dead=true
--- drivers/crypto/ccp/psp-dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/ccp/psp-dev.c +3 -3
@@ -42,6 +42,9 @@ static irqreturn_t psp_irq_handler(int irq, void *data)/* Read the interrupt status: */ status =ioread32 (psp->io_regs + psp->vdata->intsts_reg); +/* Clear the interrupt status by writing the same value we read. */ +iowrite32 (status, psp->io_regs + psp->vdata->intsts_reg); +/* invoke subdevice interrupt handlers */ if (status) {if (psp->sev_irq_handler)
@@ -51,9 +54,6 @@ static irqreturn_t psp_irq_handler(int irq, void *data) psp->tee_irq_handler (irq, psp->tee_irq_data, status); } -/* Clear the interrupt status by writing the same value we read. */ -iowrite32 (status, psp->io_regs + psp->vdata->intsts_reg); -return IRQ_HANDLED ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 304/381 mailbox: zynq: Switch to flexible array to simplify code
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 043f85ce81cb1714e14d31c322c5646513dde3fb ]
Using flexible array is more straight forward. It
- saves 1 pointer in the 'zynqmp_ipi_pdata' structure
- saves an indirection when using this array
- saves some LoC and avoids some always spurious pointer arithmetic
Stable-dep-of: f72f805e7288 ("mailbox: zynqmp: Fix counts of child nodes")
--- drivers/mailbox/zynqmp-ipi-mailbox.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mailbox/zynqmp-ipi-mailbox.c +2 -4
@@ -110,7 +110,7 @@ struct zynqmp_ipi_pdata {unsigned int method;u32 local_id;int num_mboxes; -struct zynqmp_ipi_mbox *ipi_mboxes; +struct zynqmp_ipi_mbox ipi_mboxes[]; };static struct device_driver zynqmp_ipi_mbox_driver = {
@@ -635,7 +635,7 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)int num_mboxes, ret = -EINVAL ; num_mboxes =of_get_child_count (np); - pdata =devm_kzalloc (dev,sizeof (*pdata) + (num_mboxes *sizeof (*mbox)), + pdata =devm_kzalloc (dev,struct_size (pdata, ipi_mboxes, num_mboxes),GFP_KERNEL );if (!pdata)return -ENOMEM ;
@@ -649,8 +649,6 @@ static int zynqmp_ipi_probe(struct platform_device *pdev) } pdata->num_mboxes = num_mboxes; - pdata->ipi_mboxes = (struct zynqmp_ipi_mbox *) - ((char *)pdata +sizeof (*pdata)); mbox = pdata->ipi_mboxes;for_each_available_child_of_node (np, nc) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 305/381 mailbox: zynqmp: Fix counts of child nodes
In reply to Greg Kroah-HartmanFrom: Tanmay Shah <[email protected]>
[ Upstream commit f72f805e72882c361e2a612c64a6e549f3da7152 ]
If child mailbox node status is disabled it causes crash in interrupt handler. Fix this by assigning only available child node during driver probe.
--- drivers/mailbox/zynqmp-ipi-mailbox.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mailbox/zynqmp-ipi-mailbox.c +6 -1
@@ -634,7 +634,12 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)struct zynqmp_ipi_mbox *mbox;int num_mboxes, ret = -EINVAL ; - num_mboxes =of_get_child_count (np); + num_mboxes =of_get_available_child_count (np); +if (num_mboxes ==0 ) { +dev_err (dev,"mailbox nodes not available\n" ); +return -EINVAL ; + } + pdata =devm_kzalloc (dev,struct_size (pdata, ipi_mboxes, num_mboxes),GFP_KERNEL );if (!pdata)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 306/381 dm verity: skip redundant verity_handle_err() on I/O errors
In reply to Greg Kroah-HartmanFrom: Akilesh Kailash <[email protected]>
[ Upstream commit 2c0468e054c0adb660ac055fc396622ec7235df9 ]
Without FEC, dm-verity won't call verity_handle_err() when I/O fails, but with FEC enabled, it currently does even if an I/O error has occurred.
If there is an I/O error and FEC correction fails, return the error instead of calling verity_handle_err() again.
Stable-dep-of: e8c5d45f82ce ("dm verity: fix error handling for check_at_most_once on FEC")
--- drivers/md/dm-verity-target.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/md/dm-verity-target.c +12 -3
@@ -475,6 +475,7 @@ static int verity_verify_io(struct dm_verity_io *io)struct bvec_iter start;unsigned b;struct crypto_wait wait; +struct bio *bio =dm_bio_from_per_bio_data (io, v->ti->per_io_data_size);for (b =0 ; b < io->n_blocks; b++) {int r;
@@ -529,9 +530,17 @@ static int verity_verify_io(struct dm_verity_io *io)else if (verity_fec_decode (v, io,DM_VERITY_BLOCK_TYPE_DATA , cur_block,NULL , &start) ==0 )continue ; -else if (verity_handle_err (v,DM_VERITY_BLOCK_TYPE_DATA , - cur_block)) -return -EIO ; +else { +if (bio->bi_status) { +/* +* Error correction failed; Just return error +*/ +return -EIO ; + } +if (verity_handle_err (v,DM_VERITY_BLOCK_TYPE_DATA , + cur_block)) +return -EIO ; + } }return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 307/381 dm verity: fix error handling for check_at_most_once on FEC
In reply to Greg Kroah-HartmanFrom: Yeongjin Gil <[email protected]>
[ Upstream commit e8c5d45f82ce0c238a4817739892fe8897a3dcc3 ]
In verity_end_io(), if bi_status is not BLK_STS_OK, it can be return directly. But if FEC configured, it is desired to correct the data page through verity_verify_io. And the return value will be converted to blk_status and passed to verity_finish_io().
BTW, when a bit is set in v->validated_blocks, verity_verify_io() skips verification regardless of I/O error for the corresponding bio. In this case, the I/O error could not be returned properly, and as a result, there is a problem that abnormal data could be read for the corresponding block.
To fix this problem, when an I/O error occurs, do not skip verification even if the bit related is set in v->validated_blocks.
--- drivers/md/dm-verity-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-verity-target.c +1 -1
@@ -482,7 +482,7 @@ static int verity_verify_io(struct dm_verity_io *io)sector_t cur_block = io->block + b;struct ahash_request *req =verity_io_hash_req (v, io); -if (v->validated_blocks && +if (v->validated_blocks && bio->bi_status ==BLK_STS_OK &&likely (test_bit (cur_block, v->validated_blocks))) {verity_bv_skip_block (v, io, &io->iter);continue ;
Signature · 1 line
2.39.2
RE: [PATCH 5.10 307/381] dm verity: fix error handling for check_at_most_once on FEC
Quoted 17 lines
From: Yeongjin Gil <[email protected]>
[ Upstream commit
e8c5d45f82ce0c238a4817739892fe8897a3dcc3]In
verity_end_io(), ifbi_statusis notBLK_STS_OK, it can be return directly. But if FEC configured, it is desired to correct the data page throughverity_verify_io. And the return value will be converted toblk_statusand passed toverity_finish_io().BTW, when a bit is set in
v->validated_blocks,verity_verify_io()skips verification regardless of I/O error for the corresponding bio. In this case, the I/O error could not be returned properly, and as a result, there is a problem that abnormal data could be read for the corresponding block.To fix this problem, when an I/O error occurs, do not skip verification even if the bit related is set in
v->validated_blocks.
Quoted 8 lines
Fixes 843f38d382b1 ("dm verity: add 'check_at_most_once' option to onlyvalidate hashes once")
Reviewed-by Sungjong Seo <[email protected]>Signed-off-by Yeongjin Gil <[email protected]>Signed-off-by Mike Snitzer <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
Hello Greg.
This patch is the wrong patch I mentioned :(
Please check the v2 patch I sent yesterday.
If you are still confused, would it be better to change mail subject and send v3?
Quoted 20 lines
drivers/md/dm-verity-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/md/dm-verity-target.c +1
-2@@ -482,7 +482,7 @@ static int verity_verify_io(struct dm_verity_io *io)sector_t cur_block = io->block + b;struct ahash_request *req =verity_io_hash_req (v, io); -if (v->validated_blocks && +if (v->validated_blocks && bio->bi_status ==BLK_STS_OK &&likely (test_bit (cur_block, v->validated_blocks))) {verity_bv_skip_block (v, io, &io->iter);continue ; --2.39.2
RE: [PATCH 5.10 307/381] dm verity: fix error handling for check_at_most_once on FEC
In reply to Greg Kroah-HartmanQuoted 26 lines
Quoted 9 lines
From: Yeongjin Gil <[email protected]>
[ Upstream commit
e8c5d45f82ce0c238a4817739892fe8897a3dcc3]In
verity_end_io(), ifbi_statusis notBLK_STS_OK, it can be return directly. But if FEC configured, it is desired to correct the data page throughverity_verify_io. And the return value will be converted toblk_statusand passed toverity_finish_io().Quoted 4 lines
BTW, when a bit is set in
v->validated_blocks,verity_verify_io()skips verification regardless of I/O error for the corresponding bio. In this case, the I/O error could not be returned properly, and as a result, there is a problem that abnormal data could be read for thecorresponding block.
Quoted 4 lines
To fix this problem, when an I/O error occurs, do not skip verification even if the bit related is set in
v->validated_blocks.Quoted 8 lines
Fixes 843f38d382b1 ("dm verity: add 'check_at_most_once' option toonly validate hashes once")
Reviewed-by Sungjong Seo <[email protected]>Signed-off-by Yeongjin Gil <[email protected]>Signed-off-by Mike Snitzer <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
Quoted 5 lines
Hello Greg.
This patch is the wrong patch I mentioned :( Please check the v2 patch I sent yesterday.
If you are still confused, would it be better to change mail subject and send v3?
I checked that the previous patch was queued in stable kernel. (dm verity: skip redundant verity_handle_err() on I/O errors) I didn't know how to handle dependent commit in stable kernel. There is no problem with the below current patch. Thank you and I'm sorry for confusion.
Quoted 21 lines
Quoted 21 lines
drivers/md/dm-verity-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/md/dm-verity-target.cindexd9c388e6ce76c..0c2048d2b847e100644drivers/md/dm-verity-target.c +1
-2@@ -482,7 +482,7 @@ static int verity_verify_io(struct dm_verity_io *io)sector_t cur_block = io->block + b;struct ahash_request *req =verity_io_hash_req (v, io); -if (v->validated_blocks && +if (v->validated_blocks && bio->bi_status ==BLK_STS_OK &&likely (test_bit (cur_block, v->validated_blocks))) {verity_bv_skip_block (v, io, &io->iter);continue ; --2.39.2
'Greg Kroah-Hartman'
maintainerRe: [PATCH 5.10 307/381] dm verity: fix error handling for check_at_most_once on FEC
Quoted 26 lines · Yeongjin Gil
Quoted 26 lines
Quoted 9 lines
From: Yeongjin Gil <[email protected]>
[ Upstream commit
e8c5d45f82ce0c238a4817739892fe8897a3dcc3]In
verity_end_io(), ifbi_statusis notBLK_STS_OK, it can be return directly. But if FEC configured, it is desired to correct the data page throughverity_verify_io. And the return value will be converted toblk_statusand passed toverity_finish_io().Quoted 4 lines
BTW, when a bit is set in
v->validated_blocks,verity_verify_io()skips verification regardless of I/O error for the corresponding bio. In this case, the I/O error could not be returned properly, and as a result, there is a problem that abnormal data could be read for thecorresponding block.
Quoted 12 lines
To fix this problem, when an I/O error occurs, do not skip verification even if the bit related is set in
v->validated_blocks.Fixes 843f38d382b1 ("dm verity: add 'check_at_most_once' option toonly validate hashes once")
Reviewed-by Sungjong Seo <[email protected]>Signed-off-by Yeongjin Gil <[email protected]>Signed-off-by Mike Snitzer <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
Quoted 7 lines
Quoted 5 lines
Hello Greg.
This patch is the wrong patch I mentioned :( Please check the v2 patch I sent yesterday.
If you are still confused, would it be better to change mail subject and send v3?I checked that the previous patch was queued in stable kernel. (dm verity: skip redundant
verity_handle_err()on I/O errors)
It is queued up, see the full series for details.
Quoted 1 line
I didn't know how to handle dependent commit in stable kernel.
The documentation shows how to do this.
Quoted 2 lines
There is no problem with the below current patch.
Thank you and I'm sorry for confusion.
Thanks for checking!
greg k-h
Greg Kroah-Hartman
maintainerPATCH 308/381 scsi: qedi: Fix use after free bug in qedi_remove()
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit c5749639f2d0a1f6cbe187d05f70c2e7c544d748 ]
In qedi_probe() we call __qedi_probe() which initializes &qedi->recovery_work with qedi_recovery_handler() and &qedi->board_disable_work with qedi_board_disable_work().
When qedi_schedule_recovery_handler() is called, schedule_delayed_work() will finally start the work.
In qedi_remove(), which is called to remove the driver, the following sequence may be observed:
Fix this by finishing the work before cleanup in qedi_remove().
CPU0 CPU1
|qedi_recovery_handler
qedi_remove |
__qedi_remove |
iscsi_host_free |
scsi_host_put |
//free shost |
|iscsi_host_for_each_session
|//use qedi->shostCancel recovery_work and board_disable_work in __qedi_remove().
--- drivers/scsi/qedi/qedi_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/qedi/qedi_main.c +3 -0
@@ -2456,6 +2456,9 @@ static void __qedi_remove(struct pci_dev *pdev, int mode) qedi_ops->ll2->stop (qedi->cdev); } +cancel_delayed_work_sync (&qedi->recovery_work); +cancel_delayed_work_sync (&qedi->board_disable_work); +qedi_free_iscsi_pf_param (qedi); rval = qedi_ops->common->update_drv_state (qedi->cdev, false);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 309/381 net/ncsi: clear Tx enable mode when handling a Config required AEN
In reply to Greg Kroah-HartmanFrom: Cosmo Chou <[email protected]>
[ Upstream commit 6f75cd166a5a3c0bc50441faa8b8304f60522fdd ]
ncsi_channel_is_tx() determines whether a given channel should be used for Tx or not. However, when reconfiguring the channel by handling a Configuration Required AEN, there is a misjudgment that the channel Tx has already been enabled, which results in the Enable Channel Network Tx command not being sent.
Clear the channel Tx enable flag before reconfiguring the channel to avoid the misjudgment.
--- net/ncsi/ncsi-aen.c | 1 + 1 file changed, 1 insertion(+)
net/ncsi/ncsi-aen.c +1 -0
@@ -165,6 +165,7 @@ static int ncsi_aen_handler_cr(struct ncsi_dev_priv *ndp, nc->state =NCSI_CHANNEL_INACTIVE ;list_add_tail_rcu (&nc->link, &ndp->channel_queue);spin_unlock_irqrestore (&ndp->lock, flags); + nc->modes[NCSI_MODE_TX_ENABLE ].enable =0 ;return ncsi_process_next_channel (ndp); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 310/381 net/sched: cls_api: remove block_cb from driver_list before freeing
In reply to Greg Kroah-HartmanFrom: Vlad Buslov <[email protected]>
[ Upstream commit da94a7781fc3c92e7df7832bc2746f4d39bc624e ]
Error handler of tcf_block_bind() frees the whole bo->cb_list on error. However, by that time the flow_block_cb instances are already in the driver list because driver ndo_setup_tc() callback is called before that up the call chain in tcf_block_offload_cmd(). This leaves dangling pointers to freed objects in the list and causes use-after-free[0]. Fix it by also removing flow_block_cb instances from driver_list before deallocating them.
[0]:
[ 279.868433] ================================================================== [ 279.869964] BUG: KASAN: slab-use-after-free in flow_block_cb_setup_simple+0x631/0x7c0 [ 279.871527] Read of size 8 at addr ffff888147e2bf20 by task tc/2963
[ 279.873151] CPU: 6 PID: 2963 Comm: tc Not tainted 6.3.0-rc6+ #4 [ 279.874273] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [ 279.876295] Call Trace: [ 279.876882] <TASK> [ 279.877413] dump_stack_lvl+0x33/0x50 [ 279.878198] print_report+0xc2/0x610 [ 279.878987] ? flow_block_cb_setup_simple+0x631/0x7c0 [ 279.879994] kasan_report+0xae/0xe0 [ 279.880750] ? flow_block_cb_setup_simple+0x631/0x7c0 [ 279.881744] ? mlx5e_tc_reoffload_flows_work+0x240/0x240 [mlx5_core] [ 279.883047] flow_block_cb_setup_simple+0x631/0x7c0 [ 279.884027] tcf_block_offload_cmd.isra.0+0x189/0x2d0 [ 279.885037] ? tcf_block_setup+0x6b0/0x6b0 [ 279.885901] ? mutex_lock+0x7d/0xd0 [ 279.886669] ? __mutex_unlock_slowpath.constprop.0+0x2d0/0x2d0 [ 279.887844] ? ingress_init+0x1c0/0x1c0 [sch_ingress] [ 279.888846] tcf_block_get_ext+0x61c/0x1200 [ 279.889711] ingress_init+0x112/0x1c0 [sch_ingress] [ 279.890682] ? clsact_init+0x2b0/0x2b0 [sch_ingress] [ 279.891701] qdisc_create+0x401/0xea0 [ 279.892485] ? qdisc_tree_reduce_backlog+0x470/0x470 [ 279.893473] tc_modify_qdisc+0x6f7/0x16d0 [ 279.894344] ? tc_get_qdisc+0xac0/0xac0 [ 279.895213] ? mutex_lock+0x7d/0xd0 [ 279.896005] ? __mutex_lock_slowpath+0x10/0x10 [ 279.896910] rtnetlink_rcv_msg+0x5fe/0x9d0 [ 279.897770] ? rtnl_calcit.isra.0+0x2b0/0x2b0 [ 279.898672] ? __sys_sendmsg+0xb5/0x140 [ 279.899494] ? do_syscall_64+0x3d/0x90 [ 279.900302] ? entry_SYSCALL_64_after_hwframe+0x46/0xb0 [ 279.901337] ? kasan_save_stack+0x2e/0x40 [ 279.902177] ? kasan_save_stack+0x1e/0x40 [ 279.903058] ? kasan_set_track+0x21/0x30 [ 279.903913] ? kasan_save_free_info+0x2a/0x40 [ 279.904836] ? ____kasan_slab_free+0x11a/0x1b0 [ 279.905741] ? kmem_cache_free+0x179/0x400 [ 279.906599] netlink_rcv_skb+0x12c/0x360 [ 279.907450] ? rtnl_calcit.isra.0+0x2b0/0x2b0 [ 279.908360] ? netlink_ack+0x1550/0x1550 [ 279.909192] ? rhashtable_walk_peek+0x170/0x170 [ 279.910135] ? kmem_cache_alloc_node+0x1af/0x390 [ 279.911086] ? _copy_from_iter+0x3d6/0xc70 [ 279.912031] netlink_unicast+0x553/0x790 [ 279.912864] ? netlink_attachskb+0x6a0/0x6a0 [ 279.913763] ? netlink_recvmsg+0x416/0xb50 [ 279.914627] netlink_sendmsg+0x7a1/0xcb0 [ 279.915473] ? netlink_unicast+0x790/0x790 [ 279.916334] ? iovec_from_user.part.0+0x4d/0x220 [ 279.917293] ? netlink_unicast+0x790/0x790 [ 279.918159] sock_sendmsg+0xc5/0x190 [ 279.918938] ____sys_sendmsg+0x535/0x6b0 [ 279.919813] ? import_iovec+0x7/0x10 [ 279.920601] ? kernel_sendmsg+0x30/0x30 [ 279.921423] ? __copy_msghdr+0x3c0/0x3c0 [ 279.922254] ? import_iovec+0x7/0x10 [ 279.923041] ___sys_sendmsg+0xeb/0x170 [ 279.923854] ? copy_msghdr_from_user+0x110/0x110 [ 279.924797] ? ___sys_recvmsg+0xd9/0x130 [ 279.925630] ? __perf_event_task_sched_in+0x183/0x470 [ 279.926656] ? ___sys_sendmsg+0x170/0x170 [ 279.927529] ? ctx_sched_in+0x530/0x530 [ 279.928369] ? update_curr+0x283/0x4f0 [ 279.929185] ? perf_event_update_userpage+0x570/0x570 [ 279.930201] ? __fget_light+0x57/0x520 [ 279.931023] ? __switch_to+0x53d/0xe70 [ 279.931846] ? sockfd_lookup_light+0x1a/0x140 [ 279.932761] __sys_sendmsg+0xb5/0x140 [ 279.933560] ? __sys_sendmsg_sock+0x20/0x20 [ 279.934436] ? fpregs_assert_state_consistent+0x1d/0xa0 [ 279.935490] do_syscall_64+0x3d/0x90 [ 279.936300] entry_SYSCALL_64_after_hwframe+0x46/0xb0 [ 279.937311] RIP: 0033:0x7f21c814f887 [ 279.938085] Code: 0a 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b9 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10 [ 279.941448] RSP: 002b:00007fff11efd478 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [ 279.942964] RAX: ffffffffffffffda RBX: 0000000064401979 RCX: 00007f21c814f887 [ 279.944337] RDX: 0000000000000000 RSI: 00007fff11efd4e0 RDI: 0000000000000003 [ 279.945660] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000 [ 279.947003] R10: 00007f21c8008708 R11: 0000000000000246 R12: 0000000000000001 [ 279.948345] R13: 0000000000409980 R14: 000000000047e538 R15: 0000000000485400 [ 279.949690] </TASK>
[ 279.950706] Allocated by task 2960: [ 279.951471] kasan_save_stack+0x1e/0x40 [ 279.952338] kasan_set_track+0x21/0x30 [ 279.953165] __kasan_kmalloc+0x77/0x90 [ 279.954006] flow_block_cb_setup_simple+0x3dd/0x7c0 [ 279.955001] tcf_block_offload_cmd.isra.0+0x189/0x2d0 [ 279.956020] tcf_block_get_ext+0x61c/0x1200 [ 279.956881] ingress_init+0x112/0x1c0 [sch_ingress] [ 279.957873] qdisc_create+0x401/0xea0 [ 279.958656] tc_modify_qdisc+0x6f7/0x16d0 [ 279.959506] rtnetlink_rcv_msg+0x5fe/0x9d0 [ 279.960392] netlink_rcv_skb+0x12c/0x360 [ 279.961216] netlink_unicast+0x553/0x790 [ 279.962044] netlink_sendmsg+0x7a1/0xcb0 [ 279.962906] sock_sendmsg+0xc5/0x190 [ 279.963702] ____sys_sendmsg+0x535/0x6b0 [ 279.964534] ___sys_sendmsg+0xeb/0x170 [ 279.965343] __sys_sendmsg+0xb5/0x140 [ 279.966132] do_syscall_64+0x3d/0x90 [ 279.966908] entry_SYSCALL_64_after_hwframe+0x46/0xb0
[ 279.968407] Freed by task 2960: [ 279.969114] kasan_save_stack+0x1e/0x40 [ 279.969929] kasan_set_track+0x21/0x30 [ 279.970729] kasan_save_free_info+0x2a/0x40 [ 279.971603] ____kasan_slab_free+0x11a/0x1b0 [ 279.972483] __kmem_cache_free+0x14d/0x280 [ 279.973337] tcf_block_setup+0x29d/0x6b0 [ 279.974173] tcf_block_offload_cmd.isra.0+0x226/0x2d0 [ 279.975186] tcf_block_get_ext+0x61c/0x1200 [ 279.976080] ingress_init+0x112/0x1c0 [sch_ingress] [ 279.977065] qdisc_create+0x401/0xea0 [ 279.977857] tc_modify_qdisc+0x6f7/0x16d0 [ 279.978695] rtnetlink_rcv_msg+0x5fe/0x9d0 [ 279.979562] netlink_rcv_skb+0x12c/0x360 [ 279.980388] netlink_unicast+0x553/0x790 [ 279.981214] netlink_sendmsg+0x7a1/0xcb0 [ 279.982043] sock_sendmsg+0xc5/0x190 [ 279.982827] ____sys_sendmsg+0x535/0x6b0 [ 279.983703] ___sys_sendmsg+0xeb/0x170 [ 279.984510] __sys_sendmsg+0xb5/0x140 [ 279.985298] do_syscall_64+0x3d/0x90 [ 279.986076] entry_SYSCALL_64_after_hwframe+0x46/0xb0
[ 279.987532] The buggy address belongs to the object at ffff888147e2bf00
which belongs to the cache kmalloc-192 of size 192
[ 279.989747] The buggy address is located 32 bytes inside of
freed 192-byte region [ffff888147e2bf00, ffff888147e2bfc0)[ 279.992367] The buggy address belongs to the physical page: [ 279.993430] page:00000000550f405c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x147e2a [ 279.995182] head:00000000550f405c order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ 279.996713] anon flags: 0x200000000010200(slab|head|node=0|zone=2) [ 279.997878] raw: 0200000000010200 ffff888100042a00 0000000000000000 dead000000000001 [ 279.999384] raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000 [ 280.000894] page dumped because: kasan: bad access detected
[ 280.002386] Memory state around the buggy address: [ 280.003338] ffff888147e2be00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 280.004781] ffff888147e2be80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 280.006224] >ffff888147e2bf00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 280.007700] ^ [ 280.008592] ffff888147e2bf80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 280.010035] ffff888147e2c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 280.011564] ==================================================================
--- net/sched/cls_api.c | 1 + 1 file changed, 1 insertion(+)
net/sched/cls_api.c +1 -0
@@ -1466,6 +1466,7 @@ static int tcf_block_bind(struct tcf_block *block, err_unroll:list_for_each_entry_safe (block_cb, next, &bo->cb_list, list) { +list_del (&block_cb->driver_list);if (i-- >0 ) {list_del (&block_cb->list); tcf_block_playback_offloads(block, block_cb->cb,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 311/381 sit: update dev->needed_headroom in ipip6_tunnel_bind_dev()
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
[ Upstream commit c88f8d5cd95fd039cff95d682b8e71100c001df0 ]
When a tunnel device is bound with the underlying device, its dev->needed_headroom needs to be updated properly. IPv4 tunnels already do the same in ip_tunnel_bind_dev(). Otherwise we may not have enough header room for skb, especially after commit b17f709a2401 ("gue: TX support for using remote checksum offload option").
--- net/ipv6/sit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/ipv6/sit.c +5 -3
@@ -1094,12 +1094,13 @@ static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb,static void ipip6_tunnel_bind_dev (struct net_device *dev) { +struct ip_tunnel *tunnel =netdev_priv (dev); +int t_hlen = tunnel->hlen +sizeof (struct iphdr );struct net_device *tdev =NULL ; -struct ip_tunnel *tunnel; +int hlen =LL_MAX_HEADER ;const struct iphdr *iph;struct flowi4 fl4; - tunnel =netdev_priv (dev); iph = &tunnel->parms.iph;if (iph->daddr) {
@@ -1122,14 +1123,15 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev) tdev =__dev_get_by_index (tunnel->net, tunnel->parms.link);if (tdev && !netif_is_l3_master (tdev)) { -int t_hlen = tunnel->hlen +sizeof (struct iphdr );int mtu; mtu = tdev->mtu - t_hlen;if (mtu <IPV6_MIN_MTU ) mtu =IPV6_MIN_MTU ;WRITE_ONCE (dev->mtu, mtu); + hlen = tdev->hard_header_len + tdev->needed_headroom; } + dev->needed_headroom = t_hlen + hlen; } static void ipip6_tunnel_update(struct ip_tunnel *t, struct ip_tunnel_parm *p,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 312/381 net: dsa: mv88e6xxx: add mv88e6321 rsvd2cpu
In reply to Greg Kroah-HartmanFrom: Angelo Dureghello <[email protected]>
[ Upstream commit 6686317855c6997671982d4489ccdd946f644957 ]
Add rsvd2cpu capability for mv88e6321 model, to allow proper bpdu processing.
--- drivers/net/dsa/mv88e6xxx/chip.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mv88e6xxx/chip.c +1 -0
@@ -4182,6 +4182,7 @@ static const struct mv88e6xxx_ops mv88e6321_ops = { .set_cpu_port = mv88e6095_g1_set_cpu_port, .set_egress_port = mv88e6095_g1_set_egress_port, .watchdog_ops = &mv88e6390_watchdog_ops, + .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, .reset = mv88e6352_g1_reset, .vtu_getnext = mv88e6185_g1_vtu_getnext, .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 313/381 writeback: fix call of incorrect macro
In reply to Greg Kroah-HartmanFrom: Maxim Korotkov <[email protected]>
[ Upstream commit 3e46c89c74f2c38e5337d2cf44b0b551adff1cb4 ]
the variable 'history' is of type u16, it may be an error that the hweight32 macro was used for it
I guess macro hweight16 should be used
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/fs-writeback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fs-writeback.c +1 -1
@@ -700,7 +700,7 @@ void wbc_detach_inode(struct writeback_control *wbc)* is okay. The main goal is avoiding keeping an inode on * the wrong wb for an extended period of time. */ -if (hweight32 (history) >WB_FRN_HIST_THR_SLOTS ) +if (hweight16 (history) >WB_FRN_HIST_THR_SLOTS )inode_switch_wbs (inode, max_id); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 314/381 watchdog: dw_wdt: Fix the error handling path of dw_wdt_drv_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 7f5390750645756bd5da2b24fac285f2654dd922 ]
The commit in Fixes has only updated the remove function and missed the error handling path of the probe.
Add the missing reset_control_assert() call.
--- drivers/watchdog/dw_wdt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/watchdog/dw_wdt.c +5 -2
@@ -638,7 +638,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) ret =dw_wdt_init_timeouts (dw_wdt, dev);if (ret) - goto out_disable_clk; + goto out_assert_rst; wdd = &dw_wdt->wdd; wdd->ops = &dw_wdt_ops;
@@ -669,12 +669,15 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) ret =watchdog_register_device (wdd);if (ret) - goto out_disable_pclk; + goto out_assert_rst;dw_wdt_dbgfs_init (dw_wdt);return 0 ; +out_assert_rst: +reset_control_assert (dw_wdt->rst); + out_disable_pclk:clk_disable_unprepare (dw_wdt->pclk);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 315/381 net/sched: act_mirred: Add carrier check
In reply to Greg Kroah-HartmanFrom: Victor Nogueira <[email protected]>
[ Upstream commit 526f28bd0fbdc699cda31426928802650c1528e5 ]
There are cases where the device is adminstratively UP, but operationally down. For example, we have a physical device (Nvidia ConnectX-6 Dx, 25Gbps) who's cable was pulled out, here is its ip link output:
5: ens2f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether b8:ce:f6:4b:68:35 brd ff:ff:ff:ff:ff:ff
altname enp179s0f1np1As you can see, it's administratively UP but operationally down. In this case, sending a packet to this port caused a nasty kernel hang (so nasty that we were unable to capture it). Aborting a transmit based on operational status (in addition to administrative status) fixes the issue.
v1->v2: Add fixes tagv2->v3: Remove blank line between tags + add change log, suggested by Leon
--- net/sched/act_mirred.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_mirred.c +1 -1
@@ -244,7 +244,7 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, goto out; } -if (unlikely (!(dev->flags &IFF_UP ))) { +if (unlikely (!(dev->flags &IFF_UP )) || !netif_carrier_ok (dev)) {net_notice_ratelimited ("tc mirred to Houston: device %s is down\n" , dev->name); goto out;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 316/381 sfc: Fix module EEPROM reporting for QSFP modules
In reply to Greg Kroah-HartmanFrom: Andy Moreton <[email protected]>
[ Upstream commit 281900a923d4c50df109b52a22ae3cdac150159b ]
The sfc driver does not report QSFP module EEPROM contents correctly as only the first page is fetched from hardware.
Commit 0e1a2a3e6e7d ("ethtool: Add SFF-8436 and SFF-8636 max EEPROM length definitions") added ETH_MODULE_SFF_8436_MAX_LEN for the overall size of the EEPROM info, so use that to report the full EEPROM contents.
--- drivers/net/ethernet/sfc/mcdi_port_common.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/sfc/mcdi_port_common.c +7 -4
@@ -974,12 +974,15 @@ static u32 efx_mcdi_phy_module_type(struct efx_nic *efx)/* A QSFP+ NIC may actually have an SFP+ module attached. * The ID is page 0, byte 0. +* QSFP28 is of type SFF_8636, however, this is treated +* the same by ethtool, so we can also treat them the same. */ switch (efx_mcdi_phy_get_module_eeprom_byte (efx,0 ,0 )) { -case 0x3 : +case 0x3 :/* SFP */ return MC_CMD_MEDIA_SFP_PLUS ; -case 0xc : -case 0xd : +case 0xc :/* QSFP */ +case 0xd :/* QSFP+ */ +case 0x11 :/* QSFP28 */ return MC_CMD_MEDIA_QSFP_PLUS ;default :return 0 ;
@@ -1077,7 +1080,7 @@ int efx_mcdi_phy_get_module_info(struct efx_nic *efx, struct ethtool_modinfo *mocase MC_CMD_MEDIA_QSFP_PLUS : modinfo->type =ETH_MODULE_SFF_8436 ; - modinfo->eeprom_len =ETH_MODULE_SFF_8436_LEN ; + modinfo->eeprom_len =ETH_MODULE_SFF_8436_MAX_LEN ;break ;default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 317/381 rxrpc: Fix hard call timeout units
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 0d098d83c5d9e107b2df7f5e11f81492f56d2fe7 ]
The hard call timeout is specified in the RXRPC_SET_CALL_TIMEOUT cmsg in seconds, so fix the point at which sendmsg() applies it to the call to convert to jiffies from seconds, not milliseconds.
--- net/rxrpc/sendmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/sendmsg.c +1 -1
@@ -753,7 +753,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len) fallthrough;case 1 :if (p.call.timeouts.hard >0 ) { - j =msecs_to_jiffies (p.call.timeouts.hard); + j = p.call.timeouts.hard *HZ ; now = jiffies; j += now;WRITE_ONCE (call->expect_term_by, j);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 318/381 octeontx2-pf: Disable packet I/O for graceful exit
In reply to Greg Kroah-HartmanFrom: Subbaraya Sundeep <[email protected]>
[ Upstream commit c926252205c424c4842dbdbe02f8e3296f623204 ]
At the stage of enabling packet I/O in otx2_open, If mailbox timeout occurs then interface ends up in down state where as hardware packet I/O is enabled. Hence disable packet I/O also before bailing out.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +10 -1
@@ -1589,11 +1589,20 @@ int otx2_open(struct net_device *netdev)otx2_config_pause_frm (pf); err =otx2_rxtx_enable (pf, true); -if (err) +/* If a mbox communication error happens at this point then interface +* will end up in a state such that it is in down state but hardware +* mcam entries are enabled to receive the packets. Hence disable the +* packet I/O. +*/ +if (err ==EIO ) + goto err_disable_rxtx; +else if (err) goto err_tx_stop_queues;return 0 ; +err_disable_rxtx: +otx2_rxtx_enable (pf, false); err_tx_stop_queues:netif_tx_stop_all_queues (netdev);netif_carrier_off (netdev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 319/381 octeontx2-vf: Detach LF resources on probe cleanup
In reply to Greg Kroah-HartmanFrom: Subbaraya Sundeep <[email protected]>
[ Upstream commit 99ae1260fdb5f15beab8a3adfb93a9041c87a2c1 ]
When a VF device probe fails due to error in MSIX vector allocation then the resources NIX and NPA LFs were not detached. Fix this by detaching the LFs when MSIX vector allocation fails.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +1 -1
@@ -542,7 +542,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) err =otx2vf_realloc_msix_vectors (vf);if (err) - goto err_mbox_destroy; + goto err_detach_rsrc; err =otx2_set_real_num_queues (netdev, qcount, qcount);if (err)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 320/381 ionic: remove noise from ethtool rxnfc error msg
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit 3711d44fac1f80ea69ecb7315fed05b3812a7401 ]
It seems that ethtool is calling into .get_rxnfc more often with ETHTOOL_GRXCLSRLCNT which ionic doesn't know about. We don't need to log a message about it, just return not supported.
--- drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +1 -1
@@ -693,7 +693,7 @@ static int ionic_get_rxnfc(struct net_device *netdev, info->data = lif->nxqs;break ;default : -netdev_err (netdev,"Command parameter %d is not supported\n" , +netdev_dbg (netdev,"Command parameter %d is not supported\n" , info->cmd); err = -EOPNOTSUPP ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 321/381 af_packet: Dont send zero-byte data in packet_sendmsg_spkt().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 6a341729fb31b4c5df9f74f24b4b1c98410c9b87 ]
syzkaller reported a warning below [0].
We can reproduce it by sending 0-byte data from the (AF_PACKET, SOCK_PACKET) socket via some devices whose dev->hard_header_len is 0.
struct sockaddr_pkt addr = {
.spkt_family = AF_PACKET,
.spkt_device = "tun0",
};
int fd;
fd = socket(AF_PACKET, SOCK_PACKET, 0);
sendto(fd, NULL, 0, 0, (struct sockaddr *)&addr, sizeof(addr));We have a similar fix for the (AF_PACKET, SOCK_RAW) socket as commit dc633700f00f ("net/af_packet: check len when min_header_len equals to 0").
Let's add the same test for the SOCK_PACKET socket.
[0]:skb_assert_len
WARNING: CPU: 1 PID: 19945 at include/linux/skbuff.h:2552 skb_assert_len include/linux/skbuff.h:2552 [inline] WARNING: CPU: 1 PID: 19945 at include/linux/skbuff.h:2552 __dev_queue_xmit+0x1f26/0x31d0 net/core/dev.c:4159 Modules linked in: CPU: 1 PID: 19945 Comm: syz-executor.0 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:skb_assert_len include/linux/skbuff.h:2552 [inline] RIP: 0010:__dev_queue_xmit+0x1f26/0x31d0 net/core/dev.c:4159 Code: 89 de e8 1d a2 85 fd 84 db 75 21 e8 64 a9 85 fd 48 c7 c6 80 2a 1f 86 48 c7 c7 c0 06 1f 86 c6 05 23 cf 27 04 01 e8 fa ee 56 fd <0f> 0b e8 43 a9 85 fd 0f b6 1d 0f cf 27 04 31 ff 89 de e8 e3 a1 85 RSP: 0018:ffff8880217af6e0 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffc90001133000 RDX: 0000000000040000 RSI: ffffffff81186922 RDI: 0000000000000001 RBP: ffff8880217af8b0 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000001 R12: ffff888030045640 R13: ffff8880300456b0 R14: ffff888030045650 R15: ffff888030045718 FS: 00007fc5864da640(0000) GS:ffff88806cd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020005740 CR3: 000000003f856003 CR4: 0000000000770ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> dev_queue_xmit include/linux/netdevice.h:3085 [inline] packet_sendmsg_spkt+0xc4b/0x1230 net/packet/af_packet.c:2066 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg+0x1b4/0x200 net/socket.c:747 ____sys_sendmsg+0x331/0x970 net/socket.c:2503 ___sys_sendmsg+0x11d/0x1c0 net/socket.c:2557 __sys_sendmmsg+0x18c/0x430 net/socket.c:2643 __do_sys_sendmmsg net/socket.c:2672 [inline] __se_sys_sendmmsg net/socket.c:2669 [inline] __x64_sys_sendmmsg+0x9c/0x100 net/socket.c:2669 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3c/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7fc58791de5d Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 9f 1b 00 f7 d8 64 89 01 48 RSP: 002b:00007fc5864d9cc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 00000000004bbf80 RCX: 00007fc58791de5d RDX: 0000000000000001 RSI: 0000000020005740 RDI: 0000000000000004 RBP: 00000000004bbf80 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fc58797e530 R15: 0000000000000000 </TASK> ---[ end trace 0000000000000000 ]---
skb len=0 headroom=16 headlen=0 tailroom=304 mac=(16,0) net=(16,-1) trans=-1 shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0)) csum(0x0 ip_summed=0 complete_sw=0 valid=0 level=0) hash(0x0 sw=0 l4=0) proto=0x0000 pkttype=0 iif=0 dev name=sit0 feat=0x00000006401d7869
sk family=17 type=10 proto=0
--- net/packet/af_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/packet/af_packet.c +1 -1
@@ -1996,7 +1996,7 @@ static int packet_sendmsg_spkt(struct socket *sock, struct msghdr *msg, goto retry; } -if (!dev_validate_header (dev, skb->data, len)) { +if (!dev_validate_header (dev, skb->data, len) || !skb->len) { err = -EINVAL ; goto out_unlock; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 322/381 drm/amdgpu: add a missing lock for AMDGPU_SCHED
In reply to Greg Kroah-HartmanFrom: Chia-I Wu <[email protected]>
[ Upstream commit 2397e3d8d2e120355201a8310b61929f5a8bd2c0 ]
mgr->ctx_handles should be protected by mgr->lock.
v2: improve commit message
v3: add a Fixes tag
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +5 -1
@@ -66,6 +66,7 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev, {struct fd f =fdget (fd);struct amdgpu_fpriv *fpriv; +struct amdgpu_ctx_mgr *mgr;struct amdgpu_ctx *ctx;uint32_t id;int r;
@@ -79,8 +80,11 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,return r; } -idr_for_each_entry (&fpriv->ctx_mgr.ctx_handles, ctx, id) + mgr = &fpriv->ctx_mgr; +mutex_lock (&mgr->lock); +idr_for_each_entry (&mgr->ctx_handles, ctx, id)amdgpu_ctx_priority_override (ctx, priority); +mutex_unlock (&mgr->lock);fdput (f);return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 323/381 ALSA: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init`
In reply to Greg Kroah-HartmanFrom: Ruliang Lin <[email protected]>
[ Upstream commit 0d727e1856ef22dd9337199430258cb64cbbc658 ]
Smatch complains that:snd_usb_caiaq_input_init() warn: missing error code 'ret'
This patch adds a new case to handle the situation where the device does not support any input methods in the snd_usb_caiaq_input_init function. It returns an -EINVAL error code to indicate that no input methods are supported on the device.
--- sound/usb/caiaq/input.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/caiaq/input.c +1 -0
@@ -804,6 +804,7 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev)default :/* no input methods supported on this device */ + ret = -EINVAL ; goto exit_free_idev; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 324/381 net: dsa: mt7530: fix corrupt frames using trgmii on 40 MHz XTAL MT7621
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit 37c218d8021e36e226add4bab93d071d30fe0704 ]
The multi-chip module MT7530 switch with a 40 MHz oscillator on the MT7621AT, MT7621DAT, and MT7621ST SoCs forwards corrupt frames using trgmii.
This is caused by the assumption that MT7621 SoCs have got 150 MHz PLL, hence using the ncpo1 value, 0x0780.
My testing shows this value works on Unielec U7621-06, Bartel's testing shows it won't work on Hi-Link HLK-MT7621A and Netgear WAC104. All devices tested have got 40 MHz oscillators.
Using the value for 125 MHz PLL, 0x0640, works on all boards at hand. The definitions for 125 MHz PLL exist on the Banana Pi BPI-R2 BSP source code whilst 150 MHz PLL don't.
Forwarding frames using trgmii on the MCM MT7530 switch with a 25 MHz oscillator on the said MT7621 SoCs works fine because the ncpo1 value defined for it is for 125 MHz PLL.
Change the 150 MHz PLL comment to 125 MHz PLL, and use the 125 MHz PLL ncpo1 values for both oscillator frequencies.
--- drivers/net/dsa/mt7530.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/mt7530.c +2 -2
@@ -404,9 +404,9 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)case PHY_INTERFACE_MODE_TRGMII : trgint =1 ;if (priv->id ==ID_MT7621 ) { -/* PLL frequency: 150MHz: 1.2GBit */ +/* PLL frequency: 125MHz: 1.0GBit */ if (xtal ==HWTRAP_XTAL_40MHZ ) - ncpo1 =0x0780 ; + ncpo1 =0x0640 ;if (xtal ==HWTRAP_XTAL_25MHZ ) ncpo1 =0x0a00 ; }else {/* PLL frequency: 250MHz: 2.0Gbit */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 325/381 virtio_net: split free_unused_bufs()
In reply to Greg Kroah-HartmanFrom: Xuan Zhuo <[email protected]>
[ Upstream commit 6e345f8c7cd029ad3aaece15ad4425ac26e4eb63 ]
This patch separates two functions for freeing sq buf and rq buf from free_unused_bufs().
When supporting the enable/disable tx/rq queue in the future, it is necessary to support separate recovery of a sq buf or a rq buf.
Message-Id: <[email protected]>
Stable-dep-of: f8bb51043945 ("virtio_net: suppress cpu stall when free_unused_bufs")
--- drivers/net/virtio_net.c | 41 ++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-)
drivers/net/virtio_net.c +25 -16
@@ -2747,6 +2747,27 @@ static void free_receive_page_frags(struct virtnet_info *vi)put_page (vi->rq[i].alloc_frag.page); } +static void virtnet_sq_free_unused_buf (struct virtqueue *vq,void *buf) +{ +if (!is_xdp_frame (buf)) +dev_kfree_skb (buf); +else +xdp_return_frame (ptr_to_xdp (buf)); +} + +static void virtnet_rq_free_unused_buf (struct virtqueue *vq,void *buf) +{ +struct virtnet_info *vi = vq->vdev->priv; +int i =vq2rxq (vq); + +if (vi->mergeable_rx_bufs) +put_page (virt_to_head_page (buf)); +else if (vi->big_packets) +give_pages (&vi->rq[i], buf); +else +put_page (virt_to_head_page (buf)); +} +static void free_unused_bufs (struct virtnet_info *vi) {void *buf;
@@ -2754,26 +2775,14 @@ static void free_unused_bufs(struct virtnet_info *vi)for (i =0 ; i < vi->max_queue_pairs; i++) {struct virtqueue *vq = vi->sq[i].vq; -while ((buf =virtqueue_detach_unused_buf (vq)) !=NULL ) { -if (!is_xdp_frame (buf)) -dev_kfree_skb (buf); -else -xdp_return_frame (ptr_to_xdp (buf)); - } +while ((buf =virtqueue_detach_unused_buf (vq)) !=NULL ) +virtnet_sq_free_unused_buf (vq, buf); }for (i =0 ; i < vi->max_queue_pairs; i++) {struct virtqueue *vq = vi->rq[i].vq; - -while ((buf =virtqueue_detach_unused_buf (vq)) !=NULL ) { -if (vi->mergeable_rx_bufs) { -put_page (virt_to_head_page (buf)); - }else if (vi->big_packets) { -give_pages (&vi->rq[i], buf); - }else { -put_page (virt_to_head_page (buf)); - } - } +while ((buf =virtqueue_detach_unused_buf (vq)) !=NULL ) +virtnet_rq_free_unused_buf (vq, buf); } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 326/381 virtio_net: suppress cpu stall when free_unused_bufs
In reply to Greg Kroah-HartmanFrom: Wenliang Wang <[email protected]>
[ Upstream commit f8bb5104394560e29017c25bcade4c6b7aabd108 ]
For multi-queue and large ring-size use case, the following error occurred when free_unused_bufs:
rcu: INFO: rcu_sched self-detected stall on CPU.
--- drivers/net/virtio_net.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/virtio_net.c +2 -0
@@ -2777,12 +2777,14 @@ static void free_unused_bufs(struct virtnet_info *vi)struct virtqueue *vq = vi->sq[i].vq;while ((buf =virtqueue_detach_unused_buf (vq)) !=NULL )virtnet_sq_free_unused_buf (vq, buf); +cond_resched (); }for (i =0 ; i < vi->max_queue_pairs; i++) {struct virtqueue *vq = vi->rq[i].vq;while ((buf =virtqueue_detach_unused_buf (vq)) !=NULL )virtnet_rq_free_unused_buf (vq, buf); +cond_resched (); } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 327/381 net: enetc: check the index of the SFI rather than the handle
In reply to Greg Kroah-HartmanFrom: Wei Fang <[email protected]>
[ Upstream commit 299efdc2380aac588557f4d0b2ce7bee05bd0cf2 ]
We should check whether the current SFI (Stream Filter Instance) table is full before creating a new SFI entry. However, the previous logic checks the handle by mistake and might lead to unpredictable behavior.
--- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_qos.c +1 -1
@@ -1266,7 +1266,7 @@ static int enetc_psfp_parse_clsflower(struct enetc_ndev_priv *priv,int index; index =enetc_get_free_index (priv); -if (sfi->handle <0 ) { +if (index <0 ) {NL_SET_ERR_MSG_MOD (extack,"No Stream Filter resource!" ); err = -ENOSPC ; goto free_fmi;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 328/381 net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 93e0401e0fc0c54b0ac05b687cd135c2ac38187c ]
The call to phy_stop() races with the later call to phy_disconnect(), resulting in concurrent phy_suspend() calls being run from different CPUs. The final call to phy_disconnect() ensures that the PHY is stopped and suspended, too.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -1
@@ -3412,7 +3412,6 @@ static void bcmgenet_netif_stop(struct net_device *dev)/* Disable MAC transmit. TX DMA disabled must be done before this */ umac_enable_set (priv,CMD_TX_EN , false); -phy_stop (dev->phydev);bcmgenet_disable_rx_napi (priv);bcmgenet_intr_disable (priv);
Signature · 1 line
2.39.2
Re: [PATCH 5.10 328/381] net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()
Quoted 9 lines · Greg Kroah-Hartman
From: Florian Fainelli <[email protected]>
[ Upstream commit
93e0401e0fc0c54b0ac05b687cd135c2ac38187c]The call to
phy_stop()races with the later call tophy_disconnect(), resulting in concurrentphy_suspend()calls being run from different CPUs. The final call tophy_disconnect()ensures that the PHY is stopped and suspended, too.
Quoted 4 lines
Fixes c96e731c93ff ("net: bcmgenet: connect and disconnect from the PHY state machine")Signed-off-by Florian Fainelli <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Please drop this patch until https://lore.kernel.org/lkml/[email protected]/ is merged, thanks!
Signature · 1 line
Florian
Greg Kroah-Hartman
maintainerPATCH 329/381 perf vendor events power9: Remove UTF-8 characters from JSON files
In reply to Greg Kroah-HartmanFrom: Kajol Jain <[email protected]>
[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]
Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events") added and updated power9 PMU JSON events. However some of the JSON events which are part of other.json and pipeline.json files, contains UTF-8 characters in their brief description. Having UTF-8 character could breaks the perf build on some distros.
Fix this issue by removing the UTF-8 characters from other.json and pipeline.json files.
Result without the fix:
[command]# file -i pmu-events/arch/powerpc/power9/*
pmu-events/arch/powerpc/power9/cache.json: application/json; charset=us-ascii
pmu-events/arch/powerpc/power9/floating-point.json: application/json; charset=us-ascii
pmu-events/arch/powerpc/power9/frontend.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/marked.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/memory.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/metrics.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/nest_metrics.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/other.json: application/json; charset=utf-8 pmu-events/arch/powerpc/power9/pipeline.json: application/json; charset=utf-8 pmu-events/arch/powerpc/power9/pmc.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/translation.json: application/json; charset=us-ascii
[command]#
Result with the fix:
[command]# file -i pmu-events/arch/powerpc/power9/*
pmu-events/arch/powerpc/power9/cache.json: application/json; charset=us-ascii
pmu-events/arch/powerpc/power9/floating-point.json: application/json; charset=us-ascii
pmu-events/arch/powerpc/power9/frontend.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/marked.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/memory.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/metrics.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/nest_metrics.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/other.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/pipeline.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/pmc.json: application/json; charset=us-ascii pmu-events/arch/powerpc/power9/translation.json: application/json; charset=us-ascii
[command]#
--- tools/perf/pmu-events/arch/powerpc/power9/other.json | 4 ++-- tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/pmu-events/arch/powerpc/power9/other.json +2 -2
@@ -1417,7 +1417,7 @@ { "EventCode": "0x45054", "EventName": "PM_FMA_CMPL", - "BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, fnmsub) Scalar instructions only. " + "BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, fnmsub) Scalar instructions only." }, { "EventCode": "0x201E8",
@@ -2017,7 +2017,7 @@ { "EventCode": "0xC0BC", "EventName": "PM_LSU_FLUSH_OTHER", - "BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 caused search of LRQ for oldest snooped load, This will either signal a Precise Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next (several cases of this, one example is store and reload are lined up such that a store-hit-reload scenario exists and the CDF has already launched and has gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of this, one example is a larxa (D$ hit) return data and dval but can't allocate to LMQ (LMQ full or other reason). Already gave dval but can't watch it for snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)" + "BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 caused search of LRQ for oldest snooped load, This will either signal a Precise Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next (several cases of this, one example is store and reload are lined up such that a store-hit-reload scenario exists and the CDF has already launched and has gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of this, one example is a larxa (D$ hit) return data and dval but can't allocate to LMQ (LMQ full or other reason). Already gave dval but can't watch it for snoop_hit_larx. Need to take the 'bad dval' back and flush all younger ops)" }, { "EventCode": "0x5094",
tools/perf/pmu-events/arch/powerpc/power9/pipeline.json +1 -1
@@ -442,7 +442,7 @@ { "EventCode": "0x4D052", "EventName": "PM_2FLOP_CMPL", - "BriefDescription": "DP vector version of fmul, fsub, fcmp, fsel, fabs, fnabs, fres ,fsqrte, fneg " + "BriefDescription": "DP vector version of fmul, fsub, fcmp, fsel, fabs, fnabs, fres ,fsqrte, fneg" }, { "EventCode": "0x1F142",
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 330/381 perf pmu: zfree() expects a pointer to a pointer to zero it after freeing its contents
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 57f14b5ae1a97537f2abd2828ee7212cada7036e ]
An audit showed just this one problem with zfree(), fix it.
--- tools/perf/util/pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/pmu.c +1 -1
@@ -1670,7 +1670,7 @@ static int perf_pmu__new_caps(struct list_head *list, char *name, char *value)return 0 ; free_name: -zfree (caps->name); +zfree (&caps->name); free_caps:free (caps);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 331/381 perf map: Delete two variable initialisations before null pointer checks in sort__sym_from_cmp()
In reply to Greg Kroah-HartmanFrom: Markus Elfring <[email protected]>
[ Upstream commit c160118a90d4acf335993d8d59b02ae2147a524e ]
Addresses of two data structure members were determined before corresponding null pointer checks in the implementation of the function “sort__sym_from_cmp”.
Thus avoid the risk for undefined behaviour by removing extra initialisations for the local variables “from_l” and “from_r” (also because they were already reassigned with the same value behind this pointer check).
This issue was detected by using the Coccinelle software.
--- tools/perf/util/sort.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/sort.c +1 -2
@@ -873,8 +873,7 @@ static int hist_entry__dso_to_filter(struct hist_entry *he, int type,static int64_t sort__sym_from_cmp (struct hist_entry *left,struct hist_entry *right) { -struct addr_map_symbol *from_l = &left->branch_info->from; -struct addr_map_symbol *from_r = &right->branch_info->from; +struct addr_map_symbol *from_l, *from_r;if (!left->branch_info || !right->branch_info)return cmp_null (left->branch_info, right->branch_info);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 332/381 crypto: sun8i-ss - Fix a test in sun8i_ss_setup_ivs()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 8fd91151ebcb21b3f2f2bf158ac6092192550b2b ]
SS_ENCRYPTION is (0 << 7 = 0), so the test can never be true. Use a direct comparison to SS_ENCRYPTION instead.
The same king of test is already done the same way in sun8i_ss_run_task().
--- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +1 -1
@@ -132,7 +132,7 @@ static int sun8i_ss_setup_ivs(struct skcipher_request *areq) } rctx->p_iv[i] = a;/* we need to setup all others IVs only in the decrypt way */ -if (rctx->op_dir &SS_ENCRYPTION ) +if (rctx->op_dir ==SS_ENCRYPTION )return 0 ; todo =min (len,sg_dma_len (sg)); len -= todo;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 333/381 perf symbols: Fix return incorrect build_id size in elf_read_build_id()
In reply to Greg Kroah-HartmanFrom: Yang Jihong <[email protected]>
[ Upstream commit 1511e4696acb715a4fe48be89e1e691daec91c0e ]
In elf_read_build_id(), if gnu build_id is found, should return the size of the actually copied data. If descsz is greater thanBuild_ID_SIZE, write_buildid data access may occur.
--- tools/perf/util/symbol-elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/symbol-elf.c +1 -1
@@ -548,7 +548,7 @@ static int elf_read_build_id(Elf *elf, void *bf, size_t size)size_t sz =min (size, descsz);memcpy (bf, ptr, sz);memset (bf + sz,0 , size - sz); - err = descsz; + err = sz;break ; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 334/381 btrfs: fix btrfs_prev_leaf() to not return the same key twice
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 6f932d4ef007d6a4ae03badcb749fbb8f49196f6 upstream.
A call to btrfs_prev_leaf() may end up returning a path that points to the same item (key) again. This happens if while btrfs_prev_leaf(), after we release the path, a concurrent insertion happens, which moves items off from a sibling into the front of the previous leaf, and an item with the computed previous key does not exists.
For example, suppose we have the two following leaves:
Leaf A
-------------------------------------------------------------
| ... key (300 96 10) key (300 96 15) key (300 96 16) |
-------------------------------------------------------------
slot 20 slot 21 slot 22
Leaf B
-------------------------------------------------------------
| key (300 96 20) key (300 96 21) key (300 96 22) ... |
-------------------------------------------------------------
slot 0 slot 1 slot 2
If we call btrfs_prev_leaf(), from btrfs_previous_item() for example, with a path pointing to leaf B and slot 0 and the following happens:
1) At btrfs_prev_leaf() we compute the previous key to search as:
(300 96 19), which is a key that does not exists in the tree;
2) Then we call btrfs_release_path() at btrfs_prev_leaf();
3) Some other task inserts a key at leaf A, that sorts before the key at slot 20, for example it has an objectid of 299. In order to make room for the new key, the key at slot 22 is moved to the front of leaf B. This happens at push_leaf_right(), called from split_leaf().
After this leaf B now looks like:
--------------------------------------------------------------------------------
| key (300 96 16) key (300 96 20) key (300 96 21) key (300 96 22) ... |
--------------------------------------------------------------------------------
slot 0 slot 1 slot 2 slot 3
4) At btrfs_prev_leaf() we call btrfs_search_slot() for the computed previous key: (300 96 19). Since the key does not exists, btrfs_search_slot() returns 1 and with a path pointing to leaf B and slot 1, the item with key (300 96 20);
5) This makes btrfs_prev_leaf() return a path that points to slot 1 of leaf B, the same key as before it was called, since the key at slot 0 of leaf B (300 96 16) is less than the computed previous key, which is (300 96 19);
6) As a consequence btrfs_previous_item() returns a path that points again to the item with key (300 96 20).
For some users of btrfs_prev_leaf() or btrfs_previous_item() this may not be functional a problem, despite not making sense to return a new path pointing again to the same item/key. However for a caller such as tree-log.c:log_dir_items(), this has a bad consequence, as it can result in not logging some dir index deletions in case the directory is being logged without holding the inode's VFS lock (logging triggered while logging a child inode for example) - for the example scenario above, in case the dir index keys 17, 18 and 19 were deleted in the current transaction.
--- fs/btrfs/ctree.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
fs/btrfs/ctree.c +31 -1
@@ -5160,10 +5160,12 @@ int btrfs_del_items(struct btrfs_trans_hint btrfs_prev_leaf (struct btrfs_root *root,struct btrfs_path *path) {struct btrfs_key key; +struct btrfs_key orig_key;struct btrfs_disk_key found_key;int ret;btrfs_item_key_to_cpu (path->nodes[0 ], &key,0 ); + orig_key = key;if (key.offset >0 ) { key.offset--;
@@ -5180,8 +5182,36 @@ int btrfs_prev_leaf(struct btrfs_root *rbtrfs_release_path (path); ret =btrfs_search_slot (NULL , root, &key, path,0 ,0 ); -if (ret <0 ) +if (ret <=0 )return ret; + +/* +* Previous key not found. Even if we were at slot 0 of the leaf we had +* before releasing the path and calling btrfs_search_slot(), we now may +* be in a slot pointing to the same original key - this can happen if +* after we released the path, one of more items were moved from a +* sibling leaf into the front of the leaf we had due to an insertion +* (see push_leaf_right()). +* If we hit this case and our slot is > 0 and just decrement the slot +* so that the caller does not process the same key again, which may or +* may not break the caller, depending on its logic. +*/ +if (path->slots[0 ] <btrfs_header_nritems (path->nodes[0 ])) { +btrfs_item_key (path->nodes[0 ], &found_key, path->slots[0 ]); + ret =comp_keys (&found_key, &orig_key); +if (ret ==0 ) { +if (path->slots[0 ] >0 ) { + path->slots[0 ]--; +return 0 ; + } +/* +* At slot 0, same key as before, it means orig_key is +* the lowest, leftmost, key in the tree. We're done. +*/ +return 1 ; + } + } +btrfs_item_key (path->nodes[0 ], &found_key,0 ); ret =comp_keys (&found_key, &key);/*
Greg Kroah-Hartman
maintainerPATCH 335/381 btrfs: dont free qgroup space unless specified
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit d246331b78cbef86237f9c22389205bc9b4e1cc1 upstream.
Boris noticed in his simple quotas testing that he was getting a leak with Sweet Tea's change to subvol create that stopped doing a transaction commit. This was just a side effect of that change.
In the delayed inode code we have an optimization that will free extra reservations if we think we can pack a dir item into an already modified leaf. Previously this wouldn't be triggered in the subvolume create case because we'd commit the transaction, it was still possible but much harder to trigger. It could actually be triggered if we did a mkdir && subvol create with qgroups enabled.
This occurs because in btrfs_insert_delayed_dir_index(), which gets called when we're adding the dir item, we do the following:
btrfs_block_rsv_release(fs_info, trans->block_rsv, bytes, NULL);
if we're able to skip reserving space.
The problem here is that trans->block_rsv points at the temporary block rsv for the subvolume create, which has qgroup reservations in the block rsv.
This is a problem because btrfs_block_rsv_release() will do the following:
if (block_rsv->qgroup_rsv_reserved >= block_rsv->qgroup_rsv_size) {
qgroup_to_release = block_rsv->qgroup_rsv_reserved -
block_rsv->qgroup_rsv_size;
block_rsv->qgroup_rsv_reserved = block_rsv->qgroup_rsv_size;}
The temporary block rsv just has ->qgroup_rsv_reserved set, ->qgroup_rsv_size == 0. The optimization in btrfs_insert_delayed_dir_index() sets ->qgroup_rsv_reserved = 0. Then later on when we call btrfs_subvolume_release_metadata() which has
btrfs_block_rsv_release(fs_info, rsv, (u64)-1, &qgroup_to_release); btrfs_qgroup_convert_reserved_meta(root, qgroup_to_release);
qgroup_to_release is set to 0, and we do not convert the reserved metadata space.
The problem here is that the block rsv code has been unconditionally messing with ->qgroup_rsv_reserved, because the main place this is used is delalloc, and any time we call btrfs_block_rsv_release() we do it with qgroup_to_release set, and thus do the proper accounting.
The subvolume code is the only other code that uses the qgroup reservation stuff, but it's intermingled with the above optimization, and thus was getting its reservation freed out from underneath it and thus leaking the reserved space.
The solution is to simply not mess with the qgroup reservations if we don't have qgroup_to_release set. This works with the existing code as anything that messes with the delalloc reservations always have qgroup_to_release set. This fixes the leak that Boris was observing.
--- fs/btrfs/block-rsv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/block-rsv.c +2 -1
@@ -121,7 +121,8 @@ static u64 block_rsv_release_bytes(struc }else { num_bytes =0 ; } -if (block_rsv->qgroup_rsv_reserved >= block_rsv->qgroup_rsv_size) { +if (qgroup_to_release_ret && + block_rsv->qgroup_rsv_reserved >= block_rsv->qgroup_rsv_size) { qgroup_to_release = block_rsv->qgroup_rsv_reserved - block_rsv->qgroup_rsv_size; block_rsv->qgroup_rsv_reserved = block_rsv->qgroup_rsv_size;
Greg Kroah-Hartman
maintainerPATCH 336/381 btrfs: print-tree: parent bytenr must be aligned to sector size
In reply to Greg Kroah-HartmanFrom: Anastasia Belova <[email protected]>
commit c87f318e6f47696b4040b58f460d5c17ea0280e6 upstream.
Check nodesize to sectorsize in alignment check in print_extent_item. The comment states that and this is correct, similar check is done elsewhere in the functions.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/btrfs/print-tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/print-tree.c +3 -3
@@ -147,10 +147,10 @@ static void print_extent_item(struct extpr_cont ("shared data backref parent %llu count %u\n" , offset,btrfs_shared_data_ref_count (eb, sref));/* -* offset is supposed to be a tree block which -* must be aligned to nodesize. +* Offset is supposed to be a tree block which must be +* aligned to sectorsize. */ -if (!IS_ALIGNED (offset, eb->fs_info->nodesize)) +if (!IS_ALIGNED (offset, eb->fs_info->sectorsize))pr_info ("\t\t\t(parent %llu not aligned to sectorsize %u)\n" , offset, eb->fs_info->sectorsize);
Greg Kroah-Hartman
maintainerPATCH 337/381 cifs: fix pcchunk length type in smb2_copychunk_range
In reply to Greg Kroah-HartmanFrom: Pawel Witek <[email protected]>
commit d66cde50c3c868af7abddafce701bb86e4a93039 upstream.
Change type of pcchunk->Length from u32 to u64 to match smb2_copychunk_range arguments type. Fixes the problem where performing server-side copy with CIFS_IOC_COPYCHUNK_FILE ioctl resulted in incomplete copy of large files while returning -EINVAL.
--- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2ops.c +1 -1
@@ -1784,7 +1784,7 @@ smb2_copychunk_range(const unsigned int pcchunk->SourceOffset =cpu_to_le64 (src_off); pcchunk->TargetOffset =cpu_to_le64 (dest_off); pcchunk->Length = -cpu_to_le32 (min_t (u32, len, tcon->max_bytes_chunk)); +cpu_to_le32 (min_t (u64, len, tcon->max_bytes_chunk));/* Request server copy to target from src identified by key */ kfree (retbuf);
Greg Kroah-Hartman
maintainerPATCH 338/381 platform/x86: touchscreen_dmi: Add upside-down quirk for GDIX1002 ts on the Juno Tablet
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 6abfa99ce52f61a31bcfc2aaaae09006f5665495 upstream.
The Juno Computers Juno Tablet has an upside-down mounted Goodix touchscreen. Add a quirk to invert both axis to correct for this.
--- drivers/platform/x86/touchscreen_dmi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +17 -0
@@ -381,6 +381,11 @@ static const struct ts_dmi_data glavey_t .properties = glavey_tm800a550l_props, }; +static const struct ts_dmi_data gdix1002_00_upside_down_data = { + .acpi_name ="GDIX1002:00" , + .properties = gdix1001_upside_down_props, +}; +static const struct property_entry gp_electronic_t701_props[] = {PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,960 ),PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,640 ),
@@ -1228,6 +1233,18 @@ const struct dmi_system_id touchscreen_d }, }, { +/* Juno Tablet */ + .driver_data = (void *)&gdix1002_00_upside_down_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Default string" ), +/* Both product- and board-name being "Default string" is somewhat rare */ +DMI_MATCH (DMI_PRODUCT_NAME ,"Default string" ), +DMI_MATCH (DMI_BOARD_NAME ,"Default string" ), +/* Above matches are too generic, add partial bios-version match */ + DMI_MATCH(DMI_BIOS_VERSION, "JP2V1."), + }, + }, + {/* Mediacom WinPad 7.0 W700 (same hw as Wintron surftab 7") */ .driver_data = (void *)&trekstor_surftab_wintron70_data, .matches = {
Greg Kroah-Hartman
maintainerPATCH 339/381 platform/x86: touchscreen_dmi: Add info for the Dexp Ursus KX210i
In reply to Greg Kroah-HartmanFrom: Andrey Avdeev <[email protected]>
commit 4b65f95c87c35699bc6ad540d6b9dd7f950d0924 upstream.
Add touchscreen info for the Dexp Ursus KX210i
--- drivers/platform/x86/touchscreen_dmi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +24 -0
@@ -327,6 +327,22 @@ static const struct ts_dmi_data dexp_urs .properties = dexp_ursus_7w_props, }; +static const struct property_entry dexp_ursus_kx210i_props[] = { +PROPERTY_ENTRY_U32 ("touchscreen-min-x" ,5 ), +PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,2 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1720 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,1137 ), +PROPERTY_ENTRY_STRING ("firmware-name" ,"gsl1680-dexp-ursus-kx210i.fw" ), +PROPERTY_ENTRY_U32 ("silead,max-fingers" ,10 ), +PROPERTY_ENTRY_BOOL ("silead,home-button" ), + { } +}; + +static const struct ts_dmi_data dexp_ursus_kx210i_data = { + .acpi_name ="MSSL1680:00" , + .properties = dexp_ursus_kx210i_props, +}; +static const struct property_entry digma_citi_e200_props[] = {PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1980 ),PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,1500 ),
@@ -1124,6 +1140,14 @@ const struct dmi_system_id touchscreen_d }, }, { +/* DEXP Ursus KX210i */ + .driver_data = (void *)&dexp_ursus_kx210i_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"INSYDE Corp." ), + DMI_MATCH(DMI_PRODUCT_NAME, "S107I"), + }, + }, + {/* Digma Citi E200 */ .driver_data = (void *)&digma_citi_e200_data, .matches = {
Greg Kroah-Hartman
maintainerPATCH 340/381 inotify: Avoid reporting event with invalid wd
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit c915d8f5918bea7c3962b09b8884ca128bfd9b0c upstream.
When inotify_freeing_mark() races with inotify_handle_inode_event() it can happen that inotify_handle_inode_event() sees that i_mark->wd got already reset to -1 and reports this value to userspace which can confuse the inotify listener. Avoid the problem by validating that wd is sensible (and pretend the mark got removed before the event got generated otherwise).
Message-Id: <[email protected]>
--- fs/notify/inotify/inotify_fsnotify.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/notify/inotify/inotify_fsnotify.c +9 -2
@@ -64,7 +64,7 @@ int inotify_handle_inode_event(struct fsstruct fsnotify_event *fsn_event;struct fsnotify_group *group = inode_mark->group;int ret; -int len =0 ; +int len =0 , wd;int alloc_len =sizeof (struct inotify_event_info );struct mem_cgroup *old_memcg;
@@ -80,6 +80,13 @@ int inotify_handle_inode_event(struct fs fsn_mark);/* +* We can be racing with mark being detached. Don't report event with +* invalid wd. +*/ + wd =READ_ONCE (i_mark->wd); +if (wd ==-1 ) +return 0 ; +/* * Whoever is interested in the event, pays for the allocation. Do not * trigger OOM killer in the target monitoring memcg as it may have * security repercussion.
@@ -109,7 +116,7 @@ int inotify_handle_inode_event(struct fs fsn_event = &event->fse;fsnotify_init_event (fsn_event,0 ); event->mask = mask; - event->wd = i_mark->wd; + event->wd = wd; event->sync_cookie = cookie; event->name_len = len;if (len)
Greg Kroah-Hartman
maintainerPATCH 341/381 sh: math-emu: fix macro redefined warning
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 58a49ad90939386a8682e842c474a0d2c00ec39c upstream.
Fix a warning that was reported by the kernel test robot:
In file included from ../include/math-emu/soft-fp.h:27,
from ../arch/sh/math-emu/math.c:22:
../arch/sh/include/asm/sfp-machine.h:17: warning: "__BYTE_ORDER" redefined
17 | #define __BYTE_ORDER __BIG_ENDIAN
In file included from ../arch/sh/math-emu/math.c:21:../arch/sh/math-emu/sfp-util.h:71: note: this is the location of the previous definition
71 | #define __BYTE_ORDER __LITTLE_ENDIAN
--- arch/sh/math-emu/sfp-util.h | 4 ---- 1 file changed, 4 deletions(-)
arch/sh/math-emu/sfp-util.h +0 -4
@@ -67,7 +67,3 @@ } while (0)#define abort () return 0 - -#define __BYTE_ORDER __LITTLE_ENDIAN - -
Greg Kroah-Hartman
maintainerPATCH 342/381 sh: mcount.S: fix build error when PRINTK is not enabled
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit c2bd1e18c6f85c0027da2e5e7753b9bfd9f8e6dc upstream.
Fix a build error in mcount.S when CONFIG_PRINTK is not enabled. Fixes this build error:
sh2-linux-ld: arch/sh/lib/mcount.o: in function `stack_panic':
(.text+0xec): undefined reference to `dump_stack'
--- arch/sh/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/Kconfig.debug +1 -1
@@ -18,7 +18,7 @@ config SH_STANDARD_BIOS config STACK_DEBUG bool "Check for stack overflows" - depends on DEBUG_KERNEL + depends on DEBUG_KERNEL && PRINTK help This option will cause messages to be printed if free stack space drops below a certain limit. Saying Y here will add overhead to
Greg Kroah-Hartman
maintainerPATCH 343/381 sh: init: use OF_EARLY_FLATTREE for early init
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 6cba655543c7959f8a6d2979b9d40a6a66b7ed4f upstream.
When CONFIG_OF_EARLY_FLATTREE and CONFIG_SH_DEVICE_TREE are not set, SH3 build fails with a call to early_init_dt_scan(), so in arch/sh/kernel/setup.c and arch/sh/kernel/head_32.S, use CONFIG_OF_EARLY_FLATTREE instead of CONFIG_OF_FLATTREE.
Fixes this build error:../arch/sh/kernel/setup.c: In function 'sh_fdt_init':../arch/sh/kernel/setup.c:262:26: error: implicit declaration of function 'early_init_dt_scan' [-Werror=implicit-function-declaration]
262 | if (!dt_virt || !early_init_dt_scan(dt_virt)) {
--- arch/sh/kernel/head_32.S | 6 +++--- arch/sh/kernel/setup.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
arch/sh/kernel/head_32.S +3 -3
@@ -64,7 +64,7 @@ ENTRY(_stext) ldc r0, r6_bank #endif -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE mov r4, r12 ! Store device tree blob pointer in r12 #endif
@@ -315,7 +315,7 @@ ENTRY(_stext) 10: #endif -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE mov.l 8f, r0 ! Make flat device tree available early. jsr @r0 mov r12, r4
@@ -346,7 +346,7 @@ ENTRY(stack_start) 5: .long start_kernel 6: .long cpu_init 7: .long init_thread_union -#if defined(CONFIG_OF_FLATTREE) +#if defined(CONFIG_OF_EARLY_FLATTREE) 8: .long sh_fdt_init #endif
arch/sh/kernel/setup.c +2 -2
@@ -244,7 +244,7 @@ void __init __weak plat_early_device_set { } -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE void __ref sh_fdt_init (phys_addr_t dt_phys) {static int done =0 ;
@@ -329,7 +329,7 @@ void __init setup_arch(char **cmdline_p)/* Let earlyprintk output early console messages */ sh_early_platform_driver_probe ("earlyprintk" ,1 ,1 ); -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE #ifdef CONFIG_USE_BUILTIN_DTB unflatten_and_copy_device_tree ();#else
Greg Kroah-Hartman
maintainerPATCH 344/381 sh: nmi_debug: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit d1155e4132de712a9d3066e2667ceaad39a539c5 upstream.
__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) argument or environment strings. Also, error return codes don't mean anything to obsolete_checksetup() -- only non-zero (usually 1) or zero. So return 1 from nmi_debug_setup().
--- arch/sh/kernel/nmi_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sh/kernel/nmi_debug.c +2 -2
@@ -49,7 +49,7 @@ static int __init nmi_debug_setup(char *register_die_notifier (&nmi_debug_nb);if (*str !='=' ) -return 0 ; +return 1 ;for (p = str +1 ; *p; p = sep +1 ) { sep =strchr (p,',' );
@@ -70,6 +70,6 @@ static int __init nmi_debug_setup(char *break ; } -return 0 ; +return 1 ; }__setup ("nmi_debug" , nmi_debug_setup);
Greg Kroah-Hartman
maintainerPATCH 345/381 remoteproc: stm32: Call of_node_put() on iteration error
In reply to Greg Kroah-HartmanFrom: Mathieu Poirier <[email protected]>
commit ccadca5baf5124a880f2bb50ed1ec265415f025b upstream.
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly.
--- drivers/remoteproc/stm32_rproc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/remoteproc/stm32_rproc.c +5 -1
@@ -231,11 +231,13 @@ static int stm32_rproc_parse_memory_regiwhile (of_phandle_iterator_next (&it) ==0 ) { rmem =of_reserved_mem_lookup (it.node);if (!rmem) { +of_node_put (it.node);dev_err (dev,"unable to acquire memory-region\n" );return -EINVAL ; }if (stm32_rproc_pa_to_da (rproc, rmem->base, &da) <0 ) { +of_node_put (it.node);dev_err (dev,"memory region not valid %pa\n" , &rmem->base);return -EINVAL ;
@@ -262,8 +264,10 @@ static int stm32_rproc_parse_memory_regi it.node->name); } -if (!mem) +if (!mem) { +of_node_put (it.node);return -ENOMEM ; + }rproc_add_carveout (rproc, mem); index++;
Greg Kroah-Hartman
maintainerPATCH 346/381 remoteproc: st: Call of_node_put() on iteration error
In reply to Greg Kroah-HartmanFrom: Mathieu Poirier <[email protected]>
commit 8a74918948b40317a5b5bab9739d13dcb5de2784 upstream.
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly.
--- drivers/remoteproc/st_remoteproc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/remoteproc/st_remoteproc.c +4 -1
@@ -129,6 +129,7 @@ static int st_rproc_parse_fw(struct rprowhile (of_phandle_iterator_next (&it) ==0 ) { rmem =of_reserved_mem_lookup (it.node);if (!rmem) { +of_node_put (it.node);dev_err (dev,"unable to acquire memory-region\n" );return -EINVAL ; }
@@ -150,8 +151,10 @@ static int st_rproc_parse_fw(struct rpro it.node->name); } -if (!mem) +if (!mem) { +of_node_put (it.node);return -ENOMEM ; + }rproc_add_carveout (rproc, mem); index++;
Greg Kroah-Hartman
maintainerPATCH 347/381 ARM: dts: exynos: fix WM8960 clock name in Itop Elite
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 6c950c20da38debf1ed531e0b972bd8b53d1c11f upstream.
The WM8960 Linux driver expects the clock to be named "mclk". Otherwise the clock will be ignored and not prepared/enabled by the driver.
--- arch/arm/boot/dts/exynos4412-itop-elite.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-itop-elite.dts +1 -1
@@ -179,7 +179,7 @@ compatible = "wlf,wm8960"; reg = <0x1a>; clocks = <&pmu_system_controller 0>; - clock-names = "MCLK1"; + clock-names = "mclk"; wlf,shared-lrclk; #sound-dai-cells = <0>; };
Greg Kroah-Hartman
maintainerPATCH 348/381 ARM: dts: s5pv210: correct MIPI CSIS clock name
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 665b9459bb53b8f19bd1541567e1fe9782c83c4b upstream.
The Samsung S5P/Exynos MIPI CSIS bindings and Linux driver expect first clock name to be "csis". Otherwise the driver fails to probe.
--- arch/arm/boot/dts/s5pv210.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/s5pv210.dtsi +1 -1
@@ -583,7 +583,7 @@ interrupts = <29>; clocks = <&clocks CLK_CSIS>, <&clocks SCLK_CSIS>; - clock-names = "clk_csis", + clock-names = "csis", "sclk_csis"; bus-width = <4>; status = "disabled";
Greg Kroah-Hartman
maintainerPATCH 349/381 f2fs: fix potential corruption when moving a directory
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit d94772154e524b329a168678836745d2773a6e02 upstream.
F2FS has the same issue in ext4_rename causing crash revealed by xfstests/generic/707.
See also commit 0813299c586b ("ext4: Fix possible corruption when moving a directory")
--- fs/f2fs/namei.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
fs/f2fs/namei.c +15 -1
@@ -969,12 +969,20 @@ static int f2fs_rename(struct inode *old goto out; } +/* +* Copied from ext4_rename: we need to protect against old.inode +* directory getting converted from inline directory format into +* a normal one. +*/ +if (S_ISDIR (old_inode->i_mode)) +inode_lock_nested (old_inode,I_MUTEX_NONDIR2 ); + err = -ENOENT ; old_entry =f2fs_find_entry (old_dir, &old_dentry->d_name, &old_page);if (!old_entry) {if (IS_ERR (old_page)) err =PTR_ERR (old_page); - goto out; + goto out_unlock_old; }if (S_ISDIR (old_inode->i_mode)) {
@@ -1082,6 +1090,9 @@ static int f2fs_rename(struct inode *oldf2fs_unlock_op (sbi); +if (S_ISDIR (old_inode->i_mode)) +inode_unlock (old_inode); +if (IS_DIRSYNC (old_dir) ||IS_DIRSYNC (new_dir))f2fs_sync_fs (sbi->sb,1 );
@@ -1096,6 +1107,9 @@ out_dir:f2fs_put_page (old_dir_page,0 ); out_old:f2fs_put_page (old_page,0 ); +out_unlock_old: +if (S_ISDIR (old_inode->i_mode)) +inode_unlock (old_inode); out:if (whiteout)iput (whiteout);
Greg Kroah-Hartman
maintainerPATCH 350/381 drm/panel: otm8009a: Set backlight parent to panel device
In reply to Greg Kroah-HartmanFrom: James Cowgill <[email protected]>
commit ab4f869fba6119997f7630d600049762a2b014fa upstream.
This is the logical place to put the backlight device, and it also fixes a kernel crash if the MIPI host is removed. Previously the backlight device would be unregistered twice when this happened - once as a child of the MIPI host through mipi_dsi_host_unregister, and once when the panel device is destroyed.
--- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +1 -1
@@ -458,7 +458,7 @@ static int otm8009a_probe(struct mipi_ds DRM_MODE_CONNECTOR_DSI); ctx->bl_dev =devm_backlight_device_register (dev,dev_name (dev), - dsi->host->dev, ctx, + dev, ctx, &otm8009a_backlight_ops,NULL );if (IS_ERR (ctx->bl_dev)) {
Greg Kroah-Hartman
maintainerPATCH 351/381 drm/amdgpu: fix an amdgpu_irq_put() issue in gmc_v9_0_hw_fini()
In reply to Greg Kroah-HartmanFrom: Hamza Mahfooz <[email protected]>
commit 922a76ba31adf84e72bc947267385be420c689ee upstream.
As made mention of in commit 08c677cb0b43 ("drm/amdgpu: fix amdgpu_irq_put call trace in gmc_v10_0_hw_fini") and commit 13af556104fa ("drm/amdgpu: fix amdgpu_irq_put call trace in gmc_v11_0_hw_fini"). It is meaningless to call amdgpu_irq_put() for gmc.ecc_irq. So, remove it from gmc_v9_0_hw_fini().
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -1
@@ -1686,7 +1686,6 @@ static int gmc_v9_0_hw_fini(void *handlereturn 0 ; } -amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 );amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 352/381 drm/amdgpu/gfx: disable gfx9 cp_ecc_error_irq only when enabling legacy gfx ras
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
commit 4a76680311330aefe5074bed8f06afa354b85c48 upstream.
gfx9 cp_ecc_error_irq is only enabled when legacy gfx ras is assert. So in gfx_v9_0_hw_fini, interrupt disablement for cp_ecc_error_irq should be executed under such condition, otherwise, an amdgpu_irq_put calltrace will occur.
[ 7283.170322] RIP: 0010:amdgpu_irq_put+0x45/0x70 [amdgpu] [ 7283.170964] RSP: 0018:ffff9a5fc3967d00 EFLAGS: 00010246 [ 7283.170967] RAX: ffff98d88afd3040 RBX: ffff98d89da20000 RCX: 0000000000000000 [ 7283.170969] RDX: 0000000000000000 RSI: ffff98d89da2bef8 RDI: ffff98d89da20000 [ 7283.170971] RBP: ffff98d89da20000 R08: ffff98d89da2ca18 R09: 0000000000000006 [ 7283.170973] R10: ffffd5764243c008 R11: 0000000000000000 R12: 0000000000001050 [ 7283.170975] R13: ffff98d89da38978 R14: ffffffff999ae15a R15: ffff98d880130105 [ 7283.170978] FS: 0000000000000000(0000) GS:ffff98d996f00000(0000) knlGS:0000000000000000 [ 7283.170981] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 7283.170983] CR2: 00000000f7a9d178 CR3: 00000001c42ea000 CR4: 00000000003506e0 [ 7283.170986] Call Trace: [ 7283.170988] <TASK> [ 7283.170989] gfx_v9_0_hw_fini+0x1c/0x6d0 [amdgpu] [ 7283.171655] amdgpu_device_ip_suspend_phase2+0x101/0x1a0 [amdgpu] [ 7283.172245] amdgpu_device_suspend+0x103/0x180 [amdgpu] [ 7283.172823] amdgpu_pmops_freeze+0x21/0x60 [amdgpu] [ 7283.173412] pci_pm_freeze+0x54/0xc0 [ 7283.173419] ? __pfx_pci_pm_freeze+0x10/0x10 [ 7283.173425] dpm_run_callback+0x98/0x200 [ 7283.173430] __device_suspend+0x164/0x5f0
v2: drop gfx11 as it's fixed in a different solution by retiring cp_ecc_irq funcs(Hawking)
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -3943,7 +3943,8 @@ static int gfx_v9_0_hw_fini(void *handle {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 ); +if (amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__GFX )) +amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_inst_irq,0 );
Greg Kroah-Hartman
maintainerPATCH 353/381 drm/amdgpu: disable sdma ecc irq only when sdma RAS is enabled in suspend
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
commit 8b229ada2669b74fdae06c83fbfda5a5a99fc253 upstream.
sdma_v4_0_ip is shared on a few asics, but in sdma_v4_0_hw_fini, driver unconditionally disables ecc_irq which is only enabled on those asics enabling sdma ecc. This will introduce a warning in suspend cycle on those chips with sdma ip v4.0, while without sdma ecc. So this patch correct this.
[ 7283.166354] RIP: 0010:amdgpu_irq_put+0x45/0x70 [amdgpu] [ 7283.167001] RSP: 0018:ffff9a5fc3967d08 EFLAGS: 00010246 [ 7283.167019] RAX: ffff98d88afd3770 RBX: 0000000000000001 RCX: 0000000000000000 [ 7283.167023] RDX: 0000000000000000 RSI: ffff98d89da30390 RDI: ffff98d89da20000 [ 7283.167025] RBP: ffff98d89da20000 R08: 0000000000036838 R09: 0000000000000006 [ 7283.167028] R10: ffffd5764243c008 R11: 0000000000000000 R12: ffff98d89da30390 [ 7283.167030] R13: ffff98d89da38978 R14: ffffffff999ae15a R15: ffff98d880130105 [ 7283.167032] FS: 0000000000000000(0000) GS:ffff98d996f00000(0000) knlGS:0000000000000000 [ 7283.167036] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 7283.167039] CR2: 00000000f7a9d178 CR3: 00000001c42ea000 CR4: 00000000003506e0 [ 7283.167041] Call Trace: [ 7283.167046] <TASK> [ 7283.167048] sdma_v4_0_hw_fini+0x38/0xa0 [amdgpu] [ 7283.167704] amdgpu_device_ip_suspend_phase2+0x101/0x1a0 [amdgpu] [ 7283.168296] amdgpu_device_suspend+0x103/0x180 [amdgpu] [ 7283.168875] amdgpu_pmops_freeze+0x21/0x60 [amdgpu] [ 7283.169464] pci_pm_freeze+0x54/0xc0
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +5 -3
@@ -1979,9 +1979,11 @@ static int sdma_v4_0_hw_fini(void *handlif (amdgpu_sriov_vf (adev))return 0 ; -for (i =0 ; i < adev->sdma.num_instances; i++) { -amdgpu_irq_put (adev, &adev->sdma.ecc_irq, -AMDGPU_SDMA_IRQ_INSTANCE0 + i); +if (amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__SDMA )) { +for (i =0 ; i < adev->sdma.num_instances; i++) { +amdgpu_irq_put (adev, &adev->sdma.ecc_irq, +AMDGPU_SDMA_IRQ_INSTANCE0 + i); + } }sdma_v4_0_ctx_switch_enable (adev, false);
Greg Kroah-Hartman
maintainerPATCH 354/381 HID: wacom: Set a default resolution for older tablets
In reply to Greg Kroah-HartmanFrom: Ping Cheng <[email protected]>
commit 08a46b4190d345544d04ce4fe2e1844b772b8535 upstream.
Some older tablets may not report physical maximum for X/Y coordinates. Set a default to prevent undefined resolution.
--- drivers/hid/wacom_wac.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/hid/wacom_wac.c +10 -2
@@ -1853,6 +1853,7 @@ static void wacom_map_usage(struct inputint fmax = field->logical_maximum;unsigned int equivalent_usage =wacom_equivalent_usage (usage->hid);int resolution_code = code; +int resolution =hidinput_calc_abs_res (field, resolution_code);if (equivalent_usage ==HID_DG_TWIST ) { resolution_code =ABS_RZ ;
@@ -1875,8 +1876,15 @@ static void wacom_map_usage(struct inputswitch (type) {case EV_ABS :input_set_abs_params (input, code, fmin, fmax, fuzz,0 ); -input_abs_set_res (input, code, -hidinput_calc_abs_res (field, resolution_code)); + +/* older tablet may miss physical usage */ +if ((code ==ABS_X || code ==ABS_Y ) && !resolution) { + resolution =WACOM_INTUOS_RES ; +hid_warn (input, +"Wacom usage (%d) missing resolution \n" , + code); + } +input_abs_set_res (input, code, resolution);break ;case EV_KEY :input_set_capability (input,EV_KEY , code);
Greg Kroah-Hartman
maintainerPATCH 355/381 HID: wacom: insert timestamp to packed Bluetooth (BT) events
In reply to Greg Kroah-HartmanFrom: Ping Cheng <[email protected]>
commit 17d793f3ed53080dab6bbeabfc82de890c901001 upstream.
To fully utilize the BT polling/refresh rate, a few input events are sent together to reduce event delay. This causes issue to the timestamp generated by input_sync since all the events in the same packet would pretty much have the same timestamp. This patch inserts time interval to the events by averaging the total time used for sending the packet.
This decision was mainly based on observing the actual time interval between each BT polling. The interval doesn't seem to be constant, due to the network and system environment. So, using solutions other than averaging doesn't end up with valid timestamps.
--- drivers/hid/wacom_wac.c | 26 ++++++++++++++++++++++++++ drivers/hid/wacom_wac.h | 1 + 2 files changed, 27 insertions(+)
drivers/hid/wacom_wac.c +26 -0
@@ -1265,6 +1265,9 @@ static void wacom_intuos_pro2_bt_pen(strstruct input_dev *pen_input = wacom->pen_input;unsigned char *data = wacom->data; +int number_of_valid_frames =0 ; +int time_interval =15000000 ; +ktime_t time_packet_received =ktime_get ();int i; if (wacom->features.type == INTUOSP2_BT ||
@@ -1285,12 +1288,30 @@ static void wacom_intuos_pro2_bt_pen(str wacom->id[0 ] |= (wacom->serial[0 ] >>32 ) &0xFFFFF ; } +/* number of valid frames */ for (i =0 ; i < pen_frames; i++) {unsigned char *frame = &data[i*pen_frame_len +1 ];bool valid = frame[0 ] &0x80 ; + +if (valid) + number_of_valid_frames++; + } + +if (number_of_valid_frames) { +if (wacom->hid_data.time_delayed) + time_interval =ktime_get () - wacom->hid_data.time_delayed; + time_interval /= number_of_valid_frames; + wacom->hid_data.time_delayed = time_packet_received; + } + +for (i =0 ; i < number_of_valid_frames; i++) { +unsigned char *frame = &data[i*pen_frame_len +1 ]; +bool valid = frame[0 ] &0x80 ;bool prox = frame[0 ] &0x40 ;bool range = frame[0 ] &0x20 ;bool invert = frame[0 ] &0x10 ; +int frames_number_reversed = number_of_valid_frames - i -1 ; +int event_timestamp = time_packet_received - frames_number_reversed * time_interval;if (!valid)continue ;
@@ -1303,6 +1324,7 @@ static void wacom_intuos_pro2_bt_pen(str wacom->tool[0 ] =0 ; wacom->id[0 ] =0 ; wacom->serial[0 ] =0 ; + wacom->hid_data.time_delayed =0 ;return ; }
@@ -1339,6 +1361,7 @@ static void wacom_intuos_pro2_bt_pen(str get_unaligned_le16(&frame[11])); } } +if (wacom->tool[0 ]) {input_report_abs (pen_input,ABS_PRESSURE ,get_unaligned_le16 (&frame[5 ])); if (wacom->features.type == INTUOSP2_BT ||
@@ -1362,6 +1385,9 @@ static void wacom_intuos_pro2_bt_pen(str wacom->shared->stylus_in_proximity = prox; +/* add timestamp to unpack the frames */ +input_set_timestamp (pen_input, event_timestamp); +input_sync (pen_input); } }
drivers/hid/wacom_wac.h +1 -0
@@ -320,6 +320,7 @@ struct hid_data {int bat_connected;int ps_connected;bool pad_input_event_flag; +int time_delayed; };struct wacom_remote_data {
Greg Kroah-Hartman
maintainerPATCH 356/381 KVM: x86: hyper-v: Avoid calling kvm_make_vcpus_request_mask() with vcpu_mask==NULL
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
commit 6470accc7ba948b0b3aca22b273fe84ec638a116 upstream.
In preparation to making kvm_make_vcpus_request_mask() use for_each_set_bit() switch kvm_hv_flush_tlb() to calling kvm_make_all_cpus_request() for 'all cpus' case.
Note: kvm_make_all_cpus_request() (unlike kvm_make_vcpus_request_mask()) currently dynamically allocates cpumask on each call and this is suboptimal. Both kvm_make_all_cpus_request() and kvm_make_vcpus_request_mask() are going to be switched to using pre-allocated per-cpu masks.
Message-Id: <[email protected]>
--- arch/x86/kvm/hyperv.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/x86/kvm/hyperv.c +9 -6
@@ -1562,16 +1562,19 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpumask_clear (&hv_vcpu->tlb_flush); - vcpu_mask = all_cpus ?NULL : -sparse_set_to_vcpu_mask (kvm, sparse_banks, valid_bank_mask, - vp_bitmap, vcpu_bitmap); -/* * vcpu->arch.cr3 may not be up-to-date for running vCPUs so we can't * analyze it here, flush TLB regardless of the specified address space. */ -kvm_make_vcpus_request_mask (kvm,KVM_REQ_TLB_FLUSH_GUEST , -NULL , vcpu_mask, &hv_vcpu->tlb_flush); +if (all_cpus) { +kvm_make_all_cpus_request (kvm,KVM_REQ_TLB_FLUSH_GUEST ); + }else { + vcpu_mask =sparse_set_to_vcpu_mask (kvm, sparse_banks, valid_bank_mask, + vp_bitmap, vcpu_bitmap); + +kvm_make_vcpus_request_mask (kvm,KVM_REQ_TLB_FLUSH_GUEST , +NULL , vcpu_mask, &hv_vcpu->tlb_flush); + } ret_success:/* We always do full TLB flush, set rep_done = rep_cnt. */
Greg Kroah-Hartman
maintainerPATCH 357/381 KVM: x86: do not report a vCPU as preempted outside instruction boundaries
In reply to Greg Kroah-HartmanFrom: Paolo Bonzini <[email protected]>
commit 6cd88243c7e03845a450795e134b488fc2afb736 upstream.
If a vCPU is outside guest mode and is scheduled out, it might be in the process of making a memory access. A problem occurs if another vCPU uses the PV TLB flush feature during the period when the vCPU is scheduled out, and a virtual address has already been translated but has not yet been accessed, because this is equivalent to using a stale TLB entry.
To avoid this, only report a vCPU as preempted if sure that the guest is at an instruction boundary. A rescheduling request will be delivered to the host physical CPU as an external interrupt, so for simplicity consider any vmexit *not* instruction boundary except for external interrupts.
It would in principle be okay to report the vCPU as preempted also if it is sleeping in kvm_vcpu_block(): a TLB flush IPI will incur the vmentry/vmexit overhead unnecessarily, and optimistic spinning is also unlikely to succeed. However, leave it for later because right now kvm_vcpu_check_block() is doing memory accesses. Even though the TLB flush issue only applies to virtual memory address, it's very much preferrable to be conservative.
--- arch/x86/include/asm/kvm_host.h | 3 +++ arch/x86/kvm/svm/svm.c | 2 ++ arch/x86/kvm/vmx/vmx.c | 1 + arch/x86/kvm/x86.c | 22 ++++++++++++++++++++++ 4 files changed, 28 insertions(+)
arch/x86/include/asm/kvm_host.h +3 -0
@@ -553,6 +553,7 @@ struct kvm_vcpu_arch {u64 ia32_misc_enable_msr;u64 smbase;u64 smi_count; +bool at_instruction_boundary;bool tpr_access_reporting;bool xsaves_enabled;u64 ia32_xss;
@@ -1061,6 +1062,8 @@ struct kvm_vcpu_stat {u64 req_event;u64 halt_poll_success_ns;u64 halt_poll_fail_ns; +u64 preemption_reported; +u64 preemption_other; };struct x86_instruction_info ;
arch/x86/kvm/svm/svm.c +2 -0
@@ -3983,6 +3983,8 @@ out:static void svm_handle_exit_irqoff (struct kvm_vcpu *vcpu) { +if (to_svm (vcpu)->vmcb->control.exit_code ==SVM_EXIT_INTR ) + vcpu->arch.at_instruction_boundary = true; }static void svm_sched_in (struct kvm_vcpu *vcpu,int cpu)
arch/x86/kvm/vmx/vmx.c +1 -0
@@ -6510,6 +6510,7 @@ static void handle_external_interrupt_irreturn ;handle_interrupt_nmi_irqoff (vcpu,gate_offset (desc)); + vcpu->arch.at_instruction_boundary = true; }static void vmx_handle_exit_irqoff (struct kvm_vcpu *vcpu)
arch/x86/kvm/x86.c +22 -0
@@ -231,6 +231,8 @@ struct kvm_stats_debugfs_item debugfs_enVCPU_STAT ("l1d_flush" , l1d_flush),VCPU_STAT ("halt_poll_success_ns" , halt_poll_success_ns),VCPU_STAT ("halt_poll_fail_ns" , halt_poll_fail_ns), +VCPU_STAT ("preemption_reported" , preemption_reported), +VCPU_STAT ("preemption_other" , preemption_other),VM_STAT ("mmu_shadow_zapped" , mmu_shadow_zapped),VM_STAT ("mmu_pte_write" , mmu_pte_write), VM_STAT("mmu_pde_zapped", mmu_pde_zapped),
@@ -4052,6 +4054,19 @@ static void kvm_steal_time_set_preemptedstruct kvm_host_map map;struct kvm_steal_time *st; +/* +* The vCPU can be marked preempted if and only if the VM-Exit was on +* an instruction boundary and will not trigger guest emulation of any +* kind (see vcpu_run). Vendor specific code controls (conservatively) +* when this is true, for example allowing the vCPU to be marked +* preempted if and only if the VM-Exit was due to a host interrupt. +*/ +if (!vcpu->arch.at_instruction_boundary) { + vcpu->stat.preemption_other++; +return ; + } + + vcpu->stat.preemption_reported++;if (!(vcpu->arch.st.msr_val &KVM_MSR_ENABLED ))return ;
@@ -9357,6 +9372,13 @@ static int vcpu_run(struct kvm_vcpu *vcp vcpu->arch.l1tf_flush_l1d = true;for (;;) { +/* +* If another guest vCPU requests a PV TLB flush in the middle +* of instruction emulation, the rest of the emulation could +* use a stale page translation. Assume that any code after +* this point can start executing an instruction. +*/ + vcpu->arch.at_instruction_boundary = false;if (kvm_vcpu_running (vcpu)) { r =vcpu_enter_guest (vcpu); }else {
Greg Kroah-Hartman
maintainerPATCH 358/381 ext4: fix WARNING in mb_find_extent
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit fa08a7b61dff8a4df11ff1e84abfc214b487caf7 upstream.
Syzbot found the following issue:
EXT4-fs: Warning: mounting with data=journal disables delayed allocation, dioread_nolock, O_DIRECT and fast_commit support! EXT4-fs (loop0): orphan cleanup on readonly fs
------------[ cut here ]------------ WARNING: CPU: 1 PID: 5067 at fs/ext4/mballoc.c:1869 mb_find_extent+0x8a1/0xe30 Modules linked in: CPU: 1 PID: 5067 Comm: syz-executor307 Not tainted 6.2.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 RIP: 0010:mb_find_extent+0x8a1/0xe30 fs/ext4/mballoc.c:1869 RSP: 0018:ffffc90003c9e098 EFLAGS: 00010293 RAX: ffffffff82405731 RBX: 0000000000000041 RCX: ffff8880783457c0 RDX: 0000000000000000 RSI: 0000000000000041 RDI: 0000000000000040 RBP: 0000000000000040 R08: ffffffff82405723 R09: ffffed10053c9402 R10: ffffed10053c9402 R11: 1ffff110053c9401 R12: 0000000000000000 R13: ffffc90003c9e538 R14: dffffc0000000000 R15: ffffc90003c9e2cc FS: 0000555556665300(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000056312f6796f8 CR3: 0000000022437000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ext4_mb_complex_scan_group+0x353/0x1100 fs/ext4/mballoc.c:2307 ext4_mb_regular_allocator+0x1533/0x3860 fs/ext4/mballoc.c:2735 ext4_mb_new_blocks+0xddf/0x3db0 fs/ext4/mballoc.c:5605 ext4_ext_map_blocks+0x1868/0x6880 fs/ext4/extents.c:4286 ext4_map_blocks+0xa49/0x1cc0 fs/ext4/inode.c:651 ext4_getblk+0x1b9/0x770 fs/ext4/inode.c:864 ext4_bread+0x2a/0x170 fs/ext4/inode.c:920 ext4_quota_write+0x225/0x570 fs/ext4/super.c:7105 write_blk fs/quota/quota_tree.c:64 [inline] get_free_dqblk+0x34a/0x6d0 fs/quota/quota_tree.c:130 do_insert_tree+0x26b/0x1aa0 fs/quota/quota_tree.c:340 do_insert_tree+0x722/0x1aa0 fs/quota/quota_tree.c:375 do_insert_tree+0x722/0x1aa0 fs/quota/quota_tree.c:375 do_insert_tree+0x722/0x1aa0 fs/quota/quota_tree.c:375 dq_insert_tree fs/quota/quota_tree.c:401 [inline] qtree_write_dquot+0x3b6/0x530 fs/quota/quota_tree.c:420 v2_write_dquot+0x11b/0x190 fs/quota/quota_v2.c:358 dquot_acquire+0x348/0x670 fs/quota/dquot.c:444 ext4_acquire_dquot+0x2dc/0x400 fs/ext4/super.c:6740 dqget+0x999/0xdc0 fs/quota/dquot.c:914 __dquot_initialize+0x3d0/0xcf0 fs/quota/dquot.c:1492 ext4_process_orphan+0x57/0x2d0 fs/ext4/orphan.c:329 ext4_orphan_cleanup+0xb60/0x1340 fs/ext4/orphan.c:474 __ext4_fill_super fs/ext4/super.c:5516 [inline] ext4_fill_super+0x81cd/0x8700 fs/ext4/super.c:5644 get_tree_bdev+0x400/0x620 fs/super.c:1282 vfs_get_tree+0x88/0x270 fs/super.c:1489 do_new_mount+0x289/0xad0 fs/namespace.c:3145 do_mount fs/namespace.c:3488 [inline] __do_sys_mount fs/namespace.c:3697 [inline] __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3674 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Add some debug information:mb_find_extent: mb_find_extent block=41, order=0 needed=64 next=0 ex=0/41/1@3735929054 64 64 7block_bitmap: ff 3f 0c 00 fc 01 00 00 d2 3d 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Acctually, blocks per group is 64, but block bitmap indicate at least has 128 blocks. Now, ext4_validate_block_bitmap() didn't check invalid block's bitmap if set.
To resolve above issue, add check like fsck "Padding at end of block bitmap is not set".
--- fs/ext4/balloc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
fs/ext4/balloc.c +25 -0
@@ -303,6 +303,22 @@ struct ext4_group_desc * ext4_get_group_return desc; } +static ext4_fsblk_t ext4_valid_block_bitmap_padding (struct super_block *sb, +ext4_group_t block_group, +struct buffer_head *bh) +{ +ext4_grpblk_t next_zero_bit; +unsigned long bitmap_size = sb->s_blocksize *8 ; +unsigned int offset =num_clusters_in_group (sb, block_group); + +if (bitmap_size <= offset) +return 0 ; + + next_zero_bit =ext4_find_next_zero_bit (bh->b_data, bitmap_size, offset); + +return (next_zero_bit < bitmap_size ? next_zero_bit :0 ); +} +/* * Return the block number which was discovered to be invalid, or 0 if * the block bitmap is valid.
@@ -401,6 +417,15 @@ static int ext4_validate_block_bitmap(st EXT4_GROUP_INFO_BBITMAP_CORRUPT);return -EFSCORRUPTED ; } + blk =ext4_valid_block_bitmap_padding (sb, block_group, bh); +if (unlikely (blk !=0 )) { +ext4_unlock_group (sb, block_group); +ext4_error (sb,"bg %u: block %llu: padding at end of block bitmap is not set" , + block_group, blk); +ext4_mark_group_bitmap_corrupted (sb, block_group, +EXT4_GROUP_INFO_BBITMAP_CORRUPT ); +return -EFSCORRUPTED ; + }set_buffer_verified (bh); verified:ext4_unlock_group (sb, block_group);
Greg Kroah-Hartman
maintainerPATCH 359/381 ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 4f04351888a83e595571de672e0a4a8b74f4fb31 upstream.
When modifying the block device while it is mounted by the filesystem, syzbot reported the following:
BUG: KASAN: slab-out-of-bounds in crc16+0x206/0x280 lib/crc16.c:58 Read of size 1 at addr ffff888075f5c0a8 by task syz-executor.2/15586 CPU: 1 PID: 15586 Comm: syz-executor.2 Not tainted 6.2.0-rc5-syzkaller-00205-gc96618275234 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x290 lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:306 print_report+0x107/0x1f0 mm/kasan/report.c:417 kasan_report+0xcd/0x100 mm/kasan/report.c:517 crc16+0x206/0x280 lib/crc16.c:58 ext4_group_desc_csum+0x81b/0xb20 fs/ext4/super.c:3187 ext4_group_desc_csum_set+0x195/0x230 fs/ext4/super.c:3210 ext4_mb_clear_bb fs/ext4/mballoc.c:6027 [inline] ext4_free_blocks+0x191a/0x2810 fs/ext4/mballoc.c:6173 ext4_remove_blocks fs/ext4/extents.c:2527 [inline] ext4_ext_rm_leaf fs/ext4/extents.c:2710 [inline] ext4_ext_remove_space+0x24ef/0x46a0 fs/ext4/extents.c:2958 ext4_ext_truncate+0x177/0x220 fs/ext4/extents.c:4416 ext4_truncate+0xa6a/0xea0 fs/ext4/inode.c:4342 ext4_setattr+0x10c8/0x1930 fs/ext4/inode.c:5622 notify_change+0xe50/0x1100 fs/attr.c:482 do_truncate+0x200/0x2f0 fs/open.c:65 handle_truncate fs/namei.c:3216 [inline] do_open fs/namei.c:3561 [inline] path_openat+0x272b/0x2dd0 fs/namei.c:3714 do_filp_open+0x264/0x4f0 fs/namei.c:3741 do_sys_openat2+0x124/0x4e0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_creat fs/open.c:1402 [inline] __se_sys_creat fs/open.c:1396 [inline] __x64_sys_creat+0x11f/0x160 fs/open.c:1396 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f72f8a8c0c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f72f97e3168 EFLAGS: 00000246 ORIG_RAX: 0000000000000055 RAX: ffffffffffffffda RBX: 00007f72f8bac050 RCX: 00007f72f8a8c0c9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000280 RBP: 00007f72f8ae7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd165348bf R14: 00007f72f97e3300 R15: 0000000000022000
Replace
le16_to_cpu(sbi->s_es->s_desc_size) with sbi->s_desc_size
It reduces ext4's compiled text size, and makes the code more efficient (we remove an extra indirect reference and a potential byte swap on big endian systems), and there is no downside. It also avoids the potential KASAN / syzkaller failure, as a bonus.
--- fs/ext4/super.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/ext4/super.c +2 -4
@@ -2831,11 +2831,9 @@ static __le16 ext4_group_desc_csum(struc crc =crc16 (crc, (__u8 *)gdp, offset); offset +=sizeof (gdp->bg_checksum);/* skip checksum */ /* for checksum of struct ext4_group_desc do the rest...*/ -if (ext4_has_feature_64bit (sb) && - offset <le16_to_cpu (sbi->s_es->s_desc_size)) +if (ext4_has_feature_64bit (sb) && offset < sbi->s_desc_size) crc =crc16 (crc, (__u8 *)gdp + offset, -le16_to_cpu (sbi->s_es->s_desc_size) - - offset); + sbi->s_desc_size - offset); out:return cpu_to_le16 (crc);
Greg Kroah-Hartman
maintainerPATCH 360/381 ext4: fix data races when using cached status extents
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 492888df0c7b42fc0843631168b0021bc4caee84 upstream.
When using cached extent stored in extent status tree in tree->cache_es another process holding ei->i_es_lock for reading can be racing with us setting new value of tree->cache_es. If the compiler would decide to refetch tree->cache_es at an unfortunate moment, it could result in a bogus in_range() check. Fix the possible race by using READ_ONCE() when using tree->cache_es only under ei->i_es_lock for reading.
--- fs/ext4/extents_status.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
fs/ext4/extents_status.c +13 -17
@@ -269,14 +269,12 @@ static void __es_find_extent_range(struc/* see if the extent has been cached */ es->es_lblk = es->es_len = es->es_pblk =0 ; -if (tree->cache_es) { - es1 = tree->cache_es; -if (in_range (lblk, es1->es_lblk, es1->es_len)) { -es_debug ("%u cached by [%u/%u) %llu %x\n" , - lblk, es1->es_lblk, es1->es_len, -ext4_es_pblock (es1),ext4_es_status (es1)); - goto out; - } + es1 =READ_ONCE (tree->cache_es); +if (es1 &&in_range (lblk, es1->es_lblk, es1->es_len)) { +es_debug ("%u cached by [%u/%u) %llu %x\n" , + lblk, es1->es_lblk, es1->es_len, +ext4_es_pblock (es1),ext4_es_status (es1)); + goto out; } es1 =__es_tree_search (&tree->root, lblk);
@@ -295,7 +293,7 @@ out: }if (es1 &&matching_fn (es1)) { - tree->cache_es = es1; +WRITE_ONCE (tree->cache_es, es1); es->es_lblk = es1->es_lblk; es->es_len = es1->es_len; es->es_pblk = es1->es_pblk;
@@ -934,14 +932,12 @@ int ext4_es_lookup_extent(struct inode */* find extent in cache firstly */ es->es_lblk = es->es_len = es->es_pblk =0 ; -if (tree->cache_es) { - es1 = tree->cache_es; -if (in_range (lblk, es1->es_lblk, es1->es_len)) { -es_debug ("%u cached by [%u/%u)\n" , - lblk, es1->es_lblk, es1->es_len); - found =1 ; - goto out; - } + es1 =READ_ONCE (tree->cache_es); +if (es1 &&in_range (lblk, es1->es_lblk, es1->es_len)) { +es_debug ("%u cached by [%u/%u)\n" , + lblk, es1->es_lblk, es1->es_len); + found =1 ; + goto out; } node = tree->root.rb_node;
Greg Kroah-Hartman
maintainerPATCH 361/381 ext4: check iomap type only if ext4_iomap_begin() does not fail
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit fa83c34e3e56b3c672af38059e066242655271b1 upstream.
When ext4_iomap_overwrite_begin() calls ext4_iomap_begin() map blocks may fail for some reason (e.g. memory allocation failure, bare disk write), and later because "iomap->type ! = IOMAP_MAPPED" triggers WARN_ON(). When ext4 iomap_begin() returns an error, it is normal that the type of iomap->type may not match the expectation. Therefore, we only determine if iomap->type is as expected when ext4_iomap_begin() is executed successfully.
--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -3564,7 +3564,7 @@ static int ext4_iomap_overwrite_begin(st*/ flags &= ~IOMAP_WRITE ; ret =ext4_iomap_begin (inode, offset, length, flags, iomap, srcmap); -WARN_ON_ONCE (iomap->type !=IOMAP_MAPPED ); +WARN_ON_ONCE (!ret && iomap->type !=IOMAP_MAPPED );return ret; }
Greg Kroah-Hartman
maintainerPATCH 362/381 ext4: improve error recovery code paths in __ext4_remount()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 4c0b4818b1f636bc96359f7817a2d8bab6370162 upstream.
If there are failures while changing the mount options in __ext4_remount(), we need to restore the old mount options.
This commit fixes two problem. The first is there is a chance that we will free the old quota file names before a potential failure leading to a use-after-free. The second problem addressed in this commit is if there is a failed read/write to read-only transition, if the quota has already been suspended, we need to renable quota handling.
--- fs/ext4/super.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/ext4/super.c +10 -3
@@ -6028,9 +6028,6 @@ static int ext4_remount(struct super_blo }#ifdef CONFIG_QUOTA -/* Release old quota file names */ -for (i =0 ; i <EXT4_MAXQUOTAS ; i++) -kfree (old_opts.s_qf_names[i]);if (enable_quota) {if (sb_any_quota_suspended (sb))dquot_resume (sb,-1 );
@@ -6040,6 +6037,9 @@ static int ext4_remount(struct super_blo goto restore_opts; } } +/* Release old quota file names */ +for (i =0 ; i <EXT4_MAXQUOTAS ; i++) +kfree (old_opts.s_qf_names[i]);#endif if (!test_opt (sb,BLOCK_VALIDITY ) && sbi->s_system_blks)ext4_release_system_zone (sb);
@@ -6059,6 +6059,13 @@ static int ext4_remount(struct super_bloreturn 0 ; restore_opts: +/* +* If there was a failing r/w to ro transition, we may need to +* re-enable quota +*/ +if ((sb->s_flags &SB_RDONLY ) && !(old_sb_flags &SB_RDONLY ) && +sb_any_quota_suspended (sb)) +dquot_resume (sb,-1 ); sb->s_flags = old_sb_flags; sbi->s_mount_opt = old_opts.s_mount_opt; sbi->s_mount_opt2 = old_opts.s_mount_opt2;
Greg Kroah-Hartman
maintainerPATCH 363/381 ext4: fix deadlock when converting an inline directory in nojournal mode
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit f4ce24f54d9cca4f09a395f3eecce20d6bec4663 upstream.
In no journal mode, ext4_finish_convert_inline_dir() can self-deadlock by calling ext4_handle_dirty_dirblock() when it already has taken the directory lock. There is a similar self-deadlock in ext4_incvert_inline_data_nolock() for data files which we'll fix at the same time.
A simple reproducer demonstrating the problem:
mke2fs -Fq -t ext2 -O inline_data -b 4k /dev/vdc 64 mount -t ext4 -o dirsync /dev/vdc /vdc
cd /vdc
mkdir file0
cd file0
touch file0
touch file1
attr -s BurnSpaceInEA -V abcde .
touch supercalifragilisticexpialidocious
--- fs/ext4/inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/inline.c +2 -1
@@ -1172,6 +1172,7 @@ static int ext4_finish_convert_inline_diext4_initialize_dirent_tail (dir_block, inode->i_sb->s_blocksize);set_buffer_uptodate (dir_block); +unlock_buffer (dir_block); err =ext4_handle_dirty_dirblock (handle, inode, dir_block);if (err)return err;
@@ -1245,6 +1246,7 @@ static int ext4_convert_inline_data_noloif (!S_ISDIR (inode->i_mode)) {memcpy (data_bh->b_data, buf, inline_size);set_buffer_uptodate (data_bh); +unlock_buffer (data_bh); error =ext4_handle_dirty_metadata (handle, inode, data_bh); }else {
@@ -1252,7 +1254,6 @@ static int ext4_convert_inline_data_nolo buf, inline_size); } -unlock_buffer (data_bh); out_restore:if (error)ext4_restore_inline_data (handle, inode, iloc, buf, inline_size);
Greg Kroah-Hartman
maintainerPATCH 364/381 ext4: add bounds checking in get_max_inline_xattr_value_size()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 2220eaf90992c11d888fe771055d4de330385f01 upstream.
Normally the extended attributes in the inode body would have been checked when the inode is first opened, but if someone is writing to the block device while the file system is mounted, it's possible for the inode table to get corrupted. Add bounds checking to avoid reading beyond the end of allocated memory if this happens.
--- fs/ext4/inline.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/ext4/inline.c +11 -1
@@ -32,6 +32,7 @@ static int get_max_inline_xattr_value_sistruct ext4_xattr_ibody_header *header;struct ext4_xattr_entry *entry;struct ext4_inode *raw_inode; +void *end;int free, min_offs;if (!EXT4_INODE_HAS_XATTR_SPACE (inode))
@@ -55,14 +56,23 @@ static int get_max_inline_xattr_value_si raw_inode =ext4_raw_inode (iloc); header =IHDR (inode, raw_inode); entry =IFIRST (header); + end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size;/* Compute min_offs. */ -for (; !IS_LAST_ENTRY (entry); entry =EXT4_XATTR_NEXT (entry)) { +while (!IS_LAST_ENTRY (entry)) { +void *next =EXT4_XATTR_NEXT (entry); + +if (next >= end) { +EXT4_ERROR_INODE (inode, +"corrupt xattr in inline inode" ); +return 0 ; + }if (!entry->e_value_inum && entry->e_value_size) {size_t offs =le16_to_cpu (entry->e_value_offs);if (offs < min_offs) min_offs = offs; } + entry = next; } free = min_offs - ((void *)entry - (void *)IFIRST (header)) -sizeof (__u32);
Greg Kroah-Hartman
maintainerPATCH 365/381 ext4: bail out of ext4_xattr_ibody_get() fails for any reason
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 2a534e1d0d1591e951f9ece2fb460b2ff92edabd upstream.
In ext4_update_inline_data(), if ext4_xattr_ibody_get() fails for any reason, it's best if we just fail as opposed to stumbling on, especially if the failure is EFSCORRUPTED.
--- fs/ext4/inline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inline.c +1 -1
@@ -358,7 +358,7 @@ static int ext4_update_inline_data(handl error =ext4_xattr_ibody_get (inode, i.name_index, i.name, value, len); -if (error == -ENODATA ) +if (error <0 ) goto out;BUFFER_TRACE (is.iloc.bh,"get_write_access" );
Greg Kroah-Hartman
maintainerPATCH 366/381 ext4: remove a BUG_ON in ext4_mb_release_group_pa()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 463808f237cf73e98a1a45ff7460c2406a150a0b upstream.
If a malicious fuzzer overwrites the ext4 superblock while it is mounted such that the s_first_data_block is set to a very large number, the calculation of the block group can underflow, and trigger a BUG_ON check. Change this to be an ext4_warning so that we don't crash the kernel.
--- fs/ext4/mballoc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +5 -1
@@ -4250,7 +4250,11 @@ ext4_mb_release_group_pa(struct ext4_budtrace_ext4_mb_release_group_pa (sb, pa);BUG_ON (pa->pa_deleted ==0 );ext4_get_group_no_and_offset (sb, pa->pa_pstart, &group, &bit); -BUG_ON (group != e4b->bd_group && pa->pa_len !=0 ); +if (unlikely (group != e4b->bd_group && pa->pa_len !=0 )) { +ext4_warning (sb,"bad group: expected %u, group %u, pa_start %llu" , + e4b->bd_group, group, pa->pa_pstart); +return 0 ; + }mb_free_blocks (pa->pa_inode, e4b, bit, pa->pa_len);atomic_add (pa->pa_len, &EXT4_SB (sb)->s_mb_discarded);trace_ext4_mballoc_discard (sb,NULL , group, bit, pa->pa_len);
Greg Kroah-Hartman
maintainerPATCH 367/381 ext4: fix invalid free tracking in ext4_xattr_move_to_block()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit b87c7cdf2bed4928b899e1ce91ef0d147017ba45 upstream.
In ext4_xattr_move_to_block(), the value of the extended attribute which we need to move to an external block may be allocated by kvmalloc() if the value is stored in an external inode. So at the end of the function the code tried to check if this was the case by testing entry->e_value_inum.
However, at this point, the pointer to the xattr entry is no longer valid, because it was removed from the original location where it had been stored. So we could end up calling kvfree() on a pointer which was not allocated by kvmalloc(); or we could also potentially leak memory by not freeing the buffer when it should be freed. Fix this by storing whether it should be freed in a separate variable.
--- fs/ext4/xattr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ext4/xattr.c +3 -2
@@ -2554,6 +2554,7 @@ static int ext4_xattr_move_to_block(hand .in_inode = !!entry->e_value_inum, };struct ext4_xattr_ibody_header *header =IHDR (inode, raw_inode); +int needs_kvfree =0 ;int error; is =kzalloc (sizeof (struct ext4_xattr_ibody_find ),GFP_NOFS );
@@ -2576,7 +2577,7 @@ static int ext4_xattr_move_to_block(hand error = -ENOMEM ; goto out; } - + needs_kvfree =1 ; error =ext4_xattr_inode_get (inode, entry, buffer, value_size);if (error) goto out;
@@ -2615,7 +2616,7 @@ static int ext4_xattr_move_to_block(hand out:kfree (b_entry_name); -if (entry->e_value_inum && buffer) +if (needs_kvfree && buffer)kvfree (buffer);if (is)brelse (is->iloc.bh);
Greg Kroah-Hartman
maintainerPATCH 368/381 serial: 8250: Fix serial8250_tx_empty() race with DMA Tx
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
commit 146a37e05d620cef4ad430e5d1c9c077fe6fa76f upstream.
There's a potential race before THRE/TEMT deasserts when DMA Tx is starting up (or the next batch of continuous Tx is being submitted). This can lead to misdetecting Tx empty condition.
It is entirely normal for THRE/TEMT to be set for some time after the DMA Tx had been setup in serial8250_tx_dma(). As Tx side is definitely not empty at that point, it seems incorrect for serial8250_tx_empty() claim Tx is empty.
Fix the race by also checking in serial8250_tx_empty() whether there's DMA Tx active.
Note: This fix only addresses in-kernel race mainly to make using TCSADRAIN/FLUSH robust. Userspace can still cause other races but they seem userspace concurrency control problems.
--- drivers/tty/serial/8250/8250.h | 12 ++++++++++++ drivers/tty/serial/8250/8250_port.c | 12 +++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-)
drivers/tty/serial/8250/8250.h +12 -0
@@ -330,6 +330,13 @@ extern int serial8250_rx_dma(struct uartextern void serial8250_rx_dma_flush (struct uart_8250_port *);extern int serial8250_request_dma (struct uart_8250_port *);extern void serial8250_release_dma (struct uart_8250_port *); + +static inline bool serial8250_tx_dma_running (struct uart_8250_port *p) +{ +struct uart_8250_dma *dma = p->dma; + +return dma && dma->tx_running; +}#else static inline int serial8250_tx_dma (struct uart_8250_port *p) {
@@ -345,6 +352,11 @@ static inline int serial8250_request_dma return -1; }static inline void serial8250_release_dma (struct uart_8250_port *p) { } + +static inline bool serial8250_tx_dma_running (struct uart_8250_port *p) +{ +return false; +}#endif static inline int ns16550a_goto_highspeed (struct uart_8250_port *up)
drivers/tty/serial/8250/8250_port.c +9 -3
@@ -1971,19 +1971,25 @@ static int serial8250_tx_threshold_handlstatic unsigned int serial8250_tx_empty (struct uart_port *port) {struct uart_8250_port *up =up_to_u8250p (port); +unsigned int result =0 ;unsigned long flags;unsigned int lsr;serial8250_rpm_get (up);spin_lock_irqsave (&port->lock, flags); - lsr =serial_port_in (port,UART_LSR ); - up->lsr_saved_flags |= lsr &LSR_SAVE_FLAGS ; +if (!serial8250_tx_dma_running (up)) { + lsr =serial_port_in (port,UART_LSR ); + up->lsr_saved_flags |= lsr &LSR_SAVE_FLAGS ; + +if ((lsr &BOTH_EMPTY ) ==BOTH_EMPTY ) + result =TIOCSER_TEMT ; + }spin_unlock_irqrestore (&port->lock, flags);serial8250_rpm_put (up); -return (lsr &BOTH_EMPTY ) ==BOTH_EMPTY ?TIOCSER_TEMT :0 ; +return result; }unsigned int serial8250_do_get_mctrl (struct uart_port *port)
Greg Kroah-Hartman
maintainerPATCH 369/381 drbd: correctly submit flush bio on barrier
In reply to Greg Kroah-HartmanFrom: Christoph Böhmwalder <[email protected]>
commit 3899d94e3831ee07ea6821c032dc297aec80586a upstream.
When we receive a flush command (or "barrier" in DRBD), we currently use a REQ_OP_FLUSH with the REQ_PREFLUSH flag set.
The correct way to submit a flush bio is by using a REQ_OP_WRITE without any data, and set the REQ_PREFLUSH flag.
Since commit b4a6bb3a67aa ("block: add a sanity check for non-write flush/fua bios"), this triggers a warning in the block layer, but this has been broken for quite some time before that.
So use the correct set of flags to actually make the flush happen.
--- drivers/block/drbd/drbd_receiver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/drbd/drbd_receiver.c +1 -1
@@ -1299,7 +1299,7 @@ static void submit_one_flush(struct drbdbio_set_dev (bio, device->ldev->backing_bdev); bio->bi_private = octx; bio->bi_end_io = one_flush_endio; - bio->bi_opf =REQ_OP_FLUSH |REQ_PREFLUSH ; + bio->bi_opf =REQ_OP_WRITE |REQ_PREFLUSH ; device->flush_jif = jiffies;set_bit (FLUSH_PENDING , &device->flags);
Greg Kroah-Hartman
maintainerPATCH 370/381 KVM: x86: Ensure PV TLB flush tracepoint reflects KVM behavior
In reply to Greg Kroah-HartmanFrom: Rishabh Bhatnagar <[email protected]>
From: Lai Jiangshan <[email protected]>
commit af3511ff7fa2107d6410831f3d71030f5e8d2b25 upstream.
In record_steal_time(), st->preempted is read twice, and trace_kvm_pv_tlb_flush() might output result inconsistent if kvm_vcpu_flush_tlb_guest() see a different st->preempted later.
It is a very trivial problem and hardly has actual harm and can be avoided by reseting and reading st->preempted in atomic way via xchg().
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +4 -2
@@ -3041,9 +3041,11 @@ static void record_steal_time(struct kvm* expensive IPIs. */ if (guest_pv_has (vcpu,KVM_FEATURE_PV_TLB_FLUSH )) { +u8 st_preempted =xchg (&st->preempted,0 ); +trace_kvm_pv_tlb_flush (vcpu->vcpu_id, - st->preempted &KVM_VCPU_FLUSH_TLB ); -if (xchg (&st->preempted,0 ) &KVM_VCPU_FLUSH_TLB ) + st_preempted &KVM_VCPU_FLUSH_TLB ); +if (st_preempted &KVM_VCPU_FLUSH_TLB )kvm_vcpu_flush_tlb_guest (vcpu); }else { st->preempted =0 ;
Greg Kroah-Hartman
maintainerPATCH 371/381 KVM: x86: Fix recording of guest steal time / preempted status
In reply to Greg Kroah-HartmanFrom: Rishabh Bhatnagar <[email protected]>
From: David Woodhouse <[email protected]>
commit 7e2175ebd695f17860c5bd4ad7616cce12ed4591 upstream.
In commit b043138246a4 ("x86/KVM: Make sure KVM_VCPU_FLUSH_TLB flag is not missed") we switched to using a gfn_to_pfn_cache for accessing the guest steal time structure in order to allow for an atomic xchg of the preempted field. This has a couple of problems.
Firstly, kvm_map_gfn() doesn't work at all for IOMEM pages when the atomic flag is set, which it is in kvm_steal_time_set_preempted(). So a guest vCPU using an IOMEM page for its steal time would never have its preempted field set.
Secondly, the gfn_to_pfn_cache is not invalidated in all cases where it should have been. There are two stages to the GFN->PFN conversion; first the GFN is converted to a userspace HVA, and then that HVA is looked up in the process page tables to find the underlying host PFN. Correct invalidation of the latter would require being hooked up to the MMU notifiers, but that doesn't happen---so it just keeps mapping and unmapping the *wrong* PFN after the userspace page tables change.
In the !IOMEM case at least the stale page *is* pinned all the time it's cached, so it won't be freed and reused by anyone else while still receiving the steal time updates. The map/unmap dance only takes care of the KVM administrivia such as marking the page dirty.
Until the gfn_to_pfn cache handles the remapping automatically by integrating with the MMU notifiers, we might as well not get a kernel mapping of it, and use the perfectly serviceable userspace HVA that we already have. We just need to implement the atomic xchg on the userspace address with appropriate exception handling, which is fairly trivial.
Message-Id: <[email protected]> [I didn't entirely agree with David's assessment of the
usefulness of the gfn_to_pfn cache, and integrated the outcome of the discussion in the above commit message. - Paolo]
[[email protected]: Use the older mark_page_dirty_in_slot api without kvm argument]
--- arch/x86/include/asm/kvm_host.h | 2 arch/x86/kvm/x86.c | 105 ++++++++++++++++++++++++++++------------ 2 files changed, 76 insertions(+), 31 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -1
@@ -664,7 +664,7 @@ struct kvm_vcpu_arch {u8 preempted;u64 msr_val;u64 last_steal; -struct gfn_to_pfn_cache cache; +struct gfn_to_hva_cache cache; } st;u64 l1_tsc_offset;
arch/x86/kvm/x86.c +75 -30
163 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 372/381 KVM: Fix steal time asm constraints
In reply to Greg Kroah-HartmanFrom: Rishabh Bhatnagar <[email protected]>
From: David Woodhouse <[email protected]>
commit 964b7aa0b040bdc6ec1c543ee620cda3f8b4c68a upstream.
In 64-bit mode, x86 instruction encoding allows us to use the low 8 bits of any GPR as an 8-bit operand. In 32-bit mode, however, we can only use the [abcd] registers. For which, GCC has the "q" constraint instead of the less restrictive "r".
Also fix st->preempted, which is an input/output operand rather than an input.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +3 -3
@@ -3064,9 +3064,9 @@ static void record_steal_time(struct kvm"xor %1, %1\n" "2:\n" _ASM_EXTABLE_UA(1b ,2b ) - : "+r" (st_preempted), -" +&r" (err) - : "m" (st->preempted)); + : "+q" (st_preempted), +" +&r" (err), + "+m" (st->preempted)); if (err) goto out;
Greg Kroah-Hartman
maintainerPATCH 373/381 KVM: x86: Remove obsolete disabling of page faults in kvm_arch_vcpu_put()
In reply to Greg Kroah-HartmanFrom: Rishabh Bhatnagar <[email protected]>
From: Sean Christopherson <[email protected]>
commit 19979fba9bfaeab427a8e106d915f0627c952828 upstream.
Remove the disabling of page faults across kvm_steal_time_set_preempted() as KVM now accesses the steal time struct (shared with the guest) via a cached mapping (see commit b043138246a4, "x86/KVM: Make sure KVM_VCPU_FLUSH_TLB flag is not missed".) The cache lookup is flagged as atomic, thus it would be a bug if KVM tried to resolve a new pfn, i.e. we want the splat that would be reached via might_fault().
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 10 ---------- 1 file changed, 10 deletions(-)
arch/x86/kvm/x86.c +0 -10
@@ -4143,22 +4143,12 @@ void kvm_arch_vcpu_put(struct kvm_vcpu * vcpu->arch.preempted_in_kernel = !kvm_x86_ops.get_cpl (vcpu);/* -* Disable page faults because we're in atomic context here. -* kvm_write_guest_offset_cached() would call might_fault() -* that relies on pagefault_disable() to tell if there's a -* bug. NOTE: the write to guest memory may not go through if -* during postcopy live migration or if there's heavy guest -* paging. -*/ -pagefault_disable (); -/* * kvm_memslots() will be called by * kvm_write_guest_offset_cached() so take the srcu lock. */ idx =srcu_read_lock (&vcpu->kvm->srcu);kvm_steal_time_set_preempted (vcpu);srcu_read_unlock (&vcpu->kvm->srcu, idx); -pagefault_enable (); kvm_x86_ops.vcpu_put (vcpu); vcpu->arch.last_host_tsc =rdtsc ();/*
Greg Kroah-Hartman
maintainerPATCH 374/381 KVM: x86: do not set st->preempted when going back to user space
In reply to Greg Kroah-HartmanFrom: Rishabh Bhatnagar <[email protected]>
From: Paolo Bonzini <[email protected]>
commit 54aa83c90198e68eee8b0850c749bc70efb548da upstream.
Similar to the Xen path, only change the vCPU's reported state if the vCPU was actually preempted. The reason for KVM's behavior is that for example optimistic spinning might not be a good idea if the guest is doing repeated exits to userspace; however, it is confusing and unlikely to make a difference, because well-tuned guests will hardly ever exit KVM_RUN in the first place.
[[email protected]: Don't check for xen msr as support is not available and skip the SEV-ES condition]
--- arch/x86/kvm/x86.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
arch/x86/kvm/x86.c +10 -8
@@ -4139,16 +4139,18 @@ void kvm_arch_vcpu_put(struct kvm_vcpu * {int idx; -if (vcpu->preempted) +if (vcpu->preempted) { vcpu->arch.preempted_in_kernel = !kvm_x86_ops.get_cpl (vcpu); -/* -* kvm_memslots() will be called by -* kvm_write_guest_offset_cached() so take the srcu lock. -*/ - idx =srcu_read_lock (&vcpu->kvm->srcu); -kvm_steal_time_set_preempted (vcpu); -srcu_read_unlock (&vcpu->kvm->srcu, idx); +/* +* Take the srcu lock as memslots will be accessed to check the gfn +* cache generation against the memslots generation. +*/ + idx =srcu_read_lock (&vcpu->kvm->srcu); +kvm_steal_time_set_preempted (vcpu); +srcu_read_unlock (&vcpu->kvm->srcu, idx); + } + kvm_x86_ops.vcpu_put (vcpu); vcpu->arch.last_host_tsc =rdtsc ();/*
Greg Kroah-Hartman
maintainerPATCH 375/381 KVM: x86: revalidate steal time cache if MSR value changes
In reply to Greg Kroah-HartmanFrom: Rishabh Bhatnagar <[email protected]>
From: Paolo Bonzini <[email protected]>
commit 901d3765fa804ce42812f1d5b1f3de2dfbb26723 upstream.
Commit 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempted status", 2021-11-11) open coded the previous call to kvm_map_gfn, but in doing so it dropped the comparison between the cached guest physical address and the one in the MSR. This cause an incorrect cache hit if the guest modifies the steal time address while the memslots remain the same. This can happen with kexec, in which case the steal time data is written at the address used by the old kernel instead of the old one.
While at it, rename the variable from gfn to gpa since it is a plain physical address and not a right-shifted one.
--- arch/x86/kvm/x86.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +3 -3
@@ -3025,6 +3025,7 @@ static void record_steal_time(struct kvmstruct gfn_to_hva_cache *ghc = &vcpu->arch.st.cache;struct kvm_steal_time __user *st;struct kvm_memslots *slots; +gpa_t gpa = vcpu->arch.st.msr_val &KVM_STEAL_VALID_BITS ;u64 steal;u32 version;
@@ -3037,13 +3038,12 @@ static void record_steal_time(struct kvm slots =kvm_memslots (vcpu->kvm);if (unlikely (slots->generation != ghc->generation || + gpa != ghc->gpa ||kvm_is_error_hva (ghc->hva) || !ghc->memslot)) { -gfn_t gfn = vcpu->arch.st.msr_val &KVM_STEAL_VALID_BITS ; -/* We rely on the fact that it fits in a single page. */ BUILD_BUG_ON ((sizeof (*st) -1 ) &KVM_STEAL_VALID_BITS ); -if (kvm_gfn_to_hva_cache_init (vcpu->kvm, ghc, gfn,sizeof (*st)) || +if (kvm_gfn_to_hva_cache_init (vcpu->kvm, ghc, gpa,sizeof (*st)) ||kvm_is_error_hva (ghc->hva) || !ghc->memslot)return ; }
Greg Kroah-Hartman
maintainerPATCH 376/381 KVM: x86: do not report preemption if the steal time cache is stale
In reply to Greg Kroah-HartmanFrom: Rishabh Bhatnagar <[email protected]>
From: Paolo Bonzini <[email protected]>
commit c3c28d24d910a746b02f496d190e0e8c6560224b upstream.
Commit 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempted status", 2021-11-11) open coded the previous call to kvm_map_gfn, but in doing so it dropped the comparison between the cached guest physical address and the one in the MSR. This cause an incorrect cache hit if the guest modifies the steal time address while the memslots remain the same. This can happen with kexec, in which case the preempted bit is written at the address used by the old kernel instead of the old one.
--- arch/x86/kvm/x86.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/x86.c +2 -0
@@ -4096,6 +4096,7 @@ static void kvm_steal_time_set_preemptedstruct kvm_steal_time __user *st;struct kvm_memslots *slots;static const u8 preempted =KVM_VCPU_PREEMPTED ; +gpa_t gpa = vcpu->arch.st.msr_val &KVM_STEAL_VALID_BITS ;/* * The vCPU can be marked preempted if and only if the VM-Exit was on
@@ -4123,6 +4124,7 @@ static void kvm_steal_time_set_preempted slots =kvm_memslots (vcpu->kvm);if (unlikely (slots->generation != ghc->generation || + gpa != ghc->gpa ||kvm_is_error_hva (ghc->hva) || !ghc->memslot))return ;
Greg Kroah-Hartman
maintainerPATCH 377/381 KVM: x86: move guest_pv_has out of user_access section
In reply to Greg Kroah-HartmanFrom: Rishabh Bhatnagar <[email protected]>
From: Paolo Bonzini <[email protected]>
commit 3e067fd8503d6205aa0c1c8f48f6b209c592d19c upstream.
When UBSAN is enabled, the code emitted for the call to guest_pv_has includes a call to __ubsan_handle_load_invalid_value. objtool complains that this call happens with UACCESS enabled; to avoid the warning, pull the calls to user_access_begin into both arms of the "if" statement, after the check for guest_pv_has.
--- arch/x86/kvm/x86.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +6 -3
@@ -3049,9 +3049,6 @@ static void record_steal_time(struct kvm } st = (struct kvm_steal_time __user *)ghc->hva; -if (!user_access_begin (st,sizeof (*st))) -return ; -/* * Doing a TLB flush here, on the guest's behalf, can avoid * expensive IPIs.
@@ -3060,6 +3057,9 @@ static void record_steal_time(struct kvmu8 st_preempted =0 ;int err = -EFAULT ; +if (!user_access_begin (st,sizeof (*st))) +return ; + asmvolatile ("1: xchgb %0, %2\n" "xor %1, %1\n" "2:\n"
@@ -3082,6 +3082,9 @@ static void record_steal_time(struct kvmif (!user_access_begin (st,sizeof (*st))) goto dirty; }else { +if (!user_access_begin (st,sizeof (*st))) +return ; +unsafe_put_user (0 , &st->preempted, out); vcpu->arch.st.preempted =0 ; }
Greg Kroah-Hartman
maintainerPATCH 378/381 printk: declare printk_deferred_{enter,safe}() in include/linux/printk.h
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit 85e3e7fbbb720b9897fba9a99659e31cbd1c082e upstream.
[This patch implements subset of original commit 85e3e7fbbb72 ("printk:
remove NMI tracking") where commit 1007843a9190 ("mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock") depends on, for commit 3d36424b3b58 ("mm/page_alloc: fix race condition between build_all_zonelists and page allocation") was backported to stable.]
All NMI contexts are handled the same as the safe context: store the message and defer printing. There is no need to have special NMI context tracking for this. Using in_nmi() is enough.
There are several parts of the kernel that are manually calling into the printk NMI context tracking in order to cause general printk deferred printing:
arch/arm/kernel/smp.c
arch/powerpc/kexec/crash.c
kernel/trace/trace.c
For arm/kernel/smp.c and powerpc/kexec/crash.c, provide a new function pair printk_deferred_enter/exit that explicitly achieves the same objective.
For ftrace, remove the printk context manipulation completely. It was added in commit 03fc7f9c99c1 ("printk/nmi: Prevent deadlock when accessing the main log buffer in NMI"). The purpose was to enforce storing messages directly into the ring buffer even in NMI context. It really should have only modified the behavior in NMI context. There is no need for a special behavior any longer. All messages are always stored directly now. The console deferring is handled transparently in vprintk().
[[email protected]: Remove special handling in ftrace.c completely.
--- include/linux/printk.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
include/linux/printk.h +19 -0
@@ -623,4 +623,23 @@ static inline void print_hex_dump_debug(#define print_hex_dump_bytes (prefix_str, prefix_type, buf, len) \ print_hex_dump_debug(prefix_str, prefix_type, 16, 1, buf, len, true) +#ifdef CONFIG_PRINTK +extern void __printk_safe_enter (void ); +extern void __printk_safe_exit (void ); +/* +* The printk_deferred_enter/exit macros are available only as a hack for +* some code paths that need to defer all printk console printing. Interrupts +* must be disabled for the deferred duration. +*/ +#define printk_deferred_enter __printk_safe_enter +#define printk_deferred_exit __printk_safe_exit +#else +static inline void printk_deferred_enter (void ) +{ +} +static inline void printk_deferred_exit (void ) +{ +} +#endif +#endif
Greg Kroah-Hartman
maintainerPATCH 379/381 drm/exynos: move to use request_irq by IRQF_NO_AUTOEN flag
In reply to Greg Kroah-HartmanFrom: Tian Tao <[email protected]>
commit a4e5eed2c6a689ef2b6ad8d7ae86665c69039379 upstream.
After this patch cbe16f35bee68 genirq: Add IRQF_NO_AUTOEN for request_irq/nmi() is merged. request_irq() after setting IRQ_NOAUTOEN as below
irq_set_status_flags(irq, IRQ_NOAUTOEN); request_irq(dev, irq...);
can be replaced by request_irq() with IRQF_NO_AUTOEN flag.
v2:
Fix the problem of using wrong flags
--- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/exynos5433_drm_decon.c +2 -2
@@ -775,8 +775,8 @@ static int decon_conf_irq(struct decon_creturn irq; } } -irq_set_status_flags (irq,IRQ_NOAUTOEN ); - ret =devm_request_irq (ctx->dev, irq, handler, flags,"drm_decon" , ctx); + ret =devm_request_irq (ctx->dev, irq, handler, + flags |IRQF_NO_AUTOEN ,"drm_decon" , ctx);if (ret <0 ) {dev_err (ctx->dev,"IRQ %s request failed\n" , name);return ret;
drivers/gpu/drm/exynos/exynos_drm_dsi.c +3 -4
@@ -1353,10 +1353,9 @@ static int exynos_dsi_register_te_irq(st } te_gpio_irq =gpio_to_irq (dsi->te_gpio); -irq_set_status_flags (te_gpio_irq,IRQ_NOAUTOEN ); ret =request_threaded_irq (te_gpio_irq, exynos_dsi_te_irq_handler,NULL , -IRQF_TRIGGER_RISING ,"TE" , dsi); +IRQF_TRIGGER_RISING |IRQF_NO_AUTOEN ,"TE" , dsi);if (ret) {dev_err (dsi->dev,"request interrupt failed with %d\n" , ret);gpio_free (dsi->te_gpio);
@@ -1802,9 +1801,9 @@ static int exynos_dsi_probe(struct platfif (dsi->irq <0 )return dsi->irq; -irq_set_status_flags (dsi->irq,IRQ_NOAUTOEN ); ret =devm_request_threaded_irq (dev, dsi->irq,NULL , - exynos_dsi_irq,IRQF_ONESHOT , + exynos_dsi_irq, +IRQF_ONESHOT |IRQF_NO_AUTOEN ,dev_name (dev), dsi);if (ret) {dev_err (dev,"failed to request dsi irq\n" );
Greg Kroah-Hartman
maintainerPATCH 380/381 mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit 1007843a91909a4995ee78a538f62d8665705b66 upstream.
syzbot is reporting circular locking dependency which involves zonelist_update_seq seqlock [1], for this lock is checked by memory allocation requests which do not need to be retried.
One deadlock scenario is kmalloc(GFP_ATOMIC) from an interrupt handler.
CPU0
----
__build_all_zonelists() {
write_seqlock(&zonelist_update_seq); // makes zonelist_update_seq.seqcount odd
// e.g. timer interrupt handler runs at this moment
some_timer_func() {
kmalloc(GFP_ATOMIC) {
__alloc_pages_slowpath() {
read_seqbegin(&zonelist_update_seq) {
// spins forever because zonelist_update_seq.seqcount is odd
}
}
}
}
// e.g. timer interrupt handler finishes
write_sequnlock(&zonelist_update_seq); // makes zonelist_update_seq.seqcount even
}This deadlock scenario can be easily eliminated by not calling read_seqbegin(&zonelist_update_seq) from !__GFP_DIRECT_RECLAIM allocation requests, for retry is applicable to only __GFP_DIRECT_RECLAIM allocation requests. But Michal Hocko does not know whether we should go with this approach.
Another deadlock scenario which syzbot is reporting is a race between kmalloc(GFP_ATOMIC) from tty_insert_flip_string_and_push_buffer() with port->lock held and printk() from __build_all_zonelists() with zonelist_update_seq held.
CPU0 CPU1
---- ----
pty_write() {
tty_insert_flip_string_and_push_buffer() {
__build_all_zonelists() {
write_seqlock(&zonelist_update_seq);
build_zonelists() {
printk() {
vprintk() {
vprintk_default() {
vprintk_emit() {
console_unlock() {
console_flush_all() {
console_emit_next_record() {
con->write() = serial8250_console_write() {
spin_lock_irqsave(&port->lock, flags);
tty_insert_flip_string() {
tty_insert_flip_string_fixed_flag() {
__tty_buffer_request_room() {
tty_buffer_alloc() {
kmalloc(GFP_ATOMIC | __GFP_NOWARN) {
__alloc_pages_slowpath() {
zonelist_iter_begin() {
read_seqbegin(&zonelist_update_seq); // spins forever because zonelist_update_seq.seqcount is odd
spin_lock_irqsave(&port->lock, flags); // spins forever because port->lock is held
}
}
}
}
}
}
}
}
spin_unlock_irqrestore(&port->lock, flags);
// message is printed to console
spin_unlock_irqrestore(&port->lock, flags);
}
}
}
}
}
}
}
}
}
write_sequnlock(&zonelist_update_seq);
}
}
}This deadlock scenario can be eliminated by
preventing interrupt context from calling kmalloc(GFP_ATOMIC)
and
preventing printk() from calling console_flush_all()
while zonelist_update_seq.seqcount is odd.
Since Petr Mladek thinks that __build_all_zonelists() can become a candidate for deferring printk() [2], let's address this problem by
disabling local interrupts in order to avoid kmalloc(GFP_ATOMIC)
and
disabling synchronous printk() in order to avoid console_flush_all()
.
As a side effect of minimizing duration of zonelist_update_seq.seqcount being odd by disabling synchronous printk(), latency at read_seqbegin(&zonelist_update_seq) for both !__GFP_DIRECT_RECLAIM and __GFP_DIRECT_RECLAIM allocation requests will be reduced. Although, from lockdep perspective, not calling read_seqbegin(&zonelist_update_seq) (i.e. do not record unnecessary locking dependency) from interrupt context is still preferable, even if we don't allow calling kmalloc(GFP_ATOMIC) inside write_seqlock(&zonelist_update_seq)/write_sequnlock(&zonelist_update_seq) section...
--- mm/page_alloc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
mm/page_alloc.c +16 -0
@@ -5973,7 +5973,21 @@ static void __build_all_zonelists(void *int nid;int __maybe_unused cpu;pg_data_t *self = data; +unsigned long flags; +/* +* Explicitly disable this CPU's interrupts before taking seqlock +* to prevent any IRQ handler from calling into the page allocator +* (e.g. GFP_ATOMIC) that could hit zonelist_iter_begin and livelock. +*/ +local_irq_save (flags); +/* +* Explicitly disable this CPU's synchronous printk() before taking +* seqlock to prevent any printk() from trying to hold port->lock, for +* tty_insert_flip_string_and_push_buffer() on other CPU might be +* calling kmalloc(GFP_ATOMIC | __GFP_NOWARN) with port->lock held. +*/ +printk_deferred_enter ();write_seqlock (&zonelist_update_seq);#ifdef CONFIG_NUMA
@@ -6008,6 +6022,8 @@ static void __build_all_zonelists(void * }write_sequnlock (&zonelist_update_seq); +printk_deferred_exit (); +local_irq_restore (flags); }static noinline void__init
Greg Kroah-Hartman
maintainerPATCH 381/381 drm/amd/display: Fix hang when skipping modeset
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
commit da5e14909776edea4462672fb4a3007802d262e7 upstream.
[Why&How]
When skipping full modeset since the only state change was a front porch change, the DC commit sequence requires extra checks to handle non existant plane states being asked to be removed from context.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++++- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -1
@@ -7248,6 +7248,8 @@ static void amdgpu_dm_commit_planes(strucontinue ; dc_plane = dm_new_plane_state->dc_state; +if (!dc_plane) +continue ; bundle->surface_updates[planes_count].surface = dc_plane;if (new_pcrtc_state->color_mgmt_changed) {
@@ -8562,8 +8564,9 @@ static int dm_update_plane_state(structreturn -EINVAL ; } +if (dm_old_plane_state->dc_state) +dc_plane_state_release (dm_old_plane_state->dc_state); -dc_plane_state_release (dm_old_plane_state->dc_state); dm_new_plane_state->dc_state =NULL ; *lock_and_validation_needed = true;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +3 -0
@@ -1502,6 +1502,9 @@ bool dc_remove_plane_from_context(struct dc_stream_status *stream_status =NULL ;struct resource_pool *pool = dc->res_pool; +if (!plane_state) +return true; +for (i =0 ; i < context->stream_count; i++)if (context->streams[i] == stream) { stream_status = &context->stream_status[i];
Hello Greg,
Quoted 10 lines
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, May 15, 2023 5:24 PMThis is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
CIP configurations built and booted with Linux 5.10.180-rc1 (065b6901e6da):
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/867957631
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/commits/linux-5.10.y
Kind regards, Chris
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.180-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The build fails here with:
sound/soc/intel/boards/sof_sdw.c:187:6: error: ‘RT711_JD2_100K’ undeclared here (not in a function)
187 | RT711_JD2_100K),
| ^~~~~~~~~~~~~~make[7]: *** [scripts/Makefile.build:286: sound/soc/intel/boards/sof_sdw.o] Error 1 make[6]: *** [scripts/Makefile.build:503: sound/soc/intel/boards] Error 2 make[5]: *** [scripts/Makefile.build:503: sound/soc/intel] Error 2 make[4]: *** [scripts/Makefile.build:503: sound/soc] Error 2
make[3]: *** [Makefile:1828: sound] Error 2
I did mention it in
https://lore.kernel.org/stable/[email protected]/ as well but I guess it felt trough the cracks back then.
Regards,
Salvatore
Greg Kroah-Hartman
maintainerQuoted 22 lines · Salvatore Bonaccorso
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The build fails here with:
sound/soc/intel/boards/sof_sdw.c:187:6: error: ‘RT711_JD2_100K’ undeclared here (not in a function)187 | RT711_JD2_100K), | ^~~~~~~~~~~~~~make[7]: *** [
scripts/Makefile.build:286:sound/soc/intel/boards/sof_sdw.o] Error 1 make[6]: *** [scripts/Makefile.build:503:sound/soc/intel/boards] Error 2 make[5]: *** [scripts/Makefile.build:503:sound/soc/intel] Error 2 make[4]: *** [scripts/Makefile.build:503:sound/soc] Error 2
make[3]: *** [Makefile:1828: sound] Error 2
Quoted 3 lines
I did mention it in
https://lore.kernel.org/stable/[email protected]/ as well but I guess it felt trough the cracks back then.
Sorry I missed this back then, now dropped. Interesting that almost no other build testing caught this, it's a hard driver to enable...
thanks,
greg k-h
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Build test (gcc version 11.3.1 20230511):
mips: 63 configs -> no failure
arm: 104 configs -> no failure
arm64: 3 configs -> 1 failurex86_64: 4 configs -> no failure alpha allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failure
arm64 allmodconfig build fails with the error:
/gcc/bin/aarch64-linux-ld: arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid_ipa':
(.hyp.text+0x1a4c): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld: arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid':
(.hyp.text+0x1b20): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld: arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_flush_cpu_context':
(.hyp.text+0x1b80): undefined reference to `__kvm_nvhe_memset'
Boot test:x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]
[1]. https://openqa.qa.codethink.co.uk/tests/3530
[2]. https://openqa.qa.codethink.co.uk/tests/3531
Signature · 2 lines
Regards Sudip
Greg Kroah-Hartman
maintainerQuoted 19 lines · Sudip Mukherjee (Codethink)
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Build test (gcc version 11.3.1 20230511):
mips: 63 configs -> no failure
arm: 104 configs -> no failure
arm64: 3 configs -> 1 failurex86_64: 4 configs -> no failure alpha allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failure
Quoted 8 lines
arm64 allmodconfig build fails with the error:
/gcc/bin/aarch64-linux-ld:
arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid_ipa':
(.hyp.text+0x1a4c): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid':
(.hyp.text+0x1b20): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_flush_cpu_context':
(.hyp.text+0x1b80): undefined reference to `__kvm_nvhe_memset'
That's odd, I don't see that symbol anywhere in the tree at all.
And the only arm-related kvm changes don't have those symbols either (the other kvm changes are x86-only)
Also, no one else has seen this issue. Can you bisect?
thanks,
greg k-h
Quoted 30 lines · Greg Kroah-Hartman
Quoted 19 lines · Sudip Mukherjee (Codethink)
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Build test (gcc version 11.3.1 20230511):
mips: 63 configs -> no failure
arm: 104 configs -> no failure
arm64: 3 configs -> 1 failurex86_64: 4 configs -> no failure alpha allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failureQuoted 8 lines
arm64 allmodconfig build fails with the error:
/gcc/bin/aarch64-linux-ld:
arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid_ipa':
(.hyp.text+0x1a4c): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid':
(.hyp.text+0x1b20): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_flush_cpu_context':
(.hyp.text+0x1b80): undefined reference to `__kvm_nvhe_memset'
Quoted 6 lines
That's odd, I don't see that symbol anywhere in the tree at all.
And the only arm-related kvm changes don't have those symbols either (the other kvm changes are x86-only)
Also, no one else has seen this issue. Can you bisect?
This is an old issue,
Many other reported long back [1]
[1] https://lore.kernel.org/stable/CADYN=9KSKQx816id-zWepV-E3ozph3k2_i9Rhs6QseFv0hkPfg@mail.gmail.com/
- Naresh
Greg Kroah-Hartman
maintainerQuoted 37 lines · Naresh Kamboju
Quoted 35 lines · Greg Kroah-Hartman
Quoted 19 lines · Sudip Mukherjee (Codethink)
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Build test (gcc version 11.3.1 20230511):
mips: 63 configs -> no failure
arm: 104 configs -> no failure
arm64: 3 configs -> 1 failurex86_64: 4 configs -> no failure alpha allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failureQuoted 8 lines
arm64 allmodconfig build fails with the error:
/gcc/bin/aarch64-linux-ld:
arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid_ipa':
(.hyp.text+0x1a4c): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid':
(.hyp.text+0x1b20): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_flush_cpu_context':
(.hyp.text+0x1b80): undefined reference to `__kvm_nvhe_memset'That's odd, I don't see that symbol anywhere in the tree at all.
And the only arm-related kvm changes don't have those symbols either (the other kvm changes are x86-only)
Quoted 6 lines
Quoted 1 line
Also, no one else has seen this issue. Can you bisect?
This is an old issue,
Many other reported long back [1][1] https://lore.kernel.org/stable/CADYN=9KSKQx816id-zWepV-E3ozph3k2_i9Rhs6QseFv0hkPfg@mail.gmail.com/
Then maybe someone should submit it properly for inclusion?
thanks,
greg k-h
Quoted 38 lines · Greg Kroah-Hartman
Quoted 37 lines · Naresh Kamboju
Quoted 35 lines · Greg Kroah-Hartman
Quoted 19 lines · Sudip Mukherjee (Codethink)
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Build test (gcc version 11.3.1 20230511):
mips: 63 configs -> no failure
arm: 104 configs -> no failure
arm64: 3 configs -> 1 failurex86_64: 4 configs -> no failure alpha allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failureQuoted 8 lines
arm64 allmodconfig build fails with the error:
/gcc/bin/aarch64-linux-ld:
arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid_ipa':
(.hyp.text+0x1a4c): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid':
(.hyp.text+0x1b20): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_flush_cpu_context':
(.hyp.text+0x1b80): undefined reference to `__kvm_nvhe_memset'That's odd, I don't see that symbol anywhere in the tree at all.
And the only arm-related kvm changes don't have those symbols either (the other kvm changes are x86-only)
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Also, no one else has seen this issue. Can you bisect?
This is an old issue,
Many other reported long back [1][1] https://lore.kernel.org/stable/CADYN=9KSKQx816id-zWepV-E3ozph3k2_i9Rhs6QseFv0hkPfg@mail.gmail.com/
Then maybe someone should submit it properly for inclusion?
Attached the backported patch. Also verified that my build failure is fixed with it.
Signature · 2 lines
Regards Sudip
From f57cddd458d9d49e39c061960014ec6f09187ac0 Mon Sep 17 00:00:00 2001
From: Will Deacon <[email protected]>
Date: Fri, 19 Mar 2021 10:01:10 +0000
Subject: [PATCH] KVM: arm64: Link position-independent string routines into .hyp.text
commit 7b4a7b5e6fefd15f708f959dd43e188444e252ec upstream
Pull clear_page(), copy_page(), memcpy() and memset() into the nVHE hyp code and ensure that we always execute the '__pi_' entry point on the offchance that it changes in future.
[ qperret: Commit title nits and added linker script alias ]
--- arch/arm64/include/asm/hyp_image.h | 3 +++ arch/arm64/kernel/image-vars.h | 11 +++++++++++ arch/arm64/kvm/hyp/nvhe/Makefile | 4 ++++ 3 files changed, 18 insertions(+)
arch/arm64/include/asm/hyp_image.h +3 -0
@@ -31,6 +31,9 @@*/ #define KVM_NVHE_ALIAS (sym) kvm_nvhe_sym(sym) = sym; +/* Defines a linker script alias for KVM nVHE hyp symbols */ +#define KVM_NVHE_ALIAS_HYP (first, sec) kvm_nvhe_sym(first) = kvm_nvhe_sym(sec); +#endif /* LINKER_SCRIPT */ #endif /* __ARM64_HYP_IMAGE_H__ */
arch/arm64/kernel/image-vars.h +11 -0
@@ -103,6 +103,17 @@ KVM_NVHE_ALIAS(gic_nonsecure_priorities);KVM_NVHE_ALIAS (__start___kvm_ex_table);KVM_NVHE_ALIAS (__stop___kvm_ex_table); +/* Position-independent library routines */ +KVM_NVHE_ALIAS_HYP (clear_page, __pi_clear_page); +KVM_NVHE_ALIAS_HYP (copy_page, __pi_copy_page); +KVM_NVHE_ALIAS_HYP (memcpy, __pi_memcpy); +KVM_NVHE_ALIAS_HYP (memset, __pi_memset); + +#ifdef CONFIG_KASAN +KVM_NVHE_ALIAS_HYP (__memcpy, __pi_memcpy); +KVM_NVHE_ALIAS_HYP (__memset, __pi_memset); +#endif +#endif /* CONFIG_KVM */ #endif /* __ARM64_KERNEL_IMAGE_VARS_H */
arch/arm64/kvm/hyp/nvhe/Makefile +4 -0
@@ -6,9 +6,13 @@ asflags-y := -D__KVM_NVHE_HYPERVISOR__ ccflags-y := -D__KVM_NVHE_HYPERVISOR__ +lib-objs := clear_page.o copy_page.o memcpy.o memset.o +lib-objs := $(addprefix ../../../lib/, $(lib-objs)) + obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o hyp-init.o host.o hyp-main.o obj-y += ../vgic-v3-sr.o ../aarch32.o ../vgic-v2-cpuif-proxy.o ../entry.o \ ../fpsimd.o ../hyp-entry.o +obj-y += $(lib-objs) ## ## Build rules for compiling nVHE hyp code
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerQuoted 41 lines · Sudip Mukherjee (Codethink)
Quoted 40 lines · Greg Kroah-Hartman
Quoted 39 lines · Naresh Kamboju
Quoted 36 lines · Greg Kroah-Hartman
Quoted 19 lines · Sudip Mukherjee (Codethink)
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Build test (gcc version 11.3.1 20230511):
mips: 63 configs -> no failure
arm: 104 configs -> no failure
arm64: 3 configs -> 1 failurex86_64: 4 configs -> no failure alpha allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failureQuoted 8 lines
arm64 allmodconfig build fails with the error:
/gcc/bin/aarch64-linux-ld:
arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid_ipa':
(.hyp.text+0x1a4c): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_tlb_flush_vmid':
(.hyp.text+0x1b20): undefined reference to `__kvm_nvhe_memset'
/gcc/bin/aarch64-linux-ld:arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o: in function `__kvm_nvhe___kvm_flush_cpu_context':
(.hyp.text+0x1b80): undefined reference to `__kvm_nvhe_memset'That's odd, I don't see that symbol anywhere in the tree at all.
And the only arm-related kvm changes don't have those symbols either (the other kvm changes are x86-only)
Also, no one else has seen this issue. Can you bisect?
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
This is an old issue,
Many other reported long back [1][1] https://lore.kernel.org/stable/CADYN=9KSKQx816id-zWepV-E3ozph3k2_i9Rhs6QseFv0hkPfg@mail.gmail.com/
Then maybe someone should submit it properly for inclusion?
Attached the backported patch. Also verified that my build failure is fixed with it.
Thanks, now queued up.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.180-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
Regressions on arm64, arm, x86_64 and i386.
We have recently upgraded our selftest sources to stable-rc 6.3 and running on stable rc 6.1, 5.15, 5.10, 5.4, 4.19 and 4.14 kernels.
List of test regressions:
========
kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
kselftest-memfd
- memfd_memfd_test
kselftest-rseq
- rseq_basic_test
kselftest-kvm
- kvm_xapic_state_test
NOTE:
The logs are the same as reported on other email reports.
link,
- https://lore.kernel.org/stable/CA+G9fYu6ZOu_We2GMP0sFnSovOsqd6waW7oKS-Y1VPrjdibu5Q@mail.gmail.com/
## Build
* kernel: 5.10.180-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.10.y
* git commit: 065b6901e6dab7dcc7c8884779b96269724c7201
* git describe: v5.10.179-382-g065b6901e6da
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.179-382-g065b6901e6da
## Test Regressions (compared to v5.10.176-363-g1ef2000b94cb)
* bcm2711-rpi-4-b, kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
* bcm2711-rpi-4-b, kselftest-memfd
- memfd_memfd_test
* bcm2711-rpi-4-b, kselftest-rseq
- rseq_basic_test
* dragonboard-410c, kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
* dragonboard-410c, kselftest-memfd
- memfd_memfd_test
* i386, kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
* i386, kselftest-memfd
- memfd_memfd_test
* i386, kselftest-rseq
- rseq_basic_test
- rseq_run_param_test_sh
* juno-r2, kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
* juno-r2, kselftest-memfd
- memfd_memfd_test
* juno-r2, kselftest-rseq
- rseq_basic_test
* qemu_i386, kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
* qemu_i386, kselftest-memfd
- memfd_memfd_test
* qemu_i386, kselftest-rseq
- rseq_basic_test
- rseq_run_param_test_sh
* qemu_x86_64, kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
* qemu_x86_64, kselftest-memfd
- memfd_memfd_test
* qemu_x86_64, kselftest-rseq
- rseq_basic_test
- rseq_run_param_test_sh
* x15, kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
* x15, kselftest-rseq
- rseq_basic_test
* x86, kselftest-kvm
- kvm_xapic_state_test
* x86, kselftest-membarrier
- membarrier_membarrier_test_multi_thread
- membarrier_membarrier_test_single_thread
* x86, kselftest-memfd
- memfd_memfd_test
* x86, kselftest-rseq
- rseq_basic_test
- rseq_run_param_test_sh
## Metric Regressions (compared to v5.10.176-363-g1ef2000b94cb)
## Test Fixes (compared to v5.10.176-363-g1ef2000b94cb)
## Metric Fixes (compared to v5.10.176-363-g1ef2000b94cb)
## Test result summary
total: 126856, pass: 105919, fail: 3576, skip: 17174, xfail: 187
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 117 total, 116 passed, 1 failed
* arm64: 45 total, 42 passed, 3 failed
* i386: 35 total, 33 passed, 2 failed
* mips: 27 total, 26 passed, 1 failed
* parisc: 8 total, 8 passed, 0 failed
* powerpc: 26 total, 20 passed, 6 failed
* riscv: 12 total, 11 passed, 1 failed
* s390: 12 total, 12 passed, 0 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 8 passed, 0 failed
* x86_64: 38 total, 36 passed, 2 failed
## Test suites summary
* boot
* fwts
* igt-gpu-tools
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
Build results:
total: 162 pass: 162 fail: 0 Qemu test results: total: 485 pass: 485 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.180-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.10:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
75 tests: 75 pass, 0 failLinux version: 5.10.180-rc1-g065b6901e6da
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 20 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.180-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
[...]
Quoted 2 lines
Baokun Li <[email protected]>
writeback, cgroup: fix null-ptr-deref write inbdi_split_work_to_wbs
Sorry for not noticing this sooner, but I think there's a benign issue in this backport.
v5.10.180 commit 2b00b2a0e642 ("writeback, cgroup: fix null-ptr-deref write in bdi_split_work_to_wbs") contains:
+static void cgwb_free_rcu(struct rcu_head *rcu_head) +{
+ struct bdi_writeback *wb = container_of(rcu_head,
+ struct bdi_writeback, rcu);
+
+ percpu_ref_exit(&wb->refcnt);
+ kfree(wb);
+}
[...]
@@ -397,7 +406,7 @@ static void cgwb_release_workfn(struct work_struct *work)
fprop_local_destroy_percpu(&wb->memcg_completions);
percpu_ref_exit(&wb->refcnt);
wb_exit(wb);- kfree_rcu(wb, rcu);
+ call_rcu(&wb->rcu, cgwb_free_rcu);
}
Notice there are now 2 percpu_ref_exit() calls. The upstream, and 5.15.y patches remove the cgwb_release_workfn() calls to percpu_ref_exit(). The 5.10.y fixup is below. It's not essential but might be worth applying to track upstream.
From 416e0e8ab5ff41676d04dc819bd667c6ad3f7555 Mon Sep 17 00:00:00 2001
From: Greg Thelen <[email protected]>
Date: Sat, 20 May 2023 12:46:24 -0700
Subject: [PATCH] writeback, cgroup: remove extra percpu_ref_exit()
5.10 stable commit 2b00b2a0e642 ("writeback, cgroup: fix null-ptr-deref write in bdi_split_work_to_wbs") is a backport of upstream 6.3 commit 1ba1199ec574.
In the 5.10 stable commit backport percpu_ref_exit() is called twice:
first in cgwb_release_workfn() and then in cgwb_free_rcu(). The 2nd call is benign as percpu_ref_exit() internally detects there's nothing to do.
This fixes an non-upstream issue that only applies to 5.10.y.
--- mm/backing-dev.c | 1 - 1 file changed, 1 deletion(-)
mm/backing-dev.c +0 -1
@@ -404,7 +404,6 @@ static void cgwb_release_workfn(struct work_struct *work)blkcg_unpin_online (blkcg);fprop_local_destroy_percpu (&wb->memcg_completions); -percpu_ref_exit (&wb->refcnt);wb_exit (wb);call_rcu (&wb->rcu, cgwb_free_rcu); }
Signature · 1 line
2.40.1.698.g37aff9b760-goog
Greg Kroah-Hartman
maintainerQuoted 53 lines · Greg Thelen
Quoted 20 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.180-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:[...]
Quoted 2 lines
Baokun Li <[email protected]>
writeback, cgroup: fix null-ptr-deref write inbdi_split_work_to_wbsSorry for not noticing this sooner, but I think there's a benign issue in this backport.
v5.10.180 commit
2b00b2a0e642("writeback, cgroup: fix null-ptr-deref write inbdi_split_work_to_wbs") contains:(quoted diff) +9
-1+static void cgwb_free_rcu(struct rcu_head *rcu_head) +{ + struct bdi_writeback *wb = container_of(rcu_head, + struct bdi_writeback, rcu); + + percpu_ref_exit(&wb->refcnt); + kfree(wb); +}@@ -397,7 +406,7 @@ static void cgwb_release_workfn(struct work_struct *work) fprop_local_destroy_percpu(&wb->memcg_completions); percpu_ref_exit(&wb->refcnt); wb_exit(wb); - kfree_rcu(wb, rcu); + call_rcu(&wb->rcu, cgwb_free_rcu); }
Quoted 4 lines
Notice there are now 2
percpu_ref_exit()calls. The upstream, and 5.15.y patches remove thecgwb_release_workfn()calls topercpu_ref_exit(). The 5.10.y fixup is below. It's not essential but might be worth applying to track upstream.
Thanks, I've queued this up now.
greg k-h