4.19.312-rc1 review
Greg Kroah-Hartman
maintainerPATCH 143/175 ALSA: hda/realtek: Update Panasonic CF-SZ6 quirk to support headset with microphone
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: I Gede Agastya Darma Laksana <[email protected]>
commit 1576f263ee2147dc395531476881058609ad3d38 upstream.
This patch addresses an issue with the Panasonic CF-SZ6's existing quirk, specifically its headset microphone functionality. Previously, the quirk used ALC269_FIXUP_HEADSET_MODE, which does not support the CF-SZ6's design of a single 3.5mm jack for both mic and audio output effectively. The device uses pin 0x19 for the headset mic without jack detection.
Following verification on the CF-SZ6 and discussions with the original patch author, i determined that the update to ALC269_FIXUP_ASPIRE_HEADSET_MIC is the appropriate solution. This change is custom-designed for the CF-SZ6's unique hardware setup, which includes a single 3.5mm jack for both mic and audio output, connecting the headset microphone to pin 0x19 without the use of jack detection.
Message-ID: <[email protected]>
--- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +1 -1
@@ -7218,7 +7218,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x10cf ,0x1629 ,"Lifebook U7x7" , ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),SND_PCI_QUIRK (0x10cf ,0x1845 ,"Lifebook U904" ,ALC269_FIXUP_LIFEBOOK_EXTMIC ),SND_PCI_QUIRK (0x10ec ,0x10f2 ,"Intel Reference board" ,ALC700_FIXUP_INTEL_REFERENCE ), -SND_PCI_QUIRK (0x10f7 ,0x8338 ,"Panasonic CF-SZ6" ,ALC269_FIXUP_HEADSET_MODE ), +SND_PCI_QUIRK (0x10f7 ,0x8338 ,"Panasonic CF-SZ6" ,ALC269_FIXUP_ASPIRE_HEADSET_MIC ),SND_PCI_QUIRK (0x144d ,0xc109 ,"Samsung Ativ book 9 (NP900X3G)" ,ALC269_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x144d ,0xc740 ,"Samsung Ativ book 8 (NP870Z5G)" ,ALC269_FIXUP_ATIV_BOOK_8 ), SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
Greg Kroah-Hartman
maintainerPATCH 144/175 wifi: ath9k: fix LNA selection in ath_ant_try_scan()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit d6b27eb997ef9a2aa51633b3111bc4a04748e6d3 ]
In 'ath_ant_try_scan()', (most likely) the 2nd LNA's signal strength should be used in comparison against RSSI when selecting first LNA as the main one. Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/ath/ath9k/antenna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/antenna.c +1 -1
@@ -643,7 +643,7 @@ static void ath_ant_try_scan(struct ath_ant_comb *antcomb, conf->main_lna_conf =ATH_ANT_DIV_COMB_LNA1 ; conf->alt_lna_conf =ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2 ; }else if (antcomb->rssi_sub > - antcomb->rssi_lna1) { + antcomb->rssi_lna2) {/* set to A-B */ conf->main_lna_conf =ATH_ANT_DIV_COMB_LNA1 ; conf->alt_lna_conf =ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/175 batman-adv: Return directly after a failed batadv_dat_select_candidates() in batadv_dat_forward_data()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Elfring <[email protected]>
[ Upstream commit ffc15626c861f811f9778914be004fcf43810a91 ]
The kfree() function was called in one case by
the batadv_dat_forward_data() function during error handling even if the passed variable contained a null pointer. This issue was detected by using the Coccinelle software.
* Thus return directly after a batadv_dat_select_candidates() call failed at the beginning.
* Delete the label “out” which became unnecessary with this refactoring.
--- net/batman-adv/distributed-arp-table.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/batman-adv/distributed-arp-table.c +1 -2
@@ -648,7 +648,7 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv, cand =batadv_dat_select_candidates (bat_priv, ip, vid);if (!cand) - goto out; +return ret;batadv_dbg (BATADV_DBG_DAT , bat_priv,"DHT_SEND for %pI4\n" , &ip);
@@ -692,7 +692,6 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv,batadv_orig_node_put (cand[i].orig_node); } -out:kfree (cand);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/175 VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshit Mogalapalli <[email protected]>
[ Upstream commit 19b070fefd0d024af3daa7329cbc0d00de5302ec ]
Syzkaller hit 'WARNING in dg_dispatch_as_host' bug.
memcpy: detected field-spanning write (size 56) of single field "&dg_info->msg"
at drivers/misc/vmw_vmci/vmci_datagram.c:237 (size 24) WARNING: CPU: 0 PID: 1555 at drivers/misc/vmw_vmci/vmci_datagram.c:237 dg_dispatch_as_host+0x88e/0xa60 drivers/misc/vmw_vmci/vmci_datagram.c:237
Some code commentry, based on my understanding:
544 #define VMCI_DG_SIZE(_dg) (VMCI_DG_HEADERSIZE + (size_t)(_dg)->payload_size) /// This is 24 + payload_size
memcpy(&dg_info->msg, dg, dg_size); Destination = dg_info->msg ---> this is a 24 byte structure(struct vmci_datagram) Source = dg --> this is a 24 byte structure (struct vmci_datagram) Size = dg_size = 24 + payload_size
{payload_size = 56-24 =32} -- Syzkaller managed to set payload_size to 32.
35 struct delayed_datagram_info {
36 struct datagram_entry *entry; 37 struct work_struct work; 38 bool in_dg_host_queue; 39 /* msg and msg_payload must be together. */ 40 struct vmci_datagram msg; 41 u8 msg_payload[];
42 };
So those extra bytes of payload are copied into msg_payload[], a run time warning is seen while fuzzing with Syzkaller.
One possible way to fix the warning is to split the memcpy() into two parts -- one -- direct assignment of msg and second taking care of payload.
Gustavo quoted:
"Under FORTIFY_SOURCE we should not copy data across multiple members in a structure."
--- drivers/misc/vmw_vmci/vmci_datagram.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_datagram.c +2 -1
@@ -242,7 +242,8 @@ static int dg_dispatch_as_host(u32 context_id, struct vmci_datagram *dg) dg_info->in_dg_host_queue = true; dg_info->entry = dst_entry; -memcpy (&dg_info->msg, dg, dg_size); + dg_info->msg = *dg; +memcpy (&dg_info->msg_payload, dg +1 , dg->payload_size);INIT_WORK (&dg_info->work, dg_delayed_dispatch);schedule_work (&dg_info->work);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/175 arm64: dts: rockchip: fix rk3399 hdmi ports node
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Jonker <[email protected]>
[ Upstream commit f051b6ace7ffcc48d6d1017191f167c0a85799f6 ]
Fix rk3399 hdmi ports node so that it matches the
rockchip,dw-hdmi.yaml binding.
--- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +10 -2
@@ -1683,6 +1683,7 @@ simple-audio-card,codec { hdmi: hdmi@ff940000 { compatible = "rockchip,rk3399-dw-hdmi"; reg = <0x0 0xff940000 0x0 0x20000>; + reg-io-width = <4>; interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH 0>; clocks = <&cru PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_SFR>,
@@ -1691,13 +1692,16 @@ hdmi: hdmi@ff940000 { <&cru PLL_VPLL>; clock-names = "iahb", "isfr", "cec", "grf", "vpll"; power-domains = <&power RK3399_PD_HDCP>; - reg-io-width = <4>; rockchip,grf = <&grf>; #sound-dai-cells = <0>; status = "disabled"; ports { - hdmi_in: port { + #address-cells = <1>; + #size-cells = <0>; + + hdmi_in: port@0 { + reg = <0>; #address-cells = <1>; #size-cells = <0>;
@@ -1710,6 +1714,10 @@ hdmi_in_vopl: endpoint@1 { remote-endpoint = <&vopl_out_hdmi>; }; }; + + hdmi_out: port@1 { + reg = <1>; + }; }; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/175 tools/power x86_energy_perf_policy: Fix file leak in get_pkg_num()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samasth Norway Ananda <[email protected]>
[ Upstream commit f85450f134f0b4ca7e042dc3dc89155656a2299d ]
In function get_pkg_num() if fopen_or_die() succeeds it returns a file pointer to be used. But fclose() is never called before returning from the function.
--- tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c | 1 + 1 file changed, 1 insertion(+)
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c +1 -0
@@ -1112,6 +1112,7 @@ unsigned int get_pkg_num(int cpu) retval =fscanf (fp,"%d\n" , &pkg);if (retval !=1 )errx (1 ,"%s: failed to parse" , pathname); +fclose (fp);return pkg; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/175 btrfs: handle chunk tree lookup error in btrfs_relocate_sys_chunks()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit 7411055db5ce64f836aaffd422396af0075fdc99 ]
The unhandled case in btrfs_relocate_sys_chunks() loop is a corruption, as it could be caused only by two impossible conditions:
- at first the search key is set up to look for a chunk tree item, with offset -1, this is an inexact search and the key->offset will contain the correct offset upon a successful search, a valid chunk tree item cannot have an offset -1
- after first successful search, the found_key corresponds to a chunk item, the offset is decremented by 1 before the next loop, it's impossible to find a chunk item there due to alignment and size constraints
--- fs/btrfs/volumes.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +11 -1
@@ -2948,7 +2948,17 @@ static int btrfs_relocate_sys_chunks(struct btrfs_fs_info *fs_info)mutex_unlock (&fs_info->delete_unused_bgs_mutex); goto error; } -BUG_ON (ret ==0 );/* Corruption */ +if (ret ==0 ) { +/* +* On the first search we would find chunk tree with +* offset -1, which is not possible. On subsequent +* loops this would find an existing item on an invalid +* offset (one less than the previous one, wrong +* alignment and size). +*/ + ret = -EUCLEAN ; + goto error; + } ret =btrfs_previous_item (chunk_root, path, key.objectid, key.type);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 123/175 net/sched: act_skbmod: prevent kernel-infoleak
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit d313eb8b77557a6d5855f42d2234bd592c7b50dd upstream.
syzbot found that tcf_skbmod_dump() was copying four bytes from kernel stack to user space [1].
The issue here is that 'struct tc_skbmod' has a four bytes hole.
We need to clear the structure before filling fields.
[1]
BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline] BUG: KMSAN: kernel-infoleak in copy_to_user_iter lib/iov_iter.c:24 [inline] BUG: KMSAN: kernel-infoleak in iterate_ubuf include/linux/iov_iter.h:29 [inline] BUG: KMSAN: kernel-infoleak in iterate_and_advance2 include/linux/iov_iter.h:245 [inline] BUG: KMSAN: kernel-infoleak in iterate_and_advance include/linux/iov_iter.h:271 [inline] BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x366/0x2520 lib/iov_iter.c:185 instrument_copy_to_user include/linux/instrumented.h:114 [inline] copy_to_user_iter lib/iov_iter.c:24 [inline] iterate_ubuf include/linux/iov_iter.h:29 [inline] iterate_and_advance2 include/linux/iov_iter.h:245 [inline] iterate_and_advance include/linux/iov_iter.h:271 [inline] _copy_to_iter+0x366/0x2520 lib/iov_iter.c:185 copy_to_iter include/linux/uio.h:196 [inline] simple_copy_to_iter net/core/datagram.c:532 [inline] __skb_datagram_iter+0x185/0x1000 net/core/datagram.c:420 skb_copy_datagram_iter+0x5c/0x200 net/core/datagram.c:546 skb_copy_datagram_msg include/linux/skbuff.h:4050 [inline] netlink_recvmsg+0x432/0x1610 net/netlink/af_netlink.c:1962 sock_recvmsg_nosec net/socket.c:1046 [inline] sock_recvmsg+0x2c4/0x340 net/socket.c:1068 __sys_recvfrom+0x35a/0x5f0 net/socket.c:2242 __do_sys_recvfrom net/socket.c:2260 [inline] __se_sys_recvfrom net/socket.c:2256 [inline] __x64_sys_recvfrom+0x126/0x1d0 net/socket.c:2256 do_syscall_64+0xd5/0x1f0 entry_SYSCALL_64_after_hwframe+0x6d/0x75
Uninit was stored to memory at:
pskb_expand_head+0x30f/0x19d0 net/core/skbuff.c:2253 netlink_trim+0x2c2/0x330 net/netlink/af_netlink.c:1317 netlink_unicast+0x9f/0x1260 net/netlink/af_netlink.c:1351 nlmsg_unicast include/net/netlink.h:1144 [inline] nlmsg_notify+0x21d/0x2f0 net/netlink/af_netlink.c:2610 rtnetlink_send+0x73/0x90 net/core/rtnetlink.c:741 rtnetlink_maybe_send include/linux/rtnetlink.h:17 [inline] tcf_add_notify net/sched/act_api.c:2048 [inline] tcf_action_add net/sched/act_api.c:2071 [inline] tc_ctl_action+0x146e/0x19d0 net/sched/act_api.c:2119 rtnetlink_rcv_msg+0x1737/0x1900 net/core/rtnetlink.c:6595 netlink_rcv_skb+0x375/0x650 net/netlink/af_netlink.c:2559 rtnetlink_rcv+0x34/0x40 net/core/rtnetlink.c:6613 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline] netlink_unicast+0xf4c/0x1260 net/netlink/af_netlink.c:1361 netlink_sendmsg+0x10df/0x11f0 net/netlink/af_netlink.c:1905 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:745 ____sys_sendmsg+0x877/0xb60 net/socket.c:2584 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2638 __sys_sendmsg net/socket.c:2667 [inline] __do_sys_sendmsg net/socket.c:2676 [inline] __se_sys_sendmsg net/socket.c:2674 [inline] __x64_sys_sendmsg+0x307/0x4a0 net/socket.c:2674 do_syscall_64+0xd5/0x1f0 entry_SYSCALL_64_after_hwframe+0x6d/0x75
Uninit was stored to memory at:
__nla_put lib/nlattr.c:1041 [inline] nla_put+0x1c6/0x230 lib/nlattr.c:1099 tcf_skbmod_dump+0x23f/0xc20 net/sched/act_skbmod.c:256 tcf_action_dump_old net/sched/act_api.c:1191 [inline] tcf_action_dump_1+0x85e/0x970 net/sched/act_api.c:1227 tcf_action_dump+0x1fd/0x460 net/sched/act_api.c:1251 tca_get_fill+0x519/0x7a0 net/sched/act_api.c:1628 tcf_add_notify_msg net/sched/act_api.c:2023 [inline] tcf_add_notify net/sched/act_api.c:2042 [inline] tcf_action_add net/sched/act_api.c:2071 [inline] tc_ctl_action+0x1365/0x19d0 net/sched/act_api.c:2119 rtnetlink_rcv_msg+0x1737/0x1900 net/core/rtnetlink.c:6595 netlink_rcv_skb+0x375/0x650 net/netlink/af_netlink.c:2559 rtnetlink_rcv+0x34/0x40 net/core/rtnetlink.c:6613 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline] netlink_unicast+0xf4c/0x1260 net/netlink/af_netlink.c:1361 netlink_sendmsg+0x10df/0x11f0 net/netlink/af_netlink.c:1905 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:745 ____sys_sendmsg+0x877/0xb60 net/socket.c:2584 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2638 __sys_sendmsg net/socket.c:2667 [inline] __do_sys_sendmsg net/socket.c:2676 [inline] __se_sys_sendmsg net/socket.c:2674 [inline] __x64_sys_sendmsg+0x307/0x4a0 net/socket.c:2674 do_syscall_64+0xd5/0x1f0 entry_SYSCALL_64_after_hwframe+0x6d/0x75
Local variable opt created at:
tcf_skbmod_dump+0x9d/0xc20 net/sched/act_skbmod.c:244 tcf_action_dump_old net/sched/act_api.c:1191 [inline] tcf_action_dump_1+0x85e/0x970 net/sched/act_api.c:1227
Bytes 188-191 of 248 are uninitialized Memory access of size 248 starts at ffff888117697680 Data copied to user address 00007ffe56d855f0
--- net/sched/act_skbmod.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/sched/act_skbmod.c +5 -5
@@ -210,13 +210,13 @@ static int tcf_skbmod_dump(struct sk_bufstruct tcf_skbmod *d =to_skbmod (a);unsigned char *b =skb_tail_pointer (skb);struct tcf_skbmod_params *p; -struct tc_skbmod opt = { - .index = d->tcf_index, - .refcnt =refcount_read (&d->tcf_refcnt) - ref, - .bindcnt =atomic_read (&d->tcf_bindcnt) - bind, - }; +struct tc_skbmod opt;struct tcf_t t; +memset (&opt,0 ,sizeof (opt)); + opt.index = d->tcf_index; + opt.refcnt =refcount_read (&d->tcf_refcnt) - ref, + opt.bindcnt =atomic_read (&d->tcf_bindcnt) - bind;spin_lock_bh (&d->tcf_lock); opt.action = d->tcf_action; p = rcu_dereference_protected(d->skbmod_p,
Greg Kroah-Hartman
maintainerPATCH 150/175 btrfs: export: handle invalid inode or root reference in btrfs_get_parent()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit 26b66d1d366a375745755ca7365f67110bbf6bd5 ]
The get_parent handler looks up a parent of a given dentry, this can be either a subvolume or a directory. The search is set up with offset -1 but it's never expected to find such item, as it would break allowed range of inode number or a root id. This means it's a corruption (ext4 also returns this error code).
--- fs/btrfs/export.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/btrfs/export.c +8 -1
@@ -182,8 +182,15 @@ struct dentry *btrfs_get_parent(struct dentry *child) ret =btrfs_search_slot (NULL , root, &key, path,0 ,0 );if (ret <0 ) goto fail; +if (ret ==0 ) { +/* +* Key with offset of -1 found, there would have to exist an +* inode with such number or a root with such id. +*/ + ret = -EUCLEAN ; + goto fail; + } -BUG_ON (ret ==0 );/* Key with offset of -1 found */ if (path->slots[0 ] ==0 ) { ret = -ENOENT ; goto fail;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/175 btrfs: send: handle path ref underflow in header iterate_inode_ref()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit 3c6ee34c6f9cd12802326da26631232a61743501 ]
Change BUG_ON to proper error handling if building the path buffer fails. The pointers are not printed so we don't accidentally leak kernel addresses.
--- fs/btrfs/send.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/btrfs/send.c +9 -1
@@ -958,7 +958,15 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path, ret =PTR_ERR (start); goto out; } -BUG_ON (start < p->buf); +if (unlikely (start < p->buf)) { +btrfs_err (root->fs_info, +"send: path ref buffer underflow for key (%llu %u %llu)" , + found_key->objectid, + found_key->type, + found_key->offset); + ret = -EINVAL ; + goto out; + } } p->start = start; }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/175 Bluetooth: btintel: Fix null ptr deref in btintel_read_version
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit b79e040910101b020931ba0c9a6b77e81ab7f645 ]
If hci_cmd_sync_complete() is triggered and skb is NULL, then hdev->req_skb is NULL, which will cause this issue.
--- drivers/bluetooth/btintel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btintel.c +1 -1
@@ -355,7 +355,7 @@ int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver)struct sk_buff *skb; skb =__hci_cmd_sync (hdev,0xfc05 ,0 ,NULL ,HCI_CMD_TIMEOUT ); -if (IS_ERR (skb)) { +if (IS_ERR_OR_NULL (skb)) {bt_dev_err (hdev,"Reading Intel version information failed (%ld)" ,PTR_ERR (skb));return PTR_ERR (skb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/175 Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunwu Chan <[email protected]>
[ Upstream commit bc4996184d56cfaf56d3811ac2680c8a0e2af56e ]
While input core can work with input->phys set to NULL userspace might depend on it, so better fail probing if allocation fails. The system must be in a pretty bad shape for it to happen anyway.
--- drivers/input/rmi4/rmi_driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/input/rmi4/rmi_driver.c +5 -1
@@ -1199,7 +1199,11 @@ static int rmi_driver_probe(struct device *dev) }rmi_driver_set_input_params (rmi_dev, data->input); data->input->phys =devm_kasprintf (dev,GFP_KERNEL , -"%s/input0" ,dev_name (dev)); +"%s/input0" ,dev_name (dev)); +if (!data->input->phys) { + retval = -ENOMEM ; + goto err; + } } retval =rmi_init_functions (data);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/175 sysv: dont call sb_bread() with pointers_lock held
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit f123dc86388cb669c3d6322702dc441abc35c31e ]
syzbot is reporting sleep in atomic context in SysV filesystem [1], for sb_bread() is called with rw_spinlock held.
A "write_lock(&pointers_lock) => read_lock(&pointers_lock) deadlock" bug and a "sb_bread() with write_lock(&pointers_lock)" bug were introduced by "Replace BKL for chain locking with sysvfs-private rwlock" in Linux 2.5.12.
Then, "[PATCH] err1-40: sysvfs locking fix" in Linux 2.6.8 fixed the former bug by moving pointers_lock lock to the callers, but instead introduced a "sb_bread() with read_lock(&pointers_lock)" bug (which made this problem easier to hit).
Al Viro suggested that why not to do like get_branch()/get_block()/ find_shared() in Minix filesystem does. And doing like that is almost a revert of "[PATCH] err1-40: sysvfs locking fix" except that get_branch()
from with find_shared() is called without write_lock(&pointers_lock).
--- fs/sysv/itree.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/sysv/itree.c +4 -6
@@ -82,9 +82,6 @@ static inline sysv_zone_t *block_end(struct buffer_head *bh)return (sysv_zone_t *)((char *)bh->b_data + bh->b_size); } -/* -* Requires read_lock(&pointers_lock) or write_lock(&pointers_lock) -*/ static Indirect *get_branch(struct inode *inode, int depth, int offsets[],
@@ -104,15 +101,18 @@ static Indirect *get_branch(struct inode *inode, bh =sb_bread (sb, block);if (!bh) goto failure; +read_lock (&pointers_lock);if (!verify_chain (chain, p)) goto changed;add_chain (++p, bh, (sysv_zone_t *)bh->b_data + *++offsets); +read_unlock (&pointers_lock);if (!p->key) goto no_block; }return NULL ; changed: +read_unlock (&pointers_lock);brelse (bh); *err = -EAGAIN ; goto no_block;
@@ -218,9 +218,7 @@ static int get_block(struct inode *inode, sector_t iblock, struct buffer_head *b goto out; reread: -read_lock (&pointers_lock); partial =get_branch (inode, depth, offsets, chain, &err); -read_unlock (&pointers_lock);/* Simplest case - block found, no allocation needed */ if (!partial) {
@@ -290,9 +288,9 @@ static Indirect *find_shared(struct inode *inode, *top =0 ;for (k = depth; k >1 && !offsets[k-1 ]; k--) ; + partial =get_branch (inode, k, offsets, chain, &err);write_lock (&pointers_lock); - partial =get_branch (inode, k, offsets, chain, &err);if (!partial) partial = chain + k-1 ;/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/175 scsi: lpfc: Fix possible memory leak in lpfc_rcv_padisc()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Tee <[email protected]>
[ Upstream commit 2ae917d4bcab80ab304b774d492e2fcd6c52c06b ]
The call to lpfc_sli4_resume_rpi() in lpfc_rcv_padisc() may return an unsuccessful status. In such cases, the elsiocb is not issued, the completion is not called, and thus the elsiocb resource is leaked.
Check return value after calling lpfc_sli4_resume_rpi() and conditionally release the elsiocb resource.
--- drivers/scsi/lpfc/lpfc_nportdisc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +4 -2
@@ -601,8 +601,10 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,/* Save the ELS cmd */ elsiocb->drvrTimeout = cmd; -lpfc_sli4_resume_rpi (ndlp, - lpfc_mbx_cmpl_resume_rpi, elsiocb); +if (lpfc_sli4_resume_rpi (ndlp, + lpfc_mbx_cmpl_resume_rpi, + elsiocb)) +kfree (elsiocb); goto out; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/175 isofs: handle CDs with bad root inode but good Joliet root directory
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Henrie <[email protected]>
[ Upstream commit 4243bf80c79211a8ca2795401add9c4a3b1d37ca ]
I have a CD copy of the original Tom Clancy's Ghost Recon game from 2001. The disc mounts without error on Windows, but on Linux mounting fails with the message "isofs_fill_super: get root inode failed". The error originates in isofs_read_inode, which returns -EIO because de_len is 0. The superblock on this disc appears to be intentionally corrupt as a form of copy protection.
When the root inode is unusable, instead of giving up immediately, try to continue with the Joliet file table. This fixes the Ghost Recon CD and probably other copy-protected CDs too.
Message-Id: <[email protected]>
--- fs/isofs/inode.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
fs/isofs/inode.c +16 -2
@@ -910,8 +910,22 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)* we then decide whether to use the Joliet descriptor. */ inode =isofs_iget (s, sbi->s_firstdatazone,0 ); -if (IS_ERR (inode)) - goto out_no_root; + +/* +* Fix for broken CDs with a corrupt root inode but a correct Joliet +* root directory. +*/ +if (IS_ERR (inode)) { +if (joliet_level && sbi->s_firstdatazone != first_data_zone) { +printk (KERN_NOTICE +"ISOFS: root inode is unusable. " +"Disabling Rock Ridge and switching to Joliet." ); + sbi->s_rock =0 ; + inode =NULL ; + }else { + goto out_no_root; + } + }/* * Fix for broken CDs with Rock Ridge and empty ISO root directory but
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/175 media: sta2x11: fix irq handler cast
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 3de49ae81c3a0f83a554ecbce4c08e019f30168e ]
clang-16 warns about casting incompatible function pointers:
drivers/media/pci/sta2x11/sta2x11_vip.c:1057:6: error: cast from 'irqreturn_t (*)(int, struct sta2x11_vip *)' (aka 'enum irqreturn (*)(int, struct sta2x11_vip *)') to 'irq_handler_t' (aka 'enum irqreturn (*)(int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
Change the prototype of the irq handler to the regular version with a local variable to adjust the argument type.
--- drivers/media/pci/sta2x11/sta2x11_vip.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/pci/sta2x11/sta2x11_vip.c +4 -5
@@ -780,7 +780,7 @@ static const struct video_device video_dev_template = {/** * vip_irq - interrupt routine * @irq: Number of interrupt ( not used, correct number is assumed ) -* @vip: local data structure containing all information +* @data: local data structure containing all information * * check for both frame interrupts set ( top and bottom ). * check FIFO overflow, but limit number of log messages after open.
@@ -790,8 +790,9 @@ static const struct video_device video_dev_template = {* * IRQ_HANDLED, interrupt done. */ -static irqreturn_t vip_irq (int irq,struct sta2x11_vip *vip) +static irqreturn_t vip_irq (int irq,void *data) { +struct sta2x11_vip *vip = data;unsigned int status; status =reg_read (vip,DVP_ITS );
@@ -1073,9 +1074,7 @@ static int sta2x11_vip_init_one(struct pci_dev *pdev,spin_lock_init (&vip->slock); - ret =request_irq (pdev->irq, - (irq_handler_t ) vip_irq, -IRQF_SHARED ,KBUILD_MODNAME , vip); + ret =request_irq (pdev->irq, vip_irq,IRQF_SHARED ,KBUILD_MODNAME , vip);if (ret) {dev_err (&pdev->dev,"request_irq failed\n" ); ret = -ENODEV ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/175 drm/amd/display: Fix nanosec stat overflow
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aric Cyr <[email protected]>
[ Upstream commit 14d68acfd04b39f34eea7bea65dda652e6db5bf6 ]
[Why]
Nanosec stats can overflow on long running systems potentially causing statistic logging issues.
[How]
Use 64bit types for nanosec stats to ensure no overflow.
--- drivers/gpu/drm/amd/display/modules/inc/mod_stats.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/modules/inc/mod_stats.h +2 -2
@@ -51,10 +51,10 @@ void mod_stats_update_event(struct mod_stats *mod_stats, unsigned int length);void mod_stats_update_flip (struct mod_stats *mod_stats, -unsigned long timestamp_in_ns); +unsigned long long timestamp_in_ns);void mod_stats_update_vupdate (struct mod_stats *mod_stats, -unsigned long timestamp_in_ns); +unsigned long long timestamp_in_ns); void mod_stats_update_freesync(struct mod_stats *mod_stats, unsigned int v_total_min,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/175 SUNRPC: increase size of rpc_wait_queue.qlen from unsigned short to unsigned int
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dai Ngo <[email protected]>
[ Upstream commit 2c35f43b5a4b9cdfaa6fdd946f5a212615dac8eb ]
When the NFS client is under extreme load the rpc_wait_queue.qlen counter can be overflowed. Here is an instant of the backlog queue overflow in a real world environment shown by drgn helper:
rpc_task_stats(rpc_clnt):
-------------------------rpc_clnt: 0xffff92b65d2bae00rpc_xprt: 0xffff9275db64f000
Queue: sending[64887] pending[524] backlog[30441] binding[0]
XMIT task: 0xffff925c6b1d8e98
WRITE: 750654
__dta_call_status_580: 65463
__dta_call_transmit_status_579: 1
call_reserveresult: 685189
nfs_client_init_is_complete: 1
COMMIT: 584
call_reserveresult: 573
__dta_call_status_580: 11
ACCESS: 1
__dta_call_status_580: 1
GETATTR: 10
__dta_call_status_580: 4
call_reserveresult: 6751249 tasks for server 111.222.333.444
Total tasks: 751249
count_rpc_wait_queues(xprt):
----------------------------
**** rpc_xprt: 0xffff9275db64f000 num_reqs: 65511wait_queue: xprt_binding[0] cnt: 0wait_queue: xprt_binding[1] cnt: 0wait_queue: xprt_binding[2] cnt: 0wait_queue: xprt_binding[3] cnt: 0 rpc_wait_queue[xprt_binding].qlen: 0 maxpriority: 0wait_queue: xprt_sending[0] cnt: 0wait_queue: xprt_sending[1] cnt: 64887wait_queue: xprt_sending[2] cnt: 0wait_queue: xprt_sending[3] cnt: 0 rpc_wait_queue[xprt_sending].qlen: 64887 maxpriority: 3wait_queue: xprt_pending[0] cnt: 524wait_queue: xprt_pending[1] cnt: 0wait_queue: xprt_pending[2] cnt: 0wait_queue: xprt_pending[3] cnt: 0 rpc_wait_queue[xprt_pending].qlen: 524 maxpriority: 0wait_queue: xprt_backlog[0] cnt: 0wait_queue: xprt_backlog[1] cnt: 685801wait_queue: xprt_backlog[2] cnt: 0wait_queue: xprt_backlog[3] cnt: 0 rpc_wait_queue[xprt_backlog].qlen: 30441 maxpriority: 3 [task cnt mismatch]
There is no effect on operations when this overflow occurs. However it causes confusion when trying to diagnose the performance problem.
--- include/linux/sunrpc/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/sunrpc/sched.h +1 -1
@@ -190,7 +190,7 @@ struct rpc_wait_queue {unsigned char maxpriority;/* maximum priority (0 if queue is not a priority queue) */ unsigned char priority;/* current priority */ unsigned char nr;/* # tasks remaining for cookie */ -unsigned short qlen;/* total # tasks waiting in queue */ +unsigned int qlen;/* total # tasks waiting in queue */ struct rpc_timer timer_list;#if IS_ENABLED (CONFIG_SUNRPC_DEBUG ) ||IS_ENABLED (CONFIG_TRACEPOINTS )const char * name;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 124/175 net: stmmac: fix rx queue priority assignment
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Piotr Wejman <[email protected]>
commit b3da86d432b7cd65b025a11f68613e333d2483db upstream.
The driver should ensure that same priority is not mapped to multiple rx queues. From DesignWare Cores Ethernet Quality-of-Service Databook, section 17.1.29 MAC_RxQ_Ctrl2:
"[...]The software must ensure that the content of this field is mutually exclusive to the PSRQ fields for other queues, that is, the same priority is not mapped to multiple Rx queues[...]"
Previously rx_queue_priority() function was:
- clearing all priorities from a queue
- adding new priorities to that queue
After this patch it will:
- first assign new priorities to a queue
- then remove those priorities from all other queues
- keep other priorities previously assigned to that queue
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 40 +++++++++++++++----- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 38 +++++++++++++++---- 2 files changed, 62 insertions(+), 16 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +31 -9
@@ -84,19 +84,41 @@ static void dwmac4_rx_queue_priority(str u32 prio, u32 queue) { void __iomem *ioaddr = hw->pcsr; -u32 base_register; -u32 value; +u32 clear_mask =0 ; +u32 ctrl2, ctrl3; +int i; - base_register = (queue <4 ) ?GMAC_RXQ_CTRL2 :GMAC_RXQ_CTRL3 ; -if (queue >=4 ) - queue -=4 ; + ctrl2 =readl (ioaddr +GMAC_RXQ_CTRL2 ); + ctrl3 =readl (ioaddr +GMAC_RXQ_CTRL3 ); + +/* The software must ensure that the same priority +* is not mapped to multiple Rx queues +*/ +for (i =0 ; i <4 ; i++) + clear_mask |= ((prio <<GMAC_RXQCTRL_PSRQX_SHIFT (i)) & +GMAC_RXQCTRL_PSRQX_MASK (i)); - value =readl (ioaddr + base_register); + ctrl2 &= ~clear_mask; + ctrl3 &= ~clear_mask; - value &= ~GMAC_RXQCTRL_PSRQX_MASK (queue); - value |= (prio <<GMAC_RXQCTRL_PSRQX_SHIFT (queue)) & +/* First assign new priorities to a queue, then +* clear them from others queues +*/ +if (queue <4 ) { + ctrl2 |= (prio <<GMAC_RXQCTRL_PSRQX_SHIFT (queue)) &GMAC_RXQCTRL_PSRQX_MASK (queue); -writel (value, ioaddr + base_register); + +writel (ctrl2, ioaddr +GMAC_RXQ_CTRL2 ); +writel (ctrl3, ioaddr +GMAC_RXQ_CTRL3 ); + }else { + queue -=4 ; + + ctrl3 |= (prio <<GMAC_RXQCTRL_PSRQX_SHIFT (queue)) & +GMAC_RXQCTRL_PSRQX_MASK (queue); + +writel (ctrl3, ioaddr +GMAC_RXQ_CTRL3 ); +writel (ctrl2, ioaddr +GMAC_RXQ_CTRL2 ); + } } static void dwmac4_tx_queue_priority(struct mac_device_info *hw,
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +31 -7
@@ -103,17 +103,41 @@ static void dwxgmac2_rx_queue_prio(struc u32 queue) {void __iomem *ioaddr = hw->pcsr; -u32 value, reg; +u32 clear_mask =0 ; +u32 ctrl2, ctrl3; +int i; - reg = (queue <4 ) ?XGMAC_RXQ_CTRL2 :XGMAC_RXQ_CTRL3 ; -if (queue >=4 ) + ctrl2 =readl (ioaddr +XGMAC_RXQ_CTRL2 ); + ctrl3 =readl (ioaddr +XGMAC_RXQ_CTRL3 ); + +/* The software must ensure that the same priority +* is not mapped to multiple Rx queues +*/ +for (i =0 ; i <4 ; i++) + clear_mask |= ((prio <<XGMAC_PSRQ_SHIFT (i)) & +XGMAC_PSRQ (i)); + + ctrl2 &= ~clear_mask; + ctrl3 &= ~clear_mask; + +/* First assign new priorities to a queue, then +* clear them from others queues +*/ +if (queue <4 ) { + ctrl2 |= (prio <<XGMAC_PSRQ_SHIFT (queue)) & +XGMAC_PSRQ (queue); + +writel (ctrl2, ioaddr +XGMAC_RXQ_CTRL2 ); +writel (ctrl3, ioaddr +XGMAC_RXQ_CTRL3 ); + }else { queue -=4 ; - value =readl (ioaddr + reg); - value &= ~XGMAC_PSRQ (queue); - value |= (prio <<XGMAC_PSRQ_SHIFT (queue)) &XGMAC_PSRQ (queue); + ctrl3 |= (prio <<XGMAC_PSRQ_SHIFT (queue)) & +XGMAC_PSRQ (queue); -writel (value, ioaddr + reg); +writel (ctrl3, ioaddr +XGMAC_RXQ_CTRL3 ); +writel (ctrl2, ioaddr +XGMAC_RXQ_CTRL2 ); + } } static void dwxgmac2_prog_mtl_rx_algorithms(struct mac_device_info *hw,
Greg Kroah-Hartman
maintainerPATCH 160/175 block: prevent division by zero in blk_rq_stat_sum()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Smirnov <[email protected]>
[ Upstream commit 93f52fbeaf4b676b21acfe42a5152620e6770d02 ]
The expression dst->nr_samples + src->nr_samples may have zero value on overflow. It is necessary to add a check to avoid division by zero.
Found by Linux Verification Center (linuxtesting.org) with Svace.
--- block/blk-stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-stat.c +1 -1
@@ -27,7 +27,7 @@ void blk_rq_stat_init(struct blk_rq_stat *stat)/* src is a per-cpu stat, mean isn't initialized */ void blk_rq_stat_sum (struct blk_rq_stat *dst,struct blk_rq_stat *src) { -if (!src->nr_samples) +if (dst->nr_samples + src->nr_samples <= dst->nr_samples)return ; dst->min =min (dst->min, src->min);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 125/175 selftests: reuseaddr_conflict: add missing new line at the end of the output
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
commit 31974122cfdeaf56abc18d8ab740d580d9833e90 upstream.
The netdev CI runs in a VM and captures serial, so stdout and stderr get combined. Because there's a missing new line in stderr the test ends up corrupting KTAP:
# Successok 1 selftests: net: reuseaddr_conflict
which should have been:
# Success
ok 1 selftests: net: reuseaddr_conflict
--- tools/testing/selftests/net/reuseaddr_conflict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/reuseaddr_conflict.c +1 -1
@@ -109,6 +109,6 @@ int main(void) fd1 =open_port (0 ,1 );if (fd1 >=0 )error (1 ,0 ,"Was allowed to create an ipv4 reuseport on an already bound non-reuseport socket with no ipv6" ); -fprintf (stderr,"Success" ); +fprintf (stderr,"Success\n" );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 126/175 ipv6: Fix infinite recursion in fib6_dump_done().
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit d21d40605bca7bd5fc23ef03d4c1ca1f48bc2cae upstream.
syzkaller reported infinite recursive calls of fib6_dump_done() during netlink socket destruction. [1]
Quoted 1 line
From the log, syzkaller sent an
AF_UNSPECRTM_GETROUTEmessage, and then
the response was generated. The following recvmmsg() resumed the dump for IPv6, but the first call of inet6_dump_fib() failed at kzalloc() due to the fault injection. [0]
12:01:34 executing program 3:
r0 = socket$nl_route(0x10, 0x3, 0x0)
sendmsg$nl_route(r0, ... snip ...)
recvmmsg(r0, ... snip ...) (fail_nth: 8)
Here, fib6_dump_done() was set to nlk_sk(sk)->cb.done, and the next call of inet6_dump_fib() set it to nlk_sk(sk)->cb.args[3]. syzkaller stopped receiving the response halfway through, and finally netlink_sock_destruct() called nlk_sk(sk)->cb.done().
fib6_dump_done() calls fib6_dump_end() and nlk_sk(sk)->cb.done() if it is still not NULL. fib6_dump_end() rewrites nlk_sk(sk)->cb.done() by nlk_sk(sk)->cb.args[3], but it has the same function, not NULL, calling itself recursively and hitting the stack guard page.
To avoid the issue, let's set the destructor after kzalloc().
[0]:FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0
CPU: 1 PID: 432110 Comm: syz-executor.3 Not tainted 6.8.0-12821-g537c2e91d354-dirty #11 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl (lib/dump_stack.c:117) should_fail_ex (lib/fault-inject.c:52 lib/fault-inject.c:153) should_failslab (mm/slub.c:3733) kmalloc_trace (mm/slub.c:3748 mm/slub.c:3827 mm/slub.c:3992) inet6_dump_fib (./include/linux/slab.h:628 ./include/linux/slab.h:749 net/ipv6/ip6_fib.c:662) rtnl_dump_all (net/core/rtnetlink.c:4029) netlink_dump (net/netlink/af_netlink.c:2269) netlink_recvmsg (net/netlink/af_netlink.c:1988) ____sys_recvmsg (net/socket.c:1046 net/socket.c:2801) ___sys_recvmsg (net/socket.c:2846) do_recvmmsg (net/socket.c:2943) __x64_sys_recvmmsg (net/socket.c:3041 net/socket.c:3034 net/socket.c:3034)
[1]:
BUG: TASK stack guard page was hit at 00000000f2fa9af1 (stack is 00000000b7912430..000000009a436beb) stack guard page: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 223719 Comm: kworker/1:3 Not tainted 6.8.0-12821-g537c2e91d354-dirty #11 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 Workqueue: events netlink_sock_destruct_work RIP: 0010:fib6_dump_done (net/ipv6/ip6_fib.c:570) Code: 3c 24 e8 f3 e9 51 fd e9 28 fd ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 41 57 41 56 41 55 41 54 55 48 89 fd <53> 48 8d 5d 60 e8 b6 4d 07 fd 48 89 da 48 b8 00 00 00 00 00 fc ff RSP: 0018:ffffc9000d980000 EFLAGS: 00010293 RAX: 0000000000000000 RBX: ffffffff84405990 RCX: ffffffff844059d3 RDX: ffff8881028e0000 RSI: ffffffff84405ac2 RDI: ffff88810c02f358 RBP: ffff88810c02f358 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000224 R12: 0000000000000000 R13: ffff888007c82c78 R14: ffff888007c82c68 R15: ffff888007c82c68 FS: 0000000000000000(0000) GS:ffff88811b100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffc9000d97fff8 CR3: 0000000102309002 CR4: 0000000000770ef0 PKRU: 55555554 Call Trace: <#DF> </#DF> <TASK> fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1)) fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1)) ... fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1)) fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1)) netlink_sock_destruct (net/netlink/af_netlink.c:401) __sk_destruct (net/core/sock.c:2177 (discriminator 2)) sk_destruct (net/core/sock.c:2224) __sk_free (net/core/sock.c:2235) sk_free (net/core/sock.c:2246) process_one_work (kernel/workqueue.c:3259) worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416) kthread (kernel/kthread.c:388) ret_from_fork (arch/x86/kernel/process.c:153) ret_from_fork_asm (arch/x86/entry/entry_64.S:256) Modules linked in:
--- net/ipv6/ip6_fib.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/ipv6/ip6_fib.c +7 -7
@@ -587,19 +587,19 @@ static int inet6_dump_fib(struct sk_buffif (!w) {/* New dump: * -* 1. hook callback destructor. -*/ - cb->args[3 ] = (long )cb->done; - cb->done = fib6_dump_done; - -/* -* 2. allocate and initialize walker. +* 1. allocate and initialize walker. */ w =kzalloc (sizeof (*w),GFP_ATOMIC );if (!w)return -ENOMEM ; w->func = fib6_dump_node; cb->args[2 ] = (long )w; + +/* 2. hook callback destructor. +*/ + cb->args[3 ] = (long )cb->done; + cb->done = fib6_dump_done; + } arg.skb = skb;
Greg Kroah-Hartman
maintainerPATCH 127/175 i40e: fix vf may be used uninitialized in this function warning
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Loktionov <[email protected]>
commit f37c4eac99c258111d414d31b740437e1925b8e8 upstream.
To fix the regression introduced by commit 52424f974bc5, which causes servers hang in very hard to reproduce conditions with resets races. Using two sources for the information is the root cause.
In this function before the fix bumping v didn't mean bumping vf pointer. But the code used this variables interchangeably, so stale vf could point to different/not intended vf.
Remove redundant "v" variable and iterate via single VF pointer across whole function instead to guarantee VF pointer validity.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 34 +++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +16 -18
@@ -1317,8 +1317,8 @@ bool i40e_reset_all_vfs(struct i40e_pf * {struct i40e_hw *hw = &pf->hw;struct i40e_vf *vf; -int i, v;u32 reg; +int i;/* If we don't have any VFs, then there is nothing to reset */ if (!pf->num_alloc_vfs)
@@ -1329,11 +1329,10 @@ bool i40e_reset_all_vfs(struct i40e_pf *return false;/* Begin reset on all VFs at once */ -for (v =0 ; v < pf->num_alloc_vfs; v++) { - vf = &pf->vf[v]; +for (vf = &pf->vf[0 ]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) {/* If VF is being reset no need to trigger reset again */ if (!test_bit (I40E_VF_STATE_RESETTING , &vf->vf_states)) -i40e_trigger_vf_reset (&pf->vf[v], flr); +i40e_trigger_vf_reset (vf, flr); }/* HW requires some time to make sure it can flush the FIFO for a VF
@@ -1342,14 +1341,13 @@ bool i40e_reset_all_vfs(struct i40e_pf ** the VFs using a simple iterator that increments once that VF has * finished resetting. */ -for (i =0 , v =0 ; i <10 && v < pf->num_alloc_vfs; i++) { +for (i =0 , vf = &pf->vf[0 ]; i <10 && vf < &pf->vf[pf->num_alloc_vfs]; ++i) {usleep_range (10000 ,20000 );/* Check each VF in sequence, beginning with the VF to fail * the previous check. */ -while (v < pf->num_alloc_vfs) { - vf = &pf->vf[v]; +while (vf < &pf->vf[pf->num_alloc_vfs]) {if (!test_bit (I40E_VF_STATE_RESETTING , &vf->vf_states)) { reg =rd32 (hw,I40E_VPGEN_VFRSTAT (vf->vf_id));if (!(reg &I40E_VPGEN_VFRSTAT_VFRD_MASK ))
@@ -1359,7 +1357,7 @@ bool i40e_reset_all_vfs(struct i40e_pf */* If the current VF has finished resetting, move on * to the next VF in sequence. */ - v++; + ++vf; } }
@@ -1369,39 +1367,39 @@ bool i40e_reset_all_vfs(struct i40e_pf */* Display a warning if at least one VF didn't manage to reset in * time, but continue on with the operation. */ -if (v < pf->num_alloc_vfs) +if (vf < &pf->vf[pf->num_alloc_vfs])dev_err (&pf->pdev->dev,"VF reset check timeout on VF %d\n" , - pf->vf[v].vf_id); + vf->vf_id);usleep_range (10000 ,20000 );/* Begin disabling all the rings associated with VFs, but do not wait * between each VF. */ -for (v =0 ; v < pf->num_alloc_vfs; v++) { +for (vf = &pf->vf[0 ]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) {/* On initial reset, we don't have any queues to disable */ -if (pf->vf[v].lan_vsi_idx ==0 ) +if (vf->lan_vsi_idx ==0 )continue ;/* If VF is reset in another thread just continue */ if (test_bit (I40E_VF_STATE_RESETTING , &vf->vf_states))continue ; -i40e_vsi_stop_rings_no_wait (pf->vsi[pf->vf[v].lan_vsi_idx]); +i40e_vsi_stop_rings_no_wait (pf->vsi[vf->lan_vsi_idx]); }/* Now that we've notified HW to disable all of the VF rings, wait * until they finish. */ -for (v =0 ; v < pf->num_alloc_vfs; v++) { +for (vf = &pf->vf[0 ]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) {/* On initial reset, we don't have any queues to disable */ -if (pf->vf[v].lan_vsi_idx ==0 ) +if (vf->lan_vsi_idx ==0 )continue ;/* If VF is reset in another thread just continue */ if (test_bit (I40E_VF_STATE_RESETTING , &vf->vf_states))continue ; -i40e_vsi_wait_queues_disabled (pf->vsi[pf->vf[v].lan_vsi_idx]); +i40e_vsi_wait_queues_disabled (pf->vsi[vf->lan_vsi_idx]); }/* Hw may need up to 50ms to finish disabling the RX queues. We
@@ -1410,12 +1408,12 @@ bool i40e_reset_all_vfs(struct i40e_pf *mdelay (50 );/* Finish the reset on each VF */ -for (v =0 ; v < pf->num_alloc_vfs; v++) { +for (vf = &pf->vf[0 ]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) {/* If VF is reset in another thread just continue */ if (test_bit (I40E_VF_STATE_RESETTING , &vf->vf_states))continue ; -i40e_cleanup_reset_vf (&pf->vf[v]); +i40e_cleanup_reset_vf (vf); }i40e_flush (hw);
Greg Kroah-Hartman
maintainerPATCH 128/175 staging: mmal-vchiq: Avoid use of bool in structures
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 640e77466e69d9c28de227bc76881f5501f532ca ]
Fixes up a checkpatch error "Avoid using bool structure members because of possible alignment issues".
Stable-dep-of: f37e76abd614 ("staging: vc04_services: fix information leak in create_component()")
--- .../vc04_services/bcm2835-camera/mmal-vchiq.c | 12 ++++++------ .../vc04_services/bcm2835-camera/mmal-vchiq.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +6 -6
@@ -845,9 +845,9 @@ static int port_info_get(struct vchiq_mmal_instance *instance, goto release_msg;if (rmsg->u.port_info_get_reply.port.is_enabled ==0 ) - port->enabled = false; + port->enabled =0 ;else - port->enabled = true; + port->enabled =1 ;/* copy the values out of the message */ port->handle = rmsg->u.port_info_get_reply.port_handle;
@@ -1283,7 +1283,7 @@ static int port_disable(struct vchiq_mmal_instance *instance,if (!port->enabled)return 0 ; - port->enabled = false; + port->enabled =0 ; ret =port_action_port (instance, port,MMAL_MSG_PORT_ACTION_TYPE_DISABLE );
@@ -1335,7 +1335,7 @@ static int port_enable(struct vchiq_mmal_instance *instance,if (ret) goto done; - port->enabled = true; + port->enabled =1 ;if (port->buffer_cb) {/* send buffer headers to videocore */
@@ -1502,7 +1502,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,pr_err ("failed disconnecting src port\n" ); goto release_unlock; } - src->connected->enabled = false; + src->connected->enabled =0 ; src->connected =NULL ; }
@@ -1746,7 +1746,7 @@ int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance, ret =disable_component (instance, component);if (ret ==0 ) - component->enabled = false; + component->enabled =0 ;mutex_unlock (&instance->vchiq_mutex);
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h +2 -2
@@ -47,7 +47,7 @@ typedef void (*vchiq_mmal_buffer_cb)( unsigned long length, u32 mmal_flags, s64 dts, s64 pts);struct vchiq_mmal_port { -bool enabled; +u32 enabled:1 ;u32 handle;u32 type;/* port type, cached to use on port info set */ u32 index;/* port index, cached to use on port info set */
@@ -81,7 +81,7 @@ struct vchiq_mmal_port { };struct vchiq_mmal_component { -bool enabled; +u32 enabled:1 ;u32 handle;/* VideoCore handle for component */ u32 inputs;/* Number of input ports */ u32 outputs;/* Number of output ports */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 129/175 staging: mmal-vchiq: Allocate and free components as required
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 8c589e1794a31e9a381916b0280260ab601e4d6e ]
The existing code assumed that there would only ever be 4 components, and never freed the entries once used.
Allow arbitrary creation and destruction of components.
Stable-dep-of: f37e76abd614 ("staging: vc04_services: fix information leak in create_component()")
--- .../vc04_services/bcm2835-camera/mmal-vchiq.c | 29 ++++++++++++------- .../vc04_services/bcm2835-camera/mmal-vchiq.h | 1 + 2 files changed, 20 insertions(+), 10 deletions(-)
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +19 -10
@@ -31,8 +31,11 @@#define USE_VCHIQ_ARM #include "interface/vchi/vchi.h" -/* maximum number of components supported */ -#define VCHIQ_MMAL_MAX_COMPONENTS 4 +/* +* maximum number of components supported. +* This matches the maximum permitted by default on the VPU +*/ +#define VCHIQ_MMAL_MAX_COMPONENTS 64/*#define FULL_MSG_DUMP 1*/
@@ -165,8 +168,6 @@ struct vchiq_mmal_instance {/* protect accesses to context_map */ struct mutex context_map_lock; -/* component to use next */ -int component_idx;struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS ]; };
@@ -1607,18 +1608,24 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, {int ret;int idx;/* port index */ -struct vchiq_mmal_component *component; +struct vchiq_mmal_component *component =NULL ;if (mutex_lock_interruptible (&instance->vchiq_mutex))return -EINTR ; -if (instance->component_idx ==VCHIQ_MMAL_MAX_COMPONENTS ) { +for (idx =0 ; idx <VCHIQ_MMAL_MAX_COMPONENTS ; idx++) { +if (!instance->component[idx].in_use) { + component = &instance->component[idx]; + component->in_use =1 ; +break ; + } + } + +if (!component) { ret = -EINVAL ;/* todo is this correct error? */ goto unlock; } - component = &instance->component[instance->component_idx]; - ret =create_component (instance, component, name);if (ret <0 ) goto unlock;
@@ -1666,8 +1673,6 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, goto release_component; } - instance->component_idx++; - *component_out = component;mutex_unlock (&instance->vchiq_mutex);
@@ -1677,6 +1682,8 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, release_component:destroy_component (instance, component); unlock: +if (component) + component->in_use =0 ;mutex_unlock (&instance->vchiq_mutex);return ret;
@@ -1698,6 +1705,8 @@ int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, ret =destroy_component (instance, component); + component->in_use =0 ; +mutex_unlock (&instance->vchiq_mutex);return ret;
drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h +1 -0
@@ -81,6 +81,7 @@ struct vchiq_mmal_port { };struct vchiq_mmal_component { +u32 in_use:1 ;u32 enabled:1 ;u32 handle;/* VideoCore handle for component */ u32 inputs;/* Number of input ports */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 120/175 Revert "x86/mm/ident_map: Use gbpages only where full GB page should be mapped."
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit c567f2948f57bdc03ed03403ae0234085f376b7d upstream.
This reverts commit d794734c9bbfe22f86686dc2909c25f5ffe1a572.
While the original change tries to fix a bug, it also unintentionally broke existing systems, see the regressions reported at:
https://lore.kernel.org/all/[email protected]/
Since d794734c9bbf was also marked for -stable, let's back it out before causing more damage.
Note that due to another upstream change the revert was not 100% automatic:
0a845e0f6348 mm/treewide: replace pud_large() with pud_leaf()
--- arch/x86/mm/ident_map.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
arch/x86/mm/ident_map.c +5 -18
@@ -26,31 +26,18 @@ static int ident_pud_init(struct x86_mapfor (; addr < end; addr = next) {pud_t *pud = pud_page +pud_index (addr);pmd_t *pmd; -bool use_gbpage; next = (addr &PUD_MASK ) +PUD_SIZE ;if (next > end) next = end; -/* if this is already a gbpage, this portion is already mapped */ -if (pud_large (*pud)) -continue ; - -/* Is using a gbpage allowed? */ - use_gbpage = info->direct_gbpages; - -/* Don't use gbpage if it maps more than the requested region. */ -/* at the begining: */ - use_gbpage &= ((addr & ~PUD_MASK ) ==0 ); -/* ... or at the end: */ - use_gbpage &= ((next & ~PUD_MASK ) ==0 ); - -/* Never overwrite existing mappings */ - use_gbpage &= !pud_present (*pud); - -if (use_gbpage) { +if (info->direct_gbpages) {pud_t pudval; +if (pud_present (*pud)) +continue ; + + addr &=PUD_MASK ; pudval =__pud ((addr - info->offset) | info->page_flag);set_pud (pud, pudval);continue ;
Greg Kroah-Hartman
maintainerPATCH 162/175 ktest: force $buildonly = 1 for make_warnings_file test type
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo B. Marliere <[email protected]>
[ Upstream commit 07283c1873a4d0eaa0e822536881bfdaea853910 ]
The test type "make_warnings_file" should have no mandatory configuration parameters other than the ones required by the "build" test type, because its purpose is to create a file with build warnings that may or may not be used by other subsequent tests. Currently, the only way to use it as a stand-alone test is by setting POWER_CYCLE, CONSOLE, SSH_USER, BUILD_TARGET, TARGET_IMAGE, REBOOT_TYPE and GRUB_MENU.
--- tools/testing/ktest/ktest.pl | 1 + 1 file changed, 1 insertion(+)
tools/testing/ktest/ktest.pl +1 -0
@@ -765,6 +765,7 @@ sub set_value { if ($lvalue =~ /^(TEST|BISECT|CONFIG_BISECT)_TYPE(\[.*\])?$/ && $prvalue !~ /^(config_|)bisect$/ && $prvalue !~ /^build$/ && + $prvalue !~ /^make_warnings_file$/ && $buildonly) { # Note if a test is something other than build, then we
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/175 Bluetooth: btintel: Fixe build regression
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
commit 6e62ebfb49eb65bdcbfc5797db55e0ce7f79c3dd upstream.
This fixes the following build regression:
drivers-bluetooth-btintel.c-btintel_read_version()-warn:
passing-zero-to-PTR_ERR
--- drivers/bluetooth/btintel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/btintel.c +2 -2
@@ -355,13 +355,13 @@ int btintel_read_version(struct hci_devstruct sk_buff *skb; skb =__hci_cmd_sync (hdev,0xfc05 ,0 ,NULL ,HCI_CMD_TIMEOUT ); -if (IS_ERR_OR_NULL (skb)) { +if (IS_ERR (skb)) {bt_dev_err (hdev,"Reading Intel version information failed (%ld)" ,PTR_ERR (skb));return PTR_ERR (skb); } -if (skb->len !=sizeof (*ver)) { +if (!skb || skb->len !=sizeof (*ver)) {bt_dev_err (hdev,"Intel version event size mismatch" );kfree_skb (skb);return -EILSEQ ;
Greg Kroah-Hartman
maintainerPATCH 172/175 VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
commit e606e4b71798cc1df20e987dde2468e9527bd376 upstream.
The changes are similar to those given in the commit 19b070fefd0d ("VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host()").
Fix filling of the msg and msg_payload in dg_info struct, which prevents a possible "detected field-spanning write" of memcpy warning that is issued by the tracking mechanism __fortify_memcpy_chk.
--- drivers/misc/vmw_vmci/vmci_datagram.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_datagram.c +2 -1
@@ -386,7 +386,8 @@ int vmci_datagram_invoke_guest_handler(s dg_info->in_dg_host_queue = false; dg_info->entry = dst_entry; -memcpy (&dg_info->msg, dg,VMCI_DG_SIZE (dg)); + dg_info->msg = *dg; +memcpy (&dg_info->msg_payload, dg +1 , dg->payload_size);INIT_WORK (&dg_info->work, dg_delayed_dispatch);schedule_work (&dg_info->work);
Greg Kroah-Hartman
maintainerPATCH 173/175 erspan: Check IFLA_GRE_ERSPAN_VER is set.
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Tu <[email protected]>
commit 51fa960d3b5163b1af22efdebcabfccc5d615ad6 upstream.
Add a check to make sure the IFLA_GRE_ERSPAN_VER is provided by users.
--- net/ipv4/ip_gre.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/ip_gre.c +2 -1
@@ -1182,7 +1182,8 @@ static int erspan_validate(struct nlattrif (ret)return ret; -if (nla_get_u8 (data[IFLA_GRE_ERSPAN_VER ]) ==0 ) +if (data[IFLA_GRE_ERSPAN_VER ] && +nla_get_u8 (data[IFLA_GRE_ERSPAN_VER ]) ==0 )return 0 ;/* ERSPAN type II/III should only have GRE sequence and key flag */
Greg Kroah-Hartman
maintainerPATCH 174/175 ip_gre: do not report erspan version on GRE interface
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit ee496694b9eea651ae1aa4c4667d886cdf74aa3b upstream.
Although the type I ERSPAN is based on the barebones IP + GRE encapsulation and no extra ERSPAN header. Report erspan version on GRE interface looks unreasonable. Fix this by separating the erspan and gre fill info.
IPv6 GRE does not have this info as IPv6 only supports erspan version 1 and 2.
--- net/ipv4/ip_gre.c | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-)
net/ipv4/ip_gre.c +29 -19
@@ -1586,24 +1586,6 @@ static int ipgre_fill_info(struct sk_bufstruct ip_tunnel_parm *p = &t->parms;__be16 o_flags = p->o_flags; -if (t->erspan_ver <=2 ) { -if (t->erspan_ver !=0 && !t->collect_md) - o_flags |=TUNNEL_KEY ; - -if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_VER , t->erspan_ver)) - goto nla_put_failure; - -if (t->erspan_ver ==1 ) { -if (nla_put_u32 (skb,IFLA_GRE_ERSPAN_INDEX , t->index)) - goto nla_put_failure; - }else if (t->erspan_ver ==2 ) { -if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_DIR , t->dir)) - goto nla_put_failure; -if (nla_put_u16 (skb,IFLA_GRE_ERSPAN_HWID , t->hwid)) - goto nla_put_failure; - } - } - if (nla_put_u32(skb, IFLA_GRE_LINK, p->link) || nla_put_be16(skb, IFLA_GRE_IFLAGS, gre_tnl_flags_to_gre_flags(p->i_flags)) ||
@@ -1644,6 +1626,34 @@ nla_put_failure:return -EMSGSIZE ; } +static int erspan_fill_info (struct sk_buff *skb,const struct net_device *dev) +{ +struct ip_tunnel *t =netdev_priv (dev); + +if (t->erspan_ver <=2 ) { +if (t->erspan_ver !=0 && !t->collect_md) + t->parms.o_flags |=TUNNEL_KEY ; + +if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_VER , t->erspan_ver)) + goto nla_put_failure; + +if (t->erspan_ver ==1 ) { +if (nla_put_u32 (skb,IFLA_GRE_ERSPAN_INDEX , t->index)) + goto nla_put_failure; + }else if (t->erspan_ver ==2 ) { +if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_DIR , t->dir)) + goto nla_put_failure; +if (nla_put_u16 (skb,IFLA_GRE_ERSPAN_HWID , t->hwid)) + goto nla_put_failure; + } + } + +return ipgre_fill_info (skb, dev); + +nla_put_failure: +return -EMSGSIZE ; +} +static void erspan_setup (struct net_device *dev) {struct ip_tunnel *t =netdev_priv (dev);
@@ -1722,7 +1732,7 @@ static struct rtnl_link_ops erspan_link_ .changelink = erspan_changelink, .dellink = ip_tunnel_dellink, .get_size = ipgre_get_size, - .fill_info = ipgre_fill_info, + .fill_info = erspan_fill_info, .get_link_net = ip_tunnel_get_link_net, };
Greg Kroah-Hartman
maintainerPATCH 175/175 initramfs: fix populate_initrd_image() section mismatch
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 4ada1e810038e9dbc20e40b524e05ee1a9d31f98 upstream.
With gcc-4.6.3:
WARNING: vmlinux.o(.text.unlikely+0x140): Section mismatch in reference from the function populate_initrd_image() to the variable .init.ramfs.info:__initramfs_size The function populate_initrd_image() references
the variable __init __initramfs_size.
This is often because populate_initrd_image lacks a __init
annotation or the annotation of __initramfs_size is wrong.
WARNING: vmlinux.o(.text.unlikely+0x14c): Section mismatch in reference from the function populate_initrd_image() to the function .init.text:unpack_to_rootfs() The function populate_initrd_image() references
the function __init unpack_to_rootfs().
This is often because populate_initrd_image lacks a __init
annotation or the annotation of unpack_to_rootfs is wrong.
WARNING: vmlinux.o(.text.unlikely+0x198): Section mismatch in reference from the function populate_initrd_image() to the function .init.text:xwrite() The function populate_initrd_image() references
the function __init xwrite().
This is often because populate_initrd_image lacks a __init
annotation or the annotation of xwrite is wrong.
Indeed, if the compiler decides not to inline populate_initrd_image(), a warning is generated.
Fix this by adding the missing __init annotations.
--- init/initramfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
init/initramfs.c +1 -1
@@ -603,7 +603,7 @@ static void __init clean_rootfs(void)#endif #ifdef CONFIG_BLK_DEV_RAM -static void populate_initrd_image (char *err) +static void __init populate_initrd_image (char *err) {ssize_t written;struct file *file;
Greg Kroah-Hartman
maintainerPATCH 163/175 tools: iio: replace seekdir() in iio_generic_buffer
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petre Rodan <[email protected]>
[ Upstream commit 4e6500bfa053dc133021f9c144261b77b0ba7dc8 ]
Replace seekdir() with rewinddir() in order to fix a localized glibc bug.
One of the glibc patches that stable Gentoo is using causes an improper directory stream positioning bug on 32bit arm. That in turn ends up as a floating point exception in iio_generic_buffer.
The attached patch provides a fix by using an equivalent function which should not cause trouble for other distros and is easier to reason about in general as it obviously always goes back to to the start.
https://sourceware.org/bugzilla/show_bug.cgi?id=31212
--- tools/iio/iio_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/iio/iio_utils.c +1 -1
@@ -376,7 +376,7 @@ int build_channel_array(const char *device_dir, goto error_close_dir; } -seekdir (dp,0 ); +rewinddir (dp);while (ent =readdir (dp), ent) {if (strcmp (ent->d_name +strlen (ent->d_name) -strlen ("_en" ),"_en" ) ==0 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/175 usb: sl811-hcd: only defined function checkdone if QUIRK2 is defined
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit 12f371e2b6cb4b79c788f1f073992e115f4ca918 ]
Function checkdone is only required if QUIRK2 is defined, so add appropriate #if / #endif around the function.
Cleans up clang scan build warning:drivers/usb/host/sl811-hcd.c:588:18: warning: unused function 'checkdone' [-Wunused-function]
--- drivers/usb/host/sl811-hcd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/sl811-hcd.c +2 -0
@@ -585,6 +585,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)finish_request (sl811, ep, urb, urbstat); } +#ifdef QUIRK2 static inline u8 checkdone (struct sl811 *sl811) {u8 ctl;
@@ -616,6 +617,7 @@ static inline u8 checkdone(struct sl811 *sl811)#endif return irqstat; } +#endif static irqreturn_t sl811h_irq (struct usb_hcd *hcd) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/175 fbdev: viafb: fix typo in hw_bitblt_1 and hw_bitblt_2
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Burakov <[email protected]>
[ Upstream commit bc87bb342f106a0402186bcb588fcbe945dced4b ]
There are some actions with value 'tmp' but 'dst_addr' is checked instead. It is obvious that a copy-paste error was made here and the value of variable 'tmp' should be checked here.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/video/fbdev/via/accel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/via/accel.c +2 -2
@@ -129,7 +129,7 @@ static int hw_bitblt_1(void __iomem *engine, u8 op, u32 width, u32 height,if (op !=VIA_BITBLT_FILL ) { tmp = src_mem ?0 : src_addr; -if (dst_addr &0xE0000007 ) { +if (tmp &0xE0000007 ) {printk (KERN_WARNING "hw_bitblt_1: Unsupported source " "address %X\n" , tmp);return -EINVAL ;
@@ -274,7 +274,7 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height,writel (tmp, engine +0x18 ); tmp = src_mem ?0 : src_addr; -if (dst_addr &0xE0000007 ) { +if (tmp &0xE0000007 ) {printk (KERN_WARNING "hw_bitblt_2: Unsupported source " "address %X\n" , tmp);return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/175 fbmon: prevent division by zero in fb_videomode_from_videomode()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Smirnov <[email protected]>
[ Upstream commit c2d953276b8b27459baed1277a4fdd5dd9bd4126 ]
The expression htotal * vtotal can have a zero value on overflow. It is necessary to prevent division by zero like in fb_var_to_videomode().
Found by Linux Verification Center (linuxtesting.org) with Svace.
--- drivers/video/fbdev/core/fbmon.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/video/fbdev/core/fbmon.c +4 -3
@@ -1309,7 +1309,7 @@ int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_infint fb_videomode_from_videomode (const struct videomode *vm,struct fb_videomode *fbmode) { -unsigned int htotal, vtotal; +unsigned int htotal, vtotal, total; fbmode->xres = vm->hactive; fbmode->left_margin = vm->hback_porch;
@@ -1342,8 +1342,9 @@ int fb_videomode_from_videomode(const struct videomode *vm, vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch + vm->vsync_len;/* prevent division by zero */ -if (htotal && vtotal) { - fbmode->refresh = vm->pixelclock / (htotal * vtotal); + total = htotal * vtotal; +if (total) { + fbmode->refresh = vm->pixelclock / total;/* a mode must have htotal and vtotal != 0 or it is invalid */ }else { fbmode->refresh =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/175 tty: n_gsm: require CAP_NET_ADMIN to attach N_GSM0710 ldisc
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 67c37756898a5a6b2941a13ae7260c89b54e0d88 upstream.
Any unprivileged user can attach N_GSM0710 ldisc, but it requires CAP_NET_ADMIN to create a GSM network anyway.
Require initial namespace CAP_NET_ADMIN to do that.
From: Salvatore Bonaccorso <[email protected]>
--- drivers/tty/n_gsm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/n_gsm.c +3 -0
@@ -2435,6 +2435,9 @@ static int gsmld_open(struct tty_structstruct gsm_mux *gsm;int ret; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (tty->ops->write ==NULL )return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 168/175 drm/vkms: call drm_atomic_helper_shutdown before drm_dev_put()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guo Mengqi <[email protected]>
commit 73a82b22963d ("drm/atomic: Fix potential use-after-free in nonblocking commits") introduced drm_dev_get/put() to drm_atomic_helper_shutdown(). And this cause problem in vkms driver exit process.
vkms_exit()
drm_dev_put()
vkms_release()
drm_atomic_helper_shutdown()
drm_dev_get()
drm_dev_put()
vkms_release() ------ use after freeUsing 5.4 stable x86 image on qemu, below stacktrace can be triggered by load and unload vkms.ko.
root:~ # insmod vkms.ko
[ 76.957802] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 76.961490] [drm] Driver supports precise vblank timestamp query. [ 76.964416] [drm] Initialized vkms 1.0.0 20180514 for vkms on minor 0 root:~ # rmmod vkms.ko [ 79.650202] refcount_t: addition on 0; use-after-free. [ 79.650249] WARNING: CPU: 2 PID: 3533 at ../lib/refcount.c:25 refcount_warn_saturate+0xcf/0xf0 [ 79.654241] Modules linked in: vkms(-) [ 79.654249] CPU: 2 PID: 3533 Comm: rmmod Not tainted 5.4.273 #4 [ 79.654251] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [ 79.654262] RIP: 0010:refcount_warn_saturate+0xcf/0xf0 ... [ 79.654296] Call Trace: [ 79.654462] ? __warn+0x80/0xd0 [ 79.654473] ? refcount_warn_saturate+0xcf/0xf0 [ 79.654481] ? report_bug+0xb6/0x130 [ 79.654484] ? refcount_warn_saturate+0xcf/0xf0 [ 79.654489] ? fixup_bug.part.12+0x13/0x30 [ 79.654492] ? do_error_trap+0x90/0xb0 [ 79.654495] ? do_invalid_op+0x31/0x40 [ 79.654497] ? refcount_warn_saturate+0xcf/0xf0 [ 79.654504] ? invalid_op+0x1e/0x30 [ 79.654508] ? refcount_warn_saturate+0xcf/0xf0 [ 79.654516] drm_atomic_state_init+0x68/0xb0 [ 79.654543] drm_atomic_state_alloc+0x43/0x60 [ 79.654551] drm_atomic_helper_disable_all+0x13/0x180 [ 79.654562] drm_atomic_helper_shutdown+0x5f/0xb0 [ 79.654571] vkms_release+0x18/0x40 [vkms] [ 79.654575] vkms_exit+0x29/0xc00 [vkms] [ 79.654582] __x64_sys_delete_module+0x155/0x220 [ 79.654592] do_syscall_64+0x43/0x120 [ 79.654603] entry_SYSCALL_64_after_hwframe+0x5c/0xc1 [ 79.654619] ---[ end trace ce0c02f57ea6bf73 ]---
It seems that the proper unload sequence is:
drm_atomic_helper_shutdown(); drm_dev_put();
Just put drm_atomic_helper_shutdown() before drm_dev_put() should solve the problem.
Note that vkms exit code is refactored by commit 53d77aaa3f76 ("drm/vkms: Use devm_drm_dev_alloc") in tags/v5.10-rc1.
So this bug only exists on 4.19 and 5.4.
--- drivers/gpu/drm/vkms/vkms_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_drv.c +1 -1
@@ -39,7 +39,6 @@ static void vkms_release(struct drm_devi struct vkms_device *vkms = container_of(dev, struct vkms_device, drm);platform_device_unregister (vkms->platform); -drm_atomic_helper_shutdown (&vkms->drm);drm_mode_config_cleanup (&vkms->drm);drm_dev_fini (&vkms->drm); }
@@ -137,6 +136,7 @@ static void __exit vkms_exit(void) }drm_dev_unregister (&vkms_device->drm); +drm_atomic_helper_shutdown (&vkms_device->drm);drm_dev_put (&vkms_device->drm);kfree (vkms_device);
Greg Kroah-Hartman
maintainerPATCH 169/175 virtio: reenable config if freezing device failed
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 310227f42882c52356b523e2f4e11690eebcd2ab upstream.
Currently, we don't reenable the config if freezing the device failed.
For example, virtio-mem currently doesn't support suspend+resume, and trying to freeze the device will always fail. Afterwards, the device will no longer respond to resize requests, because it won't get notified about config changes.
Let's fix this by re-enabling the config if freezing fails.
Message-Id: <[email protected]>
--- drivers/virtio/virtio.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/virtio/virtio.c +8 -2
@@ -376,13 +376,19 @@ EXPORT_SYMBOL_GPL(unregister_virtio_deviint virtio_device_freeze (struct virtio_device *dev) {struct virtio_driver *drv =drv_to_virtio (dev->dev.driver); +int ret;virtio_config_disable (dev); dev->failed = dev->config->get_status (dev) &VIRTIO_CONFIG_S_FAILED ; -if (drv && drv->freeze) -return drv->freeze (dev); +if (drv && drv->freeze) { + ret = drv->freeze (dev); +if (ret) { +virtio_config_enable (dev); +return ret; + } + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 170/175 x86/mm/pat: fix VM_PAT handling in COW mappings
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 04c35ab3bdae7fefbd7c7a7355f29fa03a035221 upstream.
PAT handling won't do the right thing in COW mappings: the first PTE (or, in fact, all PTEs) can be replaced during write faults to point at anon folios. Reliably recovering the correct PFN and cachemode using follow_phys() from PTEs will not work in COW mappings.
Using follow_phys(), we might just get the address+protection of the anon folio (which is very wrong), or fail on swap/nonswap entries, failing follow_phys() and triggering a WARN_ON_ONCE() in untrack_pfn() and track_pfn_copy(), not properly calling free_pfn_range().
In free_pfn_range(), we either wouldn't call memtype_free() or would call it with the wrong range, possibly leaking memory.
To fix that, let's update follow_phys() to refuse returning anon folios, and fallback to using the stored PFN inside vma->vm_pgoff for COW mappings if we run into that.
We will now properly handle untrack_pfn() with COW mappings, where we don't need the cachemode. We'll have to fail fork()->track_pfn_copy() if the first page was replaced by an anon folio, though: we'd have to store the cachemode in the VMA to make this work, likely growing the VMA size.
For now, lets keep it simple and let track_pfn_copy() just fail in that
case: it would have failed in the past with swap/nonswap entries already, and it would have done the wrong thing with anon folios.
Simple reproducer to trigger the WARN_ON_ONCE() in untrack_pfn():
<--- C reproducer --->
#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <liburing.h>
int main(void)
{
struct io_uring_params p = {};
int ring_fd;
size_t size;
char *map;
ring_fd = io_uring_setup(1, &p);
if (ring_fd < 0) {
perror("io_uring_setup");
return 1;
}
size = p.sq_off.array + p.sq_entries * sizeof(unsigned);
/* Map the submission queue ring MAP_PRIVATE */
map = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
ring_fd, IORING_OFF_SQ_RING);
if (map == MAP_FAILED) {
perror("mmap");
return 1;
}
/* We have at least one page. Let's COW it. */
*map = 0;
pause();
return 0; }
<--- C reproducer --->
On a system with 16 GiB RAM and swap configured:
# ./iouring & # memhog 16G # killall iouring [ 301.552930] ------------[ cut here ]------------ [ 301.553285] WARNING: CPU: 7 PID: 1402 at arch/x86/mm/pat/memtype.c:1060 untrack_pfn+0xf4/0x100 [ 301.553989] Modules linked in: binfmt_misc nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_g [ 301.558232] CPU: 7 PID: 1402 Comm: iouring Not tainted 6.7.5-100.fc38.x86_64 #1 [ 301.558772] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebu4 [ 301.559569] RIP: 0010:untrack_pfn+0xf4/0x100 [ 301.559893] Code: 75 c4 eb cf 48 8b 43 10 8b a8 e8 00 00 00 3b 6b 28 74 b8 48 8b 7b 30 e8 ea 1a f7 000 [ 301.561189] RSP: 0018:ffffba2c0377fab8 EFLAGS: 00010282 [ 301.561590] RAX: 00000000ffffffea RBX: ffff9208c8ce9cc0 RCX: 000000010455e047 [ 301.562105] RDX: 07fffffff0eb1e0a RSI: 0000000000000000 RDI: ffff9208c391d200 [ 301.562628] RBP: 0000000000000000 R08: ffffba2c0377fab8 R09: 0000000000000000 [ 301.563145] R10: ffff9208d2292d50 R11: 0000000000000002 R12: 00007fea890e0000 [ 301.563669] R13: 0000000000000000 R14: ffffba2c0377fc08 R15: 0000000000000000 [ 301.564186] FS: 0000000000000000(0000) GS:ffff920c2fbc0000(0000) knlGS:0000000000000000 [ 301.564773] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 301.565197] CR2: 00007fea88ee8a20 CR3: 00000001033a8000 CR4: 0000000000750ef0 [ 301.565725] PKRU: 55555554 [ 301.565944] Call Trace: [ 301.566148] <TASK> [ 301.566325] ? untrack_pfn+0xf4/0x100 [ 301.566618] ? __warn+0x81/0x130 [ 301.566876] ? untrack_pfn+0xf4/0x100 [ 301.567163] ? report_bug+0x171/0x1a0 [ 301.567466] ? handle_bug+0x3c/0x80 [ 301.567743] ? exc_invalid_op+0x17/0x70 [ 301.568038] ? asm_exc_invalid_op+0x1a/0x20 [ 301.568363] ? untrack_pfn+0xf4/0x100 [ 301.568660] ? untrack_pfn+0x65/0x100 [ 301.568947] unmap_single_vma+0xa6/0xe0 [ 301.569247] unmap_vmas+0xb5/0x190 [ 301.569532] exit_mmap+0xec/0x340 [ 301.569801] __mmput+0x3e/0x130 [ 301.570051] do_exit+0x305/0xaf0 ...
--- arch/x86/mm/pat.c | 50 ++++++++++++++++++++++++++++++++++++-------------- mm/memory.c | 4 ++++ 2 files changed, 40 insertions(+), 14 deletions(-)
arch/x86/mm/pat.c +36 -14
@@ -33,6 +33,7 @@#include "pat_internal.h" #include "mm_internal.h" +#include "../../mm/internal.h" /* is_cow_mapping() */ #undef pr_fmt#define pr_fmt (fmt) "" fmt
@@ -954,6 +955,38 @@ static void free_pfn_range(u64 paddr, unfree_memtype (paddr, paddr + size); } +static int get_pat_info (struct vm_area_struct *vma,resource_size_t *paddr, +pgprot_t *pgprot) +{ +unsigned long prot; + +VM_WARN_ON_ONCE (!(vma->vm_flags &VM_PAT )); + +/* +* We need the starting PFN and cachemode used for track_pfn_remap() +* that covered the whole VMA. For most mappings, we can obtain that +* information from the page tables. For COW mappings, we might now +* suddenly have anon folios mapped and follow_phys() will fail. +* +* Fallback to using vma->vm_pgoff, see remap_pfn_range_notrack(), to +* detect the PFN. If we need the cachemode as well, we're out of luck +* for now and have to fail fork(). +*/ +if (!follow_phys (vma, vma->vm_start,0 , &prot, paddr)) { +if (pgprot) + *pgprot =__pgprot (prot); +return 0 ; + } +if (is_cow_mapping (vma->vm_flags)) { +if (pgprot) +return -EINVAL ; + *paddr = (resource_size_t )vma->vm_pgoff <<PAGE_SHIFT ; +return 0 ; + } +WARN_ON_ONCE (1 ); +return -EINVAL ; +} +/* * track_pfn_copy is called when vma that is covering the pfnmap gets * copied through copy_page_range().
@@ -964,20 +997,13 @@ static void free_pfn_range(u64 paddr, unint track_pfn_copy (struct vm_area_struct *vma) {resource_size_t paddr; -unsigned long prot;unsigned long vma_size = vma->vm_end - vma->vm_start;pgprot_t pgprot;if (vma->vm_flags &VM_PAT ) { -/* -* reserve the whole chunk covered by vma. We need the -* starting address and protection from pte. -*/ -if (follow_phys (vma, vma->vm_start,0 , &prot, &paddr)) { -WARN_ON_ONCE (1 ); +if (get_pat_info (vma, &paddr, &pgprot))return -EINVAL ; - } - pgprot =__pgprot (prot); +/* reserve the whole chunk covered by vma. */ return reserve_pfn_range (paddr, vma_size, &pgprot,1 ); }
@@ -1052,7 +1078,6 @@ void untrack_pfn(struct vm_area_struct * unsigned long size) {resource_size_t paddr; -unsigned long prot;if (vma && !(vma->vm_flags &VM_PAT ))return ;
@@ -1060,11 +1085,8 @@ void untrack_pfn(struct vm_area_struct */* free the chunk starting from pfn or the whole chunk */ paddr = (resource_size_t )pfn <<PAGE_SHIFT ;if (!paddr && !size) { -if (follow_phys (vma, vma->vm_start,0 , &prot, &paddr)) { -WARN_ON_ONCE (1 ); +if (get_pat_info (vma, &paddr,NULL ))return ; - } - size = vma->vm_end - vma->vm_start; }free_pfn_range (paddr, size);
mm/memory.c +4 -0
@@ -4612,6 +4612,10 @@ int follow_phys(struct vm_area_struct *v goto out; pte = *ptep; +/* Never return PFNs of anon folios in COW mappings. */ +if (vm_normal_page (vma, address, pte)) + goto unlock; +if ((flags &FOLL_WRITE ) && !pte_write (pte)) goto unlock;
Greg Kroah-Hartman
maintainerPATCH 161/175 Input: allocate keycode for Display refresh rate toggle
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gergo Koteles <[email protected]>
[ Upstream commit cfeb98b95fff25c442f78a6f616c627bc48a26b7 ]
Newer Lenovo Yogas and Legions with 60Hz/90Hz displays send a wmi event when Fn + R is pressed. This is intended for use to switch between the two refresh rates.
Allocate a new KEY_REFRESH_RATE_TOGGLE keycode for it.
--- include/uapi/linux/input-event-codes.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/input-event-codes.h +1 -0
@@ -596,6 +596,7 @@#define KEY_ALS_TOGGLE 0x230/* Ambient light sensor */ #define KEY_ROTATE_LOCK_TOGGLE 0x231/* Display rotation lock */ +#define KEY_REFRESH_RATE_TOGGLE 0x232/* Display refresh rate toggle */ #define KEY_BUTTONCONFIG 0x240/* AL Button Configuration */ #define KEY_TASKMANAGER 0x241/* AL Task/Project Manager */
Signature · 1 line
2.43.0
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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 Sat, 13 Apr 2024 09:53:55 +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/v4.x/stable-review/patch-4.19.312-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
The arm imx_v6_v7_defconfig build failed with gcc-12 and clang on Linux stable-rc linux-4.19.y.
Regressions:
- arm
* gcc-12-imx_v6_v7_defconfig - failed
Build log:
----drivers/gpu/drm/imx/parallel-display.c: In function 'imx_pd_bridge_atomic_check':drivers/gpu/drm/imx/parallel-display.c:222:23: error: implicit declaration of function 'drm_bridge_get_next_bridge' [-Werror=implicit-function-declaration]
222 | next_bridge = drm_bridge_get_next_bridge(bridge);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~Links:
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.311-176-gf0cf5f6110a7/testrun/23411280/suite/build/test/gcc-12-imx_v6_v7_defconfig/details/
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2ex1v6eevudbi33g4ozA7hJ4fvs/
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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 Sat, 13 Apr 2024 09:53:55 +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/v4.x/stable-review/patch-4.19.312-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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 Sat, 13 Apr 2024 09:53:55 +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/v4.x/stable-review/patch-4.19.312-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.19:
10 builds: 10 pass, 0 fail
20 boots: 20 pass, 0 fail
37 tests: 37 pass, 0 failLinux version: 4.19.312-rc1-gf0cf5f6110a7
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Jon
Greg Kroah-Hartman
maintainerQuoted 38 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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 Sat, 13 Apr 2024 09:53:55 +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/v4.x/stable-review/patch-4.19.312-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
The arm
imx_v6_v7_defconfigbuild failed with gcc-12 and clang on Linux stable-rc linux-4.19.y.Regressions:
- arm
* gcc-12-imx_v6_v7_defconfig - failedBuild log:
----drivers/gpu/drm/imx/parallel-display.c: In function 'imx_pd_bridge_atomic_check':drivers/gpu/drm/imx/parallel-display.c:222:23: error: implicit declaration of function 'drm_bridge_get_next_bridge' [-Werror=implicit-function-declaration]
Quoted 7 lines
222 | next_bridge = drm_bridge_get_next_bridge(bridge); | ^~~~~~~~~~~~~~~~~~~~~~~~~~Links:
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.311-176-gf0cf5f6110a7/testrun/23411280/suite/build/test/gcc-12-imx_v6_v7_defconfig/details/
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2ex1v6eevudbi33g4ozA7hJ4fvs/
Offending commit now dropped, thanks!
greg k-h
Hi Greg,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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 Sat, 13 Apr 2024 09:53:55 +0000. Anything received after that time might be too late.
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Harshit
Quoted 10 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.312-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Hi!
Quoted 7 lines
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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.
Martijn Coenen <[email protected]>
loop: Removesector_ttruncation checks
AFAICT, in 4.19, sector_t is not guaranteed to be u64, see include/linux/types.h. So we can't take this.
Quoted 2 lines
Thomas Gleixner <[email protected]>
timers: Move clearing ofbase::timer_runningunder base:: Lock
AFAICT, we don't have those NULL assignments in expire_timers in 4.19. Can someone doublecheck this? We also don't support PREEMPT_RT there.
Quoted 2 lines
Christophe JAILLET <[email protected]>
slimbus: core: Remove usage of the deprecatedida_simple_xx()API
AFAICT this is just a cleanup. We should not need this.
Quoted 2 lines
Sean Anderson <[email protected]>
soc: fsl: qbman: Use raw spinlock forcgr_lock
As we don't have commit ef2a8d5478b9 ("net: dpaa: Adjust queue depth on rate change") in 4.19, we should not really need this. Plus, 10msec under raw spinlock is quite evil, such kernel is not realtime any more. We should not be doing that.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 6 lines · Pavel Machek
Quoted 2 lines
Thomas Gleixner <[email protected]>
timers: Move clearing ofbase::timer_runningunder base:: LockAFAICT, we don't have those NULL assignments in
expire_timersin 4.19. Can someone doublecheck this? We also don't supportPREEMPT_RTthere.
This has nothing to do with RT.
But yes, 4.19 has the original bass::running_timer clearing which happens at the end of handling all expired timer callbacks and that actually happens with base->lock held.
So right, 4.19 is not affected by this.
Thanks,
tglx
Quoted 7 lines · Pavel Machek
Quoted 2 lines
Sean Anderson <[email protected]>
soc: fsl: qbman: Use raw spinlock forcgr_lockAs we don't have commit
ef2a8d5478b9("net: dpaa: Adjust queue depth on rate change") in 4.19, we should not really need this. Plus, 10msec under raw spinlock is quite evil, such kernel is not realtime any more. We should not be doing that.
Patches welcome :)
At some point I will try and revisit this.
--Sean
Re: *** SPAM *** Re: [PATCH 4.19 000/175] 4.19.312-rc1 review
In reply to Pavel MachekLe 12/04/2024 à 21:46, Pavel Machek a écrit :
Quoted 4 lines
Quoted 2 lines
Christophe JAILLET <[email protected]>
slimbus: core: Remove usage of the deprecatedida_simple_xx()APIAFAICT this is just a cleanup. We should not need this.
Not exactly.
As stated in the commit: "this change allows one more device. Previously address 0xFE was never used."
I don't use slimbus, so I'll let people with more knowledge than me about this driver decide if it should be backported or not, but from my point of view, it is a valid fix.
But, unless s.o. complained that this extra device address was needed in a RL scenario, I would say that the patch should not be backported, because: "better safe than sorry".
CJ
Quoted 6 lines · Sean Anderson
Quoted 5 lines · Pavel Machek
Quoted 2 lines
Sean Anderson <[email protected]>
soc: fsl: qbman: Use raw spinlock forcgr_lockAs we don't have commit
ef2a8d5478b9("net: dpaa: Adjust queue depth on rate change") in 4.19, we should not really need this.
Sorry, I missed this the first time around, but this bug will still occur (just much more rarely) without this commit.
--Sean
Quoted 9 lines
Plus, 10msec
Quoted 2 lines
under raw spinlock is quite evil, such kernel is not realtime any more. We should not be doing that.
Patches welcome :)
At some point I will try and revisit this.
--Sean
Greg Kroah-Hartman
maintainerQuoted 7 lines · Pavel Machek
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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.
Quoted 5 lines
Quoted 2 lines
Martijn Coenen <[email protected]>
loop: Removesector_ttruncation checksAFAICT, in 4.19,
sector_tis not guaranteed to be u64, seeinclude/linux/types.h. So we can't take this.
It's more helpful if you cc: the people on the commit that you are asking about, so that they can explain why they asked for it, or did the backport.
Genjian, any thoughts about this one?
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 8 lines · Thomas Gleixner
Quoted 6 lines · Pavel Machek
Quoted 2 lines
Thomas Gleixner <[email protected]>
timers: Move clearing ofbase::timer_runningunder base:: LockAFAICT, we don't have those NULL assignments in
expire_timersin 4.19. Can someone doublecheck this? We also don't supportPREEMPT_RTthere.
Quoted 7 lines
This has nothing to do with RT.
But yes, 4.19 has the original
bass::running_timerclearing which happens at the end of handling all expired timer callbacks and that actually happens withbase->lockheld.So right, 4.19 is not affected by this.
Now dropped, thanks.
greg k-h
Re: [PATCH 4.19 091/175] loop: Remove sector_t truncation checks
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martijn Coenen <[email protected]>
[ Upstream commit
083a6a50783ef54256eec3499e6575237e0e3d53]
sector_tis now always u64, so we don't need to check for truncation.
This needs to be reverted for 4.19, because sector_t wasn't always u64 until 5.2.
Ben.
Quoted 76 lines
Signed-off-by Martijn Coenen <[email protected]>Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Genjian Zhang <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/block/loop.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)drivers/block/loop.c +7
-14@@ -225,24 +225,20 @@ static void __loop_update_dio(struct looblk_mq_unfreeze_queue (lo->lo_queue); } -static int +static void figure_loop_size (struct loop_device *lo,loff_t offset,loff_t sizelimit) {loff_t size =get_size (offset, sizelimit, lo->lo_backing_file); -sector_t x = (sector_t )size;struct block_device *bdev = lo->lo_device; -if (unlikely ((loff_t )x != size)) -return -EFBIG ;if (lo->lo_offset != offset) lo->lo_offset = offset;if (lo->lo_sizelimit != sizelimit) lo->lo_sizelimit = sizelimit; -set_capacity (lo->lo_disk, x); +set_capacity (lo->lo_disk, size);bd_set_size (bdev, (loff_t )get_capacity (bdev->bd_disk) <<9 );/* let user-space know about the new size */ kobject_uevent (&disk_to_dev (bdev->bd_disk)->kobj,KOBJ_CHANGE ); -return 0 ; } static inline int@@ -972,10 +968,8 @@ static int loop_set_fd(struct loop_devic !file->f_op->write_iter) lo_flags |=LO_FLAGS_READ_ONLY ; - error = -EFBIG ; size =get_loop_size (lo, file); -if ((loff_t )(sector_t )size != size) - goto out_unlock; + error =loop_prepare_queue (lo);if (error) goto out_unlock;@@ -1280,10 +1274,7 @@ loop_set_status(struct loop_device *lo, lo->lo_device->bd_inode->i_mapping->nrpages); goto out_unfreeze; } -if (figure_loop_size (lo, info->lo_offset, info->lo_sizelimit)) { - err = -EFBIG ; - goto out_unfreeze; - } +figure_loop_size (lo, info->lo_offset, info->lo_sizelimit); }memcpy (lo->lo_file_name, info->lo_file_name,LO_NAME_SIZE );@@ -1486,7 +1477,9 @@ static int loop_set_capacity(struct loopif (unlikely (lo->lo_state != Lo_bound))return -ENXIO ; -return figure_loop_size (lo, lo->lo_offset, lo->lo_sizelimit); +figure_loop_size (lo, lo->lo_offset, lo->lo_sizelimit); + +return 0 ; }static int loop_set_dio (struct loop_device *lo,unsigned long arg)
Signature · 3 lines
Ben Hutchings
Everything should be made as simple as possible, but not simpler.
- Albert EinsteinGreg Kroah-Hartman
maintainerRe: [PATCH 4.19 091/175] loop: Remove sector_t truncation checks
Quoted 5 lines · Ben Hutchings
Quoted 4 lines · Greg Kroah-Hartman
4.19-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 8 lines
Quoted 5 lines
From: Martijn Coenen <[email protected]>
[ Upstream commit
083a6a50783ef54256eec3499e6575237e0e3d53]
sector_tis now always u64, so we don't need to check for truncation.This needs to be reverted for 4.19, because
sector_twasn't always u64 until 5.2.
Ah, ick. Ok, let me go revert all of these, that should also solve the build issue for Alpha that Guenter was reporting.
thanks for letting me know.
greg k-h
Re: [PATCH 4.19 091/175] loop: Remove sector_t truncation checks
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Ben Hutchings
Quoted 6 lines · Greg Kroah-Hartman
4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martijn Coenen <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[ Upstream commit
083a6a50783ef54256eec3499e6575237e0e3d53]
sector_tis now always u64, so we don't need to check for truncation.This needs to be reverted for 4.19, because
sector_twasn't always u64 until 5.2.Ah, ick. Ok, let me go revert all of these,
I don't think it's necessary to go that far. I'll send a patch to revert just this.
Quoted 1 line
that should also solve the build issue for Alpha that Guenter was reporting.
That's a separate issue, I think.
Quoted 1 line
thanks for letting me know.
Ben.
Signature · 3 lines
Ben Hutchings The Peter principle: In a hierarchy, every employee tends to rise to their level of incompetence.
PATCH 1/1 Revert "loop: Remove sector_t truncation checks"
This reverts commit f92a3b0d003b9f7eb1f452598966a08802183f47, which was commit 083a6a50783ef54256eec3499e6575237e0e3d53 upstream. In 4.19 there is still an option to use 32-bit sector_t on 32-bit architectures, so we need to keep checking for truncation.
Since loop_set_status() was refactored by subsequent patches, this reintroduces its truncation check in loop_set_status_from_info() instead.
I tested that the loop ioctl operations have the expected behaviour on x86_64, x86_32 with CONFIG_LBDAF=y, and (the special case) x86_32 with CONFIG_LBDAF=n.
--- drivers/block/loop.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/block/loop.c +15 -4
@@ -243,12 +243,16 @@ static void loop_set_size(struct loop_device *lo, loff_t size)kobject_uevent (&disk_to_dev (bdev->bd_disk)->kobj,KOBJ_CHANGE ); } -static void +static int figure_loop_size (struct loop_device *lo,loff_t offset,loff_t sizelimit) {loff_t size =get_size (offset, sizelimit, lo->lo_backing_file); +sector_t x = (sector_t )size; +if (unlikely ((loff_t )x != size)) +return -EFBIG ;loop_set_size (lo, size); +return 0 ; } static inline int
@@ -996,7 +1000,10 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, !file->f_op->write_iter) lo_flags |=LO_FLAGS_READ_ONLY ; + error = -EFBIG ; size =get_loop_size (lo, file); +if ((loff_t )(sector_t )size != size) + goto out_unlock; error =loop_prepare_queue (lo);if (error)
@@ -1246,6 +1253,7 @@ loop_set_status_from_info(struct loop_device *lo,int err;struct loop_func_table *xfer;kuid_t uid =current_uid (); +loff_t new_size;if ((unsigned int ) info->lo_encrypt_key_size >LO_KEY_SIZE )return -EINVAL ;
@@ -1273,6 +1281,11 @@ loop_set_status_from_info(struct loop_device *lo,if (info->lo_offset >LLONG_MAX || info->lo_sizelimit >LLONG_MAX )return -EOVERFLOW ; + new_size =get_size (info->lo_offset, info->lo_sizelimit, + lo->lo_backing_file); +if ((loff_t )(sector_t )new_size != new_size) +return -EFBIG ; + lo->lo_offset = info->lo_offset; lo->lo_sizelimit = info->lo_sizelimit;
@@ -1531,9 +1544,7 @@ static int loop_set_capacity(struct loop_device *lo)if (unlikely (lo->lo_state != Lo_bound))return -ENXIO ; -figure_loop_size (lo, lo->lo_offset, lo->lo_sizelimit); - -return 0 ; +return figure_loop_size (lo, lo->lo_offset, lo->lo_sizelimit); }static int loop_set_dio (struct loop_device *lo,unsigned long arg)
Quoted 18 lines · Pavel Machek
Quoted 7 lines
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.19.312 release. There are 175 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.
Quoted 5 lines
Quoted 2 lines
Martijn Coenen <[email protected]>
loop: Removesector_ttruncation checksAFAICT, in 4.19,
sector_tis not guaranteed to be u64, seeinclude/linux/types.h. So we can't take this.It's more helpful if you cc: the people on the commit that you are asking about, so that they can explain why they asked for it, or did the backport.
Quoted 5 lines
Genjian, any thoughts about this one?
thanks,
greg k-h
This one was aimed at resolving merge conflicts with subsequent patches and had no other reason. Indeed, this patch is not suitable for 4.19. I'm sorry for the omission.
thanks,
Genjian
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19] Revert "loop: Remove sector_t truncation checks"
In reply to Ben HutchingsQuoted 9 lines · Ben Hutchings
This reverts commit
f92a3b0d003b9f7eb1f452598966a08802183f47, which was commit083a6a50783ef54256eec3499e6575237e0e3d53upstream. In 4.19 there is still an option to use 32-bitsector_ton 32-bit architectures, so we need to keep checking for truncation.Since
loop_set_status()was refactored by subsequent patches, this reintroduces its truncation check inloop_set_status_from_info()instead.
Quoted 8 lines
I tested that the loop ioctl operations have the expected behaviour on
x86_64,x86_32withCONFIG_LBDAF=y, and (the special case)x86_32withCONFIG_LBDAF=n.Signed-off-by Ben Hutchings <[email protected]>--- drivers/block/loop.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
Thanks, both reverts now queued up.
greg k-h
Patch "Revert "loop: Remove sector_t truncation checks"" has been added to the 4.19-stable tree
In reply to Ben HutchingsThis is a note to let you know that I've just added the patch titled
Revert "loop: Remove sector_t truncation checks"
to the 4.19-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
revert-loop-remove-sector_t-truncation-checks.patch
and it can be found in the queue-4.19 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From [email protected] Tue Apr 30 09:49:44 2024
From: Ben Hutchings <[email protected]>
Date: Mon, 29 Apr 2024 23:40:53 +0200
Subject: Revert "loop: Remove sector_t truncation checks"
To: Greg Kroah-Hartman <[email protected]>
Cc: [email protected], [email protected], Martijn Coenen <[email protected]>, Christoph Hellwig <[email protected]>, Jens Axboe <[email protected]>, Genjian Zhang <[email protected]>
Message-ID: <[email protected]>
Content-Disposition: inline
From: Ben Hutchings <[email protected]>
This reverts commit f92a3b0d003b9f7eb1f452598966a08802183f47, which was commit 083a6a50783ef54256eec3499e6575237e0e3d53 upstream. In 4.19 there is still an option to use 32-bit sector_t on 32-bit architectures, so we need to keep checking for truncation.
Since loop_set_status() was refactored by subsequent patches, this reintroduces its truncation check in loop_set_status_from_info() instead.
I tested that the loop ioctl operations have the expected behaviour on x86_64, x86_32 with CONFIG_LBDAF=y, and (the special case) x86_32 with CONFIG_LBDAF=n.
--- drivers/block/loop.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/block/loop.c +15 -4
@@ -243,12 +243,16 @@ static void loop_set_size(struct loop_dekobject_uevent (&disk_to_dev (bdev->bd_disk)->kobj,KOBJ_CHANGE ); } -static void +static int figure_loop_size (struct loop_device *lo,loff_t offset,loff_t sizelimit) {loff_t size =get_size (offset, sizelimit, lo->lo_backing_file); +sector_t x = (sector_t )size; +if (unlikely ((loff_t )x != size)) +return -EFBIG ;loop_set_size (lo, size); +return 0 ; } static inline int
@@ -996,7 +1000,10 @@ static int loop_set_fd(struct loop_devic !file->f_op->write_iter) lo_flags |=LO_FLAGS_READ_ONLY ; + error = -EFBIG ; size =get_loop_size (lo, file); +if ((loff_t )(sector_t )size != size) + goto out_unlock; error =loop_prepare_queue (lo);if (error)
@@ -1246,6 +1253,7 @@ loop_set_status_from_info(struct loop_deint err;struct loop_func_table *xfer;kuid_t uid =current_uid (); +loff_t new_size;if ((unsigned int ) info->lo_encrypt_key_size >LO_KEY_SIZE )return -EINVAL ;
@@ -1273,6 +1281,11 @@ loop_set_status_from_info(struct loop_deif (info->lo_offset >LLONG_MAX || info->lo_sizelimit >LLONG_MAX )return -EOVERFLOW ; + new_size =get_size (info->lo_offset, info->lo_sizelimit, + lo->lo_backing_file); +if ((loff_t )(sector_t )new_size != new_size) +return -EFBIG ; + lo->lo_offset = info->lo_offset; lo->lo_sizelimit = info->lo_sizelimit;
@@ -1531,9 +1544,7 @@ static int loop_set_capacity(struct loopif (unlikely (lo->lo_state != Lo_bound))return -ENXIO ; -figure_loop_size (lo, lo->lo_offset, lo->lo_sizelimit); - -return 0 ; +return figure_loop_size (lo, lo->lo_offset, lo->lo_sizelimit); }static int loop_set_dio (struct loop_device *lo,unsigned long arg)
Patches currently in stable-queue which might be from [email protected] are
queue-4.19/revert-loop-remove-sector_t-truncation-checks.patch queue-4.19/revert-y2038-rusage-use-__kernel_old_timeval.patch