4.19.270-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 441/521 ext4: fix deadlock due to mbcache entry corruption
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit a44e84a9b7764c72896f7241a0ec9ac7e7ef38dd ]
When manipulating xattr blocks, we can deadlock infinitely looping inside ext4_xattr_block_set() where we constantly keep finding xattr block for reuse in mbcache but we are unable to reuse it because its reference count is too big. This happens because cache entry for the xattr block is marked as reusable (e_reusable set) although its reference count is too big. When this inconsistency happens, this inconsistent state is kept indefinitely and so ext4_xattr_block_set() keeps retrying indefinitely.
The inconsistent state is caused by non-atomic update of e_reusable bit. e_reusable is part of a bitfield and e_reusable update can race with update of e_referenced bit in the same bitfield resulting in loss of one of the updates. Fix the problem by using atomic bitops instead.
This bug has been around for many years, but it became *much* easier to hit after commit 65f8b80053a1 ("ext4: fix race when reusing xattr blocks").
--- fs/ext4/xattr.c | 4 ++-- fs/mbcache.c | 14 ++++++++------ include/linux/mbcache.h | 9 +++++++-- 3 files changed, 17 insertions(+), 10 deletions(-)
fs/ext4/xattr.c +2 -2
@@ -1297,7 +1297,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, ce =mb_cache_entry_get (ea_block_cache, hash, bh->b_blocknr);if (ce) { - ce->e_reusable =1 ; +set_bit (MBE_REUSABLE_B , &ce->e_flags);mb_cache_entry_put (ea_block_cache, ce); } }
@@ -2058,7 +2058,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, }BHDR (new_bh)->h_refcount =cpu_to_le32 (ref);if (ref ==EXT4_XATTR_REFCOUNT_MAX ) - ce->e_reusable =0 ; +clear_bit (MBE_REUSABLE_B , &ce->e_flags);ea_bdebug (new_bh,"reusing; refcount now=%d" , ref);ext4_xattr_block_csum_set (inode, new_bh);
fs/mbcache.c +8 -6
@@ -93,8 +93,9 @@ int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key,atomic_set (&entry->e_refcnt,1 ); entry->e_key = key; entry->e_value = value; - entry->e_reusable = reusable; - entry->e_referenced =0 ; + entry->e_flags =0 ; +if (reusable) +set_bit (MBE_REUSABLE_B , &entry->e_flags); head =mb_cache_entry_head (cache, key);hlist_bl_lock (head);hlist_bl_for_each_entry (dup, dup_node, head, e_hash_list) {
@@ -161,7 +162,8 @@ static struct mb_cache_entry *__entry_find(struct mb_cache *cache,while (node) { entry = hlist_bl_entry(node, struct mb_cache_entry, e_hash_list); -if (entry->e_key == key && entry->e_reusable && +if (entry->e_key == key && +test_bit (MBE_REUSABLE_B , &entry->e_flags) &&atomic_inc_not_zero (&entry->e_refcnt)) goto out; node = node->next;
@@ -317,7 +319,7 @@ EXPORT_SYMBOL(mb_cache_entry_delete_or_get);void mb_cache_entry_touch (struct mb_cache *cache,struct mb_cache_entry *entry) { - entry->e_referenced =1 ; +set_bit (MBE_REFERENCED_B , &entry->e_flags); }EXPORT_SYMBOL (mb_cache_entry_touch);
@@ -342,9 +344,9 @@ static unsigned long mb_cache_shrink(struct mb_cache *cache, entry =list_first_entry (&cache->c_list, struct mb_cache_entry, e_list);/* Drop initial hash reference if there is no user */ -if (entry->e_referenced || +if (test_bit (MBE_REFERENCED_B , &entry->e_flags) ||atomic_cmpxchg (&entry->e_refcnt,1 ,0 ) !=1 ) { - entry->e_referenced =0 ; +clear_bit (MBE_REFERENCED_B , &entry->e_flags);list_move_tail (&entry->e_list, &cache->c_list);continue ; }
include/linux/mbcache.h +7 -2
@@ -10,6 +10,12 @@struct mb_cache ; +/* Cache entry flags */ +enum { +MBE_REFERENCED_B =0 , +MBE_REUSABLE_B +}; +struct mb_cache_entry {/* List of entries in cache - protected by cache->c_list_lock */ struct list_head e_list;
@@ -26,8 +32,7 @@ struct mb_cache_entry {atomic_t e_refcnt;/* Key in hash - stable during lifetime of the entry */ u32 e_key; - u32 e_referenced:1; - u32 e_reusable:1; +unsigned long e_flags;/* User provided value - stable during lifetime of the entry */ u64 e_value; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 442/521 SUNRPC: ensure the matching upcall is in-flight upon downcall
In reply to Greg Kroah-HartmanFrom: minoura makoto <[email protected]>
[ Upstream commit b18cba09e374637a0a3759d856a6bca94c133952 ]
Commit 9130b8dbc6ac ("SUNRPC: allow for upcalls for the same uid but different gss service") introduced auth argument to __gss_find_upcall(), but in gss_pipe_downcall() it was left as NULL since it (and auth->service) was not (yet) determined.
When multiple upcalls with the same uid and different service are ongoing, it could happen that __gss_find_upcall(), which returns the first match found in the pipe->in_downcall list, could not find the correct gss_msg corresponding to the downcall we are looking for. Moreover, it might return a msg which is not sent to rpc.gssd yet.
We could see mount.nfs process hung in D state with multiple mount.nfs are executed in parallel. The call trace below is of CentOS 7.9 kernel-3.10.0-1160.24.1.el7.x86_64 but we observed the same hang w/ elrepo kernel-ml-6.0.7-1.el7.
PID: 71258 TASK: ffff91ebd4be0000 CPU: 36 COMMAND: "mount.nfs"
#0 [ffff9203ca3234f8] __schedule at ffffffffa3b8899f
#1 [ffff9203ca323580] schedule at ffffffffa3b88eb9
#2 [ffff9203ca323590] gss_cred_init at ffffffffc0355818 [auth_rpcgss] #3 [ffff9203ca323658] rpcauth_lookup_credcache at ffffffffc0421ebc
[sunrpc]
#4 [ffff9203ca3236d8] gss_lookup_cred at ffffffffc0353633 [auth_rpcgss] #5 [ffff9203ca3236e8] rpcauth_lookupcred at ffffffffc0421581 [sunrpc] #6 [ffff9203ca323740] rpcauth_refreshcred at ffffffffc04223d3 [sunrpc] #7 [ffff9203ca3237a0] call_refresh at ffffffffc04103dc [sunrpc] #8 [ffff9203ca3237b8] __rpc_execute at ffffffffc041e1c9 [sunrpc] #9 [ffff9203ca323820] rpc_execute at ffffffffc0420a48 [sunrpc]
The scenario is like this. Let's say there are two upcalls for services A and B, A -> B in pipe->in_downcall, B -> A in pipe->pipe.
When rpc.gssd reads pipe to get the upcall msg corresponding to service B from pipe->pipe and then writes the response, in gss_pipe_downcall the msg corresponding to service A will be picked because only uid is used to find the msg and it is before the one for B in pipe->in_downcall. And the process waiting for the msg corresponding to service A will be woken up.
Actual scheduing of that process might be after rpc.gssd processes the next msg. In rpc_pipe_generic_upcall it clears msg->errno (for A). The process is scheduled to see gss_msg->ctx == NULL and gss_msg->msg.errno == 0, therefore it cannot break the loop in gss_create_upcall and is never woken up after that.
This patch adds a simple check to ensure that a msg which is not sent to rpc.gssd yet is not chosen as the matching upcall upon receiving a downcall.
--- include/linux/sunrpc/rpc_pipe_fs.h | 5 +++++ net/sunrpc/auth_gss/auth_gss.c | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-)
include/linux/sunrpc/rpc_pipe_fs.h +5 -0
@@ -94,6 +94,11 @@ extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, char __user *, size_t);extern int rpc_queue_upcall (struct rpc_pipe *,struct rpc_pipe_msg *); +/* returns true if the msg is in-flight, i.e., already eaten by the peer */ +static inline bool rpc_msg_is_inflight (const struct rpc_pipe_msg *msg) { +return (msg->copied !=0 &&list_empty (&msg->list)); +} +struct rpc_clnt ;extern struct dentry *rpc_create_client_dir (struct dentry *,const char *,struct rpc_clnt *);extern int rpc_remove_client_dir (struct rpc_clnt *);
net/sunrpc/auth_gss/auth_gss.c +17 -2
@@ -323,7 +323,7 @@ __gss_find_upcall(struct rpc_pipe *pipe, kuid_t uid, const struct gss_auth *authlist_for_each_entry (pos, &pipe->in_downcall, list) {if (!uid_eq (pos->uid, uid))continue ; -if (auth && pos->auth->service != auth->service) +if (pos->auth->service != auth->service)continue ;refcount_inc (&pos->count);dprintk ("RPC: %s found msg %p\n" , __func__, pos);
@@ -677,6 +677,21 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)return err; } +static struct gss_upcall_msg * +gss_find_downcall (struct rpc_pipe *pipe,kuid_t uid) +{ +struct gss_upcall_msg *pos; +list_for_each_entry (pos, &pipe->in_downcall, list) { +if (!uid_eq (pos->uid, uid)) +continue ; +if (!rpc_msg_is_inflight (&pos->msg)) +continue ; +refcount_inc (&pos->count); +return pos; + } +return NULL ; +} +#define MSG_BUF_MAXSIZE 1024 static ssize_t
@@ -723,7 +738,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) err = -ENOENT ;/* Find a matching upcall */ spin_lock (&pipe->lock); - gss_msg =__gss_find_upcall (pipe, uid,NULL ); + gss_msg =gss_find_downcall (pipe, uid);if (gss_msg ==NULL ) {spin_unlock (&pipe->lock); goto err_put_ctx;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 443/521 bpf: pull before calling skb_postpull_rcsum()
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 54c3f1a81421f85e60ae2eaae7be3727a09916ee ]
Anand hit a BUG() when pulling off headers on egress to a SW tunnel. We get to skb_checksum_help() with an invalid checksum offset (commit d7ea0d9df2a6 ("net: remove two BUG() from skb_checksum_help()") converted those BUGs to WARN_ONs()).
He points out oddness in how skb_postpull_rcsum() gets used. Indeed looks like we should pull before "postpull", otherwise the CHECKSUM_PARTIAL fixup from skb_postpull_rcsum() will not be able to do its job:
if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_start_offset(skb) < 0) skb->ip_summed = CHECKSUM_NONE;
--- net/core/filter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/core/filter.c +5 -2
@@ -2565,15 +2565,18 @@ static int bpf_skb_generic_push(struct sk_buff *skb, u32 off, u32 len)static int bpf_skb_generic_pop (struct sk_buff *skb,u32 off,u32 len) { +void *old_data; +/* skb_ensure_writable() is not needed here, as we're * already working on an uncloned skb. */ if (unlikely (!pskb_may_pull (skb, off + len)))return -ENOMEM ; -skb_postpull_rcsum (skb, skb->data + off, len); -memmove (skb->data + len, skb->data, off); + old_data = skb->data;__skb_pull (skb, len); +skb_postpull_rcsum (skb, old_data + off, len); +memmove (skb->data, old_data, off);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 444/521 qlcnic: prevent ->dcb use-after-free on qlcnic_dcb_enable() failure
In reply to Greg Kroah-HartmanFrom: Daniil Tatianin <[email protected]>
[ Upstream commit 13a7c8964afcd8ca43c0b6001ebb0127baa95362 ]
adapter->dcb would get silently freed inside qlcnic_dcb_enable() in case qlcnic_dcb_attach() would return an error, which always happens under OOM conditions. This would lead to use-after-free because both of the existing callers invoke qlcnic_dcb_get_info() on the obtained pointer, which is potentially freed at that point.
Propagate errors from qlcnic_dcb_enable(), and instead free the dcb pointer at callsite using qlcnic_dcb_free(). This also removes the now unused qlcnic_clear_dcb_ops() helper, which was a simple wrapper around kfree() also causing memory leaks for partially initialized dcb.
Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 8 +++++++- drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h | 10 ++-------- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 8 +++++++- 3 files changed, 16 insertions(+), 10 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +7 -1
@@ -2525,7 +2525,13 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) goto disable_mbx_intr;qlcnic_83xx_clear_function_resources (adapter); -qlcnic_dcb_enable (adapter->dcb); + + err =qlcnic_dcb_enable (adapter->dcb); +if (err) { +qlcnic_dcb_free (adapter->dcb); + goto disable_mbx_intr; + } +qlcnic_83xx_initialize_nic (adapter,1 );qlcnic_dcb_get_info (adapter->dcb);
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h +2 -8
@@ -42,11 +42,6 @@ struct qlcnic_dcb {unsigned long state; }; -static inline void qlcnic_clear_dcb_ops (struct qlcnic_dcb *dcb) -{ -kfree (dcb); -} -static inline int qlcnic_dcb_get_hw_capability (struct qlcnic_dcb *dcb) {if (dcb && dcb->ops->get_hw_capability)
@@ -113,9 +108,8 @@ static inline void qlcnic_dcb_init_dcbnl_ops(struct qlcnic_dcb *dcb) dcb->ops->init_dcbnl_ops(dcb); } -static inline void qlcnic_dcb_enable (struct qlcnic_dcb *dcb) +static inline int qlcnic_dcb_enable (struct qlcnic_dcb *dcb) { -if (dcb &&qlcnic_dcb_attach (dcb)) -qlcnic_clear_dcb_ops (dcb); +return dcb ?qlcnic_dcb_attach (dcb) :0 ; }#endif
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +7 -1
@@ -2638,7 +2638,13 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) "Device does not support MSI interrupts\n");if (qlcnic_82xx_check (adapter)) { -qlcnic_dcb_enable (adapter->dcb); + err =qlcnic_dcb_enable (adapter->dcb); +if (err) { +qlcnic_dcb_free (adapter->dcb); +dev_err (&pdev->dev,"Failed to enable DCB\n" ); + goto err_out_free_hw; + } +qlcnic_dcb_get_info (adapter->dcb); err =qlcnic_setup_intr (adapter);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 445/521 nfc: Fix potential resource leaks
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit df49908f3c52d211aea5e2a14a93bbe67a2cb3af ]
nfc_get_device() take reference for the device, add missing nfc_put_device() to release it when not need anymore. Also fix the style warnning by use error EOPNOTSUPP instead of ENOTSUPP.
--- net/nfc/netlink.c | 52 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 14 deletions(-)
net/nfc/netlink.c +38 -14
@@ -1515,6 +1515,7 @@ static int nfc_genl_se_io(struct sk_buff *skb, struct genl_info *info)u32 dev_idx, se_idx;u8 *apdu;size_t apdu_len; +int rc; if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || !info->attrs[NFC_ATTR_SE_INDEX] ||
@@ -1528,25 +1529,37 @@ static int nfc_genl_se_io(struct sk_buff *skb, struct genl_info *info)if (!dev)return -ENODEV ; -if (!dev->ops || !dev->ops->se_io) -return -ENOTSUPP ; +if (!dev->ops || !dev->ops->se_io) { + rc = -EOPNOTSUPP ; + goto put_dev; + } apdu_len =nla_len (info->attrs[NFC_ATTR_SE_APDU ]); -if (apdu_len ==0 ) -return -EINVAL ; +if (apdu_len ==0 ) { + rc = -EINVAL ; + goto put_dev; + } apdu =nla_data (info->attrs[NFC_ATTR_SE_APDU ]); -if (!apdu) -return -EINVAL ; +if (!apdu) { + rc = -EINVAL ; + goto put_dev; + } ctx =kzalloc (sizeof (struct se_io_ctx ),GFP_KERNEL ); -if (!ctx) -return -ENOMEM ; +if (!ctx) { + rc = -ENOMEM ; + goto put_dev; + } ctx->dev_idx = dev_idx; ctx->se_idx = se_idx; -return nfc_se_io (dev, se_idx, apdu, apdu_len, se_io_cb, ctx); + rc =nfc_se_io (dev, se_idx, apdu, apdu_len, se_io_cb, ctx); + +put_dev: +nfc_put_device (dev); +return rc; } static int nfc_genl_vendor_cmd(struct sk_buff *skb,
@@ -1569,14 +1582,21 @@ static int nfc_genl_vendor_cmd(struct sk_buff *skb, subcmd =nla_get_u32 (info->attrs[NFC_ATTR_VENDOR_SUBCMD ]); dev =nfc_get_device (dev_idx); -if (!dev || !dev->vendor_cmds || !dev->n_vendor_cmds) +if (!dev)return -ENODEV ; +if (!dev->vendor_cmds || !dev->n_vendor_cmds) { + err = -ENODEV ; + goto put_dev; + } +if (info->attrs[NFC_ATTR_VENDOR_DATA ]) { data =nla_data (info->attrs[NFC_ATTR_VENDOR_DATA ]); data_len =nla_len (info->attrs[NFC_ATTR_VENDOR_DATA ]); -if (data_len ==0 ) -return -EINVAL ; +if (data_len ==0 ) { + err = -EINVAL ; + goto put_dev; + } }else { data =NULL ; data_len =0 ;
@@ -1591,10 +1611,14 @@ static int nfc_genl_vendor_cmd(struct sk_buff *skb, dev->cur_cmd_info = info; err = cmd->doit (dev, data, data_len); dev->cur_cmd_info =NULL ; -return err; + goto put_dev; } -return -EOPNOTSUPP ; + err = -EOPNOTSUPP ; + +put_dev: +nfc_put_device (dev); +return err; }/* message building helper */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 446/521 net: amd-xgbe: add missed tasklet_kill
In reply to Greg Kroah-HartmanFrom: Jiguang Xiao <[email protected]>
[ Upstream commit d530ece70f16f912e1d1bfeea694246ab78b0a4b ]
The driver does not call tasklet_kill in several places. Add the calls to fix it.
--- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 3 +++ drivers/net/ethernet/amd/xgbe/xgbe-i2c.c | 4 +++- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +3 -0
@@ -1140,6 +1140,9 @@ static void xgbe_free_irqs(struct xgbe_prv_data *pdata)devm_free_irq (pdata->dev, pdata->dev_irq, pdata); +tasklet_kill (&pdata->tasklet_dev); +tasklet_kill (&pdata->tasklet_ecc); +if (pdata->vdata->ecc_support && (pdata->dev_irq != pdata->ecc_irq))devm_free_irq (pdata->dev, pdata->ecc_irq, pdata);
drivers/net/ethernet/amd/xgbe/xgbe-i2c.c +3 -1
@@ -447,8 +447,10 @@ static void xgbe_i2c_stop(struct xgbe_prv_data *pdata)xgbe_i2c_disable (pdata);xgbe_i2c_clear_all_interrupts (pdata); -if (pdata->dev_irq != pdata->i2c_irq) +if (pdata->dev_irq != pdata->i2c_irq) {devm_free_irq (pdata->dev, pdata->i2c_irq, pdata); +tasklet_kill (&pdata->tasklet_i2c); + } }static int xgbe_i2c_start (struct xgbe_prv_data *pdata)
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +3 -1
@@ -1390,8 +1390,10 @@ static void xgbe_phy_stop(struct xgbe_prv_data *pdata)/* Disable auto-negotiation */ xgbe_an_disable_all (pdata); -if (pdata->dev_irq != pdata->an_irq) +if (pdata->dev_irq != pdata->an_irq) {devm_free_irq (pdata->dev, pdata->an_irq, pdata); +tasklet_kill (&pdata->tasklet_an); + } pdata->phy_if.phy_impl.stop (pdata);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 447/521 net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit d039535850ee47079d59527e96be18d8e0daa84b ]
of_phy_find_device() return device node with refcount incremented. Call put_device() to relese it when not needed anymore.
--- drivers/net/phy/xilinx_gmii2rgmii.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/phy/xilinx_gmii2rgmii.c +1 -0
@@ -91,6 +91,7 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev)if (!priv->phy_dev->drv) {dev_info (dev,"Attached phy not ready\n" ); +put_device (&priv->phy_dev->mdio.dev);return -EPROBE_DEFER ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 448/521 RDMA/mlx5: Fix validation of max_rd_atomic caps for DC
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit 8de8482fe5732fbef4f5af82bc0c0362c804cd1f ]
Currently, when modifying DC, we validate max_rd_atomic user attribute against the RC cap, validate against DC. RC and DC QP types have different device limitations.
This can cause userspace created DC QPs to malfunction.
--- drivers/infiniband/hw/mlx5/qp.c | 49 +++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 14 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +35 -14
@@ -3411,6 +3411,40 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,return err; } +static int validate_rd_atomic (struct mlx5_ib_dev *dev,struct ib_qp_attr *attr, +int attr_mask,enum ib_qp_type qp_type) +{ +int log_max_ra_res; +int log_max_ra_req; + +if (qp_type ==MLX5_IB_QPT_DCI ) { + log_max_ra_res =1 <<MLX5_CAP_GEN (dev->mdev, + log_max_ra_res_dc); + log_max_ra_req =1 <<MLX5_CAP_GEN (dev->mdev, + log_max_ra_req_dc); + }else { + log_max_ra_res =1 <<MLX5_CAP_GEN (dev->mdev, + log_max_ra_res_qp); + log_max_ra_req =1 <<MLX5_CAP_GEN (dev->mdev, + log_max_ra_req_qp); + } + +if (attr_mask &IB_QP_MAX_QP_RD_ATOMIC && + attr->max_rd_atomic > log_max_ra_res) { +mlx5_ib_dbg (dev,"invalid max_rd_atomic value %d\n" , + attr->max_rd_atomic); +return false; + } + +if (attr_mask &IB_QP_MAX_DEST_RD_ATOMIC && + attr->max_dest_rd_atomic > log_max_ra_req) { +mlx5_ib_dbg (dev,"invalid max_dest_rd_atomic value %d\n" , + attr->max_dest_rd_atomic); +return false; + } +return true; +} +int mlx5_ib_modify_qp (struct ib_qp *ibqp,struct ib_qp_attr *attr,int attr_mask,struct ib_udata *udata) {
@@ -3508,21 +3542,8 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, } } -if (attr_mask &IB_QP_MAX_QP_RD_ATOMIC && - attr->max_rd_atomic > - (1 <<MLX5_CAP_GEN (dev->mdev, log_max_ra_res_qp))) { -mlx5_ib_dbg (dev,"invalid max_rd_atomic value %d\n" , - attr->max_rd_atomic); - goto out; - } - -if (attr_mask &IB_QP_MAX_DEST_RD_ATOMIC && - attr->max_dest_rd_atomic > - (1 <<MLX5_CAP_GEN (dev->mdev, log_max_ra_req_qp))) { -mlx5_ib_dbg (dev,"invalid max_dest_rd_atomic value %d\n" , - attr->max_dest_rd_atomic); +if (!validate_rd_atomic (dev, attr, attr_mask, qp_type)) goto out; - }if (cur_state == new_state && cur_state ==IB_QPS_RESET ) { err =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 449/521 net: sched: atm: dont intepret cls results when asked to drop
In reply to Greg Kroah-HartmanFrom: Jamal Hadi Salim <[email protected]>
[ Upstream commit a2965c7be0522eaa18808684b7b82b248515511b ]
If asked to drop a packet via TC_ACT_SHOT it is unsafe to assume res.class contains a valid pointer
--- net/sched/sch_atm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sched/sch_atm.c +4 -1
@@ -394,10 +394,13 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch, result =tcf_classify (skb, fl, &res, true);if (result <0 )continue ; +if (result ==TC_ACT_SHOT ) + goto done; + flow = (struct atm_flow_data *)res.class;if (!flow) flow =lookup_flow (sch, res.classid); - goto done; + goto drop; } } flow =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 450/521 usb: rndis_host: Secure rndis_query check against int overflow
In reply to Greg Kroah-HartmanFrom: Szymon Heidrich <[email protected]>
[ Upstream commit c7dd13805f8b8fc1ce3b6d40f6aff47e66b72ad2 ]
Variables off and len typed as uint32 in rndis_query function are controlled by incoming RNDIS response message thus their value may be manipulated. Setting off to a unexpectetly large value will cause the sum with len and 8 to overflow and pass the implemented validation step. Consequently the response pointer will be referring to a location past the expected buffer boundaries allowing information leakage e.g. via RNDIS_OID_802_3_PERMANENT_ADDRESS OID.
--- drivers/net/usb/rndis_host.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/usb/rndis_host.c +2 -1
@@ -267,7 +267,8 @@ static int rndis_query(struct usbnet *dev, struct usb_interface *intf, off =le32_to_cpu (u.get_c->offset); len =le32_to_cpu (u.get_c->len); -if (unlikely ((8 + off + len) >CONTROL_BUFFER_SIZE )) +if (unlikely ((off >CONTROL_BUFFER_SIZE -8 ) || + (len >CONTROL_BUFFER_SIZE -8 - off))) goto response_error;if (*reply_len !=-1 && len != *reply_len)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 451/521 caif: fix memory leak in cfctrl_linkup_request()
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit fe69230f05897b3de758427b574fc98025dfc907 ]
When linktype is unknown or kzalloc failed in cfctrl_linkup_request(), pkt is not released. Add release process to error path.
--- net/caif/cfctrl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/caif/cfctrl.c +5 -1
@@ -269,11 +269,15 @@ int cfctrl_linkup_request(struct cflayer *layer,default :pr_warn ("Request setup of bad link type = %d\n" , param->linktype); +cfpkt_destroy (pkt);return -EINVAL ; } req =kzalloc (sizeof (*req),GFP_KERNEL ); -if (!req) +if (!req) { +cfpkt_destroy (pkt);return -ENOMEM ; + } + req->client_layer = user_layer; req->cmd =CFCTRL_CMD_LINK_SETUP ; req->param = *param;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 452/521 udf: Fix extension of the last extent in the file
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 83c7423d1eb6806d13c521d1002cc1a012111719 ]
When extending the last extent in the file within the last block, we wrongly computed the length of the last extent. This is mostly a cosmetical problem since the extent does not contain any data and the length will be fixed up by following operations but still.
--- fs/udf/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/inode.c +1 -1
@@ -595,7 +595,7 @@ static void udf_do_extend_final_block(struct inode *inode,*/ if (new_elen <= (last_ext->extLength &UDF_EXTENT_LENGTH_MASK ))return ; - added_bytes = (last_ext->extLength &UDF_EXTENT_LENGTH_MASK ) - new_elen; + added_bytes = new_elen - (last_ext->extLength &UDF_EXTENT_LENGTH_MASK ); last_ext->extLength += added_bytes;UDF_I (inode)->i_lenExtents += added_bytes;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 453/521 ASoC: Intel: bytcr_rt5640: Add quirk for the Advantech MICA-071 tablet
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit a1dec9d70b6ad97087b60b81d2492134a84208c6 ]
The Advantech MICA-071 tablet deviates from the defaults for a non CR Bay Trail based tablet in several ways:
1. It uses an analog MIC on IN3 rather then using DMIC1
2. It only has 1 speaker
3. It needs the OVCD current threshold to be set to 1500uA instead of the default 2000uA to reliable differentiate between headphones vs headsets
Add a quirk with these settings for this tablet.
--- sound/soc/intel/boards/bytcr_rt5640.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +15 -0
@@ -437,6 +437,21 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF1 | BYT_RT5640_MCLK_EN), }, + { +/* Advantech MICA-071 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Advantech" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MICA-071"), + }, +/* OVCD Th = 1500uA to reliable detect head-phones vs -set */ + .driver_data = (void *)(BYT_RT5640_IN3_MAP | +BYT_RT5640_JD_SRC_JD2_IN4N | +BYT_RT5640_OVCD_TH_1500UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_MONO_SPEAKER | +BYT_RT5640_DIFF_MIC | + BYT_RT5640_MCLK_EN), + }, { .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 454/521 x86/bugs: Flush IBP in ib_prctl_set()
In reply to Greg Kroah-HartmanFrom: Rodrigo Branco <[email protected]>
commit a664ec9158eeddd75121d39c9a0758016097fa96 upstream.
We missed the window between the TIF flag update and the next reschedule.
--- arch/x86/kernel/cpu/bugs.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/cpu/bugs.c +2 -0
@@ -1778,6 +1778,8 @@ static int ib_prctl_set(struct task_struif (ctrl ==PR_SPEC_FORCE_DISABLE )task_set_spec_ib_force_disable (task);task_update_spec_tif (task); +if (task == current) +indirect_branch_prediction_barrier ();break ;default :return -ERANGE ;
Greg Kroah-Hartman
maintainerPATCH 455/521 nfsd: fix handling of readdir in v4root vs. mount upcall timeout
In reply to Greg Kroah-HartmanFrom: Jeff Layton <[email protected]>
commit cad853374d85fe678d721512cecfabd7636e51f3 upstream.
If v4 READDIR operation hits a mountpoint and gets back an error, then it will include that entry in the reply and set RDATTR_ERROR for it to the error.
That's fine for "normal" exported filesystems, but on the v4root, we need to be more careful to only expose the existence of dentries that lead to exports.
If the mountd upcall times out while checking to see whether a mountpoint on the v4root is exported, then we have no recourse other than to fail the whole operation.
--- fs/nfsd/nfs4xdr.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/nfsd/nfs4xdr.c +11 -0
@@ -3102,6 +3102,17 @@ nfsd4_encode_dirent(void *ccdv, const chcase nfserr_noent:xdr_truncate_encode (xdr, start_offset); goto skip_entry; +case nfserr_jukebox: +/* +* The pseudoroot should only display dentries that lead to +* exports. If we get EJUKEBOX here, then we can't tell whether +* this entry should be included. Just fail the whole READDIR +* with NFS4ERR_DELAY in that case, and hope that the situation +* will resolve itself by the client's next attempt. +*/ +if (cd->rd_fhp->fh_export->ex_flags &NFSEXP_V4ROOT ) + goto fail; +/* fallthrough */ default :/* * If the client requested the RDATTR_ERROR attribute,
Greg Kroah-Hartman
maintainerPATCH 456/521 riscv: uaccess: fix type of 0 variable on error in get_user()
In reply to Greg Kroah-HartmanFrom: Ben Dooks <[email protected]>
commit b9b916aee6715cd7f3318af6dc360c4729417b94 upstream.
If the get_user(x, ptr) has x as a pointer, then the setting of (x) = 0 is going to produce the following sparse warning, so fix this by forcing the type of 'x' when access_ok() fails.
fs/aio.c:2073:21: warning: Using plain integer as NULL pointer
--- arch/riscv/include/asm/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/uaccess.h +1 -1
@@ -260,7 +260,7 @@ do { \might_fault (); \access_ok (VERIFY_READ , __p,sizeof (*__p)) ? \__get_user ((x), __p) : \ - ((x) =0 , -EFAULT ); \ + ((x) = (__force __typeof__(x))0, -EFAULT); \ })#define __put_user_asm (insn, x, ptr, err) \
Greg Kroah-Hartman
maintainerPATCH 457/521 ext4: dont allow journal inode to have encrypt flag
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 105c78e12468413e426625831faa7db4284e1fec upstream.
Mounting a filesystem whose journal inode has the encrypt flag causes a NULL dereference in fscrypt_limit_io_blocks() when the 'inlinecrypt' mount option is used.
The problem is that when jbd2_journal_init_inode() calls bmap(), it eventually finds its way into ext4_iomap_begin(), which calls fscrypt_limit_io_blocks(). fscrypt_limit_io_blocks() requires that if the inode is encrypted, then its encryption key must already be set up. That's not the case here, since the journal inode is never "opened" like a normal file would be. Hence the crash.
A reproducer is:
mkfs.ext4 -F /dev/vdb
debugfs -w /dev/vdb -R "set_inode_field <8> flags 0x80808" mount /dev/vdb /mnt -o inlinecrypt
To fix this, make ext4 consider journal inodes with the encrypt flag to be invalid. (Note, maybe other flags should be rejected on the journal inode too. For now, this is just the minimal fix for the above issue.)
I've marked this as fixing the commit that introduced the call to fscrypt_limit_io_blocks(), since that's what made an actual crash start being possible. But this fix could be applied to any version of ext4 that supports the encrypt feature.
--- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/super.c +1 -1
@@ -4732,7 +4732,7 @@ static struct inode *ext4_get_journal_injbd_debug (2 ,"Journal inode found at %p: %lld bytes\n" , journal_inode, journal_inode->i_size); -if (!S_ISREG (journal_inode->i_mode)) { +if (!S_ISREG (journal_inode->i_mode) ||IS_ENCRYPTED (journal_inode)) {ext4_msg (sb,KERN_ERR ,"invalid journal inode" );iput (journal_inode);return NULL ;
Greg Kroah-Hartman
maintainerPATCH 458/521 hfs/hfsplus: use WARN_ON for sanity check
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 55d1cbbbb29e6656c662ee8f73ba1fc4777532eb upstream.
gcc warns about a couple of instances in which a sanity check exists but the author wasn't sure how to react to it failing, which makes it look like a possible bug:
fs/hfsplus/inode.c: In function 'hfsplus_cat_read_inode':
fs/hfsplus/inode.c:503:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
503 | /* panic? */;
| ^
fs/hfsplus/inode.c:524:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
524 | /* panic? */;
| ^
fs/hfsplus/inode.c: In function 'hfsplus_cat_write_inode':
fs/hfsplus/inode.c:582:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
582 | /* panic? */;
| ^
fs/hfsplus/inode.c:608:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
608 | /* panic? */;
| ^
fs/hfs/inode.c: In function 'hfs_write_inode':
fs/hfs/inode.c:464:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
464 | /* panic? */;
| ^
fs/hfs/inode.c:485:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
485 | /* panic? */;
| ^panic() is probably not the correct choice here, but a WARN_ON seems appropriate and avoids the compile-time warning.
--- fs/hfs/inode.c | 6 ++---- fs/hfsplus/inode.c | 12 ++++-------- 2 files changed, 6 insertions(+), 12 deletions(-)
fs/hfs/inode.c +2 -4
@@ -461,8 +461,7 @@ int hfs_write_inode(struct inode *inode, goto out;if (S_ISDIR (main_inode->i_mode)) { -if (fd.entrylength <sizeof (struct hfs_cat_dir )) -/* panic? */ ; +WARN_ON (fd.entrylength <sizeof (struct hfs_cat_dir ));hfs_bnode_read (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_dir )); if (rec.type != HFS_CDR_DIR ||
@@ -482,8 +481,7 @@ int hfs_write_inode(struct inode *inode,hfs_bnode_write (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_file )); }else { -if (fd.entrylength <sizeof (struct hfs_cat_file )) -/* panic? */ ; +WARN_ON (fd.entrylength <sizeof (struct hfs_cat_file ));hfs_bnode_read (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_file )); if (rec.type != HFS_CDR_FIL ||
fs/hfsplus/inode.c +4 -8
@@ -476,8 +476,7 @@ int hfsplus_cat_read_inode(struct inodeif (type ==HFSPLUS_FOLDER ) {struct hfsplus_cat_folder *folder = &entry.folder; -if (fd->entrylength <sizeof (struct hfsplus_cat_folder )) -/* panic? */ ; +WARN_ON (fd->entrylength <sizeof (struct hfsplus_cat_folder ));hfs_bnode_read (fd->bnode, &entry, fd->entryoffset,sizeof (struct hfsplus_cat_folder ));hfsplus_get_perms (inode, &folder->permissions,1 );
@@ -497,8 +496,7 @@ int hfsplus_cat_read_inode(struct inode }else if (type ==HFSPLUS_FILE ) {struct hfsplus_cat_file *file = &entry.file; -if (fd->entrylength <sizeof (struct hfsplus_cat_file )) -/* panic? */ ; +WARN_ON (fd->entrylength <sizeof (struct hfsplus_cat_file ));hfs_bnode_read (fd->bnode, &entry, fd->entryoffset,sizeof (struct hfsplus_cat_file ));
@@ -555,8 +553,7 @@ int hfsplus_cat_write_inode(struct inodeif (S_ISDIR (main_inode->i_mode)) {struct hfsplus_cat_folder *folder = &entry.folder; -if (fd.entrylength <sizeof (struct hfsplus_cat_folder )) -/* panic? */ ; +WARN_ON (fd.entrylength <sizeof (struct hfsplus_cat_folder ));hfs_bnode_read (fd.bnode, &entry, fd.entryoffset,sizeof (struct hfsplus_cat_folder ));/* simple node checks? */
@@ -581,8 +578,7 @@ int hfsplus_cat_write_inode(struct inode }else {struct hfsplus_cat_file *file = &entry.file; -if (fd.entrylength <sizeof (struct hfsplus_cat_file )) -/* panic? */ ; +WARN_ON (fd.entrylength <sizeof (struct hfsplus_cat_file ));hfs_bnode_read (fd.bnode, &entry, fd.entryoffset,sizeof (struct hfsplus_cat_file ));hfsplus_inode_write_fork (inode, &file->data_fork);
Greg Kroah-Hartman
maintainerPATCH 459/521 hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit cb7a95af78d29442b8294683eca4897544b8ef46 upstream.
Commit 55d1cbbbb29e ("hfs/hfsplus: use WARN_ON for sanity check") fixed a build warning by turning a comment into a WARN_ON(), but it turns out that syzbot then complains because it can trigger said warning with a corrupted hfs image.
The warning actually does warn about a bad situation, but we are much better off just handling it as the error it is. So rather than warn about us doing bad things, stop doing the bad things and return -EIO.
While at it, also fix a memory leak that was introduced by an earlier fix for a similar syzbot warning situation, and add a check for one case that historically wasn't handled at all (ie neither comment nor subsequent WARN_ON).
--- fs/hfs/inode.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/hfs/inode.c +10 -5
@@ -453,15 +453,16 @@ int hfs_write_inode(struct inode *inode,/* panic? */ return -EIO ; + res = -EIO ;if (HFS_I (main_inode)->cat_key.CName.len >HFS_NAMELEN ) -return -EIO ; + goto out; fd.search_key->cat =HFS_I (main_inode)->cat_key;if (hfs_brec_find (&fd)) -/* panic? */ goto out;if (S_ISDIR (main_inode->i_mode)) { -WARN_ON (fd.entrylength <sizeof (struct hfs_cat_dir )); +if (fd.entrylength <sizeof (struct hfs_cat_dir )) + goto out;hfs_bnode_read (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_dir )); if (rec.type != HFS_CDR_DIR ||
@@ -474,6 +475,8 @@ int hfs_write_inode(struct inode *inode,hfs_bnode_write (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_dir )); }else if (HFS_IS_RSRC (inode)) { +if (fd.entrylength <sizeof (struct hfs_cat_file )) + goto out;hfs_bnode_read (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_file )); hfs_inode_write_fork(inode, rec.file.RExtRec,
@@ -481,7 +484,8 @@ int hfs_write_inode(struct inode *inode,hfs_bnode_write (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_file )); }else { -WARN_ON (fd.entrylength <sizeof (struct hfs_cat_file )); +if (fd.entrylength <sizeof (struct hfs_cat_file )) + goto out;hfs_bnode_read (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_file )); if (rec.type != HFS_CDR_FIL ||
@@ -498,9 +502,10 @@ int hfs_write_inode(struct inode *inode,hfs_bnode_write (fd.bnode, &rec, fd.entryoffset,sizeof (struct hfs_cat_file )); } + res =0 ; out:hfs_find_exit (&fd); -return 0 ; +return res; } static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry,
Greg Kroah-Hartman
maintainerPATCH 460/521 mbcache: Avoid nesting of cache->c_list_lock under bit locks
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 5fc4cbd9fde5d4630494fd6ffc884148fb618087 upstream.
Commit 307af6c87937 ("mbcache: automatically delete entries from cache on freeing") started nesting cache->c_list_lock under the bit locks protecting hash buckets of the mbcache hash table in mb_cache_entry_create(). This causes problems for real-time kernels because there spinlocks are sleeping locks while bitlocks stay atomic. Luckily the nesting is easy to avoid by holding entry reference until the entry is added to the LRU list. This makes sure we cannot race with entry deletion.
--- fs/mbcache.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
fs/mbcache.c +10 -7
@@ -89,8 +89,14 @@ int mb_cache_entry_create(struct mb_cachreturn -ENOMEM ;INIT_LIST_HEAD (&entry->e_list); -/* Initial hash reference */ -atomic_set (&entry->e_refcnt,1 ); +/* +* We create entry with two references. One reference is kept by the +* hash table, the other reference is used to protect us from +* mb_cache_entry_delete_or_get() until the entry is fully setup. This +* avoids nesting of cache->c_list_lock into hash table bit locks which +* is problematic for RT. +*/ +atomic_set (&entry->e_refcnt,2 ); entry->e_key = key; entry->e_value = value; entry->e_flags =0 ;
@@ -106,15 +112,12 @@ int mb_cache_entry_create(struct mb_cach } }hlist_bl_add_head (&entry->e_hash_list, head); -/* -* Add entry to LRU list before it can be found by -* mb_cache_entry_delete() to avoid races -*/ +hlist_bl_unlock (head);spin_lock (&cache->c_list_lock);list_add_tail (&entry->e_list, &cache->c_list); cache->c_entry_count++;spin_unlock (&cache->c_list_lock); -hlist_bl_unlock (head); +mb_cache_entry_put (cache, entry);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 461/521 parisc: Align parisc MADV_XXX constants with all other architectures
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 71bdea6f798b425bc0003780b13e3fdecb16a010 upstream.
Adjust some MADV_XXX constants to be in sync what their values are on all other platforms. There is currently no reason to have an own numbering on parisc, but it requires workarounds in many userspace sources (e.g. glibc, qemu, ...) - which are often forgotten and thus introduce bugs and different behaviour on parisc.
A wrapper avoids an ABI breakage for existing userspace applications by translating any old values to the new ones, so this change allows us to move over all programs to the new ABI over time.
--- arch/parisc/include/uapi/asm/mman.h | 17 ++++++++--------- arch/parisc/kernel/sys_parisc.c | 27 +++++++++++++++++++++++++++ arch/parisc/kernel/syscall_table.S | 2 +- tools/arch/parisc/include/uapi/asm/mman.h | 12 ++++++------ tools/perf/bench/bench.h | 12 ------------ 5 files changed, 42 insertions(+), 28 deletions(-)
arch/parisc/include/uapi/asm/mman.h +8 -9
@@ -50,25 +50,24 @@#define MADV_DONTFORK 10/* don't inherit across fork */ #define MADV_DOFORK 11/* do inherit across fork */ -#define MADV_MERGEABLE 65/* KSM may merge identical pages */ -#define MADV_UNMERGEABLE 66/* KSM may not merge identical pages */ +#define MADV_MERGEABLE 12/* KSM may merge identical pages */ +#define MADV_UNMERGEABLE 13/* KSM may not merge identical pages */ -#define MADV_HUGEPAGE 67/* Worth backing with hugepages */ -#define MADV_NOHUGEPAGE 68/* Not worth backing with hugepages */ +#define MADV_HUGEPAGE 14/* Worth backing with hugepages */ +#define MADV_NOHUGEPAGE 15/* Not worth backing with hugepages */ -#define MADV_DONTDUMP 69/* Explicity exclude from the core dump, +#define MADV_DONTDUMP 16/* Explicity exclude from the core dump, overrides the coredump filter bits */ -#define MADV_DODUMP 70/* Clear the MADV_NODUMP flag */ +#define MADV_DODUMP 17/* Clear the MADV_NODUMP flag */ -#define MADV_WIPEONFORK 71/* Zero memory on fork, child only */ -#define MADV_KEEPONFORK 72/* Undo MADV_WIPEONFORK */ +#define MADV_WIPEONFORK 18/* Zero memory on fork, child only */ +#define MADV_KEEPONFORK 19/* Undo MADV_WIPEONFORK */ #define MADV_HWPOISON 100/* poison a page for testing */ #define MADV_SOFT_OFFLINE 101/* soft offline page for testing */ /* compatibility flags */ #define MAP_FILE 0 -#define MAP_VARIABLE 0#define PKEY_DISABLE_ACCESS 0x1#define PKEY_DISABLE_WRITE 0x2
arch/parisc/kernel/sys_parisc.c +27 -0
@@ -386,3 +386,30 @@ long parisc_personality(unsigned long pereturn err; } + +/* +* madvise() wrapper +* +* Up to kernel v6.1 parisc has different values than all other +* platforms for the MADV_xxx flags listed below. +* To keep binary compatibility with existing userspace programs +* translate the former values to the new values. +* +* XXX: Remove this wrapper in year 2025 (or later) +*/ + +asmlinkage notrace long parisc_madvise(unsigned long start, size_t len_in, int behavior) +{ +switch (behavior) { +case 65 : behavior =MADV_MERGEABLE ;break ; +case 66 : behavior =MADV_UNMERGEABLE ;break ; +case 67 : behavior =MADV_HUGEPAGE ;break ; +case 68 : behavior =MADV_NOHUGEPAGE ;break ; +case 69 : behavior =MADV_DONTDUMP ;break ; +case 70 : behavior =MADV_DODUMP ;break ; +case 71 : behavior =MADV_WIPEONFORK ;break ; +case 72 : behavior =MADV_KEEPONFORK ;break ; + } + +return sys_madvise (start, len_in, behavior); +}
arch/parisc/kernel/syscall_table.S +1 -1
@@ -195,7 +195,7 @@ ENTRY_COMP(sysinfo) ENTRY_SAME(shutdown) ENTRY_SAME(fsync) - ENTRY_SAME(madvise) + ENTRY_OURS(madvise) ENTRY_SAME(clone_wrapper) /* 120 */ ENTRY_SAME(setdomainname) ENTRY_COMP(sendfile)
tools/arch/parisc/include/uapi/asm/mman.h +6 -6
@@ -1,20 +1,20 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H #define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H -#define MADV_DODUMP 70 +#define MADV_DODUMP 17#define MADV_DOFORK 11 -#define MADV_DONTDUMP 69 +#define MADV_DONTDUMP 16#define MADV_DONTFORK 10#define MADV_DONTNEED 4#define MADV_FREE 8 -#define MADV_HUGEPAGE 67 -#define MADV_MERGEABLE 65 -#define MADV_NOHUGEPAGE 68 +#define MADV_HUGEPAGE 14 +#define MADV_MERGEABLE 12 +#define MADV_NOHUGEPAGE 15#define MADV_NORMAL 0#define MADV_RANDOM 1#define MADV_REMOVE 9#define MADV_SEQUENTIAL 2 -#define MADV_UNMERGEABLE 66 +#define MADV_UNMERGEABLE 13#define MADV_WILLNEED 3#define MAP_ANONYMOUS 0x10#define MAP_DENYWRITE 0x0800
tools/perf/bench/bench.h +0 -12
@@ -10,25 +10,13 @@ extern struct timeval bench__start, benc* The madvise transparent hugepage constants were added in glibc * 2.13. For compatibility with older versions of glibc, define these * tokens if they are not already defined. -* -* PA-RISC uses different madvise values from other architectures and -* needs to be special-cased. */ -#ifdef __hppa__ -# ifndef MADV_HUGEPAGE -# define MADV_HUGEPAGE 67 -# endif -# ifndef MADV_NOHUGEPAGE -# define MADV_NOHUGEPAGE 68 -# endif -#else # ifndef MADV_HUGEPAGE # define MADV_HUGEPAGE 14# endif # ifndef MADV_NOHUGEPAGE # define MADV_NOHUGEPAGE 15# endif -#endif int bench_numa (int argc,const char **argv);int bench_sched_messaging (int argc,const char **argv);
Greg Kroah-Hartman
maintainerPATCH 462/521 driver core: Fix bus_type.match() error handling in __driver_attach()
In reply to Greg Kroah-HartmanFrom: Isaac J. Manjarres <[email protected]>
commit 27c0d217340e47ec995557f61423ef415afba987 upstream.
When a driver registers with a bus, it will attempt to match with every device on the bus through the __driver_attach() function. Currently, if the bus_type.match() function encounters an error that is not -EPROBE_DEFER, __driver_attach() will return a negative error code, which causes the driver registration logic to stop trying to match with the remaining devices on the bus.
This behavior is not correct; a failure while matching a driver to a device does not mean that the driver won't be able to match and bind with other devices on the bus. Update the logic in __driver_attach() to reflect this.
--- drivers/base/dd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/base/dd.c +6 -2
@@ -911,8 +911,12 @@ static int __driver_attach(struct device*/ return 0 ; }else if (ret <0 ) { -dev_dbg (dev,"Bus failed to match device: %d" , ret); -return ret; +dev_dbg (dev,"Bus failed to match device: %d\n" , ret); +/* +* Driver could not match with device, but may match with +* another device on the bus. +*/ +return 0 ; }/* ret > 0 means positive match */ if (dev->parent && dev->bus->need_parent_lock)
Greg Kroah-Hartman
maintainerPATCH 463/521 net: sched: disallow noqueue for qdisc classes
In reply to Greg Kroah-HartmanFrom: Frederick Lawler <[email protected]>
commit 96398560f26aa07e8f2969d73c8197e6a6d10407 upstream.
While experimenting with applying noqueue to a classful queue discipline, we discovered a NULL pointer dereference in the __dev_queue_xmit() path that generates a kernel OOPS:
# dev=enp0s5
# tc qdisc replace dev $dev root handle 1: htb default 1 # tc class add dev $dev parent 1: classid 1:1 htb rate 10mbit # tc qdisc add dev $dev parent 1:1 handle 10: noqueue # ping -I $dev -w 1 -c 1 1.1.1.1
[ 2.172856] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 2.173217] #PF: supervisor instruction fetch in kernel mode ... [ 2.178451] Call Trace: [ 2.178577] <TASK> [ 2.178686] htb_enqueue+0x1c8/0x370 [ 2.178880] dev_qdisc_enqueue+0x15/0x90 [ 2.179093] __dev_queue_xmit+0x798/0xd00 [ 2.179305] ? _raw_write_lock_bh+0xe/0x30 [ 2.179522] ? __local_bh_enable_ip+0x32/0x70 [ 2.179759] ? ___neigh_create+0x610/0x840 [ 2.179968] ? eth_header+0x21/0xc0 [ 2.180144] ip_finish_output2+0x15e/0x4f0 [ 2.180348] ? dst_output+0x30/0x30 [ 2.180525] ip_push_pending_frames+0x9d/0xb0 [ 2.180739] raw_sendmsg+0x601/0xcb0 [ 2.180916] ? _raw_spin_trylock+0xe/0x50 [ 2.181112] ? _raw_spin_unlock_irqrestore+0x16/0x30 [ 2.181354] ? get_page_from_freelist+0xcd6/0xdf0 [ 2.181594] ? sock_sendmsg+0x56/0x60 [ 2.181781] sock_sendmsg+0x56/0x60 [ 2.181958] __sys_sendto+0xf7/0x160 [ 2.182139] ? handle_mm_fault+0x6e/0x1d0 [ 2.182366] ? do_user_addr_fault+0x1e1/0x660 [ 2.182627] __x64_sys_sendto+0x1b/0x30 [ 2.182881] do_syscall_64+0x38/0x90 [ 2.183085] entry_SYSCALL_64_after_hwframe+0x63/0xcd ... [ 2.187402] </TASK>
Previously in commit d66d6c3152e8 ("net: sched: register noqueue qdisc"), NULL was set for the noqueue discipline on noqueue init so that __dev_queue_xmit() falls through for the noqueue case. This also sets a bypass of the enqueue NULL check in the register_qdisc() function for the struct noqueue_disc_ops.
Classful queue disciplines make it past the NULL check in __dev_queue_xmit() because the discipline is set to htb (in this case), and then in the call to __dev_xmit_skb(), it calls into htb_enqueue() which grabs a leaf node for a class and then calls qdisc_enqueue() by passing in a queue discipline which assumes ->enqueue() is not set to NULL.
Fix this by not allowing classes to be assigned to the noqueue discipline. Linux TC Notes states that classes cannot be set to the noqueue discipline. [1] Let's enforce that here.
Links:
1. https://linux-tc-notes.sourceforge.net/tc/doc/sch_noqueue.txt
--- net/sched/sch_api.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sched/sch_api.c +6 -2
@@ -1031,8 +1031,12 @@ skip:unsigned long cl = cops->find (parent, classid);if (cl) { - err = cops->graft (parent, cl, new, &old, - extack); +if (new && new->ops == &noqueue_qdisc_ops) { +NL_SET_ERR_MSG (extack,"Cannot assign noqueue to a class" ); + err = -EINVAL ; + }else { + err = cops->graft (parent, cl, new, &old, extack); + } }else {NL_SET_ERR_MSG (extack,"Specified class not found" ); err = -ENOENT ;
Greg Kroah-Hartman
maintainerPATCH 464/521 docs: Fix the docs build with Sphinx 6.0
In reply to Greg Kroah-HartmanFrom: Jonathan Corbet <[email protected]>
commit 0283189e8f3d0917e2ac399688df85211f48447b upstream.
Sphinx 6.0 removed the execfile_() function, which we use as part of the configuration process. They *did* warn us... Just open-code the functionality as is done in Sphinx itself.
Tested (using SPHINX_CONF, since this code is only executed with an alternative config file) on various Sphinx versions from 2.5 through 6.0.
--- Documentation/sphinx/load_config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/sphinx/load_config.py +4 -2
@@ -3,7 +3,7 @@ import os import sys -from sphinx.util.pycompat import execfile_ +from sphinx.util.osutil import fs_encoding # ------------------------------------------------------------------------------ def loadConfig(namespace):
@@ -25,7 +25,9 @@ def loadConfig(namespace): sys.stdout.write("load additional sphinx-config: %s\n" % config_file) config = namespace.copy() config['__file__'] = config_file - execfile_(config_file, config) + with open(config_file, 'rb') as f: + code = compile(f.read(), fs_encoding, 'exec') + exec(code, config) del config['__file__'] namespace.update(config) else:
Greg Kroah-Hartman
maintainerPATCH 465/521 perf auxtrace: Fix address filter duplicate symbol selection
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit cf129830ee820f7fc90b98df193cd49d49344d09 upstream.
When a match has been made to the nth duplicate symbol, return success not error.
Example:
Before:
$ cat file.c
cat: file.c: No such file or directory
$ cat file1.c
#include <stdio.h> static void func(void)
{
printf("First func\n");
}
void other(void);
int main()
{
func();
other();
return 0;
}
$ cat file2.c
#include <stdio.h>
static void func(void)
{
printf("Second func\n");
}
void other(void)
{
func();
}
$ gcc -Wall -Wextra -o test file1.c file2.c
$ perf record -e intel_pt//u --filter 'filter func @ ./test' -- ./test
Multiple symbols with name 'func'
#1 0x1149 l func
which is near main
#2 0x1179 l func
which is near other
Disambiguate symbol name by inserting #n after the name e.g. func #2
Or select a global symbol by inserting #0 or #g or #G
Failed to parse address filter: 'filter func @ ./test'
Filter format is: filter|start|stop|tracestop <start symbol or address> [/ <end symbol or size>] [@<file name>]
Where multiple filters are separated by space or comma.
$ perf record -e intel_pt//u --filter 'filter func #2 @ ./test' -- ./test
Failed to parse address filter: 'filter func #2 @ ./test'
Filter format is: filter|start|stop|tracestop <start symbol or address> [/ <end symbol or size>] [@<file name>]
Where multiple filters are separated by space or comma.After:
$ perf record -e intel_pt//u --filter 'filter func #2 @ ./test' -- ./test
First func
Second func
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.016 MB perf.data ]
$ perf script --itrace=b -Ftime,flags,ip,sym,addr --ns
1231062.526977619: tr strt 0 [unknown] => 558495708179 func
1231062.526977619: tr end call 558495708188 func => 558495708050 _init
1231062.526979286: tr strt 0 [unknown] => 55849570818d func
1231062.526979286: tr end return 55849570818f func => 55849570819d other--- tools/perf/util/auxtrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/auxtrace.c +1 -1
@@ -1962,7 +1962,7 @@ static int find_dso_sym(struct dso *dso, *size = sym->start - *start;if (idx >0 ) {if (*size) -return 1 ; +return 0 ; }else if (dso_sym_match (sym, sym_name, &cnt, idx)) {print_duplicate_syms (dso, sym_name);return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 466/521 s390/percpu: add READ_ONCE() to arch_this_cpu_to_op_simple()
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
commit e3f360db08d55a14112bd27454e616a24296a8b0 upstream.
Make sure that *ptr__ within arch_this_cpu_to_op_simple() is only dereferenced once by using READ_ONCE(). Otherwise the compiler could generate incorrect code.
--- arch/s390/include/asm/percpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/percpu.h +1 -1
@@ -31,7 +31,7 @@pcp_op_T__ *ptr__; \preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ - prev__ = *ptr__; \ + prev__ =READ_ONCE (*ptr__); \ do { \ old__ = prev__; \ new__ = old__ op (val); \
Greg Kroah-Hartman
maintainerPATCH 467/521 net/ulp: prevent ULP without clone op from entering the LISTEN status
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
commit 2c02d41d71f90a5168391b6a5f2954112ba2307c upstream.
When an ULP-enabled socket enters the LISTEN status, the listener ULP data pointer is copied inside the child/accepted sockets by sk_clone_lock().
The relevant ULP can take care of de-duplicating the context pointer via the clone() operation, but only MPTCP and SMC implement such op.
Other ULPs may end-up with a double-free at socket disposal time.
We can't simply clear the ULP data at clone time, as TLS replaces the socket ops with custom ones assuming a valid TLS ULP context is available.
Instead completely prevent clone-less ULP sockets from entering the LISTEN status.
--- net/ipv4/inet_connection_sock.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
net/ipv4/inet_connection_sock.c +15 -1
@@ -903,11 +903,25 @@ void inet_csk_prepare_forced_close(struc }EXPORT_SYMBOL (inet_csk_prepare_forced_close); +static int inet_ulp_can_listen (const struct sock *sk) +{ +const struct inet_connection_sock *icsk =inet_csk (sk); + +if (icsk->icsk_ulp_ops) +return -EINVAL ; + +return 0 ; +} +int inet_csk_listen_start (struct sock *sk,int backlog) {struct inet_connection_sock *icsk =inet_csk (sk);struct inet_sock *inet =inet_sk (sk); -int err = -EADDRINUSE ; +int err; + + err =inet_ulp_can_listen (sk); +if (unlikely (err)) +return err;reqsk_queue_alloc (&icsk->icsk_accept_queue);
Greg Kroah-Hartman
maintainerPATCH 468/521 ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF
In reply to Greg Kroah-HartmanFrom: Clement Lecigne <[email protected]>
[ Note: this is a fix that works around the bug equivalently as the
two upstream commits:
1fa4445f9adf ("ALSA: control - introduce snd_ctl_notify_one() helper") 56b88b50565c ("ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF")
but in a simpler way to fit with older stable trees -- tiwai ]
Add missing locking in ctl_elem_read_user/ctl_elem_write_user which can be easily triggered and turned into an use-after-free.
Example code paths with SNDRV_CTL_IOCTL_ELEM_READ:
64-bits:snd_ctl_ioctl
snd_ctl_elem_read_user
[takes controls_rwsem]
snd_ctl_elem_read [lock properly held, all good] [drops controls_rwsem]
32-bits (compat):snd_ctl_ioctl_compat
snd_ctl_elem_write_read_compat
ctl_elem_write_read
snd_ctl_elem_read [missing lock, not good]
CVE-2023-0266 was assigned for this issue.
--- sound/core/control_compat.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/core/control_compat.c +4 -0
@@ -319,7 +319,9 @@ static int ctl_elem_read_user(struct snd err =snd_power_wait (card,SNDRV_CTL_POWER_D0 );if (err <0 ) goto error; +down_read (&card->controls_rwsem); err =snd_ctl_elem_read (card, data); +up_read (&card->controls_rwsem);if (err <0 ) goto error; err =copy_ctl_value_to_user (userdata, valuep, data, type, count);
@@ -347,7 +349,9 @@ static int ctl_elem_write_user(struct sn err =snd_power_wait (card,SNDRV_CTL_POWER_D0 );if (err <0 ) goto error; +down_write (&card->controls_rwsem); err =snd_ctl_elem_write (card, file, data); +up_write (&card->controls_rwsem);if (err <0 ) goto error; err =copy_ctl_value_to_user (userdata, valuep, data, type, count);
Greg Kroah-Hartman
maintainerPATCH 469/521 cifs: Fix uninitialized memory read for smb311 posix symlink create
In reply to Greg Kroah-HartmanFrom: Volker Lendecke <[email protected]>
commit a152d05ae4a71d802d50cf9177dba34e8bb09f68 upstream.
If smb311 posix is enabled, we send the intended mode for file creation in the posix create context. Instead of using what's there on the stack, create the mfsymlink file with 0644.
--- fs/cifs/link.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/link.c +1 -0
@@ -481,6 +481,7 @@ smb3_create_mf_symlink(unsigned int xid, oparms.disposition =FILE_CREATE ; oparms.fid = &fid; oparms.reconnect = false; + oparms.mode =0644 ; rc =SMB2_open (xid, &oparms, utf16_path, &oplock,NULL ,NULL ,NULL );
Greg Kroah-Hartman
maintainerPATCH 470/521 platform/x86: sony-laptop: Dont turn off 0x153 keyboard backlight during probe
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit ad75bd85b1db69c97eefea07b375567821f6ef58 upstream.
The 0x153 version of the kbd backlight control SNC handle has no separate address to probe if the backlight is there.
This turns the probe call into a set keyboard backlight call with a value of 0 turning off the keyboard backlight.
Skip probing when there is no separate probe address to avoid this.
--- drivers/platform/x86/sony-laptop.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/platform/x86/sony-laptop.c +14 -7
@@ -1913,14 +1913,21 @@ static int sony_nc_kbd_backlight_setup(sbreak ; } - ret =sony_call_snc_handle (handle, probe_base, &result); -if (ret) -return ret; +/* +* Only probe if there is a separate probe_base, otherwise the probe call +* is equivalent to __sony_nc_kbd_backlight_mode_set(0), resulting in +* the keyboard backlight being turned off. +*/ +if (probe_base) { + ret =sony_call_snc_handle (handle, probe_base, &result); +if (ret) +return ret; -if ((handle ==0x0137 && !(result &0x02 )) || - !(result &0x01 )) { -dprintk ("no backlight keyboard found\n" ); -return 0 ; +if ((handle ==0x0137 && !(result &0x02 )) || + !(result &0x01 )) { +dprintk ("no backlight keyboard found\n" ); +return 0 ; + } } kbdbl_ctl =kzalloc (sizeof (*kbdbl_ctl),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 471/521 ipv6: raw: Deduct extension header length in rawv6_push_pending_frames
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
commit cb3e9864cdbe35ff6378966660edbcbac955fe17 upstream.
The total cork length created by ip6_append_data includes extension headers, so we must exclude them when comparing them against the IPV6_CHECKSUM offset which does not include extension headers.
--- net/ipv6/raw.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv6/raw.c +4 -0
@@ -544,6 +544,7 @@ csum_copy_err:static int rawv6_push_pending_frames (struct sock *sk,struct flowi6 *fl6,struct raw6_sock *rp) { +struct ipv6_txoptions *opt;struct sk_buff *skb;int err =0 ;int offset;
@@ -561,6 +562,9 @@ static int rawv6_push_pending_frames(str offset = rp->offset; total_len =inet_sk (sk)->cork.base.length; + opt =inet6_sk (sk)->cork.opt; + total_len -= opt ? opt->opt_flen :0 ; +if (offset >= total_len -1 ) { err = -EINVAL ;ip6_flush_pending_frames (sk);
Greg Kroah-Hartman
maintainerPATCH 472/521 wifi: wilc1000: sdio: fix module autoloading
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 57d545b5a3d6ce3a8fb6b093f02bfcbb908973f3 ]
There are no SDIO module aliases included in the driver, therefore, module autoloading isn't working. Add the proper MODULE_DEVICE_TABLE().
--- drivers/staging/wilc1000/wilc_sdio.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/wilc1000/wilc_sdio.c +1 -0
@@ -18,6 +18,7 @@ static const struct sdio_device_id wilc_sdio_ids[] = { { SDIO_DEVICE(SDIO_VENDOR_ID_WILC, SDIO_DEVICE_ID_WILC) }, { }, }; +MODULE_DEVICE_TABLE (sdio, wilc_sdio_ids);#define WILC_SDIO_BLOCK_SIZE 512
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 473/521 ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
[ Upstream commit 56275036d8185f92eceac7479d48b858ee3dab84 ]
When HDMI PCM devices are opened in a specific order, with at least one HDMI/DP receiver connected, ALSA PCM open fails to -EBUSY on the connected monitor, on recent Intel platforms (ICL/JSL and newer). While this is not a typical sequence, at least Pulseaudio does this every time when it is started, to discover the available PCMs.
The rootcause is an invalid assumption in hdmi_add_pin(), where the total number of converters is assumed to be known at the time the function is called. On older Intel platforms this held true, but after ICL/JSL, the order how pins and converters are in the subnode list as returned by snd_hda_get_sub_nodes(), was changed. As a result, information for some converters was not stored to per_pin->mux_nids. And this means some pins cannot be connected to all converters, and application instead gets -EBUSY instead at open.
The assumption that converters are always before pins in the subnode list, is not really a valid one. Fix the problem in hdmi_parse_codec() by introducing separate loops for discovering converters and pins.
--- sound/pci/hda/patch_hdmi.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-)
sound/pci/hda/patch_hdmi.c +23 -13
@@ -1804,33 +1804,43 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)static int hdmi_parse_codec (struct hda_codec *codec) { -hda_nid_t nid; +hda_nid_t start_nid; +unsigned int caps;int i, nodes; - nodes =snd_hda_get_sub_nodes (codec, codec->core.afg, &nid); -if (!nid || nodes <0 ) { + nodes =snd_hda_get_sub_nodes (codec, codec->core.afg, &start_nid); +if (!start_nid || nodes <0 ) {codec_warn (codec,"HDMI: failed to get afg sub nodes\n" );return -EINVAL ; } -for (i =0 ; i < nodes; i++, nid++) { -unsigned int caps; -unsigned int type; +/* +* hdmi_add_pin() assumes total amount of converters to +* be known, so first discover all converters +*/ +for (i =0 ; i < nodes; i++) { +hda_nid_t nid = start_nid + i; caps =get_wcaps (codec, nid); - type =get_wcaps_type (caps);if (!(caps &AC_WCAP_DIGITAL ))continue ; -switch (type) { -case AC_WID_AUD_OUT : +if (get_wcaps_type (caps) ==AC_WID_AUD_OUT )hdmi_add_cvt (codec, nid); -break ; -case AC_WID_PIN : + } + +/* discover audio pins */ +for (i =0 ; i < nodes; i++) { +hda_nid_t nid = start_nid + i; + + caps =get_wcaps (codec, nid); + +if (!(caps &AC_WCAP_DIGITAL )) +continue ; + +if (get_wcaps_type (caps) ==AC_WID_PIN )hdmi_add_pin (codec, nid); -break ; - } }return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 474/521 Add Acer Aspire Ethos 8951G model quirk
In reply to Greg Kroah-HartmanFrom: Sergey Bostandzhyan <[email protected]>
[ Upstream commit 00066e9733f629e536f6b7957de2ce11a85fe15a ]
This notebook has 6 built in speakers for 5.1 surround support, however only two got autodetected and have also not been assigned correctly.
This patch enables all speakers and also fixes muting when headphones are plugged in.
The speaker layout is as follows:
pin 0x15 Front Left / Front Right
pin 0x18 Front Center / Subwoofer
pin 0x1b Rear Left / Rear Right (Surround)
The quirk will be enabled automatically on this hardware, but can also be activated manually via the model=aspire-ethos module parameter.
Caveat: pin 0x1b is shared between headphones jack and surround speakers. When headphones are plugged in, the surround speakers get muted automatically by the hardware, however all other speakers remain unmuted. Currently it's not possible to make use of the generic automute function in the driver, because such shared pins are not supported.
If we would change the pin settings to identify the pin as headphones, the surround channel and thus the ability to select 5.1 profiles would get lost.
This quirk solves the above problem by monitoring jack state of 0x1b and by connecting/disconnecting all remaining speaker pins when something gets plugged in or unplugged from the headphones jack port.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 71 +++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
sound/pci/hda/patch_realtek.c +71 -0
@@ -8510,6 +8510,45 @@ static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, } } +static void alc662_aspire_ethos_mute_speakers (struct hda_codec *codec, +struct hda_jack_callback *cb) +{ +/* surround speakers at 0x1b already get muted automatically when +* headphones are plugged in, but we have to mute/unmute the remaining +* channels manually: +* 0x15 - front left/front right +* 0x18 - front center/ LFE +*/ +if (snd_hda_jack_detect_state (codec,0x1b ) ==HDA_JACK_PRESENT ) { +snd_hda_set_pin_ctl_cache (codec,0x15 ,0 ); +snd_hda_set_pin_ctl_cache (codec,0x18 ,0 ); + }else { +snd_hda_set_pin_ctl_cache (codec,0x15 ,PIN_OUT ); +snd_hda_set_pin_ctl_cache (codec,0x18 ,PIN_OUT ); + } +} + +static void alc662_fixup_aspire_ethos_hp (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +/* Pin 0x1b: shared headphones jack and surround speakers */ +if (!is_jack_detectable (codec,0x1b )) +return ; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +snd_hda_jack_detect_enable_callback (codec,0x1b , + alc662_aspire_ethos_mute_speakers); +break ; +case HDA_FIXUP_ACT_INIT : +/* Make sure to start in a correct state, i.e. if +* headphones have been plugged in before powering up the system +*/ +alc662_aspire_ethos_mute_speakers (codec,NULL ); +break ; + } +} +static 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 ),
@@ -8581,6 +8620,9 @@ enum {ALC662_FIXUP_USI_FUNC ,ALC662_FIXUP_USI_HEADSET_MODE ,ALC662_FIXUP_LENOVO_MULTI_CODECS , +ALC669_FIXUP_ACER_ASPIRE_ETHOS , +ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER , + ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, }; static const struct hda_fixup alc662_fixups[] = {
@@ -8907,6 +8949,33 @@ static const struct hda_fixup alc662_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc233_alc662_fixup_lenovo_dual_codecs, }, + [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc662_fixup_aspire_ethos_hp, + }, + [ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER] = { + .type = HDA_FIXUP_VERBS, +/* subwoofer needs an extra GPIO setting to become audible */ + .v.verbs = (const struct hda_verb []) { + {0x01 ,AC_VERB_SET_GPIO_MASK ,0x02 }, + {0x01 ,AC_VERB_SET_GPIO_DIRECTION ,0x02 }, + {0x01 ,AC_VERB_SET_GPIO_DATA ,0x00 }, + { } + }, + .chained = true, + .chain_id =ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET + }, + [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x15 ,0x92130110 },/* front speakers */ + {0x18 ,0x99130111 },/* center/subwoofer */ + {0x1b ,0x11130012 },/* surround plus jack for HP */ + { } + }, + .chained = true, + .chain_id =ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER + }, };static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -8952,6 +9021,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x19da ,0xa130 ,"Zotac Z68" ,ALC662_FIXUP_ZOTAC_Z68 ),SND_PCI_QUIRK (0x1b0a ,0x01b8 ,"ACER Veriton" ,ALC662_FIXUP_ACER_VERITON ),SND_PCI_QUIRK (0x1b35 ,0x2206 ,"CZC P10T" ,ALC662_FIXUP_CZC_P10T ), +SND_PCI_QUIRK (0x1025 ,0x0566 ,"Acer Aspire Ethos 8951G" ,ALC669_FIXUP_ACER_ASPIRE_ETHOS ), #if 0/* Below is a quirk table taken from the old code.
@@ -9044,6 +9114,7 @@ static const struct hda_model_fixup alc662_fixup_models[] = { {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"}, {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"}, {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"}, + {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"}, {} };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 475/521 ALSA: hda/realtek - More constifications
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 6b0f95c49d890440c01a759c767dfe40e2acdbf2 ]
Apply const prefix to each coef table array.
Just for minor optimization and no functional changes.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 118 +++++++++++++++++----------------- 1 file changed, 59 insertions(+), 59 deletions(-)
sound/pci/hda/patch_realtek.c +59 -59
@@ -956,7 +956,7 @@ struct alc_codec_rename_pci_table {const char *name; }; -static struct alc_codec_rename_table rename_tbl[] = { +static const struct alc_codec_rename_table rename_tbl[] = { {0x10ec0221 ,0xf00f ,0x1003 ,"ALC231" }, {0x10ec0269 ,0xfff0 ,0x3010 ,"ALC277" }, {0x10ec0269 ,0xf0f0 ,0x2010 ,"ALC259" },
@@ -977,7 +977,7 @@ static struct alc_codec_rename_table rename_tbl[] = { { }/* terminator */ }; -static struct alc_codec_rename_pci_table rename_pci_tbl[] = { +static const struct alc_codec_rename_pci_table rename_pci_tbl[] = { {0x10ec0280 ,0x1028 ,0 ,"ALC3220" }, {0x10ec0282 ,0x1028 ,0 ,"ALC3221" }, {0x10ec0283 ,0x1028 ,0 ,"ALC3223" },
@@ -3115,7 +3115,7 @@ static void alc269_shutup(struct hda_codec *codec)alc_shutup_pins (codec); } -static struct coef_fw alc282_coefs[] = { +static const struct coef_fw alc282_coefs[] = {WRITE_COEF (0x03 ,0x0002 ),/* Power Down Control */ UPDATE_COEF (0x05 ,0xff3f ,0x0700 ),/* FIFO and filter clock */ WRITE_COEF (0x07 ,0x0200 ),/* DMIC control */
@@ -3227,7 +3227,7 @@ static void alc282_shutup(struct hda_codec *codec)alc_write_coef_idx (codec,0x78 , coef78); } -static struct coef_fw alc283_coefs[] = { +static const struct coef_fw alc283_coefs[] = {WRITE_COEF (0x03 ,0x0002 ),/* Power Down Control */ UPDATE_COEF (0x05 ,0xff3f ,0x0700 ),/* FIFO and filter clock */ WRITE_COEF (0x07 ,0x0200 ),/* DMIC control */
@@ -4234,7 +4234,7 @@ static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, } } -static struct coef_fw alc225_pre_hsmode[] = { +static const struct coef_fw alc225_pre_hsmode[] = {UPDATE_COEF (0x4a ,1 <<8 ,0 ),UPDATE_COEFEX (0x57 ,0x05 ,1 <<14 ,0 ),UPDATE_COEF (0x63 ,3 <<14 ,3 <<14 ),
@@ -4247,7 +4247,7 @@ static struct coef_fw alc225_pre_hsmode[] = {static void alc_headset_mode_unplugged (struct hda_codec *codec) { -static struct coef_fw coef0255[] = { +static const struct coef_fw coef0255[] = {WRITE_COEF (0x1b ,0x0c0b ),/* LDO and MISC control */ WRITE_COEF (0x45 ,0xd089 ),/* UAJ function set to menual mode */ UPDATE_COEFEX (0x57 ,0x05 ,1 <<14 ,0 ),/* Direct Drive HP Amp control(Set to verb control)*/
@@ -4255,7 +4255,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */ {} }; -static struct coef_fw coef0256[] = { +static const struct coef_fw coef0256[] = {WRITE_COEF (0x1b ,0x0c4b ),/* LDO and MISC control */ WRITE_COEF (0x45 ,0xd089 ),/* UAJ function set to menual mode */ WRITE_COEF (0x06 ,0x6104 ),/* Set MIC2 Vref gate with HP */
@@ -4263,7 +4263,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ {} }; -static struct coef_fw coef0233[] = { +static const struct coef_fw coef0233[] = {WRITE_COEF (0x1b ,0x0c0b ),WRITE_COEF (0x45 ,0xc429 ),UPDATE_COEF (0x35 ,0x4000 ,0 ),
@@ -4273,7 +4273,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) WRITE_COEF(0x32, 0x42a3), {} }; -static struct coef_fw coef0288[] = { +static const struct coef_fw coef0288[] = {UPDATE_COEF (0x4f ,0xfcc0 ,0xc400 ),UPDATE_COEF (0x50 ,0x2000 ,0x2000 ),UPDATE_COEF (0x56 ,0x0006 ,0x0006 ),
@@ -4281,18 +4281,18 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) UPDATE_COEF(0x67, 0x2000, 0), {} }; -static struct coef_fw coef0298[] = { +static const struct coef_fw coef0298[] = {UPDATE_COEF (0x19 ,0x1300 ,0x0300 ), {} }; -static struct coef_fw coef0292[] = { +static const struct coef_fw coef0292[] = {WRITE_COEF (0x76 ,0x000e ),WRITE_COEF (0x6c ,0x2400 ),WRITE_COEF (0x18 ,0x7308 ),WRITE_COEF (0x6b ,0xc429 ), {} }; -static struct coef_fw coef0293[] = { +static const struct coef_fw coef0293[] = {UPDATE_COEF (0x10 ,7 <<8 ,6 <<8 ),/* SET Line1 JD to 0 */ UPDATE_COEFEX (0x57 ,0x05 ,1 <<15 |1 <<13 ,0x0 ),/* SET charge pump by verb */ UPDATE_COEFEX (0x57 ,0x03 ,1 <<10 ,1 <<10 ),/* SET EN_OSW to 1 */
@@ -4301,16 +4301,16 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ {} }; -static struct coef_fw coef0668[] = { +static const struct coef_fw coef0668[] = {WRITE_COEF (0x15 ,0x0d40 ),WRITE_COEF (0xb7 ,0x802b ), {} }; -static struct coef_fw coef0225[] = { +static const struct coef_fw coef0225[] = {UPDATE_COEF (0x63 ,3 <<14 ,0 ), {} }; -static struct coef_fw coef0274[] = { +static const struct coef_fw coef0274[] = {UPDATE_COEF (0x4a ,0x0100 ,0 ),UPDATE_COEFEX (0x57 ,0x05 ,0x4000 ,0 ),UPDATE_COEF (0x6b ,0xf000 ,0x5000 ),
@@ -4375,25 +4375,25 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)static void alc_headset_mode_mic_in (struct hda_codec *codec,hda_nid_t hp_pin,hda_nid_t mic_pin) { -static struct coef_fw coef0255[] = { +static const struct coef_fw coef0255[] = {WRITE_COEFEX (0x57 ,0x03 ,0x8aa6 ),WRITE_COEF (0x06 ,0x6100 ),/* Set MIC2 Vref gate to normal */ {} }; -static struct coef_fw coef0256[] = { +static const struct coef_fw coef0256[] = {UPDATE_COEFEX (0x57 ,0x05 ,1 <<14 ,1 <<14 ),/* Direct Drive HP Amp control(Set to verb control)*/ WRITE_COEFEX (0x57 ,0x03 ,0x09a3 ),WRITE_COEF (0x06 ,0x6100 ),/* Set MIC2 Vref gate to normal */ {} }; -static struct coef_fw coef0233[] = { +static const struct coef_fw coef0233[] = {UPDATE_COEF (0x35 ,0 ,1 <<14 ),WRITE_COEF (0x06 ,0x2100 ),WRITE_COEF (0x1a ,0x0021 ),WRITE_COEF (0x26 ,0x008c ), {} }; -static struct coef_fw coef0288[] = { +static const struct coef_fw coef0288[] = {UPDATE_COEF (0x4f ,0x00c0 ,0 ),UPDATE_COEF (0x50 ,0x2000 ,0 ),UPDATE_COEF (0x56 ,0x0006 ,0 ),
@@ -4402,30 +4402,30 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, UPDATE_COEF(0x67, 0x2000, 0x2000), {} }; -static struct coef_fw coef0292[] = { +static const struct coef_fw coef0292[] = {WRITE_COEF (0x19 ,0xa208 ),WRITE_COEF (0x2e ,0xacf0 ), {} }; -static struct coef_fw coef0293[] = { +static const struct coef_fw coef0293[] = {UPDATE_COEFEX (0x57 ,0x05 ,0 ,1 <<15 |1 <<13 ),/* SET charge pump by verb */ UPDATE_COEFEX (0x57 ,0x03 ,1 <<10 ,0 ),/* SET EN_OSW to 0 */ UPDATE_COEF (0x1a ,1 <<3 ,0 ),/* Combo JD gating without LINE1-VREFO */ {} }; -static struct coef_fw coef0688[] = { +static const struct coef_fw coef0688[] = {WRITE_COEF (0xb7 ,0x802b ),WRITE_COEF (0xb5 ,0x1040 ),UPDATE_COEF (0xc3 ,0 ,1 <<12 ), {} }; -static struct coef_fw coef0225[] = { +static const struct coef_fw coef0225[] = {UPDATE_COEFEX (0x57 ,0x05 ,1 <<14 ,1 <<14 ),UPDATE_COEF (0x4a ,3 <<4 ,2 <<4 ),UPDATE_COEF (0x63 ,3 <<14 ,0 ), {} }; -static struct coef_fw coef0274[] = { +static const struct coef_fw coef0274[] = {UPDATE_COEFEX (0x57 ,0x05 ,0x4000 ,0x4000 ),UPDATE_COEF (0x4a ,0x0010 ,0 ),UPDATE_COEF (0x6b ,0xf000 ,0 ),
@@ -4511,7 +4511,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,static void alc_headset_mode_default (struct hda_codec *codec) { -static struct coef_fw coef0225[] = { +static const struct coef_fw coef0225[] = {UPDATE_COEF (0x45 ,0x3f <<10 ,0x30 <<10 ),UPDATE_COEF (0x45 ,0x3f <<10 ,0x31 <<10 ),UPDATE_COEF (0x49 ,3 <<8 ,0 <<8 ),
@@ -4520,14 +4520,14 @@ static void alc_headset_mode_default(struct hda_codec *codec) UPDATE_COEF(0x67, 0xf000, 0x3000), {} }; -static struct coef_fw coef0255[] = { +static const struct coef_fw coef0255[] = {WRITE_COEF (0x45 ,0xc089 ),WRITE_COEF (0x45 ,0xc489 ),WRITE_COEFEX (0x57 ,0x03 ,0x8ea6 ),WRITE_COEF (0x49 ,0x0049 ), {} }; -static struct coef_fw coef0256[] = { +static const struct coef_fw coef0256[] = {WRITE_COEF (0x45 ,0xc489 ),WRITE_COEFEX (0x57 ,0x03 ,0x0da3 ),WRITE_COEF (0x49 ,0x0049 ),
@@ -4535,12 +4535,12 @@ static void alc_headset_mode_default(struct hda_codec *codec) WRITE_COEF(0x06, 0x6100), {} }; -static struct coef_fw coef0233[] = { +static const struct coef_fw coef0233[] = {WRITE_COEF (0x06 ,0x2100 ),WRITE_COEF (0x32 ,0x4ea3 ), {} }; -static struct coef_fw coef0288[] = { +static const struct coef_fw coef0288[] = {UPDATE_COEF (0x4f ,0xfcc0 ,0xc400 ),/* Set to TRS type */ UPDATE_COEF (0x50 ,0x2000 ,0x2000 ),UPDATE_COEF (0x56 ,0x0006 ,0x0006 ),
@@ -4548,26 +4548,26 @@ static void alc_headset_mode_default(struct hda_codec *codec) UPDATE_COEF(0x67, 0x2000, 0), {} }; -static struct coef_fw coef0292[] = { +static const struct coef_fw coef0292[] = {WRITE_COEF (0x76 ,0x000e ),WRITE_COEF (0x6c ,0x2400 ),WRITE_COEF (0x6b ,0xc429 ),WRITE_COEF (0x18 ,0x7308 ), {} }; -static struct coef_fw coef0293[] = { +static const struct coef_fw coef0293[] = {UPDATE_COEF (0x4a ,0x000f ,0x000e ),/* Combo Jack auto detect */ WRITE_COEF (0x45 ,0xC429 ),/* Set to TRS type */ UPDATE_COEF (0x1a ,1 <<3 ,0 ),/* Combo JD gating without LINE1-VREFO */ {} }; -static struct coef_fw coef0688[] = { +static const struct coef_fw coef0688[] = {WRITE_COEF (0x11 ,0x0041 ),WRITE_COEF (0x15 ,0x0d40 ),WRITE_COEF (0xb7 ,0x802b ), {} }; -static struct coef_fw coef0274[] = { +static const struct coef_fw coef0274[] = {WRITE_COEF (0x45 ,0x4289 ),UPDATE_COEF (0x4a ,0x0010 ,0x0010 ),UPDATE_COEF (0x6b ,0x0f00 ,0 ),
@@ -4630,53 +4630,53 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) {int val; -static struct coef_fw coef0255[] = { +static const struct coef_fw coef0255[] = {WRITE_COEF (0x45 ,0xd489 ),/* Set to CTIA type */ WRITE_COEF (0x1b ,0x0c2b ),WRITE_COEFEX (0x57 ,0x03 ,0x8ea6 ), {} }; -static struct coef_fw coef0256[] = { +static const struct coef_fw coef0256[] = {WRITE_COEF (0x45 ,0xd489 ),/* Set to CTIA type */ WRITE_COEF (0x1b ,0x0e6b ), {} }; -static struct coef_fw coef0233[] = { +static const struct coef_fw coef0233[] = {WRITE_COEF (0x45 ,0xd429 ),WRITE_COEF (0x1b ,0x0c2b ),WRITE_COEF (0x32 ,0x4ea3 ), {} }; -static struct coef_fw coef0288[] = { +static const struct coef_fw coef0288[] = {UPDATE_COEF (0x50 ,0x2000 ,0x2000 ),UPDATE_COEF (0x56 ,0x0006 ,0x0006 ),UPDATE_COEF (0x66 ,0x0008 ,0 ),UPDATE_COEF (0x67 ,0x2000 ,0 ), {} }; -static struct coef_fw coef0292[] = { +static const struct coef_fw coef0292[] = {WRITE_COEF (0x6b ,0xd429 ),WRITE_COEF (0x76 ,0x0008 ),WRITE_COEF (0x18 ,0x7388 ), {} }; -static struct coef_fw coef0293[] = { +static const struct coef_fw coef0293[] = {WRITE_COEF (0x45 ,0xd429 ),/* Set to ctia type */ UPDATE_COEF (0x10 ,7 <<8 ,7 <<8 ),/* SET Line1 JD to 1 */ {} }; -static struct coef_fw coef0688[] = { +static const struct coef_fw coef0688[] = {WRITE_COEF (0x11 ,0x0001 ),WRITE_COEF (0x15 ,0x0d60 ),WRITE_COEF (0xc3 ,0x0000 ), {} }; -static struct coef_fw coef0225_1[] = { +static const struct coef_fw coef0225_1[] = {UPDATE_COEF (0x45 ,0x3f <<10 ,0x35 <<10 ),UPDATE_COEF (0x63 ,3 <<14 ,2 <<14 ), {} }; -static struct coef_fw coef0225_2[] = { +static const struct coef_fw coef0225_2[] = {UPDATE_COEF (0x45 ,0x3f <<10 ,0x35 <<10 ),UPDATE_COEF (0x63 ,3 <<14 ,1 <<14 ), {}
@@ -4748,48 +4748,48 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)/* Nokia type */ static void alc_headset_mode_omtp (struct hda_codec *codec) { -static struct coef_fw coef0255[] = { +static const struct coef_fw coef0255[] = {WRITE_COEF (0x45 ,0xe489 ),/* Set to OMTP Type */ WRITE_COEF (0x1b ,0x0c2b ),WRITE_COEFEX (0x57 ,0x03 ,0x8ea6 ), {} }; -static struct coef_fw coef0256[] = { +static const struct coef_fw coef0256[] = {WRITE_COEF (0x45 ,0xe489 ),/* Set to OMTP Type */ WRITE_COEF (0x1b ,0x0e6b ), {} }; -static struct coef_fw coef0233[] = { +static const struct coef_fw coef0233[] = {WRITE_COEF (0x45 ,0xe429 ),WRITE_COEF (0x1b ,0x0c2b ),WRITE_COEF (0x32 ,0x4ea3 ), {} }; -static struct coef_fw coef0288[] = { +static const struct coef_fw coef0288[] = {UPDATE_COEF (0x50 ,0x2000 ,0x2000 ),UPDATE_COEF (0x56 ,0x0006 ,0x0006 ),UPDATE_COEF (0x66 ,0x0008 ,0 ),UPDATE_COEF (0x67 ,0x2000 ,0 ), {} }; -static struct coef_fw coef0292[] = { +static const struct coef_fw coef0292[] = {WRITE_COEF (0x6b ,0xe429 ),WRITE_COEF (0x76 ,0x0008 ),WRITE_COEF (0x18 ,0x7388 ), {} }; -static struct coef_fw coef0293[] = { +static const struct coef_fw coef0293[] = {WRITE_COEF (0x45 ,0xe429 ),/* Set to omtp type */ UPDATE_COEF (0x10 ,7 <<8 ,7 <<8 ),/* SET Line1 JD to 1 */ {} }; -static struct coef_fw coef0688[] = { +static const struct coef_fw coef0688[] = {WRITE_COEF (0x11 ,0x0001 ),WRITE_COEF (0x15 ,0x0d50 ),WRITE_COEF (0xc3 ,0x0000 ), {} }; -static struct coef_fw coef0225[] = { +static const struct coef_fw coef0225[] = {UPDATE_COEF (0x45 ,0x3f <<10 ,0x39 <<10 ),UPDATE_COEF (0x63 ,3 <<14 ,2 <<14 ), {}
@@ -4849,17 +4849,17 @@ static void alc_determine_headset_type(struct hda_codec *codec)int val;bool is_ctia = false;struct alc_spec *spec = codec->spec; -static struct coef_fw coef0255[] = { +static const struct coef_fw coef0255[] = {WRITE_COEF (0x45 ,0xd089 ),/* combo jack auto switch control(Check type)*/ WRITE_COEF (0x49 ,0x0149 ),/* combo jack auto switch control(Vref conteol) */ {} }; -static struct coef_fw coef0288[] = { +static const struct coef_fw coef0288[] = {UPDATE_COEF (0x4f ,0xfcc0 ,0xd400 ),/* Check Type */ {} }; -static struct coef_fw coef0298[] = { +static const struct coef_fw coef0298[] = {UPDATE_COEF (0x50 ,0x2000 ,0x2000 ),UPDATE_COEF (0x56 ,0x0006 ,0x0006 ),UPDATE_COEF (0x66 ,0x0008 ,0 ),
@@ -4867,19 +4867,19 @@ static void alc_determine_headset_type(struct hda_codec *codec) UPDATE_COEF(0x19, 0x1300, 0x1300), {} }; -static struct coef_fw coef0293[] = { +static const struct coef_fw coef0293[] = {UPDATE_COEF (0x4a ,0x000f ,0x0008 ),/* Combo Jack auto detect */ WRITE_COEF (0x45 ,0xD429 ),/* Set to ctia type */ {} }; -static struct coef_fw coef0688[] = { +static const struct coef_fw coef0688[] = {WRITE_COEF (0x11 ,0x0001 ),WRITE_COEF (0xb7 ,0x802b ),WRITE_COEF (0x15 ,0x0d60 ),WRITE_COEF (0xc3 ,0x0c00 ), {} }; -static struct coef_fw coef0274[] = { +static const struct coef_fw coef0274[] = {UPDATE_COEF (0x4a ,0x0010 ,0 ),UPDATE_COEF (0x4a ,0x8000 ,0 ),WRITE_COEF (0x45 ,0xd289 ),
@@ -5164,7 +5164,7 @@ static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,static void alc255_set_default_jack_type (struct hda_codec *codec) {/* Set to iphone type */ -static struct coef_fw alc255fw[] = { +static const struct coef_fw alc255fw[] = {WRITE_COEF (0x1b ,0x880b ),WRITE_COEF (0x45 ,0xd089 ),WRITE_COEF (0x1b ,0x080b ),
@@ -5172,7 +5172,7 @@ static void alc255_set_default_jack_type(struct hda_codec *codec) WRITE_COEF(0x1b, 0x0c0b), {} }; -static struct coef_fw alc256fw[] = { +static const struct coef_fw alc256fw[] = {WRITE_COEF (0x1b ,0x884b ),WRITE_COEF (0x45 ,0xd089 ),WRITE_COEF (0x1b ,0x084b ),
@@ -8549,7 +8549,7 @@ static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, } } -static struct coef_fw alc668_coefs[] = { +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 ),WRITE_COEF (0x08 ,0x0031 ),WRITE_COEF (0x0a ,0x0060 ),WRITE_COEF (0x0b ,0x0 ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 476/521 ALSA: hda/realtek - Add Headset Mic supported for HP cPC
In reply to Greg Kroah-HartmanFrom: Kailang Yang <[email protected]>
[ Upstream commit 5af29028fd6db9438b5584ab7179710a0a22569d ]
HP ALC671 need to support Headset Mic.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
sound/pci/hda/patch_realtek.c +44 -0
@@ -8549,6 +8549,29 @@ static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, } } +static void alc671_fixup_hp_headset_mic2 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +static const struct hda_pintbl pincfgs[] = { + {0x19 ,0x02a11040 },/* use as headset mic, with its own jack detect */ + {0x1b ,0x0181304f }, + { } + }; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : + spec->gen.mixer_nid =0 ; + spec->parse_flags |=HDA_PINCFG_HEADSET_MIC ; +snd_hda_apply_pincfgs (codec, pincfgs); +break ; +case HDA_FIXUP_ACT_INIT : +alc_write_coef_idx (codec,0x19 ,0xa054 ); +break ; + } +} +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 ),
@@ -8623,6 +8646,7 @@ enum {ALC669_FIXUP_ACER_ASPIRE_ETHOS ,ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER ,ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET , + ALC671_FIXUP_HP_HEADSET_MIC2, }; static const struct hda_fixup alc662_fixups[] = {
@@ -8976,6 +9000,10 @@ static const struct hda_fixup alc662_fixups[] = { .chained = true, .chain_id =ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER }, + [ALC671_FIXUP_HP_HEADSET_MIC2] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc671_fixup_hp_headset_mic2, + }, };static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -9157,6 +9185,22 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { {0x12, 0x90a60130}, {0x14, 0x90170110}, {0x15, 0x0321101f}), +SND_HDA_PIN_QUIRK (0x10ec0671 ,0x103c ,"HP cPC" ,ALC671_FIXUP_HP_HEADSET_MIC2 , + {0x14, 0x01014010}, + {0x17, 0x90170150}, + {0x1b, 0x01813030}, + {0x21, 0x02211020}), +SND_HDA_PIN_QUIRK (0x10ec0671 ,0x103c ,"HP cPC" ,ALC671_FIXUP_HP_HEADSET_MIC2 , + {0x14, 0x01014010}, + {0x18, 0x01a19040}, + {0x1b, 0x01813030}, + {0x21, 0x02211020}), +SND_HDA_PIN_QUIRK (0x10ec0671 ,0x103c ,"HP cPC" ,ALC671_FIXUP_HP_HEADSET_MIC2 , + {0x14, 0x01014020}, + {0x17, 0x90170110}, + {0x18, 0x01a19050}, + {0x1b, 0x01813040}, + {0x21, 0x02211030}), {} };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 477/521 ALSA: hda/realtek - Enable headset mic of Acer X2660G with ALC662
In reply to Greg Kroah-HartmanFrom: Jian-Hong Pan <[email protected]>
[ Upstream commit d858c706bdca97698752bd26b60c21ec07ef04f2 ]
The Acer desktop X2660G with ALC662 can't detect the headset microphone until ALC662_FIXUP_ACER_X2660G_HEADSET_MODE quirk applied.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/pci/hda/patch_realtek.c +11 -0
@@ -8647,6 +8647,7 @@ enum {ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER ,ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET ,ALC671_FIXUP_HP_HEADSET_MIC2 , + ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, }; static const struct hda_fixup alc662_fixups[] = {
@@ -9004,6 +9005,15 @@ static const struct hda_fixup alc662_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc671_fixup_hp_headset_mic2, }, + [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x1a ,0x02a1113c },/* use as headset mic, without its own jack detect */ + { } + }, + .chained = true, + .chain_id =ALC662_FIXUP_USI_FUNC + }, };static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -9015,6 +9025,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1025 ,0x0349 ,"eMachines eM250" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x034a ,"Gateway LT27" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x038b ,"Acer Aspire 8943G" ,ALC662_FIXUP_ASPIRE ), +SND_PCI_QUIRK (0x1025 ,0x124e ,"Acer 2660G" ,ALC662_FIXUP_ACER_X2660G_HEADSET_MODE ),SND_PCI_QUIRK (0x1028 ,0x05d8 ,"Dell" ,ALC668_FIXUP_DELL_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x05db ,"Dell" ,ALC668_FIXUP_DELL_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 478/521 ALSA: hda/realtek - Enable the headset of Acer N50-600 with ALC662
In reply to Greg Kroah-HartmanFrom: Jian-Hong Pan <[email protected]>
[ Upstream commit a124458a127ccd7629e20cd7bae3e1f758ed32aa ]
A headset on the desktop like Acer N50-600 does not work, until quirk ALC662_FIXUP_ACER_NITRO_HEADSET_MODE is applied.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/pci/hda/patch_realtek.c +12 -0
@@ -8648,6 +8648,7 @@ enum {ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET ,ALC671_FIXUP_HP_HEADSET_MIC2 ,ALC662_FIXUP_ACER_X2660G_HEADSET_MODE , + ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, }; static const struct hda_fixup alc662_fixups[] = {
@@ -9014,6 +9015,16 @@ static const struct hda_fixup alc662_fixups[] = { .chained = true, .chain_id =ALC662_FIXUP_USI_FUNC }, + [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x1a ,0x01a11140 },/* use as headset mic, without its own jack detect */ + {0x1b ,0x0221144f }, + { } + }, + .chained = true, + .chain_id =ALC662_FIXUP_USI_FUNC + }, };static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -9025,6 +9036,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1025 ,0x0349 ,"eMachines eM250" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x034a ,"Gateway LT27" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x038b ,"Acer Aspire 8943G" ,ALC662_FIXUP_ASPIRE ), +SND_PCI_QUIRK (0x1025 ,0x123c ,"Acer Nitro N50-600" ,ALC662_FIXUP_ACER_NITRO_HEADSET_MODE ),SND_PCI_QUIRK (0x1025 ,0x124e ,"Acer 2660G" ,ALC662_FIXUP_ACER_X2660G_HEADSET_MODE ),SND_PCI_QUIRK (0x1028 ,0x05d8 ,"Dell" ,ALC668_FIXUP_DELL_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 479/521 ALSA: hda/realtek - The front Mic on a HP machine doesnt work
In reply to Greg Kroah-HartmanFrom: Jeremy Szu <[email protected]>
[ Upstream commit 148ebf548a1af366fc797fcc7d03f0bb92b12a79 ]
On a HP ZCentral, the front Mic could not be detected.
The codec of the HP ZCentrol is alc671 and it needs to override the pin configuration to enable the headset mic.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9049,6 +9049,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1028 ,0x0698 ,"Dell" ,ALC668_FIXUP_DELL_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x069f ,"Dell" ,ALC668_FIXUP_DELL_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x1632 ,"HP RP5800" ,ALC662_FIXUP_HP_RP5800 ), +SND_PCI_QUIRK (0x103c ,0x873e ,"HP" ,ALC671_FIXUP_HP_HEADSET_MIC2 ),SND_PCI_QUIRK (0x1043 ,0x1080 ,"Asus UX501VW" ,ALC668_FIXUP_HEADSET_MODE ),SND_PCI_QUIRK (0x1043 ,0x11cd ,"Asus N550" , ALC662_FIXUP_ASUS_Nx50), SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 480/521 ALSA: hda/realtek: Fix the mic type detection issue for ASUS G551JW
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
[ Upstream commit a3fd1a986e499a06ac5ef95c3a39aa4611e7444c ]
We need to define the codec pin 0x1b to be the mic, but somehow the mic doesn't support hot plugging detection, and Windows also has this issue, so we set it to phantom headset-mic.
Also the determine_headset_type() often returns the omtp type by a mistake when we plug a ctia headset, this makes the mic can't record sound at all. Because most of the headset are ctia type nowadays and some machines have the fixed ctia type audio jack, it is possible this machine has the fixed ctia jack too. Here we set this mic jack to fixed ctia type, this could avoid the mic type detection mistake and make the ctia headset work stable.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
sound/pci/hda/patch_realtek.c +27 -0
@@ -8649,6 +8649,9 @@ enum {ALC671_FIXUP_HP_HEADSET_MIC2 ,ALC662_FIXUP_ACER_X2660G_HEADSET_MODE ,ALC662_FIXUP_ACER_NITRO_HEADSET_MODE , +ALC668_FIXUP_ASUS_NO_HEADSET_MIC , +ALC668_FIXUP_HEADSET_MIC , + ALC668_FIXUP_MIC_DET_COEF, }; static const struct hda_fixup alc662_fixups[] = {
@@ -9025,6 +9028,29 @@ static const struct hda_fixup alc662_fixups[] = { .chained = true, .chain_id =ALC662_FIXUP_USI_FUNC }, + [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x1b ,0x04a1112c }, + { } + }, + .chained = true, + .chain_id =ALC668_FIXUP_HEADSET_MIC + }, + [ALC668_FIXUP_HEADSET_MIC] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc269_fixup_headset_mic, + .chained = true, + .chain_id =ALC668_FIXUP_MIC_DET_COEF + }, + [ALC668_FIXUP_MIC_DET_COEF] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb []) { + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x15 }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x0d60 }, + {} + }, + }, };static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -9059,6 +9085,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x15a7 ,"ASUS UX51VZH" ,ALC662_FIXUP_BASS_16 ),SND_PCI_QUIRK (0x1043 ,0x177d ,"ASUS N551" , ALC668_FIXUP_ASUS_Nx51),SND_PCI_QUIRK (0x1043 ,0x17bd ,"ASUS N751" , ALC668_FIXUP_ASUS_Nx51), +SND_PCI_QUIRK (0x1043 ,0x185d ,"ASUS G551JW" ,ALC668_FIXUP_ASUS_NO_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x1963 ,"ASUS X71SL" ,ALC662_FIXUP_ASUS_MODE8 ),SND_PCI_QUIRK (0x1043 ,0x1b73 ,"ASUS N55SF" ,ALC662_FIXUP_BASS_16 ), SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 481/521 ALSA: hda/realtek - Add headset Mic support for Lenovo ALC897 platform
In reply to Greg Kroah-HartmanFrom: Kailang Yang <[email protected]>
[ Upstream commit d7f32791a9fcf0dae8b073cdea9b79e29098c5f4 ]
Lenovo ALC897 platform had headset Mic.
This patch enable supported headset Mic.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
sound/pci/hda/patch_realtek.c +40 -0
@@ -8572,6 +8572,27 @@ static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, } } +static void alc897_hp_automute_hook (struct hda_codec *codec, +struct hda_jack_callback *jack) +{ +struct alc_spec *spec = codec->spec; +int vref; + +snd_hda_gen_hp_automute (codec, jack); + vref = spec->gen.hp_jack_present ? (PIN_HP |AC_PINCTL_VREF_100 ) :PIN_HP ; +snd_hda_codec_write (codec,0x1b ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL , + vref); +} + +static void alc897_fixup_lenovo_headset_mic (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->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 ),
@@ -8652,6 +8673,8 @@ enum {ALC668_FIXUP_ASUS_NO_HEADSET_MIC ,ALC668_FIXUP_HEADSET_MIC ,ALC668_FIXUP_MIC_DET_COEF , +ALC897_FIXUP_LENOVO_HEADSET_MIC , + ALC897_FIXUP_HEADSET_MIC_PIN, }; static const struct hda_fixup alc662_fixups[] = {
@@ -9051,6 +9074,19 @@ static const struct hda_fixup alc662_fixups[] = { {} }, }, + [ALC897_FIXUP_LENOVO_HEADSET_MIC ] = { + .type =HDA_FIXUP_FUNC , + .v.func = alc897_fixup_lenovo_headset_mic, + }, + [ALC897_FIXUP_HEADSET_MIC_PIN ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x1a ,0x03a11050 }, + { } + }, + .chained = true, + .chain_id =ALC897_FIXUP_LENOVO_HEADSET_MIC + }, };static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -9094,6 +9130,10 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x144d ,0xc051 ,"Samsung R720" ,ALC662_FIXUP_IDEAPAD ),SND_PCI_QUIRK (0x14cd ,0x5003 ,"USI" ,ALC662_FIXUP_USI_HEADSET_MODE ),SND_PCI_QUIRK (0x17aa ,0x1036 ,"Lenovo P520" ,ALC662_FIXUP_LENOVO_MULTI_CODECS ), +SND_PCI_QUIRK (0x17aa ,0x32ca ,"Lenovo ThinkCentre M80" ,ALC897_FIXUP_HEADSET_MIC_PIN ), +SND_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 ,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),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 482/521 ALSA: hda/realtek - ALC897 headset MIC no sound
In reply to Greg Kroah-HartmanFrom: Kailang Yang <[email protected]>
[ Upstream commit fe6900bd8156467365bd5b976df64928fdebfeb0 ]
There is not have Headset Mic verb table in BIOS default.
So, it will have recording issue from headset MIC.
Add the verb table value without jack detect. It will turn on Headset Mic.
Stable-dep-of: 4bf5bf54476d ("ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB")
--- sound/pci/hda/patch_realtek.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/pci/hda/patch_realtek.c +9 -0
@@ -8675,6 +8675,7 @@ enum {ALC668_FIXUP_MIC_DET_COEF ,ALC897_FIXUP_LENOVO_HEADSET_MIC ,ALC897_FIXUP_HEADSET_MIC_PIN , + ALC897_FIXUP_HP_HSMIC_VERB, }; static const struct hda_fixup alc662_fixups[] = {
@@ -9087,6 +9088,13 @@ static const struct hda_fixup alc662_fixups[] = { .chained = true, .chain_id =ALC897_FIXUP_LENOVO_HEADSET_MIC }, + [ALC897_FIXUP_HP_HSMIC_VERB] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x19 ,0x01a1913c },/* use as headset mic, without its own jack detect */ + { } + }, + }, };static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -9111,6 +9119,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1028 ,0x0698 ,"Dell" ,ALC668_FIXUP_DELL_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x069f ,"Dell" ,ALC668_FIXUP_DELL_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x1632 ,"HP RP5800" ,ALC662_FIXUP_HP_RP5800 ), +SND_PCI_QUIRK (0x103c ,0x8719 ,"HP" ,ALC897_FIXUP_HP_HSMIC_VERB ),SND_PCI_QUIRK (0x103c ,0x873e ,"HP" ,ALC671_FIXUP_HP_HEADSET_MIC2 ),SND_PCI_QUIRK (0x1043 ,0x1080 ,"Asus UX501VW" ,ALC668_FIXUP_HEADSET_MODE ), SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 483/521 ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB
In reply to Greg Kroah-HartmanFrom: Edward Pacman <[email protected]>
[ Upstream commit 4bf5bf54476dffe60e6b6d8d539f67309ff599e2 ]
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
@@ -8593,6 +8593,17 @@ static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, } } +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 ),
@@ -8676,6 +8687,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[] = {
@@ -9095,6 +9108,19 @@ static const struct hda_fixup alc662_fixups[] = { { } }, }, + [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[] = {
@@ -9143,6 +9169,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_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),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 484/521 ktest: Add support for meta characters in GRUB_MENU
In reply to Greg Kroah-HartmanFrom: Masayoshi Mizuma <[email protected]>
[ Upstream commit 68911069f509ba3bf0f513d9af00309e07932906 ]
ktest fails if meta characters are in GRUB_MENU, for example GRUB_MENU = 'Fedora (test)'
The failure happens because the meta characters are not escaped, so the menu doesn't match in any entries in GRUB_FILE.
Use quotemeta() to escape the meta characters.
Stable-dep-of: 26df05a8c142 ("kest.pl: Fix grub2 menu handling for rebooting")
--- tools/testing/ktest/ktest.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/ktest/ktest.pl +4 -2
@@ -1866,9 +1866,10 @@ sub get_grub2_index { or dodie "unable to get $grub_file"; my $found = 0; + my $grub_menu_qt = quotemeta($grub_menu); while (<IN>) { - if (/^menuentry.*$grub_menu/) { + if (/^menuentry.*$grub_menu_qt/) { $grub_number++; $found = 1; last;
@@ -1909,9 +1910,10 @@ sub get_grub_index { or dodie "unable to get menu.lst"; my $found = 0; + my $grub_menu_qt = quotemeta($grub_menu); while (<IN>) { - if (/^\s*title\s+$grub_menu\s*$/) { + if (/^\s*title\s+$grub_menu_qt\s*$/) { $grub_number++; $found = 1; last;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 485/521 ktest: introduce _get_grub_index
In reply to Greg Kroah-HartmanFrom: Masayoshi Mizuma <[email protected]>
[ Upstream commit f824b6866835bc5051c44ffd289134974f214e98 ]
Introduce _get_grub_index() to deal with Boot Loader Specification (BLS) and cleanup.
Stable-dep-of: 26df05a8c142 ("kest.pl: Fix grub2 menu handling for rebooting")
--- tools/testing/ktest/ktest.pl | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
tools/testing/ktest/ktest.pl +37 -0
@@ -1850,6 +1850,43 @@ sub run_scp_mod { return run_scp($src, $dst, $cp_scp); } +sub _get_grub_index { + + my ($command, $target, $skip) = @_; + + return if (defined($grub_number) && defined($last_grub_menu) && + $last_grub_menu eq $grub_menu && defined($last_machine) && + $last_machine eq $machine); + + doprint "Find $reboot_type menu ... "; + $grub_number = -1; + + my $ssh_grub = $ssh_exec; + $ssh_grub =~ s,\$SSH_COMMAND,$command,g; + + open(IN, "$ssh_grub |") + or dodie "unable to execute $command"; + + my $found = 0; + + while (<IN>) { + if (/$target/) { + $grub_number++; + $found = 1; + last; + } elsif (/$skip/) { + $grub_number++; + } + } + close(IN); + + dodie "Could not find '$grub_menu' through $command on $machine" + if (!$found); + doprint "$grub_number\n"; + $last_grub_menu = $grub_menu; + $last_machine = $machine; +} + sub get_grub2_index { return if (defined($grub_number) && defined($last_grub_menu) &&
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 486/521 ktest: cleanup get_grub_index
In reply to Greg Kroah-HartmanFrom: Masayoshi Mizuma <[email protected]>
[ Upstream commit 38891392916c42d4ba46f474d553c76d1ed329ca ]
Cleanup get_grub_index().
Stable-dep-of: 26df05a8c142 ("kest.pl: Fix grub2 menu handling for rebooting")
--- tools/testing/ktest/ktest.pl | 50 ++++++++++++------------------------ 1 file changed, 17 insertions(+), 33 deletions(-)
tools/testing/ktest/ktest.pl +17 -33
@@ -1925,46 +1925,30 @@ sub get_grub2_index { sub get_grub_index { - if ($reboot_type eq "grub2") { - get_grub2_index; - return; - } + my $command; + my $target; + my $skip; + my $grub_menu_qt; - if ($reboot_type ne "grub") { + if ($reboot_type !~ /^grub/) { return; } - return if (defined($grub_number) && defined($last_grub_menu) && - $last_grub_menu eq $grub_menu && defined($last_machine) && - $last_machine eq $machine); - - doprint "Find grub menu ... "; - $grub_number = -1; - my $ssh_grub = $ssh_exec; - $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g; - - open(IN, "$ssh_grub |") - or dodie "unable to get menu.lst"; + $grub_menu_qt = quotemeta($grub_menu); - my $found = 0; - my $grub_menu_qt = quotemeta($grub_menu); - - while (<IN>) { - if (/^\s*title\s+$grub_menu_qt\s*$/) { - $grub_number++; - $found = 1; - last; - } elsif (/^\s*title\s/) { - $grub_number++; - } + if ($reboot_type eq "grub") { + $command = "cat /boot/grub/menu.lst"; + $target = '^\s*title\s+' . $grub_menu_qt . '\s*$'; + $skip = '^\s*title\s'; + } elsif ($reboot_type eq "grub2") { + $command = "cat $grub_file"; + $target = '^menuentry.*' . $grub_menu_qt; + $skip = '^menuentry\s|^submenu\s'; + } else { + return; } - close(IN); - dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine" - if (!$found); - doprint "$grub_number\n"; - $last_grub_menu = $grub_menu; - $last_machine = $machine; + _get_grub_index($command, $target, $skip); } sub wait_for_input
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 487/521 ktest: introduce grub2bls REBOOT_TYPE option
In reply to Greg Kroah-HartmanFrom: Masayoshi Mizuma <[email protected]>
[ Upstream commit ac2466456eaa0ff9b8cf647c4c52832024bc929f ]
Fedora 30 introduces Boot Loader Specification (BLS), it changes around grub entry configuration.
kernel entries aren't in grub.cfg. We can get the entries by "grubby --info=ALL" command.
Introduce grub2bls as REBOOT_TYPE option for BLS.
Stable-dep-of: 26df05a8c142 ("kest.pl: Fix grub2 menu handling for rebooting")
--- tools/testing/ktest/ktest.pl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
tools/testing/ktest/ktest.pl +15 -3
@@ -63,6 +63,7 @@ my %default = ( "STOP_TEST_AFTER" => 600, "MAX_MONITOR_WAIT" => 1800, "GRUB_REBOOT" => "grub2-reboot", + "GRUB_BLS_GET" => "grubby --info=ALL", "SYSLINUX" => "extlinux", "SYSLINUX_PATH" => "/boot/extlinux", "CONNECT_TIMEOUT" => 25,
@@ -123,6 +124,7 @@ my $last_grub_menu; my $grub_file; my $grub_number; my $grub_reboot; +my $grub_bls_get; my $syslinux; my $syslinux_path; my $syslinux_label;
@@ -292,6 +294,7 @@ my %option_map = ( "GRUB_MENU" => \$grub_menu, "GRUB_FILE" => \$grub_file, "GRUB_REBOOT" => \$grub_reboot, + "GRUB_BLS_GET" => \$grub_bls_get, "SYSLINUX" => \$syslinux, "SYSLINUX_PATH" => \$syslinux_path, "SYSLINUX_LABEL" => \$syslinux_label,
@@ -437,7 +440,7 @@ EOF ; $config_help{"REBOOT_TYPE"} = << "EOF" Way to reboot the box to the test kernel. - Only valid options so far are "grub", "grub2", "syslinux", and "script". + Only valid options so far are "grub", "grub2", "grub2bls", "syslinux", and "script". If you specify grub, it will assume grub version 1 and will search in /boot/grub/menu.lst for the title \$GRUB_MENU
@@ -451,6 +454,8 @@ $config_help{"REBOOT_TYPE"} = << "EOF" If you specify grub2, then you also need to specify both \$GRUB_MENU and \$GRUB_FILE. + If you specify grub2bls, then you also need to specify \$GRUB_MENU. + If you specify syslinux, then you may use SYSLINUX to define the syslinux command (defaults to extlinux), and SYSLINUX_PATH to specify the path to the syslinux install (defaults to /boot/extlinux). But you have to specify
@@ -476,6 +481,9 @@ $config_help{"GRUB_MENU"} = << "EOF" menu must be a non-nested menu. Add the quotes used in the menu to guarantee your selection, as the first menuentry with the content of \$GRUB_MENU that is found will be used. + + For grub2bls, \$GRUB_MENU is searched on the result of \$GRUB_BLS_GET + command for the lines that begin with "title". EOF ; $config_help{"GRUB_FILE"} = << "EOF"
@@ -692,7 +700,7 @@ sub get_mandatory_configs { } } - if ($rtype eq "grub") { + if (($rtype eq "grub") or ($rtype eq "grub2bls")) { get_mandatory_config("GRUB_MENU"); }
@@ -1944,6 +1952,10 @@ sub get_grub_index { $command = "cat $grub_file"; $target = '^menuentry.*' . $grub_menu_qt; $skip = '^menuentry\s|^submenu\s'; + } elsif ($reboot_type eq "grub2bls") { + $command = $grub_bls_get; + $target = '^title=.*' . $grub_menu_qt; + $skip = '^title='; } else { return; }
@@ -4307,7 +4319,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { if (!$buildonly) { $target = "$ssh_user\@$machine"; - if ($reboot_type eq "grub") { + if (($reboot_type eq "grub") or ($reboot_type eq "grub2bls")) { dodie "GRUB_MENU not defined" if (!defined($grub_menu)); } elsif ($reboot_type eq "grub2") { dodie "GRUB_MENU not defined" if (!defined($grub_menu));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 488/521 ktest.pl: Fix incorrect reboot for grub2bls
In reply to Greg Kroah-HartmanFrom: Libo Chen <[email protected]>
[ Upstream commit 271e0c9dce1b02a825b3cc1a7aa1fab7c381d44b ]
This issue was first noticed when I was testing different kernels on Oracle Linux 8 which as Fedora 30+ adopts BLS as default. Even though a kernel entry was added successfully and the index of that kernel entry was retrieved correctly, ktest still wouldn't reboot the system into user-specified kernel.
The bug was spotted in subroutine reboot_to where the if-statement never checks for REBOOT_TYPE "grub2bls", therefore the desired entry will not be set for the next boot.
Add a check for "grub2bls" so that $grub_reboot $grub_number can be run before a reboot if REBOOT_TYPE is "grub2bls" then we can boot to the correct kernel.
Stable-dep-of: 26df05a8c142 ("kest.pl: Fix grub2 menu handling for rebooting")
--- tools/testing/ktest/ktest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/ktest/ktest.pl +1 -1
@@ -2023,7 +2023,7 @@ sub reboot_to { if ($reboot_type eq "grub") { run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'"; - } elsif ($reboot_type eq "grub2") { + } elsif (($reboot_type eq "grub2") or ($reboot_type eq "grub2bls")) { run_ssh "$grub_reboot $grub_number"; } elsif ($reboot_type eq "syslinux") { run_ssh "$syslinux --once \\\"$syslinux_label\\\" $syslinux_path";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 489/521 kest.pl: Fix grub2 menu handling for rebooting
In reply to Greg Kroah-HartmanFrom: Steven Rostedt <[email protected]>
[ Upstream commit 26df05a8c1420ad3de314fdd407e7fc2058cc7aa ]
grub2 has submenus where to use grub-reboot, it requires:
grub-reboot X>Y
where X is the main index and Y is the submenu. Thus if you have:
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux ...
[...]
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option ...
menuentry 'Debian GNU/Linux, with Linux 6.0.0-4-amd64' --class debian --class gnu-linux ...
[...]
}
menuentry 'Debian GNU/Linux, with Linux 6.0.0-4-amd64 (recovery mode)' --class debian --class gnu-linux ...
[...]
}
menuentry 'Debian GNU/Linux, with Linux test' --class debian --class gnu-linux ...
[...]
}And wanted to boot to the "Linux test" kernel, you need to run:
# grub-reboot 1>2
As 1 is the second top menu (the submenu) and 2 is the third of the sub menu entries.
Have the grub.cfg parsing for grub2 handle such cases.
--- tools/testing/ktest/ktest.pl | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
tools/testing/ktest/ktest.pl +15 -5
@@ -1860,7 +1860,7 @@ sub run_scp_mod { sub _get_grub_index { - my ($command, $target, $skip) = @_; + my ($command, $target, $skip, $submenu) = @_; return if (defined($grub_number) && defined($last_grub_menu) && $last_grub_menu eq $grub_menu && defined($last_machine) &&
@@ -1877,11 +1877,16 @@ sub _get_grub_index { my $found = 0; + my $submenu_number = 0; + while (<IN>) { if (/$target/) { $grub_number++; $found = 1; last; + } elsif (defined($submenu) && /$submenu/) { + $submenu_number++; + $grub_number = -1; } elsif (/$skip/) { $grub_number++; }
@@ -1890,6 +1895,9 @@ sub _get_grub_index { dodie "Could not find '$grub_menu' through $command on $machine" if (!$found); + if ($submenu_number > 0) { + $grub_number = "$submenu_number>$grub_number"; + } doprint "$grub_number\n"; $last_grub_menu = $grub_menu; $last_machine = $machine;
@@ -1936,6 +1944,7 @@ sub get_grub_index { my $command; my $target; my $skip; + my $submenu; my $grub_menu_qt; if ($reboot_type !~ /^grub/) {
@@ -1950,8 +1959,9 @@ sub get_grub_index { $skip = '^\s*title\s'; } elsif ($reboot_type eq "grub2") { $command = "cat $grub_file"; - $target = '^menuentry.*' . $grub_menu_qt; - $skip = '^menuentry\s|^submenu\s'; + $target = '^\s*menuentry.*' . $grub_menu_qt; + $skip = '^\s*menuentry'; + $submenu = '^\s*submenu\s'; } elsif ($reboot_type eq "grub2bls") { $command = $grub_bls_get; $target = '^title=.*' . $grub_menu_qt;
@@ -1960,7 +1970,7 @@ sub get_grub_index { return; } - _get_grub_index($command, $target, $skip); + _get_grub_index($command, $target, $skip, $submenu); } sub wait_for_input
@@ -2024,7 +2034,7 @@ sub reboot_to { if ($reboot_type eq "grub") { run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'"; } elsif (($reboot_type eq "grub2") or ($reboot_type eq "grub2bls")) { - run_ssh "$grub_reboot $grub_number"; + run_ssh "$grub_reboot \"'$grub_number'\""; } elsif ($reboot_type eq "syslinux") { run_ssh "$syslinux --once \\\"$syslinux_label\\\" $syslinux_path"; } elsif (defined $reboot_script) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 490/521 usb: ulpi: defer ulpi_register on ulpi_read_id timeout
In reply to Greg Kroah-HartmanFrom: Ferry Toth <[email protected]>
[ Upstream commit 8a7b31d545d3a15f0e6f5984ae16f0ca4fd76aac ]
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() on the first test write failing with -ETIMEDOUT. Currently ulpi_read_id() expects to discover the phy via DT when the test write fails and returns 0 in that case, even if DT does not provide the phy. As a result usb probe completes without phy.
Make ulpi_read_id() return -ETIMEDOUT to its user if the first test write fails. The user should then handle it appropriately. A follow up patch will make dwc3_core_init() set -EPROBE_DEFER in this case and bail out.
--- drivers/usb/common/ulpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/common/ulpi.c +1 -1
@@ -207,7 +207,7 @@ static int ulpi_read_id(struct ulpi *ulpi)/* Test the interface */ ret =ulpi_write (ulpi,ULPI_SCRATCH ,0xaa );if (ret <0 ) - goto err; +return ret; ret =ulpi_read (ulpi,ULPI_SCRATCH );if (ret <0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 491/521 quota: Factor out setup of quota inode
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit c7d3d28360fdb3ed3a5aa0bab19315e0fdc994a1 ]
Factor out setting up of quota inode and eventual error cleanup from vfs_load_quota_inode(). This will simplify situation for filesystems that don't have any quota inodes.
Stable-dep-of: d32387748476 ("ext4: fix bug_on in __es_tree_search caused by bad quota inode")
--- fs/quota/dquot.c | 108 ++++++++++++++++++++++++--------------- include/linux/quotaops.h | 2 + 2 files changed, 69 insertions(+), 41 deletions(-)
fs/quota/dquot.c +67 -41
@@ -2298,28 +2298,60 @@ EXPORT_SYMBOL(dquot_quota_off);* Turn quotas on on a device */ -/* -* Helper function to turn quotas on when we already have the inode of -* quota file and no quota information is loaded. -*/ -static int vfs_load_quota_inode (struct inode *inode,int type,int format_id, +static int vfs_setup_quota_inode (struct inode *inode,int type) +{ +struct super_block *sb = inode->i_sb; +struct quota_info *dqopt =sb_dqopt (sb); + +if (!S_ISREG (inode->i_mode)) +return -EACCES ; +if (IS_RDONLY (inode)) +return -EROFS ; +if (sb_has_quota_loaded (sb, type)) +return -EBUSY ; + + dqopt->files[type] =igrab (inode); +if (!dqopt->files[type]) +return -EIO ; +if (!(dqopt->flags &DQUOT_QUOTA_SYS_FILE )) { +/* We don't want quota and atime on quota files (deadlocks +* possible) Also nobody should write to the file - we use +* special IO operations which ignore the immutable bit. */ +inode_lock (inode); + inode->i_flags |=S_NOQUOTA ; +inode_unlock (inode); +/* +* When S_NOQUOTA is set, remove dquot references as no more +* references can be added +*/ +__dquot_drop (inode); + } +return 0 ; +} + +static void vfs_cleanup_quota_inode (struct super_block *sb,int type) +{ +struct quota_info *dqopt =sb_dqopt (sb); +struct inode *inode = dqopt->files[type]; + +if (!(dqopt->flags &DQUOT_QUOTA_SYS_FILE )) { +inode_lock (inode); + inode->i_flags &= ~S_NOQUOTA ; +inode_unlock (inode); + } + dqopt->files[type] =NULL ; +iput (inode); +} + +int dquot_load_quota_sb (struct super_block *sb,int type,int format_id,unsigned int flags) {struct quota_format_type *fmt =find_quota_format (format_id); -struct super_block *sb = inode->i_sb;struct quota_info *dqopt =sb_dqopt (sb);int error;if (!fmt)return -ESRCH ; -if (!S_ISREG (inode->i_mode)) { - error = -EACCES ; - goto out_fmt; - } -if (IS_RDONLY (inode)) { - error = -EROFS ; - goto out_fmt; - }if (!sb->s_op->quota_write || !sb->s_op->quota_read || (type ==PRJQUOTA && sb->dq_op->get_projid ==NULL )) { error = -EINVAL ;
@@ -2351,27 +2383,9 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,invalidate_bdev (sb->s_bdev); } -if (!(dqopt->flags &DQUOT_QUOTA_SYS_FILE )) { -/* We don't want quota and atime on quota files (deadlocks -* possible) Also nobody should write to the file - we use -* special IO operations which ignore the immutable bit. */ -inode_lock (inode); - inode->i_flags |=S_NOQUOTA ; -inode_unlock (inode); -/* -* When S_NOQUOTA is set, remove dquot references as no more -* references can be added -*/ -__dquot_drop (inode); - } - - error = -EIO ; - dqopt->files[type] =igrab (inode); -if (!dqopt->files[type]) - goto out_file_flags; error = -EINVAL ;if (!fmt->qf_ops->check_quota_file (sb, type)) - goto out_file_init; + goto out_fmt; dqopt->ops[type] = fmt->qf_ops; dqopt->info[type].dqi_format = fmt;
@@ -2379,7 +2393,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,INIT_LIST_HEAD (&dqopt->info[type].dqi_dirty_list); error = dqopt->ops[type]->read_file_info (sb, type);if (error <0 ) - goto out_file_init; + goto out_fmt;if (dqopt->flags &DQUOT_QUOTA_SYS_FILE ) {spin_lock (&dq_data_lock); dqopt->info[type].dqi_flags |=DQF_SYS_FILE ;
@@ -2394,18 +2408,30 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,dquot_disable (sb, type, flags);return error; -out_file_init: - dqopt->files[type] =NULL ; -iput (inode); -out_file_flags: -inode_lock (inode); - inode->i_flags &= ~S_NOQUOTA ; -inode_unlock (inode); out_fmt:put_quota_format (fmt);return error; } +EXPORT_SYMBOL (dquot_load_quota_sb); + +/* +* Helper function to turn quotas on when we already have the inode of +* quota file and no quota information is loaded. +*/ +static int vfs_load_quota_inode (struct inode *inode,int type,int format_id, +unsigned int flags) +{ +int err; + + err =vfs_setup_quota_inode (inode, type); +if (err <0 ) +return err; + err =dquot_load_quota_sb (inode->i_sb, type, format_id, flags); +if (err <0 ) +vfs_cleanup_quota_inode (inode->i_sb, type); +return err; +}/* Reenable quotas on remount RW */ int dquot_resume (struct super_block *sb,int type)
include/linux/quotaops.h +2 -0
@@ -99,6 +99,8 @@ int dquot_file_open(struct inode *inode, struct file *file);int dquot_enable (struct inode *inode,int type,int format_id,unsigned int flags); +int dquot_load_quota_sb (struct super_block *sb,int type,int format_id, +unsigned int flags);int dquot_quota_on (struct super_block *sb,int type,int format_id,const struct path *path); int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 492/521 ext4: fix bug_on in __es_tree_search caused by bad quota inode
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
[ Upstream commit d323877484765aaacbb2769b06e355c2041ed115 ]
We got a issue as fllows:
==================================================================
kernel BUG at fs/ext4/extents_status.c:202!
invalid opcode: 0000 [#1] PREEMPT SMP
CPU: 1 PID: 810 Comm: mount Not tainted 6.1.0-rc1-next-g9631525255e3 #352 RIP: 0010:__es_tree_search.isra.0+0xb8/0xe0 RSP: 0018:ffffc90001227900 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 0000000077512a0f RCX: 0000000000000000 RDX: 0000000000000002 RSI: 0000000000002a10 RDI: ffff8881004cd0c8 RBP: ffff888177512ac8 R08: 47ffffffffffffff R09: 0000000000000001 R10: 0000000000000001 R11: 00000000000679af R12: 0000000000002a10 R13: ffff888177512d88 R14: 0000000077512a10 R15: 0000000000000000 FS: 00007f4bd76dbc40(0000)GS:ffff88842fd00000(0000)knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005653bf993cf8 CR3: 000000017bfdf000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ext4_es_cache_extent+0xe2/0x210 ext4_cache_extents+0xd2/0x110 ext4_find_extent+0x5d5/0x8c0 ext4_ext_map_blocks+0x9c/0x1d30 ext4_map_blocks+0x431/0xa50 ext4_getblk+0x82/0x340 ext4_bread+0x14/0x110 ext4_quota_read+0xf0/0x180 v2_read_header+0x24/0x90 v2_check_quota_file+0x2f/0xa0 dquot_load_quota_sb+0x26c/0x760 dquot_load_quota_inode+0xa5/0x190 ext4_enable_quotas+0x14c/0x300 __ext4_fill_super+0x31cc/0x32c0 ext4_fill_super+0x115/0x2d0 get_tree_bdev+0x1d2/0x360 ext4_get_tree+0x19/0x30 vfs_get_tree+0x26/0xe0 path_mount+0x81d/0xfc0 do_mount+0x8d/0xc0 __x64_sys_mount+0xc0/0x160 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x63/0xcd </TASK> ==================================================================
Above issue may happen as follows:
-------------------------------------ext4_fill_super
ext4_orphan_cleanup
ext4_enable_quotas
ext4_quota_enable
ext4_iget --> get error inode <5>
ext4_ext_check_inode --> Wrong imode makes it escape inspection
make_bad_inode(inode) --> EXT4_BOOT_LOADER_INO set imode
dquot_load_quota_inode
vfs_setup_quota_inode --> check pass
dquot_load_quota_sb
v2_check_quota_file
v2_read_header
ext4_quota_read
ext4_bread
ext4_getblk
ext4_map_blocks
ext4_ext_map_blocks
ext4_find_extent
ext4_cache_extents
ext4_es_cache_extent
__es_tree_search.isra.0
ext4_es_end --> Wrong extents trigger BUG_ONIn the above issue, s_usr_quota_inum is set to 5, but inode<5> contains incorrect imode and disordered extents. Because 5 is EXT4_BOOT_LOADER_INO, the ext4_ext_check_inode check in the ext4_iget function can be bypassed, finally, the extents that are not checked trigger the BUG_ON in the __es_tree_search function. To solve this issue, check whether the inode is bad_inode in vfs_setup_quota_inode().
--- fs/quota/dquot.c | 2 ++ 1 file changed, 2 insertions(+)
fs/quota/dquot.c +2 -0
@@ -2303,6 +2303,8 @@ static int vfs_setup_quota_inode(struct inode *inode, int type)struct super_block *sb = inode->i_sb;struct quota_info *dqopt =sb_dqopt (sb); +if (is_bad_inode (inode)) +return -EUCLEAN ;if (!S_ISREG (inode->i_mode))return -EACCES ;if (IS_RDONLY (inode))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 493/521 ext4: lost matching-pair of trace in ext4_truncate
In reply to Greg Kroah-HartmanFrom: zhengliang <[email protected]>
[ Upstream commit 9a5d265fed014115f35e598022c956e5d2fb863e ]
It should call trace exit in all return path for ext4_truncate.
Stable-dep-of: a71248b1accb ("ext4: fix use-after-free in ext4_orphan_cleanup")
--- fs/ext4/inode.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
fs/ext4/inode.c +9 -8
@@ -4551,7 +4551,7 @@ int ext4_truncate(struct inode *inode)trace_ext4_truncate_enter (inode);if (!ext4_can_truncate (inode)) -return 0 ; + goto out_trace;ext4_clear_inode_flag (inode,EXT4_INODE_EOFBLOCKS );
@@ -4562,16 +4562,14 @@ int ext4_truncate(struct inode *inode)int has_inline =1 ; err =ext4_inline_data_truncate (inode, &has_inline); -if (err) -return err; -if (has_inline) -return 0 ; +if (err || has_inline) + goto out_trace; }/* If we zero-out tail of the page, we have to create jinode for jbd2 */ if (inode->i_size & (inode->i_sb->s_blocksize -1 )) {if (ext4_inode_attach_jinode (inode) <0 ) -return 0 ; + goto out_trace; }if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))
@@ -4580,8 +4578,10 @@ int ext4_truncate(struct inode *inode) credits =ext4_blocks_for_truncate (inode); handle =ext4_journal_start (inode,EXT4_HT_TRUNCATE , credits); -if (IS_ERR (handle)) -return PTR_ERR (handle); +if (IS_ERR (handle)) { + err =PTR_ERR (handle); + goto out_trace; + }if (inode->i_size & (inode->i_sb->s_blocksize -1 ))ext4_block_truncate_page (handle, mapping, inode->i_size);
@@ -4630,6 +4630,7 @@ int ext4_truncate(struct inode *inode)ext4_mark_inode_dirty (handle, inode);ext4_journal_stop (handle); +out_trace:trace_ext4_truncate_exit (inode);return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 494/521 ext4: fix use-after-free in ext4_orphan_cleanup
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
[ Upstream commit a71248b1accb2b42e4980afef4fa4a27fa0e36f5 ]
I caught a issue as follows:
==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0x28/0x1a0 Read of size 8 at addr ffff88814b13f378 by task mount/710 CPU: 1 PID: 710 Comm: mount Not tainted 6.1.0-rc3-next #370 Call Trace: <TASK> dump_stack_lvl+0x73/0x9f print_report+0x25d/0x759 kasan_report+0xc0/0x120 __asan_load8+0x99/0x140 __list_add_valid+0x28/0x1a0 ext4_orphan_cleanup+0x564/0x9d0 [ext4] __ext4_fill_super+0x48e2/0x5300 [ext4] ext4_fill_super+0x19f/0x3a0 [ext4] get_tree_bdev+0x27b/0x450 ext4_get_tree+0x19/0x30 [ext4] vfs_get_tree+0x49/0x150 path_mount+0xaae/0x1350 do_mount+0xe2/0x110 __x64_sys_mount+0xf0/0x190 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x63/0xcd </TASK> [...] ==================================================================
Above issue may happen as follows:
-------------------------------------ext4_fill_super
ext4_orphan_cleanup
--- loop1: assume last_orphan is 12 ---
list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan)
ext4_truncate --> return 0
ext4_inode_attach_jinode --> return -ENOMEM
iput(inode) --> free inode<12>
--- loop2: last_orphan is still 12 ---
list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
// use inode<12> and trigger UAFTo solve this issue, we need to propagate the return value of ext4_inode_attach_jinode() appropriately.
--- fs/ext4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/inode.c +2 -1
@@ -4568,7 +4568,8 @@ int ext4_truncate(struct inode *inode)/* If we zero-out tail of the page, we have to create jinode for jbd2 */ if (inode->i_size & (inode->i_sb->s_blocksize -1 )) { -if (ext4_inode_attach_jinode (inode) <0 ) + err =ext4_inode_attach_jinode (inode); +if (err) goto out_trace; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 495/521 ext4: fix uninititialized value in ext4_evict_inode
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit 7ea71af94eaaaf6d9aed24bc94a05b977a741cb9 ]
Syzbot found the following issue:
=====================================================
BUG: KMSAN: uninit-value in ext4_evict_inode+0xdd/0x26b0 fs/ext4/inode.c:180 ext4_evict_inode+0xdd/0x26b0 fs/ext4/inode.c:180 evict+0x365/0x9a0 fs/inode.c:664 iput_final fs/inode.c:1747 [inline] iput+0x985/0xdd0 fs/inode.c:1773 __ext4_new_inode+0xe54/0x7ec0 fs/ext4/ialloc.c:1361 ext4_mknod+0x376/0x840 fs/ext4/namei.c:2844 vfs_mknod+0x79d/0x830 fs/namei.c:3914 do_mknodat+0x47d/0xaa0 __do_sys_mknodat fs/namei.c:3992 [inline] __se_sys_mknodat fs/namei.c:3989 [inline] __ia32_sys_mknodat+0xeb/0x150 fs/namei.c:3989 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0xa2/0x100 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 do_SYSENTER_32+0x1b/0x20 arch/x86/entry/common.c:246 entry_SYSENTER_compat_after_hwframe+0x70/0x82
Uninit was created at:
__alloc_pages+0x9f1/0xe80 mm/page_alloc.c:5578 alloc_pages+0xaae/0xd80 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x1b5/0x1010 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0x10c3/0x2d60 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc_lru+0x6f3/0xb30 mm/slub.c:3429 alloc_inode_sb include/linux/fs.h:3117 [inline] ext4_alloc_inode+0x5f/0x860 fs/ext4/super.c:1321 alloc_inode+0x83/0x440 fs/inode.c:259 new_inode_pseudo fs/inode.c:1018 [inline] new_inode+0x3b/0x430 fs/inode.c:1046 __ext4_new_inode+0x2a7/0x7ec0 fs/ext4/ialloc.c:959 ext4_mkdir+0x4d5/0x1560 fs/ext4/namei.c:2992 vfs_mkdir+0x62a/0x870 fs/namei.c:4035 do_mkdirat+0x466/0x7b0 fs/namei.c:4060 __do_sys_mkdirat fs/namei.c:4075 [inline] __se_sys_mkdirat fs/namei.c:4073 [inline] __ia32_sys_mkdirat+0xc4/0x120 fs/namei.c:4073 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0xa2/0x100 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 do_SYSENTER_32+0x1b/0x20 arch/x86/entry/common.c:246 entry_SYSENTER_compat_after_hwframe+0x70/0x82 CPU: 1 PID: 4625 Comm: syz-executor.2 Not tainted 6.1.0-rc4-syzkaller-62821-gcb231e2f67ec #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 =====================================================
Now, 'ext4_alloc_inode()' didn't init 'ei->i_flags'. If new inode failed before set 'ei->i_flags' in '__ext4_new_inode()', then do 'iput()'. As after 6bc0d63dad7f commit will access 'ei->i_flags' in 'ext4_evict_inode()' which will lead to access uninit-value.
To solve above issue just init 'ei->i_flags' in 'ext4_alloc_inode()'.
--- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/super.c +1 -0
@@ -1081,6 +1081,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)return NULL ;inode_set_iversion (&ei->vfs_inode,1 ); + ei->i_flags =0 ;spin_lock_init (&ei->i_raw_lock);INIT_LIST_HEAD (&ei->i_prealloc_list);spin_lock_init (&ei->i_prealloc_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 496/521 ext4: generalize extents status tree search functions
In reply to Greg Kroah-HartmanFrom: Eric Whitney <[email protected]>
[ Upstream commit ad431025aecda85d3ebef5e4a3aca5c1c681d0c7 ]
Ext4 contains a few functions that are used to search for delayed extents or blocks in the extents status tree. Rather than duplicate code to add new functions to search for extents with different status values, such as written or a combination of delayed and unwritten, generalize the existing code to search for caller-specified extents status values. Also, move this code into extents_status.c where it is better associated with the data structures it operates upon, and where it can be more readily used to implement new extents status tree functions that might want a broader scope for i_es_lock.
Three missing static specifiers in RFC version of patch reported and fixed by Fengguang Wu <[email protected]>.
Stable-dep-of: 131294c35ed6 ("ext4: fix delayed allocation bug in ext4_clu_mapped for bigalloc + inline")
--- fs/ext4/ext4.h | 4 - fs/ext4/extents.c | 52 +++---------- fs/ext4/extents_status.c | 149 +++++++++++++++++++++++++++++++----- fs/ext4/extents_status.h | 13 +++- fs/ext4/inode.c | 17 ++-- include/trace/events/ext4.h | 4 +- 6 files changed, 165 insertions(+), 74 deletions(-)
fs/ext4/ext4.h +0 -4
@@ -3228,10 +3228,6 @@ extern struct ext4_ext_path *ext4_find_extent(struct inode *, ext4_lblk_t, int flags);extern void ext4_ext_drop_refs (struct ext4_ext_path *);extern int ext4_ext_check_inode (struct inode *inode); -extern int ext4_find_delalloc_range (struct inode *inode, -ext4_lblk_t lblk_start, -ext4_lblk_t lblk_end); -extern int ext4_find_delalloc_cluster (struct inode *inode,ext4_lblk_t lblk);extern ext4_lblk_t ext4_ext_next_allocated_block (struct ext4_ext_path *path);extern int ext4_fiemap (struct inode *inode,struct fiemap_extent_info *fieinfo,__u64 start,__u64 len);
fs/ext4/extents.c +12 -40
88 lines not on this page · raw message
fs/ext4/extents_status.c +131 -18
189 lines not on this page · raw message
fs/ext4/extents_status.h +10 -3
@@ -90,11 +90,18 @@ extern void ext4_es_cache_extent(struct inode *inode, ext4_lblk_t lblk, unsigned int status);extern int ext4_es_remove_extent (struct inode *inode,ext4_lblk_t lblk,ext4_lblk_t len); -extern void ext4_es_find_delayed_extent_range (struct inode *inode, -ext4_lblk_t lblk,ext4_lblk_t end, -struct extent_status *es); +extern void ext4_es_find_extent_range (struct inode *inode, +int (*match_fn)(struct extent_status *es), +ext4_lblk_t lblk,ext4_lblk_t end, +struct extent_status *es);extern int ext4_es_lookup_extent (struct inode *inode,ext4_lblk_t lblk,struct extent_status *es); +extern bool ext4_es_scan_range (struct inode *inode, +int (*matching_fn)(struct extent_status *es), +ext4_lblk_t lblk,ext4_lblk_t end); +extern bool ext4_es_scan_clu (struct inode *inode, +int (*matching_fn)(struct extent_status *es), +ext4_lblk_t lblk);static inline unsigned int ext4_es_status (struct extent_status *es) {
fs/ext4/inode.c +10 -7
@@ -600,8 +600,8 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, EXTENT_STATUS_UNWRITTEN :EXTENT_STATUS_WRITTEN ;if (!(flags &EXT4_GET_BLOCKS_DELALLOC_RESERVE ) && !(status &EXTENT_STATUS_WRITTEN ) && -ext4_find_delalloc_range (inode, map->m_lblk, - map->m_lblk + map->m_len -1 )) +ext4_es_scan_range (inode, &ext4_es_is_delayed, map->m_lblk, + map->m_lblk + map->m_len -1 )) status |=EXTENT_STATUS_DELAYED ; ret =ext4_es_insert_extent (inode, map->m_lblk, map->m_len, map->m_pblk, status);
@@ -724,8 +724,8 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, EXTENT_STATUS_UNWRITTEN :EXTENT_STATUS_WRITTEN ;if (!(flags &EXT4_GET_BLOCKS_DELALLOC_RESERVE ) && !(status &EXTENT_STATUS_WRITTEN ) && -ext4_find_delalloc_range (inode, map->m_lblk, - map->m_lblk + map->m_len -1 )) +ext4_es_scan_range (inode, &ext4_es_is_delayed, map->m_lblk, + map->m_lblk + map->m_len -1 )) status |=EXTENT_STATUS_DELAYED ; ret =ext4_es_insert_extent (inode, map->m_lblk, map->m_len, map->m_pblk, status);
@@ -1717,7 +1717,7 @@ static void ext4_da_page_release_reservation(struct page *page, lblk = (page->index << (PAGE_SHIFT - inode->i_blkbits)) + ((num_clusters -1 ) << sbi->s_cluster_bits);if (sbi->s_cluster_ratio ==1 || - !ext4_find_delalloc_cluster (inode, lblk)) + !ext4_es_scan_clu (inode, &ext4_es_is_delayed, lblk))ext4_da_release_space (inode,1 ); num_clusters--;
@@ -1902,6 +1902,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, add_delayed:if (retval ==0 ) {int ret; +/* * XXX: __block_prepare_write() unmaps passed block, * is it OK?
@@ -1912,7 +1913,8 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock,* to reserve metadata for every block we're going to write. */ if (EXT4_SB (inode->i_sb)->s_cluster_ratio ==1 || - !ext4_find_delalloc_cluster (inode, map->m_lblk)) { + !ext4_es_scan_clu (inode, + &ext4_es_is_delayed, map->m_lblk)) { ret =ext4_da_reserve_space (inode);if (ret) {/* not enough space to reserve */
@@ -3519,7 +3521,8 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,ext4_lblk_t end = map.m_lblk + map.m_len -1 ;struct extent_status es; -ext4_es_find_delayed_extent_range (inode, map.m_lblk, end, &es); +ext4_es_find_extent_range (inode, &ext4_es_is_delayed, + map.m_lblk, end, &es);if (!es.es_len || es.es_lblk > end) {/* entire range is a hole */
include/trace/events/ext4.h +2 -2
@@ -2290,7 +2290,7 @@ TRACE_EVENT(ext4_es_remove_extent, __entry->lblk, __entry->len) ); -TRACE_EVENT(ext4_es_find_delayed_extent_range_enter, +TRACE_EVENT(ext4_es_find_extent_range_enter, TP_PROTO(struct inode *inode, ext4_lblk_t lblk), TP_ARGS(inode, lblk),
@@ -2312,7 +2312,7 @@ TRACE_EVENT(ext4_es_find_delayed_extent_range_enter, (unsigned long) __entry->ino, __entry->lblk) ); -TRACE_EVENT(ext4_es_find_delayed_extent_range_exit, +TRACE_EVENT(ext4_es_find_extent_range_exit, TP_PROTO(struct inode *inode, struct extent_status *es), TP_ARGS(inode, es),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 497/521 ext4: add new pending reservation mechanism
In reply to Greg Kroah-HartmanFrom: Eric Whitney <[email protected]>
[ Upstream commit 1dc0aa46e74a3366e12f426b7caaca477853e9c3 ]
Add new pending reservation mechanism to help manage reserved cluster accounting. Its primary function is to avoid the need to read extents from the disk when invalidating pages as a result of a truncate, punch hole, or collapse range operation.
Stable-dep-of: 131294c35ed6 ("ext4: fix delayed allocation bug in ext4_clu_mapped for bigalloc + inline")
--- fs/ext4/ext4.h | 3 + fs/ext4/extents_status.c | 187 +++++++++++++++++++++++++++++++++++++++ fs/ext4/extents_status.h | 51 +++++++++++ fs/ext4/super.c | 8 ++ 4 files changed, 249 insertions(+)
fs/ext4/ext4.h +3 -0
@@ -1041,6 +1041,9 @@ struct ext4_inode_info {ext4_lblk_t i_da_metadata_calc_last_lblock;int i_da_metadata_calc_len; +/* pending cluster reservations for bigalloc file systems */ +struct ext4_pending_tree i_pending_tree; +/* on-disk additional length */ __u16 i_extra_isize;
fs/ext4/extents_status.c +187 -0
196 lines not on this page · raw message
fs/ext4/extents_status.h +51 -0
61 lines not on this page · raw message
fs/ext4/super.c +8 -0
@@ -1095,6 +1095,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) ei->i_da_metadata_calc_len =0 ; ei->i_da_metadata_calc_last_lblock =0 ;spin_lock_init (&(ei->i_block_reservation_lock)); +ext4_init_pending_tree (&ei->i_pending_tree);#ifdef CONFIG_QUOTA ei->i_reserved_quota =0 ;memset (&ei->i_dquot,0 ,sizeof (ei->i_dquot));
@@ -6189,6 +6190,10 @@ static int __init ext4_init_fs(void)if (err)return err; + err =ext4_init_pending (); +if (err) + goto out6; + err =ext4_init_pageio ();if (err) goto out5;
@@ -6227,6 +6232,8 @@ static int __init ext4_init_fs(void) out4:ext4_exit_pageio (); out5: +ext4_exit_pending (); +out6:ext4_exit_es ();return err;
@@ -6244,6 +6251,7 @@ static void __exit ext4_exit_fs(void)ext4_exit_system_zone ();ext4_exit_pageio ();ext4_exit_es (); +ext4_exit_pending (); }MODULE_AUTHOR ("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 498/521 ext4: fix reserved cluster accounting at delayed write time
In reply to Greg Kroah-HartmanFrom: Eric Whitney <[email protected]>
[ Upstream commit 0b02f4c0d6d9e2c611dfbdd4317193e9dca740e6 ]
The code in ext4_da_map_blocks sometimes reserves space for more delayed allocated clusters than it should, resulting in premature ENOSPC, exceeded quota, and inaccurate free space reporting.
Fix this by checking for written and unwritten blocks shared in the same cluster with the newly delayed allocated block. A cluster reservation should not be made for a cluster for which physical space has already been allocated.
Stable-dep-of: 131294c35ed6 ("ext4: fix delayed allocation bug in ext4_clu_mapped for bigalloc + inline")
--- fs/ext4/ext4.h | 1 + fs/ext4/extents.c | 79 +++++++++++++++++++++++++++++++++++++ fs/ext4/extents_status.c | 53 +++++++++++++++++++++++++ fs/ext4/extents_status.h | 12 ++++++ fs/ext4/inode.c | 79 ++++++++++++++++++++++++++++--------- include/trace/events/ext4.h | 35 ++++++++++++++++ 6 files changed, 241 insertions(+), 18 deletions(-)
fs/ext4/ext4.h +1 -0
@@ -3241,6 +3241,7 @@ extern int ext4_swap_extents(handle_t *handle, struct inode *inode1, struct inode *inode2, ext4_lblk_t lblk1, ext4_lblk_t lblk2, ext4_lblk_t count, int mark_unwritten,int *err); +extern int ext4_clu_mapped (struct inode *inode,ext4_lblk_t lclu);/* move_extent.c */ extern void ext4_double_down_write_data_sem(struct inode *first,
fs/ext4/extents.c +79 -0
82 lines not on this page · raw message
fs/ext4/extents_status.c +53 -0
56 lines not on this page · raw message
fs/ext4/extents_status.h +12 -0
@@ -178,6 +178,16 @@ static inline int ext4_es_is_hole(struct extent_status *es)return (ext4_es_type (es) &EXTENT_STATUS_HOLE ) !=0 ; } +static inline int ext4_es_is_mapped (struct extent_status *es) +{ +return (ext4_es_is_written (es) ||ext4_es_is_unwritten (es)); +} + +static inline int ext4_es_is_delonly (struct extent_status *es) +{ +return (ext4_es_is_delayed (es) && !ext4_es_is_unwritten (es)); +} +static inline void ext4_es_set_referenced (struct extent_status *es) { es->es_pblk |= ((ext4_fsblk_t )EXTENT_STATUS_REFERENCED ) <<ES_SHIFT ;
@@ -232,5 +242,7 @@ extern void ext4_exit_pending(void);extern void ext4_init_pending_tree (struct ext4_pending_tree *tree);extern void ext4_remove_pending (struct inode *inode,ext4_lblk_t lblk);extern bool ext4_is_pending (struct inode *inode,ext4_lblk_t lblk); +extern int ext4_es_insert_delayed_block (struct inode *inode,ext4_lblk_t lblk, +bool allocated);#endif /* _EXT4_EXTENTS_STATUS_H */
fs/ext4/inode.c +61 -18
92 lines not on this page · raw message
include/trace/events/ext4.h +35 -0
@@ -2532,6 +2532,41 @@ TRACE_EVENT(ext4_es_shrink, __entry->scan_time, __entry->nr_skipped, __entry->retried) ); +TRACE_EVENT (ext4_es_insert_delayed_block, + TP_PROTO(struct inode *inode, struct extent_status *es, + bool allocated), + +TP_ARGS (inode, es, allocated), + +TP_STRUCT__entry ( + __field( dev_t, dev ) + __field( ino_t, ino ) + __field( ext4_lblk_t, lblk ) + __field( ext4_lblk_t, len ) + __field( ext4_fsblk_t, pblk ) + __field( char, status ) +__field ( bool, allocated ) + ), + +TP_fast_assign ( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->lblk = es->es_lblk; + __entry->len = es->es_len; + __entry->pblk = ext4_es_pblock(es); + __entry->status = ext4_es_status(es); + __entry->allocated = allocated; + ), + +TP_printk ("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s " +"allocated %d" , +MAJOR (__entry->dev),MINOR (__entry->dev), + (unsigned long ) __entry->ino, + __entry->lblk, __entry->len, + __entry->pblk,show_extent_status (__entry->status), + __entry->allocated) +); +/* fsmap traces */ DECLARE_EVENT_CLASS(ext4_fsmap_class, TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 499/521 ext4: fix delayed allocation bug in ext4_clu_mapped for bigalloc + inline
In reply to Greg Kroah-HartmanFrom: Eric Whitney <[email protected]>
[ Upstream commit 131294c35ed6f777bd4e79d42af13b5c41bf2775 ]
When converting files with inline data to extents, delayed allocations made on a file system created with both the bigalloc and inline options can result in invalid extent status cache content, incorrect reserved cluster counts, kernel memory leaks, and potential kernel panics.
With bigalloc, the code that determines whether a block must be delayed allocated searches the extent tree to see if that block maps to a previously allocated cluster. If not, the block is delayed allocated, and otherwise, it isn't. However, if the inline option is also used, and if the file containing the block is marked as able to store data inline, there isn't a valid extent tree associated with the file. The current code in ext4_clu_mapped() calls ext4_find_extent() to search the non-existent tree for a previously allocated cluster anyway, which typically finds nothing, as desired. However, a side effect of the search can be to cache invalid content from the non-existent tree (garbage) in the extent status tree, including bogus entries in the pending reservation tree.
To fix this, avoid searching the extent tree when allocating blocks for bigalloc + inline files that are being converted from inline to extent mapped.
--- fs/ext4/extents.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ext4/extents.c +8 -0
@@ -5984,6 +5984,14 @@ int ext4_clu_mapped(struct inode *inode, ext4_lblk_t lclu)struct ext4_extent *extent;ext4_lblk_t first_lblk, first_lclu, last_lclu; +/* +* if data can be stored inline, the logical cluster isn't +* mapped - no physical clusters have been allocated, and the +* file has no extents +*/ +if (ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA )) +return 0 ; +/* search for the extent closest to the first block in the cluster */ path =ext4_find_extent (inode,EXT4_C2B (sbi, lclu),NULL ,0 );if (IS_ERR (path)) {
Signature · 1 line
2.35.1
Re: [PATCH 4.19 499/521] ext4: fix delayed allocation bug in ext4_clu_mapped for bigalloc + inline
Hi:
I recommend not backporting this patch or the other three patches apparently intended to support it to 4.19 stable. All these patches are related to ext4's bigalloc feature, which was experimental as of 4.19 (expressly noted by contemporary versions of e2fsprogs) and also suffered from a number of bugs. A significant number of additional patches that were applied to 5.X kernels over time would have to be backported to 4.19 for the patch below to function correctly. It's really not worth doing that given bigalloc's experimental status as of 4.19 and the very rare combination of the bigalloc and inline features.
Thanks,
Eric
* Greg Kroah-Hartman <[email protected]>:
Quoted 59 lines
From: Eric Whitney <[email protected]>
[ Upstream commit
131294c35ed6f777bd4e79d42af13b5c41bf2775]When converting files with inline data to extents, delayed allocations made on a file system created with both the bigalloc and inline options can result in invalid extent status cache content, incorrect reserved cluster counts, kernel memory leaks, and potential kernel panics.
With bigalloc, the code that determines whether a block must be delayed allocated searches the extent tree to see if that block maps to a previously allocated cluster. If not, the block is delayed allocated, and otherwise, it isn't. However, if the inline option is also used, and if the file containing the block is marked as able to store data inline, there isn't a valid extent tree associated with the file. The current code in
ext4_clu_mapped()callsext4_find_extent()to search the non-existent tree for a previously allocated cluster anyway, which typically finds nothing, as desired. However, a side effect of the search can be to cache invalid content from the non-existent tree (garbage) in the extent status tree, including bogus entries in the pending reservation tree.To fix this, avoid searching the extent tree when allocating blocks for bigalloc + inline files that are being converted from inline to extent mapped.
Signed-off-by Eric Whitney <[email protected]>Signed-off-by Theodore Ts'o <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- fs/ext4/extents.c | 8 ++++++++ 1 file changed, 8 insertions(+)fs/ext4/extents.c +8
-0@@ -5984,6 +5984,14 @@ int ext4_clu_mapped(struct inode *inode, ext4_lblk_t lclu)struct ext4_extent *extent;ext4_lblk_t first_lblk, first_lclu, last_lclu; +/* +* if data can be stored inline, the logical cluster isn't +* mapped - no physical clusters have been allocated, and the +* file has no extents +*/ +if (ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA )) +return 0 ; +/* search for the extent closest to the first block in the cluster */ path =ext4_find_extent (inode,EXT4_C2B (sbi, lclu),NULL ,0 );if (IS_ERR (path)) {Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 499/521] ext4: fix delayed allocation bug in ext4_clu_mapped for bigalloc + inline
Quoted 11 lines · Eric Whitney
Hi:
I recommend not backporting this patch or the other three patches apparently intended to support it to 4.19 stable. All these patches are related to ext4's bigalloc feature, which was experimental as of 4.19 (expressly noted by contemporary versions of e2fsprogs) and also suffered from a number of bugs. A significant number of additional patches that were applied to 5.X kernels over time would have to be backported to 4.19 for the patch below to function correctly. It's really not worth doing that given bigalloc's experimental status as of 4.19 and the very rare combination of the bigalloc and inline features.
All now reverted, thanks!
greg k-h
Greg Kroah-Hartman
maintainerPATCH 500/521 netfilter: ipset: Fix overflow before widen in the bitmap_ip_create() function.
In reply to Greg Kroah-HartmanFrom: Gavrilov Ilia <[email protected]>
commit 9ea4b476cea1b7d461d16dda25ca3c7e616e2d15 upstream.
When first_ip is 0, last_ip is 0xFFFFFFFF, and netmask is 31, the value of an arithmetic expression 2 << (netmask - mask_bits - 1) is subject to overflow due to a failure casting operands to a larger data type before performing the arithmetic.
Note that it's harmless since the value will be checked at the next step.
Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org) with SVACE.
--- net/netfilter/ipset/ip_set_bitmap_ip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipset/ip_set_bitmap_ip.c +2 -2
@@ -299,8 +299,8 @@ bitmap_ip_create(struct net *net, structreturn -IPSET_ERR_BITMAP_RANGE ;pr_debug ("mask_bits %u, netmask %u\n" , mask_bits, netmask); - hosts =2 << (32 - netmask -1 ); - elements =2 << (netmask - mask_bits -1 ); + hosts =2U << (32 - netmask -1 ); + elements =2UL << (netmask - mask_bits -1 ); }if (elements >IPSET_BITMAP_MAX_RANGE +1 )return -IPSET_ERR_BITMAP_RANGE_SIZE ;
Greg Kroah-Hartman
maintainerPATCH 501/521 x86/boot: Avoid using Intel mnemonics in AT&T syntax asm
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 7c6dd961d0c8e7e8f9fdc65071fb09ece702e18d upstream.
With 'GNU assembler (GNU Binutils for Debian) 2.39.90.20221231' the build now reports:
arch/x86/realmode/rm/../../boot/bioscall.S: Assembler messages:
arch/x86/realmode/rm/../../boot/bioscall.S:35: Warning: found movsd'; assuming movsl' was meant arch/x86/realmode/rm/../../boot/bioscall.S:70: Warning: found movsd'; assuming movsl' was meant
arch/x86/boot/bioscall.S: Assembler messages:
arch/x86/boot/bioscall.S:35: Warning: found movsd'; assuming movsl' was meant arch/x86/boot/bioscall.S:70: Warning: found movsd'; assuming movsl' was meant
Which is due to:
PR gas/29525
Note that with the dropped CMPSD and MOVSD Intel Syntax string insn templates taking operands, mixed IsString/non-IsString template groups (with memory operands) cannot occur anymore. With that maybe_adjust_templates() becomes unnecessary (and is hence being removed).
More details: https://sourceware.org/bugzilla/show_bug.cgi?id=29525
Borislav Petkov further explains:
" the particular problem here is is that the 'd' suffix is
"conflicting" in the sense that you can have SSE mnemonics like movsD %xmm... and the same thing also for string ops (which is the case here) so apparently the agreement in binutils land is to use the always accepted suffixes 'l' or 'q' and phase out 'd' slowly... "
--- arch/x86/boot/bioscall.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/boot/bioscall.S +2 -2
@@ -35,7 +35,7 @@ intcall: movw %dx, %si movw %sp, %di movw $11, %cx - rep; movsd + rep; movsl /* Pop full state from the stack */ popal
@@ -70,7 +70,7 @@ intcall: jz 4f movw %sp, %si movw $11, %cx - rep; movsd + rep; movsl 4: addw $44, %sp /* Restore state and return */
Greg Kroah-Hartman
maintainerPATCH 502/521 EDAC/device: Fix period calculation in edac_device_reset_delay_period()
In reply to Greg Kroah-HartmanFrom: Eliav Farber <[email protected]>
commit e84077437902ec99eba0a6b516df772653f142c7 upstream.
Fix period calculation in case user sets a value of 1000. The input of round_jiffies_relative() should be in jiffies and not in milli-seconds.
[ bp: Use the same code pattern as in edac_device_workq_setup() for
clarity. ]
--- drivers/edac/edac_device.c | 17 ++++++++--------- drivers/edac/edac_module.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-)
drivers/edac/edac_device.c +8 -9
@@ -424,17 +424,16 @@ static void edac_device_workq_teardown(s* Then restart the workq on the new delay */ void edac_device_reset_delay_period (struct edac_device_ctl_info *edac_dev, -unsigned long value) +unsigned long msec) { -unsigned long jiffs =msecs_to_jiffies (value); + edac_dev->poll_msec = msec; + edac_dev->delay =msecs_to_jiffies (msec); -if (value ==1000 ) - jiffs =round_jiffies_relative (value); - - edac_dev->poll_msec = value; - edac_dev->delay = jiffs; - -edac_mod_work (&edac_dev->work, jiffs); +/* See comment in edac_device_workq_setup() above */ +if (edac_dev->poll_msec ==1000 ) +edac_mod_work (&edac_dev->work,round_jiffies_relative (edac_dev->delay)); +else +edac_mod_work (&edac_dev->work, edac_dev->delay); }int edac_device_alloc_index (void )
drivers/edac/edac_module.h +1 -1
@@ -57,7 +57,7 @@ bool edac_stop_work(struct delayed_workbool edac_mod_work (struct delayed_work *work,unsigned long delay);extern void edac_device_reset_delay_period (struct edac_device_ctl_info - *edac_dev,unsigned long value); + *edac_dev,unsigned long msec);extern void edac_mc_reset_delay_period (unsigned long value);extern void *edac_align_ptr (void **p,unsigned size,int n_elems);
Greg Kroah-Hartman
maintainerPATCH 503/521 regulator: da9211: Use irq handler when ready
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit 02228f6aa6a64d588bc31e3267d05ff184d772eb ]
If the system does not come from reset (like when it is kexec()), the regulator might have an IRQ waiting for us.
If we enable the IRQ handler before its structures are ready, we crash.
This patch fixes:
[ 1.141839] Unable to handle kernel read from unreadable memory at virtual address 0000000000000078 [ 1.316096] Call trace: [ 1.316101] blocking_notifier_call_chain+0x20/0xa8 [ 1.322757] cpu cpu0: dummy supplies not allowed for exclusive requests [ 1.327823] regulator_notifier_call_chain+0x1c/0x2c [ 1.327825] da9211_irq_handler+0x68/0xf8 [ 1.327829] irq_thread+0x11c/0x234 [ 1.327833] kthread+0x13c/0x154
--- drivers/regulator/da9211-regulator.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/regulator/da9211-regulator.c +6 -5
@@ -469,6 +469,12 @@ static int da9211_i2c_probe(struct i2c_client *i2c, chip->chip_irq = i2c->irq; + ret =da9211_regulator_init (chip); +if (ret <0 ) { +dev_err (chip->dev,"Failed to initialize regulator: %d\n" , ret); +return ret; + } +if (chip->chip_irq !=0 ) { ret = devm_request_threaded_irq(chip->dev, chip->chip_irq, NULL, da9211_irq_handler,
@@ -483,11 +489,6 @@ static int da9211_i2c_probe(struct i2c_client *i2c,dev_warn (chip->dev,"No IRQ configured\n" ); } - ret =da9211_regulator_init (chip); - -if (ret <0 ) -dev_err (chip->dev,"Failed to initialize regulator: %d\n" , ret); -return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 504/521 hvc/xen: lock console list traversal
In reply to Greg Kroah-HartmanFrom: Roger Pau Monne <[email protected]>
[ Upstream commit c0dccad87cf68fc6012aec7567e354353097ec1a ]
The currently lockless access to the xen console list in vtermno_to_xencons() is incorrect, as additions and removals from the list can happen anytime, and as such the traversal of the list to get the private console data for a given termno needs to happen with the lock held. Note users that modify the list already do so with the lock taken.
Adjust current lock takers to use the _irq{save,restore} helpers, since the context in which vtermno_to_xencons() is called can have interrupts disabled. Use the _irq{save,restore} set of helpers to switch the current callers to disable interrupts in the locked region. I haven't checked if existing users could instead use the _irq variant, as I think it's safer to use _irq{save,restore} upfront.
While there switch from using list_for_each_entry_safe tolist_for_each_entry: the current entry cursor won't be removed as part of the code in the loop body, so using the _safe variant is pointless.
--- drivers/tty/hvc/hvc_xen.c | 46 ++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-)
drivers/tty/hvc/hvc_xen.c +29 -17
@@ -52,17 +52,22 @@ static DEFINE_SPINLOCK(xencons_lock);static struct xencons_info *vtermno_to_xencons (int vtermno) { -struct xencons_info *entry, *n, *ret =NULL ; +struct xencons_info *entry, *ret =NULL ; +unsigned long flags; -if (list_empty (&xenconsoles)) -return NULL ; +spin_lock_irqsave (&xencons_lock, flags); +if (list_empty (&xenconsoles)) { +spin_unlock_irqrestore (&xencons_lock, flags); +return NULL ; + } -list_for_each_entry_safe (entry, n, &xenconsoles, list) { +list_for_each_entry (entry, &xenconsoles, list) {if (entry->vtermno == vtermno) { ret = entry;break ; } } +spin_unlock_irqrestore (&xencons_lock, flags);return ret; }
@@ -223,7 +228,7 @@ static int xen_hvm_console_init(void) {int r;uint64_t v =0 ; -unsigned long gfn; +unsigned long gfn, flags;struct xencons_info *info;if (!xen_hvm_domain ())
@@ -258,9 +263,9 @@ static int xen_hvm_console_init(void) goto err; info->vtermno =HVC_COOKIE ; -spin_lock (&xencons_lock); +spin_lock_irqsave (&xencons_lock, flags);list_add_tail (&info->list, &xenconsoles); -spin_unlock (&xencons_lock); +spin_unlock_irqrestore (&xencons_lock, flags);return 0 ; err:
@@ -283,6 +288,7 @@ static int xencons_info_pv_init(struct xencons_info *info, int vtermno)static int xen_pv_console_init (void ) {struct xencons_info *info; +unsigned long flags;if (!xen_pv_domain ())return -ENODEV ;
@@ -299,9 +305,9 @@ static int xen_pv_console_init(void)/* already configured */ return 0 ; } -spin_lock (&xencons_lock); +spin_lock_irqsave (&xencons_lock, flags);xencons_info_pv_init (info,HVC_COOKIE ); -spin_unlock (&xencons_lock); +spin_unlock_irqrestore (&xencons_lock, flags);return 0 ; }
@@ -309,6 +315,7 @@ static int xen_pv_console_init(void)static int xen_initial_domain_console_init (void ) {struct xencons_info *info; +unsigned long flags;if (!xen_initial_domain ())return -ENODEV ;
@@ -323,9 +330,9 @@ static int xen_initial_domain_console_init(void) info->irq =bind_virq_to_irq (VIRQ_CONSOLE ,0 , false); info->vtermno =HVC_COOKIE ; -spin_lock (&xencons_lock); +spin_lock_irqsave (&xencons_lock, flags);list_add_tail (&info->list, &xenconsoles); -spin_unlock (&xencons_lock); +spin_unlock_irqrestore (&xencons_lock, flags);return 0 ; }
@@ -380,10 +387,12 @@ static void xencons_free(struct xencons_info *info)static int xen_console_remove (struct xencons_info *info) { +unsigned long flags; +xencons_disconnect_backend (info); -spin_lock (&xencons_lock); +spin_lock_irqsave (&xencons_lock, flags);list_del (&info->list); -spin_unlock (&xencons_lock); +spin_unlock_irqrestore (&xencons_lock, flags);if (info->xbdev !=NULL )xencons_free (info);else {
@@ -464,6 +473,7 @@ static int xencons_probe(struct xenbus_device *dev, {int ret, devid;struct xencons_info *info; +unsigned long flags; devid = dev->nodename[strlen (dev->nodename) -1 ] -'0' ;if (devid ==0 )
@@ -482,9 +492,9 @@ static int xencons_probe(struct xenbus_device *dev, ret =xencons_connect_backend (dev, info);if (ret <0 ) goto error; -spin_lock (&xencons_lock); +spin_lock_irqsave (&xencons_lock, flags);list_add_tail (&info->list, &xenconsoles); -spin_unlock (&xencons_lock); +spin_unlock_irqrestore (&xencons_lock, flags);return 0 ;
@@ -583,10 +593,12 @@ static int __init xen_hvc_init(void) info->hvc =hvc_alloc (HVC_COOKIE , info->irq, ops,256 );if (IS_ERR (info->hvc)) { +unsigned long flags; + r =PTR_ERR (info->hvc); -spin_lock (&xencons_lock); +spin_lock_irqsave (&xencons_lock, flags);list_del (&info->list); -spin_unlock (&xencons_lock); +spin_unlock_irqrestore (&xencons_lock, flags);if (info->irq)unbind_from_irqhandler (info->irq,NULL );kfree (info);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 505/521 nfc: pn533: Wait for out_urbs completion in pn533_usb_send_frame()
In reply to Greg Kroah-HartmanFrom: Minsuk Kang <[email protected]>
[ Upstream commit 9dab880d675b9d0dd56c6428e4e8352a3339371d ]
Fix a use-after-free that occurs in hcd when in_urb sent from pn533_usb_send_frame() is completed earlier than out_urb. Its callback frees the skb data in pn533_send_async_complete() that is used as a transfer buffer of out_urb. Wait before sending in_urb until the callback of out_urb is called. To modify the callback of out_urb alone, separate the complete function of out_urb and ack_urb.
Found by a modified version of syzkaller.
BUG: KASAN: use-after-free in dummy_timer Call Trace: memcpy (mm/kasan/shadow.c:65) dummy_perform_transfer (drivers/usb/gadget/udc/dummy_hcd.c:1352) transfer (drivers/usb/gadget/udc/dummy_hcd.c:1453) dummy_timer (drivers/usb/gadget/udc/dummy_hcd.c:1972) arch_static_branch (arch/x86/include/asm/jump_label.h:27) static_key_false (include/linux/jump_label.h:207) timer_expire_exit (include/trace/events/timer.h:127) call_timer_fn (kernel/time/timer.c:1475) expire_timers (kernel/time/timer.c:1519) __run_timers (kernel/time/timer.c:1790) run_timer_softirq (kernel/time/timer.c:1803)
--- drivers/nfc/pn533/usb.c | 44 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-)
drivers/nfc/pn533/usb.c +41 -3
@@ -165,10 +165,17 @@ static int pn533_usb_send_ack(struct pn533 *dev, gfp_t flags)return usb_submit_urb (phy->ack_urb, flags); } +struct pn533_out_arg { +struct pn533_usb_phy *phy; +struct completion done; +}; +static int pn533_usb_send_frame (struct pn533 *dev,struct sk_buff *out) {struct pn533_usb_phy *phy = dev->phy; +struct pn533_out_arg arg; +void *cntx;int rc;if (phy->priv ==NULL )
@@ -180,10 +187,17 @@ static int pn533_usb_send_frame(struct pn533 *dev,print_hex_dump_debug ("PN533 TX: " ,DUMP_PREFIX_NONE ,16 ,1 , out->data, out->len, false); +init_completion (&arg.done); + cntx = phy->out_urb->context; + phy->out_urb->context = &arg; + rc =usb_submit_urb (phy->out_urb,GFP_KERNEL );if (rc)return rc; +wait_for_completion (&arg.done); + phy->out_urb->context = cntx; +if (dev->protocol_type ==PN533_PROTO_REQ_RESP ) {/* request for response for sent packet directly */ rc =pn533_submit_urb_for_response (phy,GFP_KERNEL );
@@ -424,7 +438,31 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy)return arg.rc; } -static void pn533_send_complete (struct urb *urb) +static void pn533_out_complete (struct urb *urb) +{ +struct pn533_out_arg *arg = urb->context; +struct pn533_usb_phy *phy = arg->phy; + +switch (urb->status) { +case 0 : +break ;/* success */ +case -ECONNRESET : +case -ENOENT : +dev_dbg (&phy->udev->dev, +"The urb has been stopped (status %d)\n" , + urb->status); +break ; +case -ESHUTDOWN : +default : +nfc_err (&phy->udev->dev, +"Urb failure (status %d)\n" , + urb->status); + } + +complete (&arg->done); +} + +static void pn533_ack_complete (struct urb *urb) {struct pn533_usb_phy *phy = urb->context;
@@ -512,10 +550,10 @@ static int pn533_usb_probe(struct usb_interface *interface,usb_fill_bulk_urb (phy->out_urb, phy->udev,usb_sndbulkpipe (phy->udev, out_endpoint), -NULL ,0 , pn533_send_complete, phy); +NULL ,0 , pn533_out_complete, phy);usb_fill_bulk_urb (phy->ack_urb, phy->udev,usb_sndbulkpipe (phy->udev, out_endpoint), -NULL ,0 , pn533_send_complete, phy); +NULL ,0 , pn533_ack_complete, phy);switch (id->driver_info) {case PN533_DEVICE_STD :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 506/521 net/mlx5: Rename ptp clock info
In reply to Greg Kroah-HartmanFrom: Eran Ben Elisha <[email protected]>
[ Upstream commit aac2df7f022eccb5d117f07b1e231410db1a863a ]
Fix a typo in ptp_clock_info naming: mlx5_p2p -> mlx5_ptp.
Stable-dep-of: fe91d57277ee ("net/mlx5: Fix ptp max frequency adjustment range")
--- drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +1 -1
@@ -395,7 +395,7 @@ static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,static const struct ptp_clock_info mlx5_ptp_clock_info = { .owner =THIS_MODULE , - .name ="mlx5_p2p" , + .name ="mlx5_ptp" , .max_adj =100000000 , .n_alarm =0 , .n_ext_ts =0 ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 507/521 net/mlx5: Fix ptp max frequency adjustment range
In reply to Greg Kroah-HartmanFrom: Rahul Rameshbabu <[email protected]>
[ Upstream commit fe91d57277eef8bb4aca05acfa337b4a51d0bba4 ]
.max_adj of ptp_clock_info acts as an absolute value for the amount in ppb that can be set for a single call of .adjfine. This means that a single call to .getfine cannot be greater than .max_adj or less than -(.max_adj). Provides correct value for max frequency adjustment value supported by devices.
--- drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +1 -1
@@ -396,7 +396,7 @@ static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,static const struct ptp_clock_info mlx5_ptp_clock_info = { .owner =THIS_MODULE , .name ="mlx5_ptp" , - .max_adj =100000000 , + .max_adj =50000000 , .n_alarm =0 , .n_ext_ts =0 , .n_per_out =0 ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 508/521 iommu/mediatek-v1: Add error handle for mtk_iommu_probe
In reply to Greg Kroah-HartmanFrom: Yong Wu <[email protected]>
[ Upstream commit ac304c070c54413efabf29f9e73c54576d329774 ]
In the original code, we lack the error handle. This patch adds them.
Stable-dep-of: 142e821f68cf ("iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()")
--- drivers/iommu/mtk_iommu_v1.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/iommu/mtk_iommu_v1.c +18 -4
@@ -632,12 +632,26 @@ static int mtk_iommu_probe(struct platform_device *pdev) ret =iommu_device_register (&data->iommu);if (ret) -return ret; + goto out_sysfs_remove; -if (!iommu_present (&platform_bus_type)) -bus_set_iommu (&platform_bus_type, &mtk_iommu_ops); +if (!iommu_present (&platform_bus_type)) { + ret =bus_set_iommu (&platform_bus_type, &mtk_iommu_ops); +if (ret) + goto out_dev_unreg; + } -return component_master_add_with_match (dev, &mtk_iommu_com_ops, match); + ret =component_master_add_with_match (dev, &mtk_iommu_com_ops, match); +if (ret) + goto out_bus_set_null; +return ret; + +out_bus_set_null: +bus_set_iommu (&platform_bus_type,NULL ); +out_dev_unreg: +iommu_device_unregister (&data->iommu); +out_sysfs_remove: +iommu_device_sysfs_remove (&data->iommu); +return ret; }static int mtk_iommu_remove (struct platform_device *pdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 509/521 iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 142e821f68cf5da79ce722cb9c1323afae30e185 ]
A clk, prepared and enabled in mtk_iommu_v1_hw_init(), is not released in the error handling path of mtk_iommu_v1_probe().
Add the corresponding clk_disable_unprepare(), as already done in the remove function.
--- drivers/iommu/mtk_iommu_v1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/mtk_iommu_v1.c +3 -1
@@ -626,7 +626,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) ret =iommu_device_sysfs_add (&data->iommu, &pdev->dev,NULL ,dev_name (&pdev->dev));if (ret) -return ret; + goto out_clk_unprepare;iommu_device_set_ops (&data->iommu, &mtk_iommu_ops);
@@ -651,6 +651,8 @@ static int mtk_iommu_probe(struct platform_device *pdev)iommu_device_unregister (&data->iommu); out_sysfs_remove:iommu_device_sysfs_remove (&data->iommu); +out_clk_unprepare: +clk_disable_unprepare (data->bclk);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 510/521 x86/resctrl: Use task_curr() instead of task_struct->on_cpu to prevent unnecessary IPI
In reply to Greg Kroah-HartmanFrom: Reinette Chatre <[email protected]>
[ Upstream commit e0ad6dc8969f790f14bddcfd7ea284b7e5f88a16 ]
James reported in [1] that there could be two tasks running on the same CPU with task_struct->on_cpu set. Using task_struct->on_cpu as a test if a task is running on a CPU may thus match the old task for a CPU while the scheduler is running and IPI it unnecessarily.
task_curr() is the correct helper to use. While doing so move the #ifdef check of the CONFIG_SMP symbol to be a C conditional used to determine if this helper should be used to ensure the code is always checked for correctness by the compiler.
[1] https://lore.kernel.org/lkml/[email protected]
Stable-dep-of: fe1f0714385f ("x86/resctrl: Fix task CLOSID/RMID update race")
--- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +5 -9
@@ -2140,19 +2140,15 @@ static void rdt_move_group_tasks(struct rdtgroup *from, struct rdtgroup *to, t->closid = to->closid; t->rmid = to->mon.rmid; -#ifdef CONFIG_SMP /* -* This is safe on x86 w/o barriers as the ordering -* of writing to task_cpu() and t->on_cpu is -* reverse to the reading here. The detection is -* inaccurate as tasks might move or schedule -* before the smp function call takes place. In -* such a case the function call is pointless, but +* If the task is on a CPU, set the CPU in the mask. +* The detection is inaccurate as tasks might move or +* schedule before the smp function call takes place. +* In such a case the function call is pointless, but * there is no other side effect. */ -if (mask && t->on_cpu) +if (IS_ENABLED (CONFIG_SMP ) && mask &&task_curr (t))cpumask_set_cpu (task_cpu (t), mask); -#endif } }read_unlock (&tasklist_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 511/521 x86/resctrl: Fix task CLOSID/RMID update race
In reply to Greg Kroah-HartmanFrom: Peter Newman <[email protected]>
[ Upstream commit fe1f0714385fbcf76b0cbceb02b7277d842014fc ]
When the user moves a running task to a new rdtgroup using the task's file interface or by deleting its rdtgroup, the resulting change in CLOSID/RMID must be immediately propagated to the PQR_ASSOC MSR on the task(s) CPUs.
x86 allows reordering loads with prior stores, so if the task starts running between a task_curr() check that the CPU hoisted before the stores in the CLOSID/RMID update then it can start running with the old CLOSID/RMID until it is switched again because __rdtgroup_move_task() failed to determine that it needs to be interrupted to obtain the new CLOSID/RMID.
Refer to the diagram below:
CPU 0 CPU 1
----- -----__rdtgroup_move_task():
curr <- t1->cpu->rq->curr
__schedule():
rq->curr <- t1
resctrl_sched_in():
t1->{closid,rmid} -> {1,1} t1->{closid,rmid} <- {2,2}
if (curr == t1) // false
IPI(t1->cpu)
A similar race impacts rdt_move_group_tasks(), which updates tasks in a deleted rdtgroup.
In both cases, use smp_mb() to order the task_struct::{closid,rmid} stores before the loads in task_curr(). In particular, in the rdt_move_group_tasks() case, simply execute an smp_mb() on every iteration with a matching task.
It is possible to use a single smp_mb() in rdt_move_group_tasks(), but this would require two passes and a means of remembering which task_structs were updated in the first loop. However, benchmarking results below showed too little performance impact in the simple approach to justify implementing the two-pass approach.
Times below were collected using perf stat to measure the time to remove a group containing a 1600-task, parallel workload.
CPU: Intel(R) Xeon(R) Platinum P-8136 CPU @ 2.00GHz (112 threads)
# mkdir /sys/fs/resctrl/test # echo $$ > /sys/fs/resctrl/test/tasks # perf bench sched messaging -g 40 -l 100000
task-clock time ranges collected using:
# perf stat rmdir /sys/fs/resctrl/test
Baseline: 1.54 - 1.60 ms smp_mb() every matching task: 1.57 - 1.67 ms
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +11 -1
@@ -585,8 +585,10 @@ static int __rdtgroup_move_task(struct task_struct *tsk,/* * Ensure the task's closid and rmid are written before determining if * the task is current that will decide if it will be interrupted. +* This pairs with the full barrier between the rq->curr update and +* resctrl_sched_in() during context switch. */ -barrier (); +smp_mb ();/* * By now, the task's closid and rmid are set. If the task is current
@@ -2140,6 +2142,14 @@ static void rdt_move_group_tasks(struct rdtgroup *from, struct rdtgroup *to, t->closid = to->closid; t->rmid = to->mon.rmid; +/* +* Order the closid/rmid stores above before the loads +* in task_curr(). This pairs with the full barrier +* between the rq->curr update and resctrl_sched_in() +* during context switch. +*/ +smp_mb (); +/* * If the task is on a CPU, set the CPU in the mask. * The detection is inaccurate as tasks might move or
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 512/521 drm/virtio: Fix GEM handle creation UAF
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 52531258318ed59a2dc5a43df2eaf0eb1d65438e ]
Userspace can guess the handle value and try to race GEM object creation with handle close, resulting in a use-after-free if we dereference the object after dropping the handle's reference. For that reason, dropping the handle's reference must be done *after* we are done dereferencing the object.
--- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +9 -1
@@ -309,7 +309,6 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, }return ret; } -drm_gem_object_put_unlocked (obj); rc->res_handle = res_id;/* similiar to a VM address */ rc->bo_handle = handle;
@@ -318,6 +317,15 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,virtio_gpu_unref_list (&validate_list);dma_fence_put (&fence->f); } + +/* +* The handle owns the reference now. But we must drop our +* remaining reference *after* we no longer need to dereference +* the obj. Otherwise userspace could guess the handle and +* race closing it from another thread. +*/ +drm_gem_object_put_unlocked (obj); +return 0 ; fail_unref:if (vgdev->has_virgl_3d) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 513/521 arm64: cmpxchg_double*: hazard against entire exchange variable
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit 031af50045ea97ed4386eb3751ca2c134d0fc911 ]
The inline assembly for arm64's cmpxchg_double*() implementations use a +Q constraint to hazard against other accesses to the memory location being exchanged. However, the pointer passed to the constraint is a pointer to unsigned long, and thus the hazard only applies to the first 8 bytes of the location.
GCC can take advantage of this, assuming that other portions of the location are unchanged, leading to a number of potential problems.
This is similar to what we fixed back in commit:
fee960bed5e857eb ("arm64: xchg: hazard against entire exchange variable")
... but we forgot to adjust cmpxchg_double*() similarly at the same time.
The same problem applies, as demonstrated with the following test:
| struct big {
| u64 lo, hi;
| } __aligned(128);
|
| unsigned long foo(struct big *b)
| {
| u64 hi_old, hi_new;
|
| hi_old = b->hi;
| cmpxchg_double_local(&b->lo, &b->hi, 0x12, 0x34, 0x56, 0x78);
| hi_new = b->hi;
|
| return hi_old ^ hi_new;
| }... which GCC 12.1.0 compiles as:
| 0000000000000000 <foo>: | 0: d503233f paciasp | 4: aa0003e4 mov x4, x0 | 8: 1400000e b 40 <foo+0x40> | c: d2800240 mov x0, #0x12 // #18 | 10: d2800681 mov x1, #0x34 // #52 | 14: aa0003e5 mov x5, x0 | 18: aa0103e6 mov x6, x1 | 1c: d2800ac2 mov x2, #0x56 // #86 | 20: d2800f03 mov x3, #0x78 // #120 | 24: 48207c82 casp x0, x1, x2, x3, [x4] | 28: ca050000 eor x0, x0, x5 | 2c: ca060021 eor x1, x1, x6 | 30: aa010000 orr x0, x0, x1 | 34: d2800000 mov x0, #0x0 // #0 <--- BANG | 38: d50323bf autiasp | 3c: d65f03c0 ret | 40: d2800240 mov x0, #0x12 // #18 | 44: d2800681 mov x1, #0x34 // #52 | 48: d2800ac2 mov x2, #0x56 // #86 | 4c: d2800f03 mov x3, #0x78 // #120 | 50: f9800091 prfm pstl1strm, [x4] | 54: c87f1885 ldxp x5, x6, [x4] | 58: ca0000a5 eor x5, x5, x0 | 5c: ca0100c6 eor x6, x6, x1 | 60: aa0600a6 orr x6, x5, x6 | 64: b5000066 cbnz x6, 70 <foo+0x70> | 68: c8250c82 stxp w5, x2, x3, [x4] | 6c: 35ffff45 cbnz w5, 54 <foo+0x54> | 70: d2800000 mov x0, #0x0 // #0 <--- BANG | 74: d50323bf autiasp | 78: d65f03c0 ret
Notice that at the lines with "BANG" comments, GCC has assumed that the higher 8 bytes are unchanged by the cmpxchg_double() call, and that hi_old ^ hi_new can be reduced to a constant zero, for both LSE and LL/SC versions of cmpxchg_double().
This patch fixes the issue by passing a pointer to __uint128_t into the +Q constraint, ensuring that the compiler hazards against the entire 16 bytes being modified.
With this change, GCC 12.1.0 compiles the above test as:
| 0000000000000000 <foo>: | 0: f9400407 ldr x7, [x0, #8] | 4: d503233f paciasp | 8: aa0003e4 mov x4, x0 | c: 1400000f b 48 <foo+0x48> | 10: d2800240 mov x0, #0x12 // #18 | 14: d2800681 mov x1, #0x34 // #52 | 18: aa0003e5 mov x5, x0 | 1c: aa0103e6 mov x6, x1 | 20: d2800ac2 mov x2, #0x56 // #86 | 24: d2800f03 mov x3, #0x78 // #120 | 28: 48207c82 casp x0, x1, x2, x3, [x4] | 2c: ca050000 eor x0, x0, x5 | 30: ca060021 eor x1, x1, x6 | 34: aa010000 orr x0, x0, x1 | 38: f9400480 ldr x0, [x4, #8] | 3c: d50323bf autiasp | 40: ca0000e0 eor x0, x7, x0 | 44: d65f03c0 ret | 48: d2800240 mov x0, #0x12 // #18 | 4c: d2800681 mov x1, #0x34 // #52 | 50: d2800ac2 mov x2, #0x56 // #86 | 54: d2800f03 mov x3, #0x78 // #120 | 58: f9800091 prfm pstl1strm, [x4] | 5c: c87f1885 ldxp x5, x6, [x4] | 60: ca0000a5 eor x5, x5, x0 | 64: ca0100c6 eor x6, x6, x1 | 68: aa0600a6 orr x6, x5, x6 | 6c: b5000066 cbnz x6, 78 <foo+0x78> | 70: c8250c82 stxp w5, x2, x3, [x4] | 74: 35ffff45 cbnz w5, 5c <foo+0x5c> | 78: f9400480 ldr x0, [x4, #8] | 7c: d50323bf autiasp | 80: ca0000e0 eor x0, x7, x0 | 84: d65f03c0 ret
... sampling the high 8 bytes before and after the cmpxchg, and performing an EOR, as we'd expect.
For backporting, I've tested this atop linux-4.9.y with GCC 5.5.0. Note that linux-4.9.y is oldest currently supported stable release, and mandates GCC 5.1+. Unfortunately I couldn't get a GCC 5.1 binary to run on my machines due to library incompatibilities.
I've also used a standalone test to check that we can use a __uint128_t pointer in a +Q constraint at least as far back as GCC 4.8.5 and LLVM 3.9.1.
--- arch/arm64/include/asm/atomic_ll_sc.h | 2 +- arch/arm64/include/asm/atomic_lse.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/atomic_ll_sc.h +1 -1
@@ -320,7 +320,7 @@ __LL_SC_PREFIX(__cmpxchg_double##name(unsigned long old1, \" cbnz %w0, 1b\n" \ " " #mb "\n" \ "2:" \ - : "=&r" (tmp), "=&r" (ret), "+Q" (*(unsigned long *)ptr) \ + : "=&r" (tmp), "=&r" (ret), "+Q" (*(__uint128_t *)ptr) \ : "r" (old1), "r" (old2), "r" (new1), "r" (new2) \ : cl); \ \
arch/arm64/include/asm/atomic_lse.h +1 -1
@@ -555,7 +555,7 @@ static inline long __cmpxchg_double##name(unsigned long old1, \" eor %[old2], %[old2], %[oldval2]\n" \ " orr %[old1], %[old1], %[old2]") \ : [old1] "+&r" (x0), [old2] "+&r" (x1), \ -[v] " +Q " (*(unsigned long *)ptr) \ +[v] " +Q " (*(__uint128_t *)ptr) \ : [new1] " r" (x2), [new2] " r" (x3), [ptr] " r" (x4), \ [oldval1] " r" (oldval1), [oldval2] " r" (oldval2) \ : __LL_SC_CLOBBERS, ##cl); \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 514/521 efi: fix NULL-deref in init error path
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 703c13fe3c9af557d312f5895ed6a5fda2711104 ]
In cases where runtime services are not supported or have been disabled, the runtime services workqueue will never have been allocated.
Do not try to destroy the workqueue unconditionally in the unlikely event that EFI initialisation fails to avoid dereferencing a NULL pointer.
--- drivers/firmware/efi/efi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/firmware/efi/efi.c +6 -3
@@ -359,8 +359,8 @@ static int __init efisubsys_init(void) efi_kobj =kobject_create_and_add ("efi" , firmware_kobj);if (!efi_kobj) {pr_err ("efi: Firmware registration failed.\n" ); -destroy_workqueue (efi_rts_wq); -return -ENOMEM ; + error = -ENOMEM ; + goto err_destroy_wq; } error =generic_ops_register ();
@@ -396,7 +396,10 @@ err_unregister:generic_ops_unregister (); err_put:kobject_put (efi_kobj); -destroy_workqueue (efi_rts_wq); +err_destroy_wq: +if (efi_rts_wq) +destroy_workqueue (efi_rts_wq); +return error; }
Greg Kroah-Hartman
maintainerPATCH 515/521 Revert "usb: ulpi: defer ulpi_register on ulpi_read_id timeout"
In reply to Greg Kroah-HartmanFrom: Ferry Toth <[email protected]>
commit b659b613cea2ae39746ca8bd2b69d1985dd9d770 upstream.
This reverts commit 8a7b31d545d3a15f0e6f5984ae16f0ca4fd76aac.
This patch results in some qemu test failures, specifically xilinx-zynq-a9 machine and zynq-zc702 as well as zynq-zed devicetree files, when trying to boot from USB drive.
--- drivers/usb/common/ulpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/common/ulpi.c +1 -1
@@ -207,7 +207,7 @@ static int ulpi_read_id(struct ulpi *ulp/* Test the interface */ ret =ulpi_write (ulpi,ULPI_SCRATCH ,0xaa );if (ret <0 ) -return ret; + goto err; ret =ulpi_read (ulpi,ULPI_SCRATCH );if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 516/521 tty: serial: tegra: Handle RX transfer in PIO mode if DMA wasnt started
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit 1f69a1273b3f204a9c00dc3bbdcc4afcd0787428 upstream.
It is possible to get an instant RX timeout or end-of-transfer interrupt before RX DMA was started, if transaction is less than 16 bytes. Transfer should be handled in PIO mode in this case because DMA can't handle it. This patch brings back the original behaviour of the driver that was changed by accident by a previous commit, it fixes occasional Bluetooth HW initialization failures which I started to notice recently.
--- drivers/tty/serial/serial-tegra.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)
drivers/tty/serial/serial-tegra.c +16 -19
@@ -638,11 +638,22 @@ static void tegra_uart_copy_rx_to_tty(st TEGRA_UART_RX_DMA_BUFFER_SIZE, DMA_TO_DEVICE); } +static void do_handle_rx_pio (struct tegra_uart_port *tup) +{ +struct tty_struct *tty =tty_port_tty_get (&tup->uport.state->port); +struct tty_port *port = &tup->uport.state->port; + +tegra_uart_handle_rx_pio (tup, port); +if (tty) { +tty_flip_buffer_push (port); +tty_kref_put (tty); + } +} +static void tegra_uart_rx_buffer_push (struct tegra_uart_port *tup,unsigned int residue) {struct tty_port *port = &tup->uport.state->port; -struct tty_struct *tty =tty_port_tty_get (port);unsigned int count;async_tx_ack (tup->rx_dma_desc);
@@ -651,11 +662,7 @@ static void tegra_uart_rx_buffer_push(st/* If we are here, DMA is stopped */ tegra_uart_copy_rx_to_tty (tup, port, count); -tegra_uart_handle_rx_pio (tup, port); -if (tty) { -tty_flip_buffer_push (port); -tty_kref_put (tty); - } +do_handle_rx_pio (tup); }static void tegra_uart_rx_dma_complete (void *args)
@@ -695,8 +702,10 @@ static void tegra_uart_terminate_rx_dma( {struct dma_tx_state state; -if (!tup->rx_dma_active) +if (!tup->rx_dma_active) { +do_handle_rx_pio (tup);return ; + }dmaengine_pause (tup->rx_dma_chan);dmaengine_tx_status (tup->rx_dma_chan, tup->rx_cookie, &state);
@@ -765,18 +774,6 @@ static void tegra_uart_handle_modem_signuart_handle_cts_change (&tup->uport, msr &UART_MSR_CTS ); } -static void do_handle_rx_pio (struct tegra_uart_port *tup) -{ -struct tty_struct *tty =tty_port_tty_get (&tup->uport.state->port); -struct tty_port *port = &tup->uport.state->port; - -tegra_uart_handle_rx_pio (tup, port); -if (tty) { -tty_flip_buffer_push (port); -tty_kref_put (tty); - } -} -static irqreturn_t tegra_uart_isr (int irq,void *data) {struct tegra_uart_port *tup = data;
Greg Kroah-Hartman
maintainerPATCH 517/521 pseries/eeh: Fix the kdump kernel crash during eeh_pseries_init
In reply to Greg Kroah-HartmanFrom: Mahesh Salgaonkar <[email protected]>
commit eb8257a12192f43ffd41bd90932c39dade958042 upstream.
On pseries LPAR when an empty slot is assigned to partition OR in single LPAR mode, kdump kernel crashes during issuing PHB reset.
In the kdump scenario, we traverse all PHBs and issue reset using the pe_config_addr of the first child device present under each PHB. However the code assumes that none of the PHB slots can be empty and uses list_first_entry() to get the first child device under the PHB. Since list_first_entry() expects the list to be non-empty, it returns an invalid pci_dn entry and ends up accessing NULL phb pointer under pci_dn->phb causing kdump kernel crash.
This patch fixes the below kdump kernel crash by skipping empty slots:
audit: initializing netlink subsys (disabled)
thermal_sys: Registered thermal governor 'fair_share'
thermal_sys: Registered thermal governor 'step_wise'
cpuidle: using governor menu
pstore: Registered nvram as persistent store backend
Issue PHB reset ...
audit: type=2000 audit(1631267818.000:1): state=initialized audit_enabled=0 res=1
BUG: Kernel NULL pointer dereference on read at 0x00000268
Faulting instruction address: 0xc000000008101fb0
Oops: Kernel access of bad area, sig: 7 [#1]
LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
Modules linked in:
CPU: 7 PID: 1 Comm: swapper/7 Not tainted 5.14.0 #1
NIP: c000000008101fb0 LR: c000000009284ccc CTR: c000000008029d70
REGS: c00000001161b840 TRAP: 0300 Not tainted (5.14.0)
MSR: 8000000002009033 <SF,VEC,EE,ME,IR,DR,RI,LE> CR: 28000224 XER: 20040002
CFAR: c000000008101f0c DAR: 0000000000000268 DSISR: 00080000 IRQMASK: 0
...
NIP pseries_eeh_get_pe_config_addr+0x100/0x1b0
LR __machine_initcall_pseries_eeh_pseries_init+0x2cc/0x350
Call Trace:
0xc00000001161bb80 (unreliable)
__machine_initcall_pseries_eeh_pseries_init+0x2cc/0x350
do_one_initcall+0x60/0x2d0
kernel_init_freeable+0x350/0x3f8
kernel_init+0x3c/0x17c
ret_from_kernel_thread+0x5c/0x64--- arch/powerpc/platforms/pseries/eeh_pseries.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/pseries/eeh_pseries.c +4 -0
@@ -957,6 +957,10 @@ static int __init eeh_pseries_init(void)if (is_kdump_kernel () || reset_devices) {pr_info ("Issue PHB reset ...\n" );list_for_each_entry (phb, &hose_list, list_node) { +// Skip if the slot is empty +if (list_empty (&PCI_DN (phb->dn)->child_list)) +continue ; + pdn = list_first_entry(&PCI_DN(phb->dn)->child_list, struct pci_dn, list); addr = (pdn->busno <<16 ) | (pdn->devfn <<8 ); config_addr =pseries_eeh_get_config_addr (phb, addr);
Greg Kroah-Hartman
maintainerPATCH 518/521 ALSA: hda/realtek - Fix inverted bass GPIO pin on Acer 8951G
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 336820c4374bc065317f247dc2bb37c0e41b64a6 upstream.
We've added the bass speaker support on Acer 8951G by the commit 00066e9733f6 ("Add Acer Aspire Ethos 8951G model quirk"), but it seems that the GPIO pin was wrongly set: while the commit turns off the bit to power up the amp, the actual hardware reacts other way round, i.e. GPIO bit on = amp on.
So this patch fixes the bug, turning on the GPIO bit 0x02 as default. Since turning on the GPIO bit can be more easily managed with alc_setup_gpio() call, we simplify the quirk code by integrating the GPIO setup into the existing alc662_fixup_aspire_ethos_hp() and dropping the whole ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER quirk.
--- sound/pci/hda/patch_realtek.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
sound/pci/hda/patch_realtek.c +3 -14
@@ -8539,6 +8539,8 @@ static void alc662_fixup_aspire_ethos_hpcase HDA_FIXUP_ACT_PRE_PROBE :snd_hda_jack_detect_enable_callback (codec,0x1b , alc662_aspire_ethos_mute_speakers); +/* subwoofer needs an extra GPIO setting to become audible */ +alc_setup_gpio (codec,0x02 );break ;case HDA_FIXUP_ACT_INIT :/* Make sure to start in a correct state, i.e. if
@@ -8676,7 +8678,6 @@ enum {ALC662_FIXUP_USI_HEADSET_MODE ,ALC662_FIXUP_LENOVO_MULTI_CODECS ,ALC669_FIXUP_ACER_ASPIRE_ETHOS , -ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER ,ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET ,ALC671_FIXUP_HP_HEADSET_MIC2 , ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
@@ -9019,18 +9020,6 @@ static const struct hda_fixup alc662_fix .type = HDA_FIXUP_FUNC, .v.func = alc662_fixup_aspire_ethos_hp, }, - [ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER] = { - .type = HDA_FIXUP_VERBS, -/* subwoofer needs an extra GPIO setting to become audible */ - .v.verbs = (const struct hda_verb []) { - {0x01 ,AC_VERB_SET_GPIO_MASK ,0x02 }, - {0x01 ,AC_VERB_SET_GPIO_DIRECTION ,0x02 }, - {0x01 ,AC_VERB_SET_GPIO_DATA ,0x00 }, - { } - }, - .chained = true, - .chain_id =ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET - }, [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) {
@@ -9040,7 +9029,7 @@ static const struct hda_fixup alc662_fix { } }, .chained = true, - .chain_id =ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER + .chain_id =ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET }, [ALC671_FIXUP_HP_HEADSET_MIC2] = { .type = HDA_FIXUP_FUNC,
Greg Kroah-Hartman
maintainerPATCH 519/521 ALSA: hda/realtek - Fixed one of HP ALC671 platform Headset Mic supported
In reply to Greg Kroah-HartmanFrom: Kailang Yang <[email protected]>
commit f2adbae0cb20c8eaf06914b2187043ea944b0aff upstream.
HP want to keep BIOS verb table for release platform. So, it need to add 0x19 pin for quirk.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9304,6 +9304,7 @@ static const struct snd_hda_pin_quirk alSND_HDA_PIN_QUIRK (0x10ec0671 ,0x103c ,"HP cPC" ,ALC671_FIXUP_HP_HEADSET_MIC2 , {0x14, 0x01014010}, {0x17, 0x90170150}, + {0x19, 0x02a11060}, {0x1b, 0x01813030}, {0x21, 0x02211020}), SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
Greg Kroah-Hartman
maintainerPATCH 520/521 powerpc/powernv/eeh: Fix oops when probing cxl devices
In reply to Greg Kroah-HartmanFrom: Frederic Barrat <[email protected]>
commit a8a30219ba78b1abb92091102b632f8e9bbdbf03 upstream.
Recent cleanup in the way EEH support is added to a device causes a kernel oops when the cxl driver probes a device and creates virtual devices discovered on the FPGA:
BUG: Kernel NULL pointer dereference at 0x000000a0
Faulting instruction address: 0xc000000000048070
Oops: Kernel access of bad area, sig: 7 [#1]
...
NIP eeh_add_device_late.part.9+0x50/0x1e0
LR eeh_add_device_late.part.9+0x3c/0x1e0
Call Trace:
_dev_info+0x5c/0x6c (unreliable)
pnv_pcibios_bus_add_device+0x60/0xb0
pcibios_bus_add_device+0x40/0x60
pci_bus_add_device+0x30/0x100
pci_bus_add_devices+0x64/0xd0
cxl_pci_vphb_add+0xe0/0x130 [cxl]
cxl_probe+0x504/0x5b0 [cxl]
local_pci_probe+0x6c/0x110
work_for_cpu_fn+0x38/0x60The root cause is that those cxl virtual devices don't have a representation in the device tree and therefore no associated pci_dn structure. In eeh_add_device_late(), pdn is NULL, so edev is NULL and we oops.
We never had explicit support for EEH for those virtual devices. Instead, EEH events are reported to the (real) pci device and handled by the cxl driver. Which can then forward to the virtual devices and handle dependencies. The fact that we try adding EEH support for the virtual devices is new and a side-effect of the recent cleanup.
This patch fixes it by skipping adding EEH support on powernv for devices which don't have a pci_dn structure.
The cxl driver doesn't create virtual devices on pseries so this patch doesn't fix it there intentionally.
--- arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/eeh-powernv.c +1 -1
@@ -47,7 +47,7 @@ void pnv_pcibios_bus_add_device(struct p {struct pci_dn *pdn =pci_get_pdn (pdev); -if (eeh_has_flag (EEH_FORCE_DISABLED )) +if (!pdn ||eeh_has_flag (EEH_FORCE_DISABLED ))return ;pr_debug ("%s: EEH: Setting up device %s.\n" , __func__,pci_name (pdev));
Greg Kroah-Hartman
maintainerPATCH 521/521 serial: tegra: Only print FIFO error message when an error occurs
In reply to Greg Kroah-HartmanFrom: Jon Hunter <[email protected]>
commit cc9ca4d95846cbbece48d9cd385550f8fba6a3c1 upstream.
The Tegra serial driver always prints an error message when enabling the FIFO for devices that have support for checking the FIFO enable status. Fix this by displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the FIFO failed and display the error code.
--- drivers/tty/serial/serial-tegra.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/tty/serial/serial-tegra.c +4 -2
@@ -991,9 +991,11 @@ static int tegra_uart_hw_init(struct tegif (tup->cdata->fifo_mode_enable_status) { ret =tegra_uart_wait_fifo_mode_enabled (tup); -dev_err (tup->uport.dev,"FIFO mode not enabled\n" ); -if (ret <0 ) +if (ret <0 ) { +dev_err (tup->uport.dev, +"Failed to enable FIFO mode: %d\n" , ret);return ret; + } }else {/* * For all tegra devices (up to t210), there is a hardware
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.19.270 release. There are 521 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.270 release. There are 521 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 18 Jan 2023 15:47:28 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.270-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.270 release. There are 521 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 18 Jan 2023 15:47:28 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.270-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.19:
10 builds: 10 pass, 0 fail
22 boots: 22 pass, 0 fail
40 tests: 40 pass, 0 failLinux version: 4.19.270-rc1-gc75d2b5524ab
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Jon
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.270 release. There are 521 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 18 Jan 2023 15:47:28 +0000. Anything received after that time might be too late.
Build test (gcc version 11.3.1 20221127):
mips: 63 configs -> no failure
arm: 115 configs -> no failure
arm64: 2 configs -> no failurex86_64: 4 configs -> no failure
alpha allmodconfig -> no failure
powerpc allmodconfig -> no failure
riscv allmodconfig -> fails
s390 allmodconfig -> no failure
xtensa allmodconfig -> no failure
Note:
riscv build fails with the error:arch/riscv/kernel/stacktrace.c: In function 'walk_stackframe':arch/riscv/kernel/stacktrace.c:66:36: error: 'struct pt_regs' has no member named 'epc'; did you mean 'sepc'?
66 | if (regs && (regs->epc == pc) && (frame->fp & 0x7)) {
| ^~~
Boot test:x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression. [1]
[1]. https://openqa.qa.codethink.co.uk/tests/2659
Signature · 2 lines
Regards Sudip