5.17.14-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 664/772 dlm: fix missing lkb refcount handling
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
commit 1689c169134f4b5a39156122d799b7dca76d8ddb upstream.
We always call hold_lkb(lkb) if we increment lkb->lkb_wait_count. So, we always need to call unhold_lkb(lkb) if we decrement lkb->lkb_wait_count. This patch will add missing unhold_lkb(lkb) if we decrement lkb->lkb_wait_count. In case of setting lkb->lkb_wait_count to zero we need to countdown until reaching zero and call unhold_lkb(lkb). The waiters list unhold_lkb(lkb) can be removed because it's done for the last lkb_wait_count decrement iteration as it's done in _remove_from_waiters().
This issue was discovered by a dlm gfs2 test case which use excessively dlm_unlock(LKF_CANCEL) feature. Probably the lkb->lkb_wait_count value never reached above 1 if this feature isn't used and so it was not discovered before.
The testcase ended in a rsb on the rsb keep data structure with a refcount of 1 but no lkb was associated with it, which is itself an invalid behaviour. A side effect of that was a condition in which the dlm was sending remove messages in a looping behaviour. With this patch that has not been reproduced.
--- fs/dlm/lock.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/dlm/lock.c +9 -2
@@ -1559,6 +1559,7 @@ static int _remove_from_waiters(struct d lkb->lkb_wait_type =0 ; lkb->lkb_flags &= ~DLM_IFL_OVERLAP_CANCEL ; lkb->lkb_wait_count--; +unhold_lkb (lkb); goto out_del; }
@@ -1585,6 +1586,7 @@ static int _remove_from_waiters(struct dlog_error (ls,"remwait error %x reply %d wait_type %d overlap" , lkb->lkb_id, mstype, lkb->lkb_wait_type); lkb->lkb_wait_count--; +unhold_lkb (lkb); lkb->lkb_wait_type =0 ; }
@@ -5331,11 +5333,16 @@ int dlm_recover_waiters_post(struct dlm_ lkb->lkb_flags &= ~DLM_IFL_OVERLAP_UNLOCK ; lkb->lkb_flags &= ~DLM_IFL_OVERLAP_CANCEL ; lkb->lkb_wait_type =0 ; - lkb->lkb_wait_count =0 ; +/* drop all wait_count references we still +* hold a reference for this iteration. +*/ +while (lkb->lkb_wait_count) { + lkb->lkb_wait_count--; +unhold_lkb (lkb); + }mutex_lock (&ls->ls_waiters_mutex);list_del_init (&lkb->lkb_wait_reply);mutex_unlock (&ls->ls_waiters_mutex); -unhold_lkb (lkb);/* for waiters list */ if (oc || ou) {/* do an unlock or cancel instead of resending */
Greg Kroah-Hartman
maintainerPATCH 610/772 f2fs: fix to do sanity check on block address in f2fs_do_zero_range()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 25f8236213a91efdf708b9d77e9e51b6fc3e141c upstream.
As Yanming reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=215894
I have encountered a bug in F2FS file system in kernel v5.17.
I have uploaded the system call sequence as case.c, and a fuzzed image can be found in google net disk
The kernel should enable CONFIG_KASAN=y and CONFIG_KASAN_INLINE=y. You can reproduce the bug by running the following commands:
kernel BUG at fs/f2fs/segment.c:2291!
Call Trace: f2fs_invalidate_blocks+0x193/0x2d0 f2fs_fallocate+0x2593/0x4a70 vfs_fallocate+0x2a5/0xac0 ksys_fallocate+0x35/0x70 __x64_sys_fallocate+0x8e/0xf0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
The root cause is, after image was fuzzed, block mapping info in inode will be inconsistent with SIT table, so in f2fs_fallocate(), it will cause panic when updating SIT with invalid blkaddr.
Let's fix the issue by adding sanity check on block address before updating SIT table with it.
--- fs/f2fs/file.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
fs/f2fs/file.c +12 -4
@@ -1437,11 +1437,19 @@ static int f2fs_do_zero_range(struct dno ret = -ENOSPC ;break ; } -if (dn->data_blkaddr !=NEW_ADDR ) { -f2fs_invalidate_blocks (sbi, dn->data_blkaddr); - dn->data_blkaddr =NEW_ADDR ; -f2fs_set_data_blkaddr (dn); + +if (dn->data_blkaddr ==NEW_ADDR ) +continue ; + +if (!f2fs_is_valid_blkaddr (sbi, dn->data_blkaddr, +DATA_GENERIC_ENHANCE )) { + ret = -EFSCORRUPTED ; +break ; } + +f2fs_invalidate_blocks (sbi, dn->data_blkaddr); + dn->data_blkaddr =NEW_ADDR ; +f2fs_set_data_blkaddr (dn); }f2fs_update_extent_cache_range (dn, start,0 , index - start);
Greg Kroah-Hartman
maintainerPATCH 720/772 ksmbd: fix outstanding credits related bugs
In reply to Greg Kroah-HartmanFrom: Hyunchul Lee <[email protected]>
commit 376b9133826865568167b4091ef92a68c4622b87 upstream.
outstanding credits must be initialized to 0,
because it means the sum of credits consumed by
in-flight requests.
And outstanding credits must be compared with
total credits in smb2_validate_credit_charge(),
because total credits are the sum of credits
granted by ksmbd.
This patch fix the following error,
while frametest with Windows clients:
Limits exceeding the maximum allowable outstanding requests, given : 128, pending : 8065
--- fs/ksmbd/connection.c | 2 +- fs/ksmbd/smb2misc.c | 2 +- fs/ksmbd/smb_common.c | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-)
fs/ksmbd/connection.c +1 -1
@@ -62,7 +62,7 @@ struct ksmbd_conn *ksmbd_conn_alloc(voidatomic_set (&conn->req_running,0 );atomic_set (&conn->r_count,0 ); conn->total_credits =1 ; - conn->outstanding_credits =1 ; + conn->outstanding_credits =0 ;init_waitqueue_head (&conn->req_running_q);INIT_LIST_HEAD (&conn->conns_list);
fs/ksmbd/smb2misc.c +1 -1
@@ -338,7 +338,7 @@ static int smb2_validate_credit_charge(s ret =1 ; } -if ((u64 )conn->outstanding_credits + credit_charge > conn->vals->max_credits) { +if ((u64 )conn->outstanding_credits + credit_charge > conn->total_credits) {ksmbd_debug (SMB ,"Limits exceeding the maximum allowable outstanding requests, given : %u, pending : %u\n" , credit_charge, conn->outstanding_credits); ret =1 ;
fs/ksmbd/smb_common.c +3 -1
@@ -140,8 +140,10 @@ int ksmbd_verify_smb_message(struct ksmb hdr = work->request_buf;if (*(__le32 *)hdr->Protocol ==SMB1_PROTO_NUMBER && - hdr->Command ==SMB_COM_NEGOTIATE ) + hdr->Command ==SMB_COM_NEGOTIATE ) { + work->conn->outstanding_credits++;return 0 ; + }return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 692/772 drm/nouveau/clk: Fix an incorrect NULL check on list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit 1c3b2a27def609473ed13b1cd668cb10deab49b4 upstream.
The bug is here:
if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp)) return cstate;
The list iterator value 'cstate' will *always* be set and non-NULL by list_for_each_entry_from_reverse(), so it is incorrect to assume that the iterator value will be unchanged if the list is empty or no element is found (In fact, it will be a bogus pointer to an invalid structure object containing the HEAD). Also it missed a NULL check at callsite and may lead to invalid memory access after that.
To fix this bug, just return 'encoder' when found, otherwise return NULL. And add the NULL check.
--- drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +4 -2
@@ -135,10 +135,10 @@ nvkm_cstate_find_best(struct nvkm_clk *clist_for_each_entry_from_reverse (cstate, &pstate->list, head) {if (nvkm_cstate_valid (clk, cstate, max_volt, clk->temp)) -break ; +return cstate; } -return cstate; +return NULL ; } static struct nvkm_cstate *
@@ -169,6 +169,8 @@ nvkm_cstate_prog(struct nvkm_clk *clk, sif (!list_empty (&pstate->list)) { cstate =nvkm_cstate_get (clk, pstate, cstatei); cstate =nvkm_cstate_find_best (clk, pstate, cstate); +if (!cstate) +return -EINVAL ; }else { cstate = &pstate->base; }
Greg Kroah-Hartman
maintainerPATCH 728/772 xtensa/simdisk: fix proc_read_simdisk()
In reply to Greg Kroah-HartmanFrom: Yi Yang <[email protected]>
commit b011946d039d66bbc7102137e98cc67e1356aa87 upstream.
The commit a69755b18774 ("xtensa simdisk: switch to proc_create_data()") split read operation into two parts, first retrieving the path when it's non-null and second retrieving the trailing '\n'. However when the path is non-null the first simple_read_from_buffer updates ppos, and the second simple_read_from_buffer returns 0 if ppos is greater than 1 (i.e. almost always). As a result reading from that proc file is almost always empty.
Fix it by making a temporary copy of the path with the trailing '\n' and using simple_read_from_buffer on that copy.
--- arch/xtensa/platforms/iss/simdisk.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
arch/xtensa/platforms/iss/simdisk.c +12 -6
@@ -211,12 +211,18 @@ static ssize_t proc_read_simdisk(structstruct simdisk *dev =pde_data (file_inode (file));const char *s = dev->filename;if (s) { -ssize_t n =simple_read_from_buffer (buf, size, ppos, - s,strlen (s)); -if (n <0 ) -return n; - buf += n; - size -= n; +ssize_t len =strlen (s); +char *temp =kmalloc (len +2 ,GFP_KERNEL ); + +if (!temp) +return -ENOMEM ; + + len =scnprintf (temp, len +2 ,"%s\n" , s); + len =simple_read_from_buffer (buf, size, ppos, + temp, len); + +kfree (temp); +return len; }return simple_read_from_buffer (buf, size, ppos,"\n" ,1 ); }
Greg Kroah-Hartman
maintainerPATCH 717/772 um: Fix out-of-bounds read in LDT setup
In reply to Greg Kroah-HartmanFrom: Vincent Whitchurch <[email protected]>
commit 2a4a62a14be1947fa945c5c11ebf67326381a568 upstream.
syscall_stub_data() expects the data_count parameter to be the number of longs, not bytes.
==================================================================
BUG: KASAN: stack-out-of-bounds in syscall_stub_data+0x70/0xe0 Read of size 128 at addr 000000006411f6f0 by task swapper/1 CPU: 0 PID: 1 Comm: swapper Not tainted 5.18.0+ #18 Call Trace: show_stack.cold+0x166/0x2a7 __dump_stack+0x3a/0x43 dump_stack_lvl+0x1f/0x27 print_report.cold+0xdb/0xf81 kasan_report+0x119/0x1f0 kasan_check_range+0x3a3/0x440 memcpy+0x52/0x140 syscall_stub_data+0x70/0xe0 write_ldt_entry+0xac/0x190 init_new_ldt+0x515/0x960 init_new_context+0x2c4/0x4d0 mm_init.constprop.0+0x5ed/0x760 mm_alloc+0x118/0x170 0x60033f48 do_one_initcall+0x1d7/0x860 0x60003e7b kernel_init+0x6e/0x3d4 new_thread_handler+0x1e7/0x2c0 The buggy address belongs to stack of task swapper/1 and is located at offset 64 in frame: init_new_ldt+0x0/0x960
This frame has 2 objects:
[32, 40) 'addr'
[64, 80) 'desc'
==================================================================
--- arch/x86/um/ldt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/um/ldt.c +4 -2
@@ -23,9 +23,11 @@ static long write_ldt_entry(struct mm_id {long res;void *stub_addr; + +BUILD_BUG_ON (sizeof (*desc) %sizeof (long )); + res =syscall_stub_data (mm_idp, (unsigned long *)desc, - (sizeof (*desc) +sizeof (long ) -1 ) & - ~(sizeof (long ) -1 ), +sizeof (*desc) /sizeof (long ), addr, &stub_addr);if (!res) { unsigned long args[] = { func,
Greg Kroah-Hartman
maintainerPATCH 715/772 um: Use asm-generic/dma-mapping.h
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 365719035526e8eda214a1cedb2e1c96e969a0d7 upstream.
If DMA (PCI over virtio) is enabled, then some drivers may enable CONFIG_DMA_OPS as well, and then we pull in the x86 definition of get_arch_dma_ops(), which uses the dma_ops symbol, which isn't defined.
Since we don't have real DMA ops nor any kind of IOMMU fix this in the simplest possible way: pull in the asm-generic file instead of inheriting the x86 one. It's not clear why those drivers that do (e.g. VDPA) "select DMA_OPS", and if they'd even work with this, but chances are nobody will be wanting to do that anyway, so fixing the build failure is good enough.
--- arch/um/include/asm/Kbuild | 1 + 1 file changed, 1 insertion(+)
arch/um/include/asm/Kbuild +1 -0
@@ -4,6 +4,7 @@ generic-y += bug.h generic-y += compat.h generic-y += current.h generic-y += device.h +generic-y += dma-mapping.h generic-y += emergency-restart.h generic-y += exec.h generic-y += extable.h
Greg Kroah-Hartman
maintainerPATCH 713/772 mac80211: upgrade passive scan to active scan on DFS channels after beacon rx
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
commit b041b7b9de6e1d4362de855ab90f9d03ef323edd upstream.
In client mode, we can't connect to hidden SSID APs or SSIDs not advertised in beacons on DFS channels, since we're forced to passive scan. Fix this by sending out a probe request immediately after the first beacon, if active scan was requested by the user.
--- net/mac80211/ieee80211_i.h | 5 +++++ net/mac80211/scan.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+)
net/mac80211/ieee80211_i.h +5 -0
@@ -1128,6 +1128,9 @@ struct tpt_led_trigger {* a scan complete for an aborted scan. * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being * cancelled. +* @SCAN_BEACON_WAIT: Set whenever we're passive scanning because of radar/no-IR +* and could send a probe request after receiving a beacon. +* @SCAN_BEACON_DONE: Beacon received, we can now send a probe request */ enum {SCAN_SW_SCANNING ,
@@ -1136,6 +1139,8 @@ enum {SCAN_COMPLETED ,SCAN_ABORTED ,SCAN_HW_CANCELLED , +SCAN_BEACON_WAIT , + SCAN_BEACON_DONE, };/**
net/mac80211/scan.c +20 -0
@@ -281,6 +281,16 @@ void ieee80211_scan_rx(struct ieee80211_if (likely (!sdata1 && !sdata2))return ; +if (test_and_clear_bit (SCAN_BEACON_WAIT , &local->scanning)) { +/* +* we were passive scanning because of radar/no-IR, but +* the beacon/proberesp rx gives us an opportunity to upgrade +* to active scan +*/ +set_bit (SCAN_BEACON_DONE , &local->scanning); +ieee80211_queue_delayed_work (&local->hw, &local->scan_work,0 ); + } +if (ieee80211_is_probe_resp (mgmt->frame_control)) {struct cfg80211_scan_request *scan_req;struct cfg80211_sched_scan_request *sched_scan_req;
@@ -787,6 +797,8 @@ static int __ieee80211_start_scan(struct IEEE80211_CHAN_RADAR)) || !req->n_ssids) { next_delay = IEEE80211_PASSIVE_CHANNEL_TIME; + if (req->n_ssids) + set_bit(SCAN_BEACON_WAIT, &local->scanning); } else {ieee80211_scan_state_send_probe (local, &next_delay); next_delay =IEEE80211_CHANNEL_TIME ;
@@ -998,6 +1010,8 @@ set_channel: !scan_req->n_ssids) { *next_delay =IEEE80211_PASSIVE_CHANNEL_TIME ; local->next_scan_state =SCAN_DECISION ; +if (scan_req->n_ssids) +set_bit (SCAN_BEACON_WAIT , &local->scanning);return ; }
@@ -1090,6 +1104,8 @@ void ieee80211_scan_work(struct work_str goto out; } +clear_bit (SCAN_BEACON_WAIT , &local->scanning); +/* * as long as no delay is required advance immediately * without scheduling a new work
@@ -1100,6 +1116,10 @@ void ieee80211_scan_work(struct work_str goto out_complete; } +if (test_and_clear_bit (SCAN_BEACON_DONE , &local->scanning) && + local->next_scan_state ==SCAN_DECISION ) + local->next_scan_state =SCAN_SEND_PROBE ; +switch (local->next_scan_state) {case SCAN_DECISION :/* if no more bands/channels left, complete scan */
Greg Kroah-Hartman
maintainerPATCH 729/772 rtl818x: Prevent using not initialized queues
In reply to Greg Kroah-HartmanFrom: Alexander Wetzel <[email protected]>
commit 746285cf81dc19502ab238249d75f5990bd2d231 upstream.
Using not existing queues can panic the kernel with rtl8180/rtl8185 cards. Ignore the skb priority for those cards, they only have one tx queue. Pierre Asselin ([email protected]) reported the kernel crash in the Gentoo forum:
https://forums.gentoo.org/viewtopic-t-1147832-postdays-0-postorder-asc-start-25.html
He also confirmed that this patch fixes the issue. In summary this happened:
After updating wpa_supplicant from 2.9 to 2.10 the kernel crashed with a "divide error: 0000" when connecting to an AP. Control port tx now tries to use IEEE80211_AC_VO for the priority, which wpa_supplicants starts to use in 2.10.
Since only the rtl8187se part of the driver supports QoS, the priority of the skb is set to IEEE80211_AC_BE (2) by mac80211 for rtl8180/rtl8185 cards.
rtl8180 is then unconditionally reading out the priority and finally crashes on drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c line 544 without this patch:
idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries
"ring->entries" is zero for rtl8180/rtl8185 cards, tx_ring[2] never got initialized.
--- drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c +6 -2
@@ -460,8 +460,10 @@ static void rtl8180_tx(struct ieee80211_struct rtl8180_priv *priv = dev->priv;struct rtl8180_tx_ring *ring;struct rtl8180_tx_desc *entry; +unsigned int prio =0 ;unsigned long flags; -unsigned int idx, prio, hw_prio; +unsigned int idx, hw_prio; +dma_addr_t mapping;u32 tx_flags;u8 rc_flags;
@@ -470,7 +472,9 @@ static void rtl8180_tx(struct ieee80211_/* do arithmetic and then convert to le16 */ u16 frame_duration =0 ; - prio =skb_get_queue_mapping (skb); +/* rtl8180/rtl8185 only has one useable tx queue */ +if (dev->queues >IEEE80211_AC_BK ) + prio =skb_get_queue_mapping (skb); ring = &priv->tx_ring[prio]; mapping = dma_map_single(&priv->pdev->dev, skb->data, skb->len,
Greg Kroah-Hartman
maintainerPATCH 730/772 ASoC: rt5514: Fix event generation for "DSP Voice Wake Up" control
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
commit 4213ff556740bb45e2d9ff0f50d056c4e7dd0921 upstream.
The driver has a custom put function for "DSP Voice Wake Up" which does not generate event notifications on change, instead returning 0. Since we already exit early in the case that there is no change this can be fixed by unconditionally returning 1 at the end of the function.
--- sound/soc/codecs/rt5514.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt5514.c +1 -1
@@ -419,7 +419,7 @@ static int rt5514_dsp_voice_wake_up_put( } } -return 0 ; +return 1 ; }static const struct snd_kcontrol_new rt5514_snd_controls[] = {
Greg Kroah-Hartman
maintainerPATCH 711/772 mt76: fix use-after-free by removing a non-RCU wcid pointer
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
commit 51fb1278aa57ae0fc54adaa786e1965362bed4fb upstream.
Fixes an issue caught by KASAN about use-after-free in mt76_txq_schedule by protecting mtxq->wcid with rcu_lock between mt76_txq_schedule and sta_info_[alloc, free].
[18853.876689] ================================================================== [18853.876751] BUG: KASAN: use-after-free in mt76_txq_schedule+0x204/0xaf8 [mt76] [18853.876773] Read of size 8 at addr ffffffaf989a2138 by task mt76-tx phy0/883 [18853.876786] [18853.876810] CPU: 5 PID: 883 Comm: mt76-tx phy0 Not tainted 5.10.100-fix-510-56778d365941-kasan #5 0b01fbbcf41a530f52043508fec2e31a4215
[18853.876840] Call trace: [18853.876861] dump_backtrace+0x0/0x3ec [18853.876878] show_stack+0x20/0x2c [18853.876899] dump_stack+0x11c/0x1ac [18853.876918] print_address_description+0x74/0x514 [18853.876934] kasan_report+0x134/0x174 [18853.876948] __asan_report_load8_noabort+0x44/0x50 [18853.876976] mt76_txq_schedule+0x204/0xaf8 [mt76 074e03e4640e97fe7405ee1fab547b81c4fa45d2] [18853.877002] mt76_txq_schedule_all+0x2c/0x48 [mt76 074e03e4640e97fe7405ee1fab547b81c4fa45d2] [18853.877030] mt7921_tx_worker+0xa0/0x1cc [mt7921_common f0875ebac9d7b4754e1010549e7db50fbd90a047] [18853.877054] __mt76_worker_fn+0x190/0x22c [mt76 074e03e4640e97fe7405ee1fab547b81c4fa45d2] [18853.877071] kthread+0x2f8/0x3b8 [18853.877087] ret_from_fork+0x10/0x30 [18853.877098] [18853.877112] Allocated by task 941: [18853.877131] kasan_save_stack+0x38/0x68 [18853.877147] __kasan_kmalloc+0xd4/0xfc [18853.877163] kasan_kmalloc+0x10/0x1c [18853.877177] __kmalloc+0x264/0x3c4 [18853.877294] sta_info_alloc+0x460/0xf88 [mac80211] [18853.877410] ieee80211_prep_connection+0x204/0x1ee0 [mac80211] [18853.877523] ieee80211_mgd_auth+0x6c4/0xa4c [mac80211] [18853.877635] ieee80211_auth+0x20/0x2c [mac80211] [18853.877733] rdev_auth+0x7c/0x438 [cfg80211] [18853.877826] cfg80211_mlme_auth+0x26c/0x390 [cfg80211] [18853.877919] nl80211_authenticate+0x6d4/0x904 [cfg80211] [18853.877938] genl_rcv_msg+0x748/0x93c [18853.877954] netlink_rcv_skb+0x160/0x2a8 [18853.877969] genl_rcv+0x3c/0x54 [18853.877985] netlink_unicast_kernel+0x104/0x1ec [18853.877999] netlink_unicast+0x178/0x268 [18853.878015] netlink_sendmsg+0x3cc/0x5f0 [18853.878030] sock_sendmsg+0xb4/0xd8 [18853.878043] ____sys_sendmsg+0x2f8/0x53c [18853.878058] ___sys_sendmsg+0xe8/0x150 [18853.878071] __sys_sendmsg+0xc4/0x1f4 [18853.878087] __arm64_compat_sys_sendmsg+0x88/0x9c [18853.878101] el0_svc_common+0x1b4/0x390 [18853.878115] do_el0_svc_compat+0x8c/0xdc [18853.878131] el0_svc_compat+0x10/0x1c [18853.878146] el0_sync_compat_handler+0xa8/0xcc [18853.878161] el0_sync_compat+0x188/0x1c0 [18853.878171] [18853.878183] Freed by task 10927: [18853.878200] kasan_save_stack+0x38/0x68 [18853.878215] kasan_set_track+0x28/0x3c [18853.878228] kasan_set_free_info+0x24/0x48 [18853.878244] __kasan_slab_free+0x11c/0x154 [18853.878259] kasan_slab_free+0x14/0x24 [18853.878273] slab_free_freelist_hook+0xac/0x1b0 [18853.878287] kfree+0x104/0x390 [18853.878402] sta_info_free+0x198/0x210 [mac80211] [18853.878515] __sta_info_destroy_part2+0x230/0x2d4 [mac80211] [18853.878628] __sta_info_flush+0x300/0x37c [mac80211] [18853.878740] ieee80211_set_disassoc+0x2cc/0xa7c [mac80211] [18853.878851] ieee80211_mgd_deauth+0x4a4/0x10a0 [mac80211] [18853.878962] ieee80211_deauth+0x20/0x2c [mac80211] [18853.879057] rdev_deauth+0x7c/0x438 [cfg80211] [18853.879150] cfg80211_mlme_deauth+0x274/0x414 [cfg80211] [18853.879243] cfg80211_mlme_down+0xe4/0x118 [cfg80211] [18853.879335] cfg80211_disconnect+0x218/0x2d8 [cfg80211] [18853.879427] __cfg80211_leave+0x17c/0x240 [cfg80211] [18853.879519] cfg80211_leave+0x3c/0x58 [cfg80211] [18853.879611] wiphy_suspend+0xdc/0x200 [cfg80211] [18853.879628] dpm_run_callback+0x58/0x408 [18853.879642] __device_suspend+0x4cc/0x864 [18853.879658] async_suspend+0x34/0xf4 [18853.879673] async_run_entry_fn+0xe0/0x37c [18853.879689] process_one_work+0x508/0xb98 [18853.879702] worker_thread+0x7f4/0xcd4 [18853.879717] kthread+0x2f8/0x3b8 [18853.879731] ret_from_fork+0x10/0x30 [18853.879741] [18853.879757] The buggy address belongs to the object at ffffffaf989a2000 [18853.879757] which belongs to the cache kmalloc-8k of size 8192 [18853.879774] The buggy address is located 312 bytes inside of [18853.879774] 8192-byte region [ffffffaf989a2000, ffffffaf989a4000) [18853.879787] The buggy address belongs to the page: [18853.879807] page:000000004bda2a59 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1d89a0 [18853.879823] head:000000004bda2a59 order:3 compound_mapcount:0 compound_pincount:0 [18853.879839] flags: 0x8000000000010200(slab|head) [18853.879857] raw: 8000000000010200 ffffffffbc89e208 ffffffffb7fb5208 ffffffaec000cc80 [18853.879873] raw: 0000000000000000 0000000000010001 00000001ffffffff 0000000000000000 [18853.879885] page dumped because: kasan: bad access detected [18853.879896] [18853.879907] Memory state around the buggy address: [18853.879922] ffffffaf989a2000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [18853.879935] ffffffaf989a2080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [18853.879948] >ffffffaf989a2100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [18853.879961] ^ [18853.879973] ffffffaf989a2180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [18853.879986] ffffffaf989a2200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [18853.879998] ==================================================================
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76.h | 2 +- drivers/net/wireless/mediatek/mt76/mt7603/main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 2 +- drivers/net/wireless/mediatek/mt76/tx.c | 9 ++++----- 8 files changed, 13 insertions(+), 12 deletions(-)
drivers/net/wireless/mediatek/mt76/mac80211.c +1 -1
@@ -1266,7 +1266,7 @@ mt76_sta_add(struct mt76_dev *dev, struccontinue ; mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv; - mtxq->wcid = wcid; + mtxq->wcid = wcid->idx; }ewma_signal_init (&wcid->rssi);
drivers/net/wireless/mediatek/mt76/mt76.h +1 -1
@@ -267,7 +267,7 @@ struct mt76_wcid { };struct mt76_txq { -struct mt76_wcid *wcid; +u16 wcid;u16 agg_ssn;bool send_bar;
drivers/net/wireless/mediatek/mt76/mt7603/main.c +1 -1
@@ -75,7 +75,7 @@ mt7603_add_interface(struct ieee80211_hwmt7603_wtbl_init (dev, idx, mvif->idx, bc_addr); mtxq = (struct mt76_txq *)vif->txq->drv_priv; - mtxq->wcid = &mvif->sta.wcid; + mtxq->wcid = idx;rcu_assign_pointer (dev->mt76.wcid[idx], &mvif->sta.wcid); out:
drivers/net/wireless/mediatek/mt76/mt7615/main.c +1 -1
@@ -234,7 +234,7 @@ static int mt7615_add_interface(struct ircu_assign_pointer (dev->mt76.wcid[idx], &mvif->sta.wcid);if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; - mtxq->wcid = &mvif->sta.wcid; + mtxq->wcid = idx; } ret =mt7615_mcu_add_dev_info (phy, vif, true);
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +3 -1
@@ -292,7 +292,8 @@ mt76x02_vif_init(struct mt76x02_dev *devmt76_packet_id_init (&mvif->group_wcid); mtxq = (struct mt76_txq *)vif->txq->drv_priv; - mtxq->wcid = &mvif->group_wcid; +rcu_assign_pointer (dev->mt76.wcid[MT_VIF_WCID (idx)], &mvif->group_wcid); + mtxq->wcid =MT_VIF_WCID (idx); }int
@@ -345,6 +346,7 @@ void mt76x02_remove_interface(struct ieestruct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; dev->mt76.vif_mask &= ~BIT (mvif->idx); +rcu_assign_pointer (dev->mt76.wcid[mvif->group_wcid.idx],NULL );mt76_packet_id_flush (&dev->mt76, &mvif->group_wcid); }EXPORT_SYMBOL_GPL (mt76x02_remove_interface);
drivers/net/wireless/mediatek/mt76/mt7915/main.c +1 -1
@@ -245,7 +245,7 @@ static int mt7915_add_interface(struct ircu_assign_pointer (dev->mt76.wcid[idx], &mvif->sta.wcid);if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; - mtxq->wcid = &mvif->sta.wcid; + mtxq->wcid = idx; } if (vif->type != NL80211_IFTYPE_AP &&
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -1
@@ -329,7 +329,7 @@ static int mt7921_add_interface(struct ircu_assign_pointer (dev->mt76.wcid[idx], &mvif->sta.wcid);if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; - mtxq->wcid = &mvif->sta.wcid; + mtxq->wcid = idx; } out:
drivers/net/wireless/mediatek/mt76/tx.c +4 -5
@@ -436,12 +436,11 @@ mt76_txq_stopped(struct mt76_queue *q)static int mt76_txq_send_burst (struct mt76_phy *phy,struct mt76_queue *q, -struct mt76_txq *mtxq) +struct mt76_txq *mtxq,struct mt76_wcid *wcid) {struct mt76_dev *dev = phy->dev;struct ieee80211_txq *txq =mtxq_to_txq (mtxq);enum mt76_txq_id qid =mt76_txq_get_qid (txq); -struct mt76_wcid *wcid = mtxq->wcid;struct ieee80211_tx_info *info;struct sk_buff *skb;int n_frames =1 ;
@@ -521,8 +520,8 @@ mt76_txq_schedule_list(struct mt76_phy *break ; mtxq = (struct mt76_txq *)txq->drv_priv; - wcid = mtxq->wcid; -if (wcid &&test_bit (MT_WCID_FLAG_PS , &wcid->flags)) + wcid =rcu_dereference (dev->wcid[mtxq->wcid]); +if (!wcid ||test_bit (MT_WCID_FLAG_PS , &wcid->flags))continue ;spin_lock_bh (&q->lock);
@@ -541,7 +540,7 @@ mt76_txq_schedule_list(struct mt76_phy * }if (!mt76_txq_stopped (q)) - n_frames =mt76_txq_send_burst (phy, q, mtxq); + n_frames =mt76_txq_send_burst (phy, q, mtxq, wcid);spin_unlock_bh (&q->lock);
Greg Kroah-Hartman
maintainerPATCH 709/772 irqchip: irq-xtensa-mx: fix initial IRQ affinity
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
commit a255ee29252066d621df5d6b420bf534c6ba5bc0 upstream.
When irq-xtensa-mx chip is used in non-SMP configuration its irq_set_affinity callback is not called leaving IRQ affinity set empty. As a result IRQ delivery does not work in that configuration. Initialize IRQ affinity of the xtensa MX interrupt distributor to CPU 0 for all external IRQ lines.
--- drivers/irqchip/irq-xtensa-mx.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/irqchip/irq-xtensa-mx.c +14 -4
@@ -151,14 +151,25 @@ static struct irq_chip xtensa_mx_irq_chi .irq_set_affinity = xtensa_mx_irq_set_affinity, }; +static void __init xtensa_mx_init_common (struct irq_domain *root_domain) +{ +unsigned int i; + +irq_set_default_host (root_domain); +secondary_init_irq (); + +/* Initialize default IRQ routing to CPU 0 */ +for (i =0 ; i <XCHAL_NUM_EXTINTERRUPTS ; ++i) +set_er (1 ,MIROUT (i)); +} +int __init xtensa_mx_init_legacy (struct device_node *interrupt_parent) {struct irq_domain *root_domain =irq_domain_add_legacy (NULL ,NR_IRQS -1 ,1 ,0 , &xtensa_mx_irq_domain_ops, &xtensa_mx_irq_chip); -irq_set_default_host (root_domain); -secondary_init_irq (); +xtensa_mx_init_common (root_domain);return 0 ; }
@@ -168,8 +179,7 @@ static int __init xtensa_mx_init(structstruct irq_domain *root_domain =irq_domain_add_linear (np,NR_IRQS , &xtensa_mx_irq_domain_ops, &xtensa_mx_irq_chip); -irq_set_default_host (root_domain); -secondary_init_irq (); +xtensa_mx_init_common (root_domain);return 0 ; }IRQCHIP_DECLARE (xtensa_mx_irq_chip,"cdns,xtensa-mx" , xtensa_mx_init);
Greg Kroah-Hartman
maintainerPATCH 708/772 irqchip/armada-370-xp: Do not touch Performance Counter Overflow on A375, A38x, A39x
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit a3d66a76348daf559873f19afc912a2a7c2ccdaf upstream.
Register ARMADA_370_XP_INT_FABRIC_MASK_OFFS is Armada 370 and XP specific and on new Armada platforms it has different meaning. It does not configure Performance Counter Overflow interrupt masking. So do not touch this register on non-A370/XP platforms (A375, A38x and A39x).
--- drivers/irqchip/irq-armada-370-xp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/irqchip/irq-armada-370-xp.c +10 -1
@@ -308,7 +308,16 @@ static inline int armada_370_xp_msi_initstatic void armada_xp_mpic_perf_init (void ) { -unsigned long cpuid =cpu_logical_map (smp_processor_id ()); +unsigned long cpuid; + +/* +* This Performance Counter Overflow interrupt is specific for +* Armada 370 and XP. It is not available on Armada 375, 38x and 39x. +*/ +if (!of_machine_is_compatible ("marvell,armada-370-xp" )) +return ; + + cpuid =cpu_logical_map (smp_processor_id ());/* Enable Performance Counter Overflow interrupts */ writel(ARMADA_370_XP_INT_CAUSE_PERF(cpuid),
Greg Kroah-Hartman
maintainerPATCH 706/772 mmc: core: Allows to override the timeout value for ioctl() path
In reply to Greg Kroah-HartmanFrom: Bean Huo <[email protected]>
commit 23e09be254f95a5b75cd87f91a4014f3b46dda3f upstream.
Occasionally, user-land applications initiate longer timeout values for certain commands through ioctl() system call. But so far we are still using a fixed timeout of 10 seconds in mmc_poll_for_busy() on the ioctl() path, even if a custom timeout is specified in the userspace application. This patch allows custom timeout values to override this default timeout values on the ioctl path.
--- drivers/mmc/core/block.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/core/block.c +4 -4
@@ -609,11 +609,11 @@ static int __mmc_blk_ioctl_cmd(struct mmif (idata->rpmb || (cmd.flags &MMC_RSP_R1B ) ==MMC_RSP_R1B ) {/* -* Ensure RPMB/R1B command has completed by polling CMD13 -* "Send Status". +* Ensure RPMB/R1B command has completed by polling CMD13 "Send Status". Here we +* allow to override the default timeout value if a custom timeout is specified. */ - err =mmc_poll_for_busy (card,MMC_BLK_TIMEOUT_MS , false, -MMC_BUSY_IO ); + err =mmc_poll_for_busy (card, idata->ic.cmd_timeout_ms ? :MMC_BLK_TIMEOUT_MS , + false,MMC_BUSY_IO ); }return err;
Greg Kroah-Hartman
maintainerPATCH 690/772 drm/nouveau/subdev/bus: Ratelimit logging for fault errors
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit 9887bda0c831df0c044d6de147d002e48024fb4a upstream.
There's plenty of ways to fudge the GPU when developing on nouveau by mistake, some of which can result in nouveau seriously spamming dmesg with fault errors. This can be somewhat annoying, as it can quickly overrun the message buffer (or your terminal emulator's buffer) and get rid of actually useful feedback from the driver. While working on my new atomic only MST branch, I ran into this issue a couple of times.
So, let's fix this by adding nvkm_error_ratelimited(), and using it to ratelimit errors from faults. This should be fine for developers, since it's nearly always only the first few faults that we care about seeing. Plus, you can turn off rate limiting in the kernel if you really need to.
--- drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | 2 ++ drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c | 14 +++++++------- drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv31.c | 6 +++--- drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv50.c | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h +2 -0
@@ -62,4 +62,6 @@ void nvkm_subdev_intr(struct nvkm_subdev #define nvkm_debug(s,f,a...) nvkm_printk((s), DEBUG, info, f, ##a) #define nvkm_trace(s,f,a...) nvkm_printk((s), TRACE, info, f, ##a) #define nvkm_spam(s,f,a...) nvkm_printk((s), SPAM, dbg, f, ##a) + +#define nvkm_error_ratelimited(s,f,a...) nvkm_printk((s), ERROR, err_ratelimited, f, ##a)#endif
drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c +7 -7
@@ -35,13 +35,13 @@ gf100_bus_intr(struct nvkm_bus *bus)u32 addr =nvkm_rd32 (device,0x009084 );u32 data =nvkm_rd32 (device,0x009088 ); -nvkm_error (subdev, -"MMIO %s of %08x FAULT at %06x [ %s%s%s]\n" , - (addr &0x00000002 ) ?"write" :"read" , data, - (addr &0x00fffffc ), - (stat &0x00000002 ) ?"!ENGINE " :"" , - (stat &0x00000004 ) ?"PRIVRING " :"" , - (stat &0x00000008 ) ?"TIMEOUT " :"" ); +nvkm_error_ratelimited (subdev, +"MMIO %s of %08x FAULT at %06x [ %s%s%s]\n" , + (addr &0x00000002 ) ?"write" :"read" , data, + (addr &0x00fffffc ), + (stat &0x00000002 ) ?"!ENGINE " :"" , + (stat &0x00000004 ) ?"PRIVRING " :"" , + (stat &0x00000008 ) ?"TIMEOUT " :"" );nvkm_wr32 (device,0x009084 ,0x00000000 );nvkm_wr32 (device,0x001100 , (stat &0x0000000e ));
drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv31.c +3 -3
@@ -45,9 +45,9 @@ nv31_bus_intr(struct nvkm_bus *bus)u32 addr =nvkm_rd32 (device,0x009084 );u32 data =nvkm_rd32 (device,0x009088 ); -nvkm_error (subdev,"MMIO %s of %08x FAULT at %06x\n" , - (addr &0x00000002 ) ?"write" :"read" , data, - (addr &0x00fffffc )); +nvkm_error_ratelimited (subdev,"MMIO %s of %08x FAULT at %06x\n" , + (addr &0x00000002 ) ?"write" :"read" , data, + (addr &0x00fffffc )); stat &= ~0x00000008 ;nvkm_wr32 (device,0x001100 ,0x00000008 );
drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv50.c +3 -3
@@ -60,9 +60,9 @@ nv50_bus_intr(struct nvkm_bus *bus)u32 addr =nvkm_rd32 (device,0x009084 );u32 data =nvkm_rd32 (device,0x009088 ); -nvkm_error (subdev,"MMIO %s of %08x FAULT at %06x\n" , - (addr &0x00000002 ) ?"write" :"read" , data, - (addr &0x00fffffc )); +nvkm_error_ratelimited (subdev,"MMIO %s of %08x FAULT at %06x\n" , + (addr &0x00000002 ) ?"write" :"read" , data, + (addr &0x00fffffc )); stat &= ~0x00000008 ;nvkm_wr32 (device,0x001100 ,0x00000008 );
Greg Kroah-Hartman
maintainerPATCH 699/772 mtd: cfi_cmdset_0002: Use chip_ready() for write on S29GL064N
In reply to Greg Kroah-HartmanFrom: Tokunori Ikegami <[email protected]>
commit 0a8e98305f63deaf0a799d5cf5532cc83af035d1 upstream.
Since commit dfeae1073583("mtd: cfi_cmdset_0002: Change write buffer to check correct value") buffered writes fail on S29GL064N. This is because, on S29GL064N, reads return 0xFF at the end of DQ polling for write completion, where as, chip_good() check expects actual data written to the last location to be returned post DQ polling completion. Fix is to revert to using chip_good() for S29GL064N which only checks for DQ lines to settle down to determine write completion.
--- drivers/mtd/chips/cfi_cmdset_0002.c | 42 +++++++++++++++++++++++++++++------- include/linux/mtd/cfi.h | 1 2 files changed, 35 insertions(+), 8 deletions(-)
drivers/mtd/chips/cfi_cmdset_0002.c +34 -8
@@ -59,6 +59,10 @@#define CFI_SR_WBASB BIT(3)#define CFI_SR_SLSB BIT(1) +enum cfi_quirks { +CFI_QUIRK_DQ_TRUE_DATA =BIT (0 ), +}; +static int cfi_amdstd_read (struct mtd_info *,loff_t ,size_t ,size_t *,u_char *);static int cfi_amdstd_write_words (struct mtd_info *,loff_t ,size_t ,size_t *,const u_char *);#if !FORCE_WORD_WRITE
@@ -436,6 +440,15 @@ static void fixup_s29ns512p_sectors(stru mtd->name); } +static void fixup_quirks (struct mtd_info *mtd) +{ +struct map_info *map = mtd->priv; +struct cfi_private *cfi = map->fldrv_priv; + +if (cfi->mfr ==CFI_MFR_AMD && cfi->id ==0x0c01 ) + cfi->quirks |=CFI_QUIRK_DQ_TRUE_DATA ; +} +/* Used to fix CFI-Tables of chips without Extended Query Tables */ static struct cfi_fixup cfi_nopri_fixup_table[] = { {CFI_MFR_SST ,0x234a , fixup_sst39vf },/* SST39VF1602 */
@@ -474,6 +487,7 @@ static struct cfi_fixup cfi_fixup_table[ #if !FORCE_WORD_WRITE { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers }, #endif + { CFI_MFR_ANY, CFI_ID_ANY, fixup_quirks }, { 0, 0, NULL } }; static struct cfi_fixup jedec_fixup_table[] = {
@@ -846,6 +860,18 @@ static int __xipram chip_ready(struct mareturn map_word_equal (map, t, *expected); } +static int __xipram chip_good(struct map_info *map, struct flchip *chip, +unsigned long addr,map_word *expected) +{ +struct cfi_private *cfi = map->fldrv_priv; +map_word *datum = expected; + +if (cfi->quirks &CFI_QUIRK_DQ_TRUE_DATA ) + datum =NULL ; + +return chip_ready (map, chip, addr, datum); +} +static int get_chip (struct map_info *map,struct flchip *chip,unsigned long adr,int mode) {DECLARE_WAITQUEUE (wait, current);
@@ -1662,11 +1688,11 @@ static int __xipram do_write_oneword_onc }/* -* We check "time_after" and "!chip_ready" before checking -* "chip_ready" to avoid the failure due to scheduling. +* We check "time_after" and "!chip_good" before checking +* "chip_good" to avoid the failure due to scheduling. */ if (time_after (jiffies, timeo) && - !chip_ready (map, chip, adr, &datum)) { + !chip_good (map, chip, adr, &datum)) {xip_enable (map, chip, adr);printk (KERN_WARNING "MTD %s(): software timeout\n" , __func__);xip_disable (map, chip, adr);
@@ -1674,7 +1700,7 @@ static int __xipram do_write_oneword_oncbreak ; } -if (chip_ready (map, chip, adr, &datum)) { +if (chip_good (map, chip, adr, &datum)) {if (cfi_check_err_status (map, chip, adr)) ret = -EIO ;break ;
@@ -1942,18 +1968,18 @@ static int __xipram do_write_buffer_wait }/* -* We check "time_after" and "!chip_ready" before checking -* "chip_ready" to avoid the failure due to scheduling. +* We check "time_after" and "!chip_good" before checking +* "chip_good" to avoid the failure due to scheduling. */ if (time_after (jiffies, timeo) && - !chip_ready (map, chip, adr, &datum)) { + !chip_good (map, chip, adr, &datum)) {pr_err ("MTD %s(): software timeout, address:0x%.8lx.\n" , __func__, adr); ret = -EIO ;break ; } -if (chip_ready (map, chip, adr, &datum)) { +if (chip_good (map, chip, adr, &datum)) {if (cfi_check_err_status (map, chip, adr)) ret = -EIO ;break ;
include/linux/mtd/cfi.h +1 -0
@@ -286,6 +286,7 @@ struct cfi_private {map_word sector_erase_cmd;unsigned long chipshift;/* Because they're of the same type */ const char *im_name;/* inter_module name for cmdset_setup */ +unsigned long quirks;struct flchip chips[];/* per-chip data structure for each chip */ };
Greg Kroah-Hartman
maintainerPATCH 700/772 media: coda: Fix reported H264 profile
In reply to Greg Kroah-HartmanFrom: Nicolas Dufresne <[email protected]>
commit 7110c08ea71953a7fc342f0b76046f72442cf26c upstream.
The CODA960 manual states that ASO/FMO features of baseline are not supported, so for this reason this driver should only report constrained baseline support.
This fixes negotiation issue with constrained baseline content on GStreamer 1.17.1.
ASO/FMO features are unsupported for the encoder and untested for the decoder because there is currently no userspace support. Neither GStreamer parsers nor FFMPEG parsers support ASO/FMO.
--- drivers/media/platform/coda/coda-common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/coda/coda-common.c +3 -3
@@ -2352,8 +2352,8 @@ static void coda_encode_ctrls(struct cod V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET, -12, 12, 1, 0);v4l2_ctrl_new_std_menu (&ctx->ctrls, &coda_ctrl_ops,V4L2_CID_MPEG_VIDEO_H264_PROFILE , -V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE ,0x0 , -V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE ); +V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE ,0x0 , +V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE );if (ctx->dev->devtype->product ==CODA_HX4 || ctx->dev->devtype->product ==CODA_7541 ) { v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops,
@@ -2434,7 +2434,7 @@ static void coda_decode_ctrls(struct cod ctx->h264_profile_ctrl =v4l2_ctrl_new_std_menu (&ctx->ctrls, &coda_ctrl_ops,V4L2_CID_MPEG_VIDEO_H264_PROFILE ,V4L2_MPEG_VIDEO_H264_PROFILE_HIGH , - ~((1 <<V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE ) | + ~((1 <<V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE ) | (1 <<V4L2_MPEG_VIDEO_H264_PROFILE_MAIN ) | (1 <<V4L2_MPEG_VIDEO_H264_PROFILE_HIGH )),V4L2_MPEG_VIDEO_H264_PROFILE_HIGH );
Greg Kroah-Hartman
maintainerPATCH 650/772 tracing: Fix return value of trace_pid_write()
In reply to Greg Kroah-HartmanFrom: Wonhyuk Yang <[email protected]>
commit b27f266f74fbda4ee36c2b2b04d15992860cf23b upstream.
Setting set_event_pid with trailing whitespace lead to endless write system calls like below.
$ strace echo "123 " > /sys/kernel/debug/tracing/set_event_pid
execve("/usr/bin/echo", ["echo", "123 "], ...) = 0
...
write(1, "123 \n", 5) = 4
write(1, "\n", 1) = 0
write(1, "\n", 1) = 0
write(1, "\n", 1) = 0
write(1, "\n", 1) = 0
write(1, "\n", 1) = 0
....This is because, the result of trace_get_user's are not returned when it read at least one pid. To fix it, update read variable even if parser->idx == 0.
The result of applied patch is below.
$ strace echo "123 " > /sys/kernel/debug/tracing/set_event_pid
execve("/usr/bin/echo", ["echo", "123 "], ...) = 0
...
write(1, "123 \n", 5) = 5
close(1) = 0--- kernel/trace/trace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace.c +4 -2
@@ -711,13 +711,16 @@ int trace_pid_write(struct trace_pid_lis pos =0 ; ret =trace_get_user (&parser, ubuf, cnt, &pos); -if (ret <0 || !trace_parser_loaded (&parser)) +if (ret <0 )break ; read += ret; ubuf += ret; cnt -= ret; +if (!trace_parser_loaded (&parser)) +break ; + ret = -EINVAL ;if (kstrtoul (parser.buffer,0 , &val))break ;
@@ -743,7 +746,6 @@ int trace_pid_write(struct trace_pid_lisif (!nr_pids) {/* Cleared the list of pids */ trace_pid_list_free (pid_list); - read = ret; pid_list =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 687/772 landlock: Create find_rule() from unmask_layers()
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit 2cd7cd6eed88b8383cfddce589afe9c0ae1d19b4 upstream.
This refactoring will be useful in a following commit.
--- security/landlock/fs.c | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-)
security/landlock/fs.c +28 -13
@@ -183,23 +183,36 @@ int landlock_append_fs_rule(struct landl/* Access-control management */ -static inline layer_mask_t -unmask_layers (const struct landlock_ruleset *const domain, -const struct path *const path,const access_mask_t access_request, -layer_mask_t layer_mask) +/* +* The lifetime of the returned rule is tied to @domain. +* +* Returns NULL if no rule is found or if @dentry is negative. +*/ +static inline const struct landlock_rule * +find_rule (const struct landlock_ruleset *const domain, +const struct dentry *const dentry) {const struct landlock_rule *rule;const struct inode *inode; -size_t i; -if (d_is_negative (path->dentry)) -/* Ignore nonexistent leafs. */ -return layer_mask; - inode =d_backing_inode (path->dentry); +/* Ignores nonexistent leafs. */ +if (d_is_negative (dentry)) +return NULL ; + + inode =d_backing_inode (dentry);rcu_read_lock (); rule =landlock_find_rule ( domain,rcu_dereference (landlock_inode (inode)->object));rcu_read_unlock (); +return rule; +} + +static inline layer_mask_t unmask_layers (const struct landlock_rule *const rule, +const access_mask_t access_request, +layer_mask_t layer_mask) +{ +size_t layer_level; +if (!rule)return layer_mask;
@@ -210,8 +223,9 @@ unmask_layers(const struct landlock_rule* the remaining layers for each inode, from the first added layer to * the last one. */ -for (i =0 ; i < rule->num_layers; i++) { -const struct landlock_layer *const layer = &rule->layers[i]; +for (layer_level =0 ; layer_level < rule->num_layers; layer_level++) { +const struct landlock_layer *const layer = + &rule->layers[layer_level];const layer_mask_t layer_bit =BIT_ULL (layer->level -1 );/* Checks that the layer grants access to the full request. */
@@ -269,8 +283,9 @@ static int check_access_path(const strucwhile (true) {struct dentry *parent_dentry; - layer_mask =unmask_layers (domain, &walker_path, access_request, - layer_mask); + layer_mask = +unmask_layers (find_rule (domain, walker_path.dentry), + access_request, layer_mask);if (layer_mask ==0 ) {/* Stops when a rule from each layer grants access. */ allowed = true;
Greg Kroah-Hartman
maintainerPATCH 731/772 carl9170: tx: fix an incorrect use of list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit 54a6f29522da3c914da30e50721dedf51046449a upstream.
If the previous list_for_each_entry_continue_rcu() don't exit early (no goto hit inside the loop), the iterator 'cvif' after the loop will be a bogus pointer to an invalid structure object containing the HEAD (&ar->vif_list). As a result, the use of 'cvif' after that will lead to a invalid memory access (i.e., 'cvif->id': the invalid pointer dereference when return back to/after the callsite in the carl9170_update_beacon()).
The original intention should have been to return the valid 'cvif' when found in list, NULL otherwise. So just return NULL when no entry found, to fix this bug.
--- drivers/net/wireless/ath/carl9170/tx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/carl9170/tx.c +3 -0
@@ -1558,6 +1558,9 @@ static struct carl9170_vif_info *carl917 goto out; } }while (ar->beacon_enabled && i--); + +/* no entry found in list */ +return NULL ; } out:
Greg Kroah-Hartman
maintainerPATCH 679/772 selftests/landlock: Extend access right tests to directories
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit d18955d094d09a220cf8f533f5e896a2fe31575a upstream.
Make sure that all filesystem access rights can be tied to directories.
Rename layout1.file_access_rights to layout1.file_and_dir_access_rights to reflect this change.
--- tools/testing/selftests/landlock/fs_test.c | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
tools/testing/selftests/landlock/fs_test.c +22 -8
@@ -418,11 +418,12 @@ TEST_F_FORK(layout1, inval)/* clang-format on */ -TEST_F_FORK(layout1, file_access_rights) +TEST_F_FORK(layout1, file_and_dir_access_rights) {__u64 access;int err; -struct landlock_path_beneath_attr path_beneath = {}; +struct landlock_path_beneath_attr path_beneath_file = {}, + path_beneath_dir = {};struct landlock_ruleset_attr ruleset_attr = { .handled_access_fs =ACCESS_ALL , };
@@ -432,20 +433,33 @@ TEST_F_FORK(layout1, file_access_rights)ASSERT_LE (0 , ruleset_fd);/* Tests access rights for files. */ - path_beneath.parent_fd =open (file1_s1d2,O_PATH |O_CLOEXEC ); -ASSERT_LE (0 , path_beneath.parent_fd); + path_beneath_file.parent_fd =open (file1_s1d2,O_PATH |O_CLOEXEC ); +ASSERT_LE (0 , path_beneath_file.parent_fd); + +/* Tests access rights for directories. */ + path_beneath_dir.parent_fd = +open (dir_s1d2,O_PATH |O_DIRECTORY |O_CLOEXEC ); +ASSERT_LE (0 , path_beneath_dir.parent_fd); +for (access =1 ; access <=ACCESS_LAST ; access <<=1 ) { - path_beneath.allowed_access = access; + path_beneath_dir.allowed_access = access; +ASSERT_EQ (0 ,landlock_add_rule (ruleset_fd, +LANDLOCK_RULE_PATH_BENEATH , + &path_beneath_dir,0 )); + + path_beneath_file.allowed_access = access; err =landlock_add_rule (ruleset_fd,LANDLOCK_RULE_PATH_BENEATH , - &path_beneath,0 ); -if ((access |ACCESS_FILE ) ==ACCESS_FILE ) { + &path_beneath_file,0 ); +if (access &ACCESS_FILE ) {ASSERT_EQ (0 , err); }else {ASSERT_EQ (-1 , err);ASSERT_EQ (EINVAL , errno); } } -ASSERT_EQ (0 ,close (path_beneath.parent_fd)); +ASSERT_EQ (0 ,close (path_beneath_file.parent_fd)); +ASSERT_EQ (0 ,close (path_beneath_dir.parent_fd)); +ASSERT_EQ (0 ,close (ruleset_fd)); }TEST_F_FORK (layout1, unknown_access_rights)
Greg Kroah-Hartman
maintainerPATCH 675/772 landlock: Fix landlock_add_rule(2) documentation
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit a13e248ff90e81e9322406c0e618cf2168702f4e upstream.
It is not mandatory to pass a file descriptor obtained with the O_PATH flag. Also, replace rule's accesses with ruleset's accesses.
--- include/uapi/linux/landlock.h | 5 +++-- security/landlock/syscalls.c | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-)
include/uapi/linux/landlock.h +3 -2
@@ -62,8 +62,9 @@ struct landlock_path_beneath_attr {*/ __u64 allowed_access;/** -* @parent_fd: File descriptor, open with ``O_PATH``, which identifies -* the parent directory of a file hierarchy, or just a file. +* @parent_fd: File descriptor, preferably opened with ``O_PATH``, +* which identifies the parent directory of a file hierarchy, or just a +* file. */ __s32 parent_fd;/*
security/landlock/syscalls.c +3 -4
@@ -292,14 +292,13 @@ out_fdput:* * - EOPNOTSUPP: Landlock is supported by the kernel but disabled at boot time; * - EINVAL: @flags is not 0, or inconsistent access in the rule (i.e. -* &landlock_path_beneath_attr.allowed_access is not a subset of the rule's -* accesses); +* &landlock_path_beneath_attr.allowed_access is not a subset of the +* ruleset handled accesses); * - ENOMSG: Empty accesses (e.g. &landlock_path_beneath_attr.allowed_access); * - EBADF: @ruleset_fd is not a file descriptor for the current thread, or a * member of @rule_attr is not a file descriptor as expected; * - EBADFD: @ruleset_fd is not a ruleset file descriptor, or a member of -* @rule_attr is not the expected file descriptor type (e.g. file open -* without O_PATH); +* @rule_attr is not the expected file descriptor type; * - EPERM: @ruleset_fd has no write access to the underlying ruleset; * - EFAULT: @rule_attr inconsistency. */
Greg Kroah-Hartman
maintainerPATCH 693/772 drm/nouveau/kms/nv50-: atom: fix an incorrect NULL check on list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit 6ce4431c7ba7954c4fa6a96ce16ca1b2943e1a83 upstream.
The bug is here:
return encoder;
The list iterator value 'encoder' will *always* be set and non-NULL by drm_for_each_encoder_mask(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element found. Otherwise it will bypass some NULL checks and lead to invalid memory access passing the check.
To fix this bug, just return 'encoder' when found, otherwise return NULL.
--- drivers/gpu/drm/nouveau/dispnv50/atom.h | 6 +++--- drivers/gpu/drm/nouveau/dispnv50/crc.c | 27 ++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/atom.h +3 -3
@@ -160,14 +160,14 @@ nv50_head_atom_get(struct drm_atomic_stastatic inline struct drm_encoder *nv50_head_atom_get_encoder (struct nv50_head_atom *atom) { -struct drm_encoder *encoder =NULL ; +struct drm_encoder *encoder;/* We only ever have a single encoder */ drm_for_each_encoder_mask (encoder, atom->state.crtc->dev, atom->state.encoder_mask) -break ; +return encoder; -return encoder; +return NULL ; }#define nv50_wndw_atom (p) container_of((p), struct nv50_wndw_atom, state)
drivers/gpu/drm/nouveau/dispnv50/crc.c +22 -5
@@ -390,9 +390,18 @@ void nv50_crc_atomic_check_outp(struct nstruct nv50_head_atom *armh =nv50_head_atom (old_crtc_state);struct nv50_head_atom *asyh =nv50_head_atom (new_crtc_state);struct nv50_outp_atom *outp_atom; -struct nouveau_encoder *outp = -nv50_real_outp (nv50_head_atom_get_encoder (armh)); -struct drm_encoder *encoder = &outp->base.base; +struct nouveau_encoder *outp; +struct drm_encoder *encoder, *enc; + + enc =nv50_head_atom_get_encoder (armh); +if (!enc) +continue ; + + outp =nv50_real_outp (enc); +if (!outp) +continue ; + + encoder = &outp->base.base;if (!asyh->clr.crc)continue ;
@@ -443,8 +452,16 @@ void nv50_crc_atomic_set(struct nv50_heastruct drm_device *dev = crtc->dev;struct nv50_crc *crc = &head->crc;const struct nv50_crc_func *func =nv50_disp (dev)->core->func->crc; -struct nouveau_encoder *outp = -nv50_real_outp (nv50_head_atom_get_encoder (asyh)); +struct nouveau_encoder *outp; +struct drm_encoder *encoder; + + encoder =nv50_head_atom_get_encoder (asyh); +if (!encoder) +return ; + + outp =nv50_real_outp (encoder); +if (!outp) +return ; func->set_src (head, outp->or,nv50_crc_source_type (outp, asyh->crc.src), &crc->ctx[crc->ctx_idx]);
Greg Kroah-Hartman
maintainerPATCH 676/772 selftests/landlock: Make tests build with old libc
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit 87129ef13603ae46c82bcd09eed948acf0506dbb upstream.
Replace SYS_<syscall> with __NR_<syscall>. Using the __NR_<syscall> notation, provided by UAPI, is useful to build tests on systems without the SYS_<syscall> definitions.
Replace SYS_pivot_root with __NR_pivot_root, and SYS_move_mount with __NR_move_mount.
Define renameat2() and RENAME_EXCHANGE if they are unknown to old build systems.
--- tools/testing/selftests/landlock/fs_test.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
tools/testing/selftests/landlock/fs_test.c +18 -5
@@ -22,6 +22,19 @@#include "common.h" +#ifndef renameat2 +int renameat2 (int olddirfd,const char *oldpath,int newdirfd, +const char *newpath,unsigned int flags) +{ +return syscall (__NR_renameat2, olddirfd, oldpath, newdirfd, newpath, + flags); +} +#endif + +#ifndef RENAME_EXCHANGE +#define RENAME_EXCHANGE (1 << 1) +#endif +#define TMP_DIR "tmp"#define BINARY_PATH "./true"
@@ -1279,7 +1292,7 @@ TEST_F_FORK(layout1, rule_inside_mount_nint ruleset_fd;set_cap (_metadata,CAP_SYS_ADMIN ); - ASSERT_EQ(0, syscall(SYS_pivot_root, dir_s3d2, dir_s3d3)) + ASSERT_EQ(0, syscall(__NR_pivot_root, dir_s3d2, dir_s3d3)) {TH_LOG ("Failed to pivot root: %s" ,strerror (errno)); };
@@ -1313,7 +1326,7 @@ TEST_F_FORK(layout1, mount_and_pivot)set_cap (_metadata,CAP_SYS_ADMIN );ASSERT_EQ (-1 ,mount (NULL , dir_s3d2,NULL ,MS_RDONLY ,NULL ));ASSERT_EQ (EPERM , errno); -ASSERT_EQ (-1 ,syscall (SYS_pivot_root, dir_s3d2, dir_s3d3)); +ASSERT_EQ (-1 ,syscall (__NR_pivot_root, dir_s3d2, dir_s3d3));ASSERT_EQ (EPERM , errno);clear_cap (_metadata,CAP_SYS_ADMIN ); }
@@ -1332,13 +1345,13 @@ TEST_F_FORK(layout1, move_mount)ASSERT_LE (0 , ruleset_fd);set_cap (_metadata,CAP_SYS_ADMIN ); -ASSERT_EQ (0 ,syscall (SYS_move_mount,AT_FDCWD , dir_s3d2,AT_FDCWD , +ASSERT_EQ (0 ,syscall (__NR_move_mount,AT_FDCWD , dir_s3d2,AT_FDCWD , dir_s1d2, 0)) {TH_LOG ("Failed to move mount: %s" ,strerror (errno)); } -ASSERT_EQ (0 ,syscall (SYS_move_mount,AT_FDCWD , dir_s1d2,AT_FDCWD , +ASSERT_EQ (0 ,syscall (__NR_move_mount,AT_FDCWD , dir_s1d2,AT_FDCWD , dir_s3d2,0 ));clear_cap (_metadata,CAP_SYS_ADMIN );
@@ -1346,7 +1359,7 @@ TEST_F_FORK(layout1, move_mount)ASSERT_EQ (0 ,close (ruleset_fd));set_cap (_metadata,CAP_SYS_ADMIN ); -ASSERT_EQ (-1 ,syscall (SYS_move_mount,AT_FDCWD , dir_s3d2,AT_FDCWD , +ASSERT_EQ (-1 ,syscall (__NR_move_mount,AT_FDCWD , dir_s3d2,AT_FDCWD , dir_s1d2,0 ));ASSERT_EQ (EPERM , errno);clear_cap (_metadata,CAP_SYS_ADMIN );
Greg Kroah-Hartman
maintainerPATCH 674/772 samples/landlock: Format with clang-format
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit 81709f3dccacf4104a4bc2daa80bdd767a9c4c54 upstream.
Let's follow a consistent and documented coding style. Everything may not be to our liking but it is better than tacit knowledge. Moreover, this will help maintain style consistency between different developers.
This contains only whitespace changes.
Automatically formatted with:
clang-format-14 -i samples/landlock/*.[ch]
--- samples/landlock/sandboxer.c | 96 +++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 44 deletions(-)
samples/landlock/sandboxer.c +52 -44
@@ -22,9 +22,9 @@#include <unistd.h> #ifndef landlock_create_ruleset -static inline int landlock_create_ruleset ( -const struct landlock_ruleset_attr *const attr, -const size_t size,const __u32 flags) +static inline int +landlock_create_ruleset (const struct landlock_ruleset_attr *const attr, +const size_t size,const __u32 flags) {return syscall (__NR_landlock_create_ruleset, attr, size, flags); }
@@ -32,17 +32,18 @@ static inline int landlock_create_rulese#ifndef landlock_add_rulestatic inline int landlock_add_rule (const int ruleset_fd, -const enum landlock_rule_type rule_type, -const void *const rule_attr,const __u32 flags) +const enum landlock_rule_type rule_type, +const void *const rule_attr, +const __u32 flags) { -return syscall (__NR_landlock_add_rule, ruleset_fd, rule_type, - rule_attr, flags); +return syscall (__NR_landlock_add_rule, ruleset_fd, rule_type, rule_attr, + flags); }#endif #ifndef landlock_restrict_selfstatic inline int landlock_restrict_self (const int ruleset_fd, -const __u32 flags) +const __u32 flags) {return syscall (__NR_landlock_restrict_self, ruleset_fd, flags); }
@@ -79,9 +80,8 @@ static int parse_path(char *env_path, co/* clang-format on */ -static int populate_ruleset ( -const char *const env_var,const int ruleset_fd, -const __u64 allowed_access) +static int populate_ruleset (const char *const env_var,const int ruleset_fd, +const __u64 allowed_access) {int num_paths, i, ret =1 ;char *env_path_name;
@@ -111,12 +111,10 @@ static int populate_ruleset(for (i =0 ; i < num_paths; i++) {struct stat statbuf; - path_beneath.parent_fd =open (path_list[i],O_PATH | -O_CLOEXEC ); + path_beneath.parent_fd =open (path_list[i],O_PATH |O_CLOEXEC );if (path_beneath.parent_fd <0 ) {fprintf (stderr,"Failed to open \"%s\": %s\n" , - path_list[i], -strerror (errno)); + path_list[i],strerror (errno)); goto out_free_name; }if (fstat (path_beneath.parent_fd, &statbuf)) {
@@ -127,9 +125,10 @@ static int populate_ruleset(if (!S_ISDIR (statbuf.st_mode)) path_beneath.allowed_access &=ACCESS_FILE ;if (landlock_add_rule (ruleset_fd,LANDLOCK_RULE_PATH_BENEATH , - &path_beneath,0 )) { -fprintf (stderr,"Failed to update the ruleset with \"%s\": %s\n" , - path_list[i],strerror (errno)); + &path_beneath,0 )) { +fprintf (stderr, +"Failed to update the ruleset with \"%s\": %s\n" , + path_list[i],strerror (errno));close (path_beneath.parent_fd); goto out_free_name; }
@@ -171,55 +170,64 @@ int main(const int argc, char *const argint ruleset_fd;struct landlock_ruleset_attr ruleset_attr = { .handled_access_fs =ACCESS_FS_ROUGHLY_READ | -ACCESS_FS_ROUGHLY_WRITE , +ACCESS_FS_ROUGHLY_WRITE , };if (argc <2 ) { -fprintf (stderr,"usage: %s=\"...\" %s=\"...\" %s <cmd> [args]...\n\n" , -ENV_FS_RO_NAME ,ENV_FS_RW_NAME , argv[0 ]); -fprintf (stderr,"Launch a command in a restricted environment.\n\n" ); +fprintf (stderr, +"usage: %s=\"...\" %s=\"...\" %s <cmd> [args]...\n\n" , +ENV_FS_RO_NAME ,ENV_FS_RW_NAME , argv[0 ]); +fprintf (stderr, +"Launch a command in a restricted environment.\n\n" );fprintf (stderr,"Environment variables containing paths, " "each separated by a colon:\n" ); -fprintf (stderr,"* %s: list of paths allowed to be used in a read-only way.\n" , -ENV_FS_RO_NAME ); -fprintf (stderr,"* %s: list of paths allowed to be used in a read-write way.\n" , -ENV_FS_RW_NAME ); -fprintf (stderr,"\nexample:\n" -"%s=\"/bin:/lib:/usr:/proc:/etc:/dev/urandom\" " -"%s=\"/dev/null:/dev/full:/dev/zero:/dev/pts:/tmp\" " -"%s bash -i\n" , -ENV_FS_RO_NAME ,ENV_FS_RW_NAME , argv[0 ]); +fprintf (stderr, +"* %s: list of paths allowed to be used in a read-only way.\n" , +ENV_FS_RO_NAME ); +fprintf (stderr, +"* %s: list of paths allowed to be used in a read-write way.\n" , +ENV_FS_RW_NAME ); +fprintf (stderr, +"\nexample:\n" +"%s=\"/bin:/lib:/usr:/proc:/etc:/dev/urandom\" " +"%s=\"/dev/null:/dev/full:/dev/zero:/dev/pts:/tmp\" " +"%s bash -i\n" , +ENV_FS_RO_NAME ,ENV_FS_RW_NAME , argv[0 ]);return 1 ; } - ruleset_fd =landlock_create_ruleset (&ruleset_attr,sizeof (ruleset_attr),0 ); + ruleset_fd = +landlock_create_ruleset (&ruleset_attr,sizeof (ruleset_attr),0 );if (ruleset_fd <0 ) {const int err = errno;perror ("Failed to create a ruleset" );switch (err) {case ENOSYS : -fprintf (stderr,"Hint: Landlock is not supported by the current kernel. " -"To support it, build the kernel with " -"CONFIG_SECURITY_LANDLOCK=y and prepend " -"\"landlock,\" to the content of CONFIG_LSM.\n" ); +fprintf (stderr, +"Hint: Landlock is not supported by the current kernel. " +"To support it, build the kernel with " +"CONFIG_SECURITY_LANDLOCK=y and prepend " +"\"landlock,\" to the content of CONFIG_LSM.\n" );break ;case EOPNOTSUPP : -fprintf (stderr,"Hint: Landlock is currently disabled. " -"It can be enabled in the kernel configuration by " -"prepending \"landlock,\" to the content of CONFIG_LSM, " -"or at boot time by setting the same content to the " -"\"lsm\" kernel parameter.\n" ); +fprintf (stderr, +"Hint: Landlock is currently disabled. " +"It can be enabled in the kernel configuration by " +"prepending \"landlock,\" to the content of CONFIG_LSM, " +"or at boot time by setting the same content to the " +"\"lsm\" kernel parameter.\n" );break ; }return 1 ; }if (populate_ruleset (ENV_FS_RO_NAME , ruleset_fd, -ACCESS_FS_ROUGHLY_READ )) { +ACCESS_FS_ROUGHLY_READ )) { goto err_close_ruleset; }if (populate_ruleset (ENV_FS_RW_NAME , ruleset_fd, -ACCESS_FS_ROUGHLY_READ |ACCESS_FS_ROUGHLY_WRITE )) { +ACCESS_FS_ROUGHLY_READ | +ACCESS_FS_ROUGHLY_WRITE )) { goto err_close_ruleset; }if (prctl (PR_SET_NO_NEW_PRIVS ,1 ,0 ,0 ,0 )) {
@@ -236,7 +244,7 @@ int main(const int argc, char *const arg cmd_argv = argv +1 ;execvpe (cmd_path, cmd_argv, envp);fprintf (stderr,"Failed to execute \"%s\": %s\n" , cmd_path, -strerror (errno)); +strerror (errno));fprintf (stderr,"Hint: access to the binary, the interpreter or " "shared libraries may be denied.\n" );return 1 ;
Greg Kroah-Hartman
maintainerPATCH 694/772 drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
commit 8fb6c44fe8468f92ac7b8bbfcca4404a4e88645f upstream.
If the display is not enable()d, then we aren't holding a runtime PM reference here. Thus, it's easy to accidentally cause a hang, if user space is poking around at /dev/drm_dp_aux0 at the "wrong" time.
Let's get a runtime PM reference, and check that we "see" the panel. Don't force any panel power-up, etc., because that can be intrusive, and that's not what other drivers do (see drivers/gpu/drm/bridge/ti-sn65dsi86.c and drivers/gpu/drm/bridge/parade-ps8640.c.)
--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +12 -1
@@ -1632,8 +1632,19 @@ static ssize_t analogix_dpaux_transfer(s struct drm_dp_aux_msg *msg) {struct analogix_dp_device *dp =to_dp (aux); +int ret; -return analogix_dp_transfer (dp, msg); +pm_runtime_get_sync (dp->dev); + + ret =analogix_dp_detect_hpd (dp); +if (ret) + goto out; + + ret =analogix_dp_transfer (dp, msg); +out: +pm_runtime_put (dp->dev); + +return ret; } struct analogix_dp_device *
Greg Kroah-Hartman
maintainerPATCH 697/772 md: fix an incorrect NULL check in md_reload_sb
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit 64c54d9244a4efe9bc6e9c98e13c4bbb8bb39083 upstream.
The bug is here:
if (!rdev || rdev->desc_nr != nr) {The list iterator value 'rdev' will *always* be set and non-NULL by rdev_for_each_rcu(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element found (In fact, it will be a bogus pointer to an invalid struct object containing the HEAD). Otherwise it will bypass the check and lead to invalid memory access passing the check.
To fix the bug, use a new variable 'iter' as the list iterator, while using the original variable 'pdev' as a dedicated pointer to point to the found element.
--- drivers/md/md.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/md/md.c +6 -4
@@ -9794,16 +9794,18 @@ static int read_rdev(struct mddev *mddevvoid md_reload_sb (struct mddev *mddev,int nr) { -struct md_rdev *rdev; +struct md_rdev *rdev =NULL , *iter;int err;/* Find the rdev */ -rdev_for_each_rcu (rdev, mddev) { -if (rdev->desc_nr == nr) +rdev_for_each_rcu (iter, mddev) { +if (iter->desc_nr == nr) { + rdev = iter;break ; + } } -if (!rdev || rdev->desc_nr != nr) { +if (!rdev) {pr_warn ("%s: %d Could not find rdev with nr %d\n" , __func__, __LINE__, nr);return ; }
Greg Kroah-Hartman
maintainerPATCH 695/772 drm/i915/dsi: fix VBT send packet port selection for ICL+
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
commit 0ea917819d12fed41ea4662cc26ffa0060a5c354 upstream.
The VBT send packet port selection was never updated for ICL+ where the 2nd link is on port B instead of port C as in VLV+ DSI.
First, single link DSI needs to use the configured port instead of relying on the VBT sequence block port. Remove the hard-coded port C check here and make it generic. For reference, see commit f915084edc5a ("drm/i915: Changes related to the sequence port no for") for the original VLV specific fix.
Second, the sequence block port number is either 0 or 1, where 1 indicates the 2nd link. Remove the hard-coded port C here for 2nd link. (This could be a "find second set bit" on DSI ports, but just check the two possible options.)
Third, sanity check the result with a warning to avoid a NULL pointer dereference.
--- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 33 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +22 -11
@@ -122,9 +122,25 @@ struct i2c_adapter_lookup {#define ICL_GPIO_DDPA_CTRLCLK_2 8#define ICL_GPIO_DDPA_CTRLDATA_2 9 -static enum port intel_dsi_seq_port_to_port (u8 port) +static enum port intel_dsi_seq_port_to_port (struct intel_dsi *intel_dsi, +u8 seq_port) { -return port ?PORT_C :PORT_A ; +/* +* If single link DSI is being used on any port, the VBT sequence block +* send packet apparently always has 0 for the port. Just use the port +* we have configured, and ignore the sequence block port. +*/ +if (hweight8 (intel_dsi->ports) ==1 ) +return ffs (intel_dsi->ports) -1 ; + +if (seq_port) { +if (intel_dsi->ports &PORT_B ) +return PORT_B ; +else if (intel_dsi->ports &PORT_C ) +return PORT_C ; + } + +return PORT_A ; } static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
@@ -146,15 +162,10 @@ static const u8 *mipi_exec_send_packet(s seq_port = (flags >>MIPI_PORT_SHIFT ) &3 ; -/* For DSI single link on Port A & C, the seq_port value which is -* parsed from Sequence Block#53 of VBT has been set to 0 -* Now, read/write of packets for the DSI single link on Port A and -* Port C will based on the DVO port from VBT block 2. -*/ -if (intel_dsi->ports == (1 <<PORT_C )) - port =PORT_C ; -else - port =intel_dsi_seq_port_to_port (seq_port); + port =intel_dsi_seq_port_to_port (intel_dsi, seq_port); + +if (drm_WARN_ON (&dev_priv->drm, !intel_dsi->dsi_hosts[port])) + goto out; dsi_device = intel_dsi->dsi_hosts[port]->device;if (!dsi_device) {
Greg Kroah-Hartman
maintainerPATCH 696/772 md: fix an incorrect NULL check in does_sb_need_changing
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit fc8738343eefc4ea8afb6122826dea48eacde514 upstream.
The bug is here:
if (!rdev)
The list iterator value 'rdev' will *always* be set and non-NULL by rdev_for_each(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element found. Otherwise it will bypass the NULL check and lead to invalid memory access passing the check.
To fix the bug, use a new variable 'iter' as the list iterator, while using the original variable 'rdev' as a dedicated pointer to point to the found element.
--- drivers/md/md.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/md/md.c +5 -3
@@ -2629,14 +2629,16 @@ static void sync_sbs(struct mddev *mddevstatic bool does_sb_need_changing (struct mddev *mddev) { -struct md_rdev *rdev; +struct md_rdev *rdev =NULL , *iter;struct mdp_superblock_1 *sb;int role;/* Find a good rdev */ -rdev_for_each (rdev, mddev) -if ((rdev->raid_disk >=0 ) && !test_bit (Faulty, &rdev->flags)) +rdev_for_each (iter, mddev) +if ((iter->raid_disk >=0 ) && !test_bit (Faulty, &iter->flags)) { + rdev = iter;break ; + }/* No good device found. */ if (!rdev)
Greg Kroah-Hartman
maintainerPATCH 673/772 samples/landlock: Add clang-format exceptions
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit 9805a722db071e1772b80e6e0ff33f35355639ac upstream.
In preparation to a following commit, add clang-format on and clang-format off stanzas around constant definitions. This enables to keep aligned values, which is much more readable than packed definitions.
--- samples/landlock/sandboxer.c | 8 ++++++++ 1 file changed, 8 insertions(+)
samples/landlock/sandboxer.c +8 -0
@@ -70,11 +70,15 @@ static int parse_path(char *env_path, coreturn num_paths; } +/* clang-format off */ +#define ACCESS_FILE ( \ LANDLOCK_ACCESS_FS_EXECUTE | \ LANDLOCK_ACCESS_FS_WRITE_FILE | \ LANDLOCK_ACCESS_FS_READ_FILE) +/* clang-format on */ +static int populate_ruleset (const char *const env_var,const int ruleset_fd,const __u64 allowed_access)
@@ -139,6 +143,8 @@ out_free_name:return ret; } +/* clang-format off */ +#define ACCESS_FS_ROUGHLY_READ ( \ LANDLOCK_ACCESS_FS_EXECUTE | \ LANDLOCK_ACCESS_FS_READ_FILE | \
@@ -156,6 +162,8 @@ out_free_name: LANDLOCK_ACCESS_FS_MAKE_BLOCK | \ LANDLOCK_ACCESS_FS_MAKE_SYM) +/* clang-format on */ +int main (const int argc,char *const argv[],char *const *const envp) {const char *cmd_path;
Greg Kroah-Hartman
maintainerPATCH 647/772 ACPI: property: Release subnode properties with data nodes
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
commit 3bd561e1572ee02a50cd1a5be339abf1a5b78d56 upstream.
struct acpi_device_properties describes one source of properties present on either struct acpi_device or struct acpi_data_node. When properties are parsed, both are populated but when released, only those properties that are associated with the device node are freed.
Fix this by also releasing memory of the data node properties.
--- drivers/acpi/property.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/acpi/property.c +12 -6
@@ -433,6 +433,16 @@ void acpi_init_properties(struct acpi_deacpi_extract_apple_properties (adev); } +static void acpi_free_device_properties (struct list_head *list) +{ +struct acpi_device_properties *props, *tmp; + +list_for_each_entry_safe (props, tmp, list, list) { +list_del (&props->list); +kfree (props); + } +} +static void acpi_destroy_nondev_subnodes (struct list_head *list) {struct acpi_data_node *dn, *next;
@@ -445,22 +455,18 @@ static void acpi_destroy_nondev_subnodeswait_for_completion (&dn->kobj_done);list_del (&dn->sibling);ACPI_FREE ((void *)dn->data.pointer); +acpi_free_device_properties (&dn->data.properties);kfree (dn); } }void acpi_free_properties (struct acpi_device *adev) { -struct acpi_device_properties *props, *tmp; -acpi_destroy_nondev_subnodes (&adev->data.subnodes);ACPI_FREE ((void *)adev->data.pointer); adev->data.of_compatible =NULL ; adev->data.pointer =NULL ; -list_for_each_entry_safe (props, tmp, &adev->data.properties, list) { -list_del (&props->list); -kfree (props); - } +acpi_free_device_properties (&adev->data.properties); }/**
Greg Kroah-Hartman
maintainerPATCH 668/772 landlock: Add clang-format exceptions
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit 6cc2df8e3a3967e7c13a424f87f6efb1d4a62d80 upstream.
In preparation to a following commit, add clang-format on and clang-format off stanzas around constant definitions. This enables to keep aligned values, which is much more readable than packed definitions.
--- include/uapi/linux/landlock.h | 4 ++++ security/landlock/fs.c | 2 ++ security/landlock/limits.h | 4 ++++ 3 files changed, 10 insertions(+)
include/uapi/linux/landlock.h +4 -0
@@ -33,7 +33,9 @@ struct landlock_ruleset_attr {* - %LANDLOCK_CREATE_RULESET_VERSION: Get the highest supported Landlock ABI * version. */ +/* clang-format off */ #define LANDLOCK_CREATE_RULESET_VERSION (1U << 0) +/* clang-format on */ /** * enum landlock_rule_type - Landlock rule type
@@ -120,6 +122,7 @@ struct landlock_path_beneath_attr {* :manpage:`access(2)`. * Future Landlock evolutions will enable to restrict them. */ +/* clang-format off */ #define LANDLOCK_ACCESS_FS_EXECUTE (1ULL << 0)#define LANDLOCK_ACCESS_FS_WRITE_FILE (1ULL << 1)#define LANDLOCK_ACCESS_FS_READ_FILE (1ULL << 2)
@@ -133,5 +136,6 @@ struct landlock_path_beneath_attr {#define LANDLOCK_ACCESS_FS_MAKE_FIFO (1ULL << 10)#define LANDLOCK_ACCESS_FS_MAKE_BLOCK (1ULL << 11)#define LANDLOCK_ACCESS_FS_MAKE_SYM (1ULL << 12) +/* clang-format on */ #endif /* _UAPI_LINUX_LANDLOCK_H */
security/landlock/fs.c +2 -0
@@ -141,10 +141,12 @@ retry: }/* All access rights that can be tied to files. */ +/* clang-format off */ #define ACCESS_FILE ( \ LANDLOCK_ACCESS_FS_EXECUTE | \ LANDLOCK_ACCESS_FS_WRITE_FILE | \ LANDLOCK_ACCESS_FS_READ_FILE) +/* clang-format on */ /* * @path: Should have been checked by get_path_from_fd().
security/landlock/limits.h +4 -0
@@ -12,10 +12,14 @@#include <linux/limits.h> #include <uapi/linux/landlock.h> +/* clang-format off */ +#define LANDLOCK_MAX_NUM_LAYERS 64#define LANDLOCK_MAX_NUM_RULES U32_MAX#define LANDLOCK_LAST_ACCESS_FS LANDLOCK_ACCESS_FS_MAKE_SYM#define LANDLOCK_MASK_ACCESS_FS ((LANDLOCK_LAST_ACCESS_FS << 1) - 1) +/* clang-format on */ +#endif /* _SECURITY_LANDLOCK_LIMITS_H */
Greg Kroah-Hartman
maintainerPATCH 669/772 landlock: Format with clang-format
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit 06a1c40a09a8dded4bf0e7e3ccbda6bddcccd7c8 upstream.
Let's follow a consistent and documented coding style. Everything may not be to our liking but it is better than tacit knowledge. Moreover, this will help maintain style consistency between different developers.
This contains only whitespace changes.
Automatically formatted with:
clang-format-14 -i security/landlock/*.[ch] include/uapi/linux/landlock.h
--- security/landlock/cred.c | 4 +- security/landlock/cred.h | 8 ++-- security/landlock/fs.c | 78 +++++++++++++++++++++-------------------- security/landlock/fs.h | 11 +++-- security/landlock/object.c | 6 +-- security/landlock/object.h | 6 +-- security/landlock/ptrace.c | 10 ++--- security/landlock/ruleset.c | 80 +++++++++++++++++++++---------------------- security/landlock/ruleset.h | 15 ++++---- security/landlock/syscalls.c | 60 ++++++++++++++++---------------- 10 files changed, 142 insertions(+), 136 deletions(-)
security/landlock/cred.c +2 -2
@@ -15,7 +15,7 @@#include "setup.h" static int hook_cred_prepare (struct cred *const new, -const struct cred *const old,const gfp_t gfp) +const struct cred *const old,const gfp_t gfp) {struct landlock_ruleset *const old_dom =landlock_cred (old)->domain;
@@ -42,5 +42,5 @@ static struct security_hook_list landloc__init void landlock_add_cred_hooks (void ) {security_add_hooks (landlock_hooks,ARRAY_SIZE (landlock_hooks), -LANDLOCK_NAME ); +LANDLOCK_NAME ); }
security/landlock/cred.h +4 -4
@@ -20,8 +20,8 @@ struct landlock_cred_security {struct landlock_ruleset *domain; }; -static inline struct landlock_cred_security *landlock_cred ( -const struct cred *cred) +static inline struct landlock_cred_security * +landlock_cred (const struct cred *cred) {return cred->security + landlock_blob_sizes.lbs_cred; }
@@ -34,8 +34,8 @@ static inline const struct landlock_rule/* * The call needs to come from an RCU read-side critical section. */ -static inline const struct landlock_ruleset *landlock_get_task_domain ( -const struct task_struct *const task) +static inline const struct landlock_ruleset * +landlock_get_task_domain (const struct task_struct *const task) {return landlock_cred (__task_cred (task))->domain; }
security/landlock/fs.c +40 -38
205 lines not on this page · raw message
security/landlock/fs.h +6 -5
@@ -50,14 +50,14 @@ struct landlock_superblock_security {atomic_long_t inode_refs; }; -static inline struct landlock_inode_security *landlock_inode ( -const struct inode *const inode) +static inline struct landlock_inode_security * +landlock_inode (const struct inode *const inode) {return inode->i_security + landlock_blob_sizes.lbs_inode; } -static inline struct landlock_superblock_security *landlock_superblock ( -const struct super_block *const superblock) +static inline struct landlock_superblock_security * +landlock_superblock (const struct super_block *const superblock) {return superblock->s_security + landlock_blob_sizes.lbs_superblock; }
@@ -65,6 +65,7 @@ static inline struct landlock_superblock__init void landlock_add_fs_hooks (void );int landlock_append_fs_rule (struct landlock_ruleset *const ruleset, -const struct path *const path,u32 access_hierarchy); +const struct path *const path, +u32 access_hierarchy);#endif /* _SECURITY_LANDLOCK_FS_H */
security/landlock/object.c +3 -3
@@ -17,9 +17,9 @@#include "object.h" -struct landlock_object *landlock_create_object ( -const struct landlock_object_underops *const underops, -void *const underobj) +struct landlock_object * +landlock_create_object (const struct landlock_object_underops *const underops, +void *const underobj) {struct landlock_object *new_object;
security/landlock/object.h +3 -3
@@ -76,9 +76,9 @@ struct landlock_object { }; }; -struct landlock_object *landlock_create_object ( -const struct landlock_object_underops *const underops, -void *const underobj); +struct landlock_object * +landlock_create_object (const struct landlock_object_underops *const underops, +void *const underobj);void landlock_put_object (struct landlock_object *const object);
security/landlock/ptrace.c +5 -5
@@ -30,7 +30,7 @@* means a subset of) the @child domain. */ static bool domain_scope_le (const struct landlock_ruleset *const parent, -const struct landlock_ruleset *const child) +const struct landlock_ruleset *const child) {const struct landlock_hierarchy *walker;
@@ -48,7 +48,7 @@ static bool domain_scope_le(const struct }static bool task_is_scoped (const struct task_struct *const parent, -const struct task_struct *const child) +const struct task_struct *const child) {bool is_scoped;const struct landlock_ruleset *dom_parent, *dom_child;
@@ -62,7 +62,7 @@ static bool task_is_scoped(const struct }static int task_ptrace (const struct task_struct *const parent, -const struct task_struct *const child) +const struct task_struct *const child) {/* Quick return for non-landlocked tasks. */ if (!landlocked (parent))
@@ -86,7 +86,7 @@ static int task_ptrace(const struct task* granted, -errno if denied. */ static int hook_ptrace_access_check (struct task_struct *const child, -const unsigned int mode) +const unsigned int mode) {return task_ptrace (current, child); }
@@ -116,5 +116,5 @@ static struct security_hook_list landloc__init void landlock_add_ptrace_hooks (void ) {security_add_hooks (landlock_hooks,ARRAY_SIZE (landlock_hooks), -LANDLOCK_NAME ); +LANDLOCK_NAME ); }
security/landlock/ruleset.c +40 -40
200 lines not on this page · raw message
security/landlock/ruleset.h +8 -7
@@ -146,15 +146,16 @@ void landlock_put_ruleset(struct landlocvoid landlock_put_ruleset_deferred (struct landlock_ruleset *const ruleset);int landlock_insert_rule (struct landlock_ruleset *const ruleset, -struct landlock_object *const object,const u32 access); +struct landlock_object *const object, +const u32 access); -struct landlock_ruleset *landlock_merge_ruleset ( -struct landlock_ruleset *const parent, -struct landlock_ruleset *const ruleset); +struct landlock_ruleset * +landlock_merge_ruleset (struct landlock_ruleset *const parent, +struct landlock_ruleset *const ruleset); -const struct landlock_rule *landlock_find_rule ( -const struct landlock_ruleset *const ruleset, -const struct landlock_object *const object); +const struct landlock_rule * +landlock_find_rule (const struct landlock_ruleset *const ruleset, +const struct landlock_object *const object);static inline void landlock_get_ruleset (struct landlock_ruleset *const ruleset) {
security/landlock/syscalls.c +31 -29
167 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 646/772 ext4: avoid cycles in directory h-tree
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 3ba733f879c2a88910744647e41edeefbc0d92b2 upstream.
A maliciously corrupted filesystem can contain cycles in the h-tree stored inside a directory. That can easily lead to the kernel corrupting tree nodes that were already verified under its hands while doing a node split and consequently accessing unallocated memory. Fix the problem by verifying traversed block numbers are unique.
--- fs/ext4/namei.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
fs/ext4/namei.c +19 -3
@@ -777,12 +777,14 @@ static struct dx_frame * dx_probe(struct ext4_filename *fname, struct inode *dir, struct dx_hash_info *hinfo, struct dx_frame *frame_in) { - unsigned count, indirect; + unsigned count, indirect, level, i;struct dx_entry *at, *entries, *p, *q, *m;struct dx_root *root;struct dx_frame *frame = frame_in;struct dx_frame *ret_err =ERR_PTR (ERR_BAD_DX_DIR );u32 hash; +ext4_lblk_t block; +ext4_lblk_t blocks[EXT4_HTREE_LEVEL ];memset (frame_in,0 ,EXT4_HTREE_LEVEL *sizeof (frame_in[0 ])); frame->bh =ext4_read_dirblock (dir,0 ,INDEX );
@@ -854,6 +856,8 @@ dx_probe(struct ext4_filename *fname, st }dxtrace (printk ("Look up %x" , hash)); + level =0 ; + blocks[0 ] =0 ;while (1 ) { count =dx_get_count (entries);if (!count || count >dx_get_limit (entries)) {
@@ -882,15 +886,27 @@ dx_probe(struct ext4_filename *fname, st dx_get_block(at))); frame->entries = entries; frame->at = at; -if (!indirect--) + + block =dx_get_block (at); +for (i =0 ; i <= level; i++) { +if (blocks[i] == block) { +ext4_warning_inode (dir, +"dx entry: tree cycle block %u points back to block %u" , + blocks[level], block); + goto fail; + } + } +if (++level > indirect)return frame; + blocks[level] = block; frame++; - frame->bh =ext4_read_dirblock (dir,dx_get_block (at),INDEX ); + frame->bh =ext4_read_dirblock (dir, block,INDEX );if (IS_ERR (frame->bh)) { ret_err = (struct dx_frame *) frame->bh; frame->bh =NULL ; goto fail; } + entries = ((struct dx_node *) frame->bh->b_data)->entries;if (dx_get_limit (entries) !=dx_node_limit (dir)) {
Greg Kroah-Hartman
maintainerPATCH 662/772 dlm: uninitialized variable on error in dlm_listen_for_all()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 1f4f10845e14690b02410de50d9ea9684625a4ae upstream.
The "sock" variable is not initialized on this error path.
--- fs/dlm/lowcomms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dlm/lowcomms.c +1 -1
@@ -1789,7 +1789,7 @@ static int dlm_listen_for_all(void) SOCK_STREAM, dlm_proto_ops->proto, &sock);if (result <0 ) {log_print ("Can't create comms socket: %d" , result); - goto out; +return result; }sock_set_mark (sock->sk, dlm_config.ci_mark);
Greg Kroah-Hartman
maintainerPATCH 658/772 mm, compaction: fast_find_migrateblock() should return pfn in the target zone
In reply to Greg Kroah-HartmanFrom: Rei Yamamoto <[email protected]>
commit bbe832b9db2e1ad21522f8f0bf02775fff8a0e0e upstream.
At present, pages not in the target zone are added to cc->migratepages list in isolate_migratepages_block(). As a result, pages may migrate between nodes unintentionally.
This would be a serious problem for older kernels without commit a984226f457f849e ("mm: memcontrol: remove the pgdata parameter of mem_cgroup_page_lruvec"), because it can corrupt the lru list by handling pages in list without holding proper lru_lock.
Avoid returning a pfn outside the target zone in the case that it is not aligned with a pageblock boundary. Otherwise isolate_migratepages_block() will handle pages not in the target zone.
--- mm/compaction.c | 2 ++ 1 file changed, 2 insertions(+)
mm/compaction.c +2 -0
@@ -1821,6 +1821,8 @@ static unsigned long fast_find_migrateblupdate_fast_start_pfn (cc, free_pfn); pfn =pageblock_start_pfn (free_pfn); +if (pfn < cc->zone->zone_start_pfn) + pfn = cc->zone->zone_start_pfn; cc->fast_search_fail =0 ; found_block = true;set_pageblock_skip (freepage);
Greg Kroah-Hartman
maintainerPATCH 688/772 landlock: Fix same-layer rule unions
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit 8ba0005ff418ec356e176b26eaa04a6ac755d05b upstream.
The original behavior was to check if the full set of requested accesses was allowed by at least a rule of every relevant layer. This didn't take into account requests for multiple accesses and same-layer rules allowing the union of these accesses in a complementary way. As a result, multiple accesses requested on a file hierarchy matching rules that, together, allowed these accesses, but without a unique rule allowing all of them, was illegitimately denied. This case should be rare in practice and it can only be triggered by the path_rename or file_open hook implementations.
For instance, if, for the same layer, a rule allows execution beneath /a/b and another rule allows read beneath /a, requesting access to read and execute at the same time for /a/b should be allowed for this layer.
This was an inconsistency because the union of same-layer rule accesses was already allowed if requested once at a time anyway.
This fix changes the way allowed accesses are gathered over a path walk. To take into account all these rule accesses, we store in a matrix all layer granting the set of requested accesses, according to the handled accesses. To avoid heap allocation, we use an array on the stack which is 2*13 bytes. A following commit bringing the LANDLOCK_ACCESS_FS_REFER access right will increase this size to reach 112 bytes (2*14*4) in case of link or rename actions.
Add a new layout1.layer_rule_unions test to check that accesses from different rules pertaining to the same layer are ORed in a file hierarchy. Also test that it is not the case for rules from different layers.
--- security/landlock/fs.c | 80 ++++++++++++++------- security/landlock/ruleset.h | 2 tools/testing/selftests/landlock/fs_test.c | 107 +++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+), 27 deletions(-)
security/landlock/fs.c +53 -27
@@ -207,45 +207,67 @@ find_rule(const struct landlock_rulesetreturn rule; } -static inline layer_mask_t unmask_layers (const struct landlock_rule *const rule, -const access_mask_t access_request, -layer_mask_t layer_mask) +/* +* @layer_masks is read and may be updated according to the access request and +* the matching rule. +* +* Returns true if the request is allowed (i.e. relevant layer masks for the +* request are empty). +*/ +static inline bool +unmask_layers (const struct landlock_rule *const rule, +const access_mask_t access_request, +layer_mask_t (*const layer_masks)[LANDLOCK_NUM_ACCESS_FS ]) {size_t layer_level; +if (!access_request || !layer_masks) +return true;if (!rule) -return layer_mask; +return false;/* * An access is granted if, for each policy layer, at least one rule -* encountered on the pathwalk grants the requested accesses, -* regardless of their position in the layer stack. We must then check +* encountered on the pathwalk grants the requested access, +* regardless of its position in the layer stack. We must then check * the remaining layers for each inode, from the first added layer to -* the last one. +* the last one. When there is multiple requested accesses, for each +* policy layer, the full set of requested accesses may not be granted +* by only one rule, but by the union (binary OR) of multiple rules. +* E.g. /a/b <execute> + /a <read> => /a/b <execute + read> */ for (layer_level =0 ; layer_level < rule->num_layers; layer_level++) {const struct landlock_layer *const layer = &rule->layers[layer_level];const layer_mask_t layer_bit =BIT_ULL (layer->level -1 ); - -/* Checks that the layer grants access to the full request. */ -if ((layer->access & access_request) == access_request) { - layer_mask &= ~layer_bit; - -if (layer_mask ==0 ) -return layer_mask; +const unsigned long access_req = access_request; +unsigned long access_bit; +bool is_empty; + +/* +* Records in @layer_masks which layer grants access to each +* requested access. +*/ + is_empty = true; +for_each_set_bit (access_bit, &access_req, +ARRAY_SIZE (*layer_masks)) { +if (layer->access &BIT_ULL (access_bit)) + (*layer_masks)[access_bit] &= ~layer_bit; + is_empty = is_empty && !(*layer_masks)[access_bit]; } +if (is_empty) +return true; } -return layer_mask; +return false; }static int check_access_path (const struct landlock_ruleset *const domain,const struct path *const path,const access_mask_t access_request) { -bool allowed = false; +layer_mask_t layer_masks[LANDLOCK_NUM_ACCESS_FS ] = {}; +bool allowed = false, has_access = false;struct path walker_path; -layer_mask_t layer_mask;size_t i;if (!access_request)
@@ -265,13 +287,20 @@ static int check_access_path(const strucreturn -EACCES ;/* Saves all layers handling a subset of requested accesses. */ - layer_mask =0 ;for (i =0 ; i < domain->num_layers; i++) { -if (domain->fs_access_masks[i] & access_request) - layer_mask |=BIT_ULL (i); +const unsigned long access_req = access_request; +unsigned long access_bit; + +for_each_set_bit (access_bit, &access_req, +ARRAY_SIZE (layer_masks)) { +if (domain->fs_access_masks[i] &BIT_ULL (access_bit)) { + layer_masks[access_bit] |=BIT_ULL (i); + has_access = true; + } + } }/* An access request not handled by the domain is allowed. */ -if (layer_mask ==0 ) +if (!has_access)return 0 ; walker_path = *path;
@@ -283,14 +312,11 @@ static int check_access_path(const strucwhile (true) {struct dentry *parent_dentry; - layer_mask = -unmask_layers (find_rule (domain, walker_path.dentry), - access_request, layer_mask); -if (layer_mask ==0 ) { + allowed =unmask_layers (find_rule (domain, walker_path.dentry), + access_request, &layer_masks); +if (allowed)/* Stops when a rule from each layer grants access. */ - allowed = true;break ; - } jump_up:if (walker_path.dentry == walker_path.mnt->mnt_root) {
security/landlock/ruleset.h +2 -0
@@ -22,6 +22,8 @@typedef u16 access_mask_t ;/* Makes sure all filesystem access rights can be stored. */ static_assert (BITS_PER_TYPE (access_mask_t) >=LANDLOCK_NUM_ACCESS_FS ); +/* Makes sure for_each_set_bit() and for_each_clear_bit() calls are OK. */ +static_assert (sizeof (unsigned long ) >=sizeof (access_mask_t));typedef u16 layer_mask_t ;/* Makes sure all layers can be checked. */
tools/testing/selftests/landlock/fs_test.c +107 -0
113 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 657/772 block: Fix potential deadlock in blk_ia_range_sysfs_show()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 41e46b3c2aa24f755b2ae9ec4ce931ba5f0d8532 upstream.
When being read, a sysfs attribute is already protected against removal with the kobject node active reference counter. As a result, in blk_ia_range_sysfs_show(), there is no need to take the queue sysfs lock when reading the value of a range attribute. Using the queue sysfs lock in this function creates a potential deadlock situation with the disk removal, something that a lockdep signals with a splat when the device is removed:
[ 760.703551] Possible unsafe locking scenario: [ 760.703551] [ 760.703554] CPU0 CPU1 [ 760.703556] ---- ---- [ 760.703558] lock(&q->sysfs_lock); [ 760.703565] lock(kn->active#385); [ 760.703573] lock(&q->sysfs_lock); [ 760.703579] lock(kn->active#385); [ 760.703587] [ 760.703587] *** DEADLOCK ***
Solve this by removing the mutex_lock()/mutex_unlock() calls from blk_ia_range_sysfs_show().
--- block/blk-ia-ranges.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
block/blk-ia-ranges.c +1 -6
@@ -54,13 +54,8 @@ static ssize_t blk_ia_range_sysfs_show(s container_of(attr, struct blk_ia_range_sysfs_entry, attr);struct blk_independent_access_range *iar = container_of(kobj, struct blk_independent_access_range, kobj); -ssize_t ret; -mutex_lock (&iar->queue->sysfs_lock); - ret = entry->show (iar, buf); -mutex_unlock (&iar->queue->sysfs_lock); - -return ret; +return entry->show (iar, buf); }static const struct sysfs_ops blk_ia_range_sysfs_ops = {
Greg Kroah-Hartman
maintainerPATCH 656/772 staging: r8188eu: prevent ->Ssid overflow in rtw_wx_set_scan()
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
commit bc10916e890948d8927a5c8c40fb5dc44be5e1b8 upstream.
This code has a check to prevent read overflow but it needs another check to prevent writing beyond the end of the ->Ssid[] array.
--- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +4 -2
@@ -1181,9 +1181,11 @@ static int rtw_wx_set_scan(struct net_debreak ; } sec_len = *(pos++); len -=1 ; -if (sec_len >0 && sec_len <= len) { +if (sec_len >0 && + sec_len <= len && + sec_len <=32 ) { ssid[ssid_index].SsidLength = sec_len; -memcpy (ssid[ssid_index].Ssid, pos, ssid[ssid_index].SsidLength); +memcpy (ssid[ssid_index].Ssid, pos, sec_len); ssid_index++; } pos += sec_len;
Greg Kroah-Hartman
maintainerPATCH 655/772 PCI: qcom: Fix unbalanced PHY init on probe errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 83013631f0f9961416abd812e228c8efbc2f6069 upstream.
Undo the PHY initialisation (e.g. balance runtime PM) if host initialisation fails during probe.
--- drivers/pci/controller/dwc/pcie-qcom.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-qcom.c +3 -1
@@ -1601,11 +1601,13 @@ static int qcom_pcie_probe(struct platfo ret =dw_pcie_host_init (pp);if (ret) {dev_err (dev,"cannot initialize host\n" ); - goto err_pm_runtime_put; + goto err_phy_exit; }return 0 ; +err_phy_exit: +phy_exit (pcie->phy); err_pm_runtime_put:pm_runtime_put (dev);pm_runtime_disable (dev);
Greg Kroah-Hartman
maintainerPATCH 642/772 ext4: fix bug_on in ext4_writepages
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit ef09ed5d37b84d18562b30cf7253e57062d0db05 upstream.
we got issue as follows:
EXT4-fs error (device loop0): ext4_mb_generate_buddy:1141: group 0, block bitmap and bg descriptor inconsistent: 25 vs 31513 free cls
------------[ cut here ]------------ kernel BUG at fs/ext4/inode.c:2708! invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 2 PID: 2147 Comm: rep Not tainted 5.18.0-rc2-next-20220413+ #155 RIP: 0010:ext4_writepages+0x1977/0x1c10 RSP: 0018:ffff88811d3e7880 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffff88811c098000 RDX: 0000000000000000 RSI: ffff88811c098000 RDI: 0000000000000002 RBP: ffff888128140f50 R08: ffffffffb1ff6387 R09: 0000000000000000 R10: 0000000000000007 R11: ffffed10250281ea R12: 0000000000000001 R13: 00000000000000a4 R14: ffff88811d3e7bb8 R15: ffff888128141028 FS: 00007f443aed9740(0000) GS:ffff8883aef00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020007200 CR3: 000000011c2a4000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> do_writepages+0x130/0x3a0 filemap_fdatawrite_wbc+0x83/0xa0 filemap_flush+0xab/0xe0 ext4_alloc_da_blocks+0x51/0x120 __ext4_ioctl+0x1534/0x3210 __x64_sys_ioctl+0x12c/0x170 do_syscall_64+0x3b/0x90
It may happen as follows:
1. write inline_data inodevfs_write
new_sync_write
ext4_file_write_iter
ext4_buffered_write_iter
generic_perform_write
ext4_da_write_begin
ext4_da_write_inline_data_begin -> If inline data size too
small will allocate block to write, then mapping will has
dirty page
ext4_da_convert_inline_data_to_extent ->clear EXT4_STATE_MAY_INLINE_DATA
2. fallocate
do_vfs_ioctl
ioctl_preallocate
vfs_fallocate
ext4_fallocate
ext4_convert_inline_data
ext4_convert_inline_data_nolock
ext4_map_blocks -> fail will goto restore data
ext4_restore_inline_data
ext4_create_inline_data
ext4_write_inline_data
ext4_set_inode_state -> set inode EXT4_STATE_MAY_INLINE_DATA3. writepages__ext4_ioctl
ext4_alloc_da_blocks
filemap_flush
filemap_fdatawrite_wbc
do_writepages
ext4_writepages
if (ext4_has_inline_data(inode))
BUG_ON(ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA))
The root cause of this issue is we destory inline data until call ext4_writepages under delay allocation mode. But there maybe already convert from inline to extent. To solve this issue, we call filemap_flush first..
--- fs/ext4/inline.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/ext4/inline.c +12 -0
@@ -2005,6 +2005,18 @@ int ext4_convert_inline_data(struct inodif (!ext4_has_inline_data (inode)) {ext4_clear_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA );return 0 ; + }else if (!ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA )) { +/* +* Inode has inline data but EXT4_STATE_MAY_INLINE_DATA is +* cleared. This means we are in the middle of moving of +* inline data to delay allocated block. Just force writeout +* here to finish conversion. +*/ + error =filemap_flush (inode->i_mapping); +if (error) +return error; +if (!ext4_has_inline_data (inode)) +return 0 ; } needed_blocks =ext4_writepage_trans_blocks (inode);
Greg Kroah-Hartman
maintainerPATCH 683/772 landlock: Change landlock_restrict_self(2) check ordering
In reply to Greg Kroah-HartmanFrom: Mickaël Salaün <[email protected]>
commit eba39ca4b155c54adf471a69e91799cc1727873f upstream.
According to the Landlock goal to be a security feature available to unprivileges processes, it makes more sense to first check for no_new_privs before checking anything else (i.e. syscall arguments).
Merge inval_fd_enforce and unpriv_enforce_without_no_new_privs tests into the new restrict_self_checks_ordering. This is similar to the previous commit checking other syscalls.
--- security/landlock/syscalls.c | 8 ++-- tools/testing/selftests/landlock/base_test.c | 47 +++++++++++++++++++++------ 2 files changed, 41 insertions(+), 14 deletions(-)
security/landlock/syscalls.c +4 -4
@@ -405,10 +405,6 @@ SYSCALL_DEFINE2(landlock_restrict_self,if (!landlock_initialized)return -EOPNOTSUPP ; -/* No flag for now. */ -if (flags) -return -EINVAL ; -/* * Similar checks as for seccomp(2), except that an -EPERM may be * returned.
@@ -417,6 +413,10 @@ SYSCALL_DEFINE2(landlock_restrict_self, !ns_capable_noaudit(current_user_ns(), CAP_SYS_ADMIN))return -EPERM ; +/* No flag for now. */ +if (flags) +return -EINVAL ; +/* Gets and checks the ruleset. */ ruleset =get_ruleset_from_fd (ruleset_fd,FMODE_CAN_READ );if (IS_ERR (ruleset))
tools/testing/selftests/landlock/base_test.c +37 -10
59 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 733/772 bcache: improve multithreaded bch_btree_check()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
commit 622536443b6731ec82c563aae7807165adbe9178 upstream.
Commit 8e7102273f59 ("bcache: make bch_btree_check() to be multithreaded") makes bch_btree_check() to be much faster when checking all btree nodes during cache device registration. But it isn't in ideal shap yet, still can be improved.
This patch does the following thing to improve current parallel btree nodes check by multiple threads in bch_btree_check(),
- Add read lock to root node while checking all the btree nodes with multiple threads. Although currently it is not mandatory but it is good to have a read lock in code logic.
- Remove local variable 'char name[32]', and generate kernel thread name string directly when calling kthread_run().
- Allocate local variable "struct btree_check_state check_state" on the stack and avoid unnecessary dynamic memory allocation for it.
- Reduce BCH_BTR_CHKTHREAD_MAX from 64 to 12 which is enough indeed.
- Increase check_state->started to count created kernel thread after it succeeds to create.
- When wait for all checking kernel threads to finish, use wait_event() to replace wait_event_interruptible().
With this change, the code is more clear, and some potential error conditions are avoided.
--- drivers/md/bcache/btree.c | 58 ++++++++++++++++++++-------------------------- drivers/md/bcache/btree.h | 2 - 2 files changed, 27 insertions(+), 33 deletions(-)
drivers/md/bcache/btree.c +26 -32
@@ -2006,8 +2006,7 @@ int bch_btree_check(struct cache_set *c)int i;struct bkey *k =NULL ;struct btree_iter iter; -struct btree_check_state *check_state; -char name[32 ]; +struct btree_check_state check_state;/* check and mark root node keys */ for_each_key_filter (&c->root->keys, k, &iter, bch_ptr_invalid)
@@ -2018,63 +2017,58 @@ int bch_btree_check(struct cache_set *c)if (c->root->level ==0 )return 0 ; - check_state =kzalloc (sizeof (struct btree_check_state ),GFP_KERNEL ); -if (!check_state) -return -ENOMEM ; - - check_state->c = c; - check_state->total_threads =bch_btree_chkthread_nr (); - check_state->key_idx =0 ; -spin_lock_init (&check_state->idx_lock); -atomic_set (&check_state->started,0 ); -atomic_set (&check_state->enough,0 ); -init_waitqueue_head (&check_state->wait); + check_state.c = c; + check_state.total_threads =bch_btree_chkthread_nr (); + check_state.key_idx =0 ; +spin_lock_init (&check_state.idx_lock); +atomic_set (&check_state.started,0 ); +atomic_set (&check_state.enough,0 ); +init_waitqueue_head (&check_state.wait); +rw_lock (0 , c->root, c->root->level);/* * Run multiple threads to check btree nodes in parallel, -* if check_state->enough is non-zero, it means current +* if check_state.enough is non-zero, it means current * running check threads are enough, unncessary to create * more. */ -for (i =0 ; i < check_state->total_threads; i++) { -/* fetch latest check_state->enough earlier */ +for (i =0 ; i < check_state.total_threads; i++) { +/* fetch latest check_state.enough earlier */ smp_mb__before_atomic (); -if (atomic_read (&check_state->enough)) +if (atomic_read (&check_state.enough))break ; - check_state->infos[i].result =0 ; - check_state->infos[i].state = check_state; -snprintf (name,sizeof (name),"bch_btrchk[%u]" , i); -atomic_inc (&check_state->started); + check_state.infos[i].result =0 ; + check_state.infos[i].state = &check_state; - check_state->infos[i].thread = + check_state.infos[i].thread =kthread_run (bch_btree_check_thread, - &check_state->infos[i], - name); -if (IS_ERR (check_state->infos[i].thread)) { + &check_state.infos[i], +"bch_btrchk[%d]" , i); +if (IS_ERR (check_state.infos[i].thread)) {pr_err ("fails to run thread bch_btrchk[%d]\n" , i);for (--i; i >=0 ; i--) -kthread_stop (check_state->infos[i].thread); +kthread_stop (check_state.infos[i].thread); ret = -ENOMEM ; goto out; } +atomic_inc (&check_state.started); }/* * Must wait for all threads to stop. */ -wait_event_interruptible (check_state->wait, -atomic_read (&check_state->started) ==0 ); +wait_event (check_state.wait,atomic_read (&check_state.started) ==0 ); -for (i =0 ; i < check_state->total_threads; i++) { -if (check_state->infos[i].result) { - ret = check_state->infos[i].result; +for (i =0 ; i < check_state.total_threads; i++) { +if (check_state.infos[i].result) { + ret = check_state.infos[i].result; goto out; } } out: -kfree (check_state); +rw_unlock (0 , c->root);return ret; }
drivers/md/bcache/btree.h +1 -1
@@ -226,7 +226,7 @@ struct btree_check_info {int result; }; -#define BCH_BTR_CHKTHREAD_MAX 64 +#define BCH_BTR_CHKTHREAD_MAX 12struct btree_check_state {struct cache_set *c;int total_threads;
Greg Kroah-Hartman
maintainerPATCH 645/772 ext4: verify dir block before splitting it
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 46c116b920ebec58031f0a78c5ea9599b0d2a371 upstream.
Before splitting a directory block verify its directory entries are sane so that the splitting code does not access memory it should not.
--- fs/ext4/namei.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
fs/ext4/namei.c +21 -11
@@ -277,9 +277,9 @@ static struct dx_frame *dx_probe(structstruct dx_hash_info *hinfo, struct dx_frame *frame);static void dx_release (struct dx_frame *frames); -static int dx_make_map (struct inode *dir,struct ext4_dir_entry_2 *de, -unsigned blocksize,struct dx_hash_info *hinfo, -struct dx_map_entry map[]); +static int dx_make_map (struct inode *dir,struct buffer_head *bh, +struct dx_hash_info *hinfo, +struct dx_map_entry *map_tail);static void dx_sort_map (struct dx_map_entry *map,unsigned count); static struct ext4_dir_entry_2 *dx_move_dirents(struct inode *dir, char *from, char *to, struct dx_map_entry *offsets,
@@ -1249,15 +1249,23 @@ static inline int search_dirblock(struct* Create map of hash values, offsets, and sizes, stored at end of block. * Returns number of entries mapped. */ -static int dx_make_map (struct inode *dir,struct ext4_dir_entry_2 *de, -unsigned blocksize,struct dx_hash_info *hinfo, +static int dx_make_map (struct inode *dir,struct buffer_head *bh, +struct dx_hash_info *hinfo,struct dx_map_entry *map_tail) {int count =0 ; -char *base = (char *) de; +struct ext4_dir_entry_2 *de = (struct ext4_dir_entry_2 *)bh->b_data; +unsigned int buflen = bh->b_size; +char *base = bh->b_data;struct dx_hash_info h = *hinfo; -while ((char *) de < base + blocksize) { +if (ext4_has_metadata_csum (dir->i_sb)) + buflen -=sizeof (struct ext4_dir_entry_tail ); + +while ((char *) de < base + buflen) { +if (ext4_check_dir_entry (dir,NULL , de, bh, base, buflen, + ((char *)de) - base)) +return -EFSCORRUPTED ;if (de->name_len && de->inode) {if (ext4_hash_in_dirent (dir)) h.hash =EXT4_DIRENT_HASH (de);
@@ -1270,8 +1278,7 @@ static int dx_make_map(struct inode *dir count++;cond_resched (); } -/* XXX: do we need to check rec_len == 0 case? -Chris */ - de =ext4_next_entry (de, blocksize); + de =ext4_next_entry (de, dir->i_sb->s_blocksize); }return count; }
@@ -1943,8 +1950,11 @@ static struct ext4_dir_entry_2 *do_split/* create map in the end of data2 block */ map = (struct dx_map_entry *) (data2 + blocksize); - count =dx_make_map (dir, (struct ext4_dir_entry_2 *) data1, - blocksize, hinfo, map); + count =dx_make_map (dir, *bh, hinfo, map); +if (count <0 ) { + err = count; + goto journal_error; + } map -= count;dx_sort_map (map, count);/* Ensure that neither split block is over half full */
Greg Kroah-Hartman
maintainerPATCH 654/772 PCI: qcom: Fix runtime PM imbalance on probe errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 87d83b96c8d6c6c2d2096bd0bdba73bcf42b8ef0 upstream.
Drop the leftover pm_runtime_disable() calls from the late probe error paths that would, for example, prevent runtime PM from being reenabled after a probe deferral.
--- drivers/pci/controller/dwc/pcie-qcom.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pci/controller/dwc/pcie-qcom.c +1 -4
@@ -1593,17 +1593,14 @@ static int qcom_pcie_probe(struct platfo pp->ops = &qcom_pcie_dw_ops; ret =phy_init (pcie->phy); -if (ret) { -pm_runtime_disable (&pdev->dev); +if (ret) goto err_pm_runtime_put; - }platform_set_drvdata (pdev, pcie); ret =dw_pcie_host_init (pp);if (ret) {dev_err (dev,"cannot initialize host\n" ); -pm_runtime_disable (&pdev->dev); goto err_pm_runtime_put; }
Greg Kroah-Hartman
maintainerPATCH 745/772 ARM: pxa: maybe fix gpio lookup tables
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 2672a4bff6c03a20d5ae460a091f67ee782c3eff upstream.
Quoted 1 line
From inspection I found a couple of GPIO lookups that are
listed with device "gpio-pxa", but actually have a number from a different gpio controller.
Try to rectify that here, with a guess of what the actual device name is.
--- arch/arm/mach-pxa/cm-x300.c | 8 ++++---- arch/arm/mach-pxa/magician.c | 2 +- arch/arm/mach-pxa/tosa.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-pxa/cm-x300.c +4 -4
@@ -354,13 +354,13 @@ static struct platform_device cm_x300_spstatic struct gpiod_lookup_table cm_x300_spi_gpiod_table = { .dev_id ="spi_gpio" , .table = { -GPIO_LOOKUP ("gpio-pxa" ,GPIO_LCD_SCL , +GPIO_LOOKUP ("pca9555.1" ,GPIO_LCD_SCL -GPIO_LCD_BASE ,"sck" ,GPIO_ACTIVE_HIGH ), -GPIO_LOOKUP ("gpio-pxa" ,GPIO_LCD_DIN , +GPIO_LOOKUP ("pca9555.1" ,GPIO_LCD_DIN -GPIO_LCD_BASE ,"mosi" ,GPIO_ACTIVE_HIGH ), -GPIO_LOOKUP ("gpio-pxa" ,GPIO_LCD_DOUT , +GPIO_LOOKUP ("pca9555.1" ,GPIO_LCD_DOUT -GPIO_LCD_BASE ,"miso" ,GPIO_ACTIVE_HIGH ), -GPIO_LOOKUP ("gpio-pxa" ,GPIO_LCD_CS , +GPIO_LOOKUP ("pca9555.1" ,GPIO_LCD_CS -GPIO_LCD_BASE ,"cs" ,GPIO_ACTIVE_HIGH ), { }, },
arch/arm/mach-pxa/magician.c +1 -1
@@ -681,7 +681,7 @@ static struct platform_device bq24022 =static struct gpiod_lookup_table bq24022_gpiod_table = { .dev_id ="gpio-regulator" , .table = { -GPIO_LOOKUP ("gpio-pxa" ,EGPIO_MAGICIAN_BQ24022_ISET2 , +GPIO_LOOKUP ("htc-egpio-0" ,EGPIO_MAGICIAN_BQ24022_ISET2 -MAGICIAN_EGPIO_BASE ,NULL ,GPIO_ACTIVE_HIGH ),GPIO_LOOKUP ("gpio-pxa" , GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,"enable" ,GPIO_ACTIVE_LOW ),
arch/arm/mach-pxa/tosa.c +2 -2
@@ -296,9 +296,9 @@ static struct gpiod_lookup_table tosa_mc .table = {GPIO_LOOKUP ("gpio-pxa" , TOSA_GPIO_nSD_DETECT,"cd" ,GPIO_ACTIVE_LOW ), -GPIO_LOOKUP ("gpio-pxa" ,TOSA_GPIO_SD_WP , +GPIO_LOOKUP ("sharp-scoop.0" ,TOSA_GPIO_SD_WP -TOSA_SCOOP_GPIO_BASE ,"wp" ,GPIO_ACTIVE_LOW ), -GPIO_LOOKUP ("gpio-pxa" ,TOSA_GPIO_PWR_ON , +GPIO_LOOKUP ("sharp-scoop.0" ,TOSA_GPIO_PWR_ON -TOSA_SCOOP_GPIO_BASE , "power", GPIO_ACTIVE_HIGH), { }, },
Greg Kroah-Hartman
maintainerPATCH 606/772 NFSv4: Fix free of uninitialized nfs4_label on referral lookup.
In reply to Greg Kroah-HartmanFrom: Benjamin Coddington <[email protected]>
[ Upstream commit c3ed222745d9ad7b69299b349a64ba533c64a34f ]
Send along the already-allocated fattr along with nfs4_fs_locations, and drop the memcpy of fattr. We end up growing two more allocations, but this fixes up a crash as:
PID: 790 TASK: ffff88811b43c000 CPU: 0 COMMAND: "ls"
#0 [ffffc90000857920] panic at ffffffff81b9bfde
#1 [ffffc900008579c0] do_trap at ffffffff81023a9b
#2 [ffffc90000857a10] do_error_trap at ffffffff81023b78 #3 [ffffc90000857a58] exc_stack_segment at ffffffff81be1f45 #4 [ffffc90000857a80] asm_exc_stack_segment at ffffffff81c009de #5 [ffffc90000857b08] nfs_lookup at ffffffffa0302322 [nfs] #6 [ffffc90000857b70] __lookup_slow at ffffffff813a4a5f #7 [ffffc90000857c60] walk_component at ffffffff813a86c4 #8 [ffffc90000857cb8] path_lookupat at ffffffff813a9553 #9 [ffffc90000857cf0] filename_lookup at ffffffff813ab86b
--- fs/nfs/nfs4namespace.c | 9 +++++++-- fs/nfs/nfs4proc.c | 15 +++++++-------- fs/nfs/nfs4state.c | 9 ++++++++- fs/nfs/nfs4xdr.c | 4 ++-- include/linux/nfs_xdr.h | 2 +- 5 files changed, 25 insertions(+), 14 deletions(-)
fs/nfs/nfs4namespace.c +7 -2
@@ -417,6 +417,9 @@ static int nfs_do_refmount(struct fs_context *fc, struct rpc_clnt *client) fs_locations =kmalloc (sizeof (struct nfs4_fs_locations ),GFP_KERNEL );if (!fs_locations) goto out_free; + fs_locations->fattr =nfs_alloc_fattr (); +if (!fs_locations->fattr) + goto out_free_2;/* Get locations */ dentry = ctx->clone_data.dentry;
@@ -427,14 +430,16 @@ static int nfs_do_refmount(struct fs_context *fc, struct rpc_clnt *client) err =nfs4_proc_fs_locations (client,d_inode (parent), &dentry->d_name, fs_locations, page);dput (parent);if (err !=0 ) - goto out_free_2; + goto out_free_3; err = -ENOENT ;if (fs_locations->nlocations <=0 || fs_locations->fs_path.ncomponents <=0 ) - goto out_free_2; + goto out_free_3; err =nfs_follow_referral (fc, fs_locations); +out_free_3: +kfree (fs_locations->fattr); out_free_2:kfree (fs_locations); out_free:
fs/nfs/nfs4proc.c +7 -8
@@ -4246,6 +4246,8 @@ static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir,if (locations ==NULL ) goto out; + locations->fattr = fattr; + status =nfs4_proc_fs_locations (client, dir, name, locations, page);if (status !=0 ) goto out;
@@ -4255,17 +4257,14 @@ static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir,* referral. Cause us to drop into the exception handler, which * will kick off migration recovery. */ -if (nfs_fsid_equal (&NFS_SERVER (dir)->fsid, &locations->fattr.fsid)) { +if (nfs_fsid_equal (&NFS_SERVER (dir)->fsid, &fattr->fsid)) {dprintk ("%s: server did not return a different fsid for" " a referral at %s\n" , __func__, name->name); status = -NFS4ERR_MOVED ; goto out; }/* Fixup attributes for the nfs_lookup() call to nfs_fhget() */ -nfs_fixup_referral_attributes (&locations->fattr); - -/* replace the lookup nfs_fattr with the locations nfs_fattr */ -memcpy (fattr, &locations->fattr,sizeof (struct nfs_fattr )); +nfs_fixup_referral_attributes (fattr);memset (fhandle,0 ,sizeof (struct nfs_fh )); out:if (page)
@@ -7906,7 +7905,7 @@ static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,else bitmask[1 ] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID ; -nfs_fattr_init (&fs_locations->fattr); +nfs_fattr_init (fs_locations->fattr); fs_locations->server = server; fs_locations->nlocations =0 ; status =nfs4_call_sync (client, server, &msg, &args.seq_args, &res.seq_res,0 );
@@ -7971,7 +7970,7 @@ static int _nfs40_proc_get_locations(struct nfs_server *server,unsigned long now = jiffies;int status; -nfs_fattr_init (&locations->fattr); +nfs_fattr_init (locations->fattr); locations->server = server; locations->nlocations =0 ;
@@ -8024,7 +8023,7 @@ static int _nfs41_proc_get_locations(struct nfs_server *server, };int status; -nfs_fattr_init (&locations->fattr); +nfs_fattr_init (locations->fattr); locations->server = server; locations->nlocations =0 ;
fs/nfs/nfs4state.c +8 -1
@@ -2097,6 +2097,11 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *creddprintk ("<-- %s: no memory\n" , __func__); goto out; } + locations->fattr =nfs_alloc_fattr (); +if (locations->fattr ==NULL ) { +dprintk ("<-- %s: no memory\n" , __func__); + goto out; + } inode =d_inode (server->super->s_root); result = nfs4_proc_get_locations(server, NFS_FH(inode), locations,
@@ -2111,7 +2116,7 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *credif (!locations->nlocations) goto out; -if (!(locations->fattr.valid &NFS_ATTR_FATTR_V4_LOCATIONS )) { +if (!(locations->fattr->valid &NFS_ATTR_FATTR_V4_LOCATIONS )) {dprintk ("<-- %s: No fs_locations data, migration skipped\n" , __func__); goto out;
@@ -2136,6 +2141,8 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred out:if (page !=NULL )__free_page (page); +if (locations !=NULL ) +kfree (locations->fattr);kfree (locations);if (result) { pr_err("NFS: migration recovery failed (server %s)\n",
fs/nfs/nfs4xdr.c +2 -2
@@ -7051,7 +7051,7 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req,if (res->migration) {xdr_enter_page (xdr,PAGE_SIZE ); status =decode_getfattr_generic (xdr, - &res->fs_locations->fattr, + res->fs_locations->fattr,NULL , res->fs_locations, res->fs_locations->server);if (status)
@@ -7064,7 +7064,7 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, goto out;xdr_enter_page (xdr,PAGE_SIZE ); status =decode_getfattr_generic (xdr, - &res->fs_locations->fattr, + res->fs_locations->fattr,NULL , res->fs_locations, res->fs_locations->server); }
include/linux/nfs_xdr.h +1 -1
@@ -1213,7 +1213,7 @@ struct nfs4_fs_location {#define NFS4_FS_LOCATIONS_MAXENTRIES 10struct nfs4_fs_locations { -struct nfs_fattr fattr; +struct nfs_fattr *fattr;const struct nfs_server *server;struct nfs4_pathname fs_path;int nlocations;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 639/772 ext4: fix race condition between ext4_write and ext4_convert_inline_data
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit f87c7a4b084afc13190cbb263538e444cb2b392a upstream.
Hulk Robot reported a BUG_ON:
==================================================================
EXT4-fs error (device loop3): ext4_mb_generate_buddy:805: group 0, block bitmap and bg descriptor inconsistent: 25 vs 31513 free clusters kernel BUG at fs/ext4/ext4_jbd2.c:53!
invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 0 PID: 25371 Comm: syz-executor.3 Not tainted 5.10.0+ #1 RIP: 0010:ext4_put_nojournal fs/ext4/ext4_jbd2.c:53 [inline] RIP: 0010:__ext4_journal_stop+0x10e/0x110 fs/ext4/ext4_jbd2.c:116 [...] Call Trace: ext4_write_inline_data_end+0x59a/0x730 fs/ext4/inline.c:795 generic_perform_write+0x279/0x3c0 mm/filemap.c:3344 ext4_buffered_write_iter+0x2e3/0x3d0 fs/ext4/file.c:270 ext4_file_write_iter+0x30a/0x11c0 fs/ext4/file.c:520 do_iter_readv_writev+0x339/0x3c0 fs/read_write.c:732 do_iter_write+0x107/0x430 fs/read_write.c:861 vfs_writev fs/read_write.c:934 [inline] do_pwritev+0x1e5/0x380 fs/read_write.c:1031 [...] ==================================================================
Above issue may happen as follows:
cpu1 cpu2
__________________________|__________________________ do_pwritev
vfs_writev
do_iter_write
ext4_file_write_iter
ext4_buffered_write_iter
generic_perform_write
ext4_da_write_begin
vfs_fallocate
ext4_fallocate
ext4_convert_inline_data
ext4_convert_inline_data_nolock
ext4_destroy_inline_data_nolock
clear EXT4_STATE_MAY_INLINE_DATA
ext4_map_blocks
ext4_ext_map_blocks
ext4_mb_new_blocks
ext4_mb_regular_allocator
ext4_mb_good_group_nolock
ext4_mb_init_group
ext4_mb_init_cache
ext4_mb_generate_buddy --> error
ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)
ext4_restore_inline_data
set EXT4_STATE_MAY_INLINE_DATA
ext4_block_write_begin
ext4_da_write_end
ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)
ext4_write_inline_data_end
handle=NULL
ext4_journal_stop(handle)
__ext4_journal_stop
ext4_put_nojournal(handle)
ref_cnt = (unsigned long)handle
BUG_ON(ref_cnt == 0) ---> BUG_ONThe lock held by ext4_convert_inline_data is xattr_sem, but the lock held by generic_perform_write is i_rwsem. Therefore, the two locks can be concurrent.
To solve above issue, we add inode_lock() for ext4_convert_inline_data(). At the same time, move ext4_convert_inline_data() in front of ext4_punch_hole(), remove similar handling from ext4_punch_hole().
--- fs/ext4/extents.c | 10 ++++++---- fs/ext4/inode.c | 9 --------- 2 files changed, 6 insertions(+), 13 deletions(-)
fs/ext4/extents.c +6 -4
@@ -4694,15 +4694,17 @@ long ext4_fallocate(struct file *file, i FALLOC_FL_INSERT_RANGE))return -EOPNOTSUPP ; +inode_lock (inode); + ret =ext4_convert_inline_data (inode); +inode_unlock (inode); +if (ret) + goto exit; +if (mode &FALLOC_FL_PUNCH_HOLE ) { ret =ext4_punch_hole (file, offset, len); goto exit; } - ret =ext4_convert_inline_data (inode); -if (ret) - goto exit; -if (mode &FALLOC_FL_COLLAPSE_RANGE ) { ret =ext4_collapse_range (file, offset, len); goto exit;
fs/ext4/inode.c +0 -9
@@ -3958,15 +3958,6 @@ int ext4_punch_hole(struct file *file, ltrace_ext4_punch_hole (inode, offset, length,0 ); -ext4_clear_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA ); -if (ext4_has_inline_data (inode)) { -filemap_invalidate_lock (mapping); - ret =ext4_convert_inline_data (inode); -filemap_invalidate_unlock (mapping); -if (ret) -return ret; - } -/* * Write out all dirty pages to avoid race conditions * Then release them.
Greg Kroah-Hartman
maintainerPATCH 746/772 ceph: fix decoding of client session messages flags
In reply to Greg Kroah-HartmanFrom: Luís Henriques <[email protected]>
commit ea16567f11018e2f58e72b667b0c803ff92b8153 upstream.
The cephfs kernel client started to show the message:
ceph: mds0 session blocklisted
when mounting a filesystem. This is due to the fact that the session messages are being incorrectly decoded: the skip needs to take into account the 'len'.
While there, fixed some whitespaces too.
--- fs/ceph/mds_client.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
fs/ceph/mds_client.c +9 -5
@@ -3378,13 +3378,17 @@ static void handle_session(struct ceph_m }if (msg_version >=5 ) { -u32 flags; -/* version >= 4, struct_v, struct_cv, len, metric_spec */ -ceph_decode_skip_n (&p, end,2 +sizeof (u32) *2 , bad); +u32 flags, len; + +/* version >= 4 */ +ceph_decode_skip_16 (&p, end, bad);/* struct_v, struct_cv */ +ceph_decode_32_safe (&p, end, len, bad);/* len */ +ceph_decode_skip_n (&p, end, len, bad);/* metric_spec */ +/* version >= 5, flags */ -ceph_decode_32_safe (&p, end, flags, bad); +ceph_decode_32_safe (&p, end, flags, bad);if (flags &CEPH_SESSION_BLOCKLISTED ) { -pr_warn ("mds%d session blocklisted\n" , session->s_mds); +pr_warn ("mds%d session blocklisted\n" , session->s_mds); blocklisted = true; } }
Greg Kroah-Hartman
maintainerPATCH 744/772 ARM: dts: s5pv210: Remove spi-cs-high on panel in Aries
In reply to Greg Kroah-HartmanFrom: Jonathan Bakker <[email protected]>
commit 096f58507374e1293a9e9cff8a1ccd5f37780a20 upstream.
Since commit 766c6b63aa04 ("spi: fix client driver breakages when using GPIO descriptors"), the panel has been blank due to an inverted CS GPIO. In order to correct this, drop the spi-cs-high from the panel SPI device.
--- arch/arm/boot/dts/s5pv210-aries.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm/boot/dts/s5pv210-aries.dtsi +0 -1
@@ -564,7 +564,6 @@ reset-gpios = <&mp05 5 GPIO_ACTIVE_LOW>; vdd3-supply = <&ldo7_reg>; vci-supply = <&ldo17_reg>; - spi-cs-high; spi-max-frequency = <1200000>; pinctrl-names = "default";
Greg Kroah-Hartman
maintainerPATCH 743/772 phy: qcom-qmp: fix struct clk leak on probe errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit f0a4bc38a12f5a0cc5ad68670d9480e91e6a94df upstream.
Make sure to release the pipe clock reference in case of a late probe error (e.g. probe deferral).
--- drivers/phy/qualcomm/phy-qcom-qmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp.c +1 -1
@@ -5890,7 +5890,7 @@ int qcom_qmp_phy_create(struct device *d* all phys that don't need this. */ snprintf (prop_name,sizeof (prop_name),"pipe%d" , id); - qphy->pipe_clk =of_clk_get_by_name (np, prop_name); + qphy->pipe_clk =devm_get_clk_from_child (dev, np, prop_name);if (IS_ERR (qphy->pipe_clk)) {if (cfg->type ==PHY_TYPE_PCIE || cfg->type ==PHY_TYPE_USB3 ) {
Greg Kroah-Hartman
maintainerPATCH 609/772 f2fs: fix to avoid f2fs_bug_on() in dec_valid_node_count()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 4d17e6fe9293d57081ffdc11e1cf313e25e8fd9e upstream.
As Yanming reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=215897
I have encountered a bug in F2FS file system in kernel v5.17.
The kernel should enable CONFIG_KASAN=y and CONFIG_KASAN_INLINE=y. You can reproduce the bug by running the following commands:
The kernel message is shown below:
kernel BUG at fs/f2fs/f2fs.h:2511!
Call Trace: f2fs_remove_inode_page+0x2a2/0x830 f2fs_evict_inode+0x9b7/0x1510 evict+0x282/0x4e0 do_unlinkat+0x33a/0x540 __x64_sys_unlinkat+0x8e/0xd0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
The root cause is: .total_valid_block_count or .total_valid_node_count could fuzzed to zero, then once dec_valid_node_count() was called, it will cause BUG_ON(), this patch fixes to print warning info and set SBI_NEED_FSCK into CP instead of panic.
--- fs/f2fs/f2fs.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
fs/f2fs/f2fs.h +10 -4
@@ -2509,11 +2509,17 @@ static inline void dec_valid_node_count( {spin_lock (&sbi->stat_lock); -f2fs_bug_on (sbi, !sbi->total_valid_block_count); -f2fs_bug_on (sbi, !sbi->total_valid_node_count); +if (unlikely (!sbi->total_valid_block_count || + !sbi->total_valid_node_count)) { +f2fs_warn (sbi,"dec_valid_node_count: inconsistent block counts, total_valid_block:%u, total_valid_node:%u" , + sbi->total_valid_block_count, + sbi->total_valid_node_count); +set_sbi_flag (sbi,SBI_NEED_FSCK ); + }else { + sbi->total_valid_block_count--; + sbi->total_valid_node_count--; + } - sbi->total_valid_node_count--; - sbi->total_valid_block_count--;if (sbi->reserved_blocks && sbi->current_reserved_blocks < sbi->reserved_blocks) sbi->current_reserved_blocks++;
Greg Kroah-Hartman
maintainerPATCH 742/772 clk: tegra: Add missing reset deassertion
In reply to Greg Kroah-HartmanFrom: Diogo Ivo <[email protected]>
commit 23a43cc437e747473d5f8f98b4fe189fb5c433b7 upstream.
Commit 4782c0a5dd88 ("clk: tegra: Don't deassert reset on enabling clocks") removed deassertion of reset lines when enabling peripheral clocks. This breaks the initialization of the DFLL driver which relied on this behaviour.
Fix this problem by adding explicit deassert/assert requests to the driver. Tested on Google Pixel C.
--- drivers/clk/tegra/clk-dfll.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/clk/tegra/clk-dfll.c +12 -0
@@ -271,6 +271,7 @@ struct tegra_dfll {struct clk *ref_clk;struct clk *i2c_clk;struct clk *dfll_clk; +struct reset_control *dfll_rst;struct reset_control *dvco_rst;unsigned long ref_rate;unsigned long i2c_clk_rate;
@@ -1464,6 +1465,7 @@ static int dfll_init(struct tegra_dfll *return -EINVAL ; } +reset_control_deassert (td->dfll_rst);reset_control_deassert (td->dvco_rst); ret =clk_prepare (td->ref_clk);
@@ -1509,6 +1511,7 @@ di_err1:clk_unprepare (td->ref_clk);reset_control_assert (td->dvco_rst); +reset_control_assert (td->dfll_rst);return ret; }
@@ -1530,6 +1533,7 @@ int tegra_dfll_suspend(struct device *de }reset_control_assert (td->dvco_rst); +reset_control_assert (td->dfll_rst);return 0 ; }
@@ -1548,6 +1552,7 @@ int tegra_dfll_resume(struct device *dev {struct tegra_dfll *td =dev_get_drvdata (dev); +reset_control_deassert (td->dfll_rst);reset_control_deassert (td->dvco_rst);pm_runtime_get_sync (td->dev);
@@ -1951,6 +1956,12 @@ int tegra_dfll_register(struct platform_ td->soc = soc; + td->dfll_rst =devm_reset_control_get_optional (td->dev,"dfll" ); +if (IS_ERR (td->dfll_rst)) { +dev_err (td->dev,"couldn't get dfll reset\n" ); +return PTR_ERR (td->dfll_rst); + } + td->dvco_rst =devm_reset_control_get (td->dev,"dvco" );if (IS_ERR (td->dvco_rst)) {dev_err (td->dev,"couldn't get dvco reset\n" );
@@ -2087,6 +2098,7 @@ struct tegra_dfll_soc_data *tegra_dfll_uclk_unprepare (td->i2c_clk);reset_control_assert (td->dvco_rst); +reset_control_assert (td->dfll_rst);return td->soc; }
Greg Kroah-Hartman
maintainerPATCH 747/772 SMB3: EBADF/EIO errors in rename/open caused by race condition in smb2_compound_op
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit 0a55cf74ffb5d004b93647e4389096880ce37d6b upstream.
There is a race condition in smb2_compound_op:
after_close:
num_rqst++;
if (cfile) {
cifsFileInfo_put(cfile); // sends SMB2_CLOSE to the server
cfile = NULL;This is triggered by smb2_query_path_info operation that happens during revalidate_dentry. In smb2_query_path_info, get_readable_path is called to load the cfile, increasing the reference counter. If in the meantime, this reference becomes the very last, this call to cifsFileInfo_put(cfile) will trigger a SMB2_CLOSE request sent to the server just before sending this compound request – and so then the compound request fails either with EBADF/EIO depending on the timing at the server, because the handle is already closed.
In the first scenario, the race seems to be happening between smb2_query_path_info triggered by the rename operation, and between “cleanup” of asynchronous writes – while fsync(fd) likely waits for the asynchronous writes to complete, releasing the writeback structures can happen after the close(fd) call. So the EBADF/EIO errors will pop up if the timing is such that:
1) There are still outstanding references after close(fd) in the writeback structures
2) smb2_query_path_info successfully fetches the cfile, increasing the refcounter by 1
3) All writeback structures release the same cfile, reducing refcounter to 1
4) smb2_compound_op is called with that cfile
In the second scenario, the race seems to be similar – here open triggers the smb2_query_path_info operation, and if all other threads in the meantime decrease the refcounter to 1 similarly to the first scenario, again SMB2_CLOSE will be sent to the server just before issuing the compound request. This case is harder to reproduce.
See https://bugzilla.samba.org/show_bug.cgi?id=15051
--- fs/cifs/smb2inode.c | 2 -- 1 file changed, 2 deletions(-)
fs/cifs/smb2inode.c +0 -2
@@ -362,8 +362,6 @@ smb2_compound_op(const unsigned int xid, num_rqst++;if (cfile) { -cifsFileInfo_put (cfile); - cfile =NULL ; rc = compound_send_recv(xid, ses, server, flags, num_rqst - 2, &rqst[1], &resp_buftype[1],
Greg Kroah-Hartman
maintainerPATCH 748/772 docs/conf.py: Cope with removal of language=None in Sphinx 5.0.0
In reply to Greg Kroah-HartmanFrom: Akira Yokosawa <[email protected]>
commit 627f01eab93d8671d4e4afee9b148f9998d20e7c upstream.
One of the changes in Sphinx 5.0.0 [1] says [sic]:
5.0.0 final
- #10474: language does not accept None as it value. The default value of language becomes to 'en' now.
[1]: https://www.sphinx-doc.org/en/master/changes.html#release-5-0-0-released-may-30-2022
It results in a new warning from Sphinx 5.0.0 [sic]:
WARNING: Invalid configuration value found: 'language = None'. Update your configuration to a valid langauge code. Falling back to 'en' (English).
Silence the warning by using 'en'.
It works with all the Sphinx versions required for building kernel documentation (1.7.9 or later).
--- Documentation/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/conf.py +1 -1
@@ -161,7 +161,7 @@ finally: # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used:
Greg Kroah-Hartman
maintainerPATCH 751/772 blk-iolatency: Fix inflight count imbalances and IO hangs on offline
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit 8a177a36da6c54c98b8685d4f914cb3637d53c0d upstream.
iolatency needs to track the number of inflight IOs per cgroup. As this tracking can be expensive, it is disabled when no cgroup has iolatency configured for the device. To ensure that the inflight counters stay balanced, iolatency_set_limit() freezes the request_queue while manipulating the enabled counter, which ensures that no IO is in flight and thus all counters are zero.
Unfortunately, iolatency_set_limit() isn't the only place where the enabled counter is manipulated. iolatency_pd_offline() can also dec the counter and trigger disabling. As this disabling happens without freezing the q, this can easily happen while some IOs are in flight and thus leak the counts.
This can be easily demonstrated by turning on iolatency on an one empty cgroup while IOs are in flight in other cgroups and then removing the cgroup. Note that iolatency shouldn't have been enabled elsewhere in the system to ensure that removing the cgroup disables iolatency for the whole device.
The following keeps flipping on and off iolatency on sda:
echo +io > /sys/fs/cgroup/cgroup.subtree_control while true; do
mkdir -p /sys/fs/cgroup/test
echo '8:0 target=100000' > /sys/fs/cgroup/test/io.latency sleep 1
rmdir /sys/fs/cgroup/test
sleep 1
done
and there's concurrent fio generating direct rand reads:
fio --name test --filename=/dev/sda --direct=1 --rw=randread \
--runtime=600 --time_based --iodepth=256 --numjobs=4 --bs=4kwhile monitoring with the following drgn script:
while True:
for css in css_for_each_descendant_pre(prog['blkcg_root'].css.address_of_()):
for pos in hlist_for_each(container_of(css, 'struct blkcg', 'css').blkg_list):
blkg = container_of(pos, 'struct blkcg_gq', 'blkcg_node')
pd = blkg.pd[prog['blkcg_policy_iolatency'].plid]
if pd.value_() == 0:
continue
iolat = container_of(pd, 'struct iolatency_grp', 'pd') inflight = iolat.rq_wait.inflight.counter.value_()
if inflight:
print(f'inflight={inflight} {disk_name(blkg.q.disk).decode("utf-8")} '
f'{cgroup_path(css.cgroup).decode("utf-8")}')
time.sleep(1)
The monitoring output looks like the following:
inflight=1 sda /user.slice
inflight=1 sda /user.slice
...
inflight=14 sda /user.slice
inflight=13 sda /user.slice
inflight=17 sda /user.slice
inflight=15 sda /user.slice
inflight=18 sda /user.slice
inflight=17 sda /user.slice
inflight=20 sda /user.slice
inflight=19 sda /user.slice <- fio stopped, inflight stuck at 19 inflight=19 sda /user.slice
inflight=19 sda /user.slice
If a cgroup with stuck inflight ends up getting throttled, the throttled IOs will never get issued as there's no completion event to wake it up leading to an indefinite hang.
This patch fixes the bug by unifying enable handling into a work item which is automatically kicked off from iolatency_set_min_lat_nsec() which is called from both iolatency_set_limit() and iolatency_pd_offline() paths. Punting to a work item is necessary as iolatency_pd_offline() is called under spinlocks while freezing a request_queue requires a sleepable context.
This also simplifies the code reducing LOC sans the comments and avoids the unnecessary freezes which were happening whenever a cgroup's latency target is newly set or cleared.
--- block/blk-iolatency.c | 122 ++++++++++++++++++++++++++------------------------ 1 file changed, 64 insertions(+), 58 deletions(-)
block/blk-iolatency.c +64 -58
@@ -87,7 +87,17 @@ struct iolatency_grp;struct blk_iolatency {struct rq_qos rqos;struct timer_list timer; -atomic_t enabled; + +/* +* ->enabled is the master enable switch gating the throttling logic and +* inflight tracking. The number of cgroups which have iolat enabled is +* tracked in ->enable_cnt, and ->enable is flipped on/off accordingly +* from ->enable_work with the request_queue frozen. For details, See +* blkiolatency_enable_work_fn(). +*/ +bool enabled; +atomic_t enable_cnt; +struct work_struct enable_work; };static inline struct blk_iolatency *BLKIOLATENCY (struct rq_qos *rqos)
@@ -95,11 +105,6 @@ static inline struct blk_iolatency *BLKI return container_of(rqos, struct blk_iolatency, rqos); } -static inline bool blk_iolatency_enabled (struct blk_iolatency *blkiolat) -{ -return atomic_read (&blkiolat->enabled) >0 ; -} -struct child_latency_info {spinlock_t lock;
@@ -464,7 +469,7 @@ static void blkcg_iolatency_throttle(strstruct blkcg_gq *blkg = bio->bi_blkg;bool issue_as_root =bio_issue_as_root_blkg (bio); -if (!blk_iolatency_enabled (blkiolat)) +if (!blkiolat->enabled)return ;while (blkg && blkg->parent) {
@@ -594,7 +599,6 @@ static void blkcg_iolatency_done_bio(stru64 window_start;u64 now;bool issue_as_root =bio_issue_as_root_blkg (bio); -bool enabled = false;int inflight =0 ; blkg = bio->bi_blkg;
@@ -605,8 +609,7 @@ static void blkcg_iolatency_done_bio(strif (!iolat)return ; - enabled =blk_iolatency_enabled (iolat->blkiolat); -if (!enabled) +if (!iolat->blkiolat->enabled)return ; now =ktime_to_ns (ktime_get ());
@@ -645,6 +648,7 @@ static void blkcg_iolatency_exit(structstruct blk_iolatency *blkiolat =BLKIOLATENCY (rqos);del_timer_sync (&blkiolat->timer); +flush_work (&blkiolat->enable_work);blkcg_deactivate_policy (rqos->q, &blkcg_policy_iolatency);kfree (blkiolat); }
@@ -716,6 +720,44 @@ next:rcu_read_unlock (); } +/** +* blkiolatency_enable_work_fn - Enable or disable iolatency on the device +* @work: enable_work of the blk_iolatency of interest +* +* iolatency needs to keep track of the number of in-flight IOs per cgroup. This +* is relatively expensive as it involves walking up the hierarchy twice for +* every IO. Thus, if iolatency is not enabled in any cgroup for the device, we +* want to disable the in-flight tracking. +* +* We have to make sure that the counting is balanced - we don't want to leak +* the in-flight counts by disabling accounting in the completion path while IOs +* are in flight. This is achieved by ensuring that no IO is in flight by +* freezing the queue while flipping ->enabled. As this requires a sleepable +* context, ->enabled flipping is punted to this work function. +*/ +static void blkiolatency_enable_work_fn (struct work_struct *work) +{ + struct blk_iolatency *blkiolat = container_of(work, struct blk_iolatency, + enable_work); +bool enabled; + +/* +* There can only be one instance of this function running for @blkiolat +* and it's guaranteed to be executed at least once after the latest +* ->enabled_cnt modification. Acting on the latest ->enable_cnt is +* sufficient. +* +* Also, we know @blkiolat is safe to access as ->enable_work is flushed +* in blkcg_iolatency_exit(). +*/ + enabled =atomic_read (&blkiolat->enable_cnt); +if (enabled != blkiolat->enabled) { +blk_mq_freeze_queue (blkiolat->rqos.q); + blkiolat->enabled = enabled; +blk_mq_unfreeze_queue (blkiolat->rqos.q); + } +} +int blk_iolatency_init (struct request_queue *q) {struct blk_iolatency *blkiolat;
@@ -741,17 +783,15 @@ int blk_iolatency_init(struct request_qu }timer_setup (&blkiolat->timer, blkiolatency_timer_fn,0 ); +INIT_WORK (&blkiolat->enable_work, blkiolatency_enable_work_fn);return 0 ; } -/* -* return 1 for enabling iolatency, return -1 for disabling iolatency, otherwise -* return 0. -*/ -static int iolatency_set_min_lat_nsec (struct blkcg_gq *blkg,u64 val) +static void iolatency_set_min_lat_nsec (struct blkcg_gq *blkg,u64 val) {struct iolatency_grp *iolat =blkg_to_lat (blkg); +struct blk_iolatency *blkiolat = iolat->blkiolat;u64 oldval = iolat->min_lat_nsec; iolat->min_lat_nsec = val;
@@ -759,13 +799,15 @@ static int iolatency_set_min_lat_nsec(st iolat->cur_win_nsec =min_t (u64, iolat->cur_win_nsec,BLKIOLATENCY_MAX_WIN_SIZE ); -if (!oldval && val) -return 1 ; +if (!oldval && val) { +if (atomic_inc_return (&blkiolat->enable_cnt) ==1 ) +schedule_work (&blkiolat->enable_work); + }if (oldval && !val) {blkcg_clear_delay (blkg); -return -1 ; +if (atomic_dec_return (&blkiolat->enable_cnt) ==0 ) +schedule_work (&blkiolat->enable_work); } -return 0 ; }static void iolatency_clear_scaling (struct blkcg_gq *blkg)
@@ -797,7 +839,6 @@ static ssize_t iolatency_set_limit(strucu64 lat_val =0 ;u64 oldval;int ret; -int enable =0 ; ret =blkg_conf_prep (blkcg, &blkcg_policy_iolatency, buf, &ctx);if (ret)
@@ -832,41 +873,12 @@ static ssize_t iolatency_set_limit(struc blkg = ctx.blkg; oldval = iolat->min_lat_nsec; - enable =iolatency_set_min_lat_nsec (blkg, lat_val); -if (enable) { -if (!blk_get_queue (blkg->q)) { - ret = -ENODEV ; - goto out; - } - -blkg_get (blkg); - } - -if (oldval != iolat->min_lat_nsec) { +iolatency_set_min_lat_nsec (blkg, lat_val); +if (oldval != iolat->min_lat_nsec)iolatency_clear_scaling (blkg); - } - ret =0 ; out:blkg_conf_finish (&ctx); -if (ret ==0 && enable) { -struct iolatency_grp *tmp =blkg_to_lat (blkg); -struct blk_iolatency *blkiolat = tmp->blkiolat; - -blk_mq_freeze_queue (blkg->q); - -if (enable ==1 ) -atomic_inc (&blkiolat->enabled); -else if (enable ==-1 ) -atomic_dec (&blkiolat->enabled); -else -WARN_ON_ONCE (1 ); - -blk_mq_unfreeze_queue (blkg->q); - -blkg_put (blkg); -blk_put_queue (blkg->q); - }return ret ?: nbytes; }
@@ -1007,14 +1019,8 @@ static void iolatency_pd_offline(struct {struct iolatency_grp *iolat =pd_to_lat (pd);struct blkcg_gq *blkg =lat_to_blkg (iolat); -struct blk_iolatency *blkiolat = iolat->blkiolat; -int ret; - ret =iolatency_set_min_lat_nsec (blkg,0 ); -if (ret ==1 ) -atomic_inc (&blkiolat->enabled); -if (ret ==-1 ) -atomic_dec (&blkiolat->enabled); +iolatency_set_min_lat_nsec (blkg,0 );iolatency_clear_scaling (blkg); }
Greg Kroah-Hartman
maintainerPATCH 734/772 bcache: improve multithreaded bch_sectors_dirty_init()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
commit 4dc34ae1b45fe26e772a44379f936c72623dd407 upstream.
Commit b144e45fc576 ("bcache: make bch_sectors_dirty_init() to be multithreaded") makes bch_sectors_dirty_init() to be much faster when counting dirty sectors by iterating all dirty keys in the btree. But it isn't in ideal shape yet, still can be improved.
This patch does the following changes to improve current parallel dirty keys iteration on the btree,
- Add read lock to root node when multiple threads iterating the btree, to prevent the root node gets split by I/Os from other registered bcache devices.
- Remove local variable "char name[32]" and generate kernel thread name string directly when calling kthread_run().
- Allocate "struct bch_dirty_init_state state" directly on stack and avoid the unnecessary dynamic memory allocation for it.
- Decrease BCH_DIRTY_INIT_THRD_MAX from 64 to 12 which is enough indeed.
- Increase &state->started to count created kernel thread after it succeeds to create.
- When wait for all dirty key counting threads to finish, use wait_event() to replace wait_event_interruptible().
With the above changes, the code is more clear, and some potential error conditions are avoided.
--- drivers/md/bcache/writeback.c | 60 ++++++++++++++++-------------------------- drivers/md/bcache/writeback.h | 2 - 2 files changed, 25 insertions(+), 37 deletions(-)
drivers/md/bcache/writeback.c +24 -36
@@ -945,10 +945,10 @@ void bch_sectors_dirty_init(struct bcachstruct btree_iter iter;struct sectors_dirty_init op;struct cache_set *c = d->c; -struct bch_dirty_init_state *state; -char name[32 ]; +struct bch_dirty_init_state state;/* Just count root keys if no leaf node */ +rw_lock (0 , c->root, c->root->level);if (c->root->level ==0 ) {bch_btree_op_init (&op.op,-1 ); op.inode = d->id;
@@ -958,54 +958,42 @@ void bch_sectors_dirty_init(struct bcachfor_each_key_filter (&c->root->keys, k, &iter, bch_ptr_invalid)sectors_dirty_init_fn (&op.op, c->root, k); +rw_unlock (0 , c->root);return ; } - state =kzalloc (sizeof (struct bch_dirty_init_state ),GFP_KERNEL ); -if (!state) { -pr_warn ("sectors dirty init failed: cannot allocate memory\n" ); -return ; - } + state.c = c; + state.d = d; + state.total_threads =bch_btre_dirty_init_thread_nr (); + state.key_idx =0 ; +spin_lock_init (&state.idx_lock); +atomic_set (&state.started,0 ); +atomic_set (&state.enough,0 ); +init_waitqueue_head (&state.wait); - state->c = c; - state->d = d; - state->total_threads =bch_btre_dirty_init_thread_nr (); - state->key_idx =0 ; -spin_lock_init (&state->idx_lock); -atomic_set (&state->started,0 ); -atomic_set (&state->enough,0 ); -init_waitqueue_head (&state->wait); - -for (i =0 ; i < state->total_threads; i++) { -/* Fetch latest state->enough earlier */ +for (i =0 ; i < state.total_threads; i++) { +/* Fetch latest state.enough earlier */ smp_mb__before_atomic (); -if (atomic_read (&state->enough)) +if (atomic_read (&state.enough))break ; - state->infos[i].state = state; -atomic_inc (&state->started); -snprintf (name,sizeof (name),"bch_dirty_init[%d]" , i); - - state->infos[i].thread = -kthread_run (bch_dirty_init_thread, - &state->infos[i], - name); -if (IS_ERR (state->infos[i].thread)) { + state.infos[i].state = &state; + state.infos[i].thread = +kthread_run (bch_dirty_init_thread, &state.infos[i], +"bch_dirtcnt[%d]" , i); +if (IS_ERR (state.infos[i].thread)) {pr_err ("fails to run thread bch_dirty_init[%d]\n" , i);for (--i; i >=0 ; i--) -kthread_stop (state->infos[i].thread); +kthread_stop (state.infos[i].thread); goto out; } +atomic_inc (&state.started); } -/* -* Must wait for all threads to stop. -*/ -wait_event_interruptible (state->wait, -atomic_read (&state->started) ==0 ); - out: -kfree (state); +/* Must wait for all threads to stop. */ +wait_event (state.wait,atomic_read (&state.started) ==0 ); +rw_unlock (0 , c->root); }void bch_cached_dev_writeback_init (struct cached_dev *dc)
drivers/md/bcache/writeback.h +1 -1
@@ -20,7 +20,7 @@#define BCH_WRITEBACK_FRAGMENT_THRESHOLD_MID 57#define BCH_WRITEBACK_FRAGMENT_THRESHOLD_HIGH 64 -#define BCH_DIRTY_INIT_THRD_MAX 64 +#define BCH_DIRTY_INIT_THRD_MAX 12/* * 14 (16384ths) is chosen here as something that each backing device * should be a reasonable fraction of the share, and not to blow up
Greg Kroah-Hartman
maintainerPATCH 755/772 net: ipa: fix page free in ipa_endpoint_replenish_one()
In reply to Greg Kroah-HartmanFrom: Alex Elder <[email protected]>
commit 70132763d5d2e94cd185e3aa92ac6a3ba89068fa upstream.
Currently the (possibly compound) pages used for receive buffers are freed using __free_pages(). But according to this comment above the definition of that function, that's wrong:
If you want to use the page's reference count to decide when to free the allocation, you should allocate a compound page, and use put_page() instead of __free_pages().
Convert the call to __free_pages() in ipa_endpoint_replenish_one() to use put_page() instead.
--- drivers/net/ipa/ipa_endpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/ipa_endpoint.c +1 -1
@@ -1062,7 +1062,7 @@ static int ipa_endpoint_replenish_one(st err_trans_free:gsi_trans_free (trans); err_free_pages: -__free_pages (page,get_order (IPA_RX_BUFFER_SIZE )); +put_page (page);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 753/772 phy: qcom-qmp: fix reset-controller leak on probe errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 4d2900f20edfe541f75756a00deeb2ffe7c66bc1 upstream.
Make sure to release the lane reset controller in case of a late probe error (e.g. probe deferral).
Note that due to the reset controller being defined in devicetree in "lane" child nodes, devm_reset_control_get_exclusive() cannot be used directly.
--- drivers/phy/qualcomm/phy-qcom-qmp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/phy/qualcomm/phy-qcom-qmp.c +9 -0
@@ -5818,6 +5818,11 @@ static const struct phy_ops qcom_qmp_pci .owner = THIS_MODULE, }; +static void qcom_qmp_reset_control_put (void *data) +{ +reset_control_put (data); +} +static int qcom_qmp_phy_create (struct device *dev,struct device_node *np,int id,void __iomem *serdes,const struct qmp_phy_cfg *cfg)
@@ -5912,6 +5917,10 @@ int qcom_qmp_phy_create(struct device *ddev_err (dev,"failed to get lane%d reset\n" , id);return PTR_ERR (qphy->lane_rst); } + ret =devm_add_action_or_reset (dev, qcom_qmp_reset_control_put, + qphy->lane_rst); +if (ret) +return ret; }if (cfg->type ==PHY_TYPE_UFS || cfg->type ==PHY_TYPE_PCIE )
Greg Kroah-Hartman
maintainerPATCH 640/772 ext4: fix warning in ext4_handle_inode_extension
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit f4534c9fc94d22383f187b9409abb3f9df2e3db3 upstream.
We got issue as follows:
EXT4-fs error (device loop0) in ext4_reserve_inode_write:5741: Out of memory
EXT4-fs error (device loop0): ext4_setattr:5462: inode #13: comm syz-executor.0: mark_inode_dirty error
EXT4-fs error (device loop0) in ext4_setattr:5519: Out of memory
EXT4-fs error (device loop0): ext4_ind_map_blocks:595: inode #13: comm syz-executor.0: Can't allocate blocks for non-extent mapped inodes with bigalloc
------------[ cut here ]------------ WARNING: CPU: 1 PID: 4361 at fs/ext4/file.c:301 ext4_file_write_iter+0x11c9/0x1220 Modules linked in: CPU: 1 PID: 4361 Comm: syz-executor.0 Not tainted 5.10.0+ #1 RIP: 0010:ext4_file_write_iter+0x11c9/0x1220 RSP: 0018:ffff924d80b27c00 EFLAGS: 00010282 RAX: ffffffff815a3379 RBX: 0000000000000000 RCX: 000000003b000000 RDX: ffff924d81601000 RSI: 00000000000009cc RDI: 00000000000009cd RBP: 000000000000000d R08: ffffffffbc5a2c6b R09: 0000902e0e52a96f R10: ffff902e2b7c1b40 R11: ffff902e2b7c1b40 R12: 000000000000000a R13: 0000000000000001 R14: ffff902e0e52aa10 R15: ffffffffffffff8b FS: 00007f81a7f65700(0000) GS:ffff902e3bc80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffff600400 CR3: 000000012db88001 CR4: 00000000003706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: do_iter_readv_writev+0x2e5/0x360 do_iter_write+0x112/0x4c0 do_pwritev+0x1e5/0x390 __x64_sys_pwritev2+0x7e/0xa0 do_syscall_64+0x37/0x50 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Above issue may happen as follows:
Assume
inode.i_size=4096
EXT4_I(inode)->i_disksize=4096
step 1: set inode->i_isize = 8192ext4_setattr
if (attr->ia_size != inode->i_size)
EXT4_I(inode)->i_disksize = attr->ia_size;
rc = ext4_mark_inode_dirty
ext4_reserve_inode_write
ext4_get_inode_loc
__ext4_get_inode_loc
sb_getblk --> return -ENOMEM
...
if (!error) ->will not update i_size
i_size_write(inode, attr->ia_size);Now:
inode.i_size=4096
EXT4_I(inode)->i_disksize=8192
step 2: Direct write 4096 bytesext4_file_write_iter
ext4_dio_write_iter
iomap_dio_rw ->return error
if (extend)
ext4_handle_inode_extension
WARN_ON_ONCE(i_size_read(inode) < EXT4_I(inode)->i_disksize);
->Then trigger warning.
To solve above issue, if mark inode dirty failed in ext4_setattr just set 'EXT4_I(inode)->i_disksize' with old value.
--- fs/ext4/inode.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ext4/inode.c +4 -0
@@ -5381,6 +5381,7 @@ int ext4_setattr(struct user_namespace *if (attr->ia_valid &ATTR_SIZE ) {handle_t *handle;loff_t oldsize = inode->i_size; +loff_t old_disksize;int shrink = (attr->ia_size < inode->i_size);if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) {
@@ -5452,6 +5453,7 @@ int ext4_setattr(struct user_namespace * inode->i_sb->s_blocksize_bits);down_write (&EXT4_I (inode)->i_data_sem); + old_disksize =EXT4_I (inode)->i_disksize;EXT4_I (inode)->i_disksize = attr->ia_size; rc =ext4_mark_inode_dirty (handle, inode);if (!error)
@@ -5463,6 +5465,8 @@ int ext4_setattr(struct user_namespace **/ if (!error)i_size_write (inode, attr->ia_size); +else +EXT4_I (inode)->i_disksize = old_disksize;up_write (&EXT4_I (inode)->i_data_sem);ext4_journal_stop (handle);if (error)
Greg Kroah-Hartman
maintainerPATCH 752/772 coresight: core: Fix coresight device probe failure issue
In reply to Greg Kroah-HartmanFrom: Mao Jinlong <[email protected]>
commit 8c1d3f79d9ca48e406b78e90e94cf09a8c076bf2 upstream.
It is possibe that probe failure issue happens when the device and its child_device's probe happens at the same time. In coresight_make_links, has_conns_grp is true for parent, but has_conns_grp is false for child device as has_conns_grp is set to true in coresight_create_conns_sysfs_group. The probe of parent device will fail at this condition. Add has_conns_grp check for child device before make the links and make the process from device_register to connection_create be atomic to avoid this probe failure issue.
--- drivers/hwtracing/coresight/coresight-core.c | 33 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +22 -11
@@ -1382,7 +1382,7 @@ static int coresight_fixup_device_conns(continue ; conn->child_dev =coresight_find_csdev_by_fwnode (conn->child_fwnode); -if (conn->child_dev) { +if (conn->child_dev && conn->child_dev->has_conns_grp) { ret =coresight_make_links (csdev, conn, conn->child_dev);if (ret)
@@ -1574,6 +1574,7 @@ struct coresight_device *coresight_regisint nr_refcnts =1 ;atomic_t *refcnts =NULL ;struct coresight_device *csdev; +bool registered = false; csdev =kzalloc (sizeof (*csdev),GFP_KERNEL );if (!csdev) {
@@ -1594,7 +1595,8 @@ struct coresight_device *coresight_regis refcnts =kcalloc (nr_refcnts,sizeof (*refcnts),GFP_KERNEL );if (!refcnts) { ret = -ENOMEM ; - goto err_free_csdev; +kfree (csdev); + goto err_out; } csdev->refcnt = refcnts;
@@ -1619,6 +1621,13 @@ struct coresight_device *coresight_regis csdev->dev.fwnode =fwnode_handle_get (dev_fwnode (desc->dev));dev_set_name (&csdev->dev,"%s" , desc->name); +/* +* Make sure the device registration and the connection fixup +* are synchronised, so that we don't see uninitialised devices +* on the coresight bus while trying to resolve the connections. +*/ +mutex_lock (&coresight_mutex); + ret =device_register (&csdev->dev);if (ret) {put_device (&csdev->dev);
@@ -1626,7 +1635,7 @@ struct coresight_device *coresight_regis* All resources are free'd explicitly via * coresight_device_release(), triggered from put_device(). */ - goto err_out; + goto out_unlock; } if (csdev->type == CORESIGHT_DEV_TYPE_SINK ||
@@ -1641,11 +1650,11 @@ struct coresight_device *coresight_regis* from put_device(), which is in turn called from * function device_unregister(). */ - goto err_out; + goto out_unlock; } } - -mutex_lock (&coresight_mutex); +/* Device is now registered */ + registered = true; ret =coresight_create_conns_sysfs_group (csdev);if (!ret)
@@ -1655,16 +1664,18 @@ struct coresight_device *coresight_regisif (!ret && cti_assoc_ops && cti_assoc_ops->add) cti_assoc_ops->add (csdev); +out_unlock:mutex_unlock (&coresight_mutex); -if (ret) { +/* Success */ +if (!ret) +return csdev; + +/* Unregister the device if needed */ +if (registered) {coresight_unregister (csdev);return ERR_PTR (ret); } -return csdev; - -err_free_csdev: -kfree (csdev); err_out:/* Cleanup the connection information */ coresight_release_platform_data (NULL , desc->pdata);
Greg Kroah-Hartman
maintainerPATCH 750/772 vdpasim: allow to enable a vq repeatedly
In reply to Greg Kroah-HartmanFrom: Eugenio Pérez <[email protected]>
commit 242436973831aa97e8ce19533c6c912ea8def31b upstream.
Code must be resilient to enable a queue many times.
At the moment the queue is resetting so it's definitely not the expected behavior.
v2: set vq->ready = 0 at disable.
Message-Id: <[email protected]>
--- drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/vdpa/vdpa_sim/vdpa_sim.c +4 -1
@@ -353,11 +353,14 @@ static void vdpasim_set_vq_ready(struct {struct vdpasim *vdpasim =vdpa_to_sim (vdpa);struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; +bool old_ready;spin_lock (&vdpasim->lock); + old_ready = vq->ready; vq->ready = ready; -if (vq->ready) +if (vq->ready && !old_ready) {vdpasim_queue_ready (vdpasim, idx); + }spin_unlock (&vdpasim->lock); }
Greg Kroah-Hartman
maintainerPATCH 749/772 dt-bindings: gpio: altera: correct interrupt-cells
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
commit 3a21c3ac93aff7b4522b152399df8f6a041df56d upstream.
update documentation to correctly state the interrupt-cells to be 2.
--- Documentation/devicetree/bindings/gpio/gpio-altera.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/gpio/gpio-altera.txt +3 -2
@@ -9,8 +9,9 @@ Required properties: - The second cell is reserved and is currently unused. - gpio-controller : Marks the device node as a GPIO controller. - interrupt-controller: Mark the device node as an interrupt controller -- #interrupt-cells : Should be 1. The interrupt type is fixed in the hardware. +- #interrupt-cells : Should be 2. The interrupt type is fixed in the hardware. - The first cell is the GPIO offset number within the GPIO controller. + - The second cell is the interrupt trigger type and level flags. - interrupts: Specify the interrupt. - altr,interrupt-type: Specifies the interrupt trigger type the GPIO hardware is synthesized. This field is required if the Altera GPIO controller
@@ -38,6 +39,6 @@ gpio_altr: gpio@ff200000 { altr,interrupt-type = <IRQ_TYPE_EDGE_RISING>; #gpio-cells = <2>; gpio-controller; - #interrupt-cells = <1>; + #interrupt-cells = <2>; interrupt-controller; };
Greg Kroah-Hartman
maintainerPATCH 754/772 net: ipa: fix page free in ipa_endpoint_trans_release()
In reply to Greg Kroah-HartmanFrom: Alex Elder <[email protected]>
commit 155c0c90bca918de6e4327275dfc1d97fd604115 upstream.
Currently the (possibly compound) page used for receive buffers are freed using __free_pages(). But according to this comment above the definition of that function, that's wrong:
If you want to use the page's reference count to decide when to free the allocation, you should allocate a compound page, and use put_page() instead of __free_pages().
Convert the call to __free_pages() in ipa_endpoint_trans_release() to use put_page() instead.
--- drivers/net/ipa/ipa_endpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/ipa_endpoint.c +1 -1
@@ -1402,7 +1402,7 @@ void ipa_endpoint_trans_release(struct istruct page *page = trans->data;if (page) -__free_pages (page,get_order (IPA_RX_BUFFER_SIZE )); +put_page (page); } }
Greg Kroah-Hartman
maintainerPATCH 756/772 kseltest/cgroup: Make test_stress.sh work if run interactively
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
commit 213adc63dfbcdff9a0c19ec1f2681fda9c05cf6d upstream.
Commit 54de76c01239 ("kselftest/cgroup: fix test_stress.sh to use OUTPUT dir") changes the test_core command path from . to $OUTPUT. However, variable OUTPUT may not be defined if the command is run interactively. Fix that by using ${OUTPUT:-.} to cover both cases.
--- tools/testing/selftests/cgroup/test_stress.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/cgroup/test_stress.sh +1 -1
@@ -1,4 +1,4 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -./with_stress.sh -s subsys -s fork ${OUTPUT}/test_core +./with_stress.sh -s subsys -s fork ${OUTPUT:-.}/test_core
Greg Kroah-Hartman
maintainerPATCH 760/772 staging: r8188eu: delete rtw_wx_read/write32()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 4d0cc9e0e53e9946d7b8dc58279c62dfa7a2191b upstream.
These debugging tools let you call:
status = usb_control_msg_recv/send(udev, 0, REALTEK_USB_VENQT_CMD_REQ, REALTEK_USB_VENQT_READ/WRITE, value, REALTEK_USB_VENQT_CMD_IDX, io_buf, size, RTW_USB_CONTROL_MSG_TIMEOUT, GFP_KERNEL);
with a user controlled "value" in the 0-0xffff range. It's not a valid API.
--- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 92 --------------------------- 1 file changed, 2 insertions(+), 90 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +2 -90
@@ -1969,94 +1969,6 @@ static int rtw_wx_get_nick(struct net_dereturn 0 ; } -static int rtw_wx_read32 (struct net_device *dev, -struct iw_request_info *info, -union iwreq_data *wrqu,char *extra) -{ -struct adapter *padapter; -struct iw_point *p; -u16 len; -u32 addr; -u32 data32; -u32 bytes; -u8 *ptmp; -int ret; - - padapter = (struct adapter *)rtw_netdev_priv (dev); - p = &wrqu->data; - len = p->length; - ptmp =memdup_user (p->pointer, len); -if (IS_ERR (ptmp)) -return PTR_ERR (ptmp); - - bytes =0 ; - addr =0 ; -sscanf (ptmp,"%d,%x" , &bytes, &addr); - -switch (bytes) { -case 1 : - data32 =rtw_read8 (padapter, addr); -sprintf (extra,"0x%02X" , data32); -break ; -case 2 : - data32 =rtw_read16 (padapter, addr); -sprintf (extra,"0x%04X" , data32); -break ; -case 4 : - data32 =rtw_read32 (padapter, addr); -sprintf (extra,"0x%08X" , data32); -break ; -default : -DBG_88E (KERN_INFO "%s: usage> read [bytes],[address(hex)]\n" , __func__); - ret = -EINVAL ; - goto err_free_ptmp; - } -DBG_88E (KERN_INFO "%s: addr = 0x%08X data =%s\n" , __func__, addr, extra); - -kfree (ptmp); -return 0 ; - -err_free_ptmp: -kfree (ptmp); -return ret; -} - -static int rtw_wx_write32 (struct net_device *dev, -struct iw_request_info *info, -union iwreq_data *wrqu,char *extra) -{ -struct adapter *padapter = (struct adapter *)rtw_netdev_priv (dev); - -u32 addr; -u32 data32; -u32 bytes; - - bytes =0 ; - addr =0 ; - data32 =0 ; -sscanf (extra,"%d,%x,%x" , &bytes, &addr, &data32); - -switch (bytes) { -case 1 : -rtw_write8 (padapter, addr, (u8 )data32); -DBG_88E (KERN_INFO "%s: addr = 0x%08X data = 0x%02X\n" , __func__, addr, (u8 )data32); -break ; -case 2 : -rtw_write16 (padapter, addr, (u16 )data32); -DBG_88E (KERN_INFO "%s: addr = 0x%08X data = 0x%04X\n" , __func__, addr, (u16 )data32); -break ; -case 4 : -rtw_write32 (padapter, addr, data32); -DBG_88E (KERN_INFO "%s: addr = 0x%08X data = 0x%08X\n" , __func__, addr, data32); -break ; -default : -DBG_88E (KERN_INFO "%s: usage> write [bytes],[address(hex)],[data(hex)]\n" , __func__); -return -EINVAL ; - } - -return 0 ; -} -static int rtw_wx_read_rf (struct net_device *dev,struct iw_request_info *info,union iwreq_data *wrqu,char *extra)
@@ -4267,8 +4179,8 @@ static const struct iw_priv_args rtw_pri };static iw_handler rtw_private_handler[] = { -rtw_wx_write32,/* 0x00 */ -rtw_wx_read32,/* 0x01 */ +NULL ,/* 0x00 */ +NULL ,/* 0x01 */ NULL ,/* 0x02 */ NULL ,/* 0x03 */ /* for MM DTV platform */
Greg Kroah-Hartman
maintainerPATCH 758/772 list: test: Add a test for list_is_head()
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
commit 37dc573c0a547e1aed0c9abb480fab797bd3833f upstream.
list_is_head() was added recently[1], and didn't have a KUnit test. The implementation is trivial, so it's not a particularly exciting test, but it'd be nice to get back to full coverage of the list functions.
--- lib/list-test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
lib/list-test.c +19 -0
@@ -234,6 +234,24 @@ static void list_test_list_bulk_move_taiKUNIT_EXPECT_EQ (test, i,2 ); } +static void list_test_list_is_head (struct kunit *test) +{ +struct list_head a, b, c; + +/* Two lists: [a] -> b, [c] */ +INIT_LIST_HEAD (&a); +INIT_LIST_HEAD (&c); +list_add_tail (&b, &a); + +KUNIT_EXPECT_TRUE_MSG (test,list_is_head (&a, &a), +"Head element of same list" ); +KUNIT_EXPECT_FALSE_MSG (test,list_is_head (&a, &b), +"Non-head element of same list" ); +KUNIT_EXPECT_FALSE_MSG (test,list_is_head (&a, &c), +"Head element of different list" ); +} + +static void list_test_list_is_first (struct kunit *test) {struct list_head a, b;
@@ -710,6 +728,7 @@ static struct kunit_case list_test_casesKUNIT_CASE (list_test_list_move),KUNIT_CASE (list_test_list_move_tail),KUNIT_CASE (list_test_list_bulk_move_tail), +KUNIT_CASE (list_test_list_is_head),KUNIT_CASE (list_test_list_is_first),KUNIT_CASE (list_test_list_is_last), KUNIT_CASE(list_test_list_empty),
Greg Kroah-Hartman
maintainerPATCH 757/772 perf evlist: Extend arch_evsel__must_be_in_group to support hybrid systems
In reply to Greg Kroah-HartmanFrom: Zhengjun Xing <[email protected]>
commit e69a5c010246ca6a87c4e6f13d0a291954bdece8 upstream.
For the hybrid system, the "slots" event changes to "cpu_core/slots/", need extend API arch_evsel__must_be_in_group() to support hybrid systems.
In the origin code, for hybrid system event "cpu_core/slots/", the output of the API arch_evsel__must_be_in_group() is "false" (in fact,it should be "true"). Currently only one API evsel__remove_from_group() calls it. In evsel__remove_from_group(), it adds the second condition to check, so the output of evsel__remove_from_group() still is correct. That's the reason why there isn't an instant error. I'd like to fix the issue found in API arch_evsel__must_be_in_group() in case someone else using the function in the other place.
--- tools/perf/arch/x86/util/evsel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/util/evsel.c +1 -1
@@ -38,6 +38,6 @@ bool arch_evsel__must_be_in_group(constreturn false;return evsel->name && - (!strcasecmp (evsel->name,"slots" ) || + (strcasestr (evsel->name,"slots" ) ||strcasestr (evsel->name,"topdown" )); }
Greg Kroah-Hartman
maintainerPATCH 759/772 Revert "random: use static branch for crng_ready()"
In reply to Greg Kroah-HartmanFrom: "Jason A. Donenfeld" <[email protected]>
This reverts upstream commit f5bda35fba615ace70a656d4700423fa6c9bebee from stable. It's not essential and will take some time during 5.19 to work out properly.
--- drivers/char/random.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/char/random.c +2 -10
@@ -79,8 +79,7 @@ static enum {CRNG_EARLY =1 ,/* At least POOL_EARLY_BITS collected */ CRNG_READY = 2 /* Fully initialized with POOL_READY_BITS collected */ } crng_init__read_mostly =CRNG_EMPTY ; -static DEFINE_STATIC_KEY_FALSE (crng_is_ready); -#define crng_ready () (static_branch_likely(&crng_is_ready) || crng_init >= CRNG_READY) +#define crng_ready () (likely(crng_init >= CRNG_READY))/* Various types of waiters for crng_init->CRNG_READY transition. */ static DECLARE_WAIT_QUEUE_HEAD (crng_init_wait);static struct fasync_struct *fasync;
@@ -110,11 +109,6 @@ bool rng_is_initialized(void) }EXPORT_SYMBOL (rng_is_initialized); -static void __cold crng_set_ready (struct work_struct *work) -{ -static_branch_enable (&crng_is_ready); -} -/* Used by wait_for_random_bytes(), and considered an entropy collector, below. */ static void try_to_generate_entropy (void );
@@ -268,7 +262,7 @@ static void crng_reseed(void) ++next_gen;WRITE_ONCE (base_crng.generation, next_gen);WRITE_ONCE (base_crng.birth, jiffies); -if (!static_branch_likely (&crng_is_ready)) +if (!crng_ready ()) crng_init =CRNG_READY ;spin_unlock_irqrestore (&base_crng.lock, flags);memzero_explicit (key,sizeof (key));
@@ -711,7 +705,6 @@ static void extract_entropy(void *buf, sstatic void __cold _credit_init_bits (size_t bits) { -static struct execute_work set_ready;unsigned int new, orig, add;unsigned long flags;
@@ -727,7 +720,6 @@ static void __cold _credit_init_bits(sizif (orig <POOL_READY_BITS && new >=POOL_READY_BITS ) {crng_reseed ();/* Sets crng_init to CRNG_READY under base_crng.lock. */ -execute_in_process_context (crng_set_ready, &set_ready);process_random_ready_list ();wake_up_interruptible (&crng_init_wait);kill_fasync (&fasync,SIGIO ,POLL_IN );
Greg Kroah-Hartman
maintainerPATCH 761/772 RDMA/hns: Remove the num_cqc_timer variable
In reply to Greg Kroah-HartmanFrom: Yixing Liu <[email protected]>
commit db5dfbf5b201df65c1f5332c4d9d5e7c2f42396b upstream.
The bt number of cqc_timer of HIP09 increases compared with that of HIP08. Therefore, cqc_timer_bt_num and num_cqc_timer do not match. As a result, the driver may fail to allocate cqc_timer. So the driver needs to uniquely uses cqc_timer_bt_num to represent the bt number of cqc_timer.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 1 - drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 +-- drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 2 +- drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +0 -1
@@ -721,7 +721,6 @@ struct hns_roce_caps {u32 num_pi_qps;u32 reserved_qps;int num_qpc_timer; -int num_cqc_timer;u32 num_srqs;u32 max_wqes;u32 max_srq_wrs;
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -2
@@ -1965,7 +1965,7 @@ static void set_default_caps(struct hns_ caps->num_mtpts =HNS_ROCE_V2_MAX_MTPT_NUM ; caps->num_pds =HNS_ROCE_V2_MAX_PD_NUM ; caps->num_qpc_timer =HNS_ROCE_V2_MAX_QPC_TIMER_NUM ; - caps->num_cqc_timer =HNS_ROCE_V2_MAX_CQC_TIMER_NUM ; + caps->cqc_timer_bt_num =HNS_ROCE_V2_MAX_CQC_TIMER_BT_NUM ; caps->max_qp_init_rdma =HNS_ROCE_V2_MAX_QP_INIT_RDMA ; caps->max_qp_dest_rdma =HNS_ROCE_V2_MAX_QP_DEST_RDMA ;
@@ -2261,7 +2261,6 @@ static int hns_roce_query_pf_caps(struct caps->max_rq_sg =roundup_pow_of_two (caps->max_rq_sg); caps->max_extend_sg =le32_to_cpu (resp_a->max_extend_sg); caps->num_qpc_timer =le16_to_cpu (resp_a->num_qpc_timer); - caps->num_cqc_timer =le16_to_cpu (resp_a->num_cqc_timer); caps->max_srq_sges =le16_to_cpu (resp_a->max_srq_sges); caps->max_srq_sges =roundup_pow_of_two (caps->max_srq_sges); caps->num_aeq_vectors = resp_a->num_aeq_vectors;
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1 -1
@@ -41,7 +41,7 @@#define HNS_ROCE_V2_MAX_SRQ_WR 0x8000#define HNS_ROCE_V2_MAX_SRQ_SGE 64#define HNS_ROCE_V2_MAX_CQ_NUM 0x100000 -#define HNS_ROCE_V2_MAX_CQC_TIMER_NUM 0x100 +#define HNS_ROCE_V2_MAX_CQC_TIMER_BT_NUM 0x100#define HNS_ROCE_V2_MAX_SRQ_NUM 0x100000#define HNS_ROCE_V2_MAX_CQE_NUM 0x400000#define HNS_ROCE_V2_MAX_RQ_SGE_NUM 64
drivers/infiniband/hw/hns/hns_roce_main.c +1 -1
@@ -737,7 +737,7 @@ static int hns_roce_init_hem(struct hns_ ret =hns_roce_init_hem_table (hr_dev, &hr_dev->cqc_timer_table,HEM_TYPE_CQC_TIMER , hr_dev->caps.cqc_timer_entry_sz, - hr_dev->caps.num_cqc_timer,1 ); + hr_dev->caps.cqc_timer_bt_num,1 );if (ret) {dev_err (dev,"Failed to init CQC timer memory, aborting.\n" );
Greg Kroah-Hartman
maintainerPATCH 766/772 fs: add two trivial lookup helpers
In reply to Greg Kroah-HartmanFrom: Christian Brauner <[email protected]>
commit 00675017e0aeba5305665c52ded4ddce6a4c0231 upstream.
Similar to the addition of lookup_one() add a version of lookup_one_unlocked() and lookup_one_positive_unlocked() that take idmapped mounts into account. This is required to port overlay to support idmapped base layers.
--- fs/namei.c | 70 ++++++++++++++++++++++++++++++++++++++++++-------- include/linux/namei.h | 6 ++++ 2 files changed, 66 insertions(+), 10 deletions(-)
fs/namei.c +60 -10
@@ -2768,7 +2768,8 @@ struct dentry *lookup_one(struct user_naEXPORT_SYMBOL (lookup_one);/** -* lookup_one_len_unlocked - filesystem helper to lookup single pathname component +* lookup_one_unlocked - filesystem helper to lookup single pathname component +* @mnt_userns: idmapping of the mount the lookup is performed from * @name: pathname component to lookup * @base: base directory to lookup from * @len: maximum length @len should be interpreted to
@@ -2779,14 +2780,15 @@ EXPORT_SYMBOL(lookup_one);* Unlike lookup_one_len, it should be called without the parent * i_mutex held, and will take the i_mutex itself if necessary. */ -struct dentry *lookup_one_len_unlocked (const char *name, -struct dentry *base,int len) +struct dentry *lookup_one_unlocked (struct user_namespace *mnt_userns, +const char *name,struct dentry *base, +int len) {struct qstr this;int err;struct dentry *ret; - err =lookup_one_common (&init_user_ns, name, base, len, &this); + err =lookup_one_common (mnt_userns, name, base, len, &this);if (err)return ERR_PTR (err);
@@ -2795,6 +2797,59 @@ struct dentry *lookup_one_len_unlocked(c ret =lookup_slow (&this, base,0 );return ret; } +EXPORT_SYMBOL (lookup_one_unlocked); + +/** +* lookup_one_positive_unlocked - filesystem helper to lookup single +* pathname component +* @mnt_userns: idmapping of the mount the lookup is performed from +* @name: pathname component to lookup +* @base: base directory to lookup from +* @len: maximum length @len should be interpreted to +* +* This helper will yield ERR_PTR(-ENOENT) on negatives. The helper returns +* known positive or ERR_PTR(). This is what most of the users want. +* +* Note that pinned negative with unlocked parent _can_ become positive at any +* time, so callers of lookup_one_unlocked() need to be very careful; pinned +* positives have >d_inode stable, so this one avoids such problems. +* +* Note that this routine is purely a helper for filesystem usage and should +* not be called by generic code. +* +* The helper should be called without i_mutex held. +*/ +struct dentry *lookup_one_positive_unlocked (struct user_namespace *mnt_userns, +const char *name, +struct dentry *base,int len) +{ +struct dentry *ret =lookup_one_unlocked (mnt_userns, name, base, len); + +if (!IS_ERR (ret) &&d_flags_negative (smp_load_acquire (&ret->d_flags))) { +dput (ret); + ret =ERR_PTR (-ENOENT ); + } +return ret; +} +EXPORT_SYMBOL (lookup_one_positive_unlocked); + +/** +* lookup_one_len_unlocked - filesystem helper to lookup single pathname component +* @name: pathname component to lookup +* @base: base directory to lookup from +* @len: maximum length @len should be interpreted to +* +* Note that this routine is purely a helper for filesystem usage and should +* not be called by generic code. +* +* Unlike lookup_one_len, it should be called without the parent +* i_mutex held, and will take the i_mutex itself if necessary. +*/ +struct dentry *lookup_one_len_unlocked (const char *name, +struct dentry *base,int len) +{ +return lookup_one_unlocked (&init_user_ns, name, base, len); +}EXPORT_SYMBOL (lookup_one_len_unlocked);/*
@@ -2808,12 +2863,7 @@ EXPORT_SYMBOL(lookup_one_len_unlocked);struct dentry *lookup_positive_unlocked (const char *name,struct dentry *base,int len) { -struct dentry *ret =lookup_one_len_unlocked (name, base, len); -if (!IS_ERR (ret) &&d_flags_negative (smp_load_acquire (&ret->d_flags))) { -dput (ret); - ret =ERR_PTR (-ENOENT ); - } -return ret; +return lookup_one_positive_unlocked (&init_user_ns, name, base, len); }EXPORT_SYMBOL (lookup_positive_unlocked);
include/linux/namei.h +6 -0
@@ -69,6 +69,12 @@ extern struct dentry *lookup_one_len(conextern struct dentry *lookup_one_len_unlocked (const char *,struct dentry *,int );extern struct dentry *lookup_positive_unlocked (const char *,struct dentry *,int );struct dentry *lookup_one (struct user_namespace *,const char *,struct dentry *,int ); +struct dentry *lookup_one_unlocked (struct user_namespace *mnt_userns, +const char *name,struct dentry *base, +int len); +struct dentry *lookup_one_positive_unlocked (struct user_namespace *mnt_userns, +const char *name, +struct dentry *base,int len);extern int follow_down_one (struct path *);extern int follow_down (struct path *);
Greg Kroah-Hartman
maintainerPATCH 764/772 MIPS: IP30: Remove incorrect `cpu_has_fpu override
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
commit f44b3e74c33fe04defeff24ebcae98c3bcc5b285 upstream.
Remove unsupported forcing of cpu_has_fpu' to 1, which makes the nofpu' kernel parameter non-functional, and also causes a link error:
ld: arch/mips/kernel/traps.o: in function `trap_init':
./arch/mips/include/asm/msa.h:(.init.text+0x348): undefined reference to `handle_fpe'
ld: ./arch/mips/include/asm/msa.h:(.init.text+0x354): undefined reference to `handle_fpe'
ld: ./arch/mips/include/asm/msa.h:(.init.text+0x360): undefined reference to `handle_fpe'
where the CONFIG_MIPS_FP_SUPPORT configuration option has been disabled.
--- arch/mips/include/asm/mach-ip30/cpu-feature-overrides.h | 1 - 1 file changed, 1 deletion(-)
arch/mips/include/asm/mach-ip30/cpu-feature-overrides.h +0 -1
@@ -29,7 +29,6 @@#define cpu_has_3k_cache 0#define cpu_has_4k_cache 1#define cpu_has_tx39_cache 0 -#define cpu_has_fpu 1#define cpu_has_nofpuex 0#define cpu_has_32fpr 1#define cpu_has_counter 1
Greg Kroah-Hartman
maintainerPATCH 765/772 ext4: only allow test_dummy_encryption when supported
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 5f41fdaea63ddf96d921ab36b2af4a90ccdb5744 upstream.
Make the test_dummy_encryption mount option require that the encrypt feature flag be already enabled on the filesystem, rather than automatically enabling it. Practically, this means that "-O encrypt" will need to be included in MKFS_OPTIONS when running xfstests with the test_dummy_encryption mount option. (ext4/053 also needs an update.)
Moreover, as long as the preconditions for test_dummy_encryption are being tightened anyway, take the opportunity to start rejecting it when !CONFIG_FS_ENCRYPTION rather than ignoring it.
The motivation for requiring the encrypt feature flag is that:
- Having the filesystem auto-enable feature flags is problematic, as it bypasses the usual sanity checks. The specific issue which came up recently is that in kernel versions where ext4 supports casefold but not encrypt+casefold (v5.1 through v5.10), the kernel will happily add the encrypt flag to a filesystem that has the casefold flag, making it unmountable -- but only for subsequent mounts, not the initial one. This confused the casefold support detection in xfstests, causing generic/556 to fail rather than be skipped.
- The xfstests-bld test runners (kvm-xfstests et al.) already use the required mkfs flag, so they will not be affected by this change. Only users of test_dummy_encryption alone will be affected. But, this option has always been for testing only, so it should be fine to require that the few users of this option update their test scripts.
- f2fs already requires it (for its equivalent feature flag).
--- fs/ext4/ext4.h | 6 ----- fs/ext4/super.c | 60 +++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 28 deletions(-)
fs/ext4/ext4.h +0 -6
@@ -1438,12 +1438,6 @@ struct ext4_super_block {#ifdef __KERNEL__ -#ifdef CONFIG_FS_ENCRYPTION -#define DUMMY_ENCRYPTION_ENABLED (sbi) ((sbi)->s_dummy_enc_policy.policy != NULL) -#else -#define DUMMY_ENCRYPTION_ENABLED (sbi) (0) -#endif -/* Number of quota types we support */ #define EXT4_MAXQUOTAS 3
fs/ext4/super.c +38 -22
93 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 768/772 fs/ntfs3: Fix invalid free in log_replay
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit f26967b9f7a830e228bb13fb41bd516ddd9d789d upstream.
log_read_rst() returns ENOMEM error when there is not enough memory. In this case, if info is returned without initialization,
it attempts to kfree the uninitialized info->r_page pointer. This patch moves the memset initialization code to before log_read_rst() is called.
--- fs/ntfs3/fslog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ntfs3/fslog.c +3 -3
@@ -1185,8 +1185,6 @@ static int log_read_rst(struct ntfs_logif (!r_page)return -ENOMEM ; -memset (info,0 ,sizeof (struct restart_info )); -/* Determine which restart area we are looking for. */ if (first) { vbo =0 ;
@@ -3791,10 +3789,11 @@ int log_replay(struct ntfs_inode *ni, boif (!log)return -ENOMEM ; +memset (&rst_info,0 ,sizeof (struct restart_info )); + log->ni = ni; log->l_size = l_size; log->one_page_buf =kmalloc (page_size,GFP_NOFS ); -if (!log->one_page_buf) { err = -ENOMEM ; goto out;
@@ -3842,6 +3841,7 @@ int log_replay(struct ntfs_inode *ni, boif (rst_info.vbo) goto check_restart_area; +memset (&rst_info2,0 ,sizeof (struct restart_info )); err =log_read_rst (log, l_size, false, &rst_info2);/* Determine which restart area to use. */
Greg Kroah-Hartman
maintainerPATCH 770/772 md: fix double free of io_acct_set bioset
In reply to Greg Kroah-HartmanFrom: Xiao Ni <[email protected]>
commit 42b805af102471f53e3c7867b8c2b502ea4eef7e upstream.
Now io_acct_set is alloc and free in personality. Remove the codes that free io_acct_set in md_free and md_stop.
--- drivers/md/md.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/md/md.c +0 -4
@@ -5600,8 +5600,6 @@ static void md_free(struct kobject *ko)bioset_exit (&mddev->bio_set);bioset_exit (&mddev->sync_set); -if (mddev->level !=1 && mddev->level !=10 ) -bioset_exit (&mddev->io_acct_set);kfree (mddev); }
@@ -6288,8 +6286,6 @@ void md_stop(struct mddev *mddev)__md_stop (mddev);bioset_exit (&mddev->bio_set);bioset_exit (&mddev->sync_set); -if (mddev->level !=1 && mddev->level !=10 ) -bioset_exit (&mddev->io_acct_set); }EXPORT_SYMBOL_GPL (md_stop);
Greg Kroah-Hartman
maintainerPATCH 771/772 md: bcache: check the return value of kzalloc() in detached_dev_do_request()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
commit 40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19 upstream.
The function kzalloc() in detached_dev_do_request() can fail, so its return value should be checked.
--- drivers/md/bcache/request.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/md/bcache/request.c +6 -0
@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(stru* which would call closure_get(&dc->disk.cl) */ ddip =kzalloc (sizeof (struct detached_dev_io_private ),GFP_NOIO ); +if (!ddip) { + bio->bi_status =BLK_STS_RESOURCE ; + bio->bi_end_io (bio); +return ; + } + ddip->d = d;/* Count on the bcache device */ ddip->orig_bdev = orig_bdev;
Greg Kroah-Hartman
maintainerPATCH 738/772 tilcdc: tilcdc_external: fix an incorrect NULL check on list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit 8b917cbe38e9b0d002492477a9fc2bfee2412ce4 upstream.
The bug is here:
if (!encoder) {The list iterator value 'encoder' will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found.
To fix the bug, use a new variable 'iter' as the list iterator, while use the original variable 'encoder' as a dedicated pointer to point to the found element.
--- drivers/gpu/drm/tilcdc/tilcdc_external.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_external.c +5 -3
@@ -60,11 +60,13 @@ struct drm_connector *tilcdc_encoder_finint tilcdc_add_component_encoder (struct drm_device *ddev) {struct tilcdc_drm_private *priv = ddev->dev_private; -struct drm_encoder *encoder; +struct drm_encoder *encoder =NULL , *iter; -list_for_each_entry (encoder, &ddev->mode_config.encoder_list, head) -if (encoder->possible_crtcs & (1 << priv->crtc->index)) +list_for_each_entry (iter, &ddev->mode_config.encoder_list, head) +if (iter->possible_crtcs & (1 << priv->crtc->index)) { + encoder = iter;break ; + }if (!encoder) {dev_err (ddev->dev,"%s: No suitable encoder found\n" , __func__);
Greg Kroah-Hartman
maintainerPATCH 763/772 MIPS: IP27: Remove incorrect `cpu_has_fpu override
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
commit 424c3781dd1cb401857585331eaaa425a13f2429 upstream.
Remove unsupported forcing of cpu_has_fpu' to 1, which makes the nofpu' kernel parameter non-functional, and also causes a link error:
ld: arch/mips/kernel/traps.o: in function `trap_init':
./arch/mips/include/asm/msa.h:(.init.text+0x348): undefined reference to `handle_fpe'
ld: ./arch/mips/include/asm/msa.h:(.init.text+0x354): undefined reference to `handle_fpe'
ld: ./arch/mips/include/asm/msa.h:(.init.text+0x360): undefined reference to `handle_fpe'
where the CONFIG_MIPS_FP_SUPPORT configuration option has been disabled.
--- arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h | 1 - 1 file changed, 1 deletion(-)
arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h +0 -1
@@ -26,7 +26,6 @@#define cpu_has_3k_cache 0#define cpu_has_4k_cache 1#define cpu_has_tx39_cache 0 -#define cpu_has_fpu 1#define cpu_has_nofpuex 0#define cpu_has_32fpr 1#define cpu_has_counter 1
Greg Kroah-Hartman
maintainerPATCH 732/772 stm: ltdc: fix two incorrect NULL checks on list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit 2e6c86be0e57079d1fb6c7c7e5423db096d0548a upstream.
The two bugs are here:
if (encoder) {
if (bridge && bridge->timings)The list iterator value 'encoder/bridge' will *always* be set and non-NULL by drm_for_each_encoder()/list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found.
To fix the bug, use a new variable '*_iter' as the list iterator, while use the old variable 'encoder/bridge' as a dedicated pointer to point to the found element.
--- drivers/gpu/drm/stm/ltdc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/stm/ltdc.c +10 -6
@@ -528,8 +528,8 @@ static void ltdc_crtc_mode_set_nofb(strustruct drm_device *ddev = crtc->dev;struct drm_connector_list_iter iter;struct drm_connector *connector =NULL ; -struct drm_encoder *encoder =NULL ; -struct drm_bridge *bridge =NULL ; +struct drm_encoder *encoder =NULL , *en_iter; +struct drm_bridge *bridge =NULL , *br_iter;struct drm_display_mode *mode = &crtc->state->adjusted_mode;u32 hsync, vsync, accum_hbp, accum_vbp, accum_act_w, accum_act_h;u32 total_width, total_height;
@@ -538,15 +538,19 @@ static void ltdc_crtc_mode_set_nofb(struint ret;/* get encoder from crtc */ -drm_for_each_encoder (encoder, ddev) -if (encoder->crtc == crtc) +drm_for_each_encoder (en_iter, ddev) +if (en_iter->crtc == crtc) { + encoder = en_iter;break ; + }if (encoder) {/* get bridge from encoder */ -list_for_each_entry (bridge, &encoder->bridge_chain, chain_node) -if (bridge->encoder == encoder) +list_for_each_entry (br_iter, &encoder->bridge_chain, chain_node) +if (br_iter->encoder == encoder) { + bridge = br_iter;break ; + }/* Get the connector from encoder */ drm_connector_list_iter_begin (ddev, &iter);
Greg Kroah-Hartman
maintainerPATCH 741/772 arm64: tegra: Add missing DFLL reset on Tegra210
In reply to Greg Kroah-HartmanFrom: Diogo Ivo <[email protected]>
commit 0017f2c856e21bb900be88469e15dac4f41f4065 upstream.
Commit 4782c0a5dd88 ("clk: tegra: Don't deassert reset on enabling clocks") removed deassertion of reset lines when enabling peripheral clocks. This breaks the initialization of the DFLL driver which relied on this behaviour.
In order to be able to fix this, add the corresponding reset to the DT. Tested on Google Pixel C.
--- arch/arm64/boot/dts/nvidia/tegra210.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +3 -2
@@ -1366,8 +1366,9 @@ <&tegra_car TEGRA210_CLK_DFLL_REF>, <&tegra_car TEGRA210_CLK_I2C5>; clock-names = "soc", "ref", "i2c"; - resets = <&tegra_car TEGRA210_RST_DFLL_DVCO>; - reset-names = "dvco"; + resets = <&tegra_car TEGRA210_RST_DFLL_DVCO>, + <&tegra_car 155>; + reset-names = "dvco", "dfll"; #clock-cells = <0>; clock-output-names = "dfllCPU_out"; status = "disabled";
Greg Kroah-Hartman
maintainerPATCH 740/772 arm64: dts: qcom: ipq8074: fix the sleep clock frequency
In reply to Greg Kroah-HartmanFrom: Kathiravan T <[email protected]>
commit f607dd767f5d6800ffbdce5b99ba81763b023781 upstream.
Sleep clock frequency should be 32768Hz. Lets fix it.
--- arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/ipq8074.dtsi +1 -1
@@ -13,7 +13,7 @@ clocks { sleep_clk: sleep_clk { compatible = "fixed-clock"; - clock-frequency = <32000>; + clock-frequency = <32768>; #clock-cells = <0>; };
Greg Kroah-Hartman
maintainerPATCH 767/772 exportfs: support idmapped mounts
In reply to Greg Kroah-HartmanFrom: Christian Brauner <[email protected]>
commit 3a761d72fa62eec8913e45d29375344f61706541 upstream.
Make the two locations where exportfs helpers check permission to lookup a given inode idmapped mount aware by switching it to the lookup_one() helper. This is a bugfix for the open_by_handle_at() system call which doesn't take idmapped mounts into account currently. It's not tied to a specific commit so we'll just Cc stable.
In addition this is required to support idmapped base layers in overlay. The overlay filesystem uses exportfs to encode and decode file handles for its index=on mount option and when nfs_export=on.
--- fs/exportfs/expfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/exportfs/expfs.c +3 -2
@@ -145,7 +145,7 @@ static struct dentry *reconnect_one(struif (err) goto out_err;dprintk ("%s: found name: %s\n" , __func__, nbuf); - tmp =lookup_one_len_unlocked (nbuf, parent,strlen (nbuf)); + tmp =lookup_one_unlocked (mnt_user_ns (mnt), nbuf, parent,strlen (nbuf));if (IS_ERR (tmp)) {dprintk ("%s: lookup failed: %d\n" , __func__,PTR_ERR (tmp)); err =PTR_ERR (tmp);
@@ -525,7 +525,8 @@ exportfs_decode_fh_raw(struct vfsmount * }inode_lock (target_dir->d_inode); - nresult =lookup_one_len (nbuf, target_dir,strlen (nbuf)); + nresult =lookup_one (mnt_user_ns (mnt), nbuf, + target_dir,strlen (nbuf));if (!IS_ERR (nresult)) {if (unlikely (nresult->d_inode != result->d_inode)) {dput (nresult);
Greg Kroah-Hartman
maintainerPATCH 762/772 RDMA/rxe: Generate a completion for unsupported/invalid opcode
In reply to Greg Kroah-HartmanFrom: Xiao Yang <[email protected]>
commit 2f917af777011c88e977b9b9a5d00b280d3a59ce upstream.
Current rxe_requester() doesn't generate a completion when processing an unsupported/invalid opcode. If rxe driver doesn't support a new opcode (e.g. RDMA Atomic Write) and RDMA library supports it, an application using the new opcode can reproduce this issue. Fix the issue by calling "goto err;".
--- drivers/infiniband/sw/rxe/rxe_req.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_req.c +1 -1
@@ -661,7 +661,7 @@ next_wqe: opcode =next_opcode (qp, wqe, wqe->wr.opcode);if (unlikely (opcode <0 )) { wqe->status =IB_WC_LOC_QP_OP_ERR ; - goto exit; + goto err; } mask = rxe_opcode[opcode].mask;
Greg Kroah-Hartman
maintainerPATCH 736/772 bcache: avoid journal no-space deadlock by reserving 1 journal bucket
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
commit 32feee36c30ea06e38ccb8ae6e5c44c6eec790a6 upstream.
The journal no-space deadlock was reported time to time. Such deadlock can happen in the following situation.
When all journal buckets are fully filled by active jset with heavy write I/O load, the cache set registration (after a reboot) will load all active jsets and inserting them into the btree again (which is called journal replay). If a journaled bkey is inserted into a btree node and results btree node split, new journal request might be triggered. For example, the btree grows one more level after the node split, then the root node record in cache device super block will be upgrade by bch_journal_meta() from bch_btree_set_root(). But there is no space in journal buckets, the journal replay has to wait for new journal bucket to be reclaimed after at least one journal bucket replayed. This is one example that how the journal no-space deadlock happens.
The solution to avoid the deadlock is to reserve 1 journal bucket in run time, and only permit the reserved journal bucket to be used during cache set registration procedure for things like journal replay. Then the journal space will never be fully filled, there is no chance for journal no-space deadlock to happen anymore.
This patch adds a new member "bool do_reserve" in struct journal, it is inititalized to 0 (false) when struct journal is allocated, and set to 1 (true) by bch_journal_space_reserve() when all initialization done in run_cache_set(). In the run time when journal_reclaim() tries to allocate a new journal bucket, free_journal_buckets() is called to check whether there are enough free journal buckets to use. If there is only 1 free journal bucket and journal->do_reserve is 1 (true), the last bucket is reserved and free_journal_buckets() will return 0 to indicate no free journal bucket. Then journal_reclaim() will give up, and try next time to see whetheer there is free journal bucket to allocate. By this method, there is always 1 jouranl bucket reserved in run time.
During the cache set registration, journal->do_reserve is 0 (false), so the reserved journal bucket can be used to avoid the no-space deadlock.
--- drivers/md/bcache/journal.c | 31 ++++++++++++++++++++++++++----- drivers/md/bcache/journal.h | 2 ++ drivers/md/bcache/super.c | 1 + 3 files changed, 29 insertions(+), 5 deletions(-)
drivers/md/bcache/journal.c +26 -5
@@ -407,6 +407,11 @@ err:return ret; } +void bch_journal_space_reserve (struct journal *j) +{ + j->do_reserve = true; +} +/* Journalling */ static void btree_flush_write (struct cache_set *c)
@@ -625,12 +630,30 @@ static void do_journal_discard(struct ca } } +static unsigned int free_journal_buckets (struct cache_set *c) +{ +struct journal *j = &c->journal; +struct cache *ca = c->cache; +struct journal_device *ja = &c->cache->journal; +unsigned int n; + +/* In case njournal_buckets is not power of 2 */ +if (ja->cur_idx >= ja->discard_idx) + n = ca->sb.njournal_buckets + ja->discard_idx - ja->cur_idx; +else + n = ja->discard_idx - ja->cur_idx; + +if (n > (1 + j->do_reserve)) +return n - (1 + j->do_reserve); + +return 0 ; +} +static void journal_reclaim (struct cache_set *c) {struct bkey *k = &c->journal.key;struct cache *ca = c->cache;uint64_t last_seq; -unsigned int next;struct journal_device *ja = &ca->journal;atomic_t p__maybe_unused ;
@@ -653,12 +676,10 @@ static void journal_reclaim(struct cacheif (c->journal.blocks_free) goto out; - next = (ja->cur_idx +1 ) % ca->sb.njournal_buckets; -/* No space available on this device */ -if (next == ja->discard_idx) +if (!free_journal_buckets (c)) goto out; - ja->cur_idx = next; + ja->cur_idx = (ja->cur_idx +1 ) % ca->sb.njournal_buckets; k->ptr[0 ] =MAKE_PTR (0 ,bucket_to_sector (c, ca->sb.d[ja->cur_idx]), ca->sb.nr_this_dev);
drivers/md/bcache/journal.h +2 -0
@@ -105,6 +105,7 @@ struct journal {spinlock_t lock;spinlock_t flush_write_lock;bool btree_flushing; +bool do_reserve;/* used when waiting because the journal was full */ struct closure_waitlist wait;struct closure io;
@@ -182,5 +183,6 @@ int bch_journal_replay(struct cache_setvoid bch_journal_free (struct cache_set *c);int bch_journal_alloc (struct cache_set *c); +void bch_journal_space_reserve (struct journal *j);#endif /* _BCACHE_JOURNAL_H */
drivers/md/bcache/super.c +1 -0
@@ -2131,6 +2131,7 @@ static int run_cache_set(struct cache_seflash_devs_run (c); +bch_journal_space_reserve (&c->journal);set_bit (CACHE_SET_RUNNING , &c->flags);return 0 ; err:
Greg Kroah-Hartman
maintainerPATCH 737/772 serial: pch: dont overwrite xmit->buf[0] by x_char
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
commit d9f3af4fbb1d955bbaf872d9e76502f6e3e803cb upstream.
When x_char is to be sent, the TX path overwrites whatever is in the circular buffer at offset 0 with x_char and sends it using pch_uart_hal_write(). I don't understand how this was supposed to work if xmit->buf[0] already contained some character. It must have been lost.
Remove this whole pop_tx_x() concept and do the work directly in the callers. (Without printing anything using dev_dbg().)
--- drivers/tty/serial/pch_uart.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
drivers/tty/serial/pch_uart.c +7 -20
@@ -624,22 +624,6 @@ static int push_rx(struct eg20t_port *prreturn 0 ; } -static int pop_tx_x (struct eg20t_port *priv,unsigned char *buf) -{ -int ret =0 ; -struct uart_port *port = &priv->port; - -if (port->x_char) { -dev_dbg (priv->port.dev,"%s:X character send %02x (%lu)\n" , - __func__, port->x_char, jiffies); - buf[0 ] = port->x_char; - port->x_char =0 ; - ret =1 ; - } - -return ret; -} -static int dma_push_rx (struct eg20t_port *priv,int size) {int room;
@@ -889,9 +873,10 @@ static unsigned int handle_tx(struct eg2 fifo_size =max (priv->fifo_size,1 ); tx_empty =1 ; -if (pop_tx_x (priv, xmit->buf)) { -pch_uart_hal_write (priv, xmit->buf,1 ); +if (port->x_char) { +pch_uart_hal_write (priv, &port->x_char,1 ); port->icount.tx++; + port->x_char =0 ; tx_empty =0 ; fifo_size--; }
@@ -946,9 +931,11 @@ static unsigned int dma_handle_tx(struct } fifo_size =max (priv->fifo_size,1 ); -if (pop_tx_x (priv, xmit->buf)) { -pch_uart_hal_write (priv, xmit->buf,1 ); + +if (port->x_char) { +pch_uart_hal_write (priv, &port->x_char,1 ); port->icount.tx++; + port->x_char =0 ; fifo_size--; }
Greg Kroah-Hartman
maintainerPATCH 739/772 gma500: fix an incorrect NULL check on list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit bdef417d84536715145f6dc9cc3275c46f26295a upstream.
The bug is here:
return crtc;
The list iterator value 'crtc' will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found.
To fix the bug, return 'crtc' when found, otherwise return NULL.
--- drivers/gpu/drm/gma500/psb_intel_display.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/gma500/psb_intel_display.c +4 -3
@@ -535,14 +535,15 @@ void psb_intel_crtc_init(struct drm_devistruct drm_crtc *psb_intel_get_crtc_from_pipe (struct drm_device *dev,int pipe) { -struct drm_crtc *crtc =NULL ; +struct drm_crtc *crtc;list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct gma_crtc *gma_crtc =to_gma_crtc (crtc); +if (gma_crtc->pipe == pipe) -break ; +return crtc; } -return crtc; +return NULL ; }int gma_connector_clones (struct drm_device *dev,int type_mask)
Greg Kroah-Hartman
maintainerPATCH 772/772 tty: n_gsm: Fix packet data hex dump output
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
commit 925ea0fa5277c1e6bb9e51955ef34eea9736c3d7 upstream.
The module param debug for n_gsm uses KERN_INFO level, but the hexdump now uses KERN_DEBUG level. This started after commit 091cb0994edd ("lib/hexdump: make print_hex_dump_bytes() a nop on !DEBUG builds"). We now use dynamic_hex_dump() unless DEBUG is set.
This causes no packets to be seen with modprobe n_gsm debug=0x1f unlike earlier. Let's fix this by adding gsm_hex_dump_bytes() that calls print_hex_dump() with KERN_INFO to match what n_gsm is doing with the other debug related output.
--- drivers/tty/n_gsm.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/tty/n_gsm.c +23 -8
@@ -444,6 +444,25 @@ static u8 gsm_encode_modem(const structreturn modembits; } +static void gsm_hex_dump_bytes (const char *fname,const u8 *data, +unsigned long len) +{ +char *prefix; + +if (!fname) { +print_hex_dump (KERN_INFO ,"" ,DUMP_PREFIX_NONE ,16 ,1 , data, len, + true); +return ; + } + + prefix =kasprintf (GFP_KERNEL ,"%s: " , fname); +if (!prefix) +return ; +print_hex_dump (KERN_INFO , prefix,DUMP_PREFIX_OFFSET ,16 ,1 , data, len, + true); +kfree (prefix); +} +/** * gsm_print_packet - display a frame for debug * @hdr: header to print before decode
@@ -508,7 +527,7 @@ static void gsm_print_packet(const charelse pr_cont ("(F)" ); -print_hex_dump_bytes ("" ,DUMP_PREFIX_NONE , data, dlen); +gsm_hex_dump_bytes (NULL , data, dlen); }
@@ -698,9 +717,7 @@ static void gsm_data_kick(struct gsm_mux }if (debug &4 ) -print_hex_dump_bytes ("gsm_data_kick: " , -DUMP_PREFIX_OFFSET , - gsm->txframe, len); +gsm_hex_dump_bytes (__func__, gsm->txframe, len);if (gsmld_output (gsm, gsm->txframe, len) <=0 )break ;/* FIXME: Can eliminate one SOF in many more cases */
@@ -2448,8 +2465,7 @@ static int gsmld_output(struct gsm_mux *return -ENOSPC ; }if (debug &4 ) -print_hex_dump_bytes ("gsmld_output: " ,DUMP_PREFIX_OFFSET , - data, len); +gsm_hex_dump_bytes (__func__, data, len);return gsm->tty->ops->write (gsm->tty, data, len); }
@@ -2525,8 +2541,7 @@ static void gsmld_receive_buf(struct ttychar flags =TTY_NORMAL ;if (debug &4 ) -print_hex_dump_bytes ("gsmld_receive: " ,DUMP_PREFIX_OFFSET , - cp, count); +gsm_hex_dump_bytes (__func__, cp, count);for (; count; count--, cp++) {if (fp)
Greg Kroah-Hartman
maintainerPATCH 769/772 md: Dont set mddev private to NULL in raid0 pers->free
In reply to Greg Kroah-HartmanFrom: Xiao Ni <[email protected]>
commit 0f2571ad7a30ff6b33cde142439f9378669f8b4f upstream.
In normal stop process, it does like this:
do_md_stop
|
__md_stop (pers->free(); mddev->private=NULL)
| md_free (free mddev)__md_stop sets mddev->private to NULL after pers->free. The raid device will be stopped and mddev memory is free. But in reshape, it doesn't free the mddev and mddev will still be used in new raid.
In reshape, it first sets mddev->private to new_pers and then runs old_pers->free(). Now raid0 sets mddev->private to NULL in raid0_free. The new raid can't work anymore. It will panic when dereference mddev->private because of NULL pointer dereference.
It can panic like this:
[63010.814972] kernel BUG at drivers/md/raid10.c:928! [63010.819778] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [63010.825011] CPU: 3 PID: 44437 Comm: md0_resync Kdump: loaded Not tainted 5.14.0-86.el9.x86_64 #1 [63010.833789] Hardware name: Dell Inc. PowerEdge R6415/07YXFK, BIOS 1.15.0 09/11/2020 [63010.841440] RIP: 0010:raise_barrier+0x161/0x170 [raid10] [63010.865508] RSP: 0018:ffffc312408bbc10 EFLAGS: 00010246 [63010.870734] RAX: 0000000000000000 RBX: ffffa00bf7d39800 RCX: 0000000000000000 [63010.877866] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffffa00bf7d39800 [63010.884999] RBP: 0000000000000000 R08: fffffa4945e74400 R09: 0000000000000000 [63010.892132] R10: ffffa00eed02f798 R11: 0000000000000000 R12: ffffa00bbc435200 [63010.899266] R13: ffffa00bf7d39800 R14: 0000000000000400 R15: 0000000000000003 [63010.906399] FS: 0000000000000000(0000) GS:ffffa00eed000000(0000) knlGS:0000000000000000 [63010.914485] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [63010.920229] CR2: 00007f5cfbe99828 CR3: 0000000105efe000 CR4: 00000000003506e0 [63010.927363] Call Trace: [63010.929822] ? bio_reset+0xe/0x40 [63010.933144] ? raid10_alloc_init_r10buf+0x60/0xa0 [raid10] [63010.938629] raid10_sync_request+0x756/0x1610 [raid10] [63010.943770] md_do_sync.cold+0x3e4/0x94c [63010.947698] md_thread+0xab/0x160 [63010.951024] ? md_write_inc+0x50/0x50 [63010.954688] kthread+0x149/0x170 [63010.957923] ? set_kthread_struct+0x40/0x40 [63010.962107] ret_from_fork+0x22/0x30
Removing the code that sets mddev->private to NULL in raid0 can fix problem.
--- drivers/md/raid0.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/raid0.c +0 -1
@@ -361,7 +361,6 @@ static void free_conf(struct mddev *mddekfree (conf->strip_zone);kfree (conf->devlist);kfree (conf); - mddev->private =NULL ; }static void raid0_free (struct mddev *mddev,void *priv)
Greg Kroah-Hartman
maintainerPATCH 735/772 bcache: remove incremental dirty sector counting for bch_sectors_dirty_init()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
commit 80db4e4707e78cb22287da7d058d7274bd4cb370 upstream.
After making bch_sectors_dirty_init() being multithreaded, the existing incremental dirty sector counting in bch_root_node_dirty_init() doesn't release btree occupation after iterating 500000 (INIT_KEYS_EACH_TIME) bkeys. Because a read lock is added on btree root node to prevent the btree to be split during the dirty sectors counting, other I/O requester has no chance to gain the write lock even restart bcache_btree().
That is to say, the incremental dirty sectors counting is incompatible to the multhreaded bch_sectors_dirty_init(). We have to choose one and drop another one.
In my testing, with 512 bytes random writes, I generate 1.2T dirty data and a btree with 400K nodes. With single thread and incremental dirty sectors counting, it takes 30+ minites to register the backing device. And with multithreaded dirty sectors counting, the backing device registration can be accomplished within 2 minutes.
The 30+ minutes V.S. 2- minutes difference makes me decide to keep multithreaded bch_sectors_dirty_init() and drop the incremental dirty sectors counting. This is what this patch does.
But INIT_KEYS_EACH_TIME is kept, in sectors_dirty_init_fn() the CPU will be released by cond_resched() after every INIT_KEYS_EACH_TIME keys iterated. This is to avoid the watchdog reports a bogus soft lockup warning.
--- drivers/md/bcache/writeback.c | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-)
drivers/md/bcache/writeback.c +12 -27
@@ -802,13 +802,11 @@ static int bch_writeback_thread(void *ar/* Init */ #define INIT_KEYS_EACH_TIME 500000 -#define INIT_KEYS_SLEEP_MS 100struct sectors_dirty_init {struct btree_op op;unsigned int inode;size_t count; -struct bkey start; }; static int sectors_dirty_init_fn(struct btree_op *_op, struct btree *b,
@@ -824,11 +822,8 @@ static int sectors_dirty_init_fn(struct KEY_START(k), KEY_SIZE(k)); op->count++; -if (atomic_read (&b->c->search_inflight) && - !(op->count %INIT_KEYS_EACH_TIME )) { -bkey_copy_key (&op->start, k); -return -EAGAIN ; - } +if (!(op->count %INIT_KEYS_EACH_TIME )) +cond_resched ();return MAP_CONTINUE ; }
@@ -843,24 +838,16 @@ static int bch_root_node_dirty_init(strubch_btree_op_init (&op.op,-1 ); op.inode = d->id; op.count =0 ; - op.start =KEY (op.inode,0 ,0 ); -do { - ret =bcache_btree (map_keys_recurse, - k, - c->root, - &op.op, - &op.start, - sectors_dirty_init_fn, -0 ); -if (ret == -EAGAIN ) -schedule_timeout_interruptible ( -msecs_to_jiffies (INIT_KEYS_SLEEP_MS )); -else if (ret <0 ) { -pr_warn ("sectors dirty init failed, ret=%d!\n" , ret); -break ; - } - }while (ret == -EAGAIN ); + ret =bcache_btree (map_keys_recurse, + k, + c->root, + &op.op, + &KEY (op.inode,0 ,0 ), + sectors_dirty_init_fn, +0 ); +if (ret <0 ) +pr_warn ("sectors dirty init failed, ret=%d!\n" , ret);return ret; }
@@ -904,7 +891,6 @@ static int bch_dirty_init_thread(void *a goto out; } skip_nr--; -cond_resched (); }if (p) {
@@ -914,7 +900,6 @@ static int bch_dirty_init_thread(void *a p =NULL ; prev_idx = cur_idx; -cond_resched (); } out:
@@ -953,11 +938,11 @@ void bch_sectors_dirty_init(struct bcachbch_btree_op_init (&op.op,-1 ); op.inode = d->id; op.count =0 ; - op.start =KEY (op.inode,0 ,0 );for_each_key_filter (&c->root->keys, k, &iter, bch_ptr_invalid)sectors_dirty_init_fn (&op.op, c->root, k); +rw_unlock (0 , c->root);return ; }
Re: [PATCH 5.17 404/772] media: rkvdec: Stop overclocking the decoder
In reply to Greg Kroah-HartmanHi,
Quoted 18 lines · Greg Kroah-Hartman
From: Nicolas Dufresne <[email protected]>
[ Upstream commit
9998943f6dfc5d5472bfab2e38527fb6ba5e9da7]While this overclock hack seems to work on some implementations (some ChromeBooks, RockPi4) it also causes instability on other implementations (notably LibreComputer Renegade, but there were more reports in the LibreELEC project, where this has been removed). While performance is indeed affected (tested with GStreamer), 4K playback still works as long as you don't operate in lock step and keep at least 1 frame ahead of time in the decode queue.
After discussion with ChromeOS members, it would seem that their implementation indeed used to synchronously decode each frame, so this hack was simply compensating for their code being less efficient. In my opinion, this hack should not have been included upstream.
Quoted 7 lines
Fixes cd33c830448ba ("media: rkvdec: Add the rkvdec driver")Signed-off-by Nicolas Dufresne <[email protected]>Reviewed-by Sebastian Fricke <[email protected]>Reviewed-by Ezequiel Garcia <[email protected]>Signed-off-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Sasha Levin <[email protected]>
FWIW, I've noticed a problem that is uncovered by this patch, because the default clock rate is not currently acceptable all the time. See my fix here:
https://lore.kernel.org/all/20220607141535.1.Idafe043ffc94756a69426ec68872db0645c5d6e2@changeid/
[PATCH] arm64: dts: rockchip: Assign RK3399 VDU clock rate
It might be nice if $subject patch could be delayed until the fix is in too. The 5.19 cycle is only in -rc1, after all.
(The same seems to apply for the 5.{18,15,10}.y series too.)
Brian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Re: [PATCH 5.17 001/772] arm64: Initialize jump labels before setup_machine_fdt()
In reply to Greg Kroah-HartmanQuoted 47 lines · Greg Kroah-Hartman
From: Stephen Boyd <[email protected]>
commit
73e2d827a501d48dceeb5b9b267a4cd283d6b1aeupstream.A static key warning splat appears during early boot on arm64 systems that credit randomness from devicetrees that contain an "rng-seed" property. This is because
setup_machine_fdt()is called beforejump_label_init()duringsetup_arch(). Let's swap the order of these two calls so that jump labels are initialized before the devicetree is unflattened and the rng seed is credited.
static_key_enable_cpuslocked(): static key '0xffffffe51c6fcfc0' used before call tojump_label_init()WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpuslocked+0xb0/0xb8 Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0+ #224 44b43e377bfc84bc99bb5ab885ff694984ee09ff pstate: 600001c9 (nZCv dAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : static_key_enable_cpuslocked+0xb0/0xb8 lr : static_key_enable_cpuslocked+0xb0/0xb8 sp : ffffffe51c393cf0 x29: ffffffe51c393cf0 x28: 000000008185054c x27: 00000000f1042f10 x26: 0000000000000000 x25: 00000000f10302b2 x24: 0000002513200000 x23: 0000002513200000 x22: ffffffe51c1c9000 x21: fffffffdfdc00000 x20: ffffffe51c2f0831 x19: ffffffe51c6fcfc0 x18: 00000000ffff1020 x17: 00000000e1e2ac90 x16: 00000000000000e0 x15: ffffffe51b710708 x14: 0000000000000066 x13: 0000000000000018 x12: 0000000000000000 x11: 0000000000000000 x10: 00000000ffffffff x9 : 0000000000000000 x8 : 0000000000000000 x7 : 61632065726f6665 x6 : 6220646573752027 x5 : ffffffe51c641d25 x4 : ffffffe51c13142c x3 : ffff0a00ffffff05 x2 : 40000000ffffe003 x1 : 00000000000001c0 x0 : 0000000000000065 Call trace: static_key_enable_cpuslocked+0xb0/0xb8 static_key_enable+0x2c/0x40 crng_set_ready+0x24/0x30 execute_in_process_context+0x80/0x90 _credit_init_bits+0x100/0x154 add_bootloader_randomness+0x64/0x78 early_init_dt_scan_chosen+0x140/0x184 early_init_dt_scan_nodes+0x28/0x4c early_init_dt_scan+0x40/0x44 setup_machine_fdt+0x7c/0x120 setup_arch+0x74/0x1d8 start_kernel+0x84/0x44c __primary_switched+0xc0/0xc8 ---[ end trace 0000000000000000 ]--- random: crng init done Machine model: Google Lazor (rev1 - 2) with LTE
Quoted 13 lines
Cc Hsin-Yi Wang <[email protected]>Cc Douglas Anderson <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Steven Rostedt <[email protected]>Cc Jason A. Donenfeld <[email protected]>Cc Dominik Brodowski <[email protected]>Fixes f5bda35fba61 ("random: use static branch for crng_ready()")Signed-off-by Stephen Boyd <[email protected]>Reviewed-by Jason A. Donenfeld <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Please drop this from 5.17 as no longer needed. Thanks.
Signature · 1 line
Catalin
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +0000. Anything received after that time might be too late.
Build test (gcc version 11.3.1 20220606):
mips: 60 configs -> no failure
arm: 99 configs -> no failure
arm64: 3 configs -> no failurex86_64: 4 configs -> no failure
alpha allmodconfig -> no failure
csky allmodconfig -> no failure
powerpc allmodconfig -> no failure
riscv allmodconfig -> no failure
s390 allmodconfig -> no failure
xtensa allmodconfig -> no failure
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]
mips: Booted on ci20 board. No regression. [3]
[1]. https://openqa.qa.codethink.co.uk/tests/1290
[2]. https://openqa.qa.codethink.co.uk/tests/1294
[3]. https://openqa.qa.codethink.co.uk/tests/1296
--
Regards
Sudip
Greg Kroah-Hartman
maintainerRe: [PATCH 5.17 404/772] media: rkvdec: Stop overclocking the decoder
In reply to Brian NorrisQuoted 33 lines · Brian Norris
Hi,
Quoted 18 lines · Greg Kroah-Hartman
From: Nicolas Dufresne <[email protected]>
[ Upstream commit
9998943f6dfc5d5472bfab2e38527fb6ba5e9da7]While this overclock hack seems to work on some implementations (some ChromeBooks, RockPi4) it also causes instability on other implementations (notably LibreComputer Renegade, but there were more reports in the LibreELEC project, where this has been removed). While performance is indeed affected (tested with GStreamer), 4K playback still works as long as you don't operate in lock step and keep at least 1 frame ahead of time in the decode queue.
After discussion with ChromeOS members, it would seem that their implementation indeed used to synchronously decode each frame, so this hack was simply compensating for their code being less efficient. In my opinion, this hack should not have been included upstream.
Quoted 7 lines
Fixes cd33c830448ba ("media: rkvdec: Add the rkvdec driver")Signed-off-by Nicolas Dufresne <[email protected]>Reviewed-by Sebastian Fricke <[email protected]>Reviewed-by Ezequiel Garcia <[email protected]>Signed-off-by Hans Verkuil <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Sasha Levin <[email protected]>FWIW, I've noticed a problem that is uncovered by this patch, because the default clock rate is not currently acceptable all the time. See my fix here:
Quoted 7 lines
https://lore.kernel.org/all/20220607141535.1.Idafe043ffc94756a69426ec68872db0645c5d6e2@changeid/
[PATCH] arm64: dts: rockchip: Assign RK3399 VDU clock rateIt might be nice if $subject patch could be delayed until the fix is in too. The 5.19 cycle is only in -rc1, after all.
(The same seems to apply for the 5.{18,15,10}.y series too.)
Thanks, will go drop this from all branches now.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
Regressions found on qemu_x86_64:
- kunit/kasan [1]
Regressions found on qemu_i386:
- kunit/kfence [2]
- kunit/test_out_of_bounds_read
We will bisect and let you know more details about this reported problem.
[1] https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e/testrun/10038101/suite/kunit/test/kasan/details/
[2] https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e/testrun/10038215/suite/kunit/test/kfence/details/
## Build
* kernel: 5.17.14-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.17.y
* git commit: d0f9b2818e1e4d43847e10d6e5310a0c653cb18f
* git describe: v5.17.13-773-gd0f9b2818e1e
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e
## Test Regressions (compared to v5.17.11-188-g8eb69e8f0d45) Regressions found on qemu_x86_64:
- kunit/kasan [1]
Regressions found on qemu_i386:
- kunit/kfence [2]
- kunit/test_out_of_bounds_read
## Metric Regressions (compared to v5.17.11-188-g8eb69e8f0d45) No metric regressions found.
## Test Fixes (compared to v5.17.11-188-g8eb69e8f0d45) No test fixes found.
## Metric Fixes (compared to v5.17.11-188-g8eb69e8f0d45) No metric fixes found.
## Test result summary
total: 134591, pass: 121555, fail: 447, skip: 11730, xfail: 859
## Build Summary
* arm: 17 total, 14 passed, 3 failed
* arm64: 20 total, 20 passed, 0 failed
* i386: 17 total, 12 passed, 5 failed
* mips: 4 total, 1 passed, 3 failed
* parisc: 2 total, 2 passed, 0 failed
* powerpc: 5 total, 2 passed, 3 failed
* riscv: 5 total, 5 passed, 0 failed
* s390: 5 total, 2 passed, 3 failed
* sh: 2 total, 0 passed, 2 failed
* sparc: 2 total, 2 passed, 0 failed
* x86_64: 20 total, 20 passed, 0 failed
## Test suites summary
* fwts
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-cap_bounds-tests
* ltp-commands
* ltp-commands-tests
* ltp-containers
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests
* ltp-fcntl-locktests-tests
* ltp-filecaps
* ltp-filecaps-tests
* ltp-fs
* ltp-fs-tests
* ltp-fs_bind
* ltp-fs_bind-tests
* ltp-fs_perms_simple
* ltp-fs_perms_simple-tests
* ltp-fsx
* ltp-fsx-tests
* ltp-hugetlb
* ltp-hugetlb-tests
* ltp-io
* ltp-io-tests
* ltp-ipc
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, armv7, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
5.17.14-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Regression on RISC-V RV64 (HiFive Unmatched).
An Oops occurs when an NFS file system is mounted.
[ 98.244615] FS-Cache: Loaded
[ 99.311566] NFS: Registering the id_resolver key type
[ 99.311621] Key type id_resolver registered
[ 99.311626] Key type id_legacy registered
[ 99.469053] Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000000000
[ 99.479039] Oops [#1]
[ 99.481246] Modules linked in: rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs lockd grace fscache netfs nvme_fabrics sunrpc binfmt_misc nls_iso8859_1 da9063_onkey lm90 at24 uio_pdrv_genirq uio sch_fq_codel dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua ipmi_devintf ipmi_msghandler drm backlight ip_tables x_tables autofs4 btrfs blake2b_generic zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear rtc_da9063 da9063_regulator mscc macsec nvme macb xhci_pci nvme_core xhci_pci_renesas i2c_ocores phylink [ 99.532427] CPU: 2 PID: 889 Comm: mount.nfs Not tainted 5.17.13 #1
[ 99.538572] Hardware name: SiFive HiFive Unmatched A00 (DT)
[ 99.544133] epc : nfs_fattr_init+0x1e/0x48 [nfs]
[ 99.549059] ra : _nfs41_proc_get_locations+0xb4/0x128 [nfsv4]
[ 99.555877] epc : ffffffff02332e76 ra : ffffffff023c076c sp : ffffffc894793960
[ 99.563084] gp : ffffffff81a2ed00 tp : ffffffd896180000 t0 : ffffffd887720000
[ 99.570294] t1 : ffffffff81a9c110 t2 : ffffffff81003c04 s0 : ffffffc894793970
[ 99.577503] s1 : ffffffd887700000 a0 : 0000000000000000 a1 : ffffffd883de3d80
[ 99.584721] a2 : ffffffd887700000 a3 : ffffffc704608a00 a4 : ffffffff0236aa28
[ 99.591924] a5 : ffffffff02410cf8 a6 : ffffffff0240fc00 a7 : 0000000000000006
[ 99.599134] s2 : ffffffd885df6000 s3 : ffffffc8947939c8 s4 : ffffffc894793998
[ 99.606343] s5 : ffffffd881a9f000 s6 : ffffffc704608a00 s7 : ffffffff021c7db8
[ 99.613552] s8 : ffffffff0240fd50 s9 : 0000000000000cc0 s10: 0000003fd7d2e260
[ 99.620762] s11: 0000000000016700 t3 : 0000000000000020 t4 : 0000000000000001
[ 99.627971] t5 : ffffffdbffdde088 t6 : ffffffdbffdde0a8
[ 99.633266] status: 0000000200000120 badaddr: 0000000000000000 cause: 000000000000000f
[ 99.641236] ---[ end trace 0000000000000000 ]---
Manually bisected to this commit:
NFSv4: Fix free of uninitialized nfs4_label on referral lookup.
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +0000. Anything received after that time might be too late.
Build results:
total: 158 pass: 158 fail: 0 Qemu test results: total: 489 pass: 489 fail: 0
I see a new boot warning in some arm qemu tests, but that is related to enabling CONFIG_KFENCE and not a new problem. v5.17.y and v5.18.y are affected.
[ 8.157727] ------------[ cut here ]------------ [ 8.157843] WARNING: CPU: 0 PID: 0 at kernel/smp.c:894 smp_call_function_many_cond+0x38c/0x3a4 [ 8.158289] Modules linked in: [ 8.158489] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.17.14-rc1-00773-gd0f9b2818e1e #1 [ 8.158564] Hardware name: ARM-Versatile Express [ 8.158730] unwind_backtrace from show_stack+0x10/0x14 [ 8.158802] show_stack from dump_stack_lvl+0x50/0x6c [ 8.158835] dump_stack_lvl from __warn+0xd0/0x19c [ 8.158863] __warn from warn_slowpath_fmt+0x5c/0xb4 [ 8.158890] warn_slowpath_fmt from smp_call_function_many_cond+0x38c/0x3a4 [ 8.158919] smp_call_function_many_cond from smp_call_function+0x3c/0x50 [ 8.158947] smp_call_function from set_memory_valid+0x74/0x94 [ 8.158975] set_memory_valid from kfence_guarded_free+0x280/0x4b4 [ 8.159005] kfence_guarded_free from kmem_cache_free+0x2f4/0x394 [ 8.159032] kmem_cache_free from rcu_core+0x358/0xc34 [ 8.159062] rcu_core from __do_softirq+0xf0/0x41c [ 8.159101] __do_softirq from irq_exit+0xa4/0xd4 [ 8.159127] irq_exit from __irq_svc+0x50/0x68
Guenter
Greg Kroah-Hartman
maintainerQuoted 68 lines · Ron Economos
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Regression on RISC-V RV64 (HiFive Unmatched).
An Oops occurs when an NFS file system is mounted.
[ 98.244615] FS-Cache: Loaded
[ 99.311566] NFS: Registering theid_resolverkey type
[ 99.311621] Key typeid_resolverregistered
[ 99.311626] Key typeid_legacyregistered
[ 99.469053] Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000000000
[ 99.479039] Oops [#1]
[ 99.481246] Modules linked in:rpcsec_gss_krb5auth_rpcgssnfsv4 nfs lockd grace fscache netfsnvme_fabricssunrpcbinfmt_miscnls_iso8859_1da9063_onkeylm90 at24uio_pdrv_genirquiosch_fq_codeldm_multipathscsi_dh_rdacscsi_dh_emcscsi_dh_aluaipmi_devintfipmi_msghandlerdrm backlightip_tablesx_tablesautofs4 btrfsblake2b_genericzstd_compressraid10 raid456async_raid6_recovasync_memcpyasync_pqasync_xorasync_txxorraid6_pqlibcrc32c raid1 raid0 multipath linearrtc_da9063da9063_regulatormscc macsec nvme macbxhci_pcinvme_corexhci_pci_renesasi2c_ocoresphylink
[ 99.532427] CPU: 2 PID: 889 Comm: mount.nfs Not tainted 5.17.13 #1 [ 99.538572] Hardware name: SiFive HiFive Unmatched A00 (DT)
[ 99.544133] epc :nfs_fattr_init+0x1e/0x48[nfs]
[ 99.549059] ra :_nfs41_proc_get_locations+0xb4/0x128[nfsv4] [ 99.555877] epc :ffffffff02332e76ra :ffffffff023c076csp :ffffffc894793960
[ 99.563084] gp :ffffffff81a2ed00tp :ffffffd896180000t0 :ffffffd887720000
[ 99.570294] t1 :ffffffff81a9c110t2 :ffffffff81003c04s0 :ffffffc894793970
[ 99.577503] s1 :ffffffd887700000a0 : 0000000000000000 a1 :ffffffd883de3d80
[ 99.584721] a2 :ffffffd887700000a3 :ffffffc704608a00a4 :ffffffff0236aa28
[ 99.591924] a5 :ffffffff02410cf8a6 :ffffffff0240fc00a7 :
0000000000000006
[ 99.599134] s2 :ffffffd885df6000s3 :ffffffc8947939c8s4 :ffffffc894793998
[ 99.606343] s5 :ffffffd881a9f000s6 :ffffffc704608a00s7 :ffffffff021c7db8
[ 99.613552] s8 :ffffffff0240fd50s9 :0000000000000cc0s10:0000003fd7d2e260
[ 99.620762] s11: 0000000000016700 t3 : 0000000000000020 t4 :
0000000000000001
[ 99.627971] t5 :ffffffdbffdde088t6 :ffffffdbffdde0a8
[ 99.633266] status: 0000000200000120 badaddr: 0000000000000000 cause:000000000000000f
[ 99.641236] ---[ end trace 0000000000000000 ]---
Quoted 6 lines
Manually bisected to this commit:
NFSv4: Fix free of uninitialized
nfs4_labelon referral lookup.
That's odd you see this here on 5.17, but NOT on 5.18 with the same commit merged there. I'll drop this from 5.17 and as this will probably be the last (or next to last) 5.17 kernel release, not worry too much about it.
thanks,
greg k-h
Quoted 24 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
Quoted 8 lines
Regressions found on
qemu_x86_64:
- kunit/kasan [1]Regressions found on
qemu_i386:
- kunit/kfence [2]
- kunit/test_out_of_bounds_readWe will bisect and let you know more details about this reported problem.
The bisect script pointed me to this commit and reverted and tested and confirmed.
commit 1883088ed4a0d5cc9cea500ca4e89a354ab32c11
Author: Jia-Ju Bai <[email protected]> Date: Fri May 27 23:28:18 2022 +0800
md: bcache: check the return value of kzalloc() in detached_dev_do_request()
commit 40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19 upstream.
The function kzalloc() in detached_dev_do_request() can fail, so its return value should be checked.
bcache devices")
drivers/md/bcache/request.c +0 -0
@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(struct
bcache_device *d, struct bio *bio,
* which would call closure_get(&dc->disk.cl)
*/
ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
+ if (!ddip) {
+ bio->bi_status = BLK_STS_RESOURCE;
+ bio->bi_end_io(bio);
+ return;
+ }
+
ddip->d = d;
/* Count on the bcache device */
ddip->orig_bdev = orig_bdev;Quoted 108 lines
[1] https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e/testrun/10038101/suite/kunit/test/kasan/details/
[2] https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e/testrun/10038215/suite/kunit/test/kfence/details/## Build
* kernel: 5.17.14-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.17.y
* git commit:d0f9b2818e1e4d43847e10d6e5310a0c653cb18f
* git describe: v5.17.13-773-gd0f9b2818e1e
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e## Test Regressions (compared to v5.17.11-188-g8eb69e8f0d45) Regressions found on
qemu_x86_64:
- kunit/kasan [1]Regressions found on
qemu_i386:
- kunit/kfence [2]
- kunit/test_out_of_bounds_read## Metric Regressions (compared to v5.17.11-188-g8eb69e8f0d45) No metric regressions found.
## Test Fixes (compared to v5.17.11-188-g8eb69e8f0d45) No test fixes found.
## Metric Fixes (compared to v5.17.11-188-g8eb69e8f0d45) No metric fixes found.
## Test result summary
total: 134591, pass: 121555, fail: 447, skip: 11730, xfail: 859## Build Summary
* arm: 17 total, 14 passed, 3 failed
* arm64: 20 total, 20 passed, 0 failed
* i386: 17 total, 12 passed, 5 failed
* mips: 4 total, 1 passed, 3 failed
* parisc: 2 total, 2 passed, 0 failed
* powerpc: 5 total, 2 passed, 3 failed
* riscv: 5 total, 5 passed, 0 failed
* s390: 5 total, 2 passed, 3 failed
* sh: 2 total, 0 passed, 2 failed
* sparc: 2 total, 2 passed, 0 failed
*x86_64: 20 total, 20 passed, 0 failed## Test suites summary
* fwts
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-cap_bounds-tests
* ltp-commands
* ltp-commands-tests
* ltp-containers
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests
* ltp-fcntl-locktests-tests
* ltp-filecaps
* ltp-filecaps-tests
* ltp-fs
* ltp-fs-tests
* ltp-fs_bind
* ltp-fs_bind-tests
* ltp-fs_perms_simple
* ltp-fs_perms_simple-tests
* ltp-fsx
* ltp-fsx-tests
* ltp-hugetlb
* ltp-hugetlb-tests
* ltp-io
* ltp-io-tests
* ltp-ipc
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance
* vdso--
Linaro LKFT
https://lkft.linaro.org
Hi Guenter,
Quoted 16 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +0000. Anything received after that time might be too late.
Build results:
total: 158 pass: 158 fail: 0 Qemu test results: total: 489 pass: 489 fail: 0
Quoted 5 lines
Tested-by Guenter Roeck <[email protected]>I see a new boot warning in some arm qemu tests, but that is related to enabling
CONFIG_KFENCEand not a new problem. v5.17.y and v5.18.y are affected.
In LKFT we have been noticing this warning on the mainline, Linux-next, 5.18 and 5.17 on qemu-arm, and on x15 devices intermittently.
Quoted 19 lines
[ 8.157727] ------------[ cut here ]------------ [ 8.157843] WARNING: CPU: 0 PID: 0 at kernel/smp.c:894 smp_call_function_many_cond+0x38c/0x3a4 [ 8.158289] Modules linked in: [ 8.158489] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.17.14-rc1-00773-gd0f9b2818e1e #1 [ 8.158564] Hardware name: ARM-Versatile Express [ 8.158730] unwind_backtrace from show_stack+0x10/0x14 [ 8.158802] show_stack from dump_stack_lvl+0x50/0x6c [ 8.158835] dump_stack_lvl from __warn+0xd0/0x19c [ 8.158863] __warn from warn_slowpath_fmt+0x5c/0xb4 [ 8.158890] warn_slowpath_fmt from smp_call_function_many_cond+0x38c/0x3a4 [ 8.158919] smp_call_function_many_cond from smp_call_function+0x3c/0x50 [ 8.158947] smp_call_function from set_memory_valid+0x74/0x94 [ 8.158975] set_memory_valid from kfence_guarded_free+0x280/0x4b4 [ 8.159005] kfence_guarded_free from kmem_cache_free+0x2f4/0x394 [ 8.159032] kmem_cache_free from rcu_core+0x358/0xc34 [ 8.159062] rcu_core from __do_softirq+0xf0/0x41c [ 8.159101] __do_softirq from irq_exit+0xa4/0xd4 [ 8.159127] irq_exit from __irq_svc+0x50/0x68
Quoted 1 line
Guenter
[ 0.000000] Linux version 5.19.0-rc1 (tuxmake@tuxmake) (arm-linux-gnueabihf-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP @1654710061 [ 0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=10c5387d [ 0.000000] CPU: div instructions available: patching division code <trim> [ 0.000000] kfence: initialized - using 2097152 bytes for 255 objects at 0x(ptrval)-0x(ptrval) [ 0.000000] ------------[ cut here ]------------ [ 0.000000] WARNING: CPU: 0 PID: 0 at lib/refcount.c:25 kobject_get+0x9c/0xa0 [ 0.000000] refcount_t: addition on 0; use-after-free. [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1 #1 [ 0.000000] Hardware name: Generic DRA74X (Flattened Device Tree) [ 0.000000] unwind_backtrace from show_stack+0x18/0x1c [ 0.000000] show_stack from dump_stack_lvl+0x58/0x70 [ 0.000000] dump_stack_lvl from __warn+0xd4/0x14c [ 0.000000] __warn from warn_slowpath_fmt+0x98/0xbc [ 0.000000] warn_slowpath_fmt from kobject_get+0x9c/0xa0 [ 0.000000] kobject_get from of_node_get+0x1c/0x24 [ 0.000000] of_node_get from of_fwnode_get+0x3c/0x48 [ 0.000000] of_fwnode_get from fwnode_full_name_string+0x34/0xa0 [ 0.000000] fwnode_full_name_string from device_node_string+0x5fc/0x6c8 [ 0.000000] device_node_string from pointer+0x38c/0x5b0 [ 0.000000] pointer from vsnprintf+0x22c/0x3cc [ 0.000000] vsnprintf from vprintk_store+0x114/0x43c [ 0.000000] vprintk_store from vprintk_emit+0x78/0x2ac [ 0.000000] vprintk_emit from vprintk_default+0x28/0x30 [ 0.000000] vprintk_default from _printk+0x30/0x54 [ 0.000000] _printk from of_node_release+0x124/0x12c [ 0.000000] of_node_release from kobject_put+0xc4/0x294 [ 0.000000] kobject_put from ti_dt_clocks_register+0x284/0x32c [ 0.000000] ti_dt_clocks_register from dra7xx_dt_clk_init+0x18/0x11c [ 0.000000] dra7xx_dt_clk_init from omap5_realtime_timer_init+0x10/0x21c [ 0.000000] omap5_realtime_timer_init from start_kernel+0x558/0x718 [ 0.000000] start_kernel from 0x0 [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] ------------[ cut here ]------------ [ 0.000000] WARNING: CPU: 0 PID: 0 at lib/refcount.c:28 fwnode_full_name_string+0x8c/0xa0 [ 0.000000] refcount_t: underflow; use-after-free. [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 5.19.0-rc1 #1 [ 0.000000] Hardware name: Generic DRA74X (Flattened Device Tree) <trim> [ 0.000000] OF: ERROR: Bad of_node_put() on /ocp/interconnect@4a000000/segment@0/target-module@8000/cm_core@0/clock@c00/clock@0 [ 0.000000] ------------[ cut here ]------------ <trim> [ 7.246032] ------------[ cut here ]------------ [ 7.246063] WARNING: CPU: 1 PID: 0 at kernel/smp.c:913 smp_call_function_many_cond+0x3a0/0x3b0 [ 7.259399] Modules linked in: [ 7.262481] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W 5.19.0-rc1 #1 [ 7.270202] Hardware name: Generic DRA74X (Flattened Device Tree) [ 7.276336] unwind_backtrace from show_stack+0x18/0x1c [ 7.281585] show_stack from dump_stack_lvl+0x58/0x70 [ 7.286682] dump_stack_lvl from __warn+0xd4/0x14c [ 7.291503] __warn from warn_slowpath_fmt+0x64/0xbc [ 7.296508] warn_slowpath_fmt from smp_call_function_many_cond+0x3a0/0x3b0 [ 7.303527] smp_call_function_many_cond from smp_call_function+0x34/0x3c [ 7.310363] smp_call_function from set_memory_valid+0x7c/0x9c [ 7.316223] set_memory_valid from kfence_guarded_free+0x284/0x4b0 [ 7.322448] kfence_guarded_free from kmem_cache_free+0x3a0/0x484 [ 7.328582] kmem_cache_free from rcu_core+0x2c0/0x964 [ 7.333770] rcu_core from __do_softirq+0x168/0x400 [ 7.338684] __do_softirq from irq_exit+0xc0/0xf0 [ 7.343414] irq_exit from call_with_stack+0x18/0x20 [ 7.348419] call_with_stack from __irq_svc+0x9c/0xb8 [ 7.353515] Exception stack(0xf0045f40 to 0xf0045f88) [ 7.358581] 5f40: 00001770 00000000 fe600000 00000000 c2165260 c29e1500 c1f09f50 c1f09fb0 [ 7.366821] 5f60: c1e95b28 c2163ad4 00000000 00000000 00000000 f0045f90 c0335434 c030983c [ 7.375030] 5f80: 600e0013 ffffffff [ 7.378540] __irq_svc from arch_cpu_idle+0x28/0x44 [ 7.383453] arch_cpu_idle from default_idle_call+0x50/0xd0 [ 7.389068] default_idle_call from do_idle+0x224/0x2cc [ 7.394348] do_idle from cpu_startup_entry+0x20/0x24 [ 7.399414] cpu_startup_entry from secondary_start_kernel+0x13c/0x15c [ 7.405975] secondary_start_kernel from 0x80302180 [ 7.410919] ---[ end trace 0000000000000000 ]---
you may refer to this warning log on the mainline.
- Naresh
Quoted 28 lines · Naresh Kamboju
Quoted 27 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
Regressions found on
qemu_x86_64:
- kunit/kasan [1]
Quoted 9 lines
Quoted 5 lines
Regressions found on
qemu_i386:
- kunit/kfence [2]
- kunit/test_out_of_bounds_readWe will bisect and let you know more details about this reported problem.
The bisect script pointed me to this commit and reverted and tested and confirmed.
I see the same error messages after enabling CONFIG_KFENCE_KUNIT_TEST, but it doesn't go away after removing the patch below. That patch also seems to be completely unrelated to the error.
I also see the same problem in the mainline kernel. I suspect that something is wrong with CONFIG_KFENCE_KUNIT_TEST.
Guenter
Quoted 149 lines
commit
1883088ed4a0d5cc9cea500ca4e89a354ab32c11Author: Jia-Ju Bai <[email protected]> Date: Fri May 27 23:28:18 2022 +0800md: bcache: check the return value of
kzalloc()indetached_dev_do_request()commit
40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19upstream.The function
kzalloc()indetached_dev_do_request()can fail, so its return value should be checked.Fixes bc082a55d25c ("bcache: fix inaccurate io state for detachedbcache devices")
Reported-by TOTE Robot <[email protected]>Signed-off-by Jia-Ju Bai <[email protected]>Signed-off-by Coly Li <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>drivers/md/bcache/request.c +6
-0@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(structbcache_device *d, struct bio *bio, * which would call closure_get(&dc->disk.cl) */ ddip =kzalloc (sizeof (struct detached_dev_io_private ),GFP_NOIO ); +if (!ddip) { + bio->bi_status =BLK_STS_RESOURCE ; + bio->bi_end_io (bio); +return ; + } + ddip->d = d;/* Count on the bcache device */ ddip->orig_bdev = orig_bdev;Quoted 108 lines
[1] https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e/testrun/10038101/suite/kunit/test/kasan/details/
[2] https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e/testrun/10038215/suite/kunit/test/kfence/details/## Build
* kernel: 5.17.14-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.17.y
* git commit:d0f9b2818e1e4d43847e10d6e5310a0c653cb18f
* git describe: v5.17.13-773-gd0f9b2818e1e
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.13-773-gd0f9b2818e1e## Test Regressions (compared to v5.17.11-188-g8eb69e8f0d45) Regressions found on
qemu_x86_64:
- kunit/kasan [1]Regressions found on
qemu_i386:
- kunit/kfence [2]
- kunit/test_out_of_bounds_read## Metric Regressions (compared to v5.17.11-188-g8eb69e8f0d45) No metric regressions found.
## Test Fixes (compared to v5.17.11-188-g8eb69e8f0d45) No test fixes found.
## Metric Fixes (compared to v5.17.11-188-g8eb69e8f0d45) No metric fixes found.
## Test result summary
total: 134591, pass: 121555, fail: 447, skip: 11730, xfail: 859## Build Summary
* arm: 17 total, 14 passed, 3 failed
* arm64: 20 total, 20 passed, 0 failed
* i386: 17 total, 12 passed, 5 failed
* mips: 4 total, 1 passed, 3 failed
* parisc: 2 total, 2 passed, 0 failed
* powerpc: 5 total, 2 passed, 3 failed
* riscv: 5 total, 5 passed, 0 failed
* s390: 5 total, 2 passed, 3 failed
* sh: 2 total, 0 passed, 2 failed
* sparc: 2 total, 2 passed, 0 failed
*x86_64: 20 total, 20 passed, 0 failed## Test suites summary
* fwts
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-cap_bounds-tests
* ltp-commands
* ltp-commands-tests
* ltp-containers
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests
* ltp-fcntl-locktests-tests
* ltp-filecaps
* ltp-filecaps-tests
* ltp-fs
* ltp-fs-tests
* ltp-fs_bind
* ltp-fs_bind-tests
* ltp-fs_perms_simple
* ltp-fs_perms_simple-tests
* ltp-fsx
* ltp-fsx-tests
* ltp-hugetlb
* ltp-hugetlb-tests
* ltp-io
* ltp-io-tests
* ltp-ipc
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance
* vdso--
Linaro LKFT
https://lkft.linaro.org
Hi!
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.
...
Quoted 4 lines
Quoted 1 line
We will bisect and let you know more details about this reported problem.
The bisect script pointed me to this commit and reverted and tested and confirmed.
Can you add some printks into that? Because I'm pretty sure this patch does not break anything. (It should not fix much, either.)
Quoted 11 lines
commit
1883088ed4a0d5cc9cea500ca4e89a354ab32c11
Author: Jia-Ju Bai <[email protected]>md: bcache: check the return value of
kzalloc()indetached_dev_do_request()commit
40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19upstream.The function
kzalloc()indetached_dev_do_request()can fail, so its return value should be checked.Fixes bc082a55d25c ("bcache: fix inaccurate io state for detached
...
Quoted 14 lines
+++
b/drivers/md/bcache/request.c(quoted diff) +6
-0@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, * which would call closure_get(&dc->disk.cl) */ ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); + if (!ddip) { + bio->bi_status = BLK_STS_RESOURCE; + bio->bi_end_io(bio); + return; + } + ddip->d = d; /* Count on the bcache device */
Quoted 2 lines
ddip->orig_bdev = orig_bdev;
So... for patch to make any difference, memory allocation has to fail and ddip has to be NULL.
Before the patch, it would oops in "ddip->d = d;". With the patch, you do some kind of error handling. Even if it is buggy, it should not do more harm than immediate oops.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 62 lines
2022年6月18日 18:49,Pavel Machek <[email protected]> 写道:
Hi!
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
This is the start of the stable review cycle for the 5.17.14 release. There are 772 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 Thu, 09 Jun 2022 16:48:02 +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.17.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below....
Quoted 4 lines
Quoted 1 line
We will bisect and let you know more details about this reported problem.
The bisect script pointed me to this commit and reverted and tested and confirmed.
Can you add some printks into that? Because I'm pretty sure this patch does not break anything. (It should not fix much, either.)
Quoted 11 lines
commit
1883088ed4a0d5cc9cea500ca4e89a354ab32c11
Author: Jia-Ju Bai <[email protected]>md: bcache: check the return value of
kzalloc()indetached_dev_do_request()commit
40f567bbb3b0639d2ec7d1c6ad4b1b018f80cf19upstream.The function
kzalloc()indetached_dev_do_request()can fail, so its return value should be checked.Fixes bc082a55d25c ("bcache: fix inaccurate io state for detached...
Quoted 14 lines
+++
b/drivers/md/bcache/request.c(quoted diff) +6
-0@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, * which would call closure_get(&dc->disk.cl) */ ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); + if (!ddip) { + bio->bi_status = BLK_STS_RESOURCE; + bio->bi_end_io(bio); + return; + } + ddip->d = d; /* Count on the bcache device */Quoted 2 lines
ddip->orig_bdev = orig_bdev;So... for patch to make any difference, memory allocation has to fail and ddip has to be NULL.
Quoted 3 lines
Before the patch, it would oops in "
ddip->d= d;". With the patch, you do some kind of error handling. Even if it is buggy, it should not do more harm than immediate oops.
I just receive this single email and don’t have any idea for the context and what the problem is. Where can I see the whole conversation?
BTW, maybe commit 7d6b902ea0e0 (“bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()”) is necessary, how about trying to add it in?
Coly Li
Hi!
Quoted 23 lines
Quoted 23 lines
Quoted 1 line
Fixes bc082a55d25c ("bcache: fix inaccurate io state for detached...
Quoted 14 lines
+++
b/drivers/md/bcache/request.c(quoted diff) +6
-0@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, * which would call closure_get(&dc->disk.cl) */ ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); + if (!ddip) { + bio->bi_status = BLK_STS_RESOURCE; + bio->bi_end_io(bio); + return; + } + ddip->d = d; /* Count on the bcache device */Quoted 2 lines
ddip->orig_bdev = orig_bdev;So... for patch to make any difference, memory allocation has to fail and ddip has to be NULL.
Quoted 6 lines
Quoted 3 lines
Before the patch, it would oops in "
ddip->d= d;". With the patch, you do some kind of error handling. Even if it is buggy, it should not do more harm than immediate oops.I just receive this single email and don’t have any idea for the context and what the problem is. Where can I see the whole conversation?
Discussion happened on [email protected] mailing lists, archives should be easily available. Copy went to lkml, too.
Best regards,
Pavel
Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
Quoted 33 lines
2022年6月18日 19:37,Pavel Machek <[email protected]> 写道:
Hi!
Quoted 27 lines
Quoted 26 lines
Quoted 1 line
Fixes bc082a55d25c ("bcache: fix inaccurate io state for detached...
Quoted 14 lines
+++
b/drivers/md/bcache/request.c(quoted diff) +6
-0@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, * which would call closure_get(&dc->disk.cl) */ ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); + if (!ddip) { + bio->bi_status = BLK_STS_RESOURCE; + bio->bi_end_io(bio); + return; + } + ddip->d = d; /* Count on the bcache device */Quoted 2 lines
ddip->orig_bdev = orig_bdev;So... for patch to make any difference, memory allocation has to fail and ddip has to be NULL.
Before the patch, it would oops in "
ddip->d= d;". With the patch, you do some kind of error handling. Even if it is buggy, it should not do more harm than immediate oops.
Quoted 5 lines
Quoted 2 lines
I just receive this single email and don’t have any idea for the context and what the problem is. Where can I see the whole conversation?
Discussion happened on [email protected] mailing lists, archives should be easily available. Copy went to lkml, too.
Hi Pavel and Greg,
Thanks for the hint, I see the context. I cannot tell the direct reason of the kfence regression, but it is worthy to have this patch in,
- commit 7d6b902ea0e0 ("bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()”)
I am not sure whether it is directly related to the kfence issue, it corrects potential unexpected stack state in some condition. Hope it may help a bit.
Thanks.
Coly Li
Greg Kroah-Hartman
maintainerQuoted 39 lines · Coly Li
Quoted 33 lines
2022年6月18日 19:37,Pavel Machek <[email protected]> 写道:
Hi!
Quoted 27 lines
Quoted 26 lines
Quoted 1 line
Fixes bc082a55d25c ("bcache: fix inaccurate io state for detached...
Quoted 14 lines
+++
b/drivers/md/bcache/request.c(quoted diff) +6
-0@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, * which would call closure_get(&dc->disk.cl) */ ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); + if (!ddip) { + bio->bi_status = BLK_STS_RESOURCE; + bio->bi_end_io(bio); + return; + } + ddip->d = d; /* Count on the bcache device */Quoted 2 lines
ddip->orig_bdev = orig_bdev;So... for patch to make any difference, memory allocation has to fail and ddip has to be NULL.
Before the patch, it would oops in "
ddip->d= d;". With the patch, you do some kind of error handling. Even if it is buggy, it should not do more harm than immediate oops.Quoted 5 lines
Quoted 2 lines
I just receive this single email and don’t have any idea for the context and what the problem is. Where can I see the whole conversation?
Discussion happened on [email protected] mailing lists, archives should be easily available. Copy went to lkml, too.
Quoted 6 lines
Hi Pavel and Greg,
Thanks for the hint, I see the context. I cannot tell the direct reason of the kfence regression, but it is worthy to have this patch in,
- commit7d6b902ea0e0("bcache: memset on stack variables inbch_btree_check()and bch_sectors_dirty_init()”)I am not sure whether it is directly related to the kfence issue, it corrects potential unexpected stack state in some condition. Hope it may help a bit.
Added where?
confused,
greg k-h
Quoted 46 lines
2022年6月20日 18:10,Greg Kroah-Hartman <[email protected]> 写道:
Quoted 41 lines · Coly Li
Quoted 33 lines
2022年6月18日 19:37,Pavel Machek <[email protected]> 写道:
Hi!
Quoted 27 lines
Quoted 26 lines
Quoted 1 line
Fixes bc082a55d25c ("bcache: fix inaccurate io state for detached...
Quoted 14 lines
+++
b/drivers/md/bcache/request.c(quoted diff) +6
-0@@ -1107,6 +1107,12 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio, * which would call closure_get(&dc->disk.cl) */ ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); + if (!ddip) { + bio->bi_status = BLK_STS_RESOURCE; + bio->bi_end_io(bio); + return; + } + ddip->d = d; /* Count on the bcache device */Quoted 2 lines
ddip->orig_bdev = orig_bdev;So... for patch to make any difference, memory allocation has to fail and ddip has to be NULL.
Before the patch, it would oops in "
ddip->d= d;". With the patch, you do some kind of error handling. Even if it is buggy, it should not do more harm than immediate oops.Quoted 5 lines
Quoted 2 lines
I just receive this single email and don’t have any idea for the context and what the problem is. Where can I see the whole conversation?
Discussion happened on [email protected] mailing lists, archives should be easily available. Copy went to lkml, too.
Hi Pavel and Greg,
Quoted 8 lines
Quoted 4 lines
Thanks for the hint, I see the context. I cannot tell the direct reason of the kfence regression, but it is worthy to have this patch in,
- commit7d6b902ea0e0("bcache: memset on stack variables inbch_btree_check()and bch_sectors_dirty_init()”)I am not sure whether it is directly related to the kfence issue, it corrects potential unexpected stack state in some condition. Hope it may help a bit.
Added where?
confused,
I will post the patch to stable list for specific version. Thanks.
Coly Li