5.15.86-rc1 review
Subsystems (11)
Greg Kroah-Hartman
maintainerPATCH 600/731 igc: Set Qbv start_time and end_time to end_time if not being configured in GCL
In reply to Greg Kroah-HartmanFrom: Tan Tee Min <[email protected]>
[ Upstream commit 72abeedd83982c1bc6023f631e412db78374d9b4 ]
The default setting of end_time minus start_time is whole 1 second. Thus, if it's not being configured in any GCL entry then it will be staying at original 1 second.
This patch is changing the start_time and end_time to be end_time as if setting zero will be having weird HW behavior where the gate will not be fully closed.
--- drivers/net/ethernet/intel/igc/igc_main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_main.c +13 -1
@@ -5987,6 +5987,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,bool queue_configured[IGC_MAX_TX_QUEUES ] = { };u32 start_time =0 , end_time =0 ;size_t n; +int i; adapter->qbv_enable = qopt->enable;
@@ -6007,7 +6008,6 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,for (n =0 ; n < qopt->num_entries; n++) {struct tc_taprio_sched_entry *e = &qopt->entries[n]; -int i; end_time += e->interval;
@@ -6046,6 +6046,18 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter, start_time += e->interval; } +/* Check whether a queue gets configured. +* If not, set the start and end time to be end time. +*/ +for (i =0 ; i < adapter->num_tx_queues; i++) { +if (!queue_configured[i]) { +struct igc_ring *ring = adapter->tx_ring[i]; + + ring->start_time = end_time; + ring->end_time = end_time; + } + } +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 601/731 rtc: mxc_v2: Add missing clk_disable_unprepare()
In reply to Greg Kroah-HartmanFrom: GUO Zihua <[email protected]>
[ Upstream commit 55d5a86618d3b1a768bce01882b74cbbd2651975 ]
The call to clk_disable_unprepare() is left out in the error handling of devm_rtc_allocate_device. Add it back.
--- drivers/rtc/rtc-mxc_v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/rtc/rtc-mxc_v2.c +3 -1
@@ -336,8 +336,10 @@ static int mxc_rtc_probe(struct platform_device *pdev) } pdata->rtc =devm_rtc_allocate_device (&pdev->dev); -if (IS_ERR (pdata->rtc)) +if (IS_ERR (pdata->rtc)) { +clk_disable_unprepare (pdata->clk);return PTR_ERR (pdata->rtc); + } pdata->rtc->ops = &mxc_rtc_ops; pdata->rtc->range_max =U32_MAX ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 602/731 selftests: devlink: fix the fd redirect in dummy_reporter_test
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 2fc60e2ff972d3dca836bff0b08cbe503c4ca1ce ]
$number + > bash means redirect FD $number, e.g. commonly used 2> redirects stderr (fd 2). The test uses 8192> to write the number 8192 to a file, this results in:
./devlink.sh: line 499: 8192: Bad file descriptor
Oddly the test also papers over this issue by checking for failure (expecting an error rather than success) so it passes, anyway.
--- tools/testing/selftests/drivers/net/netdevsim/devlink.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/drivers/net/netdevsim/devlink.sh +2 -2
@@ -496,8 +496,8 @@ dummy_reporter_test() check_reporter_info dummy healthy 3 3 10 true - echo 8192> $DEBUGFS_DIR/health/binary_len - check_fail $? "Failed set dummy reporter binary len to 8192" + echo 8192 > $DEBUGFS_DIR/health/binary_len + check_err $? "Failed set dummy reporter binary len to 8192" local dump=$(devlink health dump show $DL_HANDLE reporter dummy -j) check_err $? "Failed show dump of dummy reporter"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 603/731 openvswitch: Fix flow lookup to use unmasked key
In reply to Greg Kroah-HartmanFrom: Eelco Chaudron <[email protected]>
[ Upstream commit 68bb10101e6b0a6bb44e9c908ef795fc4af99eae ]
The commit mentioned below causes the ovs_flow_tbl_lookup() function to be called with the masked key. However, it's supposed to be called with the unmasked key. This due to the fact that the datapath supports installing wider flows, and OVS relies on this behavior. For example if ipv4(src=1.1.1.1/192.0.0.0, dst=1.1.1.2/192.0.0.0) exists, a wider flow (smaller mask) of ipv4(src=192.1.1.1/128.0.0.0,dst=192.1.1.2/ 128.0.0.0) is allowed to be added.
However, if we try to add a wildcard rule, the installation fails:
$ ovs-appctl dpctl/add-flow system@myDP "in_port(1),eth_type(0x0800), \ ipv4(src=1.1.1.1/192.0.0.0,dst=1.1.1.2/192.0.0.0,frag=no)" 2 $ ovs-appctl dpctl/add-flow system@myDP "in_port(1),eth_type(0x0800), \ ipv4(src=192.1.1.1/0.0.0.0,dst=49.1.1.2/0.0.0.0,frag=no)" 2 ovs-vswitchd: updating flow table (File exists)
The reason is that the key used to determine if the flow is already present in the system uses the original key ANDed with the mask. This results in the IP address not being part of the (miniflow) key, i.e., being substituted with an all-zero value. When doing the actual lookup, this results in the key wrongfully matching the first flow, and therefore the flow does not get installed.
This change reverses the commit below, but rather than having the key on the stack, it's allocated.
--- net/openvswitch/datapath.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
net/openvswitch/datapath.c +16 -9
@@ -946,6 +946,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)struct sw_flow_mask mask;struct sk_buff *reply;struct datapath *dp; +struct sw_flow_key *key;struct sw_flow_actions *acts;struct sw_flow_match match;u32 ufid_flags =ovs_nla_get_ufid_flags (a[OVS_FLOW_ATTR_UFID_FLAGS ]);
@@ -973,24 +974,26 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info) }/* Extract key. */ -ovs_match_init (&match, &new_flow->key, false, &mask); + key =kzalloc (sizeof (*key),GFP_KERNEL ); +if (!key) { + error = -ENOMEM ; + goto err_kfree_key; + } + +ovs_match_init (&match, key, false, &mask); error =ovs_nla_get_match (net, &match, a[OVS_FLOW_ATTR_KEY ], a[OVS_FLOW_ATTR_MASK ], log);if (error) goto err_kfree_flow; +ovs_flow_mask_key (&new_flow->key, key, true, &mask); +/* Extract flow identifier. */ error =ovs_nla_get_identifier (&new_flow->id, a[OVS_FLOW_ATTR_UFID ], - &new_flow->key, log); + key, log);if (error) goto err_kfree_flow; -/* unmasked key is needed to match when ufid is not used. */ -if (ovs_identifier_is_key (&new_flow->id)) - match.key = new_flow->id.unmasked_key; - -ovs_flow_mask_key (&new_flow->key, &new_flow->key, true, &mask); -/* Validate actions. */ error =ovs_nla_copy_actions (net, a[OVS_FLOW_ATTR_ACTIONS ], &new_flow->key, &acts, log);
@@ -1017,7 +1020,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)if (ovs_identifier_is_ufid (&new_flow->id)) flow =ovs_flow_tbl_lookup_ufid (&dp->table, &new_flow->id);if (!flow) - flow =ovs_flow_tbl_lookup (&dp->table, &new_flow->key); + flow =ovs_flow_tbl_lookup (&dp->table, key);if (likely (!flow)) {rcu_assign_pointer (new_flow->sf_acts, acts);
@@ -1087,6 +1090,8 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)if (reply)ovs_notify (&dp_flow_genl_family, reply, info); + +kfree (key);return 0 ; err_unlock_ovs:
@@ -1096,6 +1101,8 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)ovs_nla_free_flow_actions (acts); err_kfree_flow:ovs_flow_free (new_flow, false); +err_kfree_key: +kfree (key); error:return error; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 604/731 soc: mediatek: pm-domains: Fix the power glitch issue
In reply to Greg Kroah-HartmanFrom: Chun-Jie Chen <[email protected]>
[ Upstream commit dba8eb83af9dd757ef645b52200775e86883d858 ]
Power reset maybe generate unexpected signal. In order to avoid the glitch issue, we need to enable isolation first to guarantee the stable signal when power reset is triggered.
--- drivers/soc/mediatek/mtk-pm-domains.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/mediatek/mtk-pm-domains.c +1 -1
@@ -272,9 +272,9 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)clk_bulk_disable_unprepare (pd->num_subsys_clks, pd->subsys_clks);/* subsys power off */ -regmap_clear_bits (scpsys->base, pd->data->ctl_offs,PWR_RST_B_BIT );regmap_set_bits (scpsys->base, pd->data->ctl_offs,PWR_ISO_BIT );regmap_set_bits (scpsys->base, pd->data->ctl_offs,PWR_CLK_DIS_BIT ); +regmap_clear_bits (scpsys->base, pd->data->ctl_offs,PWR_RST_B_BIT );regmap_clear_bits (scpsys->base, pd->data->ctl_offs,PWR_ON_2ND_BIT );regmap_clear_bits (scpsys->base, pd->data->ctl_offs,PWR_ON_BIT );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 605/731 arm64: dts: mt8183: Fix Mali GPU clock
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit ad2631b5645a1d0ca9bf6fecf71f77e3b0071ee5 ]
The actual clock feeding into the Mali GPU on the MT8183 is from the clock gate in the MFGCFG block, not CLK_TOP_MFGPLL_CK from the TOPCKGEN block, which itself is simply a pass-through placeholder for the MFGPLL in the APMIXEDSYS block.
Fix the hardware description with the correct clock reference.
--- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt8183.dtsi +1 -1
@@ -1212,7 +1212,7 @@ gpu: gpu@13040000 { <GIC_SPI 278 IRQ_TYPE_LEVEL_LOW>; interrupt-names = "job", "mmu", "gpu"; - clocks = <&topckgen CLK_TOP_MFGPLL_CK>; + clocks = <&mfgcfg CLK_MFG_BG3D>; power-domains = <&spm MT8183_POWER_DOMAIN_MFG_CORE0>,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 606/731 skbuff: Account for tail adjustment during pull operations
In reply to Greg Kroah-HartmanFrom: Subash Abhinov Kasiviswanathan <[email protected]>
[ Upstream commit 2d7afdcbc9d32423f177ee12b7c93783aea338fb ]
Extending the tail can have some unexpected side effects if a program uses a helper like BPF_FUNC_skb_pull_data to read partial content beyond the head skb headlen when all the skbs in the gso frag_list are linear with no head_frag -
kernel BUG at net/core/skbuff.c:4219!
pc : skb_segment+0xcf4/0xd2c lr : skb_segment+0x63c/0xd2c Call trace: skb_segment+0xcf4/0xd2c __udp_gso_segment+0xa4/0x544 udp4_ufo_fragment+0x184/0x1c0 inet_gso_segment+0x16c/0x3a4 skb_mac_gso_segment+0xd4/0x1b0 __skb_gso_segment+0xcc/0x12c udp_rcv_segment+0x54/0x16c udp_queue_rcv_skb+0x78/0x144 udp_unicast_rcv_skb+0x8c/0xa4 __udp4_lib_rcv+0x490/0x68c udp_rcv+0x20/0x30 ip_protocol_deliver_rcu+0x1b0/0x33c ip_local_deliver+0xd8/0x1f0 ip_rcv+0x98/0x1a4 deliver_ptype_list_skb+0x98/0x1ec __netif_receive_skb_core+0x978/0xc60
Fix this by marking these skbs as GSO_DODGY so segmentation can handle the tail updates accordingly.
--- net/core/skbuff.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/skbuff.c +3 -0
@@ -2263,6 +2263,9 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta) insp = list; }else {/* Eaten partially. */ +if (skb_is_gso (skb) && !list->head_frag && +skb_headlen (list)) +skb_shinfo (skb)->gso_type |=SKB_GSO_DODGY ;if (skb_shared (list)) {/* Sucks! We need to fork list. :-( */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 607/731 mailbox: mpfs: read the system controllers status
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit ab47d0bfdf88faac0eb02749e5bfaa306e004300 ]
Some services explicitly return an error code in their response, but others rely on the system controller to set a status in its status register. The meaning of the bits varies based on what service is requested, so pass it back up to the driver that requested the service in the first place. The field in the message struct already existed, but was unused until now.
If the system controller is busy, in which case we should never actually be in the interrupt handler, or if the service fails the mailbox itself should not be read. Callers should check the status before operating on the response.
There's an existing, but unused, #define for the mailbox mask - but it was incorrect. It was doing a GENMASK_ULL(32, 16) which should've just been a GENMASK(31, 16), so fix that up and start using it.
--- drivers/mailbox/mailbox-mpfs.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
drivers/mailbox/mailbox-mpfs.c +28 -3
@@ -2,7 +2,7 @@/* * Microchip PolarFire SoC (MPFS) system controller/mailbox controller driver * -* Copyright (c) 2020 Microchip Corporation. All rights reserved. +* Copyright (c) 2020-2022 Microchip Corporation. All rights reserved. * * Author: Conor Dooley <[email protected]> *
@@ -56,7 +56,7 @@#define SCB_STATUS_NOTIFY_MASK BIT(SCB_STATUS_NOTIFY)#define SCB_STATUS_POS (16) -#define SCB_STATUS_MASK GENMASK_ULL(SCB_STATUS_POS + SCB_MASK_WIDTH, SCB_STATUS_POS) +#define SCB_STATUS_MASK GENMASK(SCB_STATUS_POS + SCB_MASK_WIDTH - 1, SCB_STATUS_POS)struct mpfs_mbox {struct mbox_controller controller;
@@ -130,13 +130,38 @@ static void mpfs_mbox_rx_data(struct mbox_chan *chan)struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv;struct mpfs_mss_response *response = mbox->response;u16 num_words =ALIGN ((response->resp_size), (4 )) /4U ; -u32 i; +u32 i, status;if (!response->resp_msg) {dev_err (mbox->dev,"failed to assign memory for response %d\n" , -ENOMEM );return ; } +/* +* The status is stored in bits 31:16 of the SERVICES_SR register. +* It is only valid when BUSY == 0. +* We should *never* get an interrupt while the controller is +* still in the busy state. If we do, something has gone badly +* wrong & the content of the mailbox would not be valid. +*/ +if (mpfs_mbox_busy (mbox)) { +dev_err (mbox->dev,"got an interrupt but system controller is busy\n" ); + response->resp_status =0xDEAD ; +return ; + } + + status =readl_relaxed (mbox->ctrl_base +SERVICES_SR_OFFSET ); + +/* +* If the status of the individual servers is non-zero, the service has +* failed. The contents of the mailbox at this point are not be valid, +* so don't bother reading them. Set the status so that the driver +* implementing the service can handle the result. +*/ + response->resp_status = (status &SCB_STATUS_MASK ) >>SCB_STATUS_POS ; +if (response->resp_status) +return ; +if (!mpfs_mbox_busy (mbox)) {for (i =0 ; i < num_words; i++) { response->resp_msg[i] =
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 608/731 mailbox: arm_mhuv2: Fix return value check in mhuv2_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 165b7643f2df890066b1b4e8a387888a600ca9bf ]
If devm_of_iomap() fails, it returns ERR_PTR() and never return NULL, so replace NULL pointer check with IS_ERR() to fix this problem.
--- drivers/mailbox/arm_mhuv2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mailbox/arm_mhuv2.c +2 -2
@@ -1061,8 +1061,8 @@ static int mhuv2_probe(struct amba_device *adev, const struct amba_id *id)int ret = -EINVAL ; reg =devm_of_iomap (dev, dev->of_node,0 ,NULL ); -if (!reg) -return -ENOMEM ; +if (IS_ERR (reg)) +return PTR_ERR (reg); mhu =devm_kzalloc (dev,sizeof (*mhu),GFP_KERNEL );if (!mhu)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 609/731 mailbox: zynq-ipi: fix error handling while device_register() fails
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit a6792a0cdef0b1c2d77920246283a72537e60e94 ]
If device_register() fails, it has two issues:
1. The name allocated by dev_set_name() is leaked.
2. The parent of device is not NULL, device_unregister() is called in zynqmp_ipi_free_mboxes(), it will lead a kernel crash because of removing not added device.
Call put_device() to give up the reference, so the name is freed in kobject_cleanup(). Add device registered check in zynqmp_ipi_free_mboxes() to avoid null-ptr-deref.
--- drivers/mailbox/zynqmp-ipi-mailbox.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mailbox/zynqmp-ipi-mailbox.c +3 -1
@@ -493,6 +493,7 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, ret =device_register (&ipi_mbox->dev);if (ret) {dev_err (dev,"Failed to register ipi mbox dev.\n" ); +put_device (&ipi_mbox->dev);return ret; } mdev = &ipi_mbox->dev;
@@ -619,7 +620,8 @@ static void zynqmp_ipi_free_mboxes(struct zynqmp_ipi_pdata *pdata) ipi_mbox = &pdata->ipi_mboxes[i];if (ipi_mbox->dev.parent) {mbox_controller_unregister (&ipi_mbox->mbox); -device_unregister (&ipi_mbox->dev); +if (device_is_registered (&ipi_mbox->dev)) +device_unregister (&ipi_mbox->dev); } } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 610/731 net_sched: reject TCF_EM_SIMPLE case for complex ematch module
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
[ Upstream commit 9cd3fd2054c3b3055163accbf2f31a4426f10317 ]
When TCF_EM_SIMPLE was introduced, it is supposed to be convenient for ematch implementation:
https://lore.kernel.org/all/[email protected]/
"You don't have to, providing a 32bit data chunk without TCF_EM_SIMPLE set will simply result in allocating & copy. It's an optimization, nothing more."
So if an ematch module provides ops->datalen that means it wants a complex data structure (saved in its em->data) instead of a simple u32 value. We should simply reject such a combination, otherwise this u32 could be misinterpreted as a pointer.
--- net/sched/ematch.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/ematch.c +2 -0
@@ -255,6 +255,8 @@ static int tcf_em_validate(struct tcf_proto *tp,* the value carried. */ if (em_hdr->flags &TCF_EM_SIMPLE ) { +if (em->ops->datalen >0 ) + goto errout;if (data_len <sizeof (u32)) goto errout; em->data = *(u32 *) data;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 611/731 rxrpc: Fix missing unlock in rxrpc_do_sendmsg()
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 4feb2c44629e6f9b459b41a5a60491069d346a95 ]
One of the error paths in rxrpc_do_sendmsg() doesn't unlock the call mutex before returning. Fix it to do this.
Note that this still doesn't get rid of the checker warning:
../net/rxrpc/sendmsg.c:617:5: warning: context imbalance in 'rxrpc_do_sendmsg' - wrong count at exit
I think the interplay between the socket lock and the call's user_mutex may be too complicated for checker to analyse, especially as rxrpc_new_client_call_for_sendmsg(), which it calls, returns with the call's user_mutex if successful but unconditionally drops the socket lock.
--- net/rxrpc/sendmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/sendmsg.c +1 -1
@@ -716,7 +716,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)if (call->tx_total_len !=-1 || call->tx_pending || call->tx_top !=0 ) - goto error_put; + goto out_put_unlock; call->tx_total_len = p.call.tx_total_len; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 612/731 myri10ge: Fix an error handling path in myri10ge_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d83b950d44d2982c0e62e3d81b0f35ab09431008 ]
Some memory allocated in myri10ge_probe_slices() is not released in the error handling path of myri10ge_probe().
Add the corresponding kfree(), as already done in the remove function.
--- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/myricom/myri10ge/myri10ge.c +1 -0
@@ -3923,6 +3923,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)myri10ge_free_slices (mgp); abort_with_firmware: +kfree (mgp->msix_vectors);myri10ge_dummy_rdma (mgp,0 ); abort_with_ioremap:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 613/731 net: stream: purge sk_error_queue in sk_stream_kill_queues()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit e0c8bccd40fc1c19e1d246c39bcf79e357e1ada3 ]
Changheon Lee reported TCP socket leaks, with a nice repro.
It seems we leak TCP sockets with the following sequence:
1) SOF_TIMESTAMPING_TX_ACK is enabled on the socket.
Each ACK will cook an skb put in error queue, from __skb_tstamp_tx(). __skb_tstamp_tx() is using skb_clone(), unless SOF_TIMESTAMPING_OPT_TSONLY was also requested.
2) If the application is also using MSG_ZEROCOPY, then we put in the error queue cloned skbs that had a struct ubuf_info attached to them.
Whenever an struct ubuf_info is allocated, sock_zerocopy_alloc() does a sock_hold().
As long as the cloned skbs are still in sk_error_queue, socket refcount is kept elevated.
3) Application closes the socket, while error queue is not empty.
Since tcp_close() no longer purges the socket error queue, we might end up with a TCP socket with at least one skb in error queue keeping the socket alive forever.
This bug can be (ab)used to consume all kernel memory and freeze the host.
We need to purge the error queue, with proper synchronization against concurrent writers.
--- net/core/stream.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/core/stream.c +6 -0
@@ -196,6 +196,12 @@ void sk_stream_kill_queues(struct sock *sk)/* First the read buffer. */ __skb_queue_purge (&sk->sk_receive_queue); +/* Next, the error queue. +* We need to use queue lock, because other threads might +* add packets to the queue without socket lock being held. +*/ +skb_queue_purge (&sk->sk_error_queue); +/* Next, the write queue. */ WARN_ON (!skb_queue_empty (&sk->sk_write_queue));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 614/731 HID: amd_sfh: Add missing check for dma_alloc_coherent
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 53ffa6a9f83b2170c60591da1ead8791d5a42e81 ]
Add check for the return value of the dma_alloc_coherent since it may return NULL pointer if allocation fails.
--- drivers/hid/amd-sfh-hid/amd_sfh_client.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hid/amd-sfh-hid/amd_sfh_client.c +4 -0
@@ -166,6 +166,10 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) in_data->sensor_virt_addr[i] =dma_alloc_coherent (dev,sizeof (int ) *8 , &cl_data->sensor_dma_addr[i],GFP_KERNEL ); +if (!in_data->sensor_virt_addr[i]) { + rc = -ENOMEM ; + goto cleanup; + } cl_data->sensor_sts[i] =SENSOR_DISABLED ; cl_data->sensor_requested_cnt[i] =0 ; cl_data->cur_hid_dev = i;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 615/731 rcu: Fix __this_cpu_read() lockdep warning in rcu_force_quiescent_state()
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
[ Upstream commit ceb1c8c9b8aa9199da46a0f29d2d5f08d9b44c15 ]
Running rcutorture with non-zero fqs_duration module parameter in a kernel built with CONFIG_PREEMPTION=y results in the following splat:
BUG: using __this_cpu_read() in preemptible [00000000] code: rcu_torture_fqs/398 caller is __this_cpu_preempt_check+0x13/0x20 CPU: 3 PID: 398 Comm: rcu_torture_fqs Not tainted 6.0.0-rc1-yoctodev-standard+ Call Trace: <TASK> dump_stack_lvl+0x5b/0x86 dump_stack+0x10/0x16 check_preemption_disabled+0xe5/0xf0 __this_cpu_preempt_check+0x13/0x20 rcu_force_quiescent_state.part.0+0x1c/0x170 rcu_force_quiescent_state+0x1e/0x30 rcu_torture_fqs+0xca/0x160 ? rcu_torture_boost+0x430/0x430 kthread+0x192/0x1d0 ? kthread_complete_and_exit+0x30/0x30 ret_from_fork+0x22/0x30 </TASK>
The problem is that rcu_force_quiescent_state() uses __this_cpu_read() in preemptible code instead of the proper raw_cpu_read(). This commit therefore changes __this_cpu_read() to raw_cpu_read().
--- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
@@ -2674,7 +2674,7 @@ void rcu_force_quiescent_state(void)struct rcu_node *rnp_old =NULL ;/* Funnel through hierarchy to reduce memory contention. */ - rnp =__this_cpu_read (rcu_data.mynode); + rnp =raw_cpu_read (rcu_data.mynode);for (; rnp !=NULL ; rnp = rnp->parent) { ret = (READ_ONCE (rcu_state.gp_flags) &RCU_GP_FLAG_FQS ) || !raw_spin_trylock (&rnp->fqslock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 616/731 arm64: make is_ttbrX_addr() noinstr-safe
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit d8c1d798a2e5091128c391c6dadcc9be334af3f5 ]
We use is_ttbr0_addr() in noinstr code, but as it's only marked as inline, it's theoretically possible for the compiler to place it out-of-line and instrument it, which would be problematic.
Mark is_ttbr0_addr() as __always_inline such that that can safely be used from noinstr code. For consistency, do the same to is_ttbr1_addr(). Note that while is_ttbr1_addr() calls arch_kasan_reset_tag(), this is a macro (and its callees are either macros or __always_inline), so there is not a risk of transient instrumentation.
--- arch/arm64/include/asm/processor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/processor.h +2 -2
@@ -240,13 +240,13 @@ static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc, }#endif -static inline bool is_ttbr0_addr (unsigned long addr) +static __always_inline bool is_ttbr0_addr(unsigned long addr) {/* entry assembly clears tags for TTBR0 addrs */ return addr <TASK_SIZE ; } -static inline bool is_ttbr1_addr (unsigned long addr) +static __always_inline bool is_ttbr1_addr(unsigned long addr) {/* TTBR1 addresses may have a tag if KASAN_SW_TAGS is in use */ return arch_kasan_reset_tag (addr) >=PAGE_OFFSET ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 617/731 video: hyperv_fb: Avoid taking busy spinlock on panic path
In reply to Greg Kroah-HartmanFrom: Guilherme G. Piccoli <[email protected]>
[ Upstream commit 1d044ca035dc22df0d3b39e56f2881071d9118bd ]
The Hyper-V framebuffer code registers a panic notifier in order to try updating its fbdev if the kernel crashed. The notifier callback is straightforward, but it calls the vmbus_sendpacket() routine eventually, and such function takes a spinlock for the ring buffer operations.
Panic path runs in atomic context, with local interrupts and preemption disabled, and all secondary CPUs shutdown. That said, taking a spinlock might cause a lockup if a secondary CPU was disabled with such lock taken. Fix it here by checking if the ring buffer spinlock is busy on Hyper-V framebuffer panic notifier; if so, bail-out avoiding the potential lockup scenario.
--- drivers/hv/ring_buffer.c | 13 +++++++++++++ drivers/video/fbdev/hyperv_fb.c | 8 +++++++- include/linux/hyperv.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-)
drivers/hv/ring_buffer.c +13 -0
@@ -249,6 +249,19 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info) ring_info->pkt_buffer_size =0 ; } +/* +* Check if the ring buffer spinlock is available to take or not; used on +* atomic contexts, like panic path (see the Hyper-V framebuffer driver). +*/ + +bool hv_ringbuffer_spinlock_busy (struct vmbus_channel *channel) +{ +struct hv_ring_buffer_info *rinfo = &channel->outbound; + +return spin_is_locked (&rinfo->ring_lock); +} +EXPORT_SYMBOL_GPL (hv_ringbuffer_spinlock_busy); +/* Write to the ring buffer. */ int hv_ringbuffer_write(struct vmbus_channel *channel, const struct kvec *kv_list, u32 kv_count,
drivers/video/fbdev/hyperv_fb.c +7 -1
@@ -799,12 +799,18 @@ static void hvfb_ondemand_refresh_throttle(struct hvfb_par *par,static int hvfb_on_panic (struct notifier_block *nb,unsigned long e,void *p) { +struct hv_device *hdev;struct hvfb_par *par;struct fb_info *info; par = container_of(nb, struct hvfb_par, hvfb_panic_nb); - par->synchronous_fb = true; info = par->info; + hdev =device_to_hv_device (info->device); + +if (hv_ringbuffer_spinlock_busy (hdev->channel)) +return NOTIFY_DONE ; + + par->synchronous_fb = true;if (par->need_docopy)hvfb_docopy (par,0 , dio_fb_size);synthvid_update (info,0 ,0 ,INT_MAX ,INT_MAX );
include/linux/hyperv.h +2 -0
@@ -1307,6 +1307,8 @@ struct hv_ring_buffer_debug_info {int hv_ringbuffer_get_debuginfo (struct hv_ring_buffer_info *ring_info,struct hv_ring_buffer_debug_info *debug_info); +bool hv_ringbuffer_spinlock_busy (struct vmbus_channel *channel); +/* Vmbus interface */ #define vmbus_driver_register (driver) \ __vmbus_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 618/731 x86/hyperv: Remove unregister syscore call from Hyper-V cleanup
In reply to Greg Kroah-HartmanFrom: Gaurav Kohli <[email protected]>
[ Upstream commit 32c97d980e2eef25465d453f2956a9ca68926a3c ]
Hyper-V cleanup code comes under panic path where preemption and irq is already disabled. So calling of unregister_syscore_ops might schedule out the thread even for the case where mutex lock is free. hyperv_cleanup
unregister_syscore_ops
mutex_lock(&syscore_ops_lock)
might_sleep
Here might_sleep might schedule out this thread, where voluntary preemption config is on and this thread will never comes back. And also this was added earlier to maintain the symmetry which is not required as this can comes during crash shutdown path only.
To prevent the same, removing unregister_syscore_ops function call.
--- arch/x86/hyperv/hv_init.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/hyperv/hv_init.c +0 -2
@@ -469,8 +469,6 @@ void hyperv_cleanup(void) {union hv_x64_msr_hypercall_contents hypercall_msr; -unregister_syscore_ops (&hv_syscore_ops); -/* Reset our OS id */ wrmsrl (HV_X64_MSR_GUEST_OS_ID ,0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 619/731 binfmt_misc: fix shift-out-of-bounds in check_special_flags
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
[ Upstream commit 6a46bf558803dd2b959ca7435a5c143efe837217 ]
UBSAN reported a shift-out-of-bounds warning:
left shift of 1 by 31 places cannot be represented in type 'int'
Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x8d/0xcf lib/dump_stack.c:106 ubsan_epilogue+0xa/0x44 lib/ubsan.c:151 __ubsan_handle_shift_out_of_bounds+0x1e7/0x208 lib/ubsan.c:322 check_special_flags fs/binfmt_misc.c:241 [inline] create_entry fs/binfmt_misc.c:456 [inline] bm_register_write+0x9d3/0xa20 fs/binfmt_misc.c:654 vfs_write+0x11e/0x580 fs/read_write.c:582 ksys_write+0xcf/0x120 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x34/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x4194e1
Since the type of Node's flags is unsigned long, we should define these macros with same type too.
--- fs/binfmt_misc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/binfmt_misc.c +4 -4
@@ -44,10 +44,10 @@ static LIST_HEAD(entries);static int enabled =1 ;enum {Enabled, Magic}; -#define MISC_FMT_PRESERVE_ARGV0 (1 << 31) -#define MISC_FMT_OPEN_BINARY (1 << 30) -#define MISC_FMT_CREDENTIALS (1 << 29) -#define MISC_FMT_OPEN_FILE (1 << 28) +#define MISC_FMT_PRESERVE_ARGV0 (1UL << 31) +#define MISC_FMT_OPEN_BINARY (1UL << 30) +#define MISC_FMT_CREDENTIALS (1UL << 29) +#define MISC_FMT_OPEN_FILE (1UL << 28) typedef struct { struct list_head list;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 620/731 fs: jfs: fix shift-out-of-bounds in dbAllocAG
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit 898f706695682b9954f280d95e49fa86ffa55d08 ]
Syzbot found a crash : UBSAN: shift-out-of-bounds in dbAllocAG. The underlying bug is the missing check of bmp->db_agl2size. The field can be greater than 64 and trigger the shift-out-of-bounds.
Fix this bug by adding a check of bmp->db_agl2size in dbMount since this field is used in many following functions. The upper bound for this field is L2MAXL2SIZE - L2MAXAG, thanks for the help of Dave Kleikamp. Note that, for maintenance, I reorganized error handling code of dbMount.
--- fs/jfs/jfs_dmap.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
fs/jfs/jfs_dmap.c +16 -6
@@ -155,7 +155,7 @@ int dbMount(struct inode *ipbmap)struct bmap *bmp;struct dbmap_disk *dbmp_le;struct metapage *mp; -int i; +int i, err;/* * allocate/initialize the in-memory bmap descriptor
@@ -170,8 +170,8 @@ int dbMount(struct inode *ipbmap)BMAPBLKNO <<JFS_SBI (ipbmap->i_sb)->l2nbperpage, PSIZE, 0);if (mp ==NULL ) { -kfree (bmp); -return -EIO ; + err = -EIO ; + goto err_kfree_bmp; }/* copy the on-disk bmap descriptor to its in-memory version. */
@@ -181,9 +181,8 @@ int dbMount(struct inode *ipbmap) bmp->db_l2nbperpage =le32_to_cpu (dbmp_le->dn_l2nbperpage); bmp->db_numag =le32_to_cpu (dbmp_le->dn_numag);if (!bmp->db_numag) { -release_metapage (mp); -kfree (bmp); -return -EINVAL ; + err = -EINVAL ; + goto err_release_metapage; } bmp->db_maxlevel =le32_to_cpu (dbmp_le->dn_maxlevel);
@@ -194,6 +193,11 @@ int dbMount(struct inode *ipbmap) bmp->db_agwidth =le32_to_cpu (dbmp_le->dn_agwidth); bmp->db_agstart =le32_to_cpu (dbmp_le->dn_agstart); bmp->db_agl2size =le32_to_cpu (dbmp_le->dn_agl2size); +if (bmp->db_agl2size >L2MAXL2SIZE -L2MAXAG ) { + err = -EINVAL ; + goto err_release_metapage; + } +for (i =0 ; i <MAXAG ; i++) bmp->db_agfree[i] =le64_to_cpu (dbmp_le->dn_agfree[i]); bmp->db_agsize =le64_to_cpu (dbmp_le->dn_agsize);
@@ -214,6 +218,12 @@ int dbMount(struct inode *ipbmap)BMAP_LOCK_INIT (bmp);return (0 ); + +err_release_metapage: +release_metapage (mp); +err_kfree_bmp: +kfree (bmp); +return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 621/731 udf: Avoid double brelse() in udf_rename()
In reply to Greg Kroah-HartmanFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit c791730f2554a9ebb8f18df9368dc27d4ebc38c2 ]
syzbot reported a warning like below [1]:
VFS: brelse: Trying to free free buffer
WARNING: CPU: 2 PID: 7301 at fs/buffer.c:1145 __brelse+0x67/0xa0 ... Call Trace: <TASK> invalidate_bh_lru+0x99/0x150 smp_call_function_many_cond+0xe2a/0x10c0 ? generic_remap_file_range_prep+0x50/0x50 ? __brelse+0xa0/0xa0 ? __mutex_lock+0x21c/0x12d0 ? smp_call_on_cpu+0x250/0x250 ? rcu_read_lock_sched_held+0xb/0x60 ? lock_release+0x587/0x810 ? __brelse+0xa0/0xa0 ? generic_remap_file_range_prep+0x50/0x50 on_each_cpu_cond_mask+0x3c/0x80 blkdev_flush_mapping+0x13a/0x2f0 blkdev_put_whole+0xd3/0xf0 blkdev_put+0x222/0x760 deactivate_locked_super+0x96/0x160 deactivate_super+0xda/0x100 cleanup_mnt+0x222/0x3d0 task_work_run+0x149/0x240 ? task_work_cancel+0x30/0x30 do_exit+0xb29/0x2a40 ? reacquire_held_locks+0x4a0/0x4a0 ? do_raw_spin_lock+0x12a/0x2b0 ? mm_update_next_owner+0x7c0/0x7c0 ? rwlock_bug.part.0+0x90/0x90 ? zap_other_threads+0x234/0x2d0 do_group_exit+0xd0/0x2a0 __x64_sys_exit_group+0x3a/0x50 do_syscall_64+0x34/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The cause of the issue is that brelse() is called on both ofibh.sbh and ofibh.ebh by udf_find_entry() when it returns NULL. However, brelse() is called by udf_rename(), too. So, b_count on buffer_head becomes unbalanced.
This patch fixes the issue by not calling brelse() by udf_rename() when udf_find_entry() returns NULL.
--- fs/udf/namei.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/udf/namei.c +4 -4
@@ -1091,8 +1091,9 @@ static int udf_rename(struct user_namespace *mnt_userns, struct inode *old_dir,return -EINVAL ; ofi =udf_find_entry (old_dir, &old_dentry->d_name, &ofibh, &ocfi); -if (IS_ERR (ofi)) { - retval =PTR_ERR (ofi); +if (!ofi ||IS_ERR (ofi)) { +if (IS_ERR (ofi)) + retval =PTR_ERR (ofi); goto end_rename; }
@@ -1101,8 +1102,7 @@ static int udf_rename(struct user_namespace *mnt_userns, struct inode *old_dir,brelse (ofibh.sbh); tloc =lelb_to_cpu (ocfi.icb.extLocation); -if (!ofi ||udf_get_lb_pblock (old_dir->i_sb, &tloc,0 ) - != old_inode->i_ino) +if (udf_get_lb_pblock (old_dir->i_sb, &tloc,0 ) != old_inode->i_ino) goto end_rename; nfi =udf_find_entry (new_dir, &new_dentry->d_name, &nfibh, &ncfi);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 622/731 jfs: Fix fortify moan in symlink
In reply to Greg Kroah-HartmanFrom: Dr. David Alan Gilbert <[email protected]>
[ Upstream commit ebe060369f8d6e4588b115f252bebf5ba4d64350 ]
JFS has in jfs_incore.h:
/* _inline may overflow into _inline_ea when needed */
/* _inline_ea may overlay the last part of
* file._xtroot if maxentry = XTROOTINITSLOT
*/
union {
struct {
/* 128: inline symlink */
unchar _inline[128];
/* 128: inline extended attr */
unchar _inline_ea[128];
};
unchar _inline_all[256];and currently the symlink code copies into _inline;
if this is larger than 128 bytes it triggers a fortify warning of the form:
memcpy: detected field-spanning write (size 132) of single field
"ip->i_link" at fs/jfs/namei.c:950 (size 18446744073709551615)
when it's actually OK.
Copy it into _inline_all instead.
--- fs/jfs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/namei.c +1 -1
@@ -946,7 +946,7 @@ static int jfs_symlink(struct user_namespace *mnt_userns, struct inode *dip,if (ssize <=IDATASIZE ) { ip->i_op = &jfs_fast_symlink_inode_operations; - ip->i_link =JFS_IP (ip)->i_inline; + ip->i_link =JFS_IP (ip)->i_inline_all;memcpy (ip->i_link, name, ssize); ip->i_size = ssize -1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 623/731 fs: jfs: fix shift-out-of-bounds in dbDiscardAG
In reply to Greg Kroah-HartmanFrom: Hoi Pok Wu <[email protected]>
[ Upstream commit 25e70c6162f207828dd405b432d8f2a98dbf7082 ]
This should be applied to most URSAN bugs found recently by syzbot, by guarding the dbMount. As syzbot feeding rubbish into the bmap descriptor.
--- fs/jfs/jfs_dmap.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/jfs/jfs_dmap.c +5 -0
@@ -198,6 +198,11 @@ int dbMount(struct inode *ipbmap) goto err_release_metapage; } +if (((bmp->db_mapsize -1 ) >> bmp->db_agl2size) >MAXAG ) { + err = -EINVAL ; + goto err_release_metapage; + } +for (i =0 ; i <MAXAG ; i++) bmp->db_agfree[i] =le64_to_cpu (dbmp_le->dn_agfree[i]); bmp->db_agsize =le64_to_cpu (dbmp_le->dn_agsize);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 624/731 ACPICA: Fix error code path in acpi_ds_call_control_method()
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 404ec60438add1afadaffaed34bb5fe4ddcadd40 ]
A use-after-free in acpi_ps_parse_aml() after a failing invocaion of acpi_ds_call_control_method() is reported by KASAN [1] and code inspection reveals that next_walk_state pushed to the thread by acpi_ds_create_walk_state() is freed on errors, but it is not popped from the thread beforehand. Thus acpi_ds_get_current_walk_state() called by acpi_ps_parse_aml() subsequently returns it as the new walk state which is incorrect.
To address this, make acpi_ds_call_control_method() call acpi_ds_pop_walk_state() to pop next_walk_state from the thread before returning an error.
--- drivers/acpi/acpica/dsmethod.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/acpi/acpica/dsmethod.c +8 -2
@@ -517,7 +517,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, info =ACPI_ALLOCATE_ZEROED (sizeof (struct acpi_evaluate_info ));if (!info) { status =AE_NO_MEMORY ; - goto cleanup; + goto pop_walk_state; } info->parameters = &this_walk_state->operands[0 ];
@@ -529,7 +529,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,ACPI_FREE (info);if (ACPI_FAILURE (status)) { - goto cleanup; + goto pop_walk_state; } next_walk_state->method_nesting_depth =
@@ -575,6 +575,12 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,return_ACPI_STATUS (status); +pop_walk_state: + +/* On error, pop the walk state to be deleted from thread */ + +acpi_ds_pop_walk_state (thread); + cleanup:/* On error, we must terminate the method properly */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 625/731 nilfs2: fix shift-out-of-bounds/overflow in nilfs_sb2_bad_offset()
In reply to Greg Kroah-HartmanFrom: Ryusuke Konishi <[email protected]>
[ Upstream commit 610a2a3d7d8be3537458a378ec69396a76c385b6 ]
Patch series "nilfs2: fix UBSAN shift-out-of-bounds warnings on mount time".
The first patch fixes a bug reported by syzbot, and the second one fixes the remaining bug of the same kind. Although they are triggered by the same super block data anomaly, I divided it into the above two because the details of the issues and how to fix it are different.
Both are required to eliminate the shift-out-of-bounds issues at mount time.
This patch (of 2):
If the block size exponent information written in an on-disk superblock is corrupted, nilfs_sb2_bad_offset helper function can trigger shift-out-of-bounds warning followed by a kernel panic (if panic_on_warn is set):
shift exponent 38983 is too large for 64-bit type 'unsigned long long'
Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:151 [inline] __ubsan_handle_shift_out_of_bounds+0x33d/0x3b0 lib/ubsan.c:322 nilfs_sb2_bad_offset fs/nilfs2/the_nilfs.c:449 [inline] nilfs_load_super_block+0xdf5/0xe00 fs/nilfs2/the_nilfs.c:523 init_nilfs+0xb7/0x7d0 fs/nilfs2/the_nilfs.c:577 nilfs_fill_super+0xb1/0x5d0 fs/nilfs2/super.c:1047 nilfs_mount+0x613/0x9b0 fs/nilfs2/super.c:1317 ...
In addition, since nilfs_sb2_bad_offset() performs multiplication without considering the upper bound, the computation may overflow if the disk layout parameters are not normal.
This fixes these issues by inserting preliminary sanity checks for those parameters and by converting the comparison from one involving multiplication and left bit-shifting to one using division and right bit-shifting.
--- fs/nilfs2/the_nilfs.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
fs/nilfs2/the_nilfs.c +27 -4
@@ -13,6 +13,7 @@#include <linux/blkdev.h> #include <linux/backing-dev.h> #include <linux/random.h> +#include <linux/log2.h> #include <linux/crc32.h> #include "nilfs.h" #include "segment.h"
@@ -443,11 +444,33 @@ static int nilfs_valid_sb(struct nilfs_super_block *sbp)return crc ==le32_to_cpu (sbp->s_sum); } -static int nilfs_sb2_bad_offset (struct nilfs_super_block *sbp,u64 offset) +/** +* nilfs_sb2_bad_offset - check the location of the second superblock +* @sbp: superblock raw data buffer +* @offset: byte offset of second superblock calculated from device size +* +* nilfs_sb2_bad_offset() checks if the position on the second +* superblock is valid or not based on the filesystem parameters +* stored in @sbp. If @offset points to a location within the segment +* area, or if the parameters themselves are not normal, it is +* determined to be invalid. +* +* Return Value: true if invalid, false if valid. +*/ +static bool nilfs_sb2_bad_offset (struct nilfs_super_block *sbp,u64 offset) { -return offset < ((le64_to_cpu (sbp->s_nsegments) * -le32_to_cpu (sbp->s_blocks_per_segment)) << - (le32_to_cpu (sbp->s_log_block_size) +10 )); +unsigned int shift_bits =le32_to_cpu (sbp->s_log_block_size); +u32 blocks_per_segment =le32_to_cpu (sbp->s_blocks_per_segment); +u64 nsegments =le64_to_cpu (sbp->s_nsegments); +u64 index; + +if (blocks_per_segment <NILFS_SEG_MIN_BLOCKS || + shift_bits >ilog2 (NILFS_MAX_BLOCK_SIZE ) -BLOCK_SIZE_BITS ) +return true; + + index = offset >> (shift_bits +BLOCK_SIZE_BITS ); +do_div (index, blocks_per_segment); +return index < nsegments; }static void nilfs_release_super_block (struct the_nilfs *nilfs)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 626/731 nilfs2: fix shift-out-of-bounds due to too large exponent of block size
In reply to Greg Kroah-HartmanFrom: Ryusuke Konishi <[email protected]>
[ Upstream commit ebeccaaef67a4895d2496ab8d9c2fb8d89201211 ]
If field s_log_block_size of superblock data is corrupted and too large, init_nilfs() and load_nilfs() still can trigger a shift-out-of-bounds warning followed by a kernel panic (if panic_on_warn is set):
shift exponent 38973 is too large for 32-bit type 'int'
Call Trace: <TASK> dump_stack_lvl+0xcd/0x134 ubsan_epilogue+0xb/0x50 __ubsan_handle_shift_out_of_bounds.cold.12+0x17b/0x1f5 init_nilfs.cold.11+0x18/0x1d [nilfs2] nilfs_mount+0x9b5/0x12b0 [nilfs2] ...
This fixes the issue by adding and using a new helper function for getting block size with sanity check.
--- fs/nilfs2/the_nilfs.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-)
fs/nilfs2/the_nilfs.c +38 -4
@@ -193,6 +193,34 @@ static int nilfs_store_log_cursor(struct the_nilfs *nilfs,return ret; } +/** +* nilfs_get_blocksize - get block size from raw superblock data +* @sb: super block instance +* @sbp: superblock raw data buffer +* @blocksize: place to store block size +* +* nilfs_get_blocksize() calculates the block size from the block size +* exponent information written in @sbp and stores it in @blocksize, +* or aborts with an error message if it's too large. +* +* Return Value: On success, 0 is returned. If the block size is too +* large, -EINVAL is returned. +*/ +static int nilfs_get_blocksize (struct super_block *sb, +struct nilfs_super_block *sbp,int *blocksize) +{ +unsigned int shift_bits =le32_to_cpu (sbp->s_log_block_size); + +if (unlikely (shift_bits > +ilog2 (NILFS_MAX_BLOCK_SIZE ) -BLOCK_SIZE_BITS )) { +nilfs_err (sb,"too large filesystem blocksize: 2 ^ %u KiB" , + shift_bits); +return -EINVAL ; + } + *blocksize =BLOCK_SIZE << shift_bits; +return 0 ; +} +/** * load_nilfs - load and recover the nilfs * @nilfs: the_nilfs structure to be released
@@ -246,11 +274,15 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb) nilfs->ns_sbwtime =le64_to_cpu (sbp[0 ]->s_wtime);/* verify consistency between two super blocks */ - blocksize =BLOCK_SIZE <<le32_to_cpu (sbp[0 ]->s_log_block_size); + err =nilfs_get_blocksize (sb, sbp[0 ], &blocksize); +if (err) + goto scan_error; +if (blocksize != nilfs->ns_blocksize) {nilfs_warn (sb,"blocksize differs between two super blocks (%d != %d)" , blocksize, nilfs->ns_blocksize); + err = -EINVAL ; goto scan_error; }
@@ -609,9 +641,11 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data)if (err) goto failed_sbh; - blocksize =BLOCK_SIZE <<le32_to_cpu (sbp->s_log_block_size); -if (blocksize <NILFS_MIN_BLOCK_SIZE || - blocksize >NILFS_MAX_BLOCK_SIZE ) { + err =nilfs_get_blocksize (sb, sbp, &blocksize); +if (err) + goto failed_sbh; + +if (blocksize <NILFS_MIN_BLOCK_SIZE ) {nilfs_err (sb,"couldn't mount because of unsupported filesystem blocksize %d" , blocksize);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 627/731 acct: fix potential integer overflow in encode_comp_t()
In reply to Greg Kroah-HartmanFrom: Zheng Yejian <[email protected]>
[ Upstream commit c5f31c655bcc01b6da53b836ac951c1556245305 ]
The integer overflow is descripted with following codes:
Quoted 3 lines
317 static
comp_tencode_comp_t(u64 value)
318 {
319 int exp, rnd;
......
Quoted 4 lines
341 exp <<= MANTSIZE; 342 exp += value; 343 return exp;344 }
Currently comp_t is defined as type of '__u16', but the variable 'exp' is type of 'int', so overflow would happen when variable 'exp' in line 343 is greater than 65535.
--- kernel/acct.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/acct.c +2 -0
@@ -331,6 +331,8 @@ static comp_t encode_comp_t(unsigned long value) exp++; } +if (exp > (((comp_t ) ~0U ) >>MANTSIZE )) +return (comp_t ) ~0U ;/* * Clean it up and polish it off. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 628/731 hfs: fix OOB Read in __hfs_brec_find
In reply to Greg Kroah-HartmanFrom: ZhangPeng <[email protected]>
[ Upstream commit 8d824e69d9f3fa3121b2dda25053bae71e2460d2 ]
Syzbot reported a OOB read bug:
==================================================================
BUG: KASAN: slab-out-of-bounds in hfs_strcmp+0x117/0x190 fs/hfs/string.c:84 Read of size 1 at addr ffff88807eb62c4e by task kworker/u4:1/11 CPU: 1 PID: 11 Comm: kworker/u4:1 Not tainted 6.1.0-rc6-syzkaller-00308-g644e9524388a #0 Workqueue: writeback wb_workfn (flush-7:0) Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:284 print_report+0x107/0x1f0 mm/kasan/report.c:395 kasan_report+0xcd/0x100 mm/kasan/report.c:495 hfs_strcmp+0x117/0x190 fs/hfs/string.c:84 __hfs_brec_find+0x213/0x5c0 fs/hfs/bfind.c:75 hfs_brec_find+0x276/0x520 fs/hfs/bfind.c:138 hfs_write_inode+0x34c/0xb40 fs/hfs/inode.c:462 write_inode fs/fs-writeback.c:1440 [inline]
If the input inode of hfs_write_inode() is incorrect:
struct inode
struct hfs_inode_info
struct hfs_cat_key
struct hfs_name
u8 len # len is greater than HFS_NAMELEN(31) which is the
maximum length of an HFS filename
OOB read occurred:hfs_write_inode()
hfs_brec_find()
__hfs_brec_find()
hfs_cat_keycmp()
hfs_strcmp() # OOB read occurred due to len is too large
Fix this by adding a Check on len in hfs_write_inode() before calling hfs_brec_find().
--- fs/hfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/hfs/inode.c +2 -0
@@ -456,6 +456,8 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)/* panic? */ return -EIO ; +if (HFS_I (main_inode)->cat_key.CName.len >HFS_NAMELEN ) +return -EIO ; fd.search_key->cat =HFS_I (main_inode)->cat_key;if (hfs_brec_find (&fd))/* panic? */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 629/731 drm/etnaviv: add missing quirks for GC300
In reply to Greg Kroah-HartmanFrom: Doug Brown <[email protected]>
[ Upstream commit cc7d3fb446a91f24978a6aa59cbb578f92e22242 ]
The GC300's features register doesn't specify that a 2D pipe is available, and like the GC600, its idle register reports zero bits where modules aren't present.
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +9 -2
@@ -416,6 +416,12 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)if (gpu->identity.model == chipModel_GC700) gpu->identity.features &= ~chipFeatures_FAST_CLEAR; +/* These models/revisions don't have the 2D pipe bit */ +if ((gpu->identity.model == chipModel_GC500 && + gpu->identity.revision <=2 ) || + gpu->identity.model == chipModel_GC300) + gpu->identity.features |= chipFeatures_PIPE_2D; + if ((gpu->identity.model == chipModel_GC500 && gpu->identity.revision < 2) || (gpu->identity.model == chipModel_GC300 &&
@@ -449,8 +455,9 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)gpu_read (gpu,VIVS_HI_CHIP_MINOR_FEATURE_5 ); } -/* GC600 idle register reports zero bits where modules aren't present */ -if (gpu->identity.model == chipModel_GC600) +/* GC600/300 idle register reports zero bits where modules aren't present */ +if (gpu->identity.model == chipModel_GC600 || + gpu->identity.model == chipModel_GC300) gpu->idle_mask =VIVS_HI_IDLE_STATE_TX |VIVS_HI_IDLE_STATE_RA | VIVS_HI_IDLE_STATE_SE |
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 630/731 media: imx-jpeg: Disable useless interrupt to avoid kernel panic
In reply to Greg Kroah-HartmanFrom: Ming Qian <[email protected]>
[ Upstream commit c3720e65c9013a7b2a5dbb63e6bf6d74a35dd894 ]
There is a hardware bug that the interrupt STMBUF_HALF may be triggered after or when disable interrupt.
It may led to unexpected kernel panic.
And interrupt STMBUF_HALF and STMBUF_RTND have no other effect. So disable them and the unused interrupts.
meanwhile clear the interrupt status when disable interrupt.
--- drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c +3 -1
@@ -76,12 +76,14 @@ void print_wrapper_info(struct device *dev, void __iomem *reg)void mxc_jpeg_enable_irq (void __iomem *reg,int slot) { -writel (0xFFFFFFFF , reg +MXC_SLOT_OFFSET (slot,SLOT_IRQ_EN )); +writel (0xFFFFFFFF , reg +MXC_SLOT_OFFSET (slot,SLOT_STATUS )); +writel (0xF0C , reg +MXC_SLOT_OFFSET (slot,SLOT_IRQ_EN )); }void mxc_jpeg_disable_irq (void __iomem *reg,int slot) {writel (0x0 , reg +MXC_SLOT_OFFSET (slot,SLOT_IRQ_EN )); +writel (0xFFFFFFFF , reg +MXC_SLOT_OFFSET (slot,SLOT_STATUS )); }void mxc_jpeg_sw_reset (void __iomem *reg)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 631/731 brcmfmac: return error when getting invalid max_flowrings from dongle
In reply to Greg Kroah-HartmanFrom: Wright Feng <[email protected]>
[ Upstream commit 2aca4f3734bd717e04943ddf340d49ab62299a00 ]
When firmware hit trap at initialization, host will read abnormal max_flowrings number from dongle, and it will cause kernel panic when doing iowrite to initialize dongle ring.
To detect this error at early stage, we directly return error when getting invalid max_flowrings(>256).
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +4 -0
@@ -1118,6 +1118,10 @@ static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo)BRCMF_NROF_H2D_COMMON_MSGRINGS ; max_completionrings =BRCMF_NROF_D2H_COMMON_MSGRINGS ; } +if (max_flowrings >256 ) { +brcmf_err (bus,"invalid max_flowrings(%d)\n" , max_flowrings); +return -EIO ; + }if (devinfo->dma_idx_sz !=0 ) { bufsz = (max_submissionrings + max_completionrings) *
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 632/731 wifi: ath9k: verify the expected usb_endpoints are present
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 16ef02bad239f11f322df8425d302be62f0443ce ]
The bug arises when a USB device claims to be an ATH9K but doesn't have the expected endpoints. (In this case there was an interrupt endpoint where the driver expected a bulk endpoint.) The kernel needs to be able to handle such devices without getting an internal error.
usb 1-1: BOGUS urb xfer, pipe 3 != type 1
WARNING: CPU: 3 PID: 500 at drivers/usb/core/urb.c:493 usb_submit_urb+0xce2/0x1430 drivers/usb/core/urb.c:493 Modules linked in: CPU: 3 PID: 500 Comm: kworker/3:2 Not tainted 5.10.135-syzkaller #0 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Workqueue: events request_firmware_work_func RIP: 0010:usb_submit_urb+0xce2/0x1430 drivers/usb/core/urb.c:493 Call Trace: ath9k_hif_usb_alloc_rx_urbs drivers/net/wireless/ath/ath9k/hif_usb.c:908 [inline] ath9k_hif_usb_alloc_urbs+0x75e/0x1010 drivers/net/wireless/ath/ath9k/hif_usb.c:1019 ath9k_hif_usb_dev_init drivers/net/wireless/ath/ath9k/hif_usb.c:1109 [inline] ath9k_hif_usb_firmware_cb+0x142/0x530 drivers/net/wireless/ath/ath9k/hif_usb.c:1242 request_firmware_work_func+0x12e/0x240 drivers/base/firmware_loader/main.c:1097 process_one_work+0x9af/0x1600 kernel/workqueue.c:2279 worker_thread+0x61d/0x12f0 kernel/workqueue.c:2425 kthread+0x3b4/0x4a0 kernel/kthread.c:313 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:299
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/wireless/ath/ath9k/hif_usb.c +14 -0
@@ -1328,10 +1328,24 @@ static int send_eject_command(struct usb_interface *interface)static int ath9k_hif_usb_probe (struct usb_interface *interface,const struct usb_device_id *id) { +struct usb_endpoint_descriptor *bulk_in, *bulk_out, *int_in, *int_out;struct usb_device *udev =interface_to_usbdev (interface); +struct usb_host_interface *alt;struct hif_device_usb *hif_dev;int ret =0 ; +/* Verify the expected endpoints are present */ + alt = interface->cur_altsetting; +if (usb_find_common_endpoints (alt, &bulk_in, &bulk_out, &int_in, &int_out) <0 || +usb_endpoint_num (bulk_in) !=USB_WLAN_RX_PIPE || +usb_endpoint_num (bulk_out) !=USB_WLAN_TX_PIPE || +usb_endpoint_num (int_in) !=USB_REG_IN_PIPE || +usb_endpoint_num (int_out) !=USB_REG_OUT_PIPE ) { +dev_err (&udev->dev, +"ath9k_htc: Device endpoint numbers are not the expected ones\n" ); +return -ENODEV ; + } +if (id->driver_info ==STORAGE_DEVICE )return send_eject_command (interface);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 633/731 wifi: ar5523: Fix use-after-free on ar5523_cmd() timed out
In reply to Greg Kroah-HartmanFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit b6702a942a069c2a975478d719e98d83cdae1797 ]
syzkaller reported use-after-free with the stack trace like below [1]:
[ 38.960489][ C3] ================================================================== [ 38.963216][ C3] BUG: KASAN: use-after-free in ar5523_cmd_tx_cb+0x220/0x240 [ 38.964950][ C3] Read of size 8 at addr ffff888048e03450 by task swapper/3/0 [ 38.966363][ C3] [ 38.967053][ C3] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 6.0.0-09039-ga6afa4199d3d-dirty #18 [ 38.968464][ C3] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014 [ 38.969959][ C3] Call Trace: [ 38.970841][ C3] <IRQ> [ 38.971663][ C3] dump_stack_lvl+0xfc/0x174 [ 38.972620][ C3] print_report.cold+0x2c3/0x752 [ 38.973626][ C3] ? ar5523_cmd_tx_cb+0x220/0x240 [ 38.974644][ C3] kasan_report+0xb1/0x1d0 [ 38.975720][ C3] ? ar5523_cmd_tx_cb+0x220/0x240 [ 38.976831][ C3] ar5523_cmd_tx_cb+0x220/0x240 [ 38.978412][ C3] __usb_hcd_giveback_urb+0x353/0x5b0 [ 38.979755][ C3] usb_hcd_giveback_urb+0x385/0x430 [ 38.981266][ C3] dummy_timer+0x140c/0x34e0 [ 38.982925][ C3] ? notifier_call_chain+0xb5/0x1e0 [ 38.984761][ C3] ? rcu_read_lock_sched_held+0xb/0x60 [ 38.986242][ C3] ? lock_release+0x51c/0x790 [ 38.987323][ C3] ? _raw_read_unlock_irqrestore+0x37/0x70 [ 38.988483][ C3] ? __wake_up_common_lock+0xde/0x130 [ 38.989621][ C3] ? reacquire_held_locks+0x4a0/0x4a0 [ 38.990777][ C3] ? lock_acquire+0x472/0x550 [ 38.991919][ C3] ? rcu_read_lock_sched_held+0xb/0x60 [ 38.993138][ C3] ? lock_acquire+0x472/0x550 [ 38.994890][ C3] ? dummy_urb_enqueue+0x860/0x860 [ 38.996266][ C3] ? do_raw_spin_unlock+0x16f/0x230 [ 38.997670][ C3] ? dummy_urb_enqueue+0x860/0x860 [ 38.999116][ C3] call_timer_fn+0x1a0/0x6a0 [ 39.000668][ C3] ? add_timer_on+0x4a0/0x4a0 [ 39.002137][ C3] ? reacquire_held_locks+0x4a0/0x4a0 [ 39.003809][ C3] ? __next_timer_interrupt+0x226/0x2a0 [ 39.005509][ C3] __run_timers.part.0+0x69a/0xac0 [ 39.007025][ C3] ? dummy_urb_enqueue+0x860/0x860 [ 39.008716][ C3] ? call_timer_fn+0x6a0/0x6a0 [ 39.010254][ C3] ? cpuacct_percpu_seq_show+0x10/0x10 [ 39.011795][ C3] ? kvm_sched_clock_read+0x14/0x40 [ 39.013277][ C3] ? sched_clock_cpu+0x69/0x2b0 [ 39.014724][ C3] run_timer_softirq+0xb6/0x1d0 [ 39.016196][ C3] __do_softirq+0x1d2/0x9be [ 39.017616][ C3] __irq_exit_rcu+0xeb/0x190 [ 39.019004][ C3] irq_exit_rcu+0x5/0x20 [ 39.020361][ C3] sysvec_apic_timer_interrupt+0x8f/0xb0 [ 39.021965][ C3] </IRQ> [ 39.023237][ C3] <TASK>
In ar5523_probe(), ar5523_host_available() calls ar5523_cmd() as below (there are other functions which finally call ar5523_cmd()):
ar5523_probe()
-> ar5523_host_available()
-> ar5523_cmd_read()
-> ar5523_cmd()
If ar5523_cmd() timed out, then ar5523_host_available() failed and ar5523_probe() freed the device structure. So, ar5523_cmd_tx_cb() might touch the freed structure.
This patch fixes this issue by canceling in-flight tx cmd if submitted urb timed out.
--- drivers/net/wireless/ath/ar5523/ar5523.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/ath/ar5523/ar5523.c +6 -0
@@ -241,6 +241,11 @@ static void ar5523_cmd_tx_cb(struct urb *urb) } } +static void ar5523_cancel_tx_cmd (struct ar5523 *ar) +{ +usb_kill_urb (ar->tx_cmd.urb_tx); +} +static int ar5523_cmd (struct ar5523 *ar,u32 code,const void *idata,int ilen,void *odata,int olen,int flags) {
@@ -280,6 +285,7 @@ static int ar5523_cmd(struct ar5523 *ar, u32 code, const void *idata, }if (!wait_for_completion_timeout (&cmd->done,2 *HZ )) { +ar5523_cancel_tx_cmd (ar); cmd->odata =NULL ;ar5523_err (ar,"timeout waiting for command %02x reply\n" , code);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 634/731 ASoC: codecs: rt298: Add quirk for KBL-R RVP platform
In reply to Greg Kroah-HartmanFrom: Amadeusz Sławiński <[email protected]>
[ Upstream commit 953dbd1cef18ce9ac0d69c1bd735b929fe52a17e ]
KBL-R RVP platforms also use combojack, so we need to enable that configuration for them.
--- sound/soc/codecs/rt298.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/codecs/rt298.c +7 -0
@@ -1173,6 +1173,13 @@ static const struct dmi_system_id force_combo_jack_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Geminilake") } }, + { + .ident = "Intel Kabylake R RVP", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Intel Corporation" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Kabylake Client platform") + } + }, { } };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 635/731 ipmi: fix memleak when unload ipmi driver
In reply to Greg Kroah-HartmanFrom: Zhang Yuchen <[email protected]>
[ Upstream commit 36992eb6b9b83f7f9cdc8e74fb5799d7b52e83e9 ]
After the IPMI disconnect problem, the memory kept rising and we tried to unload the driver to free the memory. However, only part of the free memory is recovered after the driver is uninstalled. Using ebpf to hook free functions, we find that neither ipmi_user nor ipmi_smi_msg is free, only ipmi_recv_msg is free.
We find that the deliver_smi_err_response call in clean_smi_msgs does the destroy processing on each message from the xmit_msg queue without checking the return value and free ipmi_smi_msg.
deliver_smi_err_response is called only at this location. Adding the free handling has no effect.
To verify, try using ebpf to trace the free function.
$ bpftrace -e 'kretprobe:ipmi_alloc_recv_msg {printf("alloc rcv
%p\n",retval);} kprobe:free_recv_msg {printf("free recv %p\n",
arg0)} kretprobe:ipmi_alloc_smi_msg {printf("alloc smi %p\n",
retval);} kprobe:free_smi_msg {printf("free smi %p\n",arg0)}'Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_msghandler.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +6 -2
@@ -3527,12 +3527,16 @@ static void deliver_smi_err_response(struct ipmi_smi *intf,struct ipmi_smi_msg *msg, unsigned char err) { + int rv; msg->rsp[0 ] = msg->data[0 ] |4 ; msg->rsp[1 ] = msg->data[1 ]; msg->rsp[2 ] = err; msg->rsp_size =3 ; -/* It's an error, so it will never requeue, no need to check return. */ -handle_one_recv_msg (intf, msg); + +/* This will never requeue, but it may ask us to free the message. */ + rv =handle_one_recv_msg (intf, msg); +if (rv ==0 ) +ipmi_free_smi_msg (msg); }static void cleanup_smi_msgs (struct ipmi_smi *intf)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 636/731 drm/amd/display: prevent memory leak
In reply to Greg Kroah-HartmanFrom: gehao <[email protected]>
[ Upstream commit d232afb1f3417ae8194ccf19ad3a8360e70e104e ]
In dce6(0,1,4)_create_resource_pool and dce80_create_resource_pool the allocated memory should be released if construct pool fails.
--- drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c | 3 +++ drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c | 2 ++ 2 files changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c +3 -0
@@ -1127,6 +1127,7 @@ struct resource_pool *dce60_create_resource_pool(if (dce60_construct (num_virtual_links, dc, pool))return &pool->base; +kfree (pool);BREAK_TO_DEBUGGER ();return NULL ; }
@@ -1324,6 +1325,7 @@ struct resource_pool *dce61_create_resource_pool(if (dce61_construct (num_virtual_links, dc, pool))return &pool->base; +kfree (pool);BREAK_TO_DEBUGGER ();return NULL ; }
@@ -1517,6 +1519,7 @@ struct resource_pool *dce64_create_resource_pool(if (dce64_construct (num_virtual_links, dc, pool))return &pool->base; +kfree (pool);BREAK_TO_DEBUGGER ();return NULL ; }
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +2 -0
@@ -1138,6 +1138,7 @@ struct resource_pool *dce80_create_resource_pool(if (dce80_construct (num_virtual_links, dc, pool))return &pool->base; +kfree (pool);BREAK_TO_DEBUGGER ();return NULL ; }
@@ -1337,6 +1338,7 @@ struct resource_pool *dce81_create_resource_pool(if (dce81_construct (num_virtual_links, dc, pool))return &pool->base; +kfree (pool);BREAK_TO_DEBUGGER ();return NULL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 637/731 Revert "drm/amd/display: Limit max DSC target bpp for specific monitors"
In reply to Greg Kroah-HartmanFrom: Hamza Mahfooz <[email protected]>
[ Upstream commit 6803dfd3a69ccb318772463a86e40929fd4fbac7 ]
This reverts commit 55eea8ef98641f6e1e1c202bd3a49a57c1dd4059.
This quirk is now handled in the DRM core, so we can drop all of the internal code that was added to handle it.
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 35 ------------------- 1 file changed, 35 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0 -35
@@ -40,39 +40,6 @@#include "dm_helpers.h" -struct monitor_patch_info { -unsigned int manufacturer_id; -unsigned int product_id; -void (*patch_func)(struct dc_edid_caps *edid_caps,unsigned int param); -unsigned int patch_param; -}; -static void set_max_dsc_bpp_limit (struct dc_edid_caps *edid_caps,unsigned int param); - -static const struct monitor_patch_info monitor_patch_table[] = { -{0x6D1E ,0x5BBF , set_max_dsc_bpp_limit,15 }, -{0x6D1E ,0x5B9A , set_max_dsc_bpp_limit,15 }, -}; - -static void set_max_dsc_bpp_limit (struct dc_edid_caps *edid_caps,unsigned int param) -{ -if (edid_caps) - edid_caps->panel_patch.max_dsc_target_bpp_limit = param; -} - -static int amdgpu_dm_patch_edid_caps (struct dc_edid_caps *edid_caps) -{ -int i, ret =0 ; - -for (i =0 ; i <ARRAY_SIZE (monitor_patch_table); i++) -if ((edid_caps->manufacturer_id == monitor_patch_table[i].manufacturer_id) - && (edid_caps->product_id == monitor_patch_table[i].product_id)) { - monitor_patch_table[i].patch_func (edid_caps, monitor_patch_table[i].patch_param); - ret++; - } - -return ret; -} -/* dm_helpers_parse_edid_caps * * Parse edid caps
@@ -158,8 +125,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(kfree (sads);kfree (sadb); -amdgpu_dm_patch_edid_caps (edid_caps); -return result; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 638/731 qed (gcc13): use u16 for fid to be big enough
In reply to Greg Kroah-HartmanFrom: Jiri Slaby (SUSE) <[email protected]>
[ Upstream commit 7d84118229bf7f7290438c85caa8e49de52d50c1 ]
gcc 13 correctly reports overflow in qed_grc_dump_addr_range():
In file included from drivers/net/ethernet/qlogic/qed/qed.h:23,
from drivers/net/ethernet/qlogic/qed/qed_debug.c:10:drivers/net/ethernet/qlogic/qed/qed_debug.c: In function 'qed_grc_dump_addr_range':include/linux/qed/qed_if.h:1217:9: error: overflow in conversion from 'int' to 'u8' {aka 'unsigned char'} changes value from '(int)vf_id << 8 | 128' to '128' [-Werror=overflow]
We do:
u8 fid;
...
fid = vf_id << 8 | 128;
Since fid is 16bit (and the stored value above too), fid should be u16, not u8. Fix that.
--- drivers/net/ethernet/qlogic/qed/qed_debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_debug.c +2 -1
@@ -1796,9 +1796,10 @@ static u32 qed_grc_dump_addr_range(struct qed_hwfn *p_hwfn, u8 split_id) {struct dbg_tools_data *dev_data = &p_hwfn->dbg_info; -u8 port_id =0 , pf_id =0 , vf_id =0 , fid =0 ; +u8 port_id =0 , pf_id =0 , vf_id =0 ;bool read_using_dmae = false;u32 thresh; +u16 fid;if (!dump)return len;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 639/731 bpf: make sure skb->len != 0 when redirecting to a tunneling device
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 07ec7b502800ba9f7b8b15cb01dd6556bb41aaca ]
syzkaller managed to trigger another case where skb->len == 0 when we enter __dev_queue_xmit:
WARNING: CPU: 0 PID: 2470 at include/linux/skbuff.h:2576 skb_assert_len include/linux/skbuff.h:2576 [inline] WARNING: CPU: 0 PID: 2470 at include/linux/skbuff.h:2576 __dev_queue_xmit+0x2069/0x35e0 net/core/dev.c:4295 Call Trace: dev_queue_xmit+0x17/0x20 net/core/dev.c:4406 __bpf_tx_skb net/core/filter.c:2115 [inline] __bpf_redirect_no_mac net/core/filter.c:2140 [inline] __bpf_redirect+0x5fb/0xda0 net/core/filter.c:2163 ____bpf_clone_redirect net/core/filter.c:2447 [inline] bpf_clone_redirect+0x247/0x390 net/core/filter.c:2419 bpf_prog_48159a89cb4a9a16+0x59/0x5e bpf_dispatcher_nop_func include/linux/bpf.h:897 [inline] __bpf_prog_run include/linux/filter.h:596 [inline] bpf_prog_run include/linux/filter.h:603 [inline] bpf_test_run+0x46c/0x890 net/bpf/test_run.c:402 bpf_prog_test_run_skb+0xbdc/0x14c0 net/bpf/test_run.c:1170 bpf_prog_test_run+0x345/0x3c0 kernel/bpf/syscall.c:3648 __sys_bpf+0x43a/0x6c0 kernel/bpf/syscall.c:5005 __do_sys_bpf kernel/bpf/syscall.c:5091 [inline] __se_sys_bpf kernel/bpf/syscall.c:5089 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5089 do_syscall_64+0x54/0x70 arch/x86/entry/common.c:48 entry_SYSCALL_64_after_hwframe+0x61/0xc6
The reproducer doesn't really reproduce outside of syzkaller environment, so I'm taking a guess here. It looks like we do generate correct ETH_HLEN-sized packet, but we redirect the packet to the tunneling device. Before we do so, we __skb_pull l2 header and arrive again at skb->len == 0. Doesn't seem like we can do anything better than having an explicit check after __skb_pull?
--- net/core/filter.c | 4 ++++ 1 file changed, 4 insertions(+)
net/core/filter.c +4 -0
@@ -2130,6 +2130,10 @@ static int __bpf_redirect_no_mac(struct sk_buff *skb, struct net_device *dev,if (mlen) {__skb_pull (skb, mlen); +if (unlikely (!skb->len)) { +kfree_skb (skb); +return -ERANGE ; + }/* At ingress, the mac header has already been pulled once. * At egress, skb_pospull_rcsum has to be done in case that
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 640/731 net: ethernet: ti: Fix return type of netcp_ndo_start_xmit()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 63fe6ff674a96cfcfc0fa8df1051a27aa31c70b4 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/net/ethernet/ti/netcp_core.c:1944:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = netcp_ndo_start_xmit,
^~~~~~~~~~~~~~~~~~~~
1 error generated.
->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of netcp_ndo_start_xmit() to match the prototype's to resolve the warning and CFI failure.
--- drivers/net/ethernet/ti/netcp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/netcp_core.c +1 -1
@@ -1262,7 +1262,7 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp, }/* Submit the packet */ -static int netcp_ndo_start_xmit (struct sk_buff *skb,struct net_device *ndev) +static netdev_tx_t netcp_ndo_start_xmit (struct sk_buff *skb,struct net_device *ndev) {struct netcp_intf *netcp =netdev_priv (ndev);struct netcp_stats *tx_stats = &netcp->stats;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 641/731 hamradio: baycom_epp: Fix return type of baycom_send_packet()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit c5733e5b15d91ab679646ec3149e192996a27d5d ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/net/hamradio/baycom_epp.c:1119:25: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = baycom_send_packet,
^~~~~~~~~~~~~~~~~~
1 error generated.
->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of baycom_send_packet() to match the prototype's to resolve the warning and CFI failure.
--- drivers/net/hamradio/baycom_epp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hamradio/baycom_epp.c +1 -1
@@ -758,7 +758,7 @@ static void epp_bh(struct work_struct *work)* ===================== network driver interface ========================= */ -static int baycom_send_packet (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t baycom_send_packet (struct sk_buff *skb,struct net_device *dev) {struct baycom_state *bc =netdev_priv (dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 642/731 wifi: brcmfmac: Fix potential shift-out-of-bounds in brcmf_fw_alloc_request()
In reply to Greg Kroah-HartmanFrom: Minsuk Kang <[email protected]>
[ Upstream commit 81d17f6f3331f03c8eafdacea68ab773426c1e3c ]
This patch fixes a shift-out-of-bounds in brcmfmac that occurs in BIT(chiprev) when a 'chiprev' provided by the device is too large. It should also not be equal to or greater than BITS_PER_TYPE(u32) as we do bitwise AND with a u32 variable and BIT(chiprev). The patch adds a check that makes the function return NULL if that is the case. Note that the NULL case is later handled by the bus-specific caller, brcmf_usb_probe_cb() or brcmf_usb_reset_resume(), for example.
Found by a modified version of syzkaller.
UBSAN: shift-out-of-bounds in drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c shift exponent 151055786 is too large for 64-bit type 'long unsigned int' CPU: 0 PID: 1885 Comm: kworker/0:2 Tainted: G O 5.14.0+ #132 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 Workqueue: usb_hub_wq hub_event Call Trace: dump_stack_lvl+0x57/0x7d ubsan_epilogue+0x5/0x40 __ubsan_handle_shift_out_of_bounds.cold+0x53/0xdb ? lock_chain_count+0x20/0x20 brcmf_fw_alloc_request.cold+0x19/0x3ea ? brcmf_fw_get_firmwares+0x250/0x250 ? brcmf_usb_ioctl_resp_wait+0x1a7/0x1f0 brcmf_usb_get_fwname+0x114/0x1a0 ? brcmf_usb_reset_resume+0x120/0x120 ? number+0x6c4/0x9a0 brcmf_c_process_clm_blob+0x168/0x590 ? put_dec+0x90/0x90 ? enable_ptr_key_workfn+0x20/0x20 ? brcmf_common_pd_remove+0x50/0x50 ? rcu_read_lock_sched_held+0xa1/0xd0 brcmf_c_preinit_dcmds+0x673/0xc40 ? brcmf_c_set_joinpref_default+0x100/0x100 ? rcu_read_lock_sched_held+0xa1/0xd0 ? rcu_read_lock_bh_held+0xb0/0xb0 ? lock_acquire+0x19d/0x4e0 ? find_held_lock+0x2d/0x110 ? brcmf_usb_deq+0x1cc/0x260 ? mark_held_locks+0x9f/0xe0 ? lockdep_hardirqs_on_prepare+0x273/0x3e0 ? _raw_spin_unlock_irqrestore+0x47/0x50 ? trace_hardirqs_on+0x1c/0x120 ? brcmf_usb_deq+0x1a7/0x260 ? brcmf_usb_rx_fill_all+0x5a/0xf0 brcmf_attach+0x246/0xd40 ? wiphy_new_nm+0x1476/0x1d50 ? kmemdup+0x30/0x40 brcmf_usb_probe+0x12de/0x1690 ? brcmf_usbdev_qinit.constprop.0+0x470/0x470 usb_probe_interface+0x25f/0x710 really_probe+0x1be/0xa90 __driver_probe_device+0x2ab/0x460 ? usb_match_id.part.0+0x88/0xc0 driver_probe_device+0x49/0x120 __device_attach_driver+0x18a/0x250 ? driver_allows_async_probing+0x120/0x120 bus_for_each_drv+0x123/0x1a0 ? bus_rescan_devices+0x20/0x20 ? lockdep_hardirqs_on_prepare+0x273/0x3e0 ? trace_hardirqs_on+0x1c/0x120 __device_attach+0x207/0x330 ? device_bind_driver+0xb0/0xb0 ? kobject_uevent_env+0x230/0x12c0 bus_probe_device+0x1a2/0x260 device_add+0xa61/0x1ce0 ? __mutex_unlock_slowpath+0xe7/0x660 ? __fw_devlink_link_to_suppliers+0x550/0x550 usb_set_configuration+0x984/0x1770 ? kernfs_create_link+0x175/0x230 usb_generic_driver_probe+0x69/0x90 usb_probe_device+0x9c/0x220 really_probe+0x1be/0xa90 __driver_probe_device+0x2ab/0x460 driver_probe_device+0x49/0x120 __device_attach_driver+0x18a/0x250 ? driver_allows_async_probing+0x120/0x120 bus_for_each_drv+0x123/0x1a0 ? bus_rescan_devices+0x20/0x20 ? lockdep_hardirqs_on_prepare+0x273/0x3e0 ? trace_hardirqs_on+0x1c/0x120 __device_attach+0x207/0x330 ? device_bind_driver+0xb0/0xb0 ? kobject_uevent_env+0x230/0x12c0 bus_probe_device+0x1a2/0x260 device_add+0xa61/0x1ce0 ? __fw_devlink_link_to_suppliers+0x550/0x550 usb_new_device.cold+0x463/0xf66 ? hub_disconnect+0x400/0x400 ? _raw_spin_unlock_irq+0x24/0x30 hub_event+0x10d5/0x3330 ? hub_port_debounce+0x280/0x280 ? __lock_acquire+0x1671/0x5790 ? wq_calc_node_cpumask+0x170/0x2a0 ? lock_release+0x640/0x640 ? rcu_read_lock_sched_held+0xa1/0xd0 ? rcu_read_lock_bh_held+0xb0/0xb0 ? lockdep_hardirqs_on_prepare+0x273/0x3e0 process_one_work+0x873/0x13e0 ? lock_release+0x640/0x640 ? pwq_dec_nr_in_flight+0x320/0x320 ? rwlock_bug.part.0+0x90/0x90 worker_thread+0x8b/0xd10 ? __kthread_parkme+0xd9/0x1d0 ? process_one_work+0x13e0/0x13e0 kthread+0x379/0x450 ? _raw_spin_unlock_irq+0x24/0x30 ? set_kthread_struct+0x100/0x100 ret_from_fork+0x1f/0x30
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +5 -0
@@ -746,6 +746,11 @@ brcmf_fw_alloc_request(u32 chip, u32 chiprev,u32 i, j;char end ='\0' ; +if (chiprev >=BITS_PER_TYPE (u32)) { +brcmf_err ("Invalid chip revision %u\n" , chiprev); +return NULL ; + } +for (i =0 ; i < table_size; i++) {if (mapping_table[i].chipid == chip && mapping_table[i].revmask &BIT (chiprev))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 643/731 igb: Do not free q_vector unless new one was allocated
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 0668716506ca66f90d395f36ccdaebc3e0e84801 ]
Avoid potential use-after-free condition under memory pressure. If the kzalloc() fails, q_vector will be freed but left in the original adapter->q_vector[v_idx] array position.
--- drivers/net/ethernet/intel/igb/igb_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +6 -2
@@ -1204,8 +1204,12 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,if (!q_vector) { q_vector =kzalloc (size,GFP_KERNEL ); }else if (size >ksize (q_vector)) { -kfree_rcu (q_vector, rcu); - q_vector =kzalloc (size,GFP_KERNEL ); +struct igb_q_vector *new_q_vector; + + new_q_vector =kzalloc (size,GFP_KERNEL ); +if (new_q_vector) +kfree_rcu (q_vector, rcu); + q_vector = new_q_vector; }else {memset (q_vector,0 , size); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 644/731 drm/amdgpu: Fix type of second parameter in trans_msg() callback
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit f0d0f1087333714ee683cc134a95afe331d7ddd9 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c:412:15: error: incompatible function pointer types initializing 'void (*)(struct amdgpu_device *, u32, u32, u32, u32)' (aka 'void (*)(struct amdgpu_device *, unsigned int, unsigned int, unsigned int, unsigned int)') with an expression of type 'void (struct amdgpu_device *, enum idh_request, u32, u32, u32)' (aka 'void (struct amdgpu_device *, enum idh_request, unsigned int, unsigned int, unsigned int)') [-Werror,-Wincompatible-function-pointer-types-strict]
.trans_msg = xgpu_ai_mailbox_trans_msg,
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c:435:15: error: incompatible function pointer types initializing 'void (*)(struct amdgpu_device *, u32, u32, u32, u32)' (aka 'void (*)(struct amdgpu_device *, unsigned int, unsigned int, unsigned int, unsigned int)') with an expression of type 'void (struct amdgpu_device *, enum idh_request, u32, u32, u32)' (aka 'void (struct amdgpu_device *, enum idh_request, unsigned int, unsigned int, unsigned int)') [-Werror,-Wincompatible-function-pointer-types-strict]
.trans_msg = xgpu_nv_mailbox_trans_msg,
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
The type of the second parameter in the prototype should be 'enum idh_request' instead of 'u32'. Update it to clear up the warnings.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +4 -1
@@ -62,6 +62,8 @@ struct amdgpu_vf_error_buffer {uint64_t data[AMDGPU_VF_ERROR_ENTRY_SIZE ]; }; +enum idh_request ; +/** * struct amdgpu_virt_ops - amdgpu device virt operations */
@@ -71,7 +73,8 @@ struct amdgpu_virt_ops {int (*req_init_data)(struct amdgpu_device *adev);int (*reset_gpu)(struct amdgpu_device *adev);int (*wait_reset)(struct amdgpu_device *adev); -void (*trans_msg)(struct amdgpu_device *adev,u32 req,u32 data1,u32 data2,u32 data3); +void (*trans_msg)(struct amdgpu_device *adev,enum idh_request req, +u32 data1,u32 data2,u32 data3); };/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 645/731 drm/amdgpu: Fix type of second parameter in odn_edit_dpm_table() callback
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit e4d0ef752081e7aa6ffb7ccac11c499c732a2e05 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/amdgpu_smu.c:3008:29: error: incompatible function pointer types initializing 'int (*)(void *, uint32_t, long *, uint32_t)' (aka 'int (*)(void *, unsigned int, long *, unsigned int)') with an expression of type 'int (void *, enum PP_OD_DPM_TABLE_COMMAND, long *, uint32_t)' (aka 'int (void *, enum PP_OD_DPM_TABLE_COMMAND, long *, unsigned int)') [-Werror,-Wincompatible-function-pointer-types-strict]
.odn_edit_dpm_table = smu_od_edit_dpm_table,
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
There are only two implementations of ->odn_edit_dpm_table() in 'struct amd_pm_funcs': smu_od_edit_dpm_table() and pp_odn_edit_dpm_table(). One has a second parameter type of 'enum PP_OD_DPM_TABLE_COMMAND' and the other uses 'u32'. Ultimately, smu_od_edit_dpm_table() calls ->od_edit_dpm_table() from 'struct pptable_funcs' and pp_odn_edit_dpm_table() calls ->odn_edit_dpm_table() from 'struct pp_hwmgr_func', which both have a second parameter type of 'enum PP_OD_DPM_TABLE_COMMAND'.
Update the type parameter in both the prototype in 'struct amd_pm_funcs' and pp_odn_edit_dpm_table() to 'enum PP_OD_DPM_TABLE_COMMAND', which cleans up the warning.
--- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 3 ++- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -1
@@ -341,7 +341,8 @@ struct amd_pm_funcs {int (*get_power_profile_mode)(void *handle,char *buf);int (*set_power_profile_mode)(void *handle,long *input,uint32_t size);int (*set_fine_grain_clk_vol)(void *handle,uint32_t type,long *input,uint32_t size); -int (*odn_edit_dpm_table)(void *handle,uint32_t type,long *input,uint32_t size); +int (*odn_edit_dpm_table)(void *handle,enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size);int (*set_mp1_state)(void *handle,enum pp_mp1_state mp1_state);int (*smu_i2c_bus_access)(void *handle,bool acquire);int (*gfx_state_change_set)(void *handle,uint32_t state);
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +2 -1
@@ -924,7 +924,8 @@ static int pp_set_fine_grain_clk_vol(void *handle, uint32_t type, long *input, ureturn hwmgr->hwmgr_func->set_fine_grain_clk_vol (hwmgr, type, input, size); } -static int pp_odn_edit_dpm_table (void *handle,uint32_t type,long *input,uint32_t size) +static int pp_odn_edit_dpm_table (void *handle,enum PP_OD_DPM_TABLE_COMMAND type, +long *input,uint32_t size) {struct pp_hwmgr *hwmgr = handle;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 646/731 s390/ctcm: Fix return type of ctc{mp,}m_tx()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit aa5bf80c3c067b82b4362cd6e8e2194623bcaca6 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/s390/net/ctcm_main.c:1064:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = ctcm_tx,
^~~~~~~
drivers/s390/net/ctcm_main.c:1072:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = ctcmpc_tx,
^~~~~~~~~
->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of ctc{mp,}m_tx() to match the prototype's to resolve the warning and potential CFI failure, should s390 select ARCH_SUPPORTS_CFI_CLANG in the future.
Additionally, while in the area, remove a comment block that is no longer relevant.
--- drivers/s390/net/ctcm_main.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/s390/net/ctcm_main.c +2 -9
@@ -825,16 +825,9 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb)/** * Start transmission of a packet. * Called from generic network device layer. -* -* skb Pointer to buffer containing the packet. -* dev Pointer to interface struct. -* -* returns 0 if packet consumed, !0 if packet rejected. -* Note: If we return !0, then the packet is free'd by -* the generic network layer. */ /* first merge version - leaving both functions separated */ -static int ctcm_tx (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t ctcm_tx (struct sk_buff *skb,struct net_device *dev) {struct ctcm_priv *priv = dev->ml_priv;
@@ -877,7 +870,7 @@ static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) }/* unmerged MPC variant of ctcm_tx */ -static int ctcmpc_tx (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t ctcmpc_tx (struct sk_buff *skb,struct net_device *dev) {int len =0 ;struct ctcm_priv *priv = dev->ml_priv;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 647/731 s390/netiucv: Fix return type of netiucv_tx()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 88d86d18d7cf7e9137c95f9d212bb9fff8a1b4be ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/s390/net/netiucv.c:1854:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = netiucv_tx,
^~~~~~~~~~
->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of netiucv_tx() to match the prototype's to resolve the warning and potential CFI failure, should s390 select ARCH_SUPPORTS_CFI_CLANG in the future.
Additionally, while in the area, remove a comment block that is no longer relevant.
--- drivers/s390/net/netiucv.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/s390/net/netiucv.c +1 -8
@@ -1252,15 +1252,8 @@ static int netiucv_close(struct net_device *dev)/** * Start transmission of a packet. * Called from generic network device layer. -* -* @param skb Pointer to buffer containing the packet. -* @param dev Pointer to interface struct. -* -* @return 0 if packet consumed, !0 if packet rejected. -* Note: If we return !0, then the packet is free'd by -* the generic network layer. */ -static int netiucv_tx (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t netiucv_tx (struct sk_buff *skb,struct net_device *dev) {struct netiucv_priv *privptr =netdev_priv (dev);int rc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 648/731 s390/lcs: Fix return type of lcs_start_xmit()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit bb16db8393658e0978c3f0d30ae069e878264fa3 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/s390/net/lcs.c:2090:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = lcs_start_xmit,
^~~~~~~~~~~~~~
drivers/s390/net/lcs.c:2097:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.ndo_start_xmit = lcs_start_xmit,
^~~~~~~~~~~~~~
->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of lcs_start_xmit() to match the prototype's to resolve the warning and potential CFI failure, should s390 select ARCH_SUPPORTS_CFI_CLANG in the future.
--- drivers/s390/net/lcs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/s390/net/lcs.c +3 -5
@@ -1518,9 +1518,8 @@ lcs_txbuffer_cb(struct lcs_channel *channel, struct lcs_buffer *buffer)/** * Packet transmit function called by network stack */ -static int -__lcs_start_xmit (struct lcs_card *card,struct sk_buff *skb, -struct net_device *dev) +static netdev_tx_t __lcs_start_xmit (struct lcs_card *card,struct sk_buff *skb, +struct net_device *dev) {struct lcs_header *header;int rc =NETDEV_TX_OK ;
@@ -1581,8 +1580,7 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,return rc; } -static int -lcs_start_xmit (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t lcs_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct lcs_card *card;int rc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 649/731 drm/msm: Use drm_mode_copy()
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
[ Upstream commit b2a1c5ca50db22b3677676dd5bad5f6092429acf ]
struct drm_display_mode embeds a list head, so overwriting the full struct with another one will corrupt the list (if the destination mode is on a list). Use drm_mode_copy() instead which explicitly preserves the list head of the destination mode.
Even if we know the destination mode is not on any list using drm_mode_copy() seems decent as it sets a good example. Bad examples of not using it might eventually get copied into code where preserving the list head actually matters.
Obviously one case not covered here is when the mode itself is embedded in a larger structure and the whole structure is copied. But if we are careful when copying into modes embedded in structures I think we can be a little more reassured that bogus list heads haven't been propagated in.
@is_mode_copy@
@@drm_mode_copy(...)
{
...
}
@depends on !is_mode_copy@
struct drm_display_mode *mode;
expression E, S;
@@
(
- *mode = E
+ drm_mode_copy(mode, &E)
|
- memcpy(mode, E, S)
+ drm_mode_copy(mode, E)
)
@depends on !is_mode_copy@
struct drm_display_mode mode;
expression E;
@@
(
- mode = E
+ drm_mode_copy(&mode, &E)
|
- memcpy(&mode, E, S)
+ drm_mode_copy(&mode, E)
)
@@
struct drm_display_mode *mode;
@@
- &*mode
+ mode
--- drivers/gpu/drm/msm/dp/dp_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dp/dp_display.c +1 -1
@@ -840,7 +840,7 @@ static int dp_display_set_mode(struct msm_dp *dp_display, dp = container_of(dp_display, struct dp_display_private, dp_display); - dp->panel->dp_mode.drm_mode = mode->drm_mode; +drm_mode_copy (&dp->panel->dp_mode.drm_mode, &mode->drm_mode); dp->panel->dp_mode.bpp = mode->bpp; dp->panel->dp_mode.capabilities = mode->capabilities;dp_panel_init_panel_info (dp->panel);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 650/731 drm/rockchip: Use drm_mode_copy()
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
[ Upstream commit 2bfaa28000d2830d3209161a4541cce0660e1b84 ]
struct drm_display_mode embeds a list head, so overwriting the full struct with another one will corrupt the list (if the destination mode is on a list). Use drm_mode_copy() instead which explicitly preserves the list head of the destination mode.
Even if we know the destination mode is not on any list using drm_mode_copy() seems decent as it sets a good example. Bad examples of not using it might eventually get copied into code where preserving the list head actually matters.
Obviously one case not covered here is when the mode itself is embedded in a larger structure and the whole structure is copied. But if we are careful when copying into modes embedded in structures I think we can be a little more reassured that bogus list heads haven't been propagated in.
@is_mode_copy@
@@drm_mode_copy(...)
{
...
}
@depends on !is_mode_copy@
struct drm_display_mode *mode;
expression E, S;
@@
(
- *mode = E
+ drm_mode_copy(mode, &E)
|
- memcpy(mode, E, S)
+ drm_mode_copy(mode, E)
)
@depends on !is_mode_copy@
struct drm_display_mode mode;
expression E;
@@
(
- mode = E
+ drm_mode_copy(&mode, &E)
|
- memcpy(&mode, E, S)
+ drm_mode_copy(&mode, E)
)
@@
struct drm_display_mode *mode;
@@
- &*mode
+ mode
--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +- drivers/gpu/drm/rockchip/inno_hdmi.c | 2 +- drivers/gpu/drm/rockchip/rk3066_hdmi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/rockchip/cdn-dp-core.c +1 -1
@@ -565,7 +565,7 @@ static void cdn_dp_encoder_mode_set(struct drm_encoder *encoder, video->v_sync_polarity = !!(mode->flags &DRM_MODE_FLAG_NVSYNC ); video->h_sync_polarity = !!(mode->flags &DRM_MODE_FLAG_NHSYNC ); -memcpy (&dp->mode, adjusted,sizeof (*mode)); +drm_mode_copy (&dp->mode, adjusted); }static bool cdn_dp_check_link_status (struct cdn_dp_device *dp)
drivers/gpu/drm/rockchip/inno_hdmi.c +1 -1
@@ -488,7 +488,7 @@ static void inno_hdmi_encoder_mode_set(struct drm_encoder *encoder,inno_hdmi_setup (hdmi, adj_mode);/* Store the display mode for plugin/DPMS poweron events */ -memcpy (&hdmi->previous_mode, adj_mode,sizeof (hdmi->previous_mode)); +drm_mode_copy (&hdmi->previous_mode, adj_mode); }static void inno_hdmi_encoder_enable (struct drm_encoder *encoder)
drivers/gpu/drm/rockchip/rk3066_hdmi.c +1 -1
@@ -383,7 +383,7 @@ rk3066_hdmi_encoder_mode_set(struct drm_encoder *encoder,struct rk3066_hdmi *hdmi =to_rk3066_hdmi (encoder);/* Store the display mode for plugin/DPMS poweron events. */ -memcpy (&hdmi->previous_mode, adj_mode,sizeof (hdmi->previous_mode)); +drm_mode_copy (&hdmi->previous_mode, adj_mode); }static void rk3066_hdmi_encoder_enable (struct drm_encoder *encoder)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 651/731 drm/sti: Use drm_mode_copy()
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
[ Upstream commit 442cf8e22ba25a77cb9092d78733fdbac9844e50 ]
struct drm_display_mode embeds a list head, so overwriting the full struct with another one will corrupt the list (if the destination mode is on a list). Use drm_mode_copy() instead which explicitly preserves the list head of the destination mode.
Even if we know the destination mode is not on any list using drm_mode_copy() seems decent as it sets a good example. Bad examples of not using it might eventually get copied into code where preserving the list head actually matters.
Obviously one case not covered here is when the mode itself is embedded in a larger structure and the whole structure is copied. But if we are careful when copying into modes embedded in structures I think we can be a little more reassured that bogus list heads haven't been propagated in.
@is_mode_copy@
@@drm_mode_copy(...)
{
...
}
@depends on !is_mode_copy@
struct drm_display_mode *mode;
expression E, S;
@@
(
- *mode = E
+ drm_mode_copy(mode, &E)
|
- memcpy(mode, E, S)
+ drm_mode_copy(mode, E)
)
@depends on !is_mode_copy@
struct drm_display_mode mode;
expression E;
@@
(
- mode = E
+ drm_mode_copy(&mode, &E)
|
- memcpy(&mode, E, S)
+ drm_mode_copy(&mode, E)
)
@@
struct drm_display_mode *mode;
@@
- &*mode
+ mode
--- drivers/gpu/drm/sti/sti_dvo.c | 2 +- drivers/gpu/drm/sti/sti_hda.c | 2 +- drivers/gpu/drm/sti/sti_hdmi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/sti/sti_dvo.c +1 -1
@@ -288,7 +288,7 @@ static void sti_dvo_set_mode(struct drm_bridge *bridge,DRM_DEBUG_DRIVER ("\n" ); -memcpy (&dvo->mode, mode,sizeof (struct drm_display_mode )); +drm_mode_copy (&dvo->mode, mode);/* According to the path used (main or aux), the dvo clocks should * have a different parent clock. */
drivers/gpu/drm/sti/sti_hda.c +1 -1
@@ -523,7 +523,7 @@ static void sti_hda_set_mode(struct drm_bridge *bridge,DRM_DEBUG_DRIVER ("\n" ); -memcpy (&hda->mode, mode,sizeof (struct drm_display_mode )); +drm_mode_copy (&hda->mode, mode);if (!hda_get_mode_idx (hda->mode, &mode_idx)) {DRM_ERROR ("Undefined mode\n" );
drivers/gpu/drm/sti/sti_hdmi.c +1 -1
@@ -940,7 +940,7 @@ static void sti_hdmi_set_mode(struct drm_bridge *bridge,DRM_DEBUG_DRIVER ("\n" );/* Copy the drm display mode in the connector local structure */ -memcpy (&hdmi->mode, mode,sizeof (struct drm_display_mode )); +drm_mode_copy (&hdmi->mode, mode);/* Update clock framerate according to the selected mode */ ret =clk_set_rate (hdmi->clk_pix, mode->clock *1000 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 652/731 drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 890d637523eec9d730e3885532fa1228ba678880 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/gpu/drm/mediatek/mtk_hdmi.c:1407:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' with an expression of type 'int (struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.mode_valid = mtk_hdmi_bridge_mode_valid,
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
->mode_valid() in 'struct drm_bridge_funcs' expects a return type of 'enum drm_mode_status', not 'int'. Adjust the return type of mtk_hdmi_bridge_mode_valid() to match the prototype's to resolve the warning and CFI failure.
--- drivers/gpu/drm/mediatek/mtk_hdmi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/mediatek/mtk_hdmi.c +4 -3
@@ -1203,9 +1203,10 @@ static enum drm_connector_status mtk_hdmi_detect(struct mtk_hdmi *hdmi)return mtk_hdmi_update_plugged_status (hdmi); } -static int mtk_hdmi_bridge_mode_valid (struct drm_bridge *bridge, -const struct drm_display_info *info, -const struct drm_display_mode *mode) +static enum drm_mode_status +mtk_hdmi_bridge_mode_valid (struct drm_bridge *bridge, +const struct drm_display_info *info, +const struct drm_display_mode *mode) {struct mtk_hdmi *hdmi =hdmi_ctx_from_bridge (bridge);struct drm_bridge *next_bridge;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 653/731 drivers/md/md-bitmap: check the return value of md_bitmap_get_counter()
In reply to Greg Kroah-HartmanFrom: Li Zhong <[email protected]>
[ Upstream commit 3bd548e5b819b8c0f2c9085de775c5c7bff9052f ]
Check the return value of md_bitmap_get_counter() in case it returns NULL pointer, which will result in a null pointer dereference.
v2: update the check to include other dereference
--- drivers/md/md-bitmap.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/md/md-bitmap.c +15 -12
@@ -2196,20 +2196,23 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,if (set) { bmc_new =md_bitmap_get_counter (&bitmap->counts, block, &new_blocks,1 ); -if (*bmc_new ==0 ) { -/* need to set on-disk bits too. */ -sector_t end = block + new_blocks; -sector_t start = block >> chunkshift; - start <<= chunkshift; -while (start < end) { -md_bitmap_file_set_bit (bitmap, block); - start +=1 << chunkshift; +if (bmc_new) { +if (*bmc_new ==0 ) { +/* need to set on-disk bits too. */ +sector_t end = block + new_blocks; +sector_t start = block >> chunkshift; + + start <<= chunkshift; +while (start < end) { +md_bitmap_file_set_bit (bitmap, block); + start +=1 << chunkshift; + } + *bmc_new =2 ; +md_bitmap_count_page (&bitmap->counts, block,1 ); +md_bitmap_set_pending (&bitmap->counts, block); } - *bmc_new =2 ; -md_bitmap_count_page (&bitmap->counts, block,1 ); -md_bitmap_set_pending (&bitmap->counts, block); + *bmc_new |=NEEDED_MASK ; } - *bmc_new |=NEEDED_MASK ;if (new_blocks < old_blocks) old_blocks = new_blocks; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 654/731 md/raid1: stop mdx_raid1 thread when raid1 array run failed
In reply to Greg Kroah-HartmanFrom: Jiang Li <[email protected]>
[ Upstream commit b611ad14006e5be2170d9e8e611bf49dff288911 ]
fail run raid1 array when we assemble array with the inactive disk only, but the mdx_raid1 thread were not stop, Even if the associated resources have been released. it will caused a NULL dereference when we do poweroff.
This causes the following Oops:
[ 287.587787] BUG: kernel NULL pointer dereference, address: 0000000000000070
[ 287.594762] #PF: supervisor read access in kernel mode
[ 287.599912] #PF: error_code(0x0000) - not-present page
[ 287.605061] PGD 0 P4D 0
[ 287.607612] Oops: 0000 [#1] SMP NOPTI
[ 287.611287] CPU: 3 PID: 5265 Comm: md0_raid1 Tainted: G U 5.10.146 #0
[ 287.619029] Hardware name: xxxxxxx/To be filled by O.E.M, BIOS 5.19 06/16/2022
[ 287.626775] RIP: 0010:md_check_recovery+0x57/0x500 [md_mod]
[ 287.632357] Code: fe 01 00 00 48 83 bb 10 03 00 00 00 74 08 48 89 ......
[ 287.651118] RSP: 0018:ffffc90000433d78 EFLAGS: 00010202
[ 287.656347] RAX: 0000000000000000 RBX: ffff888105986800 RCX: 0000000000000000
[ 287.663491] RDX: ffffc90000433bb0 RSI: 00000000ffffefff RDI: ffff888105986800
[ 287.670634] RBP: ffffc90000433da0 R08: 0000000000000000 R09: c0000000ffffefff
[ 287.677771] R10: 0000000000000001 R11: ffffc90000433ba8 R12: ffff888105986800
[ 287.684907] R13: 0000000000000000 R14: fffffffffffffe00 R15: ffff888100b6b500
[ 287.692052] FS: 0000000000000000(0000) GS:ffff888277f80000(0000) knlGS:0000000000000000
[ 287.700149] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 287.705897] CR2: 0000000000000070 CR3: 000000000320a000 CR4: 0000000000350ee0
[ 287.713033] Call Trace:
[ 287.715498] raid1d+0x6c/0xbbb [raid1]
[ 287.719256] ? __schedule+0x1ff/0x760
[ 287.722930] ? schedule+0x3b/0xb0
[ 287.726260] ? schedule_timeout+0x1ed/0x290
[ 287.730456] ? __switch_to+0x11f/0x400
[ 287.734219] md_thread+0xe9/0x140 [md_mod]
[ 287.738328] ? md_thread+0xe9/0x140 [md_mod]
[ 287.742601] ? wait_woken+0x80/0x80
[ 287.746097] ? md_register_thread+0xe0/0xe0 [md_mod]
[ 287.751064] kthread+0x11a/0x140
[ 287.754300] ? kthread_park+0x90/0x90
[ 287.757974] ret_from_fork+0x1f/0x30In fact, when raid1 array run fail, we need to domd_unregister_thread() before raid1_free().
--- drivers/md/raid1.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/raid1.c +1 -0
@@ -3141,6 +3141,7 @@ static int raid1_run(struct mddev *mddev)* RAID1 needs at least one disk in active */ if (conf->raid_disks - mddev->degraded <1 ) { +md_unregister_thread (&conf->thread); ret = -EINVAL ; goto abort; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 655/731 drm/amd/display: fix array index out of bound error in bios parser
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
[ Upstream commit 4fc1ba4aa589ca267468ad23fedef37562227d32 ]
[Why&How]
Firmware headers dictate that gpio_pin array only has a size of 8. The count returned from vbios however is greater than 8.
Fix this by not using array indexing but incrementing the pointer since gpio_pin definition in atomfirmware.h is hardcoded to size 8
--- .../gpu/drm/amd/display/dc/bios/bios_parser2.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +7 -9
@@ -352,6 +352,7 @@ static enum bp_result get_gpio_i2c_info(uint32_t count =0 ;unsigned int table_index =0 ;bool find_valid = false; +struct atom_gpio_pin_assignment *pin;if (!info)return BP_RESULT_BADINPUT ;
@@ -379,20 +380,17 @@ static enum bp_result get_gpio_i2c_info( - sizeof(struct atom_common_table_header)) /sizeof (struct atom_gpio_pin_assignment ); + pin = (struct atom_gpio_pin_assignment *) header->gpio_pin; +for (table_index =0 ; table_index < count; table_index++) { -if (((record->i2c_id &I2C_HW_CAP ) == ( - header->gpio_pin[table_index].gpio_id & -I2C_HW_CAP )) && - ((record->i2c_id &I2C_HW_ENGINE_ID_MASK ) == - (header->gpio_pin[table_index].gpio_id & -I2C_HW_ENGINE_ID_MASK )) && - ((record->i2c_id &I2C_HW_LANE_MUX ) == - (header->gpio_pin[table_index].gpio_id & -I2C_HW_LANE_MUX ))) { +if (((record->i2c_id &I2C_HW_CAP ) == (pin->gpio_id &I2C_HW_CAP )) && + ((record->i2c_id &I2C_HW_ENGINE_ID_MASK ) == (pin->gpio_id &I2C_HW_ENGINE_ID_MASK )) && + ((record->i2c_id &I2C_HW_LANE_MUX ) == (pin->gpio_id &I2C_HW_LANE_MUX ))) {/* still valid */ find_valid = true;break ; } + pin = (struct atom_gpio_pin_assignment *)((uint8_t *)pin +sizeof (struct atom_gpio_pin_assignment )); }/* If we don't find the entry that we are looking for then
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 656/731 net: add atomic_long_t to net_device_stats fields
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 6c1c5097781f563b70a81683ea6fdac21637573b ]
Long standing KCSAN issues are caused by data-race around some dev->stats changes.
Most performance critical paths already use per-cpu variables, or per-queue ones.
It is reasonable (and more correct) to use atomic operations for the slow paths.
This patch adds an union for each field of net_device_stats, so that we can convert paths that are not yet protected by a spinlock or a mutex.
netdev_stats_to_stats64() no longer has an #if BITS_PER_LONG==64
Note that the memcpy() we were using on 64bit arches had no provision to avoid load-tearing,
while atomic_long_read() is providing the needed protection at no cost.
--- include/linux/netdevice.h | 58 +++++++++++++++++++++++---------------- include/net/dst.h | 5 ++-- net/core/dev.c | 14 ++-------- 3 files changed, 40 insertions(+), 37 deletions(-)
include/linux/netdevice.h +35 -23
@@ -167,31 +167,38 @@ static inline bool dev_xmit_complete(int rc)* (unsigned long) so they can be read and written atomically. */ +#define NET_DEV_STAT (FIELD ) \ + union { \ + unsigned long FIELD; \ + atomic_long_t __##FIELD; \ + } +struct net_device_stats { -unsigned long rx_packets; -unsigned long tx_packets; -unsigned long rx_bytes; -unsigned long tx_bytes; -unsigned long rx_errors; -unsigned long tx_errors; -unsigned long rx_dropped; -unsigned long tx_dropped; -unsigned long multicast; -unsigned long collisions; -unsigned long rx_length_errors; -unsigned long rx_over_errors; -unsigned long rx_crc_errors; -unsigned long rx_frame_errors; -unsigned long rx_fifo_errors; -unsigned long rx_missed_errors; -unsigned long tx_aborted_errors; -unsigned long tx_carrier_errors; -unsigned long tx_fifo_errors; -unsigned long tx_heartbeat_errors; -unsigned long tx_window_errors; -unsigned long rx_compressed; -unsigned long tx_compressed; +NET_DEV_STAT (rx_packets); +NET_DEV_STAT (tx_packets); +NET_DEV_STAT (rx_bytes); +NET_DEV_STAT (tx_bytes); +NET_DEV_STAT (rx_errors); +NET_DEV_STAT (tx_errors); +NET_DEV_STAT (rx_dropped); +NET_DEV_STAT (tx_dropped); +NET_DEV_STAT (multicast); +NET_DEV_STAT (collisions); +NET_DEV_STAT (rx_length_errors); +NET_DEV_STAT (rx_over_errors); +NET_DEV_STAT (rx_crc_errors); +NET_DEV_STAT (rx_frame_errors); +NET_DEV_STAT (rx_fifo_errors); +NET_DEV_STAT (rx_missed_errors); +NET_DEV_STAT (tx_aborted_errors); +NET_DEV_STAT (tx_carrier_errors); +NET_DEV_STAT (tx_fifo_errors); +NET_DEV_STAT (tx_heartbeat_errors); +NET_DEV_STAT (tx_window_errors); +NET_DEV_STAT (rx_compressed); +NET_DEV_STAT (tx_compressed); }; +#undef NET_DEV_STAT#include <linux/cache.h>
@@ -5477,4 +5484,9 @@ extern struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;extern struct net_device *blackhole_netdev; +/* Note: Avoid these macros in fast path, prefer per-cpu or per-queue counters. */ +#define DEV_STATS_INC (DEV ,FIELD ) atomic_long_inc(&(DEV)->stats.__##FIELD) +#define DEV_STATS_ADD (DEV ,FIELD ,VAL ) \ + atomic_long_add((VAL), &(DEV)->stats.__##FIELD) +#endif /* _LINUX_NETDEVICE_H */
include/net/dst.h +2 -3
@@ -361,9 +361,8 @@ static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev,static inline void skb_tunnel_rx (struct sk_buff *skb,struct net_device *dev,struct net *net) { -/* TODO : stats should be SMP safe */ - dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; +DEV_STATS_INC (dev, rx_packets); +DEV_STATS_ADD (dev, rx_bytes, skb->len);__skb_tunnel_rx (skb, dev, net); }
net/core/dev.c +3 -11
@@ -10640,24 +10640,16 @@ void netdev_run_todo(void)void netdev_stats_to_stats64 (struct rtnl_link_stats64 *stats64,const struct net_device_stats *netdev_stats) { -#if BITS_PER_LONG ==64 -BUILD_BUG_ON (sizeof (*stats64) <sizeof (*netdev_stats)); -memcpy (stats64, netdev_stats,sizeof (*netdev_stats)); -/* zero out counters that only exist in rtnl_link_stats64 */ -memset ((char *)stats64 +sizeof (*netdev_stats),0 , -sizeof (*stats64) -sizeof (*netdev_stats)); -#else -size_t i, n =sizeof (*netdev_stats) /sizeof (unsigned long ); -const unsigned long *src = (const unsigned long *)netdev_stats; +size_t i, n =sizeof (*netdev_stats) /sizeof (atomic_long_t); +const atomic_long_t *src = (atomic_long_t *)netdev_stats;u64 *dst = (u64 *)stats64;BUILD_BUG_ON (n >sizeof (*stats64) /sizeof (u64));for (i =0 ; i < n; i++) - dst[i] = src[i]; + dst[i] =atomic_long_read (&src[i]);/* zero out counters that only exist in rtnl_link_stats64 */ memset ((char *)stats64 + n *sizeof (u64),0 ,sizeof (*stats64) - n *sizeof (u64)); -#endif }EXPORT_SYMBOL (netdev_stats_to_stats64);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 657/731 ipv6/sit: use DEV_STATS_INC() to avoid data-races
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit cb34b7cf17ecf33499c9298943f85af247abc1e9 ]
syzbot/KCSAN reported that multiple cpus are updating dev->stats.tx_error concurrently.
This is because sit tunnels are NETIF_F_LLTX, meaning their ndo_start_xmit() is not protected by a spinlock.
While original KCSAN report was about tx path, rx path has the same issue.
--- net/ipv6/sit.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
net/ipv6/sit.c +11 -11
@@ -696,7 +696,7 @@ static int ipip6_rcv(struct sk_buff *skb) skb->dev = tunnel->dev;if (packet_is_spoofed (skb, iph, tunnel)) { - tunnel->dev->stats.rx_errors++; +DEV_STATS_INC (tunnel->dev, rx_errors); goto out; }
@@ -716,8 +716,8 @@ static int ipip6_rcv(struct sk_buff *skb)net_info_ratelimited ("non-ECT from %pI4 with TOS=%#x\n" , &iph->saddr, iph->tos);if (err >1 ) { - ++tunnel->dev->stats.rx_frame_errors; - ++tunnel->dev->stats.rx_errors; +DEV_STATS_INC (tunnel->dev, rx_frame_errors); +DEV_STATS_INC (tunnel->dev, rx_errors); goto out; } }
@@ -948,7 +948,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,if (!rt) { rt =ip_route_output_flow (tunnel->net, &fl4,NULL );if (IS_ERR (rt)) { - dev->stats.tx_carrier_errors++; +DEV_STATS_INC (dev, tx_carrier_errors); goto tx_error_icmp; }dst_cache_set_ip4 (&tunnel->dst_cache, &rt->dst, fl4.saddr);
@@ -956,14 +956,14 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,if (rt->rt_type !=RTN_UNICAST ) {ip_rt_put (rt); - dev->stats.tx_carrier_errors++; +DEV_STATS_INC (dev, tx_carrier_errors); goto tx_error_icmp; } tdev = rt->dst.dev;if (tdev == dev) {ip_rt_put (rt); - dev->stats.collisions++; +DEV_STATS_INC (dev, collisions); goto tx_error; }
@@ -976,7 +976,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, mtu =dst_mtu (&rt->dst) - t_hlen;if (mtu <IPV4_MIN_MTU ) { - dev->stats.collisions++; +DEV_STATS_INC (dev, collisions);ip_rt_put (rt); goto tx_error; }
@@ -1015,7 +1015,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,struct sk_buff *new_skb =skb_realloc_headroom (skb, max_headroom);if (!new_skb) {ip_rt_put (rt); - dev->stats.tx_dropped++; +DEV_STATS_INC (dev, tx_dropped);kfree_skb (skb);return NETDEV_TX_OK ; }
@@ -1045,7 +1045,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,dst_link_failure (skb); tx_error:kfree_skb (skb); - dev->stats.tx_errors++; +DEV_STATS_INC (dev, tx_errors);return NETDEV_TX_OK ; }
@@ -1064,7 +1064,7 @@ static netdev_tx_t sit_tunnel_xmit__(struct sk_buff *skb,return NETDEV_TX_OK ; tx_error:kfree_skb (skb); - dev->stats.tx_errors++; +DEV_STATS_INC (dev, tx_errors);return NETDEV_TX_OK ; }
@@ -1093,7 +1093,7 @@ static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb,return NETDEV_TX_OK ; tx_err: - dev->stats.tx_errors++; +DEV_STATS_INC (dev, tx_errors);kfree_skb (skb);return NETDEV_TX_OK ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 658/731 mrp: introduce active flags to prevent UAF when applicant uninit
In reply to Greg Kroah-HartmanFrom: Schspa Shi <[email protected]>
[ Upstream commit ab0377803dafc58f1e22296708c1c28e309414d6 ]
The caller of del_timer_sync must prevent restarting of the timer, If we have no this synchronization, there is a small probability that the cancellation will not be successful.
And syzbot report the fellowing crash:
==================================================================
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:929 [inline] BUG: KASAN: use-after-free in enqueue_timer+0x18/0xa4 kernel/time/timer.c:605
Write at addr f9ff000024df6058 by task syz-fuzzer/2256 Pointer tag: [f9], memory tag: [fe]
CPU: 1 PID: 2256 Comm: syz-fuzzer Not tainted 6.1.0-rc5-syzkaller-00008- ge01d50cbd6ee #0 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace.part.0+0xe0/0xf0 arch/arm64/kernel/stacktrace.c:156 dump_backtrace arch/arm64/kernel/stacktrace.c:162 [inline] show_stack+0x18/0x40 arch/arm64/kernel/stacktrace.c:163 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x68/0x84 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x1a8/0x4a0 mm/kasan/report.c:395 kasan_report+0x94/0xb4 mm/kasan/report.c:495 __do_kernel_fault+0x164/0x1e0 arch/arm64/mm/fault.c:320 do_bad_area arch/arm64/mm/fault.c:473 [inline] do_tag_check_fault+0x78/0x8c arch/arm64/mm/fault.c:749 do_mem_abort+0x44/0x94 arch/arm64/mm/fault.c:825 el1_abort+0x40/0x60 arch/arm64/kernel/entry-common.c:367 el1h_64_sync_handler+0xd8/0xe4 arch/arm64/kernel/entry-common.c:427 el1h_64_sync+0x64/0x68 arch/arm64/kernel/entry.S:576 hlist_add_head include/linux/list.h:929 [inline] enqueue_timer+0x18/0xa4 kernel/time/timer.c:605 mod_timer+0x14/0x20 kernel/time/timer.c:1161 mrp_periodic_timer_arm net/802/mrp.c:614 [inline] mrp_periodic_timer+0xa0/0xc0 net/802/mrp.c:627 call_timer_fn.constprop.0+0x24/0x80 kernel/time/timer.c:1474 expire_timers+0x98/0xc4 kernel/time/timer.c:1519
To fix it, we can introduce a new active flags to make sure the timer will not restart.
--- include/net/mrp.h | 1 + net/802/mrp.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-)
include/net/mrp.h +1 -0
@@ -120,6 +120,7 @@ struct mrp_applicant {struct sk_buff *pdu;struct rb_root mad;struct rcu_head rcu; +bool active; };struct mrp_port {
net/802/mrp.c +13 -5
@@ -606,7 +606,10 @@ static void mrp_join_timer(struct timer_list *t)spin_unlock (&app->lock);mrp_queue_xmit (app); -mrp_join_timer_arm (app); +spin_lock (&app->lock); +if (likely (app->active)) +mrp_join_timer_arm (app); +spin_unlock (&app->lock); }static void mrp_periodic_timer_arm (struct mrp_applicant *app)
@@ -620,11 +623,12 @@ static void mrp_periodic_timer(struct timer_list *t)struct mrp_applicant *app =from_timer (app, t, periodic_timer);spin_lock (&app->lock); -mrp_mad_event (app,MRP_EVENT_PERIODIC ); -mrp_pdu_queue (app); +if (likely (app->active)) { +mrp_mad_event (app,MRP_EVENT_PERIODIC ); +mrp_pdu_queue (app); +mrp_periodic_timer_arm (app); + }spin_unlock (&app->lock); - -mrp_periodic_timer_arm (app); }static int mrp_pdu_parse_end_mark (struct sk_buff *skb,int *offset)
@@ -872,6 +876,7 @@ int mrp_init_applicant(struct net_device *dev, struct mrp_application *appl) app->dev = dev; app->app = appl; app->mad =RB_ROOT ; + app->active = true;spin_lock_init (&app->lock);skb_queue_head_init (&app->queue);rcu_assign_pointer (dev->mrp_port->applicants[appl->type], app);
@@ -900,6 +905,9 @@ void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *appl)RCU_INIT_POINTER (port->applicants[appl->type],NULL ); +spin_lock_bh (&app->lock); + app->active = false; +spin_unlock_bh (&app->lock);/* Delete timer and generate a final TX event to flush out * all pending messages before the applicant is gone. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 659/731 ppp: associate skb with a device at tx
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 9f225444467b98579cf28d94f4ad053460dfdb84 ]
Syzkaller triggered flow dissector warning with the following:
r0 = openat$ppp(0xffffffffffffff9c, &(0x7f0000000000), 0xc0802, 0x0)
ioctl$PPPIOCNEWUNIT(r0, 0xc004743e, &(0x7f00000000c0))
ioctl$PPPIOCSACTIVE(r0, 0x40107446, &(0x7f0000000240)={0x2, &(0x7f0000000180)=[{0x20, 0x0, 0x0, 0xfffff034}, {0x6}]}) pwritev(r0, &(0x7f0000000040)=[{&(0x7f0000000140)='\x00!', 0x2}], 0x1, 0x0, 0x0)
[ 9.485814] WARNING: CPU: 3 PID: 329 at net/core/flow_dissector.c:1016 __skb_flow_dissect+0x1ee0/0x1fa0 [ 9.485929] skb_get_poff+0x53/0xa0 [ 9.485937] bpf_skb_get_pay_offset+0xe/0x20 [ 9.485944] ? ppp_send_frame+0xc2/0x5b0 [ 9.485949] ? _raw_spin_unlock_irqrestore+0x40/0x60 [ 9.485958] ? __ppp_xmit_process+0x7a/0xe0 [ 9.485968] ? ppp_xmit_process+0x5b/0xb0 [ 9.485974] ? ppp_write+0x12a/0x190 [ 9.485981] ? do_iter_write+0x18e/0x2d0 [ 9.485987] ? __import_iovec+0x30/0x130 [ 9.485997] ? do_pwritev+0x1b6/0x240 [ 9.486016] ? trace_hardirqs_on+0x47/0x50 [ 9.486023] ? __x64_sys_pwritev+0x24/0x30 [ 9.486026] ? do_syscall_64+0x3d/0x80 [ 9.486031] ? entry_SYSCALL_64_after_hwframe+0x63/0xcd
Flow dissector tries to find skb net namespace either via device or via socket. Neigher is set in ppp_send_frame, so let's manually use ppp->dev.
--- drivers/net/ppp/ppp_generic.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ppp/ppp_generic.c +2 -0
@@ -1742,6 +1742,8 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)int len;unsigned char *cp; + skb->dev = ppp->dev; +if (proto <0x8000 ) {#ifdef CONFIG_PPP_FILTER /* check if we should pass this packet */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 660/731 bpf: Prevent decl_tag from being referenced in func_proto arg
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit f17472d4599697d701aa239b4c475a506bccfd19 ]
Syzkaller managed to hit another decl_tag issue:
btf_func_proto_check kernel/bpf/btf.c:4506 [inline] btf_check_all_types kernel/bpf/btf.c:4734 [inline] btf_parse_type_sec+0x1175/0x1980 kernel/bpf/btf.c:4763 btf_parse kernel/bpf/btf.c:5042 [inline] btf_new_fd+0x65a/0xb00 kernel/bpf/btf.c:6709 bpf_btf_load+0x6f/0x90 kernel/bpf/syscall.c:4342 __sys_bpf+0x50a/0x6c0 kernel/bpf/syscall.c:5034 __do_sys_bpf kernel/bpf/syscall.c:5093 [inline] __se_sys_bpf kernel/bpf/syscall.c:5091 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5091 do_syscall_64+0x54/0x70 arch/x86/entry/common.c:48
This seems similar to commit ea68376c8bed ("bpf: prevent decl_tag from being referenced in func_proto") but for the argument.
--- kernel/bpf/btf.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/bpf/btf.c +5 -0
@@ -3864,6 +3864,11 @@ static int btf_func_proto_check(struct btf_verifier_env *env,break ; } +if (btf_type_is_resolve_source_only (arg_type)) { +btf_verifier_log_type (env, t,"Invalid arg#%u" , i +1 ); +return -EINVAL ; + } +if (args[i].name_off && (!btf_name_offset_valid (btf, args[i].name_off) || !btf_name_valid_identifier (btf, args[i].name_off))) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 661/731 ethtool: avoiding integer overflow in ethtool_phys_id()
In reply to Greg Kroah-HartmanFrom: Maxim Korotkov <[email protected]>
[ Upstream commit 64a8f8f7127da228d59a39e2c5e75f86590f90b4 ]
The value of an arithmetic expression "n * id.data" is subject to possible overflow due to a failure to cast operands to a larger data type before performing arithmetic. Used macro for multiplication instead operator for avoiding overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/ethtool/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ethtool/ioctl.c +2 -1
@@ -1988,7 +1988,8 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) }else {/* Driver expects to be called at twice the frequency in rc */ int n = rc *2 , interval =HZ / n; -u64 count = n * id.data, i =0 ; +u64 count =mul_u32_u32 (n, id.data); +u64 i =0 ; do { rtnl_lock();
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 662/731 media: dvb-frontends: fix leak of memory fw
In reply to Greg Kroah-HartmanFrom: Yan Lei <[email protected]>
[ Upstream commit a15fe8d9f1bf460a804bcf18a890bfd2cf0d5caa ]
--- drivers/media/dvb-frontends/bcm3510.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/dvb-frontends/bcm3510.c +1 -0
@@ -649,6 +649,7 @@ static int bcm3510_download_firmware(struct dvb_frontend* fe)deb_info ("firmware chunk, addr: 0x%04x, len: 0x%04x, total length: 0x%04zx\n" ,addr,len,fw->size);if ((ret =bcm3510_write_ram (st,addr,&b[i+4 ],len)) <0 ) {err ("firmware download failed: %d\n" ,ret); +release_firmware (fw);return ret; } i +=4 + len;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 663/731 media: dvbdev: adopts refcnt to avoid UAF
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 0fc044b2b5e2d05a1fa1fb0d7f270367a7855d79 ]
dvb_unregister_device() is known that prone to use-after-free. That is, the cleanup from dvb_unregister_device() releases the dvb_device even if there are pointers stored in file->private_data still refer to it.
This patch adds a reference counter into struct dvb_device and delays its deallocation until no pointer refers to the object.
--- drivers/media/dvb-core/dvb_ca_en50221.c | 2 +- drivers/media/dvb-core/dvb_frontend.c | 2 +- drivers/media/dvb-core/dvbdev.c | 32 +++++++++++++++++++------ include/media/dvbdev.h | 31 +++++++++++++----------- 4 files changed, 44 insertions(+), 23 deletions(-)
drivers/media/dvb-core/dvb_ca_en50221.c +1 -1
@@ -157,7 +157,7 @@ static void dvb_ca_private_free(struct dvb_ca_private *ca) {unsigned int i; -dvb_free_device (ca->dvbdev); +dvb_device_put (ca->dvbdev);for (i =0 ; i < ca->slot_count; i++)vfree (ca->slot_info[i].rx_buffer.data);
drivers/media/dvb-core/dvb_frontend.c +1 -1
@@ -136,7 +136,7 @@ static void __dvb_frontend_free(struct dvb_frontend *fe)struct dvb_frontend_private *fepriv = fe->frontend_priv;if (fepriv) -dvb_free_device (fepriv->dvbdev); +dvb_device_put (fepriv->dvbdev);dvb_frontend_invoke_release (fe, fe->ops.release);
drivers/media/dvb-core/dvbdev.c +25 -7
@@ -107,7 +107,7 @@ static int dvb_device_open(struct inode *inode, struct file *file) new_fops =fops_get (dvbdev->fops);if (!new_fops) goto fail; - file->private_data = dvbdev; + file->private_data =dvb_device_get (dvbdev);replace_fops (file, new_fops);if (file->f_op->open) err = file->f_op->open (inode, file);
@@ -171,6 +171,9 @@ int dvb_generic_release(struct inode *inode, struct file *file) } dvbdev->users++; + +dvb_device_put (dvbdev); +return 0 ; }EXPORT_SYMBOL (dvb_generic_release);
@@ -487,6 +490,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,return -ENOMEM ; } +kref_init (&dvbdev->ref);memcpy (dvbdev, template,sizeof (struct dvb_device )); dvbdev->type = type; dvbdev->id = id;
@@ -518,7 +522,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,#endif dvbdev->minor = minor; - dvb_minors[minor] = dvbdev; + dvb_minors[minor] =dvb_device_get (dvbdev);up_write (&minor_rwsem); ret =dvb_register_media_device (dvbdev, type, minor, demux_sink_pads);
@@ -563,6 +567,7 @@ void dvb_remove_device(struct dvb_device *dvbdev)down_write (&minor_rwsem); dvb_minors[dvbdev->minor] =NULL ; +dvb_device_put (dvbdev);up_write (&minor_rwsem);dvb_media_device_free (dvbdev);
@@ -574,21 +579,34 @@ void dvb_remove_device(struct dvb_device *dvbdev)EXPORT_SYMBOL (dvb_remove_device); -void dvb_free_device (struct dvb_device *dvbdev) +static void dvb_free_device (struct kref *ref) { -if (!dvbdev) -return ; + struct dvb_device *dvbdev = container_of(ref, struct dvb_device, ref);kfree (dvbdev->fops);kfree (dvbdev); } -EXPORT_SYMBOL (dvb_free_device); + + +struct dvb_device *dvb_device_get (struct dvb_device *dvbdev) +{ +kref_get (&dvbdev->ref); +return dvbdev; +} +EXPORT_SYMBOL (dvb_device_get); + + +void dvb_device_put (struct dvb_device *dvbdev) +{ +if (dvbdev) +kref_put (&dvbdev->ref, dvb_free_device); +}void dvb_unregister_device (struct dvb_device *dvbdev) {dvb_remove_device (dvbdev); -dvb_free_device (dvbdev); +dvb_device_put (dvbdev); }EXPORT_SYMBOL (dvb_unregister_device);
include/media/dvbdev.h +17 -14
@@ -156,6 +156,7 @@ struct dvb_adapter {*/ struct dvb_device {struct list_head list_head; +struct kref ref;const struct file_operations *fops;struct dvb_adapter *adapter;enum dvb_device_type type;
@@ -187,6 +188,20 @@ struct dvb_device {void *priv; }; +/** +* dvb_device_get - Increase dvb_device reference +* +* @dvbdev: pointer to struct dvb_device +*/ +struct dvb_device *dvb_device_get (struct dvb_device *dvbdev); + +/** +* dvb_device_get - Decrease dvb_device reference +* +* @dvbdev: pointer to struct dvb_device +*/ +void dvb_device_put (struct dvb_device *dvbdev); +/** * dvb_register_adapter - Registers a new DVB adapter *
@@ -231,29 +246,17 @@ int dvb_register_device(struct dvb_adapter *adap,/** * dvb_remove_device - Remove a registered DVB device * -* This does not free memory. To do that, call dvb_free_device(). +* This does not free memory. dvb_free_device() will do that when +* reference counter is empty * * @dvbdev: pointer to struct dvb_device */ void dvb_remove_device (struct dvb_device *dvbdev); -/** -* dvb_free_device - Free memory occupied by a DVB device. -* -* Call dvb_unregister_device() before calling this function. -* -* @dvbdev: pointer to struct dvb_device -*/ -void dvb_free_device (struct dvb_device *dvbdev);/** * dvb_unregister_device - Unregisters a DVB device * -* This is a combination of dvb_remove_device() and dvb_free_device(). -* Using this function is usually a mistake, and is often an indicator -* for a use-after-free bug (when a userspace process keeps a file -* handle to a detached device). -* * @dvbdev: pointer to struct dvb_device */ void dvb_unregister_device (struct dvb_device *dvbdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 664/731 media: dvb-usb: fix memory leak in dvb_usb_adapter_init()
In reply to Greg Kroah-HartmanFrom: Mazin Al Haddad <[email protected]>
[ Upstream commit 94d90fb06b94a90c176270d38861bcba34ce377d ]
Syzbot reports a memory leak in "dvb_usb_adapter_init()". The leak is due to not accounting for and freeing current iteration's adapter->priv in case of an error. Currently if an error occurs, it will exit before incrementing "num_adapters_initalized", which is used as a reference counter to free all adap->priv in "dvb_usb_adapter_exit()". There are multiple error paths that can exit from before incrementing the counter. Including the error handling paths for "dvb_usb_adapter_stream_init()", "dvb_usb_adapter_dvb_init()" and "dvb_usb_adapter_frontend_init()" within "dvb_usb_adapter_init()".
This means that in case of an error in any of these functions the current iteration is not accounted for and the current iteration's adap->priv is not freed.
Fix this by freeing the current iteration's adap->priv in the "stream_init_err:" label in the error path. The rest of the (accounted for) adap->priv objects are freed in dvb_usb_adapter_exit() as expected using the num_adapters_initalized variable.
Syzbot report:
BUG: memory leak
unreferenced object 0xffff8881172f1a00 (size 512):
comm "kworker/0:2", pid 139, jiffies 4294994873 (age 10.960s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff844af012>] dvb_usb_adapter_init drivers/media/usb/dvb-usb/dvb-usb-init.c:75 [inline]
[<ffffffff844af012>] dvb_usb_init drivers/media/usb/dvb-usb/dvb-usb-init.c:184 [inline]
[<ffffffff844af012>] dvb_usb_device_init.cold+0x4e5/0x79e drivers/media/usb/dvb-usb/dvb-usb-init.c:308
[<ffffffff830db21d>] dib0700_probe+0x8d/0x1b0 drivers/media/usb/dvb-usb/dib0700_core.c:883
[<ffffffff82d3fdc7>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
[<ffffffff8274ab37>] call_driver_probe drivers/base/dd.c:542 [inline]
[<ffffffff8274ab37>] really_probe.part.0+0xe7/0x310 drivers/base/dd.c:621
[<ffffffff8274ae6c>] really_probe drivers/base/dd.c:583 [inline]
[<ffffffff8274ae6c>] __driver_probe_device+0x10c/0x1e0 drivers/base/dd.c:752
[<ffffffff8274af6a>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:782
[<ffffffff8274b786>] __device_attach_driver+0xf6/0x140 drivers/base/dd.c:899
[<ffffffff82747c87>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:427
[<ffffffff8274b352>] __device_attach+0x122/0x260 drivers/base/dd.c:970
[<ffffffff827498f6>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:487
[<ffffffff82745cdb>] device_add+0x5fb/0xdf0 drivers/base/core.c:3405
[<ffffffff82d3d202>] usb_set_configuration+0x8f2/0xb80 drivers/usb/core/message.c:2170
[<ffffffff82d4dbfc>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
[<ffffffff82d3f49c>] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
[<ffffffff8274ab37>] call_driver_probe drivers/base/dd.c:542 [inline]
[<ffffffff8274ab37>] really_probe.part.0+0xe7/0x310 drivers/base/dd.c:621
[<ffffffff8274ae6c>] really_probe drivers/base/dd.c:583 [inline]
[<ffffffff8274ae6c>] __driver_probe_device+0x10c/0x1e0 drivers/base/dd.c:752--- drivers/media/usb/dvb-usb/dvb-usb-init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb/dvb-usb-init.c +3 -1
@@ -81,7 +81,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) ret =dvb_usb_adapter_stream_init (adap);if (ret) -return ret; + goto stream_init_err; ret =dvb_usb_adapter_dvb_init (adap, adapter_nrs);if (ret)
@@ -114,6 +114,8 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)dvb_usb_adapter_dvb_exit (adap); dvb_init_err:dvb_usb_adapter_stream_exit (adap); +stream_init_err: +kfree (adap->priv);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 665/731 blk-mq: fix possible memleak when register hctx failed
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit 4b7a21c57b14fbcd0e1729150189e5933f5088e9 ]
There's issue as follows when do fault injection test:
unreferenced object 0xffff888132a9f400 (size 512):
comm "insmod", pid 308021, jiffies 4324277909 (age 509.733s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 08 f4 a9 32 81 88 ff ff ...........2....
08 f4 a9 32 81 88 ff ff 00 00 00 00 00 00 00 00 ...2............
backtrace:
[<00000000e8952bb4>] kmalloc_node_trace+0x22/0xa0
[<00000000f9980e0f>] blk_mq_alloc_and_init_hctx+0x3f1/0x7e0
[<000000002e719efa>] blk_mq_realloc_hw_ctxs+0x1e6/0x230
[<000000004f1fda40>] blk_mq_init_allocated_queue+0x27e/0x910
[<00000000287123ec>] __blk_mq_alloc_disk+0x67/0xf0
[<00000000a2a34657>] 0xffffffffa2ad310f
[<00000000b173f718>] 0xffffffffa2af824a
[<0000000095a1dabb>] do_one_initcall+0x87/0x2a0
[<00000000f32fdf93>] do_init_module+0xdf/0x320
[<00000000cbe8541e>] load_module+0x3006/0x3390
[<0000000069ed1bdb>] __do_sys_finit_module+0x113/0x1b0
[<00000000a1a29ae8>] do_syscall_64+0x35/0x80
[<000000009cd878b0>] entry_SYSCALL_64_after_hwframe+0x46/0xb0Fault injection context as follows:
kobject_add
blk_mq_register_hctx
blk_mq_sysfs_register
blk_register_queue
device_add_disk
null_add_dev.part.0 [null_blk]
As 'blk_mq_register_hctx' may already add some objects when failed halfway, but there isn't do fallback, caller don't know which objects add failed. To solve above issue just do fallback when add objects failed halfway in 'blk_mq_register_hctx'.
--- block/blk-mq-sysfs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
block/blk-mq-sysfs.c +9 -2
@@ -187,7 +187,7 @@ static int blk_mq_register_hctx(struct blk_mq_hw_ctx *hctx) {struct request_queue *q = hctx->queue;struct blk_mq_ctx *ctx; -int i, ret; +int i, j, ret;if (!hctx->nr_ctx)return 0 ;
@@ -199,9 +199,16 @@ static int blk_mq_register_hctx(struct blk_mq_hw_ctx *hctx)hctx_for_each_ctx (hctx, ctx, i) { ret =kobject_add (&ctx->kobj, &hctx->kobj,"cpu%u" , ctx->cpu);if (ret) -break ; + goto out; } +return 0 ; +out: +hctx_for_each_ctx (hctx, ctx, j) { +if (j < i) +kobject_del (&ctx->kobj); + } +kobject_del (&hctx->kobj);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 666/731 drm/amd/display: Use the largest vready_offset in pipe group
In reply to Greg Kroah-HartmanFrom: Wesley Chalmers <[email protected]>
[ Upstream commit 5842abd985b792a3b13a89b6dae4869b56656c92 ]
[WHY]
Corruption can occur in LB if vready_offset is not large enough. DML calculates vready_offset for each pipe, but we currently select the top pipe's vready_offset, which is not necessarily enough for all pipes in the group.
[HOW]
Wherever program_global_sync is currently called, iterate through the entire pipe group and find the highest vready_offset.
--- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 30 +++++++++++++++++-- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 29 ++++++++++++++++-- 2 files changed, 55 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +28 -2
@@ -804,6 +804,32 @@ static void false_optc_underflow_wa( tg->funcs->clear_optc_underflow (tg); } +static int calculate_vready_offset_for_group (struct pipe_ctx *pipe) +{ +struct pipe_ctx *other_pipe; +int vready_offset = pipe->pipe_dlg_param.vready_offset; + +/* Always use the largest vready_offset of all connected pipes */ +for (other_pipe = pipe->bottom_pipe; other_pipe !=NULL ; other_pipe = other_pipe->bottom_pipe) { +if (other_pipe->pipe_dlg_param.vready_offset > vready_offset) + vready_offset = other_pipe->pipe_dlg_param.vready_offset; + } +for (other_pipe = pipe->top_pipe; other_pipe !=NULL ; other_pipe = other_pipe->top_pipe) { +if (other_pipe->pipe_dlg_param.vready_offset > vready_offset) + vready_offset = other_pipe->pipe_dlg_param.vready_offset; + } +for (other_pipe = pipe->next_odm_pipe; other_pipe !=NULL ; other_pipe = other_pipe->next_odm_pipe) { +if (other_pipe->pipe_dlg_param.vready_offset > vready_offset) + vready_offset = other_pipe->pipe_dlg_param.vready_offset; + } +for (other_pipe = pipe->prev_odm_pipe; other_pipe !=NULL ; other_pipe = other_pipe->prev_odm_pipe) { +if (other_pipe->pipe_dlg_param.vready_offset > vready_offset) + vready_offset = other_pipe->pipe_dlg_param.vready_offset; + } + +return vready_offset; +} + enum dc_status dcn10_enable_stream_timing( struct pipe_ctx *pipe_ctx, struct dc_state *context,
@@ -838,7 +864,7 @@ enum dc_status dcn10_enable_stream_timing( pipe_ctx->stream_res.tg->funcs->program_timing( pipe_ctx->stream_res.tg, &stream->timing, - pipe_ctx->pipe_dlg_param.vready_offset, + calculate_vready_offset_for_group(pipe_ctx), pipe_ctx->pipe_dlg_param.vstartup_start, pipe_ctx->pipe_dlg_param.vupdate_offset, pipe_ctx->pipe_dlg_param.vupdate_width,
@@ -2776,7 +2802,7 @@ void dcn10_program_pipe( pipe_ctx->stream_res.tg->funcs->program_global_sync ( pipe_ctx->stream_res.tg, - pipe_ctx->pipe_dlg_param.vready_offset, +calculate_vready_offset_for_group (pipe_ctx), pipe_ctx->pipe_dlg_param.vstartup_start, pipe_ctx->pipe_dlg_param.vupdate_offset, pipe_ctx->pipe_dlg_param.vupdate_width);
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +27 -2
@@ -1564,6 +1564,31 @@ static void dcn20_update_dchubp_dpp( hubp->funcs->set_blank (hubp, false); } +static int calculate_vready_offset_for_group (struct pipe_ctx *pipe) +{ +struct pipe_ctx *other_pipe; +int vready_offset = pipe->pipe_dlg_param.vready_offset; + +/* Always use the largest vready_offset of all connected pipes */ +for (other_pipe = pipe->bottom_pipe; other_pipe !=NULL ; other_pipe = other_pipe->bottom_pipe) { +if (other_pipe->pipe_dlg_param.vready_offset > vready_offset) + vready_offset = other_pipe->pipe_dlg_param.vready_offset; + } +for (other_pipe = pipe->top_pipe; other_pipe !=NULL ; other_pipe = other_pipe->top_pipe) { +if (other_pipe->pipe_dlg_param.vready_offset > vready_offset) + vready_offset = other_pipe->pipe_dlg_param.vready_offset; + } +for (other_pipe = pipe->next_odm_pipe; other_pipe !=NULL ; other_pipe = other_pipe->next_odm_pipe) { +if (other_pipe->pipe_dlg_param.vready_offset > vready_offset) + vready_offset = other_pipe->pipe_dlg_param.vready_offset; + } +for (other_pipe = pipe->prev_odm_pipe; other_pipe !=NULL ; other_pipe = other_pipe->prev_odm_pipe) { +if (other_pipe->pipe_dlg_param.vready_offset > vready_offset) + vready_offset = other_pipe->pipe_dlg_param.vready_offset; + } + +return vready_offset; +} static void dcn20_program_pipe( struct dc *dc,
@@ -1582,7 +1607,7 @@ static void dcn20_program_pipe( pipe_ctx->stream_res.tg->funcs->program_global_sync ( pipe_ctx->stream_res.tg, - pipe_ctx->pipe_dlg_param.vready_offset, +calculate_vready_offset_for_group (pipe_ctx), pipe_ctx->pipe_dlg_param.vstartup_start, pipe_ctx->pipe_dlg_param.vupdate_offset, pipe_ctx->pipe_dlg_param.vupdate_width);
@@ -1875,7 +1900,7 @@ bool dcn20_update_bandwidth( pipe_ctx->stream_res.tg->funcs->program_global_sync ( pipe_ctx->stream_res.tg, - pipe_ctx->pipe_dlg_param.vready_offset, +calculate_vready_offset_for_group (pipe_ctx), pipe_ctx->pipe_dlg_param.vstartup_start, pipe_ctx->pipe_dlg_param.vupdate_offset, pipe_ctx->pipe_dlg_param.vupdate_width);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 667/731 libbpf: Avoid enum forward-declarations in public API in C++ mode
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit b42693415b86f608049cf1b4870adc1dc65e58b0 ]
C++ enum forward declarations are fundamentally not compatible with pure C enum definitions, and so libbpf's use of enum bpf_stats_type; forward declaration in libbpf/bpf.h public API header is causing C++ compilation issues.
More details can be found in [0], but it comes down to C++ supporting enum forward declaration only with explicitly specified backing type:
enum bpf_stats_type: int;
In C (and I believe it's a GCC extension also), such forward declaration is simply:
enum bpf_stats_type;
Further, in Linux UAPI this enum is defined in pure C way:
enum bpf_stats_type { BPF_STATS_RUN_TIME = 0; }
And even though in both cases backing type is int, which can be confirmed by looking at DWARF information, for C++ compiler actual enum definition and forward declaration are incompatible.
To eliminate this problem, for C++ mode define input argument as int, which makes enum unnecessary in libbpf public header. This solves the issue and as demonstrated by next patch doesn't cause any unwanted compiler warnings, at least with default warnings setting.
[0] https://stackoverflow.com/questions/42766839/c11-enum-forward-causes-underlying-type-mismatch
[1] Closes: https://github.com/libbpf/libbpf/issues/249
--- tools/lib/bpf/bpf.h | 7 +++++++ 1 file changed, 7 insertions(+)
tools/lib/bpf/bpf.h +7 -0
@@ -249,8 +249,15 @@ LIBBPF_API int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf, __u32 *buf_len, __u32 *prog_id, __u32 *fd_type, __u64 *probe_offset, __u64 *probe_addr); +#ifdef __cplusplus +/* forward-declaring enums in C++ isn't compatible with pure C enums, so +* instead define bpf_enable_stats() as accepting int as an input +*/ +LIBBPF_API int bpf_enable_stats(int type); +#else enum bpf_stats_type ;/* defined in up-to-date linux/bpf.h */ LIBBPF_API int bpf_enable_stats(enum bpf_stats_type type); +#endif struct bpf_prog_bind_opts {size_t sz;/* size of this struct for forward/backward compatibility */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 668/731 regulator: core: fix use_count leakage when handling boot-on
In reply to Greg Kroah-HartmanFrom: Rui Zhang <[email protected]>
[ Upstream commit 0591b14ce0398125439c759f889647369aa616a0 ]
I found a use_count leakage towards supply regulator of rdev with boot-on option.
┌───────────────────┐ ┌───────────────────┐ │ regulator_dev A │ │ regulator_dev B │ │ (boot-on) │ │ (boot-on) │ │ use_count=0 │◀──supply──│ use_count=1 │ │ │ │ │ └───────────────────┘ └───────────────────┘
In case of rdev(A) configured with `regulator-boot-on', the use_count of supplying regulator(B) will increment inside regulator_enable(rdev->supply).
Thus, B will acts like always-on, and further balanced regulator_enable/disable cannot actually disable it anymore.
However, B was also configured with `regulator-boot-on', we wish it could be disabled afterwards.
--- drivers/regulator/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/regulator/core.c +7 -1
@@ -1531,7 +1531,13 @@ static int set_machine_constraints(struct regulator_dev *rdev)if (rdev->supply_name && !rdev->supply)return -EPROBE_DEFER ; -if (rdev->supply) { +/* If supplying regulator has already been enabled, +* it's not intended to have use_count increment +* when rdev is only boot-on. +*/ +if (rdev->supply && + (rdev->constraints->always_on || + !regulator_is_enabled (rdev->supply))) { ret =regulator_enable (rdev->supply);if (ret <0 ) {_regulator_put (rdev->supply);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 669/731 wifi: mt76: do not run mt76u_status_worker if the device is not running
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit bd5dac7ced5a7c9faa4dc468ac9560c3256df845 ]
Fix the following NULL pointer dereference avoiding to run mt76u_status_worker thread if the device is not running yet.
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 98 Comm: kworker/u2:2 Not tainted 5.14.0+ #78 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 Workqueue: mt76 mt76u_tx_status_data RIP: 0010:mt76x02_mac_fill_tx_status.isra.0+0x82c/0x9e0 Code: c5 48 b8 00 00 00 00 00 fc ff df 80 3c 02 00 0f 85 94 01 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 34 24 4c 89 f2 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 89 01 00 00 41 8b 16 41 0f b7 RSP: 0018:ffffc900005af988 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffffc900005afae8 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff832fc661 RDI: ffffc900005afc2a RBP: ffffc900005afae0 R08: 0000000000000001 R09: fffff520000b5f3c R10: 0000000000000003 R11: fffff520000b5f3b R12: ffff88810b6132d8 R13: 000000000000ffff R14: 0000000000000000 R15: ffffc900005afc28 FS: 0000000000000000(0000) GS:ffff88811aa00000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa0eda6a000 CR3: 0000000118f17000 CR4: 0000000000750ef0
PKRU: 55555554
Call Trace: mt76x02_send_tx_status+0x1d2/0xeb0 mt76x02_tx_status_data+0x8e/0xd0 mt76u_tx_status_data+0xe1/0x240 process_one_work+0x92b/0x1460 worker_thread+0x95/0xe00 kthread+0x3a1/0x480 ret_from_fork+0x1f/0x30 Modules linked in: --[ end trace 8df5d20fc5040f65 ]-- RIP: 0010:mt76x02_mac_fill_tx_status.isra.0+0x82c/0x9e0 Code: c5 48 b8 00 00 00 00 00 fc ff df 80 3c 02 00 0f 85 94 01 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 34 24 4c 89 f2 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 89 01 00 00 41 8b 16 41 0f b7 RSP: 0018:ffffc900005af988 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffffc900005afae8 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff832fc661 RDI: ffffc900005afc2a RBP: ffffc900005afae0 R08: 0000000000000001 R09: fffff520000b5f3c R10: 0000000000000003 R11: fffff520000b5f3b R12: ffff88810b6132d8 R13: 000000000000ffff R14: 0000000000000000 R15: ffffc900005afc28 FS: 0000000000000000(0000) GS:ffff88811aa00000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa0eda6a000 CR3: 0000000118f17000 CR4: 0000000000750ef0
PKRU: 55555554
Moreover move stat_work schedule out of the for loop.
--- drivers/net/wireless/mediatek/mt76/usb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/usb.c +7 -4
@@ -814,6 +814,9 @@ static void mt76u_status_worker(struct mt76_worker *w)struct mt76_queue *q;int i; +if (!test_bit (MT76_STATE_RUNNING , &dev->phy.state)) +return ; +for (i =0 ; i <IEEE80211_NUM_ACS ; i++) { q = dev->phy.q_tx[i];if (!q)
@@ -833,11 +836,11 @@ static void mt76u_status_worker(struct mt76_worker *w)wake_up (&dev->tx_wait);mt76_worker_schedule (&dev->tx_worker); - -if (dev->drv->tx_status_data && - !test_and_set_bit (MT76_READING_STATS , &dev->phy.state)) -queue_work (dev->wq, &dev->usb.stat_work); } + +if (dev->drv->tx_status_data && + !test_and_set_bit (MT76_READING_STATS , &dev->phy.state)) +queue_work (dev->wq, &dev->usb.stat_work); }static void mt76u_tx_status_data (struct work_struct *work)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 670/731 mmc: f-sdh30: Add quirks for broken timeout clock capability
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit aae9d3a440736691b3c1cb09ae2c32c4f1ee2e67 ]
There is a case where the timeout clock is not supplied to the capability. Add a quirk for that.
--- drivers/mmc/host/sdhci_f_sdh30.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/sdhci_f_sdh30.c +3 -0
@@ -168,6 +168,9 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)if (reg &SDHCI_CAN_DO_8BIT ) priv->vendor_hs200 =F_SDH30_EMMC_HS200 ; +if (!(reg &SDHCI_TIMEOUT_CLK_MASK )) + host->quirks |=SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK ; + ret =sdhci_add_host (host);if (ret) goto err_add_host;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 671/731 mmc: renesas_sdhi: better reset from HS400 mode
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 0da69dd2155019ed4c444ede0e79ce7a4a6af627 ]
Up to now, HS400 adjustment mode was only disabled on soft reset when a calibration table was in use. It is safer, though, to disable it as soon as the instance has an adjustment related quirk set, i.e. bad taps or a calibration table.
--- drivers/mmc/host/renesas_sdhi_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/renesas_sdhi_core.c +1 -1
@@ -520,7 +520,7 @@ static void renesas_sdhi_reset_hs400_mode(struct tmio_mmc_host *host, SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) & sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2)); -if (priv->adjust_hs400_calib_table) +if (priv->quirks && (priv->quirks->hs400_calib_table || priv->quirks->hs400_bad_taps))renesas_sdhi_adjust_hs400_mode_disable (host); sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN |
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 672/731 media: si470x: Fix use-after-free in si470x_int_in_callback()
In reply to Greg Kroah-HartmanFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit 7d21e0b1b41b21d628bf2afce777727bd4479aa5 ]
syzbot reported use-after-free in si470x_int_in_callback() [1]. This indicates that urb->context, which contains struct si470x_device object, is freed when si470x_int_in_callback() is called.
The cause of this issue is that si470x_int_in_callback() is called for freed urb.
si470x_usb_driver_probe() calls si470x_start_usb(), which then calls usb_submit_urb() and si470x_start(). If si470x_start_usb() fails, si470x_usb_driver_probe() doesn't kill urb, but it just frees struct si470x_device object, as depicted below:
si470x_usb_driver_probe()
...
si470x_start_usb()
...
usb_submit_urb()
retval = si470x_start()
return retval
if (retval < 0)
free struct si470x_device object, but don't kill urbThis patch fixes this issue by killing urb when si470x_start_usb() fails and urb is submitted. If si470x_start_usb() fails and urb is not submitted, i.e. submitting usb fails, it just frees struct si470x_device object.
--- drivers/media/radio/si470x/radio-si470x-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/radio/si470x/radio-si470x-usb.c +3 -1
@@ -733,8 +733,10 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,/* start radio */ retval =si470x_start_usb (radio); -if (retval <0 ) +if (retval <0 && !radio->int_in_running) goto err_buf; +else if (retval <0 )/* in case of radio->int_in_running == 1 */ + goto err_all;/* set initial frequency */ si470x_set_freq (radio,87.5 *FREQ_MUL );/* available in all regions */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 673/731 clk: st: Fix memory leak in st_of_quadfs_setup()
In reply to Greg Kroah-HartmanFrom: Xiu Jianfeng <[email protected]>
[ Upstream commit cfd3ffb36f0d566846163118651d868e607300ba ]
If st_clk_register_quadfs_pll() fails, @lock should be freed before goto @err_exit, otherwise will cause meory leak issue, fix it.
--- drivers/clk/st/clkgen-fsyn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/st/clkgen-fsyn.c +3 -2
@@ -1008,9 +1008,10 @@ static void __init st_of_quadfs_setup(struct device_node *np, clk =st_clk_register_quadfs_pll (pll_name, clk_parent_name, datac->data, reg, lock); -if (IS_ERR (clk)) +if (IS_ERR (clk)) { +kfree (lock); goto err_exit; -else + }else pr_debug("%s: parent %s rate %u\n", __clk_get_name(clk), __clk_get_name(clk_get_parent(clk)),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 674/731 crypto: hisilicon/hpre - fix resource leak in remove process
In reply to Greg Kroah-HartmanFrom: Zhiqi Song <[email protected]>
[ Upstream commit 45e6319bd5f2154d8b8c9f1eaa4ac030ba0d330c ]
In hpre_remove(), when the disable operation of qm sriov failed, the following logic should continue to be executed to release the remaining resources that have been allocated, instead of returning directly, otherwise there will be resource leakage.
--- drivers/crypto/hisilicon/hpre/hpre_main.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_main.c +2 -8
@@ -1143,18 +1143,12 @@ static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id)static void hpre_remove (struct pci_dev *pdev) {struct hisi_qm *qm =pci_get_drvdata (pdev); -int ret;hisi_qm_pm_uninit (qm);hisi_qm_wait_task_finish (qm, &hpre_devices);hisi_qm_alg_unregister (qm, &hpre_devices); -if (qm->fun_type ==QM_HW_PF && qm->vfs_num) { - ret =hisi_qm_sriov_disable (pdev, true); -if (ret) { -pci_err (pdev,"Disable SRIOV fail!\n" ); -return ; - } - } +if (qm->fun_type ==QM_HW_PF && qm->vfs_num) +hisi_qm_sriov_disable (pdev, true);hpre_debugfs_exit (qm);hisi_qm_stop (qm,QM_NORMAL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 675/731 scsi: lpfc: Fix hard lockup when reading the rx_monitor from debugfs
In reply to Greg Kroah-HartmanFrom: Justin Tee <[email protected]>
[ Upstream commit c44e50f4a0ec00c2298f31f91bc2c3e9bbd81c7e ]
During I/O and simultaneous cat of /sys/kernel/debug/lpfc/fnX/rx_monitor, a hard lockup similar to the call trace below may occur.
The spin_lock_bh in lpfc_rx_monitor_report is not protecting from timer interrupts as expected, so change the strength of the spin lock to _irq.
Kernel panic - not syncing: Hard LOCKUP CPU: 3 PID: 110402 Comm: cat Kdump: loaded
exception RIP: native_queued_spin_lock_slowpath+91
[IRQ stack]
native_queued_spin_lock_slowpath at ffffffffb814e30b _raw_spin_lock at ffffffffb89a667a lpfc_rx_monitor_record at ffffffffc0a73a36 [lpfc] lpfc_cmf_timer at ffffffffc0abbc67 [lpfc] __hrtimer_run_queues at ffffffffb8184250 hrtimer_interrupt at ffffffffb8184ab0 smp_apic_timer_interrupt at ffffffffb8a026ba apic_timer_interrupt at ffffffffb8a01c4f
[End of IRQ stack]
apic_timer_interrupt at ffffffffb8a01c4f lpfc_rx_monitor_report at ffffffffc0a73c80 [lpfc] lpfc_rx_monitor_read at ffffffffc0addde1 [lpfc] full_proxy_read at ffffffffb83e7fc3 vfs_read at ffffffffb833fe71
ksys_read at ffffffffb83402af do_syscall_64 at ffffffffb800430b entry_SYSCALL_64_after_hwframe at ffffffffb8a000ad
--- drivers/scsi/lpfc/lpfc_sli.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +3 -3
@@ -7992,10 +7992,10 @@ u32 lpfc_rx_monitor_report(struct lpfc_hba *phba, "IO_cnt", "Info", "BWutil(ms)"); } -/* Needs to be _bh because record is called from timer interrupt +/* Needs to be _irq because record is called from timer interrupt * context */ -spin_lock_bh (ring_lock); +spin_lock_irq (ring_lock);while (*head_idx != *tail_idx) { entry = &ring[*head_idx];
@@ -8039,7 +8039,7 @@ u32 lpfc_rx_monitor_report(struct lpfc_hba *phba,if (cnt >= max_read_entries)break ; } -spin_unlock_bh (ring_lock); +spin_unlock_irq (ring_lock);return cnt; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 676/731 scsi: ufs: Reduce the START STOP UNIT timeout
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit dcd5b7637c6d442d957f73780a03047413ed3a10 ]
Reduce the START STOP UNIT command timeout to one second since on Android devices a kernel panic is triggered if an attempt to suspend the system takes more than 20 seconds. One second should be enough for the START STOP UNIT command since this command completes in less than a millisecond for the UFS devices I have access to.
--- drivers/scsi/ufs/ufshcd.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -8
@@ -8476,8 +8476,6 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,struct scsi_device *sdp;unsigned long flags;int ret, retries; -unsigned long deadline; -int32_t remaining;spin_lock_irqsave (hba->host->host_lock, flags); sdp = hba->sdev_ufs_device;
@@ -8510,14 +8508,9 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,* callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ - deadline = jiffies +10 *HZ ;for (retries =3 ; retries >0 ; --retries) { - ret = -ETIMEDOUT ; - remaining = deadline - jiffies; -if (remaining <=0 ) -break ; ret =scsi_execute (sdp, cmd,DMA_NONE ,NULL ,0 ,NULL , &sshdr, - remaining /HZ ,0 ,0 ,RQF_PM ,NULL ); +HZ ,0 ,0 ,RQF_PM ,NULL );if (!scsi_status_is_check_condition (ret) || !scsi_sense_valid (&sshdr) || sshdr.sense_key !=UNIT_ATTENTION )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 677/731 scsi: elx: libefc: Fix second parameter type in state callbacks
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 3d75e766b58a7410d4e835c534e1b4664a8f62d0 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/scsi/elx/libefc/efc_node.c:811:22: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)' [-Werror,-Wincompatible-function-pointer-types-strict]
ctx->current_state = state;
^ ~~~~~
drivers/scsi/elx/libefc/efc_node.c:878:21: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)' [-Werror,-Wincompatible-function-pointer-types-strict]
node->nodedb_state = state;
^ ~~~~~
drivers/scsi/elx/libefc/efc_node.c:905:6: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)' from 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') [-Werror,-Wincompatible-function-pointer-types-strict]
pf = node->nodedb_state;
^ ~~~~~~~~~~~~~~~~~~
drivers/scsi/elx/libefc/efc_device.c:455:22: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void (struct efc_sm_ctx *, enum efc_sm_event, void *)' [-Werror,-Wincompatible-function-pointer-types-strict]
node->nodedb_state = __efc_d_init;
^ ~~~~~~~~~~~~
drivers/scsi/elx/libefc/efc_sm.c:41:22: error: incompatible function pointer types assigning to 'void (*)(struct efc_sm_ctx *, u32, void *)' (aka 'void (*)(struct efc_sm_ctx *, unsigned int, void *)') from 'void (*)(struct efc_sm_ctx *, enum efc_sm_event, void *)' [-Werror,-Wincompatible-function-pointer-types-strict]
ctx->current_state = state;
^ ~~~~~The type of the second parameter in the prototypes of ->current_state() and ->nodedb_state() ('u32') does not match the implementations, which have a second parameter type of 'enum efc_sm_event'. Update the prototypes to have the correct second parameter type, clearing up all the warnings and CFI failures.
--- drivers/scsi/elx/libefc/efclib.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/elx/libefc/efclib.h +4 -2
@@ -58,10 +58,12 @@ enum efc_node_send_ls_acc {#define EFC_LINK_STATUS_UP 0#define EFC_LINK_STATUS_DOWN 1 +enum efc_sm_event ; +/* State machine context header */ struct efc_sm_ctx {void (*current_state)(struct efc_sm_ctx *ctx, -u32 evt,void *arg); +enum efc_sm_event evt,void *arg);const char *description;void *app;
@@ -364,7 +366,7 @@ struct efc_node {int prev_evt;void (*nodedb_state)(struct efc_sm_ctx *ctx, -u32 evt,void *arg); +enum efc_sm_event evt,void *arg);struct timer_list gidpt_delay_timer;u64 time_last_gidpt_msec;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 678/731 hugetlbfs: fix null-ptr-deref in hugetlbfs_parse_param()
In reply to Greg Kroah-HartmanFrom: Hawkins Jiawei <[email protected]>
[ Upstream commit 26215b7ee923b9251f7bb12c4e5f09dc465d35f2 ]
Syzkaller reports a null-ptr-deref bug as follows:
======================================================
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] RIP: 0010:hugetlbfs_parse_param+0x1dd/0x8e0 fs/hugetlbfs/inode.c:1380 [...] Call Trace: <TASK> vfs_parse_fs_param fs/fs_context.c:148 [inline] vfs_parse_fs_param+0x1f9/0x3c0 fs/fs_context.c:129 vfs_parse_fs_string+0xdb/0x170 fs/fs_context.c:191 generic_parse_monolithic+0x16f/0x1f0 fs/fs_context.c:231 do_new_mount fs/namespace.c:3036 [inline] path_mount+0x12de/0x1e20 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd [...] </TASK> ======================================================
According to commit "vfs: parse: deal with zero length string value", kernel will set the param->string to null pointer in vfs_parse_fs_string() if fs string has zero length.
Yet the problem is that, hugetlbfs_parse_param() will dereference the param->string, without checking whether it is a null pointer. To be more specific, if hugetlbfs_parse_param() parses an illegal mount parameter, such as "size=,", kernel will constructs struct fs_parameter with null pointer in vfs_parse_fs_string(), then passes this struct fs_parameter to hugetlbfs_parse_param(), which triggers the above null-ptr-deref bug.
This patch solves it by adding sanity check on param->string in hugetlbfs_parse_param().
--- fs/hugetlbfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/hugetlbfs/inode.c +3 -3
@@ -1250,7 +1250,7 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *parcase Opt_size:/* memparse() will accept a K/M/G without a digit */ -if (!isdigit (param->string[0 ])) +if (!param->string || !isdigit (param->string[0 ])) goto bad_val; ctx->max_size_opt =memparse (param->string, &rest); ctx->max_val_type =SIZE_STD ;
@@ -1260,7 +1260,7 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *parcase Opt_nr_inodes:/* memparse() will accept a K/M/G without a digit */ -if (!isdigit (param->string[0 ])) +if (!param->string || !isdigit (param->string[0 ])) goto bad_val; ctx->nr_inodes =memparse (param->string, &rest);return 0 ;
@@ -1276,7 +1276,7 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *parcase Opt_min_size:/* memparse() will accept a K/M/G without a digit */ -if (!isdigit (param->string[0 ])) +if (!param->string || !isdigit (param->string[0 ])) goto bad_val; ctx->min_size_opt =memparse (param->string, &rest); ctx->min_val_type =SIZE_STD ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 679/731 drm/fsl-dcu: Fix return type of fsl_dcu_drm_connector_mode_valid()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 96d845a67b7e406cfed7880a724c8ca6121e022e ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c:74:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.mode_valid = fsl_dcu_drm_connector_mode_valid,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
->mode_valid() in 'struct drm_connector_helper_funcs' expects a return type of 'enum drm_mode_status', not 'int'. Adjust the return type of fsl_dcu_drm_connector_mode_valid() to match the prototype's to resolve the warning and CFI failure.
--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c +3 -2
@@ -60,8 +60,9 @@ static int fsl_dcu_drm_connector_get_modes(struct drm_connector *connector)return drm_panel_get_modes (fsl_connector->panel, connector); } -static int fsl_dcu_drm_connector_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) +static enum drm_mode_status +fsl_dcu_drm_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode) {if (mode->hdisplay &0xf )return MODE_ERROR ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 680/731 drm/sti: Fix return type of sti_{dvo,hda,hdmi}_connector_mode_valid()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 0ad811cc08a937d875cbad0149c1bab17f84ba05 ]
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/gpu/drm/sti/sti_hda.c:637:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.mode_valid = sti_hda_connector_mode_valid,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/sti/sti_dvo.c:376:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.mode_valid = sti_dvo_connector_mode_valid,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/sti/sti_hdmi.c:1035:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_connector *, struct drm_display_mode *)' with an expression of type 'int (struct drm_connector *, struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict]
.mode_valid = sti_hdmi_connector_mode_valid,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
->mode_valid() in 'struct drm_connector_helper_funcs' expects a return type of 'enum drm_mode_status', not 'int'. Adjust the return type of sti_{dvo,hda,hdmi}_connector_mode_valid() to match the prototype's to resolve the warning and CFI failure.
--- drivers/gpu/drm/sti/sti_dvo.c | 5 +++-- drivers/gpu/drm/sti/sti_hda.c | 5 +++-- drivers/gpu/drm/sti/sti_hdmi.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/sti/sti_dvo.c +3 -2
@@ -346,8 +346,9 @@ static int sti_dvo_connector_get_modes(struct drm_connector *connector)#define CLK_TOLERANCE_HZ 50 -static int sti_dvo_connector_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) +static enum drm_mode_status +sti_dvo_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode) {int target = mode->clock *1000 ;int target_min = target -CLK_TOLERANCE_HZ ;
drivers/gpu/drm/sti/sti_hda.c +3 -2
@@ -600,8 +600,9 @@ static int sti_hda_connector_get_modes(struct drm_connector *connector)#define CLK_TOLERANCE_HZ 50 -static int sti_hda_connector_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) +static enum drm_mode_status +sti_hda_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode) {int target = mode->clock *1000 ;int target_min = target -CLK_TOLERANCE_HZ ;
drivers/gpu/drm/sti/sti_hdmi.c +3 -2
@@ -1003,8 +1003,9 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector)#define CLK_TOLERANCE_HZ 50 -static int sti_hdmi_connector_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) +static enum drm_mode_status +sti_hdmi_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode) {int target = mode->clock *1000 ;int target_min = target -CLK_TOLERANCE_HZ ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 681/731 orangefs: Fix kmemleak in orangefs_prepare_debugfs_help_string()
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
[ Upstream commit d23417a5bf3a3afc55de5442eb46e1e60458b0a1 ]
When insert and remove the orangefs module, then debug_help_string will be leaked:
unreferenced object 0xffff8881652ba000 (size 4096):
comm "insmod", pid 1701, jiffies 4294893639 (age 13218.530s)
hex dump (first 32 bytes):
43 6c 69 65 6e 74 20 44 65 62 75 67 20 4b 65 79 Client Debug Key
77 6f 72 64 73 20 61 72 65 20 75 6e 6b 6e 6f 77 words are unknow
backtrace:
[<0000000004e6f8e3>] kmalloc_trace+0x27/0xa0
[<0000000006f75d85>] orangefs_prepare_debugfs_help_string+0x5e/0x480 [orangefs]
[<0000000091270a2a>] _sub_I_65535_1+0x57/0xf70 [crc_itu_t]
[<000000004b1ee1a3>] do_one_initcall+0x87/0x2a0
[<000000001d0614ae>] do_init_module+0xdf/0x320
[<00000000efef068c>] load_module+0x2f98/0x3330
[<000000006533b44d>] __do_sys_finit_module+0x113/0x1b0
[<00000000a0da6f99>] do_syscall_64+0x35/0x80
[<000000007790b19b>] entry_SYSCALL_64_after_hwframe+0x46/0xb0When remove the module, should always free debug_help_string. Should always free the allocated buffer when change the free_debug_help_string.
--- fs/orangefs/orangefs-debugfs.c | 3 +++ 1 file changed, 3 insertions(+)
fs/orangefs/orangefs-debugfs.c +3 -0
@@ -222,6 +222,8 @@ static void orangefs_kernel_debug_init(void)void orangefs_debugfs_cleanup (void ) {debugfs_remove_recursive (debug_dir); +kfree (debug_help_string); + debug_help_string =NULL ; }/* open ORANGEFS_KMOD_DEBUG_HELP_FILE */
@@ -671,6 +673,7 @@ int orangefs_prepare_debugfs_help_string(int at_boot)memset (debug_help_string,0 ,DEBUG_HELP_STRING_SIZE );strlcat (debug_help_string, new, string_size);mutex_unlock (&orangefs_help_file_lock); +kfree (new); } rc =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 682/731 orangefs: Fix kmemleak in orangefs_{kernel,client}_debug_init()
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
[ Upstream commit 31720a2b109b3080eb77e97b8f6f50a27b4ae599 ]
When insert and remove the orangefs module, there are memory leaked as below:
unreferenced object 0xffff88816b0cc000 (size 2048):
comm "insmod", pid 783, jiffies 4294813439 (age 65.512s) hex dump (first 32 bytes):
6e 6f 6e 65 0a 00 00 00 00 00 00 00 00 00 00 00 none............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<0000000031ab7788>] kmalloc_trace+0x27/0xa0
[<000000005b405fee>] orangefs_debugfs_init.cold+0xaf/0x17f
[<00000000e5a0085b>] 0xffffffffa02780f9
[<000000004232d9f7>] do_one_initcall+0x87/0x2a0
[<0000000054f22384>] do_init_module+0xdf/0x320
[<000000003263bdea>] load_module+0x2f98/0x3330
[<0000000052cd4153>] __do_sys_finit_module+0x113/0x1b0
[<00000000250ae02b>] do_syscall_64+0x35/0x80
[<00000000f11c03c7>] entry_SYSCALL_64_after_hwframe+0x46/0xb0Use the golbal variable as the buffer rather than dynamic allocate to slove the problem.
--- fs/orangefs/orangefs-debugfs.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)
fs/orangefs/orangefs-debugfs.c +3 -23
@@ -194,15 +194,10 @@ void orangefs_debugfs_init(int debug_mask)*/ static void orangefs_kernel_debug_init (void ) { -int rc = -ENOMEM ; -char *k_buffer =NULL ; +static char k_buffer[ORANGEFS_MAX_DEBUG_STRING_LEN ] = { };gossip_debug (GOSSIP_DEBUGFS_DEBUG ,"%s: start\n" , __func__); - k_buffer =kzalloc (ORANGEFS_MAX_DEBUG_STRING_LEN ,GFP_KERNEL ); -if (!k_buffer) - goto out; -if (strlen (kernel_debug_string) +1 <ORANGEFS_MAX_DEBUG_STRING_LEN ) {strcpy (k_buffer, kernel_debug_string);strcat (k_buffer,"\n" );
@@ -213,9 +208,6 @@ static void orangefs_kernel_debug_init(void)debugfs_create_file (ORANGEFS_KMOD_DEBUG_FILE ,0444 , debug_dir, k_buffer, &kernel_debug_fops); - -out: -gossip_debug (GOSSIP_DEBUGFS_DEBUG ,"%s: rc:%d:\n" , __func__, rc); }
@@ -299,18 +291,13 @@ static int help_show(struct seq_file *m, void *v)/* * initialize the client-debug file. */ -static int orangefs_client_debug_init (void ) +static void orangefs_client_debug_init (void ) { -int rc = -ENOMEM ; -char *c_buffer =NULL ; +static char c_buffer[ORANGEFS_MAX_DEBUG_STRING_LEN ] = { };gossip_debug (GOSSIP_DEBUGFS_DEBUG ,"%s: start\n" , __func__); - c_buffer =kzalloc (ORANGEFS_MAX_DEBUG_STRING_LEN ,GFP_KERNEL ); -if (!c_buffer) - goto out; -if (strlen (client_debug_string) +1 <ORANGEFS_MAX_DEBUG_STRING_LEN ) {strcpy (c_buffer, client_debug_string);strcat (c_buffer,"\n" );
@@ -324,13 +311,6 @@ static int orangefs_client_debug_init(void) debug_dir, c_buffer, &kernel_debug_fops); - - rc =0 ; - -out: - -gossip_debug (GOSSIP_DEBUGFS_DEBUG ,"%s: rc:%d:\n" , __func__, rc); -return rc; }/* open ORANGEFS_KMOD_DEBUG_FILE or ORANGEFS_CLIENT_DEBUG_FILE.*/
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 683/731 tools/include: Add _RET_IP_ and math definitions to kernel.h
In reply to Greg Kroah-HartmanFrom: Karolina Drobnik <[email protected]>
commit 5cf67a6051ea2558fd7c3d39c5a808db73073e9d upstream.
Add max_t, min_t and clamp functions, together with _RET_IP_ definition, so they can be used in testing.
[tyhicks: Backport around contextual differences due to the lack of v5.16 commit
d6e6a27d960f ("tools: Fix math.h breakage"). That commit fixed a commit that was merged in v5.16-rc1 and, therefore, doesn't need to go back to the stable branches.]
--- tools/include/linux/kernel.h | 6 ++++++ 1 file changed, 6 insertions(+)
tools/include/linux/kernel.h +6 -0
@@ -14,6 +14,8 @@#define UINT_MAX (~0U)#endif +#define _RET_IP_ ((unsigned long)__builtin_return_address(0)) +#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d))#define PERF_ALIGN (x, a) __PERF_ALIGN_MASK(x, (typeof(x))(a)-1)
@@ -52,6 +54,10 @@ _min1 < _min2 ? _min1 : _min2; })#endif +#define max_t (type, x, y) max((type)x, (type)y) +#define min_t (type, x, y) min((type)x, (type)y) +#define clamp (val, lo, hi) min((typeof(val))max(val, lo), hi) +#ifndef roundup#define roundup (x, y) ( \ { \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 684/731 KVM: selftests: Fix build regression by using accessor function
In reply to Greg Kroah-HartmanFrom: Tyler Hicks <[email protected]>
Fix the stable backport of commit 05c2224d4b04 ("KVM: selftests: Fix number of pages for memory slot in memslot_modification_stress_test"), which caused memslot_modification_stress_test.c build failures due to trying to access private members of struct kvm_vm.
v6.0 commit b530eba14c70 ("KVM: selftests: Get rid of kvm_util_internal.h") and some other commits got rid of the accessors and made all of the KVM data structures public. Keep using the accessors in older kernels.
There is no corresponding upstream commit for this change.
--- tools/testing/selftests/kvm/memslot_modification_stress_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/memslot_modification_stress_test.c +1 -1
@@ -72,7 +72,7 @@ struct memslot_antagonist_args {static void add_remove_memslot (struct kvm_vm *vm,useconds_t delay,uint64_t nr_modifications) { -uint64_t pages =max_t (int, vm->page_size,getpagesize ()) / vm->page_size; +uint64_t pages =max_t (int,vm_get_page_size (vm),getpagesize ()) /vm_get_page_size (vm);uint64_t gpa;int i;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 685/731 hwmon: (jc42) Fix missing unlock on error in jc42_write()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit b744db17abf6a2efc2bfa80870cc88e9799a8ccc ]
Add the missing unlock before return from function jc42_write() in the error handling case.
--- drivers/hwmon/jc42.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/jc42.c +1 -1
@@ -340,7 +340,7 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type, ret =regmap_read (data->regmap,JC42_REG_TEMP_CRITICAL , ®val);if (ret) -return ret; +break ;/* * JC42.4 compliant chips only support four hysteresis values.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 686/731 ALSA/ASoC: hda: move/rename snd_hdac_ext_stop_streams to hdac_stream.c
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 12054f0ce8be7d2003ec068ab27c9eb608397b98 ]
snd_hdac_ext_stop_streams() has really nothing to do with the extension, it just loops over the bus streams.
Move it to the hdac_stream layer and rename to remove the 'ext' prefix and add the precision that the chip will also be stopped.
Stable-dep-of: 171107237246 ("ASoC: Intel: Skylake: Fix driver hang during shutdown")
--- include/sound/hdaudio.h | 1 + include/sound/hdaudio_ext.h | 1 - sound/hda/ext/hdac_ext_stream.c | 17 ----------------- sound/hda/hdac_stream.c | 16 ++++++++++++++++ sound/soc/intel/skylake/skl.c | 4 ++-- 5 files changed, 19 insertions(+), 20 deletions(-)
include/sound/hdaudio.h +1 -0
@@ -558,6 +558,7 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,void snd_hdac_stream_start (struct hdac_stream *azx_dev,bool fresh_start);void snd_hdac_stream_clear (struct hdac_stream *azx_dev);void snd_hdac_stream_stop (struct hdac_stream *azx_dev); +void snd_hdac_stop_streams_and_chip (struct hdac_bus *bus);void snd_hdac_stream_reset (struct hdac_stream *azx_dev);void snd_hdac_stream_sync_trigger (struct hdac_stream *azx_dev,bool set,unsigned int streams,unsigned int reg);
include/sound/hdaudio_ext.h +0 -1
@@ -92,7 +92,6 @@ void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus, struct hdac_ext_stream *azx_dev, bool decouple);void snd_hdac_ext_stream_decouple (struct hdac_bus *bus,struct hdac_ext_stream *azx_dev,bool decouple); -void snd_hdac_ext_stop_streams (struct hdac_bus *bus);int snd_hdac_ext_stream_set_spib (struct hdac_bus *bus,struct hdac_ext_stream *stream,u32 value);
sound/hda/ext/hdac_ext_stream.c +0 -17
@@ -475,23 +475,6 @@ int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus, }EXPORT_SYMBOL_GPL (snd_hdac_ext_stream_get_spbmaxfifo); - -/** -* snd_hdac_ext_stop_streams - stop all stream if running -* @bus: HD-audio core bus -*/ -void snd_hdac_ext_stop_streams (struct hdac_bus *bus) -{ -struct hdac_stream *stream; - -if (bus->chip_init) { -list_for_each_entry (stream, &bus->stream_list, list) -snd_hdac_stream_stop (stream); -snd_hdac_bus_stop_chip (bus); - } -} -EXPORT_SYMBOL_GPL (snd_hdac_ext_stop_streams); -/** * snd_hdac_ext_stream_drsm_enable - enable DMA resume for a stream * @bus: HD-audio core bus
sound/hda/hdac_stream.c +16 -0
@@ -142,6 +142,22 @@ void snd_hdac_stream_stop(struct hdac_stream *azx_dev) }EXPORT_SYMBOL_GPL (snd_hdac_stream_stop); +/** +* snd_hdac_stop_streams_and_chip - stop all streams and chip if running +* @bus: HD-audio core bus +*/ +void snd_hdac_stop_streams_and_chip (struct hdac_bus *bus) +{ +struct hdac_stream *stream; + +if (bus->chip_init) { +list_for_each_entry (stream, &bus->stream_list, list) +snd_hdac_stream_stop (stream); +snd_hdac_bus_stop_chip (bus); + } +} +EXPORT_SYMBOL_GPL (snd_hdac_stop_streams_and_chip); +/** * snd_hdac_stream_reset - reset a stream * @azx_dev: HD-audio core stream to reset
sound/soc/intel/skylake/skl.c +2 -2
@@ -439,7 +439,7 @@ static int skl_free(struct hdac_bus *bus) skl->init_done =0 ;/* to be sure */ -snd_hdac_ext_stop_streams (bus); +snd_hdac_stop_streams_and_chip (bus);if (bus->irq >=0 )free_irq (bus->irq, (void *)bus);
@@ -1096,7 +1096,7 @@ static void skl_shutdown(struct pci_dev *pci)if (!skl->init_done)return ; -snd_hdac_ext_stop_streams (bus); +snd_hdac_stop_streams_and_chip (bus);list_for_each_entry (s, &bus->stream_list, list) { stream =stream_to_hdac_ext_stream (s);snd_hdac_ext_stream_decouple (bus, stream, false);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 687/731 ALSA: hda: add snd_hdac_stop_streams() helper
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 24ad3835a6db4f8857975effa6bf47730371a5ff ]
Minor code reuse, no functionality change.
Stable-dep-of: 171107237246 ("ASoC: Intel: Skylake: Fix driver hang during shutdown")
--- include/sound/hdaudio.h | 1 + sound/hda/hdac_stream.c | 17 ++++++++++++++--- sound/pci/hda/hda_controller.c | 4 +--- 3 files changed, 16 insertions(+), 6 deletions(-)
include/sound/hdaudio.h +1 -0
@@ -558,6 +558,7 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,void snd_hdac_stream_start (struct hdac_stream *azx_dev,bool fresh_start);void snd_hdac_stream_clear (struct hdac_stream *azx_dev);void snd_hdac_stream_stop (struct hdac_stream *azx_dev); +void snd_hdac_stop_streams (struct hdac_bus *bus);void snd_hdac_stop_streams_and_chip (struct hdac_bus *bus);void snd_hdac_stream_reset (struct hdac_stream *azx_dev); void snd_hdac_stream_sync_trigger(struct hdac_stream *azx_dev, bool set,
sound/hda/hdac_stream.c +14 -3
@@ -142,17 +142,28 @@ void snd_hdac_stream_stop(struct hdac_stream *azx_dev) }EXPORT_SYMBOL_GPL (snd_hdac_stream_stop); +/** +* snd_hdac_stop_streams - stop all streams +* @bus: HD-audio core bus +*/ +void snd_hdac_stop_streams (struct hdac_bus *bus) +{ +struct hdac_stream *stream; + +list_for_each_entry (stream, &bus->stream_list, list) +snd_hdac_stream_stop (stream); +} +EXPORT_SYMBOL_GPL (snd_hdac_stop_streams); +/** * snd_hdac_stop_streams_and_chip - stop all streams and chip if running * @bus: HD-audio core bus */ void snd_hdac_stop_streams_and_chip (struct hdac_bus *bus) { -struct hdac_stream *stream;if (bus->chip_init) { -list_for_each_entry (stream, &bus->stream_list, list) -snd_hdac_stream_stop (stream); +snd_hdac_stop_streams (bus);snd_hdac_bus_stop_chip (bus); } }
sound/pci/hda/hda_controller.c +1 -3
@@ -1033,10 +1033,8 @@ EXPORT_SYMBOL_GPL(azx_init_chip);void azx_stop_all_streams (struct azx *chip) {struct hdac_bus *bus =azx_bus (chip); -struct hdac_stream *s; -list_for_each_entry (s, &bus->stream_list, list) -snd_hdac_stream_stop (s); +snd_hdac_stop_streams (bus); }EXPORT_SYMBOL_GPL (azx_stop_all_streams);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 688/731 ASoC: Intel: Skylake: Fix driver hang during shutdown
In reply to Greg Kroah-HartmanFrom: Cezary Rojewski <[email protected]>
[ Upstream commit 171107237246d66bce04f3769d33648f896b4ce3 ]
AudioDSP cores and HDAudio links need to be turned off on shutdown to ensure no communication or data transfer occurs during the procedure.
--- sound/soc/intel/skylake/skl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl.c +4 -1
@@ -1096,7 +1096,10 @@ static void skl_shutdown(struct pci_dev *pci)if (!skl->init_done)return ; -snd_hdac_stop_streams_and_chip (bus); +snd_hdac_stop_streams (bus); +snd_hdac_ext_bus_link_power_down_all (bus); +skl_dsp_sleep (skl->dsp); +list_for_each_entry (s, &bus->stream_list, list) { stream =stream_to_hdac_ext_stream (s);snd_hdac_ext_stream_decouple (bus, stream, false);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 689/731 ASoC: mediatek: mt8173-rt5650-rt5514: fix refcount leak in mt8173_rt5650_rt5514_dev_probe()
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 3327d721114c109ba0575f86f8fda3b525404054 ]
The node returned by of_parse_phandle() with refcount incremented, of_node_put() needs be called when finish using it. So add it in the error path in mt8173_rt5650_rt5514_dev_probe().
--- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +5 -2
@@ -200,14 +200,16 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)if (!mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S ].codecs[0 ].of_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out; } mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S ].codecs[1 ].of_node =of_parse_phandle (pdev->dev.of_node,"mediatek,audio-codec" ,1 );if (!mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S ].codecs[1 ].of_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out; } mt8173_rt5650_rt5514_codec_conf[0 ].dlc.of_node = mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S ].codecs[1 ].of_node;
@@ -219,6 +221,7 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)dev_err (&pdev->dev,"%s snd_soc_register_card fail %d\n" , __func__, ret); +out:of_node_put (platform_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 690/731 ASoC: audio-graph-card: fix refcount leak of cpu_ep in __graph_for_each_link()
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 8ab2d12c726f0fde0692fa5d81d8019b3dcd62d0 ]
The of_get_next_child() returns a node with refcount incremented, and decrements the refcount of prev. So in the error path of the while loop, of_node_put() needs be called for cpu_ep.
--- sound/soc/generic/audio-graph-card.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/generic/audio-graph-card.c +3 -1
@@ -483,8 +483,10 @@ static int __graph_for_each_link(struct asoc_simple_priv *priv,of_node_put (codec_ep);of_node_put (codec_port); -if (ret <0 ) +if (ret <0 ) { +of_node_put (cpu_ep);return ret; + } codec_port_old = codec_port; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 691/731 ASoC: rockchip: pdm: Add missing clk_disable_unprepare() in rockchip_pdm_runtime_resume()
In reply to Greg Kroah-HartmanFrom: Wang Jingjin <[email protected]>
[ Upstream commit ef0a098efb36660326c133af9b5a04a96a00e3ca ]
The clk_disable_unprepare() should be called in the error handling of rockchip_pdm_runtime_resume().
--- sound/soc/rockchip/rockchip_pdm.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/rockchip/rockchip_pdm.c +1 -0
@@ -368,6 +368,7 @@ static int rockchip_pdm_runtime_resume(struct device *dev) ret =clk_prepare_enable (pdm->hclk);if (ret) { +clk_disable_unprepare (pdm->clk);dev_err (pdm->dev,"hclock enable failed %d\n" , ret);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 692/731 ASoC: mediatek: mt8183: fix refcount leak in mt8183_mt6358_ts3a227_max98357_dev_probe()
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 38eef3be38ab895959c442702864212cc3beb96c ]
The node returned by of_parse_phandle() with refcount incremented, of_node_put() needs be called when finish using it. So add it in the error path in mt8183_mt6358_ts3a227_max98357_dev_probe().
--- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +10 -4
@@ -647,8 +647,10 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) } card = (struct snd_soc_card *)of_device_get_match_data (&pdev->dev); -if (!card) +if (!card) { +of_node_put (platform_node);return -EINVAL ; + } card->dev = &pdev->dev; ec_codec =of_parse_phandle (pdev->dev.of_node,"mediatek,ec-codec" ,0 );
@@ -737,8 +739,10 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) } priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); -if (!priv) -return -ENOMEM ; +if (!priv) { + ret = -ENOMEM ; + goto out; + }snd_soc_card_set_drvdata (card, priv);
@@ -746,7 +750,8 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)if (IS_ERR (priv->pinctrl)) {dev_err (&pdev->dev,"%s devm_pinctrl_get failed\n" , __func__); -return PTR_ERR (priv->pinctrl); + ret =PTR_ERR (priv->pinctrl); + goto out; }for (i =0 ; i <PIN_STATE_MAX ; i++) {
@@ -779,6 +784,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) ret =devm_snd_soc_register_card (&pdev->dev, card); +out:of_node_put (platform_node);of_node_put (ec_codec);of_node_put (hdmi_codec);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 693/731 ASoC: wm8994: Fix potential deadlock
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 9529dc167ffcdfd201b9f0eda71015f174095f7e ]
Fix this by dropping wm8994->accdet_lock while calling cancel_delayed_work_sync(&wm8994->mic_work) in wm1811_jackdet_irq().
--- sound/soc/codecs/wm8994.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/codecs/wm8994.c +5 -0
@@ -3853,7 +3853,12 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) }else {dev_dbg (component->dev,"Jack not detected\n" ); +/* Release wm8994->accdet_lock to avoid deadlock: +* cancel_delayed_work_sync() takes wm8994->mic_work internal +* lock and wm1811_mic_work takes wm8994->accdet_lock */ +mutex_unlock (&wm8994->accdet_lock);cancel_delayed_work_sync (&wm8994->mic_work); +mutex_lock (&wm8994->accdet_lock);snd_soc_component_update_bits (component,WM8958_MICBIAS2 ,WM8958_MICB2_DISCH ,WM8958_MICB2_DISCH );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 694/731 ASoC: rockchip: spdif: Add missing clk_disable_unprepare() in rk_spdif_runtime_resume()
In reply to Greg Kroah-HartmanFrom: Wang Jingjin <[email protected]>
[ Upstream commit 6d94d0090527b1763872275a7ccd44df7219b31e ]
rk_spdif_runtime_resume() may have called clk_prepare_enable() before return from failed branches, add missing clk_disable_unprepare() in this case.
--- sound/soc/rockchip/rockchip_spdif.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/rockchip/rockchip_spdif.c +1 -0
@@ -88,6 +88,7 @@ static int __maybe_unused rk_spdif_runtime_resume(struct device *dev) ret =clk_prepare_enable (spdif->hclk);if (ret) { +clk_disable_unprepare (spdif->mclk);dev_err (spdif->dev,"hclk clock enable failed %d\n" , ret);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 695/731 ASoC: rt5670: Remove unbalanced pm_runtime_put()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 6c900dcc3f7331a67ed29739d74524e428d137fb ]
For some reason rt5670_i2c_probe() does a pm_runtime_put() at the end of a successful probe. But it has never done a pm_runtime_get() leading to the following error being logged into dmesg:
rt5670 i2c-10EC5640:00: Runtime PM usage count underflow!
Fix this by removing the unnecessary pm_runtime_put().
--- sound/soc/codecs/rt5670.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/codecs/rt5670.c +0 -2
@@ -3313,8 +3313,6 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,if (ret <0 ) goto err; -pm_runtime_put (&i2c->dev); -return 0 ; err:pm_runtime_disable (&i2c->dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 696/731 drm/i915/display: Dont disable DDI/Transcoder when setting phy test pattern
In reply to Greg Kroah-HartmanFrom: Khaled Almahallawy <[email protected]>
[ Upstream commit 3153eebb7a76e663ac76d6670dc113296de96622 ]
Bspecs has updated recently to remove the restriction to disable DDI/Transcoder before setting PHY test pattern. This update is to address PHY compliance test failures observed on a port with LTTPR. The issue is that when Transc. is disabled, the main link signals fed to LTTPR will be dropped invalidating link training, which will affect the quality of the phy test pattern when the transcoder is enabled again.
v2: Update commit message (Clint)
v3: Add missing Signed-off in v2
v4: Update Bspec and commit message for pre-gen12 (Jani)
Bspec: 50482, 7555
--- drivers/gpu/drm/i915/display/intel_dp.c | 59 ------------------------- 1 file changed, 59 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +0 -59
@@ -3245,61 +3245,6 @@ static void intel_dp_phy_pattern_update(struct intel_dp *intel_dp, } } -static void -intel_dp_autotest_phy_ddi_disable (struct intel_dp *intel_dp, -const struct intel_crtc_state *crtc_state) -{ -struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = dig_port->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -struct intel_crtc *crtc =to_intel_crtc (dig_port->base.base.crtc); -enum pipe pipe = crtc->pipe; -u32 trans_ddi_func_ctl_value, trans_conf_value, dp_tp_ctl_value; - - trans_ddi_func_ctl_value =intel_de_read (dev_priv, -TRANS_DDI_FUNC_CTL (pipe)); - trans_conf_value =intel_de_read (dev_priv,PIPECONF (pipe)); - dp_tp_ctl_value =intel_de_read (dev_priv,TGL_DP_TP_CTL (pipe)); - - trans_ddi_func_ctl_value &= ~(TRANS_DDI_FUNC_ENABLE | -TGL_TRANS_DDI_PORT_MASK ); - trans_conf_value &= ~PIPECONF_ENABLE ; - dp_tp_ctl_value &= ~DP_TP_CTL_ENABLE ; - -intel_de_write (dev_priv,PIPECONF (pipe), trans_conf_value); -intel_de_write (dev_priv,TRANS_DDI_FUNC_CTL (pipe), - trans_ddi_func_ctl_value); -intel_de_write (dev_priv,TGL_DP_TP_CTL (pipe), dp_tp_ctl_value); -} - -static void -intel_dp_autotest_phy_ddi_enable (struct intel_dp *intel_dp, -const struct intel_crtc_state *crtc_state) -{ -struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = dig_port->base.base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); -enum port port = dig_port->base.port; -struct intel_crtc *crtc =to_intel_crtc (dig_port->base.base.crtc); -enum pipe pipe = crtc->pipe; -u32 trans_ddi_func_ctl_value, trans_conf_value, dp_tp_ctl_value; - - trans_ddi_func_ctl_value =intel_de_read (dev_priv, -TRANS_DDI_FUNC_CTL (pipe)); - trans_conf_value =intel_de_read (dev_priv,PIPECONF (pipe)); - dp_tp_ctl_value =intel_de_read (dev_priv,TGL_DP_TP_CTL (pipe)); - - trans_ddi_func_ctl_value |=TRANS_DDI_FUNC_ENABLE | -TGL_TRANS_DDI_SELECT_PORT (port); - trans_conf_value |=PIPECONF_ENABLE ; - dp_tp_ctl_value |=DP_TP_CTL_ENABLE ; - -intel_de_write (dev_priv,PIPECONF (pipe), trans_conf_value); -intel_de_write (dev_priv,TGL_DP_TP_CTL (pipe), dp_tp_ctl_value); -intel_de_write (dev_priv,TRANS_DDI_FUNC_CTL (pipe), - trans_ddi_func_ctl_value); -} -static void intel_dp_process_phy_request (struct intel_dp *intel_dp,const struct intel_crtc_state *crtc_state) {
@@ -3317,14 +3262,10 @@ static void intel_dp_process_phy_request(struct intel_dp *intel_dp,intel_dp_get_adjust_train (intel_dp, crtc_state,DP_PHY_DPRX , link_status); -intel_dp_autotest_phy_ddi_disable (intel_dp, crtc_state); -intel_dp_set_signal_levels (intel_dp, crtc_state,DP_PHY_DPRX );intel_dp_phy_pattern_update (intel_dp, crtc_state); -intel_dp_autotest_phy_ddi_enable (intel_dp, crtc_state); -drm_dp_dpcd_write (&intel_dp->aux,DP_TRAINING_LANE0_SET , intel_dp->train_set, crtc_state->lane_count);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 697/731 LoadPin: Ignore the "contents" argument of the LSM hooks
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 1a17e5b513ceebf21100027745b8731b4728edf7 ]
LoadPin only enforces the read-only origin of kernel file reads. Whether or not it was a partial read isn't important. Remove the overly conservative checks so that things like partial firmware reads will succeed (i.e. reading a firmware header).
--- security/loadpin/loadpin.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
security/loadpin/loadpin.c +18 -12
@@ -118,21 +118,11 @@ static void loadpin_sb_free_security(struct super_block *mnt_sb) } } -static int loadpin_read_file (struct file *file,enum kernel_read_file_id id, -bool contents) +static int loadpin_check (struct file *file,enum kernel_read_file_id id) {struct super_block *load_root;const char *origin =kernel_read_file_id_str (id); -/* -* If we will not know that we'll be seeing the full contents -* then we cannot trust a load will be complete and unchanged -* off disk. Treat all contents=false hooks as if there were -* no associated file struct. -*/ -if (!contents) - file =NULL ; -/* If the file id is excluded, ignore the pinning. */ if ((unsigned int )id <ARRAY_SIZE (ignore_read_file_id) && ignore_read_file_id[id]) {
@@ -187,9 +177,25 @@ static int loadpin_read_file(struct file *file, enum kernel_read_file_id id,return 0 ; } +static int loadpin_read_file (struct file *file,enum kernel_read_file_id id, +bool contents) +{ +/* +* LoadPin only cares about the _origin_ of a file, not its +* contents, so we can ignore the "are full contents available" +* argument here. +*/ +return loadpin_check (file, id); +} +static int loadpin_load_data (enum kernel_load_data_id id,bool contents) { -return loadpin_read_file (NULL , (enum kernel_read_file_id ) id, contents); +/* +* LoadPin only cares about the _origin_ of a file, not its +* contents, so a NULL file is passed, and we can ignore the +* state of "contents". +*/ +return loadpin_check (NULL , (enum kernel_read_file_id ) id); } static struct security_hook_list loadpin_hooks[] __lsm_ro_after_init = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 698/731 pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion
In reply to Greg Kroah-HartmanFrom: John Stultz <[email protected]>
[ Upstream commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721 ]
Wei Wang reported seeing priority inversion caused latencies caused by contention on pmsg_lock, and suggested it be switched to a rt_mutex.
I was initially hesitant this would help, as the tasks in that trace all seemed to be SCHED_NORMAL, so the benefit would be limited to only nice boosting.
However, another similar issue was raised where the priority inversion was seen did involve a blocked RT task so it is clear this would be helpful in that case.
--- fs/pstore/pmsg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/pstore/pmsg.c +4 -3
@@ -7,9 +7,10 @@#include <linux/device.h> #include <linux/fs.h> #include <linux/uaccess.h> +#include <linux/rtmutex.h> #include "internal.h" -static DEFINE_MUTEX (pmsg_lock); +static DEFINE_RT_MUTEX (pmsg_lock);static ssize_t write_pmsg (struct file *file,const char __user *buf,size_t count,loff_t *ppos)
@@ -28,9 +29,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,if (!access_ok (buf, count))return -EFAULT ; -mutex_lock (&pmsg_lock); +rt_mutex_lock (&pmsg_lock); ret = psinfo->write_user (&record, buf); -mutex_unlock (&pmsg_lock); +rt_mutex_unlock (&pmsg_lock);return ret ? ret : count; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 699/731 perf debug: Set debug_peo_args and redirect_to_stderr variable to correct values in perf_quiet_option()
In reply to Greg Kroah-HartmanFrom: Yang Jihong <[email protected]>
[ Upstream commit 188ac720d364035008a54d249cf47b4cc100f819 ]
When perf uses quiet mode, perf_quiet_option() sets the 'debug_peo_args' variable to -1, and display_attr() incorrectly determines the value of 'debug_peo_args'. As a result, unexpected information is displayed.
Before:
# perf record --quiet -- ls > /dev/null
------------------------------------------------------------
perf_event_attr:
size 128
{ sample_period, sample_freq } 4000
sample_type IP|TID|TIME|PERIOD
read_format ID|LOST
disabled 1
inherit 1
mmap 1
comm 1
freq 1
enable_on_exec 1
task 1
precise_ip 3
sample_id_all 1
exclude_guest 1
mmap2 1
comm_exec 1
ksymbol 1
bpf_event 1
------------------------------------------------------------
...After:
# perf record --quiet -- ls > /dev/null #
redirect_to_stderr is a similar problem.
--- tools/perf/util/debug.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/perf/util/debug.c +4 -0
@@ -241,6 +241,10 @@ int perf_quiet_option(void) opt++; } +/* For debug variables that are used as bool types, set to 0. */ + redirect_to_stderr =0 ; + debug_peo_args =0 ; +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 700/731 afs: Fix lost servers_outstanding count
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 36f82c93ee0bd88f1c95a52537906b8178b537f1 ]
The afs_fs_probe_dispatcher() work function is passed a count on net->servers_outstanding when it is scheduled (which may come via its timer). This is passed back to the work_item, passed to the timer or dropped at the end of the dispatcher function.
But, at the top of the dispatcher function, there are two checks which skip the rest of the function: if the network namespace is being destroyed or if there are no fileservers to probe. These two return paths, however, do not drop the count passed to the dispatcher, and so, sometimes, the destruction of a network namespace, such as induced by rmmod of the kafs module, may get stuck in afs_purge_servers(), waiting for net->servers_outstanding to become zero.
Fix this by adding the missing decrements in afs_fs_probe_dispatcher().
--- fs/afs/fs_probe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/afs/fs_probe.c +4 -1
@@ -366,12 +366,15 @@ void afs_fs_probe_dispatcher(struct work_struct *work)unsigned long nowj, timer_at, poll_at;bool first_pass = true, set_timer = false; -if (!net->live) +if (!net->live) { +afs_dec_servers_outstanding (net);return ; + }_enter ("" );if (list_empty (&net->fs_probe_fast) &&list_empty (&net->fs_probe_slow)) { +afs_dec_servers_outstanding (net);_leave (" [none]" );return ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 701/731 pstore: Make sure CONFIG_PSTORE_PMSG selects CONFIG_RT_MUTEXES
In reply to Greg Kroah-HartmanFrom: John Stultz <[email protected]>
[ Upstream commit 2f4fec5943407318b9523f01ce1f5d668c028332 ]
In commit 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion") I changed a lock to an rt_mutex.
However, its possible that CONFIG_RT_MUTEXES is not enabled, which then results in a build failure, as the 0day bot detected:
https://lore.kernel.org/linux-mm/[email protected]/
Thus this patch changes CONFIG_PSTORE_PMSG to select CONFIG_RT_MUTEXES, which ensures the build will not fail.
--- fs/pstore/Kconfig | 1 + 1 file changed, 1 insertion(+)
fs/pstore/Kconfig +1 -0
@@ -126,6 +126,7 @@ config PSTORE_CONSOLE config PSTORE_PMSG bool "Log user space messages" depends on PSTORE + select RT_MUTEXES help When the option is enabled, pstore will export a character interface /dev/pmsg0 to log user space messages. On reboot
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 702/731 ima: Simplify ima_lsm_copy_rule
In reply to Greg Kroah-HartmanFrom: GUO Zihua <[email protected]>
[ Upstream commit d57378d3aa4d864d9e590482602068af1b20c0c5 ]
Currently ima_lsm_copy_rule() set the arg_p field of the source rule to NULL, so that the source rule could be freed afterward. It does not make sense for this behavior to be inside a "copy" function. So move it outside and let the caller handle this field.
ima_lsm_copy_rule() now produce a shallow copy of the original entry including args_p field. Meaning only the lsm.rule and the rule itself should be freed for the original rule. Thus, instead of calling ima_lsm_free_rule() which frees lsm.rule as well as args_p field, free the lsm.rule directly.
--- security/integrity/ima/ima_policy.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
security/integrity/ima/ima_policy.c +3 -7
@@ -391,12 +391,6 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry) nentry->lsm[i].type = entry->lsm[i].type; nentry->lsm[i].args_p = entry->lsm[i].args_p; -/* -* Remove the reference from entry so that the associated -* memory will not be freed during a later call to -* ima_lsm_free_rule(entry). -*/ - entry->lsm[i].args_p =NULL ; ima_filter_rule_init(nentry->lsm[i].type, Audit_equal, nentry->lsm[i].args_p,
@@ -410,6 +404,7 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)static int ima_lsm_update_rule (struct ima_rule_entry *entry) { +int i;struct ima_rule_entry *nentry; nentry =ima_lsm_copy_rule (entry);
@@ -424,7 +419,8 @@ static int ima_lsm_update_rule(struct ima_rule_entry *entry)* references and the entry itself. All other memory refrences will now * be owned by nentry. */ -ima_lsm_free_rule (entry); +for (i =0 ; i <MAX_LSM_RULES ; i++) +ima_filter_rule_free (entry->lsm[i].rule);kfree (entry);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 703/731 ALSA: usb-audio: add the quirk for KT0206 device
In reply to Greg Kroah-HartmanFrom: wangdicheng <[email protected]>
commit 696b66ac26ef953aed5783ef26a252ec8f207013 upstream.
Add relevant information to the quirks-table.h file. The test passes and the sound source file plays normally.
--- sound/usb/quirks-table.h | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks-table.h +2 -0
@@ -76,6 +76,8 @@ { USB_DEVICE_VENDOR_SPEC(0x041e, 0x3f0a) },/* E-Mu 0204 USB */ { USB_DEVICE_VENDOR_SPEC(0x041e, 0x3f19) }, +/* Ktmicro Usb_audio device */ +{ USB_DEVICE_VENDOR_SPEC(0x31b2, 0x0011) },/* * Creative Technology, Ltd Live! Cam Sync HD [VF0770]
Greg Kroah-Hartman
maintainerPATCH 704/731 ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB
In reply to Greg Kroah-HartmanFrom: Edward Pacman <[email protected]>
commit 4bf5bf54476dffe60e6b6d8d539f67309ff599e2 upstream.
Lenovo TianYi510Pro-14IOB (17aa:3742)
require quirk for enabling headset-mic
--- sound/pci/hda/patch_realtek.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
sound/pci/hda/patch_realtek.c +27 -0
@@ -10593,6 +10593,17 @@ static void alc897_fixup_lenovo_headset_ } } +static void alc897_fixup_lenovo_headset_mode (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->parse_flags |=HDA_PINCFG_HEADSET_MIC ; + spec->gen.hp_automute_hook = alc897_hp_automute_hook; + } +} +static const struct coef_fw alc668_coefs[] = {WRITE_COEF (0x01 ,0xbebe ),WRITE_COEF (0x02 ,0xaaaa ),WRITE_COEF (0x03 ,0x0 ),WRITE_COEF (0x04 ,0x0180 ),WRITE_COEF (0x06 ,0x0 ),WRITE_COEF (0x07 ,0x0f80 ),
@@ -10676,6 +10687,8 @@ enum {ALC897_FIXUP_LENOVO_HEADSET_MIC ,ALC897_FIXUP_HEADSET_MIC_PIN ,ALC897_FIXUP_HP_HSMIC_VERB , +ALC897_FIXUP_LENOVO_HEADSET_MODE , + ALC897_FIXUP_HEADSET_MIC_PIN2, }; static const struct hda_fixup alc662_fixups[] = {
@@ -11102,6 +11115,19 @@ static const struct hda_fixup alc662_fix { } }, }, + [ALC897_FIXUP_LENOVO_HEADSET_MODE ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc897_fixup_lenovo_headset_mode, + }, + [ALC897_FIXUP_HEADSET_MIC_PIN2 ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x1a ,0x01a11140 },/* use as headset mic, without its own jack detect */ + { } + }, + .chained = true, + .chain_id =ALC897_FIXUP_LENOVO_HEADSET_MODE + }, };static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -11154,6 +11180,7 @@ static const struct snd_pci_quirk alc662SND_PCI_QUIRK (0x17aa ,0x32cb ,"Lenovo ThinkCentre M70" ,ALC897_FIXUP_HEADSET_MIC_PIN ),SND_PCI_QUIRK (0x17aa ,0x32cf ,"Lenovo ThinkCentre M950" ,ALC897_FIXUP_HEADSET_MIC_PIN ),SND_PCI_QUIRK (0x17aa ,0x32f7 ,"Lenovo ThinkCentre M90" ,ALC897_FIXUP_HEADSET_MIC_PIN ), +SND_PCI_QUIRK (0x17aa ,0x3742 ,"Lenovo TianYi510Pro-14IOB" ,ALC897_FIXUP_HEADSET_MIC_PIN2 ),SND_PCI_QUIRK (0x17aa ,0x38af ,"Lenovo Ideapad Y550P" ,ALC662_FIXUP_IDEAPAD ),SND_PCI_QUIRK (0x17aa ,0x3a0d ,"Lenovo Ideapad Y550" ,ALC662_FIXUP_IDEAPAD ), SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
Greg Kroah-Hartman
maintainerPATCH 705/731 ALSA: hda/hdmi: Add HP Device 0x8711 to force connect list
In reply to Greg Kroah-HartmanFrom: Jiao Zhou <[email protected]>
commit 31b573946ea55e1ea0e08ae8e83bcf879b30f83a upstream.
HDMI audio is not working on the HP EliteDesk 800 G6 because the pin is unconnected. This issue can be resolved by using the 'hdajackretask' tool to override the unconnected pin to force it to connect.
--- sound/pci/hda/patch_hdmi.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_hdmi.c +1 -0
@@ -1962,6 +1962,7 @@ static int hdmi_add_cvt(struct hda_codecstatic const struct snd_pci_quirk force_connect_list[] = {SND_PCI_QUIRK (0x103c ,0x870f ,"HP" ,1 ),SND_PCI_QUIRK (0x103c ,0x871a ,"HP" ,1 ), +SND_PCI_QUIRK (0x103c ,0x8711 ,"HP" ,1 ),SND_PCI_QUIRK (0x1462 ,0xec94 ,"MS-7C94" ,1 ),SND_PCI_QUIRK (0x8086 ,0x2081 ,"Intel NUC 10" ,1 ), {}
Greg Kroah-Hartman
maintainerPATCH 706/731 usb: cdnsp: fix lack of ZLP for ep0
In reply to Greg Kroah-HartmanFrom: Pawel Laszczak <[email protected]>
commit ae423ef5d095e09970f52c08020fdbf7f9d87c22 upstream.
Patch implements the handling of ZLP for control transfer. To send the ZLP driver must prepare the extra TRB in TD with length set to zero and TRB type to TRB_NORMAL.
The first TRB must have set TRB_CHAIN flag, TD_SIZE = 1 and TRB type to TRB_DATA.
--- drivers/usb/cdns3/cdnsp-ring.c | 42 +++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-)
drivers/usb/cdns3/cdnsp-ring.c +32 -10
@@ -2006,10 +2006,11 @@ int cdnsp_queue_bulk_tx(struct cdnsp_devint cdnsp_queue_ctrl_tx (struct cdnsp_device *pdev,struct cdnsp_request *preq) { -u32 field, length_field, remainder; +u32 field, length_field, zlp =0 ;struct cdnsp_ep *pep = preq->pep;struct cdnsp_ring *ep_ring;int num_trbs; +u32 maxp;int ret; ep_ring =cdnsp_request_to_transfer_ring (pdev, preq);
@@ -2019,26 +2020,33 @@ int cdnsp_queue_ctrl_tx(struct cdnsp_dev/* 1 TRB for data, 1 for status */ num_trbs = (pdev->three_stage_setup) ?2 :1 ; + maxp =usb_endpoint_maxp (pep->endpoint.desc); + +if (preq->request.zero && preq->request.length && + (preq->request.length % maxp ==0 )) { + num_trbs++; + zlp =1 ; + } + ret =cdnsp_prepare_transfer (pdev, preq, num_trbs);if (ret)return ret;/* If there's data, queue data TRBs */ -if (pdev->ep0_expect_in) - field =TRB_TYPE (TRB_DATA ) |TRB_IOC ; -else - field =TRB_ISP |TRB_TYPE (TRB_DATA ) |TRB_IOC ; -if (preq->request.length >0 ) { - remainder =cdnsp_td_remainder (pdev,0 , preq->request.length, - preq->request.length, preq,1 ,0 ); + field =TRB_TYPE (TRB_DATA ); - length_field =TRB_LEN (preq->request.length) | -TRB_TD_SIZE (remainder) |TRB_INTR_TARGET (0 ); +if (zlp) + field |=TRB_CHAIN ; +else + field |=TRB_IOC | (pdev->ep0_expect_in ?0 :TRB_ISP );if (pdev->ep0_expect_in) field |=TRB_DIR_IN ; + length_field =TRB_LEN (preq->request.length) | +TRB_TD_SIZE (zlp) |TRB_INTR_TARGET (0 ); + cdnsp_queue_trb(pdev, ep_ring, true, lower_32_bits(preq->request.dma), upper_32_bits(preq->request.dma), length_field,
@@ -2046,6 +2054,20 @@ int cdnsp_queue_ctrl_tx(struct cdnsp_devTRB_SETUPID (pdev->setup_id) | pdev->setup_speed); +if (zlp) { + field =TRB_TYPE (TRB_NORMAL ) |TRB_IOC ; + +if (!pdev->ep0_expect_in) + field =TRB_ISP ; + +cdnsp_queue_trb (pdev, ep_ring, true, +lower_32_bits (preq->request.dma), +upper_32_bits (preq->request.dma),0 , + field | ep_ring->cycle_state | +TRB_SETUPID (pdev->setup_id) | + pdev->setup_speed); + } + pdev->ep0_stage =CDNSP_DATA_STAGE ; }
Greg Kroah-Hartman
maintainerPATCH 707/731 usb: xhci-mtk: fix leakage of shared hcd when fail to set wakeup irq
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
commit 03a88b0bafbe3f548729d970d8366f48718c9b19 upstream.
Can not set the @shared_hcd to NULL before decrease the usage count by usb_put_hcd(), this will cause the shared hcd not released.
--- drivers/usb/host/xhci-mtk.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/host/xhci-mtk.c +0 -1
@@ -619,7 +619,6 @@ static int xhci_mtk_probe(struct platfor dealloc_usb3_hcd:usb_remove_hcd (xhci->shared_hcd); - xhci->shared_hcd =NULL ; dealloc_usb2_hcd:usb_remove_hcd (hcd);
Greg Kroah-Hartman
maintainerPATCH 708/731 arm64: dts: qcom: sm8250: fix USB-DP PHY registers
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit f8d8840c72b3df61b5252052b79020dabec01ab5 upstream.
When adding support for the DisplayPort part of the QMP PHY the binding (and devicetree parser) for the (USB) child node was simply reused and this has lead to some confusion.
The third DP register region is really the DP_PHY region, not "PCS" as the binding claims, and lie at offset 0x2a00 (not 0x2c00).
Similarly, there likely are no "RX", "RX2" or "PCS_MISC" regions as there are for the USB part of the PHY (and in any case the Linux driver does not use them).
Note that the sixth "PCS_MISC" region is not even in the binding.
--- arch/arm64/boot/dts/qcom/sm8250.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8250.dtsi +2 -3
@@ -2306,10 +2306,9 @@ dp_phy: dp-phy@88ea200 { reg = <0 0x088ea200 0 0x200>, <0 0x088ea400 0 0x200>, - <0 0x088eac00 0 0x400>, + <0 0x088eaa00 0 0x200>, <0 0x088ea600 0 0x200>, - <0 0x088ea800 0 0x200>, - <0 0x088eaa00 0 0x100>; + <0 0x088ea800 0 0x200>; #phy-cells = <0>; #clock-cells = <1>; };
Greg Kroah-Hartman
maintainerPATCH 709/731 usb: dwc3: Fix race between dwc3_set_mode and __dwc3_set_mode
In reply to Greg Kroah-HartmanFrom: Sven Peter <[email protected]>
commit 62c73bfea048e66168df09da6d3e4510ecda40bb upstream.
dwc->desired_dr_role is changed by dwc3_set_mode inside a spinlock but then read by __dwc3_set_mode outside of that lock. This can lead to a race condition when very quick successive role switch events happen:
CPU A
dwc3_set_mode(DWC3_GCTL_PRTCAP_HOST) // first role switch event spin_lock_irqsave(&dwc->lock, flags); dwc->desired_dr_role = mode; // DWC3_GCTL_PRTCAP_HOST spin_unlock_irqrestore(&dwc->lock, flags); queue_work(system_freezable_wq, &dwc->drd_work);
CPU B
__dwc3_set_mode // .... spin_lock_irqsave(&dwc->lock, flags); // desired_dr_role is DWC3_GCTL_PRTCAP_HOST dwc3_set_prtcap(dwc, dwc->desired_dr_role); spin_unlock_irqrestore(&dwc->lock, flags);
CPU A
dwc3_set_mode(DWC3_GCTL_PRTCAP_DEVICE) // second event spin_lock_irqsave(&dwc->lock, flags); dwc->desired_dr_role = mode; // DWC3_GCTL_PRTCAP_DEVICE spin_unlock_irqrestore(&dwc->lock, flags);
CPU B (continues running __dwc3_set_mode)
switch (dwc->desired_dr_role) { // DWC3_GCTL_PRTCAP_DEVICE
// ....
case DWC3_GCTL_PRTCAP_DEVICE:
// ....
ret = dwc3_gadget_init(dwc);We then have DWC3_GCTL.DWC3_GCTL_PRTCAPDIR = DWC3_GCTL_PRTCAP_HOST and dwc->current_dr_role = DWC3_GCTL_PRTCAP_HOST but initialized the controller in device mode. It's also possible to get into a state where both host and device are intialized at the same time. Fix this race by creating a local copy of desired_dr_role inside __dwc3_set_mode while holding dwc->lock.
--- drivers/usb/dwc3/core.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/usb/dwc3/core.c +10 -6
@@ -120,21 +120,25 @@ static void __dwc3_set_mode(struct work_unsigned long flags;int ret;u32 reg; +u32 desired_dr_role;mutex_lock (&dwc->mutex); +spin_lock_irqsave (&dwc->lock, flags); + desired_dr_role = dwc->desired_dr_role; +spin_unlock_irqrestore (&dwc->lock, flags);pm_runtime_get_sync (dwc->dev);if (dwc->current_dr_role ==DWC3_GCTL_PRTCAP_OTG )dwc3_otg_update (dwc,0 ); -if (!dwc->desired_dr_role) +if (!desired_dr_role) goto out; -if (dwc->desired_dr_role == dwc->current_dr_role) +if (desired_dr_role == dwc->current_dr_role) goto out; -if (dwc->desired_dr_role ==DWC3_GCTL_PRTCAP_OTG && dwc->edev) +if (desired_dr_role ==DWC3_GCTL_PRTCAP_OTG && dwc->edev) goto out;switch (dwc->current_dr_role) {
@@ -162,7 +166,7 @@ static void __dwc3_set_mode(struct work_*/ if (dwc->current_dr_role && ((DWC3_IP_IS (DWC3 ) || DWC3_VER_IS_PRIOR(DWC31, 190A)) && - dwc->desired_dr_role !=DWC3_GCTL_PRTCAP_OTG )) { + desired_dr_role !=DWC3_GCTL_PRTCAP_OTG )) { reg =dwc3_readl (dwc->regs,DWC3_GCTL ); reg |=DWC3_GCTL_CORESOFTRESET ;dwc3_writel (dwc->regs,DWC3_GCTL , reg);
@@ -182,11 +186,11 @@ static void __dwc3_set_mode(struct work_spin_lock_irqsave (&dwc->lock, flags); -dwc3_set_prtcap (dwc, dwc->desired_dr_role); +dwc3_set_prtcap (dwc, desired_dr_role);spin_unlock_irqrestore (&dwc->lock, flags); -switch (dwc->desired_dr_role) { +switch (desired_dr_role) {case DWC3_GCTL_PRTCAP_HOST : ret =dwc3_host_init (dwc);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 710/731 usb: dwc3: core: defer probe on ulpi_read_id timeout
In reply to Greg Kroah-HartmanFrom: Ferry Toth <[email protected]>
commit 63130462c919ece0ad0d9bb5a1f795ef8d79687e upstream.
Since commit 0f0101719138 ("usb: dwc3: Don't switch OTG -> peripheral if extcon is present"), Dual Role support on Intel Merrifield platform broke due to rearranging the call to dwc3_get_extcon().
It appears to be caused by ulpi_read_id() masking the timeout on the first test write. In the past dwc3 probe continued by calling dwc3_core_soft_reset() followed by dwc3_get_extcon() which happend to return -EPROBE_DEFER. On deferred probe ulpi_read_id() finally succeeded. Due to above mentioned rearranging -EPROBE_DEFER is not returned and probe completes without phy.
On Intel Merrifield the timeout on the first test write issue is reproducible but it is difficult to find the root cause. Using a mainline kernel and rootfs with buildroot ulpi_read_id() succeeds. As soon as adding ftrace / bootconfig to find out why, ulpi_read_id() fails and we can't analyze the flow. Using another rootfs ulpi_read_id() fails even without adding ftrace. We suspect the issue is some kind of timing / race, but merely retrying ulpi_read_id() does not resolve the issue.
As we now changed ulpi_read_id() to return -ETIMEDOUT in this case, we need to handle the error by calling dwc3_core_soft_reset() and request -EPROBE_DEFER. On deferred probe ulpi_read_id() is retried and succeeds.
--- drivers/usb/dwc3/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +6 -1
@@ -963,8 +963,13 @@ static int dwc3_core_init(struct dwc3 *dif (!dwc->ulpi_ready) { ret =dwc3_core_ulpi_init (dwc); -if (ret) +if (ret) { +if (ret == -ETIMEDOUT ) { +dwc3_core_soft_reset (dwc); + ret = -EPROBE_DEFER ; + } goto err0; + } dwc->ulpi_ready = true; }
Greg Kroah-Hartman
maintainerPATCH 711/731 xhci: Prevent infinite loop in transaction errors recovery for streams
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
commit a1575120972ecd7baa6af6a69e4e7ea9213bde7c upstream.
Make sure to also limit the amount of soft reset retries for transaction errors on streams in cases where the transaction error event doesn't point to any specific TRB.
In these cases we don't know the TRB or stream ring, but we do know which endpoint had the error.
To keep error counting simple and functional, move the current err_count from ring structure to endpoint structure.
--- drivers/usb/host/xhci-ring.c | 14 ++++++++++---- drivers/usb/host/xhci.h | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-ring.c +10 -4
@@ -2524,7 +2524,7 @@ static int process_bulk_intr_td(struct xswitch (trb_comp_code) {case COMP_SUCCESS : - ep_ring->err_count =0 ; + ep->err_count =0 ;/* handle success with untransferred data as short packet */ if (ep_trb != td->last_trb || remaining) {xhci_warn (xhci,"WARN Successful completion on short TX\n" );
@@ -2550,7 +2550,7 @@ static int process_bulk_intr_td(struct xbreak ;case COMP_USB_TRANSACTION_ERROR :if (xhci->quirks &XHCI_NO_SOFT_RETRY || - (ep_ring->err_count++ >MAX_SOFT_RETRY ) || + (ep->err_count++ >MAX_SOFT_RETRY ) ||le32_to_cpu (slot_ctx->tt_info) &TT_SLOT )break ;
@@ -2631,8 +2631,14 @@ static int handle_tx_event(struct xhci_hcase COMP_USB_TRANSACTION_ERROR :case COMP_INVALID_STREAM_TYPE_ERROR :case COMP_INVALID_STREAM_ID_ERROR : -xhci_handle_halted_endpoint (xhci, ep,0 ,NULL , -EP_SOFT_RESET ); +xhci_dbg (xhci,"Stream transaction error ep %u no id\n" , + ep_index); +if (ep->err_count++ >MAX_SOFT_RETRY ) +xhci_handle_halted_endpoint (xhci, ep,0 ,NULL , +EP_HARD_RESET ); +else +xhci_handle_halted_endpoint (xhci, ep,0 ,NULL , +EP_SOFT_RESET ); goto cleanup;case COMP_RING_UNDERRUN :case COMP_RING_OVERRUN :
drivers/usb/host/xhci.h +1 -1
@@ -933,6 +933,7 @@ struct xhci_virt_ep {* have to restore the device state to the previous state */ struct xhci_ring *new_ring; +unsigned int err_count;unsigned int ep_state;#define SET_DEQ_PENDING (1 << 0)#define EP_HALTED (1 << 1)/* For stall handling */
@@ -1629,7 +1630,6 @@ struct xhci_ring {* if we own the TRB (if we are the consumer). See section 4.9.1. */ u32 cycle_state; -unsigned int err_count;unsigned int stream_id;unsigned int num_segs;unsigned int num_trbs_free;
Greg Kroah-Hartman
maintainerPATCH 712/731 HID: wacom: Ensure bootloader PID is usable in hidraw mode
In reply to Greg Kroah-HartmanFrom: Jason Gerecke <[email protected]>
commit 1db1f392591aff13fd643f0ec7c1d5e27391d700 upstream.
Some Wacom devices have a special "bootloader" mode that is used for firmware flashing. When operating in this mode, the device cannot be used for input, and the HID descriptor is not able to be processed by the driver. The driver generates an "Unknown device_type" warning and then returns an error code from wacom_probe(). This is a problem because userspace still needs to be able to interact with the device via hidraw to perform the firmware flash.
This commit adds a non-generic device definition for 056a:0094 which is used when devices are in "bootloader" mode. It marks the devices with a special BOOTLOADER type that is recognized by wacom_probe() and wacom_raw_event(). When we see this type we ensure a hidraw device is created and otherwise keep our hands off so that userspace is in full control.
--- drivers/hid/wacom_sys.c | 8 ++++++++ drivers/hid/wacom_wac.c | 4 ++++ drivers/hid/wacom_wac.h | 1 + 3 files changed, 13 insertions(+)
drivers/hid/wacom_sys.c +8 -0
@@ -160,6 +160,9 @@ static int wacom_raw_event(struct hid_de {struct wacom *wacom =hid_get_drvdata (hdev); +if (wacom->wacom_wac.features.type ==BOOTLOADER ) +return 0 ; +if (size >WACOM_PKGLEN_MAX )return 1 ;
@@ -2792,6 +2795,11 @@ static int wacom_probe(struct hid_devicereturn error; } +if (features->type ==BOOTLOADER ) { +hid_warn (hdev,"Using device in hidraw-only mode" ); +return hid_hw_start (hdev,HID_CONNECT_HIDRAW ); + } + error =wacom_parse_and_register (wacom, false);if (error)return error;
drivers/hid/wacom_wac.c +4 -0
@@ -4813,6 +4813,9 @@ static const struct wacom_features wacomstatic const struct wacom_features wacom_features_HID_ANY_ID = {"Wacom HID" , .type =HID_GENERIC , .oVid =HID_ANY_ID , .oPid =HID_ANY_ID }; +static const struct wacom_features wacom_features_0x94 = + {"Wacom Bootloader" , .type =BOOTLOADER }; +#define USB_DEVICE_WACOM (prod) \ HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ .driver_data = (kernel_ulong_t)&wacom_features_##prod
@@ -4886,6 +4889,7 @@ const struct hid_device_id wacom_ids[] = { USB_DEVICE_WACOM(0x84) }, { USB_DEVICE_WACOM(0x90) }, { USB_DEVICE_WACOM(0x93) }, + { USB_DEVICE_WACOM(0x94) }, { USB_DEVICE_WACOM(0x97) }, { USB_DEVICE_WACOM(0x9A) }, { USB_DEVICE_WACOM(0x9F) },
drivers/hid/wacom_wac.h +1 -0
@@ -242,6 +242,7 @@ enum {MTTPC ,MTTPC_B ,HID_GENERIC , +BOOTLOADER , MAX_TYPE };
Greg Kroah-Hartman
maintainerPATCH 713/731 HID: mcp2221: dont connect hidraw
In reply to Greg Kroah-HartmanFrom: Enrik Berkhan <[email protected]>
commit 67c90d14018775556d5420382ace86521421f9ff upstream.
The MCP2221 driver should not connect to the hidraw userspace interface, as it needs exclusive access to the chip.
If you want to use /dev/hidrawX with the MCP2221, you need to avoid binding this driver to the device and use the hid generic driver instead (e.g. using udev rules).
--- drivers/hid/hid-mcp2221.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/hid/hid-mcp2221.c +9 -3
@@ -840,12 +840,19 @@ static int mcp2221_probe(struct hid_devireturn ret; } - ret =hid_hw_start (hdev,HID_CONNECT_HIDRAW ); +/* +* This driver uses the .raw_event callback and therefore does not need any +* HID_CONNECT_xxx flags. +*/ + ret =hid_hw_start (hdev,0 );if (ret) {hid_err (hdev,"can't start hardware\n" );return ret; } +hid_info (hdev,"USB HID v%x.%02x Device [%s] on %s\n" , hdev->version >>8 , + hdev->version &0xff , hdev->name, hdev->phys); + ret =hid_hw_open (hdev);if (ret) {hid_err (hdev,"can't open device\n" );
@@ -870,8 +877,7 @@ static int mcp2221_probe(struct hid_devi mcp->adapter.retries =1 ; mcp->adapter.dev.parent = &hdev->dev;snprintf (mcp->adapter.name,sizeof (mcp->adapter.name), -"MCP2221 usb-i2c bridge on hidraw%d" , - ((struct hidraw *)hdev->hidraw)->minor); +"MCP2221 usb-i2c bridge" ); ret =i2c_add_adapter (&mcp->adapter);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 714/731 loop: Fix the max_loop commandline argument treatment when it is set to 0
In reply to Greg Kroah-HartmanFrom: Isaac J. Manjarres <[email protected]>
commit 85c50197716c60fe57f411339c579462e563ac57 upstream.
Currently, the max_loop commandline argument can be used to specify how many loop block devices are created at init time. If it is not specified on the commandline, CONFIG_BLK_DEV_LOOP_MIN_COUNT loop block devices will be created.
The max_loop commandline argument can be used to override the value of CONFIG_BLK_DEV_LOOP_MIN_COUNT. However, when max_loop is set to 0 through the commandline, the current logic treats it as if it had not been set, and creates CONFIG_BLK_DEV_LOOP_MIN_COUNT devices anyway.
Fix this by starting max_loop off as set to CONFIG_BLK_DEV_LOOP_MIN_COUNT. This preserves the intended behavior of creating CONFIG_BLK_DEV_LOOP_MIN_COUNT loop block devices if the max_loop commandline parameter is not specified, and allowing max_loop to be respected for all values, including 0.
This allows environments that can create all of their required loop block devices on demand to not have to unnecessarily preallocate loop block devices.
--- drivers/block/loop.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
drivers/block/loop.c +12 -16
@@ -2091,7 +2091,16 @@ static const struct block_device_operati/* * And now the modules code and kernel interface. */ -static int max_loop; + +/* +* If max_loop is specified, create that many devices upfront. +* This also becomes a hard limit. If max_loop is not specified, +* create CONFIG_BLK_DEV_LOOP_MIN_COUNT loop devices at module +* init time. Loop devices can be requested on-demand with the +* /dev/loop-control interface, or be instantiated by accessing +* a 'dead' device node. +*/ +static int max_loop =CONFIG_BLK_DEV_LOOP_MIN_COUNT ;module_param (max_loop, int,0444 );MODULE_PARM_DESC (max_loop,"Maximum number of loop devices" );module_param (max_part, int,0444 );
@@ -2536,7 +2545,7 @@ MODULE_ALIAS("devname:loop-control");static int __init loop_init (void ) { -int i, nr; +int i;int err; part_shift =0 ;
@@ -2564,19 +2573,6 @@ static int __init loop_init(void) goto err_out; } -/* -* If max_loop is specified, create that many devices upfront. -* This also becomes a hard limit. If max_loop is not specified, -* create CONFIG_BLK_DEV_LOOP_MIN_COUNT loop devices at module -* init time. Loop devices can be requested on-demand with the -* /dev/loop-control interface, or be instantiated by accessing -* a 'dead' device node. -*/ -if (max_loop) - nr = max_loop; -else - nr =CONFIG_BLK_DEV_LOOP_MIN_COUNT ; - err =misc_register (&loop_misc);if (err <0 ) goto err_out;
@@ -2588,7 +2584,7 @@ static int __init loop_init(void) }/* pre-create number of devices given by config or max_loop */ -for (i =0 ; i < nr; i++) +for (i =0 ; i < max_loop; i++)loop_add (i);printk (KERN_INFO "loop: module loaded\n" );
Greg Kroah-Hartman
maintainerPATCH 715/731 9p: set req refcount to zero to avoid uninitialized usage
In reply to Greg Kroah-HartmanFrom: Schspa Shi <[email protected]>
commit 26273ade77f54716e30dfd40ac6e85ceb54ac0f9 upstream.
When a new request is allocated, the refcount will be zero if it is reused, but if the request is newly allocated from slab, it is not fully initialized before being added to idr.
If the p9_read_work got a response before the refcount initiated. It will use a uninitialized req, which will result in a bad request data struct.
Here is the logs from syzbot.
Corrupted memory at 0xffff88807eade00b [ 0xff 0x07 0x00 0x00 0x00 0x00 0x00 0x00 . . . . . . . . ] (in kfence-#110):
p9_fcall_fini net/9p/client.c:248 [inline] p9_req_put net/9p/client.c:396 [inline] p9_req_put+0x208/0x250 net/9p/client.c:390 p9_client_walk+0x247/0x540 net/9p/client.c:1165 clone_fid fs/9p/fid.h:21 [inline] v9fs_fid_xattr_set+0xe4/0x2b0 fs/9p/xattr.c:118 v9fs_xattr_set fs/9p/xattr.c:100 [inline] v9fs_xattr_handler_set+0x6f/0x120 fs/9p/xattr.c:159 __vfs_setxattr+0x119/0x180 fs/xattr.c:182 __vfs_setxattr_noperm+0x129/0x5f0 fs/xattr.c:216 __vfs_setxattr_locked+0x1d3/0x260 fs/xattr.c:277 vfs_setxattr+0x143/0x340 fs/xattr.c:309 setxattr+0x146/0x160 fs/xattr.c:617 path_setxattr+0x197/0x1c0 fs/xattr.c:636 __do_sys_setxattr fs/xattr.c:652 [inline] __se_sys_setxattr fs/xattr.c:648 [inline] __ia32_sys_setxattr+0xc0/0x160 fs/xattr.c:648 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82
Below is a similar scenario, the scenario in the syzbot log looks more complicated than this one, but this patch can fix it.
T21124 p9_read_work
======================== second trans ================================= p9_client_walk
p9_client_rpc
p9_client_prepare_req
p9_tag_alloc
req = kmem_cache_alloc(p9_req_cache, GFP_NOFS);
tag = idr_alloc
<< preempted >>
req->tc.tag = tag;
/* req->[refcount/tag] == uninitialized */
m->rreq = p9_tag_lookup(m->client, m->rc.tag);
/* increments uninitalized refcount */
refcount_set(&req->refcount, 2);
/* cb drops one ref */
p9_client_cb(req)
/* reader thread drops its ref:
request is incorrectly freed */
p9_req_put(req)
/* use after free and ref underflow */
p9_req_put(req)To fix it, we can initialize the refcount to zero before add to idr.
--- net/9p/client.c | 5 +++++ 1 file changed, 5 insertions(+)
net/9p/client.c +5 -0
@@ -281,6 +281,11 @@ p9_tag_alloc(struct p9_client *c, int8_tp9pdu_reset (&req->rc); req->t_err =0 ; req->status =REQ_STATUS_ALLOC ; +/* refcount needs to be set to 0 before inserting into the idr +* so p9_tag_lookup does not accept a request that is not fully +* initialized. refcount_set to 2 below will mark request ready. +*/ +refcount_set (&req->refcount,0 );init_waitqueue_head (&req->wq);INIT_LIST_HEAD (&req->req_list);
Greg Kroah-Hartman
maintainerPATCH 716/731 security: Restrict CONFIG_ZERO_CALL_USED_REGS to gcc or clang > 15.0.6
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit d6a9fb87e9d18f3394a9845546bbe868efdccfd2 upstream.
A bad bug in clang's implementation of -fzero-call-used-regs can result in NULL pointer dereferences (see the links above the check for more information). Restrict CONFIG_CC_HAS_ZERO_CALL_USED_REGS to either a supported GCC version or a clang newer than 15.0.6, which will catch both a theoretical 15.0.7 and the upcoming 16.0.0, which will both have the bug fixed.
--- security/Kconfig.hardening | 3 +++ 1 file changed, 3 insertions(+)
security/Kconfig.hardening +3 -0
@@ -240,6 +240,9 @@ config INIT_ON_FREE_DEFAULT_ON config CC_HAS_ZERO_CALL_USED_REGS def_bool $(cc-option,-fzero-call-used-regs=used-gpr) + # https://github.com/ClangBuiltLinux/linux/issues/1766 + # https://github.com/llvm/llvm-project/issues/59242 + depends on !CC_IS_CLANG || CLANG_VERSION > 150006 config ZERO_CALL_USED_REGS bool "Enable register zeroing on function exit"
Greg Kroah-Hartman
maintainerPATCH 717/731 reiserfs: Add missing calls to reiserfs_security_free()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 572302af1258459e124437b8f3369357447afac7 upstream.
Commit 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes during inode creation") defined reiserfs_security_free() to free the name and value of a security xattr allocated by the active LSM through security_old_inode_init_security(). However, this function is not called in the reiserfs code.
Thus, add a call to reiserfs_security_free() whenever reiserfs_security_init() is called, and initialize value to NULL, to avoid to call kfree() on an uninitialized pointer.
Finally, remove the kfree() for the xattr name, as it is not allocated anymore.
--- fs/reiserfs/namei.c | 4 ++++ fs/reiserfs/xattr_security.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
fs/reiserfs/namei.c +4 -0
@@ -696,6 +696,7 @@ static int reiserfs_create(struct user_n out_failed:reiserfs_write_unlock (dir->i_sb); +reiserfs_security_free (&security);return retval; }
@@ -779,6 +780,7 @@ static int reiserfs_mknod(struct user_na out_failed:reiserfs_write_unlock (dir->i_sb); +reiserfs_security_free (&security);return retval; }
@@ -878,6 +880,7 @@ static int reiserfs_mkdir(struct user_na retval =journal_end (&th); out_failed:reiserfs_write_unlock (dir->i_sb); +reiserfs_security_free (&security);return retval; }
@@ -1194,6 +1197,7 @@ static int reiserfs_symlink(struct user_ retval =journal_end (&th); out_failed:reiserfs_write_unlock (parent_dir->i_sb); +reiserfs_security_free (&security);return retval; }
fs/reiserfs/xattr_security.c +1 -1
@@ -50,6 +50,7 @@ int reiserfs_security_init(struct inodeint error; sec->name =NULL ; + sec->value =NULL ;/* Don't add selinux attributes on xattrs - they'll never get used */ if (IS_PRIVATE (dir))
@@ -95,7 +96,6 @@ int reiserfs_security_write(struct reisevoid reiserfs_security_free (struct reiserfs_security_handle *sec) { -kfree (sec->name);kfree (sec->value); sec->name =NULL ; sec->value =NULL ;
Greg Kroah-Hartman
maintainerPATCH 718/731 iio: fix memory leak in iio_device_register_eventset()
In reply to Greg Kroah-HartmanFrom: Zeng Heng <[email protected]>
commit 86fdd15e10e404e70ecb2a3bff24d70356d42b36 upstream.
When iio_device_register_sysfs_group() returns failed, iio_device_register_eventset() needs to free attrs array.
Otherwise, kmemleak would scan & report memory leak as below:
unreferenced object 0xffff88810a1cc3c0 (size 32):
comm "100-i2c-vcnl302", pid 728, jiffies 4295052307 (age 156.027s) backtrace:
__kmalloc+0x46/0x1b0
iio_device_register_eventset at drivers/iio/industrialio-event.c:541
__iio_device_register at drivers/iio/industrialio-core.c:1959
__devm_iio_device_register at drivers/iio/industrialio-core.c:2040--- drivers/iio/industrialio-event.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/industrialio-event.c +3 -1
@@ -549,7 +549,7 @@ int iio_device_register_eventset(struct ret =iio_device_register_sysfs_group (indio_dev, &ev_int->group);if (ret) - goto error_free_setup_event_lines; + goto error_free_group_attrs; ev_int->ioctl_handler.ioctl = iio_event_ioctl; iio_device_ioctl_handler_register(&iio_dev_opaque->indio_dev,
@@ -557,6 +557,8 @@ int iio_device_register_eventset(structreturn 0 ; +error_free_group_attrs: +kfree (ev_int->group.attrs); error_free_setup_event_lines:iio_free_chan_devattr_list (&ev_int->dev_attr_list);kfree (ev_int);
Greg Kroah-Hartman
maintainerPATCH 719/731 iio: adc: ad_sigma_delta: do not use internal iio_dev lock
In reply to Greg Kroah-HartmanFrom: Nuno Sá <[email protected]>
commit 20228a1d5a55e7db0c6720840f2c7d2b48c55f69 upstream.
Drop 'mlock' usage by making use of iio_device_claim_direct_mode(). This change actually makes sure we cannot do a single conversion while buffering is enable. Note there was a potential race in the previous code since we were only acquiring the lock after checking if the bus is enabled.
--- drivers/iio/adc/ad_sigma_delta.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/adc/ad_sigma_delta.c +4 -4
@@ -280,10 +280,10 @@ int ad_sigma_delta_single_conversion(strunsigned int data_reg;int ret =0 ; -if (iio_buffer_enabled (indio_dev)) -return -EBUSY ; + ret =iio_device_claim_direct_mode (indio_dev); +if (ret) +return ret; -mutex_lock (&indio_dev->mlock);ad_sigma_delta_set_channel (sigma_delta, chan->address);spi_bus_lock (sigma_delta->spi->master);
@@ -322,7 +322,7 @@ out:ad_sigma_delta_set_mode (sigma_delta,AD_SD_MODE_IDLE ); sigma_delta->bus_locked = false;spi_bus_unlock (sigma_delta->spi->master); -mutex_unlock (&indio_dev->mlock); +iio_device_release_direct_mode (indio_dev);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 720/731 iio: adc128s052: add proper .data members in adc128_of_match table
In reply to Greg Kroah-HartmanFrom: Rasmus Villemoes <[email protected]>
commit e2af60f5900c6ade53477b494ffb54690eee11f5 upstream.
Prior to commit bd5d54e4d49d ("iio: adc128s052: add ACPI _HID AANT1280"), the driver unconditionally used spi_get_device_id() to get the index into the adc128_config array.
However, with that commit, OF-based boards now incorrectly treat all supported sensors as if they are an adc128s052, because all the .data members of the adc128_of_match table are implicitly 0. Our board, which has an adc122s021, thus exposes 8 channels whereas it really only has two.
--- drivers/iio/adc/ti-adc128s052.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/iio/adc/ti-adc128s052.c +7 -7
@@ -193,13 +193,13 @@ static int adc128_remove(struct spi_devi }static const struct of_device_id adc128_of_match[] = { - { .compatible ="ti,adc128s052" , }, - { .compatible ="ti,adc122s021" , }, - { .compatible ="ti,adc122s051" , }, - { .compatible ="ti,adc122s101" , }, - { .compatible ="ti,adc124s021" , }, - { .compatible ="ti,adc124s051" , }, - { .compatible ="ti,adc124s101" , }, + { .compatible ="ti,adc128s052" , .data = (void *)0L , }, + { .compatible ="ti,adc122s021" , .data = (void *)1L , }, + { .compatible ="ti,adc122s051" , .data = (void *)1L , }, + { .compatible ="ti,adc122s101" , .data = (void *)1L , }, + { .compatible ="ti,adc124s021" , .data = (void *)2L , }, + { .compatible ="ti,adc124s051" , .data = (void *)2L , }, + { .compatible ="ti,adc124s101" , .data = (void *)2L , }, {/* sentinel */ }, };MODULE_DEVICE_TABLE (of, adc128_of_match);
Greg Kroah-Hartman
maintainerPATCH 721/731 regulator: core: fix deadlock on regulator enable
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit cb3543cff90a4448ed560ac86c98033ad5fecda9 upstream.
When updating the operating mode as part of regulator enable, the caller has already locked the regulator tree and drms_uA_update() must not try to do the same in order not to trigger a deadlock.
The lock inversion is reported by lockdep as:
======================================================
WARNING: possible circular locking dependency detected
6.1.0-next-20221215 #142 Not tainted
------------------------------------------------------
udevd/154 is trying to acquire lock:
ffffc11f123d7e50 (regulator_list_mutex){+.+.}-{3:3}, at: regulator_lock_dependent+0x54/0x280
but task is already holding lock:
ffff80000e4c36e8 (regulator_ww_class_acquire){+.+.}-{0:0}, at: regulator_enable+0x34/0x80
which lock already depends on the new lock.
...
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(regulator_ww_class_acquire);
lock(regulator_list_mutex);
lock(regulator_ww_class_acquire);
lock(regulator_list_mutex);*** DEADLOCK ***
just before probe of a Qualcomm UFS controller (occasionally) deadlocks when enabling one of its regulators.
--- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
@@ -962,7 +962,7 @@ static int drms_uA_update(struct regulat/* get input voltage */ input_uV =0 ;if (rdev->supply) - input_uV =regulator_get_voltage (rdev->supply); + input_uV =regulator_get_voltage_rdev (rdev->supply->rdev);if (input_uV <=0 ) input_uV = rdev->constraints->input_uV;if (input_uV <=0 ) {
Greg Kroah-Hartman
maintainerPATCH 722/731 floppy: Fix memory leak in do_floppy_init()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
commit f8ace2e304c5dd8a7328db9cd2b8a4b1b98d83ec upstream.
A memory leak was reported when floppy_alloc_disk() failed in do_floppy_init().
unreferenced object 0xffff888115ed25a0 (size 8):
comm "modprobe", pid 727, jiffies 4295051278 (age 25.529s) hex dump (first 8 bytes):
00 ac 67 5b 81 88 ff ff ..g[....
backtrace:
[<000000007f457abb>] __kmalloc_node+0x4c/0xc0
[<00000000a87bfa9e>] blk_mq_realloc_tag_set_tags.part.0+0x6f/0x180
[<000000006f02e8b1>] blk_mq_alloc_tag_set+0x573/0x1130
[<0000000066007fd7>] 0xffffffffc06b8b08
[<0000000081f5ac40>] do_one_initcall+0xd0/0x4f0
[<00000000e26d04ee>] do_init_module+0x1a4/0x680
[<000000001bb22407>] load_module+0x6249/0x7110
[<00000000ad31ac4d>] __do_sys_finit_module+0x140/0x200
[<000000007bddca46>] do_syscall_64+0x35/0x80
[<00000000b5afec39>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
unreferenced object 0xffff88810fc30540 (size 32):
comm "modprobe", pid 727, jiffies 4295051278 (age 25.529s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000007f457abb>] __kmalloc_node+0x4c/0xc0
[<000000006b91eab4>] blk_mq_alloc_tag_set+0x393/0x1130
[<0000000066007fd7>] 0xffffffffc06b8b08
[<0000000081f5ac40>] do_one_initcall+0xd0/0x4f0
[<00000000e26d04ee>] do_init_module+0x1a4/0x680
[<000000001bb22407>] load_module+0x6249/0x7110
[<00000000ad31ac4d>] __do_sys_finit_module+0x140/0x200
[<000000007bddca46>] do_syscall_64+0x35/0x80
[<00000000b5afec39>] entry_SYSCALL_64_after_hwframe+0x46/0xb0If the floppy_alloc_disk() failed, disks of current drive will not be set, thus the lastest allocated set->tag cannot be freed in the error handling path. A simple call graph shown as below:
floppy_module_init()
floppy_init()
do_floppy_init()
for (drive = 0; drive < N_DRIVE; drive++)
blk_mq_alloc_tag_set()
blk_mq_alloc_tag_set_tags()
blk_mq_realloc_tag_set_tags() # set->tag allocated
floppy_alloc_disk()
blk_mq_alloc_disk() # error occurred, disks failed to allocated
->out_put_disk:
for (drive = 0; drive < N_DRIVE; drive++)
if (!disks[drive][0]) # the last disks is not set and loop break
break;
blk_mq_free_tag_set() # the latest allocated set->tag leakedFix this problem by free the set->tag of current drive before jump to error handling path.
--- drivers/block/floppy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/floppy.c +3 -1
@@ -4587,8 +4587,10 @@ static int __init do_floppy_init(void) goto out_put_disk; err =floppy_alloc_disk (drive,0 ); -if (err) +if (err) { +blk_mq_free_tag_set (&tag_sets[drive]); goto out_put_disk; + }timer_setup (&motor_off_timer[drive], motor_off_callback,0 ); }
Greg Kroah-Hartman
maintainerPATCH 723/731 gcov: add support for checksum field
In reply to Greg Kroah-HartmanFrom: Rickard x Andersson <[email protected]>
commit e96b95c2b7a63a454b6498e2df67aac14d046d13 upstream.
In GCC version 12.1 a checksum field was added.
This patch fixes a kernel crash occurring during boot when using gcov-kernel with GCC version 12.2. The crash occurred on a system running on i.MX6SX.
--- kernel/gcov/gcc_4_7.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/gcov/gcc_4_7.c +5 -0
@@ -82,6 +82,7 @@ struct gcov_fn_info {* @version: gcov version magic indicating the gcc version used for compilation * @next: list head for a singly-linked list * @stamp: uniquifying time stamp +* @checksum: unique object checksum * @filename: name of the associated gcov data file * @merge: merge functions (null for unused counter type) * @n_functions: number of instrumented functions
@@ -94,6 +95,10 @@ struct gcov_info {unsigned int version;struct gcov_info *next;unsigned int stamp; +/* Since GCC 12.1 a checksum field is added. */ +#if (__GNUC__ >=12 ) +unsigned int checksum; +#endif const char *filename;void (*merge[GCOV_COUNTERS ])(gcov_type *,unsigned int );unsigned int n_functions;
Greg Kroah-Hartman
maintainerPATCH 724/731 fbdev: fbcon: release buffer when fbcon_do_set_font() failed
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit 3c3bfb8586f848317ceba5d777e11204ba3e5758 upstream.
syzbot is reporting memory leak at fbcon_do_set_font() [1], for commit a5a923038d70 ("fbdev: fbcon: Properly revert changes when vc_resize() failed") missed that the buffer might be newly allocated by fbcon_set_font().
--- drivers/video/fbdev/core/fbcon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/fbdev/core/fbcon.c +2 -1
@@ -2462,7 +2462,8 @@ err_out:if (userfont) { p->userfont = old_userfont; -REFCOUNT (data)--; +if (--REFCOUNT (data) ==0 ) +kfree (data -FONT_EXTRA_WORDS *sizeof (int )); } vc->vc_font.width = old_width;
Greg Kroah-Hartman
maintainerPATCH 725/731 ovl: fix use inode directly in rcu-walk mode
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
commit 672e4268b2863d7e4978dfed29552b31c2f9bd4e upstream.
ovl_dentry_revalidate_common() can be called in rcu-walk mode. As document said, "in rcu-walk mode, d_parent and d_inode should not be used without care".
Check inode here to protect access under rcu-walk mode.
--- fs/overlayfs/super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/overlayfs/super.c +6 -1
@@ -138,11 +138,16 @@ static int ovl_dentry_revalidate_common( unsigned int flags, bool weak) {struct ovl_entry *oe = dentry->d_fsdata; +struct inode *inode =d_inode_rcu (dentry);struct dentry *upper;unsigned int i;int ret =1 ; - upper =ovl_dentry_upper (dentry); +/* Careful in RCU mode */ +if (!inode) +return -ECHILD ; + + upper =ovl_i_dentry_upper (inode);if (upper) ret =ovl_revalidate_real (upper, flags, weak);
Greg Kroah-Hartman
maintainerPATCH 726/731 btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 162d053e15fe985f754ef495a96eb3db970c43ed upstream.
If we get -ENOMEM while dropping file extent items in a given range, at btrfs_drop_extents(), due to failure to allocate memory when attempting to increment the reference count for an extent or drop the reference count, we handle it with a BUG_ON(). This is excessive, instead we can simply abort the transaction and return the error to the caller. In fact most callers of btrfs_drop_extents(), directly or indirectly, already abort the transaction if btrfs_drop_extents() returns any error.
Also, we already have error paths at btrfs_drop_extents() that may return -ENOMEM and in those cases we abort the transaction, like for example anything that changes the b+tree may return -ENOMEM due to a failure to allocate a new extent buffer when COWing an existing extent buffer, such as a call to btrfs_duplicate_item() for example.
So replace the BUG_ON() calls with proper logic to abort the transaction and return the error.
--- fs/btrfs/file.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/file.c +8 -2
@@ -872,7 +872,10 @@ next_slot: args->start - extent_offset, 0, false); ret =btrfs_inc_extent_ref (trans, &ref); -BUG_ON (ret);/* -ENOMEM */ +if (ret) { +btrfs_abort_transaction (trans, ret); +break ; + } } key.offset = args->start; }
@@ -959,7 +962,10 @@ delete_extent_item: key.offset - extent_offset,0 , false); ret =btrfs_free_extent (trans, &ref); -BUG_ON (ret);/* -ENOMEM */ +if (ret) { +btrfs_abort_transaction (trans, ret); +break ; + } args->bytes_found += extent_end - key.offset; }
Greg Kroah-Hartman
maintainerPATCH 727/731 scsi: qla2xxx: Fix crash when I/O abort times out
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
commit 68ad83188d782b2ecef2e41ac245d27e0710fe8e upstream.
While performing CPU hotplug, a crash with the following stack was seen:
Call Trace:
qla24xx_process_response_queue+0x42a/0x970 [qla2xxx]
qla2x00_start_nvme_mq+0x3a2/0x4b0 [qla2xxx]
qla_nvme_post_cmd+0x166/0x240 [qla2xxx]
nvme_fc_start_fcp_op.part.0+0x119/0x2e0 [nvme_fc]
blk_mq_dispatch_rq_list+0x17b/0x610
__blk_mq_sched_dispatch_requests+0xb0/0x140
blk_mq_sched_dispatch_requests+0x30/0x60
__blk_mq_run_hw_queue+0x35/0x90
__blk_mq_delay_run_hw_queue+0x161/0x180
blk_execute_rq+0xbe/0x160
__nvme_submit_sync_cmd+0x16f/0x220 [nvme_core]
nvmf_connect_admin_queue+0x11a/0x170 [nvme_fabrics]
nvme_fc_create_association.cold+0x50/0x3dc [nvme_fc]
nvme_fc_connect_ctrl_work+0x19/0x30 [nvme_fc]
process_one_work+0x1e8/0x3c0On abort timeout, completion was called without checking if the I/O was already completed.
Verify that I/O and abort request are indeed outstanding before attempting completion.
--- drivers/scsi/qla2xxx/qla_init.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +10 -4
@@ -110,6 +110,7 @@ static void qla24xx_abort_iocb_timeout(vstruct qla_qpair *qpair = sp->qpair;u32 handle;unsigned long flags; +int sp_found =0 , cmdsp_found =0 ;if (sp->cmd_sp) ql_dbg(ql_dbg_async, sp->vha, 0x507c,
@@ -124,18 +125,21 @@ static void qla24xx_abort_iocb_timeout(vspin_lock_irqsave (qpair->qp_lock_ptr, flags);for (handle =1 ; handle < qpair->req->num_outstanding_cmds; handle++) {if (sp->cmd_sp && (qpair->req->outstanding_cmds[handle] == - sp->cmd_sp)) + sp->cmd_sp)) { qpair->req->outstanding_cmds[handle] =NULL ; + cmdsp_found =1 ; + }/* removing the abort */ if (qpair->req->outstanding_cmds[handle] == sp) { qpair->req->outstanding_cmds[handle] =NULL ; + sp_found =1 ;break ; } }spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); -if (sp->cmd_sp) { +if (cmdsp_found && sp->cmd_sp) {/* * This done function should take care of * original command ref: INIT
@@ -143,8 +147,10 @@ static void qla24xx_abort_iocb_timeout(v sp->cmd_sp->done (sp->cmd_sp,QLA_OS_TIMER_EXPIRED ); } - abt->u.abt.comp_status =cpu_to_le16 (CS_TIMEOUT ); - sp->done (sp,QLA_OS_TIMER_EXPIRED ); +if (sp_found) { + abt->u.abt.comp_status =cpu_to_le16 (CS_TIMEOUT ); + sp->done (sp,QLA_OS_TIMER_EXPIRED ); + } }static void qla24xx_abort_sp_done (srb_t *sp,int res)
Greg Kroah-Hartman
maintainerPATCH 728/731 net: stmmac: fix errno when create_singlethread_workqueue() fails
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
commit 2cb815cfc78b137ee38bcd65e7c955d6cc2cc250 upstream.
We should set the return value to -ENOMEM explicitly when create_singlethread_workqueue() fails in stmmac_dvr_probe(), otherwise we'll lose the error value.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -0
@@ -7046,6 +7046,7 @@ int stmmac_dvr_probe(struct device *devi priv->wq =create_singlethread_workqueue ("stmmac_wq" );if (!priv->wq) {dev_err (priv->device,"failed to create workqueue\n" ); + ret = -ENOMEM ; goto error_wq_init; }
Greg Kroah-Hartman
maintainerPATCH 729/731 media: dvbdev: fix build warning due to comments
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
commit 3edfd14bb50fa6f94ed1a37bbb17d9f1c2793b57 upstream.
Previous commit that introduces reference counter does not add proper comments, which will lead to warning when building htmldocs. Fix them.
--- include/media/dvbdev.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/media/dvbdev.h +2 -1
@@ -126,6 +126,7 @@ struct dvb_adapter {* struct dvb_device - represents a DVB device node * * @list_head: List head with all DVB devices +* @ref: reference counter * @fops: pointer to struct file_operations * @adapter: pointer to the adapter that holds this device node * @type: type of the device, as defined by &enum dvb_device_type.
@@ -196,7 +197,7 @@ struct dvb_device {struct dvb_device *dvb_device_get (struct dvb_device *dvbdev);/** -* dvb_device_get - Decrease dvb_device reference +* dvb_device_put - Decrease dvb_device reference * * @dvbdev: pointer to struct dvb_device */
Greg Kroah-Hartman
maintainerPATCH 730/731 media: dvbdev: fix refcnt bug
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
commit 3a664569b71b0a52be5ffb9fb87cc4f83d29bd71 upstream.
Previous commit initialize the dvbdev->ref before the template copy, which will overwrite the reference and cause refcnt bug.
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 0 PID: 1 at lib/refcount.c:25 refcount_warn_saturate+0x17c/0x1f0 lib/refcount.c:25 Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.0-rc6-next-20221128-syzkaller #0 ... RIP: 0010:refcount_warn_saturate+0x17c/0x1f0 lib/refcount.c:25 RSP: 0000:ffffc900000678d0 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff88813ff58000 RSI: ffffffff81660e7c RDI: fffff5200000cf0c RBP: ffff888022a45010 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000080000000 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001 FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff88823ffff000 CR3: 000000000c48e000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __refcount_add include/linux/refcount.h:199 [inline] __refcount_inc include/linux/refcount.h:250 [inline] refcount_inc include/linux/refcount.h:267 [inline] kref_get include/linux/kref.h:45 [inline] dvb_device_get drivers/media/dvb-core/dvbdev.c:585 [inline] dvb_register_device+0xe83/0x16e0 drivers/media/dvb-core/dvbdev.c:517
...
Just place the kref_init at correct position.
--- drivers/media/dvb-core/dvbdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-core/dvbdev.c +1 -1
@@ -490,8 +490,8 @@ int dvb_register_device(struct dvb_adaptreturn -ENOMEM ; } -kref_init (&dvbdev->ref);memcpy (dvbdev, template,sizeof (struct dvb_device )); +kref_init (&dvbdev->ref); dvbdev->type = type; dvbdev->id = id; dvbdev->adapter = adap;
Greg Kroah-Hartman
maintainerPATCH 731/731 extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered
In reply to Greg Kroah-HartmanFrom: Yassine Oudjana <[email protected]>
commit 341fd15e2e18c24d5c738496cfc3d7a272241201 upstream.
Commit bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support") added an optional Type-C interface to the driver but missed to check if it is in use when calling the IRQ handler. This causes an oops on devices currently using the old extcon interface. Check if a Type-C port is registered before calling the Type-C IRQ handler.
--- drivers/extcon/extcon-usbc-tusb320.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/extcon/extcon-usbc-tusb320.c +7 -1
@@ -327,7 +327,13 @@ static irqreturn_t tusb320_state_update_return IRQ_NONE ;tusb320_extcon_irq_handler (priv, reg); -tusb320_typec_irq_handler (priv, reg); + +/* +* Type-C support is optional. Only call the Type-C handler if a +* port had been registered previously. +*/ +if (priv->port) +tusb320_typec_irq_handler (priv, reg);regmap_write (priv->regmap,TUSB320_REG9 , reg);
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.86-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
Compiled and tested on my x86_64 test systems, no errors or regressions to report.
-- Slade
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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.
Successfully cross-compiled for arm64 (bcm2711_defconfig, GCC 10.2.0) and powerpc (ps3_defconfig, GCC 12.2.0).
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.86-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.86-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.15:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
114 tests: 114 pass, 0 failLinux version: 5.15.86-rc1-g9c8c39127c59
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.86-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.15:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
114 tests: 114 pass, 0 failLinux version: 5.15.86-rc1-g87d5d5cae7d9
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.86-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.15:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
114 tests: 114 pass, 0 failLinux version: 5.15.86-rc1-g87d5d5cae7d9
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
Build results:
total: 160 pass: 158 fail: 2
Failed builds:
arm:allmodconfig
arm64:allmodconfig
Qemu test results:
total: 489 pass: 489 fail: 0
Build errors as reported.
Guenter
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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.
These are just kCFI annotations. I don't believe we need them in 5.10 (and 5.15).
Quoted 6 lines
Nathan Chancellor <[email protected]>
net: ethernet: ti: Fix return type ofnetcp_ndo_start_xmit()
Nathan Chancellor <[email protected]>
drm/fsl-dcu: Fix return type offsl_dcu_drm_connector_mode_valid()
Nathan Chancellor <[email protected]>
drm/sti: Fix return type of sti_{dvo,hda,hdmi}_connector_mode_valid()
These are just preparation for "bpf: allow precision tracking for programs with subprogs", but that is not queued here. We should not need them.
Quoted 4 lines
Andrii Nakryiko <[email protected]>
bpf: propagate precision in ALU/ALU64 operations
Andrii Nakryiko <[email protected]>
bpf: propagate precision across all frames, not just the last one
AFAICT, DRM_FORMAT_P030 is not used anywhere in 5.15, so we should not need this one.
Quoted 2 lines
Dave Stevenson <[email protected]>
drm/fourcc: Add packed 10bit YUV 4:2:0 format
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines · Pavel Machek
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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.
These are just kCFI annotations. I don't believe we need them in 5.10 (and 5.15).
The original CFI implementation exists in 5.15 and the problem described in those patches should still trigger with that implementation just like kCFI, so they should likely still go to 5.15. However, they were AUTOSEL'd and we have not had any reports of problems that are solved with these patches (although that is likely because nobody who is using this hardware has tried running a CONFIG_CFI_CLANG kernel), so I do not really care if they are applied or not.
Quoted 6 lines
Quoted 6 lines
Nathan Chancellor <[email protected]>
net: ethernet: ti: Fix return type ofnetcp_ndo_start_xmit()
Nathan Chancellor <[email protected]>
drm/fsl-dcu: Fix return type offsl_dcu_drm_connector_mode_valid()
Nathan Chancellor <[email protected]>
drm/sti: Fix return type of sti_{dvo,hda,hdmi}_connector_mode_valid()
Cheers,
Nathan
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.86-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.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 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.86 release. There are 731 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 Fri, 30 Dec 2022 14:41:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.86-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
NOTE:
Daniel Díaz reported allmodconfig failures [1]
[1] https://lore.kernel.org/stable/[email protected]/
## Build
* kernel: 5.15.86-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.15.y
* git commit: 87d5d5cae7d93d584c504a91241ccf7a09217bab
* git describe: v5.15.85-732-g87d5d5cae7d9
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15.85-732-g87d5d5cae7d9
## Test Regressions (compared to v5.15.84-18-gbef75c6188c7)
## Metric Regressions (compared to v5.15.84-18-gbef75c6188c7)
## Test Fixes (compared to v5.15.84-18-gbef75c6188c7)
## Metric Fixes (compared to v5.15.84-18-gbef75c6188c7)
## Test result summary
total: 148474, pass: 130464, fail: 2813, skip: 14903, xfail: 294
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 151 total, 146 passed, 5 failed
* arm64: 49 total, 43 passed, 6 failed
* i386: 39 total, 35 passed, 4 failed
* mips: 31 total, 29 passed, 2 failed
* parisc: 8 total, 8 passed, 0 failed
* powerpc: 34 total, 32 passed, 2 failed
* riscv: 14 total, 14 passed, 0 failed
* s390: 16 total, 14 passed, 2 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 8 passed, 0 failed
* x86_64: 42 total, 40 passed, 2 failed
## Test suites summary
* boot
* fwts
* igt-gpu-tools
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-open-posix-tests
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* packetdrill
* perf
* rcutorture
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org