scsi: scsi_dh_alua: Properly handle the ALUA transitioning state
Subsystems (10)
Sasha Levin
maintainerPATCH 1/17 scsi: scsi_dh_alua: Properly handle the ALUA transitioning state
From: Brian Bunker <[email protected]>
[ Upstream commit 6056a92ceb2a7705d61df7ec5370548e96aee258 ]
The handling of the ALUA transitioning state is currently broken. When a target goes into this state, it is expected that the target is allowed to stay in this state for the implicit transition timeout without a path failure. The handler has this logic, but it gets skipped currently.
When the target transitions, there is in-flight I/O from the initiator. The first of these responses from the target will be a unit attention letting the initiator know that the ALUA state has changed. The remaining in-flight I/Os, before the initiator finds out that the portal state has changed, will return not ready, ALUA state is transitioning. The portal state will change to SCSI_ACCESS_STATE_TRANSITIONING. This will lead to all new I/O immediately failing the path unexpectedly. The path failure happens in less than a second instead of the expected successes until the transition timer is exceeded.
Allow I/Os to continue while the path is in the ALUA transitioning state. The handler already takes care of a target that stays in the transitioning state for too long by changing the state to ALUA state standby once the transition timeout is exceeded at which point the path will fail.
--- drivers/scsi/device_handler/scsi_dh_alua.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +1 -2
@@ -1172,9 +1172,8 @@ static blk_status_t alua_prep_fn(struct scsi_device *sdev, struct request *req)case SCSI_ACCESS_STATE_OPTIMAL :case SCSI_ACCESS_STATE_ACTIVE :case SCSI_ACCESS_STATE_LBA : -return BLK_STS_OK ;case SCSI_ACCESS_STATE_TRANSITIONING : -return BLK_STS_AGAIN ; +return BLK_STS_OK ;default : req->rq_flags |=RQF_QUIET ;return BLK_STS_IOERR ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/17 scsi: qla2xxx: Fix missed DMA unmap for aborted commands
From: Gleb Chesnokov <[email protected]>
[ Upstream commit 26f9ce53817a8fd84b69a73473a7de852a24c897 ]
Aborting commands that have already been sent to the firmware can cause BUG in qlt_free_cmd(): BUG_ON(cmd->sg_mapped)
For instance:
- Command passes rdx_to_xfer state, maps sgl, sends to the firmware
- Reset occurs, qla2xxx performs ISP error recovery, aborts the command
- Target stack calls qlt_abort_cmd() and then qlt_free_cmd()
- BUG_ON(cmd->sg_mapped) in qlt_free_cmd() occurs because sgl was not unmapped
Thus, unmap sgl in qlt_abort_cmd() for commands with the aborted flag set.
--- drivers/scsi/qla2xxx/qla_target.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/qla2xxx/qla_target.c +3 -0
@@ -3837,6 +3837,9 @@ int qlt_abort_cmd(struct qla_tgt_cmd *cmd)spin_lock_irqsave (&cmd->cmd_lock, flags);if (cmd->aborted) { +if (cmd->sg_mapped) +qlt_unmap_sg (vha, cmd); +spin_unlock_irqrestore (&cmd->cmd_lock, flags);/* * It's normal to see 2 calls in this path:
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/17 mac80211: fix rx reordering with non explicit / psmp ack policy
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit 5e469ed9764d4722c59562da13120bd2dc6834c5 ]
When the QoS ack policy was set to non explicit / psmp ack, frames are treated as not being part of a BA session, which causes extra latency on reordering. Fix this by only bypassing reordering for packets with no-ack policy
--- net/mac80211/rx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/mac80211/rx.c +1 -2
@@ -1400,8 +1400,7 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx, goto dont_reorder;/* not part of a BA session */ -if (ack_policy !=IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK && - ack_policy !=IEEE80211_QOS_CTL_ACK_POLICY_NORMAL ) +if (ack_policy ==IEEE80211_QOS_CTL_ACK_POLICY_NOACK ) goto dont_reorder;/* new, potentially un-ordered, ampdu frame - process it */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/17 nl80211: validate S1G channel width
In reply to Sasha LevinFrom: Kieran Frewen <[email protected]>
[ Upstream commit 5d087aa759eb82b8208411913f6c2158bd85abc0 ]
Validate the S1G channel width input by user to ensure it matches that of the requested channel
--- net/wireless/nl80211.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/wireless/nl80211.c +9 -0
@@ -3080,6 +3080,15 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, }else if (attrs[NL80211_ATTR_CHANNEL_WIDTH ]) { chandef->width =nla_get_u32 (attrs[NL80211_ATTR_CHANNEL_WIDTH ]); +if (chandef->chan->band ==NL80211_BAND_S1GHZ ) { +/* User input error for channel width doesn't match channel */ +if (chandef->width !=ieee80211_s1g_channel_width (chandef->chan)) { +NL_SET_ERR_MSG_ATTR (extack, + attrs[NL80211_ATTR_CHANNEL_WIDTH ], +"bad channel width" ); +return -EINVAL ; + } + }if (attrs[NL80211_ATTR_CENTER_FREQ1 ]) { chandef->center_freq1 =nla_get_u32 (attrs[NL80211_ATTR_CENTER_FREQ1 ]);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/17 selftests: add ping test with ping_group_range tuned
In reply to Sasha LevinFrom: Nicolas Dichtel <[email protected]>
[ Upstream commit e71b7f1f44d3d88c677769c85ef0171caf9fc89f ]
The 'ping' utility is able to manage two kind of sockets (raw or icmp), depending on the sysctl ping_group_range. By default, ping_group_range is set to '1 0', which forces ping to use an ip raw socket.
Let's replay the ping tests by allowing 'ping' to use the ip icmp socket. After the previous patch, ipv4 tests results are the same with both kinds of socket. For ipv6, there are a lot a new failures (the previous patch fixes only two cases).
--- tools/testing/selftests/net/fcnal-test.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tools/testing/selftests/net/fcnal-test.sh +12 -0
@@ -803,10 +803,16 @@ ipv4_ping() setup set_sysctl net.ipv4.raw_l3mdev_accept=1 2>/dev/null ipv4_ping_novrf + setup + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null + ipv4_ping_novrf log_subsection "With VRF" setup "yes" ipv4_ping_vrf + setup "yes" + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null + ipv4_ping_vrf } ################################################################################
@@ -2324,10 +2330,16 @@ ipv6_ping() log_subsection "No VRF" setup ipv6_ping_novrf + setup + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null + ipv6_ping_novrf log_subsection "With VRF" setup "yes" ipv6_ping_vrf + setup "yes" + set_sysctl net.ipv4.ping_group_range='0 2147483647' 2>/dev/null + ipv6_ping_vrf } ################################################################################
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/17 Revert "fbdev: Make fb_release() return -ENODEV if fbdev was unregistered"
In reply to Sasha LevinFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit 135332f34ba2662bc1e32b5c612e06a8cc41a053 ]
This reverts commit aafa025c76dcc7d1a8c8f0bdefcbe4eb480b2f6a. That commit attempted to fix a NULL pointer dereference, caused by the struct fb_info associated with a framebuffer device to not longer be valid when the file descriptor was closed.
The issue was exposed by commit 27599aacbaef ("fbdev: Hot-unplug firmware fb devices on forced removal"), which added a new path that goes through the struct device removal instead of directly unregistering the fb.
Most fbdev drivers have issues with the fb_info lifetime, because call to framebuffer_release() from their driver's .remove callback, rather than doing from fbops.fb_destroy callback. This meant that due to this switch, the fb_info was now destroyed too early, while references still existed, while before it was simply leaked.
The patch we're reverting here reinstated that leak, hence "fixed" the regression. But the proper solution is to fix the drivers to not release the fb_info too soon.
--- drivers/video/fbdev/core/fbmem.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/video/fbdev/core/fbmem.c +1 -4
@@ -1436,10 +1436,7 @@ fb_release(struct inode *inode, struct file *file) __acquires(&info->lock) __releases(&info->lock) { -struct fb_info *const info =file_fb_info (file); - -if (!info) -return -ENODEV ; +struct fb_info *const info = file->private_data;lock_fb_info (info);if (info->fbops->fb_release)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/17 fbdev: Prevent possible use-after-free in fb_release()
In reply to Sasha LevinFrom: Daniel Vetter <[email protected]>
[ Upstream commit 89bfd4017e58faaf70411555e7f508495114e90b ]
Most fbdev drivers have issues with the fb_info lifetime, because call to framebuffer_release() from their driver's .remove callback, rather than doing from fbops.fb_destroy callback.
Doing that will destroy the fb_info too early, while references to it may still exist, leading to a use-after-free error.
To prevent this, check the fb_info reference counter when attempting to kfree the data structure in framebuffer_release(). That will leak it but at least will prevent the mentioned error.
--- drivers/video/fbdev/core/fbsysfs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/video/fbdev/core/fbsysfs.c +4 -0
@@ -80,6 +80,10 @@ void framebuffer_release(struct fb_info *info) {if (!info)return ; + +if (WARN_ON (refcount_read (&info->count))) +return ; +kfree (info->apertures);kfree (info); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/17 net: fix wrong network header length
In reply to Sasha LevinFrom: Lina Wang <[email protected]>
[ Upstream commit cf3ab8d4a797960b4be20565abb3bcd227b18a68 ]
When clatd starts with ebpf offloaing, and NETIF_F_GRO_FRAGLIST is enable, several skbs are gathered in skb_shinfo(skb)->frag_list. The first skb's ipv6 header will be changed to ipv4 after bpf_skb_proto_6_to_4, network_header\transport_header\mac_header have been updated as ipv4 acts, but other skbs in frag_list didnot update anything, just ipv6 packets.
udp_queue_rcv_skb will call skb_segment_list to traverse other skbs in frag_list and make sure right udp payload is delivered to user space. Unfortunately, other skbs in frag_list who are still ipv6 packets are updated like the first skb and will have wrong transport header length.
e.g.before bpf_skb_proto_6_to_4,the first skb and other skbs in frag_list has the same network_header(24)& transport_header(64), after bpf_skb_proto_6_to_4, ipv6 protocol has been changed to ipv4, the first skb's network_header is 44,transport_header is 64, other skbs in frag_list didnot change.After skb_segment_list, the other skbs in frag_list has different network_header(24) and transport_header(44), so there will be 20 bytes different from original,that is difference between ipv6 header and ipv4 header. Just change transport_header to be the same with original.
Actually, there are two solutions to fix it, one is traversing all skbs and changing every skb header in bpf_skb_proto_6_to_4, the other is modifying frag_list skb's header in skb_segment_list. Considering efficiency, adopt the second one--- when the first skb and other skbs in frag_list has different network_header length, restore them to make sure right udp payload is delivered to user space.
--- net/core/skbuff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/skbuff.c +3 -1
@@ -3873,7 +3873,7 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,unsigned int delta_len =0 ;struct sk_buff *tail =NULL ;struct sk_buff *nskb, *tmp; -int err; +int len_diff, err;skb_push (skb, -skb_network_offset (skb) + offset);
@@ -3913,9 +3913,11 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,skb_push (nskb, -skb_network_offset (nskb) + offset);skb_release_head_state (nskb); + len_diff =skb_network_header_len (nskb) -skb_network_header_len (skb);__copy_skb_header (nskb, skb);skb_headers_offset_update (nskb,skb_headroom (nskb) -skb_headroom (skb)); + nskb->transport_header += len_diff;skb_copy_from_linear_data_offset (skb, -tnl_hlen, nskb->data - tnl_hlen, offset + tnl_hlen);
Signature · 7 lines
2.35.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Sasha Levin
maintainerPATCH 9/17 nl80211: fix locking in nl80211_set_tx_bitrate_mask()
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit f971e1887fdb3ab500c9bebf4b98f62d49a20655 ]
This accesses the wdev's chandef etc., so cannot safely be used without holding the lock.
--- net/wireless/nl80211.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/wireless/nl80211.c +7 -2
@@ -11341,18 +11341,23 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,struct cfg80211_bitrate_mask mask;struct cfg80211_registered_device *rdev = info->user_ptr[0 ];struct net_device *dev = info->user_ptr[1 ]; +struct wireless_dev *wdev = dev->ieee80211_ptr;int err;if (!rdev->ops->set_bitrate_mask)return -EOPNOTSUPP ; +wdev_lock (wdev); err =nl80211_parse_tx_bitrate_mask (info, info->attrs,NL80211_ATTR_TX_RATES , &mask, dev, true);if (err) -return err; + goto out; -return rdev_set_bitrate_mask (rdev, dev,NULL , &mask); + err =rdev_set_bitrate_mask (rdev, dev,NULL , &mask); +out: +wdev_unlock (wdev); +return err; }static int nl80211_register_mgmt (struct sk_buff *skb,struct genl_info *info)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/17 ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 51ca86b4c9c7c75f5630fa0dbe5f8f0bd98e3c3e ]
Fix the missing pci_disable_device() before return from tulip_init_one() in the error handling case.
--- drivers/net/ethernet/dec/tulip/tulip_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/tulip_core.c +4 -1
@@ -1398,8 +1398,10 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)/* alloc_etherdev ensures aligned and zeroed private structures */ dev =alloc_etherdev (sizeof (*tp)); -if (!dev) +if (!dev) { +pci_disable_device (pdev);return -ENOMEM ; + }SET_NETDEV_DEV (dev, &pdev->dev);if (pci_resource_len (pdev,0 ) < tulip_tbl[chip_idx].io_size) {
@@ -1778,6 +1780,7 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) err_out_free_netdev:free_netdev (dev); +pci_disable_device (pdev);return -ENODEV ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/17 net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 0807ce0b010418a191e0e4009803b2d74c3245d5 ]
Switch to using pcim_enable_device() to avoid missing pci_disable_device().
--- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +1 -3
@@ -181,7 +181,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,return -ENOMEM ;/* Enable pci device */ - ret =pci_enable_device (pdev); + ret =pcim_enable_device (pdev);if (ret) {dev_err (&pdev->dev,"%s: ERROR: failed to enable device\n" , __func__);
@@ -241,8 +241,6 @@ static void stmmac_pci_remove(struct pci_dev *pdev)pcim_iounmap_regions (pdev,BIT (i));break ; } - -pci_disable_device (pdev); }static int __maybe_unused stmmac_pci_suspend (struct device *dev)
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 12/17 net: atlantic: fix "frag[0] not initialized"
In reply to Sasha LevinFrom: Grant Grundler <[email protected]>
[ Upstream commit 62e0ae0f4020250f961cf8d0103a4621be74e077 ]
In aq_ring_rx_clean(), if buff->is_eop is not set AND buff->len < AQ_CFG_RX_HDR_SIZE, then hdr_len remains equal to buff->len and skb_add_rx_frag(xxx, *0*, ...) is not called.
The loop following this code starts calling skb_add_rx_frag() starting with i=1 and thus frag[0] is never initialized. Since i is initialized to zero at the top of the primary loop, we can just reference and post-increment i instead of hardcoding the 0 when calling skb_add_rx_frag() the first time.
--- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ring.c +1 -2
@@ -445,7 +445,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self, ALIGN(hdr_len, sizeof(long)));if (buff->len - hdr_len >0 ) { -skb_add_rx_frag (skb,0 , buff->rxdata.page, +skb_add_rx_frag (skb, i++, buff->rxdata.page, buff->rxdata.pg_off + hdr_len, buff->len - hdr_len,AQ_CFG_RX_FRAME_MAX );
@@ -454,7 +454,6 @@ int aq_ring_rx_clean(struct aq_ring_s *self,if (!buff->is_eop) { buff_ = buff; - i =1U ; do { next_ = buff_->next; buff_ = &self->buff_ring[next_];
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/17 net: atlantic: reduce scope of is_rsc_complete
In reply to Sasha LevinFrom: Grant Grundler <[email protected]>
[ Upstream commit 79784d77ebbd3ec516b7a5ce555d979fb7946202 ]
Don't defer handling the err case outside the loop. That's pointless.
And since is_rsc_complete is only used inside this loop, declare it inside the loop to reduce it's scope.
--- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ring.c +6 -7
@@ -345,7 +345,6 @@ int aq_ring_rx_clean(struct aq_ring_s *self, int budget) {struct net_device *ndev =aq_nic_get_ndev (self->aq_nic); -bool is_rsc_completed = true;int err =0 ; for (; (self->sw_head != self->hw_head) && budget;
@@ -365,6 +364,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self,if (!buff->is_eop) { buff_ = buff; do { + bool is_rsc_completed = true; + if (buff_->next >= self->size) { err = -EIO; goto err_exit;
@@ -376,18 +377,16 @@ int aq_ring_rx_clean(struct aq_ring_s *self, next_, self->hw_head); -if (unlikely (!is_rsc_completed)) -break ; +if (unlikely (!is_rsc_completed)) { + err =0 ; + goto err_exit; + } buff->is_error |= buff_->is_error; buff->is_cso_err |= buff_->is_cso_err; }while (!buff_->is_eop); -if (!is_rsc_completed) { - err =0 ; - goto err_exit; - }if (buff->is_error || (buff->is_lro && buff->is_cso_err)) { buff_ = buff;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/17 net: atlantic: add check for MAX_SKB_FRAGS
In reply to Sasha LevinFrom: Grant Grundler <[email protected]>
[ Upstream commit 6aecbba12b5c90b26dc062af3b9de8c4b3a2f19f ]
Enforce that the CPU can not get stuck in an infinite loop.
--- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_ring.c +5 -1
@@ -362,6 +362,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self,continue ;if (!buff->is_eop) { +unsigned int frag_cnt =0U ; buff_ = buff; do { bool is_rsc_completed = true;
@@ -370,6 +371,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self, err = -EIO ; goto err_exit; } + + frag_cnt++; next_ = buff_->next, buff_ = &self->buff_ring[next_]; is_rsc_completed =
@@ -377,7 +380,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self, next_, self->hw_head); -if (unlikely (!is_rsc_completed)) { +if (unlikely (!is_rsc_completed) || + frag_cnt >MAX_SKB_FRAGS ) { err =0 ; goto err_exit; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/17 net: atlantic: verify hw_head_ lies within TX buffer ring
In reply to Sasha LevinFrom: Grant Grundler <[email protected]>
[ Upstream commit 2120b7f4d128433ad8c5f503a9584deba0684901 ]
Bounds check hw_head index provided by NIC to verify it lies within the TX buffer ring.
--- drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +7 -0
@@ -889,6 +889,13 @@ int hw_atl_b0_hw_ring_tx_head_update(struct aq_hw_s *self, err = -ENXIO ; goto err_exit; } + +/* Validate that the new hw_head_ is reasonable. */ +if (hw_head_ >= ring->size) { + err = -ENXIO ; + goto err_exit; + } + ring->hw_head = hw_head_; err =aq_hw_err_from_flags (self);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/17 arm64: Enable repeat tlbi workaround on KRYO4XX gold CPUs
In reply to Sasha LevinFrom: Shreyas K K <[email protected]>
[ Upstream commit 51f559d66527e238f9a5f82027bff499784d4eac ]
Add KRYO4XX gold/big cores to the list of CPUs that need the repeat TLBI workaround. Apply this to the affected KRYO4XX cores (rcpe to rfpe).
The variant and revision bits are implementation defined and are different from the their Cortex CPU counterparts on which they are based on, i.e., (r0p0 to r3p0) is equivalent to (rcpe to rfpe).
--- Documentation/arm64/silicon-errata.rst | 3 +++ arch/arm64/kernel/cpu_errata.c | 2 ++ 2 files changed, 5 insertions(+)
Documentation/arm64/silicon-errata.rst +3 -0
@@ -163,6 +163,9 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | Qualcomm Tech. | Kryo4xx Silver | N/A | ARM64_ERRATUM_1024718 | +----------------+-----------------+-----------------+-----------------------------+ +| Qualcomm Tech. | Kryo4xx Gold | N/A | ARM64_ERRATUM_1286807 | ++----------------+-----------------+-----------------+-----------------------------+ + +----------------+-----------------+-----------------+-----------------------------+ | Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 | +----------------+-----------------+-----------------+-----------------------------+
arch/arm64/kernel/cpu_errata.c +2 -0
@@ -208,6 +208,8 @@ static const struct arm64_cpu_capabilities arm64_repeat_tlbi_list[] = { #ifdef CONFIG_ARM64_ERRATUM_1286807 { ERRATA_MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 0), + /* Kryo4xx Gold (rcpe to rfpe) => (r0p0 to r3p0) */ + ERRATA_MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xe), }, #endif {},
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 17/17 usb: gadget: fix race when gadget driver register via ioctl
In reply to Sasha LevinFrom: Schspa Shi <[email protected]>
[ Upstream commit 5f0b5f4d50fa0faa8c76ef9d42a42e8d43f98b44 ]
The usb_gadget_register_driver can be called multi time by to threads via USB_RAW_IOCTL_RUN ioctl syscall, which will lead to multiple registrations.
Call trace:
driver_register+0x220/0x3a0 drivers/base/driver.c:171
usb_gadget_register_driver_owner+0xfb/0x1e0
drivers/usb/gadget/udc/core.c:1546
raw_ioctl_run drivers/usb/gadget/legacy/raw_gadget.c:513 [inline]
raw_ioctl+0x1883/0x2730 drivers/usb/gadget/legacy/raw_gadget.c:1220
ioctl USB_RAW_IOCTL_RUNThis routine allows two processes to register the same driver instance via ioctl syscall. which lead to a race condition.
Please refer to the following scenarios.
T1 T2
------------------------------------------------------------------usb_gadget_register_driver_owner
driver_register driver_register
driver_find driver_find
bus_add_driver bus_add_driver
priv alloced <context switch>
drv->p = priv;
<schedule out>
kobject_init_and_add // refcount = 1;
//couldn't find an available UDC or it's busy
<context switch>
priv alloced
drv->priv = priv;
kobject_init_and_add
---> refcount = 1 <------
// register success
<context switch>
===================== another ioctl/process ======================
driver_register
driver_find
k = kset_find_obj()
---> refcount = 2 <------
<context out>
driver_unregister
// drv->p become T2's priv
---> refcount = 1 <------
<context switch>
kobject_put(k)
---> refcount = 0 <------
return priv->driver;
--------UAF here----------There will be UAF in this scenario.
We can fix it by adding a new STATE_DEV_REGISTERING device state to avoid double register.
--- drivers/usb/gadget/legacy/raw_gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/legacy/raw_gadget.c +2 -0
@@ -145,6 +145,7 @@ enum dev_state {STATE_DEV_INVALID =0 ,STATE_DEV_OPENED ,STATE_DEV_INITIALIZED , +STATE_DEV_REGISTERING ,STATE_DEV_RUNNING ,STATE_DEV_CLOSED ,STATE_DEV_FAILED
@@ -508,6 +509,7 @@ static int raw_ioctl_run(struct raw_dev *dev, unsigned long value) ret = -EINVAL ; goto out_unlock; } + dev->state =STATE_DEV_REGISTERING ;spin_unlock_irqrestore (&dev->lock, flags); ret =usb_gadget_probe_driver (&dev->driver);
Signature · 1 line
2.35.1