5.13.2-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 574/800 net: dsa: sja1105: fix NULL pointer dereference in sja1105_reload_cbs()
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit be7f62eebaff2f86c1467a2d33930a0a7a87675b ]
priv->cbs is an array of priv->info->num_cbs_shapers elements of type struct sja1105_cbs_entry which only get allocated if CONFIG_NET_SCH_CBS is enabled.
However, sja1105_reload_cbs() is called from sja1105_static_config_reload() which in turn is called for any of the items in sja1105_reset_reasons, therefore during the normal runtime of the driver and not just from a code path which can be triggered by the tc-cbs offload.
The sja1105_reload_cbs() function does not contain a check whether the priv->cbs array is NULL or not, it just assumes it isn't and proceeds to iterate through the credit-based shaper elements. This leads to a NULL pointer dereference.
The solution is to return success if the priv->cbs array has not been allocated, since sja1105_reload_cbs() has nothing to do.
--- drivers/net/dsa/sja1105/sja1105_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/dsa/sja1105/sja1105_main.c +6 -0
@@ -1798,6 +1798,12 @@ static int sja1105_reload_cbs(struct sja1105_private *priv) {int rc =0 , i; +/* The credit based shapers are only allocated if +* CONFIG_NET_SCH_CBS is enabled. +*/ +if (!priv->cbs) +return 0 ; +for (i =0 ; i < priv->info->num_cbs_shapers; i++) {struct sja1105_cbs_entry *cbs = &priv->cbs[i];
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 575/800 bpfilter: Specify the log level for the kmsg message
In reply to Greg Kroah-HartmanFrom: Gary Lin <[email protected]>
[ Upstream commit a196fa78a26571359740f701cf30d774eb8a72cb ]
Per the kmsg document [0], if we don't specify the log level with a prefix "<N>" in the message string, the default log level will be applied to the message. Since the default level could be warning(4), this would make the log utility such as journalctl treat the message, "Started bpfilter", as a warning. To avoid confusion, this commit adds the prefix "<5>" to make the message always a notice.
[0] https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg
--- net/bpfilter/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bpfilter/main.c +1 -1
@@ -57,7 +57,7 @@ int main(void) { debug_f =fopen ("/dev/kmsg" ,"w" );setvbuf (debug_f,0 , _IOLBF,0 ); -fprintf (debug_f,"Started bpfilter\n" ); +fprintf (debug_f,"<5>Started bpfilter\n" );loop ();fclose (debug_f);return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 576/800 RDMA/cma: Fix incorrect Packet Lifetime calculation
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit e84045eab69c625bc0b0bf24d8e05bc65da1eed1 ]
An approximation for the PacketLifeTime is half the local ACK timeout. The encoding for both timers are logarithmic.
If the local ACK timeout is set, but zero, it means the timer is disabled. In this case, we choose the CMA_IBOE_PACKET_LIFETIME value, since 50% of infinite makes no sense.
Before this commit, the PacketLifeTime became 255 if local ACK timeout was zero (not running).
Fixed by explicitly testing for timeout being zero.
--- drivers/infiniband/core/cma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/core/cma.c +4 -2
@@ -3096,8 +3096,10 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)* as a reasonable approximation for RoCE networks. */ mutex_lock (&id_priv->qp_mutex); - route->path_rec->packet_life_time = id_priv->timeout_set ? - id_priv->timeout -1 :CMA_IBOE_PACKET_LIFETIME ; +if (id_priv->timeout_set && id_priv->timeout) + route->path_rec->packet_life_time = id_priv->timeout -1 ; +else + route->path_rec->packet_life_time =CMA_IBOE_PACKET_LIFETIME ;mutex_unlock (&id_priv->qp_mutex);if (!route->path_rec->mtu) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 577/800 gve: Fix swapped vars when fetching max queues
In reply to Greg Kroah-HartmanFrom: Bailey Forrest <[email protected]>
[ Upstream commit 1db1a862a08f85edc36aad091236ac9b818e949e ]
--- drivers/net/ethernet/google/gve/gve_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/google/gve/gve_main.c +2 -2
@@ -1295,8 +1295,8 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)gve_write_version (®_bar->driver_version);/* Get max queues to alloc etherdev */ - max_rx_queues =ioread32be (®_bar->max_tx_queues); - max_tx_queues =ioread32be (®_bar->max_rx_queues); + max_tx_queues =ioread32be (®_bar->max_tx_queues); + max_rx_queues =ioread32be (®_bar->max_rx_queues);/* Alloc and setup the netdev and priv */ dev =alloc_etherdev_mqs (sizeof (*priv), max_tx_queues, max_rx_queues);if (!dev) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 578/800 Revert "be2net: disable bh with spin_lock in be_process_mcc"
In reply to Greg Kroah-HartmanFrom: Petr Oros <[email protected]>
[ Upstream commit d6765985a42a660f078896d5c5b27f97c580a490 ]
Patch was based on wrong presumption that be_poll can be called only from bh context. It reintroducing old regression (also reverted) and causing deadlock when we use netconsole with benet in bonding.
Old revert: commit 072a9c486004 ("netpoll: revert 6bdb7fe3104 and fix be_poll() instead")
[ 331.269715] bond0: (slave enp0s7f0): Releasing backup interface [ 331.270121] CPU: 4 PID: 1479 Comm: ifenslave Not tainted 5.13.0-rc7+ #2 [ 331.270122] Call Trace: [ 331.270122] [c00000001789f200] [c0000000008c505c] dump_stack+0x100/0x174 (unreliable) [ 331.270124] [c00000001789f240] [c008000001238b9c] be_poll+0x64/0xe90 [be2net] [ 331.270125] [c00000001789f330] [c000000000d1e6e4] netpoll_poll_dev+0x174/0x3d0 [ 331.270127] [c00000001789f400] [c008000001bc167c] bond_poll_controller+0xb4/0x130 [bonding] [ 331.270128] [c00000001789f450] [c000000000d1e624] netpoll_poll_dev+0xb4/0x3d0 [ 331.270129] [c00000001789f520] [c000000000d1ed88] netpoll_send_skb+0x448/0x470 [ 331.270130] [c00000001789f5d0] [c0080000011f14f8] write_msg+0x180/0x1b0 [netconsole] [ 331.270131] [c00000001789f640] [c000000000230c0c] console_unlock+0x54c/0x790 [ 331.270132] [c00000001789f7b0] [c000000000233098] vprintk_emit+0x2d8/0x450 [ 331.270133] [c00000001789f810] [c000000000234758] vprintk+0xc8/0x270 [ 331.270134] [c00000001789f850] [c000000000233c28] printk+0x40/0x54 [ 331.270135] [c00000001789f870] [c000000000ccf908] __netdev_printk+0x150/0x198 [ 331.270136] [c00000001789f910] [c000000000ccfdb4] netdev_info+0x68/0x94 [ 331.270137] [c00000001789f950] [c008000001bcbd70] __bond_release_one+0x188/0x6b0 [bonding] [ 331.270138] [c00000001789faa0] [c008000001bcc6f4] bond_do_ioctl+0x42c/0x490 [bonding] [ 331.270139] [c00000001789fb60] [c000000000d0d17c] dev_ifsioc+0x17c/0x400 [ 331.270140] [c00000001789fbc0] [c000000000d0db70] dev_ioctl+0x390/0x890 [ 331.270141] [c00000001789fc10] [c000000000c7c76c] sock_do_ioctl+0xac/0x1b0 [ 331.270142] [c00000001789fc90] [c000000000c7ffac] sock_ioctl+0x31c/0x6e0 [ 331.270143] [c00000001789fd60] [c0000000005b9728] sys_ioctl+0xf8/0x150 [ 331.270145] [c00000001789fdb0] [c0000000000336c0] system_call_exception+0x160/0x2f0 [ 331.270146] [c00000001789fe10] [c00000000000d35c] system_call_common+0xec/0x278 [ 331.270147] --- interrupt: c00 at 0x7fffa6c6ec00 [ 331.270147] NIP: 00007fffa6c6ec00 LR: 0000000105c4185c CTR: 0000000000000000 [ 331.270148] REGS: c00000001789fe80 TRAP: 0c00 Not tainted (5.13.0-rc7+) [ 331.270148] MSR: 800000000280f033 <SF,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE> CR: 28000428 XER: 00000000 [ 331.270155] IRQMASK: 0 [ 331.270156] GPR00: 0000000000000036 00007fffd494d5b0 00007fffa6d57100 0000000000000003 [ 331.270158] GPR04: 0000000000008991 00007fffd494d6d0 0000000000000008 00007fffd494f28c [ 331.270161] GPR08: 0000000000000003 0000000000000000 0000000000000000 0000000000000000 [ 331.270164] GPR12: 0000000000000000 00007fffa6dfa220 0000000000000000 0000000000000000 [ 331.270167] GPR16: 0000000105c44880 0000000000000000 0000000105c60088 0000000105c60318 [ 331.270170] GPR20: 0000000105c602c0 0000000105c44560 0000000000000000 0000000000000000 [ 331.270172] GPR24: 00007fffd494dc50 00007fffd494d6a8 0000000105c60008 00007fffd494d6d0 [ 331.270175] GPR28: 00007fffd494f27e 0000000105c6026c 00007fffd494f284 0000000000000000 [ 331.270178] NIP [00007fffa6c6ec00] 0x7fffa6c6ec00 [ 331.270178] LR [0000000105c4185c] 0x105c4185c [ 331.270179] --- interrupt: c00
This reverts commit d0d006a43e9a7a796f6f178839c92fcc222c564d.
--- drivers/net/ethernet/emulex/benet/be_cmds.c | 6 ++++-- drivers/net/ethernet/emulex/benet/be_main.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/emulex/benet/be_cmds.c +4 -2
@@ -550,7 +550,7 @@ int be_process_mcc(struct be_adapter *adapter)int num =0 , status =0 ;struct be_mcc_obj *mcc_obj = &adapter->mcc_obj; -spin_lock_bh (&adapter->mcc_cq_lock); +spin_lock (&adapter->mcc_cq_lock);while ((compl =be_mcc_compl_get (adapter))) {if (compl->flags &CQE_FLAGS_ASYNC_MASK ) {
@@ -566,7 +566,7 @@ int be_process_mcc(struct be_adapter *adapter)if (num)be_cq_notify (adapter, mcc_obj->cq.id, mcc_obj->rearm_cq, num); -spin_unlock_bh (&adapter->mcc_cq_lock); +spin_unlock (&adapter->mcc_cq_lock);return status; }
@@ -581,7 +581,9 @@ static int be_mcc_wait_compl(struct be_adapter *adapter)if (be_check_error (adapter,BE_ERROR_ANY ))return -EIO ; +local_bh_disable (); status =be_process_mcc (adapter); +local_bh_enable ();if (atomic_read (&mcc_obj->q.used) ==0 )break ;
drivers/net/ethernet/emulex/benet/be_main.c +2 -0
@@ -5501,7 +5501,9 @@ static void be_worker(struct work_struct *work)* mcc completions */ if (!netif_running (adapter->netdev)) { +local_bh_disable ();be_process_mcc (adapter); +local_bh_enable (); goto reschedule; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 579/800 clk: zynqmp: fix compile testing without ZYNQMP_FIRMWARE
In reply to Greg Kroah-HartmanFrom: Michal Simek <[email protected]>
[ Upstream commit 6c9feabc2c6bd49abbd2130341e7cb91f42d3fa5 ]
When the firmware code is disabled, the incomplete error handling in the clk driver causes compile-time warnings:
drivers/clk/zynqmp/pll.c: In function 'zynqmp_pll_recalc_rate':drivers/clk/zynqmp/pll.c:147:29: error: 'fbdiv' is used uninitialized [-Werror=uninitialized]
147 | rate = parent_rate * fbdiv;
| ~~~~~~~~~~~~^~~~~~~
In function 'zynqmp_pll_get_mode',
inlined from 'zynqmp_pll_recalc_rate' at drivers/clk/zynqmp/pll.c:148:6:
drivers/clk/zynqmp/pll.c:61:27: error: 'ret_payload' is used uninitialized [-Werror=uninitialized]
61 | return ret_payload[1];
| ~~~~~~~~~~~^~~
drivers/clk/zynqmp/pll.c: In function 'zynqmp_pll_recalc_rate':
drivers/clk/zynqmp/pll.c:53:13: note: 'ret_payload' declared here
53 | u32 ret_payload[PAYLOAD_ARG_CNT];
| ^~~~~~~~~~~drivers/clk/zynqmp/clk-mux-zynqmp.c: In function 'zynqmp_clk_mux_get_parent':drivers/clk/zynqmp/clk-mux-zynqmp.c:57:16: error: 'val' is used uninitialized [-Werror=uninitialized]
57 | return val;
| ^~~
As it was apparently intentional to support this for compile testing purposes, change the code to have just enough error handling for the compiler to not notice the remaining bugs.
--- drivers/clk/zynqmp/clk-mux-zynqmp.c | 10 ++++++++-- drivers/clk/zynqmp/pll.c | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-)
drivers/clk/zynqmp/clk-mux-zynqmp.c +8 -2
@@ -38,7 +38,7 @@ struct zynqmp_clk_mux {* zynqmp_clk_mux_get_parent() - Get parent of clock * @hw: handle between common and hardware-specific interfaces * -* Return: Parent index +* Return: Parent index on success or number of parents in case of error */ static u8 zynqmp_clk_mux_get_parent (struct clk_hw *hw) {
@@ -50,9 +50,15 @@ static u8 zynqmp_clk_mux_get_parent(struct clk_hw *hw) ret =zynqmp_pm_clock_getparent (clk_id, &val); -if (ret) +if (ret) {pr_warn_once ("%s() getparent failed for clock: %s, ret = %d\n" , __func__, clk_name, ret); +/* +* clk_core_get_parent_by_index() takes num_parents as incorrect +* index which is exactly what I want to return here +*/ +return clk_hw_get_num_parents (hw); + }return val; }
drivers/clk/zynqmp/pll.c +16 -6
@@ -31,8 +31,9 @@ struct zynqmp_pll {#define PS_PLL_VCO_MAX 3000000000ULenum pll_mode { -PLL_MODE_INT , -PLL_MODE_FRAC , +PLL_MODE_INT =0 , +PLL_MODE_FRAC =1 , +PLL_MODE_ERROR =2 , };#define FRAC_OFFSET 0x8
@@ -54,9 +55,11 @@ static inline enum pll_mode zynqmp_pll_get_mode(struct clk_hw *hw)int ret; ret =zynqmp_pm_get_pll_frac_mode (clk_id, ret_payload); -if (ret) +if (ret) {pr_warn_once ("%s() PLL get frac mode failed for %s, ret = %d\n" , __func__, clk_name, ret); +return PLL_MODE_ERROR ; + }return ret_payload[1 ]; }
@@ -126,7 +129,7 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate,* @hw: Handle between common and hardware-specific interfaces * @parent_rate: Clock frequency of parent clock * -* Return: Current clock frequency +* Return: Current clock frequency or 0 in case of error */ static unsigned long zynqmp_pll_recalc_rate (struct clk_hw *hw,unsigned long parent_rate)
@@ -138,14 +141,21 @@ static unsigned long zynqmp_pll_recalc_rate(struct clk_hw *hw,unsigned long rate, frac;u32 ret_payload[PAYLOAD_ARG_CNT ];int ret; +enum pll_mode mode; ret =zynqmp_pm_clock_getdivider (clk_id, &fbdiv); -if (ret) +if (ret) {pr_warn_once ("%s() get divider failed for %s, ret = %d\n" , __func__, clk_name, ret); +return 0ul ; + } + + mode =zynqmp_pll_get_mode (hw); +if (mode ==PLL_MODE_ERROR ) +return 0ul ; rate = parent_rate * fbdiv; -if (zynqmp_pll_get_mode (hw) ==PLL_MODE_FRAC ) { +if (mode ==PLL_MODE_FRAC ) {zynqmp_pm_get_pll_frac_data (clk_id, ret_payload); data = ret_payload[1 ]; frac = (parent_rate * data) /FRAC_DIV ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 580/800 Bluetooth: virtio_bt: add missing null pointer check on alloc_skb call return
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 1cb027f2f803d0a7abe9c291f0625e6bccd25999 ]
The call to alloc_skb with the GFP_KERNEL flag can return a null sk_buff pointer, so add a null check to avoid any null pointer deference issues.
Addresses-Coverity: ("Dereference null return value")
--- drivers/bluetooth/virtio_bt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/virtio_bt.c +3 -0
@@ -34,6 +34,9 @@ static int virtbt_add_inbuf(struct virtio_bluetooth *vbt)int err; skb =alloc_skb (1000 ,GFP_KERNEL ); +if (!skb) +return -ENOMEM ; +sg_init_one (sg, skb->data,1000 ); err =virtqueue_add_inbuf (vq, sg,1 , skb,GFP_KERNEL );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 581/800 Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 799acb9347915bfe4eac0ff2345b468f0a1ca207 ]
This fixes parsing of LTV entries when the length is 0.
Found with:
tools/mgmt-tester -s "Add Advertising - Success (ScRsp only)"
Add Advertising - Success (ScRsp only) - run
Sending Add Advertising (0x003e)
Test condition added, total 1
[ 11.004577] ================================================================== [ 11.005292] BUG: KASAN: slab-out-of-bounds in tlv_data_is_valid+0x87/0xe0 [ 11.005984] Read of size 1 at addr ffff888002c695b0 by task mgmt-tester/87 [ 11.006711] [ 11.007176] [ 11.007429] Allocated by task 87: [ 11.008151] [ 11.008438] The buggy address belongs to the object at ffff888002c69580 [ 11.008438] which belongs to the cache kmalloc-64 of size 64 [ 11.010526] The buggy address is located 48 bytes inside of [ 11.010526] 64-byte region [ffff888002c69580, ffff888002c695c0) [ 11.012423] The buggy address belongs to the page: [ 11.013291] [ 11.013544] Memory state around the buggy address: [ 11.014359] ffff888002c69480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.015453] ffff888002c69500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.016232] >ffff888002c69580: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc [ 11.017010] ^ [ 11.017547] ffff888002c69600: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc [ 11.018296] ffff888002c69680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.019116] ==================================================================
--- net/bluetooth/mgmt.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/mgmt.c +3 -0
@@ -7585,6 +7585,9 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,for (i =0 , cur_len =0 ; i < len; i += (cur_len +1 )) { cur_len = data[i]; +if (!cur_len) +continue ; +if (data[i +1 ] ==EIR_FLAGS && (!is_adv_data ||flags_managed (adv_flags)))return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 582/800 Bluetooth: Fix Set Extended (Scan Response) Data
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit c9ed0a7077306f9d41d74fb006ab5dbada8349c5 ]
These command do have variable length and the length can go up to 251, so this changes the struct to not use a fixed size and then when creating the PDU only the actual length of the data send to the controller.
--- include/net/bluetooth/hci.h | 6 ++-- include/net/bluetooth/hci_core.h | 8 ++--- net/bluetooth/hci_request.c | 51 ++++++++++++++++++-------------- 3 files changed, 37 insertions(+), 28 deletions(-)
include/net/bluetooth/hci.h +4 -2
@@ -1774,13 +1774,15 @@ struct hci_cp_ext_adv_set {__u8 max_events; } __packed; +#define HCI_MAX_EXT_AD_LENGTH 251 +#define HCI_OP_LE_SET_EXT_ADV_DATA 0x2037struct hci_cp_le_set_ext_adv_data {__u8 handle;__u8 operation;__u8 frag_pref;__u8 length; -__u8 data[HCI_MAX_AD_LENGTH ]; +__u8 data[]; } __packed;#define HCI_OP_LE_SET_EXT_SCAN_RSP_DATA 0x2038
@@ -1789,7 +1791,7 @@ struct hci_cp_le_set_ext_scan_rsp_data {__u8 operation;__u8 frag_pref;__u8 length; -__u8 data[HCI_MAX_AD_LENGTH ]; +__u8 data[]; } __packed;#define LE_SET_ADV_DATA_OP_COMPLETE 0x03
include/net/bluetooth/hci_core.h +4 -4
@@ -228,9 +228,9 @@ struct adv_info {__u16 remaining_time;__u16 duration;__u16 adv_data_len; -__u8 adv_data[HCI_MAX_AD_LENGTH ]; +__u8 adv_data[HCI_MAX_EXT_AD_LENGTH ];__u16 scan_rsp_len; -__u8 scan_rsp_data[HCI_MAX_AD_LENGTH ]; +__u8 scan_rsp_data[HCI_MAX_EXT_AD_LENGTH ];__s8 tx_power;__u32 min_interval;__u32 max_interval;
@@ -550,9 +550,9 @@ struct hci_dev {DECLARE_BITMAP (dev_flags, __HCI_NUM_FLAGS);__s8 adv_tx_power; -__u8 adv_data[HCI_MAX_AD_LENGTH ]; +__u8 adv_data[HCI_MAX_EXT_AD_LENGTH ];__u8 adv_data_len; -__u8 scan_rsp_data[HCI_MAX_AD_LENGTH ]; +__u8 scan_rsp_data[HCI_MAX_EXT_AD_LENGTH ];__u8 scan_rsp_data_len;struct list_head adv_instances;
net/bluetooth/hci_request.c +29 -22
85 lines not on this page · raw message
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 583/800 Bluetooth: Fix handling of HCI_LE_Advertising_Set_Terminated event
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 23837a6d7a1a61818ed94a6b8af552d6cf7d32d5 ]
Error status of this event means that it has ended due reasons other than a connection:
'If advertising has terminated as a result of the advertising duration elapsing, the Status parameter shall be set to the error code Advertising Timeout (0x3C).'
'If advertising has terminated because the Max_Extended_Advertising_Events was reached, the Status parameter shall be set to the error code Limit Reached (0x43).'
--- net/bluetooth/hci_event.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +12 -1
@@ -5296,8 +5296,19 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb)BT_DBG ("%s status 0x%2.2x" , hdev->name, ev->status); -if (ev->status) +if (ev->status) { +struct adv_info *adv; + + adv =hci_find_adv_instance (hdev, ev->handle); +if (!adv) +return ; + +/* Remove advertising as it has been terminated */ +hci_remove_adv_instance (hdev, ev->handle); +mgmt_advertising_removed (NULL , hdev, ev->handle); +return ; + } conn =hci_conn_hash_lookup_handle (hdev,__le16_to_cpu (ev->conn_handle));if (conn) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 584/800 clk: qcom: gcc: Add support for a new frequency for SC7280
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit ca1c667f4be935825fffb232a106c9d3f1c09b0b ]
There is a requirement to support 52MHz for qup clocks for bluetooth usecase, thus update the frequency table to support the frequency.
--- drivers/clk/qcom/gcc-sc7280.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/gcc-sc7280.c +1 -0
@@ -716,6 +716,7 @@ static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s2_clk_src[] = {F (29491200 ,P_GCC_GPLL0_OUT_EVEN ,1 ,1536 ,15625 ),F (32000000 ,P_GCC_GPLL0_OUT_EVEN ,1 ,8 ,75 ),F (48000000 ,P_GCC_GPLL0_OUT_EVEN ,1 ,4 ,25 ), +F (52174000 ,P_GCC_GPLL0_OUT_MAIN ,1 ,2 ,23 ),F (64000000 ,P_GCC_GPLL0_OUT_EVEN ,1 ,16 ,75 ),F (75000000 ,P_GCC_GPLL0_OUT_EVEN ,4 ,0 ,0 ), F(80000000, P_GCC_GPLL0_OUT_EVEN, 1, 4, 15),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 585/800 clk: actions: Fix UART clock dividers on Owl S500 SoC
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 2dca2a619a907579e3e65e7c1789230c2b912e88 ]
Use correct divider registers for the Actions Semi Owl S500 SoC's UART clocks.
--- drivers/clk/actions/owl-s500.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/actions/owl-s500.c +6 -6
@@ -305,7 +305,7 @@ static OWL_COMP_FIXED_FACTOR(i2c3_clk, "i2c3_clk", "ethernet_pll_clk", static OWL_COMP_DIV(uart0_clk, "uart0_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART0CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,6 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART0CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart1_clk, "uart1_clk", uart_clk_mux_p,
@@ -317,31 +317,31 @@ static OWL_COMP_DIV(uart1_clk, "uart1_clk", uart_clk_mux_p, static OWL_COMP_DIV(uart2_clk, "uart2_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART2CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,8 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART2CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart3_clk, "uart3_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART3CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,19 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART3CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart4_clk, "uart4_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART4CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,20 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART4CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart5_clk, "uart5_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART5CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,21 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART5CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(uart6_clk, "uart6_clk", uart_clk_mux_p,OWL_MUX_HW (CMU_UART6CLK ,16 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN1 ,18 ,0 ), -OWL_DIVIDER_HW (CMU_UART1CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), +OWL_DIVIDER_HW (CMU_UART6CLK ,0 ,8 ,CLK_DIVIDER_ROUND_CLOSEST ,NULL ), CLK_IGNORE_UNUSED); static OWL_COMP_DIV(i2srx_clk, "i2srx_clk", i2s_clk_mux_p,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 586/800 clk: actions: Fix SD clocks factor table on Owl S500 SoC
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit fe1f71e338d77814da3ef44e9f64d32981a6ccdf ]
Drop the unsupported entries in the factor table used for the SD[0-2] clocks definitions on the Actions Semi Owl S500 SoC.
--- drivers/clk/actions/owl-s500.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clk/actions/owl-s500.c +2 -4
@@ -127,8 +127,7 @@ static struct clk_factor_table sd_factor_table[] = { { 12, 1, 13 }, { 13, 1, 14 }, { 14, 1, 15 }, { 15, 1, 16 }, { 16, 1, 17 }, { 17, 1, 18 }, { 18, 1, 19 }, { 19, 1, 20 }, { 20, 1, 21 }, { 21, 1, 22 }, { 22, 1, 23 }, { 23, 1, 24 }, - { 24, 1, 25 }, { 25, 1, 26 }, { 26, 1, 27 }, { 27, 1, 28 }, - { 28, 1, 29 }, { 29, 1, 30 }, { 30, 1, 31 }, { 31, 1, 32 }, + { 24, 1, 25 },/* bit8: /128 */ { 256, 1, 1 * 128 }, { 257, 1, 2 * 128 }, { 258, 1, 3 * 128 }, { 259, 1, 4 * 128 },
@@ -137,8 +136,7 @@ static struct clk_factor_table sd_factor_table[] = { { 268, 1, 13 * 128 }, { 269, 1, 14 * 128 }, { 270, 1, 15 * 128 }, { 271, 1, 16 * 128 }, { 272, 1, 17 * 128 }, { 273, 1, 18 * 128 }, { 274, 1, 19 * 128 }, { 275, 1, 20 * 128 }, { 276, 1, 21 * 128 }, { 277, 1, 22 * 128 }, { 278, 1, 23 * 128 }, { 279, 1, 24 * 128 }, - { 280, 1, 25 * 128 }, { 281, 1, 26 * 128 }, { 282, 1, 27 * 128 }, { 283, 1, 28 * 128 }, - { 284, 1, 29 * 128 }, { 285, 1, 30 * 128 }, { 286, 1, 31 * 128 }, { 287, 1, 32 * 128 }, + { 280, 1, 25 * 128 }, { 0, 0, 0 }, };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 587/800 clk: actions: Fix bisp_factor_table based clocks on Owl S500 SoC
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit a8f1f03caa51aa7a69c671aa87c475034db7d368 ]
The following clocks of the Actions Semi Owl S500 SoC have been defined to use a shared clock factor table 'bisp_factor_table[]': DE[1-2], VCE, VDE, BISP, SENSOR[0-1]
There are several issues involved in this approach:
* 'bisp_factor_table[]' describes the configuration of a regular 8-rates divider, so its usage is redundant. Additionally, judging by the BISP clock context, it is incomplete since it maps only 8 out of 12 possible entries.
* The clocks mentioned above are not identical in terms of the available rates, therefore cannot rely on the same factor table. Specifically, BISP and SENSOR* are standard 12-rate dividers so their configuration should rely on a proper clock div table, while VCE and VDE require a factor table that is a actually a subset of the one needed for DE[1-2] clocks.
Let's fix this by implementing the following:
* Add new factor tables 'de_factor_table' and 'hde_factor_table' to properly handle DE[1-2], VCE and VDE clocks.
* Add a common div table 'std12rate_div_table' for BISP and SENSOR[0-1] clocks converted to OWL_COMP_DIV.
* Drop the now unused 'bisp_factor_table[]'.
Additionally, drop the CLK_IGNORE_UNUSED flag for SENSOR[0-1] since there is no reason to always keep ON those clocks.
--- drivers/clk/actions/owl-s500.c | 44 ++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 15 deletions(-)
drivers/clk/actions/owl-s500.c +29 -15
@@ -140,9 +140,16 @@ static struct clk_factor_table sd_factor_table[] = { { 0, 0, 0 }, }; -static struct clk_factor_table bisp_factor_table[] = { - {0 ,1 ,1 }, {1 ,1 ,2 }, {2 ,1 ,3 }, {3 ,1 ,4 }, - {4 ,1 ,5 }, {5 ,1 ,6 }, {6 ,1 ,7 }, {7 ,1 ,8 }, +static struct clk_factor_table de_factor_table[] = { + {0 ,1 ,1 }, {1 ,2 ,3 }, {2 ,1 ,2 }, {3 ,2 ,5 }, + {4 ,1 ,3 }, {5 ,1 ,4 }, {6 ,1 ,6 }, {7 ,1 ,8 }, + {8 ,1 ,12 }, + {0 ,0 ,0 }, +}; + +static struct clk_factor_table hde_factor_table[] = { + {0 ,1 ,1 }, {1 ,2 ,3 }, {2 ,1 ,2 }, {3 ,2 ,5 }, + {4 ,1 ,3 }, {5 ,1 ,4 }, {6 ,1 ,6 }, {7 ,1 ,8 }, {0 ,0 ,0 }, };
@@ -156,6 +163,13 @@ static struct clk_div_table rmii_ref_div_table[] = { { 0, 0 }, }; +static struct clk_div_table std12rate_div_table[] = { + {0 ,1 }, {1 ,2 }, {2 ,3 }, {3 ,4 }, + {4 ,5 }, {5 ,6 }, {6 ,7 }, {7 ,8 }, + {8 ,9 }, {9 ,10 }, {10 ,11 }, {11 ,12 }, + {0 ,0 }, +}; +static struct clk_div_table i2s_div_table[] = { {0 ,1 }, {1 ,2 }, {2 ,3 }, {3 ,4 }, { 4, 6 }, { 5, 8 }, { 6, 12 }, { 7, 16 },
@@ -191,39 +205,39 @@ static OWL_DIVIDER(rmii_ref_clk, "rmii_ref_clk", "ethernet_pll_clk", CMU_ETHERNE/* factor clocks */ static OWL_FACTOR(ahb_clk, "ahb_clk", "h_clk", CMU_BUSCLK1, 2, 2, ahb_factor_table, 0, 0); -static OWL_FACTOR(de1_clk, "de_clk1", "de_clk", CMU_DECLK, 0, 3, bisp_factor_table, 0, 0); -static OWL_FACTOR(de2_clk, "de_clk2", "de_clk", CMU_DECLK, 4, 3, bisp_factor_table, 0, 0); +static OWL_FACTOR(de1_clk, "de_clk1", "de_clk", CMU_DECLK, 0, 4, de_factor_table, 0, 0); +static OWL_FACTOR(de2_clk, "de_clk2", "de_clk", CMU_DECLK, 4, 4, de_factor_table, 0, 0);/* composite clocks */ static OWL_COMP_FACTOR(vce_clk, "vce_clk", hde_clk_mux_p,OWL_MUX_HW (CMU_VCECLK ,4 ,2 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,26 ,0 ), -OWL_FACTOR_HW (CMU_VCECLK ,0 ,3 ,0 , bisp_factor_table), +OWL_FACTOR_HW (CMU_VCECLK ,0 ,3 ,0 , hde_factor_table), 0); static OWL_COMP_FACTOR(vde_clk, "vde_clk", hde_clk_mux_p,OWL_MUX_HW (CMU_VDECLK ,4 ,2 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,25 ,0 ), -OWL_FACTOR_HW (CMU_VDECLK ,0 ,3 ,0 , bisp_factor_table), +OWL_FACTOR_HW (CMU_VDECLK ,0 ,3 ,0 , hde_factor_table), 0); -static OWL_COMP_FACTOR(bisp_clk, "bisp_clk", bisp_clk_mux_p, +static OWL_COMP_DIV(bisp_clk, "bisp_clk", bisp_clk_mux_p,OWL_MUX_HW (CMU_BISPCLK ,4 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,14 ,0 ), -OWL_FACTOR_HW (CMU_BISPCLK ,0 ,3 ,0 , bisp_factor_table), +OWL_DIVIDER_HW (CMU_BISPCLK ,0 ,4 ,0 , std12rate_div_table), 0); -static OWL_COMP_FACTOR(sensor0_clk, "sensor0_clk", sensor_clk_mux_p, +static OWL_COMP_DIV(sensor0_clk, "sensor0_clk", sensor_clk_mux_p,OWL_MUX_HW (CMU_SENSORCLK ,4 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,14 ,0 ), -OWL_FACTOR_HW (CMU_SENSORCLK ,0 ,3 ,0 , bisp_factor_table), - CLK_IGNORE_UNUSED); +OWL_DIVIDER_HW (CMU_SENSORCLK ,0 ,4 ,0 , std12rate_div_table), + 0); -static OWL_COMP_FACTOR(sensor1_clk, "sensor1_clk", sensor_clk_mux_p, +static OWL_COMP_DIV(sensor1_clk, "sensor1_clk", sensor_clk_mux_p,OWL_MUX_HW (CMU_SENSORCLK ,4 ,1 ),OWL_GATE_HW (CMU_DEVCLKEN0 ,14 ,0 ), -OWL_FACTOR_HW (CMU_SENSORCLK ,8 ,3 ,0 , bisp_factor_table), - CLK_IGNORE_UNUSED); +OWL_DIVIDER_HW (CMU_SENSORCLK ,8 ,4 ,0 , std12rate_div_table), + 0); static OWL_COMP_FACTOR(sd0_clk, "sd0_clk", sd_clk_mux_p, OWL_MUX_HW(CMU_SD0CLK, 9, 1),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 588/800 clk: actions: Fix AHPPREDIV-H-AHB clock chain on Owl S500 SoC
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit fd90b5b9045274360b12cea0f2ce50f3bcfb25cc ]
There are a few issues with the setup of the Actions Semi Owl S500 SoC's clock chain involving AHPPREDIV, H and AHB clocks:
* AHBPREDIV clock is defined as a muxer only, although it also acts as a divider.
* H clock is using a wrong divider register offset
* AHB is defined as a multi-rate factor clock, but it is actually just a fixed pass clock.
Let's provide the following fixes:
* Change AHBPREDIV clock to an ungated OWL_COMP_DIV definition.
* Use the correct register shift value in the OWL_DIVIDER definition for H clock
* Drop the unneeded 'ahb_factor_table[]' and change AHB clock to an ungated OWL_COMP_FIXED_FACTOR definition.
--- drivers/clk/actions/owl-s500.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/clk/actions/owl-s500.c +11 -8
@@ -153,11 +153,6 @@ static struct clk_factor_table hde_factor_table[] = { { 0, 0, 0 }, }; -static struct clk_factor_table ahb_factor_table[] = { - {1 ,1 ,2 }, {2 ,1 ,3 }, - {0 ,0 ,0 }, -}; -static struct clk_div_table rmii_ref_div_table[] = { {0 ,4 }, {1 ,10 }, { 0, 0 },
@@ -186,7 +181,6 @@ static struct clk_div_table nand_div_table[] = {/* mux clock */ static OWL_MUX(dev_clk, "dev_clk", dev_clk_mux_p, CMU_DEVPLL, 12, 1, CLK_SET_RATE_PARENT); -static OWL_MUX(ahbprediv_clk, "ahbprediv_clk", ahbprediv_clk_mux_p, CMU_BUSCLK1, 8, 3, CLK_SET_RATE_PARENT);/* gate clocks */ static OWL_GATE(gpio_clk, "gpio_clk", "apb_clk", CMU_DEVCLKEN0, 18, 0, 0);
@@ -199,16 +193,25 @@ static OWL_GATE(timer_clk, "timer_clk", "hosc", CMU_DEVCLKEN1, 27, 0, 0); static OWL_GATE(hdmi_clk, "hdmi_clk", "hosc", CMU_DEVCLKEN1, 3, 0, 0);/* divider clocks */ -static OWL_DIVIDER(h_clk, "h_clk", "ahbprediv_clk", CMU_BUSCLK1, 12, 2, NULL, 0, 0); +static OWL_DIVIDER(h_clk, "h_clk", "ahbprediv_clk", CMU_BUSCLK1, 2, 2, NULL, 0, 0); static OWL_DIVIDER(apb_clk, "apb_clk", "ahb_clk", CMU_BUSCLK1, 14, 2, NULL, 0, 0); static OWL_DIVIDER(rmii_ref_clk, "rmii_ref_clk", "ethernet_pll_clk", CMU_ETHERNETPLL, 1, 1, rmii_ref_div_table, 0, 0);/* factor clocks */ -static OWL_FACTOR(ahb_clk, "ahb_clk", "h_clk", CMU_BUSCLK1, 2, 2, ahb_factor_table, 0, 0); static OWL_FACTOR(de1_clk, "de_clk1", "de_clk", CMU_DECLK, 0, 4, de_factor_table, 0, 0); static OWL_FACTOR(de2_clk, "de_clk2", "de_clk", CMU_DECLK, 4, 4, de_factor_table, 0, 0);/* composite clocks */ +static OWL_COMP_DIV(ahbprediv_clk, "ahbprediv_clk", ahbprediv_clk_mux_p, +OWL_MUX_HW (CMU_BUSCLK1 ,8 ,3 ), + { 0 }, +OWL_DIVIDER_HW (CMU_BUSCLK1 ,12 ,2 ,0 ,NULL ), + CLK_SET_RATE_PARENT); + +static OWL_COMP_FIXED_FACTOR(ahb_clk, "ahb_clk", "h_clk", + { 0 }, + 1, 1, 0); + static OWL_COMP_FACTOR(vce_clk, "vce_clk", hde_clk_mux_p,OWL_MUX_HW (CMU_VCECLK ,4 ,2 ), OWL_GATE_HW(CMU_DEVCLKEN0, 26, 0),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 589/800 clk: qcom: clk-alpha-pll: fix CAL_L write in alpha_pll_fabia_prepare
In reply to Greg Kroah-HartmanFrom: Jonathan Marek <[email protected]>
[ Upstream commit 7f54bf2640e877c8a9b4cc7e2b29f82e3ca1a284 ]
Caught this when looking at alpha-pll code. Untested but it is clear that this was intended to write to PLL_CAL_L_VAL and not PLL_ALPHA_VAL.
--- drivers/clk/qcom/clk-alpha-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-alpha-pll.c +1 -1
@@ -1234,7 +1234,7 @@ static int alpha_pll_fabia_prepare(struct clk_hw *hw)return ret;/* Setup PLL for calibration frequency */ -regmap_write (pll->clkr.regmap,PLL_ALPHA_VAL (pll), cal_l); +regmap_write (pll->clkr.regmap,PLL_CAL_L_VAL (pll), cal_l);/* Bringup the PLL at calibration frequency */ ret =clk_alpha_pll_enable (hw);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 590/800 clk: si5341: Wait for DEVICE_READY on startup
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 6e7d2de1e000d36990923ed80d2e78dfcb545cee ]
The Si5341 datasheet warns that before accessing any other registers, including the PAGE register, we need to wait for the DEVICE_READY register to indicate the device is ready, or the process of the device loading its state from NVM can be corrupted. Wait for DEVICE_READY on startup before continuing initialization. This is done using a raw I2C register read prior to setting up regmap to avoid any potential unwanted automatic PAGE register accesses from regmap at this stage.
--- drivers/clk/clk-si5341.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/clk/clk-si5341.c +32 -0
@@ -94,6 +94,7 @@ struct clk_si5341_output_config {#define SI5341_STATUS 0x000C#define SI5341_SOFT_RST 0x001C#define SI5341_IN_SEL 0x0021 +#define SI5341_DEVICE_READY 0x00FE#define SI5341_XAXB_CFG 0x090E#define SI5341_IN_EN 0x0949#define SI5341_INX_TO_PFD_EN 0x094A
@@ -1189,6 +1190,32 @@ static const struct regmap_range_cfg si5341_regmap_ranges[] = { }, }; +static int si5341_wait_device_ready (struct i2c_client *client) +{ +int count; + +/* Datasheet warns: Any attempt to read or write any register other +* than DEVICE_READY before DEVICE_READY reads as 0x0F may corrupt the +* NVM programming and may corrupt the register contents, as they are +* read from NVM. Note that this includes accesses to the PAGE register. +* Also: DEVICE_READY is available on every register page, so no page +* change is needed to read it. +* Do this outside regmap to avoid automatic PAGE register access. +* May take up to 300ms to complete. +*/ +for (count =0 ; count <15 ; ++count) { +s32 result =i2c_smbus_read_byte_data (client, +SI5341_DEVICE_READY ); +if (result <0 ) +return result; +if (result ==0x0F ) +return 0 ; +msleep (20 ); + } +dev_err (&client->dev,"timeout waiting for DEVICE_READY\n" ); +return -EIO ; +} +static const struct regmap_config si5341_regmap_config = { .reg_bits =8 , .val_bits =8 ,
@@ -1385,6 +1412,11 @@ static int si5341_probe(struct i2c_client *client, data->i2c_client = client; +/* Must be done before otherwise touching hardware */ + err =si5341_wait_device_ready (client); +if (err) +return err; +for (i =0 ; i <SI5341_NUM_INPUTS ; ++i) { input =devm_clk_get (&client->dev, si5341_input_clock_names[i]);if (IS_ERR (input)) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 591/800 clk: si5341: Avoid divide errors due to bogus register contents
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 78f6f406026d688868223d5dbeb197a4f7e9a9fd ]
If the Si5341 is being initially programmed and has no stored NVM configuration, some of the register contents may contain unexpected values, such as zeros, which could cause divide by zero errors during driver initialization. Trap errors caused by zero registers or zero clock rates which could result in divide errors later in the code.
--- drivers/clk/clk-si5341.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/clk/clk-si5341.c +13 -2
@@ -624,6 +624,9 @@ static unsigned long si5341_synth_clk_recalc_rate(struct clk_hw *hw, SI5341_SYNTH_N_NUM(synth->index), &n_num, &n_den);if (err <0 )return err; +/* Check for bogus/uninitialized settings */ +if (!n_num || !n_den) +return 0 ;/* * n_num and n_den are shifted left as much as possible, so to prevent
@@ -807,6 +810,9 @@ static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate, {unsigned long r; +if (!rate) +return 0 ; + r = *parent_rate >>1 ;/* If rate is an even divisor, no changes to parent required */
@@ -835,11 +841,16 @@ static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) {struct clk_si5341_output *output =to_clk_si5341_output (hw); -/* Frequency divider is (r_div + 1) * 2 */ -u32 r_div = (parent_rate / rate) >>1 ; +u32 r_div;int err;u8 r[3 ]; +if (!rate) +return -EINVAL ; + +/* Frequency divider is (r_div + 1) * 2 */ + r_div = (parent_rate / rate) >>1 ; +if (r_div <=1 ) r_div =0 ;else if (r_div >=BIT (24 ))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 592/800 clk: si5341: Check for input clock presence and PLL lock on startup
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 71dcc4d1f7d2ad97ff7ab831281bc6893ff713a2 ]
After initializing the device, wait for it to report that the input clock is present and the PLL has locked before declaring success.
--- drivers/clk/clk-si5341.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/clk/clk-si5341.c +26 -0
@@ -92,6 +92,9 @@ struct clk_si5341_output_config {#define SI5341_PN_BASE 0x0002#define SI5341_DEVICE_REV 0x0005#define SI5341_STATUS 0x000C +#define SI5341_LOS 0x000D +#define SI5341_STATUS_STICKY 0x0011 +#define SI5341_LOS_STICKY 0x0012#define SI5341_SOFT_RST 0x001C#define SI5341_IN_SEL 0x0021#define SI5341_DEVICE_READY 0x00FE
@@ -99,6 +102,12 @@ struct clk_si5341_output_config {#define SI5341_IN_EN 0x0949#define SI5341_INX_TO_PFD_EN 0x094A +/* Status bits */ +#define SI5341_STATUS_SYSINCAL BIT(0) +#define SI5341_STATUS_LOSXAXB BIT(1) +#define SI5341_STATUS_LOSREF BIT(2) +#define SI5341_STATUS_LOL BIT(3) +/* Input selection */ #define SI5341_IN_SEL_MASK 0x06#define SI5341_IN_SEL_SHIFT 1
@@ -1416,6 +1425,7 @@ static int si5341_probe(struct i2c_client *client,unsigned int i;struct clk_si5341_output_config config[SI5341_MAX_NUM_OUTPUTS ];bool initialization_required; +u32 status; data =devm_kzalloc (&client->dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -1583,6 +1593,22 @@ static int si5341_probe(struct i2c_client *client,return err; } +/* wait for device to report input clock present and PLL lock */ + err =regmap_read_poll_timeout (data->regmap,SI5341_STATUS , status, + !(status & (SI5341_STATUS_LOSREF |SI5341_STATUS_LOL )), +10000 ,250000 ); +if (err) { +dev_err (&client->dev,"Error waiting for input clock or PLL lock\n" ); +return err; + } + +/* clear sticky alarm bits from initialization */ + err =regmap_write (data->regmap,SI5341_STATUS_STICKY ,0 ); +if (err) { +dev_err (&client->dev,"unable to clear sticky status\n" ); +return err; + } +/* Free the names, clk framework makes copies */ for (i =0 ; i < data->num_synth; ++i)devm_kfree (&client->dev, (void *)synth_clock_names[i]);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 593/800 clk: si5341: Update initialization magic
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 3c9b49b0031aefb81adfdba5ab0ddf3ca3a2cdc9 ]
Update the default register settings to include the VCO_RESET_CALCODE settings (set by the SiLabs ClockBuilder software but not described in the datasheet). Also update part of the initialization sequence to match ClockBuilder and the datasheet.
--- drivers/clk/clk-si5341.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/clk-si5341.c +3 -1
@@ -350,6 +350,8 @@ static const struct si5341_reg_default si5341_reg_defaults[] = { { 0x094A, 0x00 }, /* INx_TO_PFD_EN (disabled) */ { 0x0A02, 0x00 }, /* Not in datasheet */ { 0x0B44, 0x0F }, /* PDIV_ENB (datasheet does not mention what it is) */ + { 0x0B57, 0x10 }, /* VCO_RESET_CALCODE (not described in datasheet) */ + { 0x0B58, 0x05 }, /* VCO_RESET_CALCODE (not described in datasheet) */ };/* Read and interpret a 44-bit followed by a 32-bit value in the regmap */
@@ -1104,7 +1106,7 @@ static const struct si5341_reg_default si5341_preamble[] = { { 0x0B25, 0x00 }, { 0x0502, 0x01 }, { 0x0505, 0x03 }, - { 0x0957, 0x1F }, + { 0x0957, 0x17 }, { 0x0B4E, 0x1A }, };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 594/800 bpf, x86: Fix extable offset calculation
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 328aac5ecd119ede3633f7d17969b1ff34ccc784 ]
Commit 4c5de127598e1 ("bpf: Emit explicit NULL pointer checks for PROBE_LDX instructions.") is emitting a couple of instructions before the actual load. Consider those additional instructions while calculating extable offset.
--- arch/x86/net/bpf_jit_comp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/net/bpf_jit_comp.c +1 -1
@@ -1297,7 +1297,7 @@ st: if (is_imm8(insn->off))emit_ldx (&prog,BPF_SIZE (insn->code), dst_reg, src_reg, insn->off);if (BPF_MODE (insn->code) ==BPF_PROBE_MEM ) {struct exception_table_entry *ex; -u8 *_insn = image + proglen; +u8 *_insn = image + proglen + (start_of_ldx - temp);s64 delta;/* populate jmp_offset for JMP above */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 595/800 writeback: fix obtain a reference to a freeing memcg css
In reply to Greg Kroah-HartmanFrom: Muchun Song <[email protected]>
[ Upstream commit 8b0ed8443ae6458786580d36b7d5f8125535c5d4 ]
The caller of wb_get_create() should pin the memcg, because wb_get_create() relies on this guarantee. The rcu read lock only can guarantee that the memcg css returned by css_from_id() cannot be released, but the reference of the memcg can be zero.
rcu_read_lock()
memcg_css = css_from_id()
wb_get_create(memcg_css)
cgwb_create(memcg_css)
// css_get can change the ref counter from 0 back to 1
css_get(memcg_css) rcu_read_unlock()
Fix it by holding a reference to the css before calling wb_get_create(). This is not a problem I encountered in the real world. Just the result of a code review.
--- fs/fs-writeback.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/fs-writeback.c +7 -2
@@ -510,9 +510,14 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)/* find and pin the new wb */ rcu_read_lock (); memcg_css =css_from_id (new_wb_id, &memory_cgrp_subsys); -if (memcg_css) - isw->new_wb =wb_get_create (bdi, memcg_css,GFP_ATOMIC ); +if (memcg_css && !css_tryget (memcg_css)) + memcg_css =NULL ;rcu_read_unlock (); +if (!memcg_css) + goto out_free; + + isw->new_wb =wb_get_create (bdi, memcg_css,GFP_ATOMIC ); +css_put (memcg_css);if (!isw->new_wb) goto out_free;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 596/800 net: lwtunnel: handle MTU calculation in forwading
In reply to Greg Kroah-HartmanFrom: Vadim Fedorenko <[email protected]>
[ Upstream commit fade56410c22cacafb1be9f911a0afd3701d8366 ]
Commit 14972cbd34ff ("net: lwtunnel: Handle fragmentation") moved fragmentation logic away from lwtunnel by carry encap headroom and use it in output MTU calculation. But the forwarding part was not covered and created difference in MTU for output and forwarding and further to silent drops on ipv4 forwarding path. Fix it by taking into account lwtunnel encap headroom.
The same commit also introduced difference in how to treat RTAX_MTU in IPv4 and IPv6 where latter explicitly removes lwtunnel encap headroom from route MTU. Make IPv4 version do the same.
--- include/net/ip.h | 12 ++++++++---- include/net/ip6_route.h | 16 ++++++++++++---- net/ipv4/route.c | 3 ++- 3 files changed, 22 insertions(+), 9 deletions(-)
include/net/ip.h +8 -4
@@ -31,6 +31,7 @@#include <net/flow.h> #include <net/flow_dissector.h> #include <net/netns/hash.h> +#include <net/lwtunnel.h> #define IPV4_MAX_PMTU 65535U/* RFC 2675, Section 5.1 */ #define IPV4_MIN_MTU 68/* RFC 791 */
@@ -445,22 +446,25 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,/* 'forwarding = true' case should always honour route mtu */ mtu =dst_metric_raw (dst,RTAX_MTU ); -if (mtu) -return mtu; +if (!mtu) + mtu =min (READ_ONCE (dst->dev->mtu),IP_MAX_MTU ); -return min (READ_ONCE (dst->dev->mtu),IP_MAX_MTU ); +return mtu -lwtunnel_headroom (dst->lwtstate, mtu); }static inline unsigned int ip_skb_dst_mtu (struct sock *sk,const struct sk_buff *skb) { +unsigned int mtu; +if (!sk || !sk_fullsock (sk) ||ip_sk_use_pmtu (sk)) {bool forwarding =IPCB (skb)->flags &IPSKB_FORWARDED ;return ip_dst_mtu_maybe_forward (skb_dst (skb), forwarding); } -return min (READ_ONCE (skb_dst (skb)->dev->mtu),IP_MAX_MTU ); + mtu =min (READ_ONCE (skb_dst (skb)->dev->mtu),IP_MAX_MTU ); +return mtu -lwtunnel_headroom (skb_dst (skb)->lwtstate, mtu); } struct dst_metrics *ip_fib_metrics_init(struct net *net, struct nlattr *fc_mx,
include/net/ip6_route.h +12 -4
@@ -265,11 +265,18 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,static inline int ip6_skb_dst_mtu (struct sk_buff *skb) { +int mtu; +struct ipv6_pinfo *np = skb->sk && !dev_recursion_level () ?inet6_sk (skb->sk) :NULL ; -return (np && np->pmtudisc >=IPV6_PMTUDISC_PROBE ) ? -skb_dst (skb)->dev->mtu :dst_mtu (skb_dst (skb)); +if (np && np->pmtudisc >=IPV6_PMTUDISC_PROBE ) { + mtu =READ_ONCE (skb_dst (skb)->dev->mtu); + mtu -=lwtunnel_headroom (skb_dst (skb)->lwtstate, mtu); + }else + mtu =dst_mtu (skb_dst (skb)); + +return mtu; }static inline bool ip6_sk_accept_pmtu (const struct sock *sk)
@@ -317,7 +324,7 @@ static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)if (dst_metric_locked (dst,RTAX_MTU )) { mtu =dst_metric_raw (dst,RTAX_MTU );if (mtu) -return mtu; + goto out; } mtu =IPV6_MIN_MTU ;
@@ -327,7 +334,8 @@ static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst) mtu = idev->cnf.mtu6;rcu_read_unlock (); -return mtu; +out: +return mtu -lwtunnel_headroom (dst->lwtstate, mtu); } u32 ip6_mtu_from_fib6(const struct fib6_result *res,
net/ipv4/route.c +2 -1
@@ -1306,7 +1306,7 @@ INDIRECT_CALLABLE_SCOPE unsigned int ipv4_mtu(const struct dst_entry *dst) mtu =dst_metric_raw (dst,RTAX_MTU );if (mtu) -return mtu; + goto out; mtu =READ_ONCE (dst->dev->mtu);
@@ -1315,6 +1315,7 @@ INDIRECT_CALLABLE_SCOPE unsigned int ipv4_mtu(const struct dst_entry *dst) mtu =576 ; } +out: mtu = min_t(unsigned int, mtu, IP_MAX_MTU);return mtu -lwtunnel_headroom (dst->lwtstate, mtu);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 597/800 net: sched: fix warning in tcindex_alloc_perfect_hash
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 3f2db250099f46988088800052cdf2332c7aba61 ]
Syzbot reported warning in tcindex_alloc_perfect_hash. The problem was in too big cp->hash, which triggers warning in kmalloc. Since cp->hash comes from userspace, there is no need to warn if value is not correct
--- net/sched/cls_tcindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_tcindex.c +1 -1
@@ -304,7 +304,7 @@ static int tcindex_alloc_perfect_hash(struct net *net, struct tcindex_data *cp)int i, err =0 ; cp->perfect =kcalloc (cp->hash,sizeof (struct tcindex_filter_result ), -GFP_KERNEL ); +GFP_KERNEL | __GFP_NOWARN);if (!cp->perfect)return -ENOMEM ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 598/800 net: tipc: fix FB_MTU eat two pages
In reply to Greg Kroah-HartmanFrom: Menglong Dong <[email protected]>
[ Upstream commit 0c6de0c943dbb42831bf7502eb5c007f71e752d2 ]
FB_MTU is used in 'tipc_msg_build()' to alloc smaller skb when memory allocation fails, which can avoid unnecessary sending failures.
The value of FB_MTU now is 3744, and the data size will be:
(3744 + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
SKB_DATA_ALIGN(BUF_HEADROOM + BUF_TAILROOM + 3))which is larger than one page(4096), and two pages will be allocated.
To avoid it, replace '3744' with a calculation:
(PAGE_SIZE - SKB_DATA_ALIGN(BUF_OVERHEAD) - \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))What's more, alloc_skb_fclone() will call SKB_DATA_ALIGN for data size, and it's not necessary to make alignment for buf_size in tipc_buf_acquire(). So, just remove it.
--- net/tipc/bcast.c | 2 +- net/tipc/msg.c | 17 ++++++++--------- net/tipc/msg.h | 3 ++- 3 files changed, 11 insertions(+), 11 deletions(-)
net/tipc/bcast.c +1 -1
@@ -699,7 +699,7 @@ int tipc_bcast_init(struct net *net)spin_lock_init (&tipc_net (net)->bclock); if (!tipc_link_bc_create(net, 0, 0, NULL, - FB_MTU, + one_page_mtu, BCLINK_WIN_DEFAULT, BCLINK_WIN_DEFAULT, 0,
net/tipc/msg.c +8 -9
@@ -44,12 +44,15 @@#define MAX_FORWARD_SIZE 1024#ifdef CONFIG_TIPC_CRYPTO #define BUF_HEADROOM ALIGN(((LL_MAX_HEADER + 48) + EHDR_MAX_SIZE), 16) -#define BUF_TAILROOM (TIPC_AES_GCM_TAG_SIZE) +#define BUF_OVERHEAD (BUF_HEADROOM + TIPC_AES_GCM_TAG_SIZE)#else #define BUF_HEADROOM (LL_MAX_HEADER + 48) -#define BUF_TAILROOM 16 +#define BUF_OVERHEAD BUF_HEADROOM#endif +const int one_page_mtu =PAGE_SIZE -SKB_DATA_ALIGN (BUF_OVERHEAD ) - +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); +static unsigned int align (unsigned int i) {return (i +3 ) & ~3u ;
@@ -69,13 +72,8 @@ static unsigned int align(unsigned int i)struct sk_buff *tipc_buf_acquire (u32 size,gfp_t gfp) {struct sk_buff *skb; -#ifdef CONFIG_TIPC_CRYPTO -unsigned int buf_size = (BUF_HEADROOM + size +BUF_TAILROOM +3 ) & ~3u ; -#else -unsigned int buf_size = (BUF_HEADROOM + size +3 ) & ~3u ; -#endif - skb =alloc_skb_fclone (buf_size, gfp); + skb =alloc_skb_fclone (BUF_OVERHEAD + size, gfp);if (skb) {skb_reserve (skb,BUF_HEADROOM );skb_put (skb, size);
@@ -395,7 +393,8 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, int offset,if (unlikely (!skb)) {if (pktmax !=MAX_MSG_SIZE )return -ENOMEM ; - rc =tipc_msg_build (mhdr, m, offset, dsz,FB_MTU , list); + rc =tipc_msg_build (mhdr, m, offset, dsz, + one_page_mtu, list);if (rc != dsz)return rc;if (tipc_msg_assemble (list))
net/tipc/msg.h +2 -1
@@ -99,9 +99,10 @@ struct plist;#define MAX_H_SIZE 60/* Largest possible TIPC header size */ #define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE) -#define FB_MTU 3744#define TIPC_MEDIA_INFO_OFFSET 5 +extern const int one_page_mtu; + struct tipc_skb_cb { union { struct {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 599/800 RDMA/mlx5: Dont access NULL-cleared mpi pointer
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 4a754d7637026b42b0c9ba5787ad5ee3bc2ff77f ]
The "dev->port[i].mp.mpi" is set to NULL during mlx5_ib_unbind_slave_port() execution, however that field is needed to add device to unaffiliated list.
Such flow causes to the following kernel panic while unloading mlx5_ib module in multi-port mode, hence the device should be added to the list prior to unbind call.
RPC: Unregistered rdma transport module.
RPC: Unregistered rdma backchannel transport module.
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 0 P4D 0 Oops: 0002 [#1] SMP NOPTI CPU: 4 PID: 1904 Comm: modprobe Not tainted 5.13.0-rc7_for_upstream_min_debug_2021_06_24_12_08 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:mlx5_ib_cleanup_multiport_master+0x18b/0x2d0 [mlx5_ib] Code: 00 04 0f 85 c4 00 00 00 48 89 df e8 ef fa ff ff 48 8b 83 40 0d 00 00 48 8b 15 b9 e8 05 00 4a 8b 44 28 20 48 89 05 ad e8 05 00 <48> c7 00 d0 57 c5 a0 48 89 50 08 48 89 02 39 ab 88 0a 00 00 0f 86 RSP: 0018:ffff888116ee3df8 EFLAGS: 00010296 RAX: 0000000000000000 RBX: ffff8881154f6000 RCX: 0000000000000080 RDX: ffffffffa0c557d0 RSI: ffff88810b69d200 RDI: 000000000002d8a0 RBP: 0000000000000002 R08: ffff888110780408 R09: 0000000000000000 R10: ffff88812452e1c0 R11: fffffffffff7e028 R12: 0000000000000000 R13: 0000000000000080 R14: ffff888102c58000 R15: 0000000000000000 FS: 00007f884393a740(0000) GS:ffff8882f5a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000001249f6004 CR4: 0000000000370ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: mlx5_ib_stage_init_cleanup+0x16/0xd0 [mlx5_ib] __mlx5_ib_remove+0x33/0x90 [mlx5_ib] mlx5r_remove+0x22/0x30 [mlx5_ib] auxiliary_bus_remove+0x18/0x30 __device_release_driver+0x177/0x220 driver_detach+0xc4/0x100 bus_remove_driver+0x58/0xd0 auxiliary_driver_unregister+0x12/0x20 mlx5_ib_cleanup+0x13/0x897 [mlx5_ib] __x64_sys_delete_module+0x154/0x230 ? exit_to_user_mode_prepare+0x104/0x140 do_syscall_64+0x3f/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f8842e095c7 Code: 73 01 c3 48 8b 0d d9 48 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a9 48 2c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffc68f6e758 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0 RAX: ffffffffffffffda RBX: 00005638207929c0 RCX: 00007f8842e095c7 RDX: 0000000000000000 RSI: 0000000000000800 RDI: 0000563820792a28 RBP: 00005638207929c0 R08: 00007ffc68f6d701 R09: 0000000000000000 R10: 00007f8842e82880 R11: 0000000000000206 R12: 0000563820792a28 R13: 0000000000000001 R14: 0000563820792a28 R15: 00007ffc68f6fb40 Modules linked in: xt_MASQUERADE nf_conntrack_netlink nfnetlink iptable_nat xt_addrtype xt_conntrack nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter overlay rdma_ucm ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_ipoib ib_cm ib_umad mlx5_ib(-) mlx4_ib ib_uverbs ib_core mlx4_en mlx4_core mlx5_core ptp pps_core [last unloaded: rpcrdma] CR2: 0000000000000000 ---[ end trace a0bb7e20804e9e9b ]---
--- drivers/infiniband/hw/mlx5/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +2 -1
@@ -3325,9 +3325,10 @@ static void mlx5_ib_cleanup_multiport_master(struct mlx5_ib_dev *dev) }else {mlx5_ib_dbg (dev,"unbinding port_num: %u\n" , i +1 ); -mlx5_ib_unbind_slave_port (dev, dev->port[i].mp.mpi);list_add_tail (&dev->port[i].mp.mpi->list, &mlx5_ib_unaffiliated_port_list); +mlx5_ib_unbind_slave_port (dev, + dev->port[i].mp.mpi); } } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 600/800 RDMA/core: Always release restrack object
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 3d8287544223a3d2f37981c1f9ffd94d0b5e9ffc ]
Change location of rdma_restrack_del() to fix the bug where task_struct was acquired but not released, causing to resource leak.
ucma_create_id() {
ucma_alloc_ctx();
rdma_create_user_id() {
rdma_restrack_new();
rdma_restrack_set_name() {
rdma_restrack_attach_task.part.0(); <--- task_struct was gotten
}
}
ucma_destroy_private_ctx() {
ucma_put_ctx();
rdma_destroy_id() {
_destroy_id() <--- id_priv was freed
}
}
}--- drivers/infiniband/core/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
@@ -1852,6 +1852,7 @@ static void _destroy_id(struct rdma_id_private *id_priv, {cma_cancel_operation (id_priv, state); +rdma_restrack_del (&id_priv->res);if (id_priv->cma_dev) {if (rdma_cap_ib_cm (id_priv->id.device,1 )) {if (id_priv->cm_id.ib)
@@ -1861,7 +1862,6 @@ static void _destroy_id(struct rdma_id_private *id_priv,iw_destroy_cm_id (id_priv->cm_id.iw); }cma_leave_mc_groups (id_priv); -rdma_restrack_del (&id_priv->res);cma_release_dev (id_priv); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 601/800 MIPS: Fix PKMAP with 32-bit MIPS huge page support
In reply to Greg Kroah-HartmanFrom: Wei Li <[email protected]>
[ Upstream commit cf02ce742f09188272bcc8b0e62d789eb671fc4c ]
When 32-bit MIPS huge page support is enabled, we halve the number of pointers a PTE page holds, making its last half go to waste. Correspondingly, we should halve the number of kmap entries, as we just initialized only a single pte table for that in pagetable_init().
--- arch/mips/include/asm/highmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/highmem.h +1 -1
@@ -36,7 +36,7 @@ extern pte_t *pkmap_page_table;* easily, subsequent pte tables have to be allocated in one physical * chunk of RAM. */ -#ifdef CONFIG_PHYS_ADDR_T_64BIT +#if defined(CONFIG_PHYS_ADDR_T_64BIT ) || defined(CONFIG_MIPS_HUGE_TLB_SUPPORT )#define LAST_PKMAP 512#else #define LAST_PKMAP 1024
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 602/800 staging: rtl8712: Fix some tests against some data subtype frames
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 116138c3bd34f92e550431d495db515f5ea19f13 ]
Commit 6e2baa44c6d1 ("staging: rtl8712: remove enum WIFI_FRAME_SUBTYPE") was wrong because:
WIFI_DATA_NULL != IEEE80211_STYPE_NULLFUNC WIFI_DATA_CFACK != IEEE80211_STYPE_DATA_CFACK WIFI_DATA_CFPOLL != IEEE80211_STYPE_DATA_CFPOLL WIFI_DATA_CFACKPOLL != IEEE80211_STYPE_DATA_CFACKPOLL
the WIFI_DATA_xxx definitions include WIFI_DATA_TYPE, which is 'BIT(3)'. Restore the previous behavior by adding the missing 'IEEE80211_FTYPE_DATA |' (0x0008, that is to say BIT(3)) when these values are used.
Hopefully, the wrong commit was small enough and hand review is possible.
--- drivers/staging/rtl8712/rtl871x_recv.c | 2 +- drivers/staging/rtl8712/rtl871x_security.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
@@ -374,7 +374,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter,if (check_fwstate (pmlmepriv,WIFI_STATION_STATE ) &&check_fwstate (pmlmepriv, _FW_LINKED)) {/* if NULL-frame, drop packet */ -if ((GetFrameSubType (ptr)) ==IEEE80211_STYPE_NULLFUNC ) +if ((GetFrameSubType (ptr)) == (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_NULLFUNC ))return _FAIL;/* drop QoS-SubType Data, including QoS NULL, * excluding QoS-Data
drivers/staging/rtl8712/rtl871x_security.c +6 -6
@@ -1045,9 +1045,9 @@ static void aes_cipher(u8 *key, uint hdrlen,else a4_exists =1 ; -if ((frtype ==IEEE80211_STYPE_DATA_CFACK ) || - (frtype ==IEEE80211_STYPE_DATA_CFPOLL ) || - (frtype ==IEEE80211_STYPE_DATA_CFACKPOLL )) { +if ((frtype == (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_DATA_CFACK )) || + (frtype == (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_DATA_CFPOLL )) || + (frtype == (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_DATA_CFACKPOLL ))) { qc_exists =1 ;if (hdrlen !=WLAN_HDR_A3_QOS_LEN ) hdrlen +=2 ;
@@ -1225,9 +1225,9 @@ static void aes_decipher(u8 *key, uint hdrlen, a4_exists =0 ; else a4_exists =1 ; -if ((frtype ==IEEE80211_STYPE_DATA_CFACK ) || - (frtype ==IEEE80211_STYPE_DATA_CFPOLL ) || - (frtype ==IEEE80211_STYPE_DATA_CFACKPOLL )) { +if ((frtype == (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_DATA_CFACK )) || + (frtype == (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_DATA_CFPOLL )) || + (frtype == (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_DATA_CFACKPOLL ))) { qc_exists =1 ;if (hdrlen !=WLAN_HDR_A3_QOS_LEN ) hdrlen +=2 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 603/800 staging: fbtft: Rectify GPIO handling
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit ec03c2104365ead0a33627c05e685093eed3eaef ]
The infamous commit c440eee1a7a1 ("Staging: staging: fbtft: Switch to the GPIO descriptor interface") broke GPIO handling completely. It has already four commits to rectify and it seems not enough. In order to fix the mess here we:
1) Set default to "inactive" for all requested pins
2) Fix CS#, RD#, and WR# pins polarity since it's active low and GPIO descriptor interface takes it into consideration from the Device Tree or ACPI
3) Consolidate chip activation (CS# assertion) under default
->reset() callback
To summarize the expectations about polarity for GPIOs:
RD# Low
WR# Low
CS# Low
RESET# Low
DC or RS High
RW High
Data 0 .. 15 High
See also Adafruit learning course [1] for the example of the schematics.
While at it, drop unneeded NULL checks, since GPIO API is tolerant to that.
[1]: https://learn.adafruit.com/adafruit-2-8-and-3-2-color-tft-touchscreen-breakout-v2/downloads
--- drivers/staging/fbtft/fb_agm1264k-fl.c | 20 ++++++++++---------- drivers/staging/fbtft/fb_bd663474.c | 4 ---- drivers/staging/fbtft/fb_ili9163.c | 4 ---- drivers/staging/fbtft/fb_ili9320.c | 1 - drivers/staging/fbtft/fb_ili9325.c | 4 ---- drivers/staging/fbtft/fb_ili9340.c | 1 - drivers/staging/fbtft/fb_s6d1121.c | 4 ---- drivers/staging/fbtft/fb_sh1106.c | 1 - drivers/staging/fbtft/fb_ssd1289.c | 4 ---- drivers/staging/fbtft/fb_ssd1325.c | 2 -- drivers/staging/fbtft/fb_ssd1331.c | 6 ++---- drivers/staging/fbtft/fb_ssd1351.c | 1 - drivers/staging/fbtft/fb_upd161704.c | 4 ---- drivers/staging/fbtft/fb_watterott.c | 1 - drivers/staging/fbtft/fbtft-bus.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 13 ++++++------- drivers/staging/fbtft/fbtft-io.c | 12 ++++++------ 17 files changed, 25 insertions(+), 60 deletions(-)
drivers/staging/fbtft/fb_agm1264k-fl.c +10 -10
@@ -84,9 +84,9 @@ static void reset(struct fbtft_par *par)dev_dbg (par->info->device,"%s()\n" , __func__); -gpiod_set_value (par->gpio.reset,0 ); -udelay (20 );gpiod_set_value (par->gpio.reset,1 ); +udelay (20 ); +gpiod_set_value (par->gpio.reset,0 );mdelay (120 ); }
@@ -194,12 +194,12 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)/* select chip */ if (*buf) {/* cs1 */ -gpiod_set_value (par->CS0,1 ); -gpiod_set_value (par->CS1,0 ); - }else { -/* cs0 */ gpiod_set_value (par->CS0,0 );gpiod_set_value (par->CS1,1 ); + }else { +/* cs0 */ +gpiod_set_value (par->CS0,1 ); +gpiod_set_value (par->CS1,0 ); }gpiod_set_value (par->RS,0 );/* RS->0 (command mode) */
@@ -397,8 +397,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) }kfree (convert_buf); -gpiod_set_value (par->CS0,1 ); -gpiod_set_value (par->CS1,1 ); +gpiod_set_value (par->CS0,0 ); +gpiod_set_value (par->CS1,0 );return ret; }
@@ -419,10 +419,10 @@ static int write(struct fbtft_par *par, void *buf, size_t len)for (i =0 ; i <8 ; ++i)gpiod_set_value (par->gpio.db[i], data & (1 << i));/* set E */ -gpiod_set_value (par->EPIN,1 ); +gpiod_set_value (par->EPIN,0 );udelay (5 );/* unset E - write */ -gpiod_set_value (par->EPIN,0 ); +gpiod_set_value (par->EPIN,1 );udelay (1 ); }
drivers/staging/fbtft/fb_bd663474.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -24,9 +23,6 @@static int init_display (struct fbtft_par *par) { -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ - par->fbtftops.reset (par);/* Initialization sequence from Lib_UTFT */
drivers/staging/fbtft/fb_ili9163.c +0 -4
@@ -11,7 +11,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include <video/mipi_display.h>
@@ -77,9 +76,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -write_reg (par,MIPI_DCS_SOFT_RESET );/* software reset */ mdelay (500 );write_reg (par,MIPI_DCS_EXIT_SLEEP_MODE );/* exit sleep */
drivers/staging/fbtft/fb_ili9320.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/spi/spi.h> #include <linux/delay.h>
drivers/staging/fbtft/fb_ili9325.c +0 -4
@@ -10,7 +10,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -85,9 +84,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ - bt &=0x07 ; vc &=0x07 ; vrh &=0x0f ;
drivers/staging/fbtft/fb_ili9340.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include <video/mipi_display.h>
drivers/staging/fbtft/fb_s6d1121.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -29,9 +28,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -/* Initialization sequence from Lib_UTFT */ write_reg (par,0x0011 ,0x2004 );
drivers/staging/fbtft/fb_sh1106.c +0 -1
@@ -9,7 +9,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
drivers/staging/fbtft/fb_ssd1289.c +0 -4
@@ -10,7 +10,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include "fbtft.h"
@@ -28,9 +27,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -write_reg (par,0x00 ,0x0001 );write_reg (par,0x03 ,0xA8A4 );write_reg (par,0x0C ,0x0000 );
drivers/staging/fbtft/fb_ssd1325.c +0 -2
@@ -35,8 +35,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -gpiod_set_value (par->gpio.cs,0 ); -write_reg (par,0xb3 );write_reg (par,0xf0 );write_reg (par,0xae );
drivers/staging/fbtft/fb_ssd1331.c +2 -4
@@ -81,8 +81,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)va_start (args, len); *buf = (u8)va_arg(args, unsigned int); -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,0 ); +gpiod_set_value (par->gpio.dc,0 ); ret = par->fbtftops.write (par, par->buf,sizeof (u8));if (ret <0 ) {va_end (args);
@@ -104,8 +103,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)return ; } } -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,1 ); +gpiod_set_value (par->gpio.dc,1 );va_end (args); }
drivers/staging/fbtft/fb_ssd1351.c +0 -1
@@ -2,7 +2,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/spi/spi.h> #include <linux/delay.h>
drivers/staging/fbtft/fb_upd161704.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -26,9 +25,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -/* Initialization sequence from Lib_UTFT */ /* register reset */
drivers/staging/fbtft/fb_watterott.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
drivers/staging/fbtft/fbtft-bus.c +1 -2
@@ -135,8 +135,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) remain = len /2 ; vmem16 = (u16 *)(par->info->screen_buffer + offset); -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,1 ); +gpiod_set_value (par->gpio.dc,1 );/* non buffered write */ if (!par->txbuf.buf)
drivers/staging/fbtft/fbtft-core.c +6 -7
@@ -38,8 +38,7 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc) {int ret; -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc, dc); +gpiod_set_value (par->gpio.dc, dc); ret = par->fbtftops.write (par, buf, len);if (ret <0 )
@@ -79,7 +78,7 @@ static int fbtft_request_one_gpio(struct fbtft_par *par,int ret =0 ; *gpiop =devm_gpiod_get_index_optional (dev, name, index, -GPIOD_OUT_HIGH ); +GPIOD_OUT_LOW );if (IS_ERR (*gpiop)) { ret =PTR_ERR (*gpiop); dev_err(dev,
@@ -226,11 +225,15 @@ static void fbtft_reset(struct fbtft_par *par) {if (!par->gpio.reset)return ; +fbtft_par_dbg (DEBUG_RESET , par,"%s()\n" , __func__); +gpiod_set_value_cansleep (par->gpio.reset,1 );usleep_range (20 ,40 );gpiod_set_value_cansleep (par->gpio.reset,0 );msleep (120 ); + +gpiod_set_value_cansleep (par->gpio.cs,1 );/* Activate chip */ } static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
@@ -922,8 +925,6 @@ static int fbtft_init_display_from_property(struct fbtft_par *par) goto out_free; par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ index =-1 ; val = values[++index];
@@ -1018,8 +1019,6 @@ int fbtft_init_display(struct fbtft_par *par) } par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ i =0 ;while (i <FBTFT_MAX_INIT_SEQUENCE ) {
drivers/staging/fbtft/fbtft-io.c +6 -6
@@ -142,12 +142,12 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) data = *(u8 *)buf;/* Start writing by pulling down /WR */ -gpiod_set_value (par->gpio.wr,0 ); +gpiod_set_value (par->gpio.wr,1 );/* Set data */ #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO if (data == prev_data) { -gpiod_set_value (par->gpio.wr,0 );/* used as delay */ +gpiod_set_value (par->gpio.wr,1 );/* used as delay */ }else {for (i =0 ; i <8 ; i++) {if ((data &1 ) != (prev_data &1 ))
@@ -165,7 +165,7 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len)#endif /* Pullup /WR */ -gpiod_set_value (par->gpio.wr,1 ); +gpiod_set_value (par->gpio.wr,0 );#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO prev_data = *(u8 *)buf;
@@ -192,12 +192,12 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) data = *(u16 *)buf;/* Start writing by pulling down /WR */ -gpiod_set_value (par->gpio.wr,0 ); +gpiod_set_value (par->gpio.wr,1 );/* Set data */ #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO if (data == prev_data) { -gpiod_set_value (par->gpio.wr,0 );/* used as delay */ +gpiod_set_value (par->gpio.wr,1 );/* used as delay */ }else {for (i =0 ; i <16 ; i++) {if ((data &1 ) != (prev_data &1 ))
@@ -215,7 +215,7 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len)#endif /* Pullup /WR */ -gpiod_set_value (par->gpio.wr,1 ); +gpiod_set_value (par->gpio.wr,0 );#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO prev_data = *(u16 *)buf;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 604/800 staging: fbtft: Dont spam logs when probe is deferred
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 37667f6e57712cef5652fa67f1cbd1299e204d94 ]
When requesting GPIO line the probe can be deferred. In such case don't spam logs with an error message. This can be achieved by switching to dev_err_probe().
--- drivers/staging/fbtft/fbtft-core.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/staging/fbtft/fbtft-core.c +4 -8
@@ -75,20 +75,16 @@ static int fbtft_request_one_gpio(struct fbtft_par *par, struct gpio_desc **gpiop) {struct device *dev = par->info->device; -int ret =0 ; *gpiop =devm_gpiod_get_index_optional (dev, name, index,GPIOD_OUT_LOW ); -if (IS_ERR (*gpiop)) { - ret =PTR_ERR (*gpiop); -dev_err (dev, -"Failed to request %s GPIO: %d\n" , name, ret); -return ret; - } +if (IS_ERR (*gpiop)) +return dev_err_probe (dev,PTR_ERR (*gpiop),"Failed to request %s GPIO\n" , name); +fbtft_par_dbg (DEBUG_REQUEST_GPIOS , par,"%s: '%s' GPIO\n" , __func__, name); -return ret; +return 0 ; }static int fbtft_request_gpios (struct fbtft_par *par)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 605/800 ASoC: rt5682: Disable irq on shutdown
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit 47bcb1c7108363418cd578283333d72e310dfeaa ]
We cancel the work queues, and reset the device on shutdown, but the irq isn't disabled so the work queues could be queued again. Let's disable the irq during shutdown so that we don't have to worry about this device trying to do anything anymore. This fixes a problem seen where the i2c bus is shutdown at reboot but this device irq still comes in and tries to make another i2c transaction when the bus doesn't work.
--- sound/soc/codecs/rt5682-i2c.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/rt5682-i2c.c +1 -0
@@ -273,6 +273,7 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) {struct rt5682_priv *rt5682 =i2c_get_clientdata (client); +disable_irq (client->irq);cancel_delayed_work_sync (&rt5682->jack_detect_work);cancel_delayed_work_sync (&rt5682->jd_check_work);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 606/800 rcu: Invoke rcu_spawn_core_kthreads() from rcu_spawn_gp_kthread()
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit 8e4b1d2bc198e34b48fc7cc3a3c5a2fcb269e271 ]
Currently, rcu_spawn_core_kthreads() is invoked via an early_initcall(), which works, except that rcu_spawn_gp_kthread() is also invoked via an early_initcall() and rcu_spawn_core_kthreads() relies on adjustments to kthread_prio that are carried out by rcu_spawn_gp_kthread(). There is no guaranttee of ordering among early_initcall() handlers, and thus no guarantee that kthread_prio will be properly checked and range-limited at the time that rcu_spawn_core_kthreads() needs it.
In most cases, this bug is harmless. After all, the only reason that rcu_spawn_gp_kthread() adjusts the value of kthread_prio is if the user specified a nonsensical value for this boot parameter, which experience indicates is rare.
Nevertheless, a bug is a bug. This commit therefore causes the rcu_spawn_core_kthreads() function to be invoked directly from rcu_spawn_gp_kthread() after any needed adjustments to kthread_prio have been carried out.
--- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
@@ -2911,7 +2911,6 @@ static int __init rcu_spawn_core_kthreads(void) "%s: Could not start rcuc kthread, OOM is now expected behavior\n", __func__);return 0 ; } -early_initcall (rcu_spawn_core_kthreads);/* * Handle any core-RCU processing required by a call_rcu() invocation.
@@ -4472,6 +4471,7 @@ static int __init rcu_spawn_gp_kthread(void)wake_up_process (t);rcu_spawn_nocb_kthreads ();rcu_spawn_boost_kthreads (); +rcu_spawn_core_kthreads ();return 0 ; }early_initcall (rcu_spawn_gp_kthread);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 607/800 serial: fsl_lpuart: dont modify arbitrary data on lpuart32
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit ccf08fd1204bcb5311cc10aea037c71c6e74720a ]
lpuart_rx_dma_startup() is used for both the 8 bit and the 32 bit version of the LPUART. Modify the UARTCR only for the 8 bit version.
--- drivers/tty/serial/fsl_lpuart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/fsl_lpuart.c +1 -1
@@ -1625,7 +1625,7 @@ static void lpuart_rx_dma_startup(struct lpuart_port *sport) sport->lpuart_dma_rx_use = true;rx_dma_timer_init (sport); -if (sport->port.has_sysrq) { +if (sport->port.has_sysrq && !lpuart_is_32 (sport)) { cr3 =readb (sport->port.membase +UARTCR3 ); cr3 |=UARTCR3_FEIE ;writeb (cr3, sport->port.membase +UARTCR3 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 608/800 serial: fsl_lpuart: remove RTSCTS handling from get_mctrl()
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit e60c2991f18bf221fa9908ff10cb24eaedaa9bae ]
The wrong code in set_mctrl() was already removed in commit 2b30efe2e88a ("tty: serial: lpuart: Remove unnecessary code from set_mctrl"), but the code in get_mctrl() wasn't removed. It will not return the state of the RTS or CTS line but whether automatic flow control is enabled, which is wrong for the get_mctrl(). Thus remove it.
--- drivers/tty/serial/fsl_lpuart.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/tty/serial/fsl_lpuart.c +1 -11
@@ -1408,17 +1408,7 @@ static unsigned int lpuart_get_mctrl(struct uart_port *port)static unsigned int lpuart32_get_mctrl (struct uart_port *port) { -unsigned int temp =0 ; -unsigned long reg; - - reg =lpuart32_read (port,UARTMODIR ); -if (reg &UARTMODIR_TXCTSE ) - temp |=TIOCM_CTS ; - -if (reg &UARTMODIR_RXRTSE ) - temp |=TIOCM_RTS ; - -return temp; +return 0 ; }static void lpuart_set_mctrl (struct uart_port *port,unsigned int mctrl)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 609/800 serial: 8250_omap: fix a timeout loop condition
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d7e325aaa8c3593b5a572b583ecad79e95f32e7f ]
This loop ends on -1 so the error message will never be printed.
--- drivers/tty/serial/8250/8250_omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_omap.c +1 -1
@@ -813,7 +813,7 @@ static void __dma_rx_do_complete(struct uart_8250_port *p) poll_count--)cpu_relax (); -if (!poll_count) +if (poll_count ==-1 )dev_err (p->port.dev,"teardown incomplete\n" ); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 610/800 tty: nozomi: Fix a resource leak in an error handling function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 31a9a318255960d32ae183e95d0999daf2418608 ]
A 'request_irq()' call is not balanced by a corresponding 'free_irq()' in the error handling path, as already done in the remove function.
Add it.
--- drivers/tty/nozomi.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/nozomi.c +1 -0
@@ -1420,6 +1420,7 @@ err_free_tty:tty_unregister_device (ntty_driver, dc->index_start + i);tty_port_destroy (&dc->port[i].port); } +free_irq (pdev->irq, dc); err_free_kfifo:for (i =0 ; i <MAX_PORT ; i++)kfifo_free (&dc->port[i].fifo_ul);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 611/800 phy: ralink: phy-mt7621-pci: properly print pointer address
In reply to Greg Kroah-HartmanFrom: Sergio Paracuellos <[email protected]>
[ Upstream commit 652a6a2e3824ce2ebf79a2d5326940d05c4db036 ]
The way of printing the pointer address for the 'port_base' address got into compile warnings on some architectures [-Wpointer-to-int-cast]. Instead of use '%08x' and cast to an 'unsigned int' just make use of '%px' and avoid the cast. To avoid not really needed driver verbosity on normal behaviour change also from 'dev_info' to 'dev_dbg'.
--- drivers/phy/ralink/phy-mt7621-pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/ralink/phy-mt7621-pci.c +2 -2
@@ -272,8 +272,8 @@ static struct phy *mt7621_pcie_phy_of_xlate(struct device *dev, mt7621_phy->has_dual_port = args->args[0 ]; -dev_info (dev,"PHY for 0x%08x (dual port = %d)\n" , - (unsigned int )mt7621_phy->port_base, mt7621_phy->has_dual_port); +dev_dbg (dev,"PHY for 0x%px (dual port = %d)\n" , + mt7621_phy->port_base, mt7621_phy->has_dual_port);return mt7621_phy->phy; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 612/800 mwifiex: re-fix for unaligned accesses
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 8f4e3d48bb50765ab27ae5bebed2595b20de80a1 ]
A patch from 2017 changed some accesses to DMA memory to use get_unaligned_le32() and similar interfaces, to avoid problems with doing unaligned accesson uncached memory.
However, the change in the mwifiex_pcie_alloc_sleep_cookie_buf() function ended up changing the size of the access instead, as it operates on a pointer to u8.
Change this function back to actually access the entire 32 bits. Note that the pointer is aligned by definition because it came from dma_alloc_coherent().
--- drivers/net/wireless/marvell/mwifiex/pcie.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +4 -6
@@ -1231,7 +1231,7 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter)static int mwifiex_pcie_alloc_sleep_cookie_buf (struct mwifiex_adapter *adapter) {struct pcie_service_card *card = adapter->card; -u32 tmp; +u32 *cookie; card->sleep_cookie_vbase = dma_alloc_coherent(&card->dev->dev, sizeof(u32),
@@ -1242,13 +1242,11 @@ static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) "dma_alloc_coherent failed!\n");return -ENOMEM ; } + cookie = (u32 *)card->sleep_cookie_vbase;/* Init val of Sleep Cookie */ - tmp =FW_AWAKE_COOKIE ; -put_unaligned (tmp, card->sleep_cookie_vbase); + *cookie =FW_AWAKE_COOKIE ; -mwifiex_dbg (adapter,INFO , -"alloc_scook: sleep cookie=0x%x\n" , -get_unaligned (card->sleep_cookie_vbase)); +mwifiex_dbg (adapter,INFO ,"alloc_scook: sleep cookie=0x%x\n" , *cookie);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 613/800 iio: adis_buffer: do not return ints in irq handlers
In reply to Greg Kroah-HartmanFrom: Nuno Sa <[email protected]>
[ Upstream commit d877539ad8e8fdde9af69887055fec6402be1a13 ]
On an IRQ handler we should not return normal error codes as 'irqreturn_t' is expected.
Not necessarily stable material as the old check cannot fail, so it's a bug we can not hit.
--- drivers/iio/imu/adis_buffer.c | 3 --- 1 file changed, 3 deletions(-)
drivers/iio/imu/adis_buffer.c +0 -3
@@ -129,9 +129,6 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)struct adis *adis =iio_device_get_drvdata (indio_dev);int ret; -if (!adis->buffer) -return -ENOMEM ; -if (adis->data->has_paging) {mutex_lock (&adis->state_lock);if (adis->current_page !=0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 614/800 iio: adis16400: do not return ints in irq handlers
In reply to Greg Kroah-HartmanFrom: Nuno Sa <[email protected]>
[ Upstream commit ab3df79782e7d8a27a58576c9b4e8c6c4879ad79 ]
On an IRQ handler we should not return normal error codes as 'irqreturn_t' is expected.
Not necessary to apply to stable as the original check cannot fail and as such the bug cannot actually occur.
--- drivers/iio/imu/adis16400.c | 3 --- 1 file changed, 3 deletions(-)
drivers/iio/imu/adis16400.c +0 -3
@@ -645,9 +645,6 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p)void *buffer;int ret; -if (!adis->buffer) -return -ENOMEM ; -if (!(st->variant->flags &ADIS16400_NO_BURST ) && st->adis.spi->max_speed_hz >ADIS16400_SPI_BURST ) { st->adis.spi->max_speed_hz =ADIS16400_SPI_BURST ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 615/800 iio: adis16475: do not return ints in irq handlers
In reply to Greg Kroah-HartmanFrom: Nuno Sa <[email protected]>
[ Upstream commit 00a72db718fa198da3946286dcad222399ccd4fb ]
On an IRQ handler we should not return normal error codes as 'irqreturn_t' is expected.
This is done by jumping to the 'check_burst32' label where we return 'IRQ_HANDLED'. Note that it is fine to do the burst32 check in this error path. If we have proper settings to apply burst32, we might just do the setup now so that the next sample already uses it.
--- drivers/iio/imu/adis16475.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/adis16475.c +1 -1
@@ -1068,7 +1068,7 @@ static irqreturn_t adis16475_trigger_handler(int irq, void *p) ret =spi_sync (adis->spi, &adis->msg);if (ret) -return ret; + goto check_burst32; adis->spi->max_speed_hz = cached_spi_speed_hz; buffer = adis->buffer;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 616/800 iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit fc36da3131a747a9367a05caf06de19be1bcc972 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/bma180.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/bma180.c +7 -3
@@ -164,7 +164,11 @@ struct bma180_data {int scale;int bw;bool pmode; -u8 buff[16 ];/* 3x 16-bit + 8-bit + padding + timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s16 chan[4 ]; +s64 timestamp__aligned(8) ; + } scan; };enum bma180_chan {
@@ -943,12 +947,12 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)mutex_unlock (&data->mutex); goto err; } - ((s16 *)data->buff)[i++] = ret; + data->scan.chan[i++] = ret; }mutex_unlock (&data->mutex); -iio_push_to_buffers_with_timestamp (indio_dev, data->buff, time_ns); +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, time_ns); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 617/800 iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 151dbf0078da98206817ee0b87d499035479ef11 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/bma220_spi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/bma220_spi.c +7 -3
@@ -63,7 +63,11 @@ static const int bma220_scale_table[][2] = {struct bma220_data {struct spi_device *spi_device;struct mutex lock; -s8 buffer[16 ];/* 3x8-bit channels + 5x8 padding + 8x8 timestamp */ +struct { +s8 chans[3 ]; +/* Ensure timestamp is naturally aligned. */ +s64 timestamp__aligned(8) ; + } scan;u8 tx_buf[2 ]____cacheline_aligned ; };
@@ -94,12 +98,12 @@ static irqreturn_t bma220_trigger_handler(int irq, void *p)mutex_lock (&data->lock); data->tx_buf[0 ] =BMA220_REG_ACCEL_X |BMA220_READ_MASK ; - ret =spi_write_then_read (spi, data->tx_buf,1 , data->buffer, + ret =spi_write_then_read (spi, data->tx_buf,1 , &data->scan.chans,ARRAY_SIZE (bma220_channels) -1 );if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:mutex_unlock (&data->lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 618/800 iio: accel: hid: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit c6559bf796ccdb3a0c79db846af96c8f7046880b ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Note this matches what was done in all the other hid sensor drivers. This one was missed previously due to an extra level of indirection.
Found during an audit of all calls of this function.
--- drivers/iio/accel/hid-sensor-accel-3d.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/iio/accel/hid-sensor-accel-3d.c +8 -5
@@ -28,8 +28,11 @@ struct accel_3d_state {struct hid_sensor_hub_callbacks callbacks;struct hid_sensor_common common_attributes;struct hid_sensor_hub_attribute_info accel[ACCEL_3D_CHANNEL_MAX ]; -/* Reserve for 3 channels + padding + timestamp */ -u32 accel_val[ACCEL_3D_CHANNEL_MAX +3 ]; +/* Ensure timestamp is naturally aligned */ +struct { +u32 accel_val[3 ]; +s64 timestamp__aligned(8) ; + } scan;int scale_pre_decml;int scale_post_decml;int scale_precision;
@@ -245,8 +248,8 @@ static int accel_3d_proc_event(struct hid_sensor_hub_device *hsdev, accel_state->timestamp =iio_get_time_ns (indio_dev);hid_sensor_push_data (indio_dev, - accel_state->accel_val, -sizeof (accel_state->accel_val), + &accel_state->scan, +sizeof (accel_state->scan), accel_state->timestamp); accel_state->timestamp =0 ;
@@ -271,7 +274,7 @@ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev,case HID_USAGE_SENSOR_ACCEL_Y_AXIS :case HID_USAGE_SENSOR_ACCEL_Z_AXIS : offset = usage_id -HID_USAGE_SENSOR_ACCEL_X_AXIS ; - accel_state->accel_val[CHANNEL_SCAN_INDEX_X + offset] = + accel_state->scan.accel_val[CHANNEL_SCAN_INDEX_X + offset] = *(u32 *)raw_data; ret =0 ;break ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 619/800 iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 3ab3aa2e7bd57497f9a7c6275c00dce237d2c9ba ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/kxcjk-1013.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/iio/accel/kxcjk-1013.c +14 -10
@@ -133,6 +133,13 @@ enum kx_acpi_type { ACPI_KIOX010A, }; +enum kxcjk1013_axis { +AXIS_X , +AXIS_Y , +AXIS_Z , +AXIS_MAX +}; +struct kxcjk1013_data {struct regulator_bulk_data regulators[2 ];struct i2c_client *client;
@@ -140,7 +147,11 @@ struct kxcjk1013_data {struct iio_trigger *motion_trig;struct iio_mount_matrix orientation;struct mutex mutex; -s16 buffer[8 ]; +/* Ensure timestamp naturally aligned */ +struct { +s16 chans[AXIS_MAX ]; +s64 timestamp__aligned(8) ; + } scan;u8 odr_bits;u8 range;int wake_thres;
@@ -154,13 +165,6 @@ struct kxcjk1013_data {enum kx_acpi_type acpi_type; }; -enum kxcjk1013_axis { -AXIS_X , -AXIS_Y , -AXIS_Z , -AXIS_MAX , -}; -enum kxcjk1013_mode {STANDBY ,OPERATION ,
@@ -1094,12 +1098,12 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data_or_emulated (data->client,KXCJK1013_REG_XOUT_L ,AXIS_MAX *2 , - (u8 *)data->buffer); + (u8 *)data->scan.chans);mutex_unlock (&data->mutex);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, data->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 620/800 iio: accel: mxc4005: Fix overread of data and alignment issue.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f65802284a3a337510d7f8f916c97d66c74f2e71 ]
The bulk read size is based on the size of an array that also has space for the timestamp alongside the channels.
Fix that and also fix alignment of the buffer passed
to iio_push_to_buffers_with_timestamp.
Found during an audit of all calls to this function.
--- drivers/iio/accel/mxc4005.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/mxc4005.c +7 -3
@@ -56,7 +56,11 @@ struct mxc4005_data {struct mutex mutex;struct regmap *regmap;struct iio_trigger *dready_trig; -__be16 buffer[8 ]; +/* Ensure timestamp is naturally aligned */ +struct { +__be16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan;bool trigger_enabled; };
@@ -135,7 +139,7 @@ static int mxc4005_read_xyz(struct mxc4005_data *data)int ret; ret =regmap_bulk_read (data->regmap,MXC4005_REG_XOUT_UPPER , - data->buffer,sizeof (data->buffer)); + data->scan.chans,sizeof (data->scan.chans));if (ret <0 ) {dev_err (data->dev,"failed to read axes\n" );return ret;
@@ -301,7 +305,7 @@ static irqreturn_t mxc4005_trigger_handler(int irq, void *private)if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 621/800 iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f40a71ffec808e7e51848f63f0c0d3c32d65081b ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/stk8312.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/iio/accel/stk8312.c +8 -4
@@ -103,7 +103,11 @@ struct stk8312_data {u8 mode;struct iio_trigger *dready_trig;bool dready_trigger_on; -s8 buffer[16 ];/* 3x8-bit channels + 5x8 padding + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s8 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan; }; static IIO_CONST_ATTR(in_accel_scale_available, STK8312_SCALE_AVAIL);
@@ -438,7 +442,7 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data (data->client,STK8312_REG_XOUT ,STK8312_ALL_CHANNEL_SIZE , - data->buffer); + data->scan.chans);if (ret <STK8312_ALL_CHANNEL_SIZE ) {dev_err (&data->client->dev,"register read failed\n" );mutex_unlock (&data->lock);
@@ -452,12 +456,12 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p)mutex_unlock (&data->lock); goto err; } - data->buffer[i++] = ret; + data->scan.chans[i++] = ret; } }mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 622/800 iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 334883894bc1e145a1e0f5de1b0d1b6a1133f0e6 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/stk8ba50.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/iio/accel/stk8ba50.c +8 -9
@@ -91,12 +91,11 @@ struct stk8ba50_data {u8 sample_rate_idx;struct iio_trigger *dready_trig;bool dready_trigger_on; -/* -* 3 x 16-bit channels (10-bit data, 6-bit padding) + -* 1 x 16 padding + -* 4 x 16 64-bit timestamp -*/ -s16 buffer[8 ]; +/* Ensure timestamp is naturally aligned */ +struct { +s16 chans[3 ]; +s64 timetamp__aligned(8) ; + } scan; };#define STK8BA50_ACCEL_CHANNEL (index, reg, axis) { \
@@ -324,7 +323,7 @@ static irqreturn_t stk8ba50_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data (data->client,STK8BA50_REG_XOUT ,STK8BA50_ALL_CHANNEL_SIZE , - (u8 *)data->buffer); + (u8 *)data->scan.chans);if (ret <STK8BA50_ALL_CHANNEL_SIZE ) {dev_err (&data->client->dev,"register read failed\n" ); goto err;
@@ -337,10 +336,10 @@ static irqreturn_t stk8ba50_trigger_handler(int irq, void *p)if (ret <0 ) goto err; - data->buffer[i++] = ret; + data->scan.chans[i++] = ret; } } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:mutex_unlock (&data->lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 623/800 iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit d85d71dd1ab67eaa7351f69fec512d8f09d164e1 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/adc/ti-ads1015.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-ads1015.c +8 -4
@@ -395,10 +395,14 @@ static irqreturn_t ads1015_trigger_handler(int irq, void *p)struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct ads1015_data *data =iio_priv (indio_dev); -s16 buf[8 ];/* 1x s16 ADC val + 3x s16 padding + 4x s16 timestamp */ +/* Ensure natural alignment of timestamp */ +struct { +s16 chan; +s64 timestamp__aligned(8) ; + } scan;int chan, ret, res; -memset (buf,0 ,sizeof (buf)); +memset (&scan,0 ,sizeof (scan));mutex_lock (&data->lock); chan = find_first_bit(indio_dev->active_scan_mask,
@@ -409,10 +413,10 @@ static irqreturn_t ads1015_trigger_handler(int irq, void *p) goto err; } - buf[0 ] = res; + scan.chan = res;mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, buf, +iio_push_to_buffers_with_timestamp (indio_dev, &scan,iio_get_time_ns (indio_dev)); err:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 624/800 iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 7765dfaa22ea08abf0c175e7553826ba2a939632 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/adc/vf610_adc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/adc/vf610_adc.c +7 -3
@@ -167,7 +167,11 @@ struct vf610_adc {u32 sample_freq_avail[5 ];struct completion completion; -u16 buffer[8 ]; +/* Ensure the timestamp is naturally aligned */ +struct { +u16 chan; +s64 timestamp__aligned(8) ; + } scan; };static const u32 vf610_hw_avgs[] = {1 ,4 ,8 ,16 ,32 };
@@ -579,9 +583,9 @@ static irqreturn_t vf610_adc_isr(int irq, void *dev_id)if (coco &VF610_ADC_HS_COCO0 ) { info->value =vf610_adc_read_data (info);if (iio_buffer_enabled (indio_dev)) { - info->buffer[0 ] = info->value; + info->scan.chan = info->value;iio_push_to_buffers_with_timestamp (indio_dev, - info->buffer, + &info->scan,iio_get_time_ns (indio_dev));iio_trigger_notify_done (indio_dev->trig); }else
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 625/800 iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 06778d881f3798ce93ffbbbf801234292250b598 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/gyro/bmg160_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/gyro/bmg160_core.c +7 -3
@@ -98,7 +98,11 @@ struct bmg160_data {struct iio_trigger *motion_trig;struct iio_mount_matrix orientation;struct mutex mutex; -s16 buffer[8 ]; +/* Ensure naturally aligned timestamp */ +struct { +s16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan;u32 dps_range;int ev_enable_state;int slope_thres;
@@ -882,12 +886,12 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); ret =regmap_bulk_read (data->regmap,BMG160_REG_XOUT_L , - data->buffer,AXIS_MAX *2 ); + data->scan.chans,AXIS_MAX *2 );mutex_unlock (&data->mutex);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 626/800 iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f4ca2e2595d9fee65d5ce0d218b22ce00e5b2915 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/humidity/am2315.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/iio/humidity/am2315.c +10 -6
@@ -33,7 +33,11 @@struct am2315_data {struct i2c_client *client;struct mutex lock; -s16 buffer[8 ];/* 2x16-bit channels + 2x16 padding + 4x16 timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s16 chans[2 ]; +s64 timestamp__aligned(8) ; + } scan; };struct am2315_sensor_data {
@@ -167,20 +171,20 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p)mutex_lock (&data->lock);if (*(indio_dev->active_scan_mask) ==AM2315_ALL_CHANNEL_MASK ) { - data->buffer[0 ] = sensor_data.hum_data; - data->buffer[1 ] = sensor_data.temp_data; + data->scan.chans[0 ] = sensor_data.hum_data; + data->scan.chans[1 ] = sensor_data.temp_data; }else { i =0 ;for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { - data->buffer[i] = (bit ? sensor_data.temp_data : - sensor_data.hum_data); + data->scan.chans[i] = (bit ? sensor_data.temp_data : + sensor_data.hum_data); i++; } }mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 627/800 iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 19f1a254fe4949fff1e67db386409f48cf438bd7 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/proximity/srf08.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/iio/proximity/srf08.c +7 -7
@@ -63,11 +63,11 @@ struct srf08_data {int range_mm;struct mutex lock; -/* -* triggered buffer -* 1x16-bit channel + 3x16 padding + 4x16 timestamp -*/ -s16 buffer[8 ]; +/* Ensure timestamp is naturally aligned */ +struct { +s16 chan; +s64 timestamp__aligned(8) ; + } scan;/* Sensor-Type */ enum srf08_sensor_type sensor_type;
@@ -190,9 +190,9 @@ static irqreturn_t srf08_trigger_handler(int irq, void *p)mutex_lock (&data->lock); - data->buffer[0 ] = sensor_data; + data->scan.chan = sensor_data;iio_push_to_buffers_with_timestamp (indio_dev, - data->buffer, pf->timestamp); + &data->scan, pf->timestamp);mutex_unlock (&data->lock); err:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 628/800 iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 679cc377a03ff1944491eafc7355c1eb1fad4109 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +7 -3
@@ -44,7 +44,11 @@ struct lidar_data {int (*xfer)(struct lidar_data *data,u8 reg,u8 *val,int len);int i2c_enabled; -u16 buffer[8 ];/* 2 byte distance + 8 byte timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chan; +s64 timestamp__aligned(8) ; + } scan; };static const struct iio_chan_spec lidar_channels[] = {
@@ -230,9 +234,9 @@ static irqreturn_t lidar_trigger_handler(int irq, void *private)struct lidar_data *data =iio_priv (indio_dev);int ret; - ret =lidar_get_measurement (data, data->buffer); + ret =lidar_get_measurement (data, &data->scan.chan);if (!ret) { -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); }else if (ret != -EINVAL ) {dev_err (&data->client->dev,"cannot read LIDAR measurement" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 629/800 iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 37eb8d8c64f2ecb3a5521ba1cc1fad973adfae41 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/proximity/as3935.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/proximity/as3935.c +7 -3
@@ -59,7 +59,11 @@ struct as3935_state {unsigned long noise_tripped;u32 tune_cap;u32 nflwdth_reg; -u8 buffer[16 ];/* 8-bit data + 56-bit padding + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u8 chan; +s64 timestamp__aligned(8) ; + } scan;u8 buf[2 ]____cacheline_aligned ; };
@@ -225,8 +229,8 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private)if (ret) goto err_read; - st->buffer[0 ] = val &AS3935_DATA_MASK ; -iio_push_to_buffers_with_timestamp (indio_dev, &st->buffer, + st->scan.chan = val &AS3935_DATA_MASK ; +iio_push_to_buffers_with_timestamp (indio_dev, &st->scan,iio_get_time_ns (indio_dev)); err_read:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 630/800 iio: magn: hmc5843: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 1ef2f51e9fe424ccecca5bb0373d71b900c2cd41 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/magnetometer/hmc5843.h | 8 ++++++-- drivers/iio/magnetometer/hmc5843_core.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/iio/magnetometer/hmc5843.h +6 -2
@@ -33,7 +33,8 @@ enum hmc5843_ids {* @lock: update and read regmap data * @regmap: hardware access register maps * @variant: describe chip variants -* @buffer: 3x 16-bit channels + padding + 64-bit timestamp +* @scan: buffer to pack data for passing to +* iio_push_to_buffers_with_timestamp() */ struct hmc5843_data {struct device *dev;
@@ -41,7 +42,10 @@ struct hmc5843_data {struct regmap *regmap;const struct hmc5843_chip_info *variant;struct iio_mount_matrix orientation; -__be16 buffer[8 ]; +struct { +__be16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan; }; int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
drivers/iio/magnetometer/hmc5843_core.c +2 -2
@@ -446,13 +446,13 @@ static irqreturn_t hmc5843_trigger_handler(int irq, void *p) } ret =regmap_bulk_read (data->regmap,HMC5843_DATA_OUT_MSB_REGS , - data->buffer,3 *sizeof (__be16)); + data->scan.chans,sizeof (data->scan.chans));mutex_unlock (&data->lock);if (ret <0 ) goto done; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 631/800 iio: magn: bmc150: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 7692088f72865c41b6b531fd09486ee99a5da930 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/magnetometer/bmc150_magn.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/iio/magnetometer/bmc150_magn.c +7 -4
@@ -138,8 +138,11 @@ struct bmc150_magn_data {struct regmap *regmap;struct regulator_bulk_data regulators[2 ];struct iio_mount_matrix orientation; -/* 4 x 32 bits for x, y z, 4 bytes align, 64 bits timestamp */ -s32 buffer[6 ]; +/* Ensure timestamp is naturally aligned */ +struct { +s32 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan;struct iio_trigger *dready_trig;bool dready_trigger_on;int max_odr;
@@ -675,11 +678,11 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p)int ret;mutex_lock (&data->mutex); - ret =bmc150_magn_read_xyz (data, data->buffer); + ret =bmc150_magn_read_xyz (data, data->scan.chans);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 632/800 iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 3d4725194de6935dba2ad7c9cc075c885008f747 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/light/isl29125.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/light/isl29125.c +7 -3
@@ -51,7 +51,11 @@struct isl29125_data {struct i2c_client *client;u8 conf1; -u16 buffer[8 ];/* 3x 16-bit, padding, 8 bytes timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan; };#define ISL29125_CHANNEL (_color, _si) { \
@@ -184,10 +188,10 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 633/800 iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit ff08fbc22ab32ccc6690c21b0e5e1d402dcc076f ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/light/tcs3414.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/light/tcs3414.c +7 -3
@@ -53,7 +53,11 @@ struct tcs3414_data {u8 control;u8 gain;u8 timing; -u16 buffer[8 ];/* 4x 16-bit + 8 bytes timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[4 ]; +s64 timestamp__aligned(8) ; + } scan; };#define TCS3414_CHANNEL (_color, _si, _addr) { \
@@ -209,10 +213,10 @@ static irqreturn_t tcs3414_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 634/800 iio: light: tcs3472: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit df2f37cffd6ed486d613e7ee22aadc8e49ae2dd3 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp().
Fixes tag is not strictly accurate as prior to that patch there was potentially an unaligned write. However, any backport past there will need to be done manually.
--- drivers/iio/light/tcs3472.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/light/tcs3472.c +7 -3
@@ -64,7 +64,11 @@ struct tcs3472_data {u8 control;u8 atime;u8 apers; -u16 buffer[8 ];/* 4 16-bit channels + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[4 ]; +s64 timestamp__aligned(8) ; + } scan; };static const struct iio_event_spec tcs3472_events[] = {
@@ -386,10 +390,10 @@ static irqreturn_t tcs3472_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 635/800 iio: chemical: atlas: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit b0f5d8db7348a6ce5cdd79fba46ebc91eebc8fd9 ]
Variable location for the timestamp, so just use __aligned(8) to ensure it is always possible to naturally align it.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
Fixes tag is not accurate, but it will need manual backporting beyond that point if anyone cares.
--- drivers/iio/chemical/atlas-sensor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/chemical/atlas-sensor.c +2 -2
@@ -91,8 +91,8 @@ struct atlas_data {struct regmap *regmap;struct irq_work work;unsigned int interrupt_enabled; - -__be32 buffer[6 ];/* 96-bit data + 32-bit pad + 64-bit timestamp */ +/* 96-bit data + 32-bit pad + 64-bit timestamp */ +__be32 buffer[6 ]__aligned(8) ; };static const struct regmap_config atlas_regmap_config = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 636/800 iio: cros_ec_sensors: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 8dea228b174ac9637b567e5ef54f4c40db4b3c41 ]
The samples buffer is passed to iio_push_to_buffers_with_timestamp() which requires a buffer aligned to 8 bytes as it is assumed that the timestamp will be naturally aligned if present.
Fixes tag is inaccurate but prior to that likely manual backporting needed (for anything before 4.18) Earlier than that the include file to fix is drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.h:
commit 974e6f02e27 ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub.") present since kernel stable 4.10. (Thanks to Gwendal for tracking this down)
--- include/linux/iio/common/cros_ec_sensors_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iio/common/cros_ec_sensors_core.h +1 -1
@@ -77,7 +77,7 @@ struct cros_ec_sensors_core_state {u16 scale; } calib[CROS_EC_SENSOR_MAX_AXIS ];s8 sign[CROS_EC_SENSOR_MAX_AXIS ]; -u8 samples[CROS_EC_SAMPLE_SIZE ]; +u8 samples[CROS_EC_SAMPLE_SIZE ]__aligned(8) ;int (*read_ec_sensors_data)(struct iio_dev *indio_dev,unsigned long scan_mask,s16 *data);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 637/800 iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 8979b67ec61abc232636400ee8c758a16a73c95f ]
Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted.
Here structure is not used, because this buffer is also used elsewhere in the driver.
--- drivers/iio/potentiostat/lmp91000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/potentiostat/lmp91000.c +2 -2
@@ -71,8 +71,8 @@ struct lmp91000_data {struct completion completion;u8 chan_select; - -u32 buffer[4 ];/* 64-bit data + 64-bit timestamp */ +/* 64-bit data + 64-bit naturally aligned timestamp */ +u32 buffer[4 ]__aligned(8) ; };static const struct iio_chan_spec lmp91000_channels[] = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 638/800 ASoC: rk3328: fix missing clk_disable_unprepare() on error in rk3328_platform_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit d14eece945a8068a017995f7512ea2beac21e34b ]
Fix the missing clk_disable_unprepare() before return from rk3328_platform_probe() in the error handling case.
--- sound/soc/codecs/rk3328_codec.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
sound/soc/codecs/rk3328_codec.c +22 -6
@@ -474,7 +474,8 @@ static int rk3328_platform_probe(struct platform_device *pdev) rk3328->pclk =devm_clk_get (&pdev->dev,"pclk" );if (IS_ERR (rk3328->pclk)) {dev_err (&pdev->dev,"can't get acodec pclk\n" ); -return PTR_ERR (rk3328->pclk); + ret =PTR_ERR (rk3328->pclk); + goto err_unprepare_mclk; } ret =clk_prepare_enable (rk3328->pclk);
@@ -484,19 +485,34 @@ static int rk3328_platform_probe(struct platform_device *pdev) } base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (base)) -return PTR_ERR (base); +if (IS_ERR (base)) { + ret =PTR_ERR (base); + goto err_unprepare_pclk; + } rk3328->regmap =devm_regmap_init_mmio (&pdev->dev, base, &rk3328_codec_regmap_config); -if (IS_ERR (rk3328->regmap)) -return PTR_ERR (rk3328->regmap); +if (IS_ERR (rk3328->regmap)) { + ret =PTR_ERR (rk3328->regmap); + goto err_unprepare_pclk; + }platform_set_drvdata (pdev, rk3328); -return devm_snd_soc_register_component (&pdev->dev, &soc_codec_rk3328, + ret =devm_snd_soc_register_component (&pdev->dev, &soc_codec_rk3328, rk3328_dai,ARRAY_SIZE (rk3328_dai)); +if (ret) + goto err_unprepare_pclk; + +return 0 ; + +err_unprepare_pclk: +clk_disable_unprepare (rk3328->pclk); + +err_unprepare_mclk: +clk_disable_unprepare (rk3328->mclk); +return ret; }static const struct of_device_id rk3328_codec_of_match[]__maybe_unused = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 639/800 ASoC: hisilicon: fix missing clk_disable_unprepare() on error in hi6210_i2s_startup()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 375904e3931955fcf0a847f029b2492a117efc43 ]
After calling clk_prepare_enable(), clk_disable_unprepare() need be called when calling clk_set_rate() failed.
--- sound/soc/hisilicon/hi6210-i2s.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
sound/soc/hisilicon/hi6210-i2s.c +8 -6
@@ -102,18 +102,15 @@ static int hi6210_i2s_startup(struct snd_pcm_substream *substream,for (n =0 ; n < i2s->clocks; n++) { ret =clk_prepare_enable (i2s->clk[n]); -if (ret) { -while (n--) -clk_disable_unprepare (i2s->clk[n]); -return ret; - } +if (ret) + goto err_unprepare_clk; } ret =clk_set_rate (i2s->clk[CLK_I2S_BASE ],49152000 );if (ret) {dev_err (i2s->dev,"%s: setting 49.152MHz base rate failed %d\n" , __func__, ret); -return ret; + goto err_unprepare_clk; }/* enable clock before frequency division */
@@ -165,6 +162,11 @@ static int hi6210_i2s_startup(struct snd_pcm_substream *substream,hi6210_write_reg (i2s,HII2S_SW_RST_N , val);return 0 ; + +err_unprepare_clk: +while (n--) +clk_disable_unprepare (i2s->clk[n]); +return ret; } static void hi6210_i2s_shutdown(struct snd_pcm_substream *substream,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 640/800 backlight: lm3630a_bl: Put fwnode in error case during ->probe()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 6d1c32dbedd7d7e7372aa38033ec8782c39f6379 ]
device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.
--- drivers/video/backlight/lm3630a_bl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/lm3630a_bl.c +3 -1
@@ -482,8 +482,10 @@ static int lm3630a_parse_node(struct lm3630a_chip *pchip,device_for_each_child_node (pchip->dev, node) { ret =lm3630a_parse_bank (pdata, node, &seen_led_sources); -if (ret) +if (ret) { +fwnode_handle_put (node);return ret; + } }return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 641/800 usb: typec: tcpm: Fix up PR_SWAP when vsafe0v is signalled
In reply to Greg Kroah-HartmanFrom: Badhri Jagan Sridharan <[email protected]>
[ Upstream commit d112efbe6dbf7d4c482e2a3f381fa315aabfe63b ]
During PR_SWAP, When TCPM is in PR_SWAP_SNK_SRC_SINK_OFF, vbus is expected to reach VSAFE0V when source turns off vbus. Do not move to SNK_UNATTACHED state when this happens.
--- drivers/usb/typec/tcpm/tcpm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +3 -0
@@ -5225,6 +5225,9 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port)tcpm_set_state (port,SNK_UNATTACHED ,0 ); }break ; +case PR_SWAP_SNK_SRC_SINK_OFF : +/* Do nothing, vsafe0v is expected during transition */ +break ;default :if (port->pwr_role ==TYPEC_SINK && port->auto_vbus_discharge_enabled)tcpm_set_state (port,SNK_UNATTACHED ,0 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 642/800 ASoC: rsnd: tidyup loop on rsnd_adg_clk_query()
In reply to Greg Kroah-HartmanFrom: Kuninori Morimoto <[email protected]>
[ Upstream commit cf9d5c6619fadfc41cf8f5154cb990cc38e3da85 ]
commit 06e8f5c842f2d ("ASoC: rsnd: don't call clk_get_rate() under atomic context") used saved clk_rate, thus for_each_rsnd_clk() is no longer needed. This patch fixes it.
--- sound/soc/sh/rcar/adg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/sh/rcar/adg.c +1 -3
@@ -290,7 +290,6 @@ static void rsnd_adg_set_ssi_clk(struct rsnd_mod *ssi_mod, u32 val)int rsnd_adg_clk_query (struct rsnd_priv *priv,unsigned int rate) {struct rsnd_adg *adg =rsnd_priv_to_adg (priv); -struct clk *clk;int i;int sel_table[] = { [CLKA ] =0x1 ,
@@ -303,10 +302,9 @@ int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate)* find suitable clock from * AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC/AUDIO_CLKI. */ -for_each_rsnd_clk (clk, adg, i) { +for (i =0 ; i <CLKMAX ; i++)if (rate == adg->clk_rate[i])return sel_table[i]; - }/* * find divided clock from BRGA/BRGB
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 643/800 Input: hil_kbd - fix error return code in hil_dev_connect()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit d9b576917a1d0efa293801a264150a1b37691617 ]
Return error code -EINVAL rather than '0' when the combo devices are not supported.
--- drivers/input/keyboard/hil_kbd.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/keyboard/hil_kbd.c +1 -0
@@ -512,6 +512,7 @@ static int hil_dev_connect(struct serio *serio, struct serio_driver *drv) HIL_IDD_NUM_AXES_PER_SET(*idd)) { printk(KERN_INFO PREFIX "combo devices are not supported.\n"); + error = -EINVAL ; goto bail1; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 644/800 perf scripting python: Fix tuple_set_u64()
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
[ Upstream commit d04c1ff0b3ddd5c0fbbe640996c8eaad279ed1c5 ]
tuple_set_u64() produces a signed value instead of an unsigned value. That works for database export but not other cases. Rename to tuple_set_d64() for database export and fix tuple_set_u64().
--- .../scripting-engines/trace-event-python.c | 146 ++++++++++-------- 1 file changed, 81 insertions(+), 65 deletions(-)
tools/perf/util/scripting-engines/trace-event-python.c +81 -65
@@ -934,7 +934,7 @@ static PyObject *tuple_new(unsigned int sz)return t; } -static int tuple_set_u64 (PyObject *t,unsigned int pos,u64 val) +static int tuple_set_s64 (PyObject *t,unsigned int pos,s64 val) {#if BITS_PER_LONG ==64 return PyTuple_SetItem (t, pos,_PyLong_FromLong (val));
@@ -944,6 +944,22 @@ static int tuple_set_u64(PyObject *t, unsigned int pos, u64 val)#endif } +/* +* Databases support only signed 64-bit numbers, so even though we are +* exporting a u64, it must be as s64. +*/ +#define tuple_set_d64 tuple_set_s64 + +static int tuple_set_u64 (PyObject *t,unsigned int pos,u64 val) +{ +#if BITS_PER_LONG ==64 +return PyTuple_SetItem (t, pos,PyLong_FromUnsignedLong (val)); +#endif +#if BITS_PER_LONG ==32 +return PyTuple_SetItem (t, pos,PyLong_FromUnsignedLongLong (val)); +#endif +} +static int tuple_set_s32 (PyObject *t,unsigned int pos,s32 val) {return PyTuple_SetItem (t, pos,_PyLong_FromLong (val));
@@ -967,7 +983,7 @@ static int python_export_evsel(struct db_export *dbe, struct evsel *evsel) t =tuple_new (2 ); -tuple_set_u64 (t,0 , evsel->db_id); +tuple_set_d64 (t,0 , evsel->db_id);tuple_set_string (t,1 ,evsel__name (evsel));call_object (tables->evsel_handler, t,"evsel_table" );
@@ -985,7 +1001,7 @@ static int python_export_machine(struct db_export *dbe, t =tuple_new (3 ); -tuple_set_u64 (t,0 , machine->db_id); +tuple_set_d64 (t,0 , machine->db_id);tuple_set_s32 (t,1 , machine->pid);tuple_set_string (t,2 , machine->root_dir ? machine->root_dir :"" );
@@ -1004,9 +1020,9 @@ static int python_export_thread(struct db_export *dbe, struct thread *thread, t =tuple_new (5 ); -tuple_set_u64 (t,0 , thread->db_id); -tuple_set_u64 (t,1 , machine->db_id); -tuple_set_u64 (t,2 , main_thread_db_id); +tuple_set_d64 (t,0 , thread->db_id); +tuple_set_d64 (t,1 , machine->db_id); +tuple_set_d64 (t,2 , main_thread_db_id);tuple_set_s32 (t,3 , thread->pid_);tuple_set_s32 (t,4 , thread->tid);
@@ -1025,10 +1041,10 @@ static int python_export_comm(struct db_export *dbe, struct comm *comm, t =tuple_new (5 ); -tuple_set_u64 (t,0 , comm->db_id); +tuple_set_d64 (t,0 , comm->db_id);tuple_set_string (t,1 ,comm__str (comm)); -tuple_set_u64 (t,2 , thread->db_id); -tuple_set_u64 (t,3 , comm->start); +tuple_set_d64 (t,2 , thread->db_id); +tuple_set_d64 (t,3 , comm->start);tuple_set_s32 (t,4 , comm->exec);call_object (tables->comm_handler, t,"comm_table" );
@@ -1046,9 +1062,9 @@ static int python_export_comm_thread(struct db_export *dbe, u64 db_id, t =tuple_new (3 ); -tuple_set_u64 (t,0 , db_id); -tuple_set_u64 (t,1 , comm->db_id); -tuple_set_u64 (t,2 , thread->db_id); +tuple_set_d64 (t,0 , db_id); +tuple_set_d64 (t,1 , comm->db_id); +tuple_set_d64 (t,2 , thread->db_id);call_object (tables->comm_thread_handler, t,"comm_thread_table" );
@@ -1068,8 +1084,8 @@ static int python_export_dso(struct db_export *dbe, struct dso *dso, t =tuple_new (5 ); -tuple_set_u64 (t,0 , dso->db_id); -tuple_set_u64 (t,1 , machine->db_id); +tuple_set_d64 (t,0 , dso->db_id); +tuple_set_d64 (t,1 , machine->db_id);tuple_set_string (t,2 , dso->short_name);tuple_set_string (t,3 , dso->long_name);tuple_set_string (t,4 , sbuild_id);
@@ -1090,10 +1106,10 @@ static int python_export_symbol(struct db_export *dbe, struct symbol *sym, t =tuple_new (6 ); -tuple_set_u64 (t,0 , *sym_db_id); -tuple_set_u64 (t,1 , dso->db_id); -tuple_set_u64 (t,2 , sym->start); -tuple_set_u64 (t,3 , sym->end); +tuple_set_d64 (t,0 , *sym_db_id); +tuple_set_d64 (t,1 , dso->db_id); +tuple_set_d64 (t,2 , sym->start); +tuple_set_d64 (t,3 , sym->end);tuple_set_s32 (t,4 , sym->binding);tuple_set_string (t,5 , sym->name);
@@ -1130,30 +1146,30 @@ static void python_export_sample_table(struct db_export *dbe, t =tuple_new (24 ); -tuple_set_u64 (t,0 , es->db_id); -tuple_set_u64 (t,1 , es->evsel->db_id); -tuple_set_u64 (t,2 , es->al->maps->machine->db_id); -tuple_set_u64 (t,3 , es->al->thread->db_id); -tuple_set_u64 (t,4 , es->comm_db_id); -tuple_set_u64 (t,5 , es->dso_db_id); -tuple_set_u64 (t,6 , es->sym_db_id); -tuple_set_u64 (t,7 , es->offset); -tuple_set_u64 (t,8 , es->sample->ip); -tuple_set_u64 (t,9 , es->sample->time); +tuple_set_d64 (t,0 , es->db_id); +tuple_set_d64 (t,1 , es->evsel->db_id); +tuple_set_d64 (t,2 , es->al->maps->machine->db_id); +tuple_set_d64 (t,3 , es->al->thread->db_id); +tuple_set_d64 (t,4 , es->comm_db_id); +tuple_set_d64 (t,5 , es->dso_db_id); +tuple_set_d64 (t,6 , es->sym_db_id); +tuple_set_d64 (t,7 , es->offset); +tuple_set_d64 (t,8 , es->sample->ip); +tuple_set_d64 (t,9 , es->sample->time);tuple_set_s32 (t,10 , es->sample->cpu); -tuple_set_u64 (t,11 , es->addr_dso_db_id); -tuple_set_u64 (t,12 , es->addr_sym_db_id); -tuple_set_u64 (t,13 , es->addr_offset); -tuple_set_u64 (t,14 , es->sample->addr); -tuple_set_u64 (t,15 , es->sample->period); -tuple_set_u64 (t,16 , es->sample->weight); -tuple_set_u64 (t,17 , es->sample->transaction); -tuple_set_u64 (t,18 , es->sample->data_src); +tuple_set_d64 (t,11 , es->addr_dso_db_id); +tuple_set_d64 (t,12 , es->addr_sym_db_id); +tuple_set_d64 (t,13 , es->addr_offset); +tuple_set_d64 (t,14 , es->sample->addr); +tuple_set_d64 (t,15 , es->sample->period); +tuple_set_d64 (t,16 , es->sample->weight); +tuple_set_d64 (t,17 , es->sample->transaction); +tuple_set_d64 (t,18 , es->sample->data_src);tuple_set_s32 (t,19 , es->sample->flags &PERF_BRANCH_MASK );tuple_set_s32 (t,20 , !!(es->sample->flags &PERF_IP_FLAG_IN_TX )); -tuple_set_u64 (t,21 , es->call_path_id); -tuple_set_u64 (t,22 , es->sample->insn_cnt); -tuple_set_u64 (t,23 , es->sample->cyc_cnt); +tuple_set_d64 (t,21 , es->call_path_id); +tuple_set_d64 (t,22 , es->sample->insn_cnt); +tuple_set_d64 (t,23 , es->sample->cyc_cnt);call_object (tables->sample_handler, t,"sample_table" );
@@ -1167,8 +1183,8 @@ static void python_export_synth(struct db_export *dbe, struct export_sample *es) t =tuple_new (3 ); -tuple_set_u64 (t,0 , es->db_id); -tuple_set_u64 (t,1 , es->evsel->core.attr.config); +tuple_set_d64 (t,0 , es->db_id); +tuple_set_d64 (t,1 , es->evsel->core.attr.config);tuple_set_bytes (t,2 , es->sample->raw_data, es->sample->raw_size);call_object (tables->synth_handler, t,"synth_data" );
@@ -1200,10 +1216,10 @@ static int python_export_call_path(struct db_export *dbe, struct call_path *cp) t =tuple_new (4 ); -tuple_set_u64 (t,0 , cp->db_id); -tuple_set_u64 (t,1 , parent_db_id); -tuple_set_u64 (t,2 , sym_db_id); -tuple_set_u64 (t,3 , cp->ip); +tuple_set_d64 (t,0 , cp->db_id); +tuple_set_d64 (t,1 , parent_db_id); +tuple_set_d64 (t,2 , sym_db_id); +tuple_set_d64 (t,3 , cp->ip);call_object (tables->call_path_handler, t,"call_path_table" );
@@ -1221,20 +1237,20 @@ static int python_export_call_return(struct db_export *dbe, t =tuple_new (14 ); -tuple_set_u64 (t,0 , cr->db_id); -tuple_set_u64 (t,1 , cr->thread->db_id); -tuple_set_u64 (t,2 , comm_db_id); -tuple_set_u64 (t,3 , cr->cp->db_id); -tuple_set_u64 (t,4 , cr->call_time); -tuple_set_u64 (t,5 , cr->return_time); -tuple_set_u64 (t,6 , cr->branch_count); -tuple_set_u64 (t,7 , cr->call_ref); -tuple_set_u64 (t,8 , cr->return_ref); -tuple_set_u64 (t,9 , cr->cp->parent->db_id); +tuple_set_d64 (t,0 , cr->db_id); +tuple_set_d64 (t,1 , cr->thread->db_id); +tuple_set_d64 (t,2 , comm_db_id); +tuple_set_d64 (t,3 , cr->cp->db_id); +tuple_set_d64 (t,4 , cr->call_time); +tuple_set_d64 (t,5 , cr->return_time); +tuple_set_d64 (t,6 , cr->branch_count); +tuple_set_d64 (t,7 , cr->call_ref); +tuple_set_d64 (t,8 , cr->return_ref); +tuple_set_d64 (t,9 , cr->cp->parent->db_id);tuple_set_s32 (t,10 , cr->flags); -tuple_set_u64 (t,11 , cr->parent_db_id); -tuple_set_u64 (t,12 , cr->insn_count); -tuple_set_u64 (t,13 , cr->cyc_count); +tuple_set_d64 (t,11 , cr->parent_db_id); +tuple_set_d64 (t,12 , cr->insn_count); +tuple_set_d64 (t,13 , cr->cyc_count);call_object (tables->call_return_handler, t,"call_return_table" );
@@ -1254,14 +1270,14 @@ static int python_export_context_switch(struct db_export *dbe, u64 db_id, t =tuple_new (9 ); -tuple_set_u64 (t,0 , db_id); -tuple_set_u64 (t,1 , machine->db_id); -tuple_set_u64 (t,2 , sample->time); +tuple_set_d64 (t,0 , db_id); +tuple_set_d64 (t,1 , machine->db_id); +tuple_set_d64 (t,2 , sample->time);tuple_set_s32 (t,3 , sample->cpu); -tuple_set_u64 (t,4 , th_out_id); -tuple_set_u64 (t,5 , comm_out_id); -tuple_set_u64 (t,6 , th_in_id); -tuple_set_u64 (t,7 , comm_in_id); +tuple_set_d64 (t,4 , th_out_id); +tuple_set_d64 (t,5 , comm_out_id); +tuple_set_d64 (t,6 , th_in_id); +tuple_set_d64 (t,7 , comm_in_id);tuple_set_s32 (t,8 , flags);call_object (tables->context_switch_handler, t,"context_switch" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 645/800 mtd: partitions: redboot: seek fis-index-block in the right node
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 237960880960863fb41888763d635b384cffb104 ]
fis-index-block is seeked in the master node and not in the partitions node. For following binding and current usage, the driver need to check the partitions subnode.
--- drivers/mtd/parsers/redboot.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mtd/parsers/redboot.c +6 -1
@@ -45,6 +45,7 @@ static inline int redboot_checksum(struct fis_image_desc *img)static void parse_redboot_of (struct mtd_info *master) {struct device_node *np; +struct device_node *npart;u32 dirblock;int ret;
@@ -52,7 +53,11 @@ static void parse_redboot_of(struct mtd_info *master)if (!np)return ; - ret =of_property_read_u32 (np,"fis-index-block" , &dirblock); + npart =of_get_child_by_name (np,"partitions" ); +if (!npart) +return ; + + ret =of_property_read_u32 (npart,"fis-index-block" , &dirblock);if (ret)return ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 646/800 mtd: parsers: qcom: Fix leaking of partition name
In reply to Greg Kroah-HartmanFrom: Ansuel Smith <[email protected]>
[ Upstream commit 10f3b4d79958d6f9f71588c6fa862159c83fa80f ]
Add cleanup function as the name variable for the partition name was allocaed but never freed after the use as the add mtd function duplicate the name and free the pparts struct as the partition name is assumed to be static.
The leak was found using kmemleak.
--- drivers/mtd/parsers/qcomsmempart.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mtd/parsers/qcomsmempart.c +10 -0
@@ -159,6 +159,15 @@ out_free_parts:return ret; } +static void parse_qcomsmem_cleanup (const struct mtd_partition *pparts, +int nr_parts) +{ +int i; + +for (i =0 ; i < nr_parts; i++) +kfree (pparts[i].name); +} +static const struct of_device_id qcomsmem_of_match_table[] = { { .compatible ="qcom,smem-part" }, {},
@@ -167,6 +176,7 @@ MODULE_DEVICE_TABLE(of, qcomsmem_of_match_table);static struct mtd_part_parser mtd_parser_qcomsmem = { .parse_fn = parse_qcomsmem_part, + .cleanup = parse_qcomsmem_cleanup, .name ="qcomsmem" , .of_match_table = qcomsmem_of_match_table, };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 647/800 mtd: rawnand: arasan: Ensure proper configuration for the asserted target
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
[ Upstream commit b5437c7b682c9a505065b4ab4716cdc951dc3c7c ]
The controller being always asserting one CS or the other, there is no need to actually select the right target before doing a page read/write. However, the anfc_select_target() helper actually also changes the timing configuration and clock in the case were two different NAND chips with different timing requirements would be used. In this situation, we must ensure proper configuration of the controller by calling it.
As a consequence of this change, the anfc_select_target() helper is being moved earlier in the driver.
--- drivers/mtd/nand/raw/arasan-nand-controller.c | 90 ++++++++++++------- 1 file changed, 57 insertions(+), 33 deletions(-)
drivers/mtd/nand/raw/arasan-nand-controller.c +57 -33
@@ -273,6 +273,37 @@ static int anfc_pkt_len_config(unsigned int len, unsigned int *steps,return 0 ; } +static int anfc_select_target (struct nand_chip *chip,int target) +{ +struct anand *anand =to_anand (chip); +struct arasan_nfc *nfc =to_anfc (chip->controller); +int ret; + +/* Update the controller timings and the potential ECC configuration */ +writel_relaxed (anand->timings, nfc->base +DATA_INTERFACE_REG ); + +/* Update clock frequency */ +if (nfc->cur_clk != anand->clk) { +clk_disable_unprepare (nfc->controller_clk); + ret =clk_set_rate (nfc->controller_clk, anand->clk); +if (ret) { +dev_err (nfc->dev,"Failed to change clock rate\n" ); +return ret; + } + + ret =clk_prepare_enable (nfc->controller_clk); +if (ret) { +dev_err (nfc->dev, +"Failed to re-enable the controller clock\n" ); +return ret; + } + + nfc->cur_clk = anand->clk; + } + +return 0 ; +} +/* * When using the embedded hardware ECC engine, the controller is in charge of * feeding the engine with, first, the ECC residue present in the data array.
@@ -401,6 +432,18 @@ static int anfc_read_page_hw_ecc(struct nand_chip *chip, u8 *buf,return 0 ; } +static int anfc_sel_read_page_hw_ecc (struct nand_chip *chip,u8 *buf, +int oob_required,int page) +{ +int ret; + + ret =anfc_select_target (chip, chip->cur_cs); +if (ret) +return ret; + +return anfc_read_page_hw_ecc (chip, buf, oob_required, page); +}; +static int anfc_write_page_hw_ecc (struct nand_chip *chip,const u8 *buf,int oob_required,int page) {
@@ -461,6 +504,18 @@ static int anfc_write_page_hw_ecc(struct nand_chip *chip, const u8 *buf,return ret; } +static int anfc_sel_write_page_hw_ecc (struct nand_chip *chip,const u8 *buf, +int oob_required,int page) +{ +int ret; + + ret =anfc_select_target (chip, chip->cur_cs); +if (ret) +return ret; + +return anfc_write_page_hw_ecc (chip, buf, oob_required, page); +}; +/* NAND framework ->exec_op() hooks and related helpers */ static int anfc_parse_instructions(struct nand_chip *chip, const struct nand_subop *subop,
@@ -753,37 +808,6 @@ static const struct nand_op_parser anfc_op_parser = NAND_OP_PARSER( NAND_OP_PARSER_PAT_WAITRDY_ELEM(false)), ); -static int anfc_select_target (struct nand_chip *chip,int target) -{ -struct anand *anand =to_anand (chip); -struct arasan_nfc *nfc =to_anfc (chip->controller); -int ret; - -/* Update the controller timings and the potential ECC configuration */ -writel_relaxed (anand->timings, nfc->base +DATA_INTERFACE_REG ); - -/* Update clock frequency */ -if (nfc->cur_clk != anand->clk) { -clk_disable_unprepare (nfc->controller_clk); - ret =clk_set_rate (nfc->controller_clk, anand->clk); -if (ret) { -dev_err (nfc->dev,"Failed to change clock rate\n" ); -return ret; - } - - ret =clk_prepare_enable (nfc->controller_clk); -if (ret) { -dev_err (nfc->dev, -"Failed to re-enable the controller clock\n" ); -return ret; - } - - nfc->cur_clk = anand->clk; - } - -return 0 ; -} -static int anfc_check_op (struct nand_chip *chip,const struct nand_operation *op) {
@@ -1007,8 +1031,8 @@ static int anfc_init_hw_ecc_controller(struct arasan_nfc *nfc,if (!anand->bch)return -EINVAL ; - ecc->read_page = anfc_read_page_hw_ecc; - ecc->write_page = anfc_write_page_hw_ecc; + ecc->read_page = anfc_sel_read_page_hw_ecc; + ecc->write_page = anfc_sel_write_page_hw_ecc;return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 648/800 staging: mmal-vchiq: Fix incorrect static vchiq_instance.
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit afc023da53e46b88552822f2fe035c7129c505a2 ]
For some reason lost in history function vchiq_mmal_init used a static variable for storing the vchiq_instance.
This value is retrieved from vchiq per instance, so worked fine until you try to call vchiq_mmal_init multiple times concurrently when things then go wrong. This seemed to happen quite frequently if using the cutdown firmware (no MMAL or VCSM services running) as the vchiq_connect then failed, and one or other vchiq_shutdown was working on an invalid handle.
Remove the static so that each caller gets a unique vchiq_instance.
--- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +1 -1
@@ -1862,7 +1862,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)int status;int err = -ENODEV ;struct vchiq_mmal_instance *instance; -static struct vchiq_instance *vchiq_instance; +struct vchiq_instance *vchiq_instance;struct vchiq_service_params_kernel params = { .version =VC_MMAL_VER , .version_min =VC_MMAL_MIN_VER ,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 649/800 char: pcmcia: error out if num_bytes_read is greater than 4 in set_protocol()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 37188559c610f1b7eec83c8e448936c361c578de ]
Theoretically, it will cause index out of bounds error if 'num_bytes_read' is greater than 4. As we expect it(and was tested) never to be greater than 4, error out if it happens.
--- drivers/char/pcmcia/cm4000_cs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/char/pcmcia/cm4000_cs.c +4 -0
@@ -544,6 +544,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)io_read_num_rec_bytes (iobase, &num_bytes_read);if (num_bytes_read >=4 ) {DEBUGP (2 , dev,"NumRecBytes = %i\n" , num_bytes_read); +if (num_bytes_read >4 ) { + rc = -EIO ; + goto exit_setprotocol; + }break ; }usleep_range (10000 ,11000 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 650/800 misc/pvpanic-pci: Fix error handling in pvpanic_pci_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 372dae89972594393b57f29ec44e351fa7eedbbe ]
There is no error handling path in the probe function.
Switch to managed resource so that errors in the probe are handled easily and simplify the remove function accordingly.
--- drivers/misc/pvpanic/pvpanic-pci.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/misc/pvpanic/pvpanic-pci.c +3 -6
@@ -78,15 +78,15 @@ static int pvpanic_pci_probe(struct pci_dev *pdev,void __iomem *base;int ret; - ret =pci_enable_device (pdev); + ret =pcim_enable_device (pdev);if (ret <0 )return ret; - base =pci_iomap (pdev,0 ,0 ); + base =pcim_iomap (pdev,0 ,0 );if (!base)return -ENOMEM ; - pi =kmalloc (sizeof (*pi),GFP_ATOMIC ); + pi =devm_kmalloc (&pdev->dev,sizeof (*pi),GFP_ATOMIC );if (!pi)return -ENOMEM ;
@@ -107,9 +107,6 @@ static void pvpanic_pci_remove(struct pci_dev *pdev)struct pvpanic_instance *pi =dev_get_drvdata (&pdev->dev);pvpanic_remove (pi); -iounmap (pi->base); -kfree (pi); -pci_disable_device (pdev); }static struct pci_driver pvpanic_pci_driver = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 651/800 misc/pvpanic-mmio: Fix error handling in pvpanic_mmio_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 9a3c72ee6ffcd461bae1bbdf4e71dca6d5bc160c ]
There is no error handling path in the probe function.
Switch to managed resource so that errors in the probe are handled easily and simplify the remove function accordingly.
--- drivers/misc/pvpanic/pvpanic-mmio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/misc/pvpanic/pvpanic-mmio.c +1 -2
@@ -93,7 +93,7 @@ static int pvpanic_mmio_probe(struct platform_device *pdev)return -EINVAL ; } - pi =kmalloc (sizeof (*pi),GFP_ATOMIC ); + pi =devm_kmalloc (dev,sizeof (*pi),GFP_ATOMIC );if (!pi)return -ENOMEM ;
@@ -114,7 +114,6 @@ static int pvpanic_mmio_remove(struct platform_device *pdev)struct pvpanic_instance *pi =dev_get_drvdata (&pdev->dev);pvpanic_remove (pi); -kfree (pi);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 652/800 firmware: stratix10-svc: Fix a resource leak in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d99247f9b542533ddbf87a3481a05473b8e48194 ]
If an error occurs after a successful 'kfifo_alloc()' call, it must be undone by a corresponding 'kfifo_free()' call, as already done in the remove function.
While at it, move the 'platform_device_put()' call to this new error handling path and explicitly return 0 in the success path.
--- drivers/firmware/stratix10-svc.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/firmware/stratix10-svc.c +15 -7
@@ -1034,24 +1034,32 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)/* add svc client device(s) */ svc =devm_kzalloc (dev,sizeof (*svc),GFP_KERNEL ); -if (!svc) -return -ENOMEM ; +if (!svc) { + ret = -ENOMEM ; + goto err_free_kfifo; + } svc->stratix10_svc_rsu =platform_device_alloc (STRATIX10_RSU ,0 );if (!svc->stratix10_svc_rsu) {dev_err (dev,"failed to allocate %s device\n" ,STRATIX10_RSU ); -return -ENOMEM ; + ret = -ENOMEM ; + goto err_free_kfifo; } ret =platform_device_add (svc->stratix10_svc_rsu); -if (ret) { -platform_device_put (svc->stratix10_svc_rsu); -return ret; - } +if (ret) + goto err_put_device; +dev_set_drvdata (dev, svc);pr_info ("Intel Service Layer Driver Initialized\n" ); +return 0 ; + +err_put_device: +platform_device_put (svc->stratix10_svc_rsu); +err_free_kfifo: +kfifo_free (&controller->svc_fifo);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 653/800 tty: nozomi: Fix the error handling path of nozomi_card_init()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 6ae7d0f5a92b9619f6e3c307ce56b2cefff3f0e9 ]
The error handling path is broken and we may un-register things that have never been registered.
Update the loops index accordingly.
--- drivers/tty/nozomi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/tty/nozomi.c +5 -3
@@ -1378,7 +1378,7 @@ static int nozomi_card_init(struct pci_dev *pdev, NOZOMI_NAME, dc);if (unlikely (ret)) {dev_err (&pdev->dev,"can't request irq %d\n" , pdev->irq); - goto err_free_kfifo; + goto err_free_all_kfifo; }DBG1 ("base_addr: %p" , dc->base_addr);
@@ -1416,13 +1416,15 @@ static int nozomi_card_init(struct pci_dev *pdev,return 0 ; err_free_tty: -for (i =0 ; i <MAX_PORT ; ++i) { +for (i--; i >=0 ; i--) {tty_unregister_device (ntty_driver, dc->index_start + i);tty_port_destroy (&dc->port[i].port); }free_irq (pdev->irq, dc); +err_free_all_kfifo: + i =MAX_PORT ; err_free_kfifo: -for (i =0 ; i <MAX_PORT ; i++) +for (i--; i >=PORT_MDM ; i--)kfifo_free (&dc->port[i].fifo_ul); err_free_sbuf:kfree (dc->send_buf);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 654/800 leds: class: The -ENOTSUPP should never be seen by user space
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 0ac40af86077982a5346dbc9655172d2775d6b08 ]
Drop the bogus error code and let of_led_get() to take care about absent of_node.
--- drivers/leds/led-class.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/leds/led-class.c +0 -4
@@ -285,10 +285,6 @@ struct led_classdev *__must_check devm_of_led_get(struct device *dev,if (!dev)return ERR_PTR (-EINVAL ); -/* Not using device tree? */ -if (!IS_ENABLED (CONFIG_OF ) || !dev->of_node) -return ERR_PTR (-ENOTSUPP ); - led =of_led_get (dev->of_node, index);if (IS_ERR (led))return led;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 655/800 leds: lgm-sso: Fix clock handling
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit fba8a6f2263bc54683cf3fd75df4dbd5d041c195 ]
The clock handling has a few issues:
- when getting second clock fails, the first one left prepared and enabled
- on ->remove() clocks are unprepared and disabled twice
Fix all these by converting to use bulk clock operations since both clocks are mandatory.
--- drivers/leds/blink/leds-lgm-sso.c | 44 ++++++++++++------------------- 1 file changed, 17 insertions(+), 27 deletions(-)
drivers/leds/blink/leds-lgm-sso.c +17 -27
@@ -132,8 +132,7 @@ struct sso_led_priv {struct regmap *mmap;struct device *dev;struct platform_device *pdev; -struct clk *gclk; -struct clk *fpid_clk; +struct clk_bulk_data clocks[2 ];u32 fpid_clkrate;u32 gptc_clkrate;u32 freq[MAX_FREQ_RANK ];
@@ -763,12 +762,11 @@ static int sso_probe_gpios(struct sso_led_priv *priv)return sso_gpio_gc_init (dev, priv); } -static void sso_clk_disable (void *data) +static void sso_clock_disable_unprepare (void *data) {struct sso_led_priv *priv = data; -clk_disable_unprepare (priv->fpid_clk); -clk_disable_unprepare (priv->gclk); +clk_bulk_disable_unprepare (ARRAY_SIZE (priv->clocks), priv->clocks); }static int intel_sso_led_probe (struct platform_device *pdev)
@@ -785,36 +783,30 @@ static int intel_sso_led_probe(struct platform_device *pdev) priv->dev = dev;/* gate clock */ - priv->gclk =devm_clk_get (dev,"sso" ); -if (IS_ERR (priv->gclk)) { -dev_err (dev,"get sso gate clock failed!\n" ); -return PTR_ERR (priv->gclk); - } + priv->clocks[0 ].id ="sso" ; + +/* fpid clock */ + priv->clocks[1 ].id ="fpid" ; - ret =clk_prepare_enable (priv->gclk); + ret =devm_clk_bulk_get (dev,ARRAY_SIZE (priv->clocks), priv->clocks);if (ret) { -dev_err (dev,"Failed to prepare/enable sso gate clock!\n" ); +dev_err (dev,"Getting clocks failed!\n" );return ret; } - priv->fpid_clk =devm_clk_get (dev,"fpid" ); -if (IS_ERR (priv->fpid_clk)) { -dev_err (dev,"Failed to get fpid clock!\n" ); -return PTR_ERR (priv->fpid_clk); - } - - ret =clk_prepare_enable (priv->fpid_clk); + ret =clk_bulk_prepare_enable (ARRAY_SIZE (priv->clocks), priv->clocks);if (ret) { -dev_err (dev,"Failed to prepare/enable fpid clock!\n" ); +dev_err (dev,"Failed to prepare and enable clocks!\n" );return ret; } - priv->fpid_clkrate =clk_get_rate (priv->fpid_clk); - ret =devm_add_action_or_reset (dev, sso_clk_disable, priv); -if (ret) { -dev_err (dev,"Failed to devm_add_action_or_reset, %d\n" , ret); + ret =devm_add_action_or_reset (dev, sso_clock_disable_unprepare, priv); +if (ret)return ret; - } + + priv->fpid_clkrate =clk_get_rate (priv->clocks[1 ].clk); + + priv->mmap =syscon_node_to_regmap (dev->of_node); priv->mmap =syscon_node_to_regmap (dev->of_node);if (IS_ERR (priv->mmap)) {
@@ -859,8 +851,6 @@ static int intel_sso_led_remove(struct platform_device *pdev)sso_led_shutdown (led); } -clk_disable_unprepare (priv->fpid_clk); -clk_disable_unprepare (priv->gclk);regmap_exit (priv->mmap);return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 656/800 leds: lm3532: select regmap I2C API
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 99be74f61cb0292b518f5e6d7e5c6611555c2ec7 ]
Regmap APIs should be selected, otherwise link can fail
ERROR: modpost: "__devm_regmap_init_i2c" [drivers/leds/leds-lm3532.ko] undefined!
--- drivers/leds/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/leds/Kconfig +1 -0
@@ -199,6 +199,7 @@ config LEDS_LM3530 config LEDS_LM3532 tristate "LCD Backlight driver for LM3532" + select REGMAP_I2C depends on LEDS_CLASS depends on I2C help
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 657/800 leds: lm36274: Put fwnode in error case during ->probe()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 3c5f655c44bb65cb7e3c219d08c130ce5fa45d7f ]
device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.
In the older code the same is implied with device_for_each_child_node().
--- drivers/leds/leds-lm36274.c | 1 + 1 file changed, 1 insertion(+)
drivers/leds/leds-lm36274.c +1 -0
@@ -127,6 +127,7 @@ static int lm36274_probe(struct platform_device *pdev) ret =lm36274_init (chip);if (ret) { +fwnode_handle_put (init_data.fwnode);dev_err (chip->dev,"Failed to init the device\n" );return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 658/800 leds: lm3692x: Put fwnode in any case during ->probe()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit f55db1c7fadc2a29c9fa4ff3aec98dbb111f2206 ]
device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.
--- drivers/leds/leds-lm3692x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/leds/leds-lm3692x.c +4 -4
@@ -435,6 +435,7 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) ret =fwnode_property_read_u32 (child,"reg" , &led->led_enable);if (ret) { +fwnode_handle_put (child);dev_err (&led->client->dev,"reg DT property missing\n" );return ret; }
@@ -449,12 +450,11 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) ret =devm_led_classdev_register_ext (&led->client->dev, &led->led_dev, &init_data); -if (ret) { +if (ret)dev_err (&led->client->dev,"led register err: %d\n" , ret); -return ret; - } -return 0 ; +fwnode_handle_put (init_data.fwnode); +return ret; } static int lm3692x_probe(struct i2c_client *client,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 659/800 leds: lm3697: Dont spam logs when probe is deferred
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 807553f8bf4afa673750e52905e0f9488179112f ]
When requesting GPIO line the probe can be deferred. In such case don't spam logs with an error message. This can be achieved by switching to dev_err_probe().
--- drivers/leds/leds-lm3697.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/leds/leds-lm3697.c +3 -5
@@ -203,11 +203,9 @@ static int lm3697_probe_dt(struct lm3697 *priv) priv->enable_gpio =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_LOW ); -if (IS_ERR (priv->enable_gpio)) { - ret =PTR_ERR (priv->enable_gpio); -dev_err (dev,"Failed to get enable gpio: %d\n" , ret); -return ret; - } +if (IS_ERR (priv->enable_gpio)) +return dev_err_probe (dev,PTR_ERR (priv->enable_gpio), +"Failed to get enable GPIO\n" ); priv->regulator =devm_regulator_get (dev,"vled" );if (IS_ERR (priv->regulator))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 660/800 leds: lp50xx: Put fwnode in error case during ->probe()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit f1e1d532da7e6ef355528a22fb97d9a8fbf76c4e ]
fwnode_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.
OTOH, the successful iteration will drop reference count under the hood, no need to do it twice.
--- drivers/leds/leds-lp50xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-lp50xx.c +1 -1
@@ -490,6 +490,7 @@ static int lp50xx_probe_dt(struct lp50xx *priv) ret =fwnode_property_read_u32 (led_node,"color" , &color_id);if (ret) { +fwnode_handle_put (led_node);dev_err (priv->dev,"Cannot read color\n" ); goto child_out; }
@@ -512,7 +513,6 @@ static int lp50xx_probe_dt(struct lp50xx *priv) goto child_out; } i++; -fwnode_handle_put (child); }return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 661/800 scsi: FlashPoint: Rename si_flags field
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 4d431153e751caa93f3b7e6f6313446974e92253 ]
The BusLogic driver has build errors on ia64 due to a name collision (in the #included FlashPoint.c file). Rename the struct field in struct sccb_mgr_info from si_flags to si_mflags (manager flags) to mend the build.
This is the first problem. There are 50+ others after this one:
In file included from ../include/uapi/linux/signal.h:6,
from ../include/linux/signal_types.h:10,
from ../include/linux/sched.h:29,
from ../include/linux/hardirq.h:9,
from ../include/linux/interrupt.h:11,
from ../drivers/scsi/BusLogic.c:27:../arch/ia64/include/uapi/asm/siginfo.h:15:27: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
15 | #define si_flags _sifields._sigfault._flags
| ^../drivers/scsi/FlashPoint.c:43:6: note: in expansion of macro 'si_flags'
43 | u16 si_flags;
| ^~~~~~~~In file included from ../drivers/scsi/BusLogic.c:51:../drivers/scsi/FlashPoint.c: In function 'FlashPoint_ProbeHostAdapter':../drivers/scsi/FlashPoint.c:1076:11: error: 'struct sccb_mgr_info' has no member named '_sifields'
1076 | pCardInfo->si_flags = 0x0000;
| ^~../drivers/scsi/FlashPoint.c:1079:12: error: 'struct sccb_mgr_info' has no member named '_sifields'
--- drivers/scsi/FlashPoint.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/scsi/FlashPoint.c +16 -16
@@ -40,7 +40,7 @@ struct sccb_mgr_info {u16 si_per_targ_ultra_nego;u16 si_per_targ_no_disc;u16 si_per_targ_wide_nego; -u16 si_flags; +u16 si_mflags;unsigned char si_card_family;unsigned char si_bustype;unsigned char si_card_model[3 ];
@@ -1073,22 +1073,22 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) ScamFlg = (unsigned char )FPT_utilEERead (ioport,SCAM_CONFIG /2 ); - pCardInfo->si_flags =0x0000 ; + pCardInfo->si_mflags =0x0000 ;if (i &0x01 ) - pCardInfo->si_flags |=SCSI_PARITY_ENA ; + pCardInfo->si_mflags |=SCSI_PARITY_ENA ;if (!(i &0x02 )) - pCardInfo->si_flags |=SOFT_RESET ; + pCardInfo->si_mflags |=SOFT_RESET ;if (i &0x10 ) - pCardInfo->si_flags |=EXTENDED_TRANSLATION ; + pCardInfo->si_mflags |=EXTENDED_TRANSLATION ;if (ScamFlg &SCAM_ENABLED ) - pCardInfo->si_flags |=FLAG_SCAM_ENABLED ; + pCardInfo->si_mflags |=FLAG_SCAM_ENABLED ;if (ScamFlg &SCAM_LEVEL2 ) - pCardInfo->si_flags |=FLAG_SCAM_LEVEL2 ; + pCardInfo->si_mflags |=FLAG_SCAM_LEVEL2 ; j = (RD_HARPOON (ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L );if (i &0x04 ) {
@@ -1104,7 +1104,7 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)if (!(RD_HARPOON (ioport + hp_page_ctrl) &NARROW_SCSI_CARD )) - pCardInfo->si_flags |=SUPPORT_16TAR_32LUN ; + pCardInfo->si_mflags |=SUPPORT_16TAR_32LUN ; pCardInfo->si_card_family =HARPOON_FAMILY ; pCardInfo->si_bustype =BUSTYPE_PCI ;
@@ -1140,15 +1140,15 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)if (pCardInfo->si_card_model[1 ] =='3' ) {if (RD_HARPOON (ioport + hp_ee_ctrl) &BIT (7 )) - pCardInfo->si_flags |=LOW_BYTE_TERM ; + pCardInfo->si_mflags |=LOW_BYTE_TERM ; }else if (pCardInfo->si_card_model[2 ] =='0' ) { temp =RD_HARPOON (ioport + hp_xfer_pad);WR_HARPOON (ioport + hp_xfer_pad, (temp & ~BIT (4 )));if (RD_HARPOON (ioport + hp_ee_ctrl) &BIT (7 )) - pCardInfo->si_flags |=LOW_BYTE_TERM ; + pCardInfo->si_mflags |=LOW_BYTE_TERM ;WR_HARPOON (ioport + hp_xfer_pad, (temp |BIT (4 )));if (RD_HARPOON (ioport + hp_ee_ctrl) &BIT (7 )) - pCardInfo->si_flags |=HIGH_BYTE_TERM ; + pCardInfo->si_mflags |=HIGH_BYTE_TERM ;WR_HARPOON (ioport + hp_xfer_pad, temp); }else { temp =RD_HARPOON (ioport + hp_ee_ctrl);
@@ -1166,9 +1166,9 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)WR_HARPOON (ioport + hp_ee_ctrl, temp);WR_HARPOON (ioport + hp_xfer_pad, temp2);if (!(temp3 &BIT (7 ))) - pCardInfo->si_flags |=LOW_BYTE_TERM ; + pCardInfo->si_mflags |=LOW_BYTE_TERM ;if (!(temp3 &BIT (6 ))) - pCardInfo->si_flags |=HIGH_BYTE_TERM ; + pCardInfo->si_mflags |=HIGH_BYTE_TERM ; }ARAM_ACCESS (ioport);
@@ -1275,7 +1275,7 @@ static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_infoWR_HARPOON (ioport + hp_arb_id, pCardInfo->si_id); CurrCard->ourId = pCardInfo->si_id; - i = (unsigned char )pCardInfo->si_flags; + i = (unsigned char )pCardInfo->si_mflags;if (i &SCSI_PARITY_ENA )WR_HARPOON (ioport + hp_portctrl_1, (HOST_MODE8 |CHK_SCSI_P ));
@@ -1289,14 +1289,14 @@ static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info j |=SCSI_TERM_ENA_H ;WR_HARPOON (ioport + hp_ee_ctrl, j); -if (!(pCardInfo->si_flags &SOFT_RESET )) { +if (!(pCardInfo->si_mflags &SOFT_RESET )) {FPT_sresb (ioport, thisCard);FPT_scini (thisCard, pCardInfo->si_id,0 ); } -if (pCardInfo->si_flags &POST_ALL_UNDERRRUNS ) +if (pCardInfo->si_mflags &POST_ALL_UNDERRRUNS ) CurrCard->globalFlags |=F_NO_FILTER ;if (pCurrNvRam) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 662/800 scsi: iscsi: Stop queueing during ep_disconnect
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 891e2639deae721dc43764a44fa255890dc34313 ]
During ep_disconnect we have been doing iscsi_suspend_tx/queue to block new I/O but every driver except cxgbi and iscsi_tcp can still get I/O from __iscsi_conn_send_pdu() if we haven't called iscsi_conn_failure() before ep_disconnect. This could happen if we were terminating the session, and the logout timed out before it was even sent to libiscsi.
Fix the issue by adding a helper which reverses the bind_conn call that allows new I/O to be queued. Drivers implementing ep_disconnect can use this to make sure new I/O is not queued to them when handling the disconnect.
--- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/scsi/be2iscsi/be_main.c | 1 + drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 + drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1 + drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 + drivers/scsi/libiscsi.c | 70 +++++++++++++++++++++--- drivers/scsi/qedi/qedi_iscsi.c | 1 + drivers/scsi/qla4xxx/ql4_os.c | 1 + drivers/scsi/scsi_transport_iscsi.c | 10 +++- include/scsi/libiscsi.h | 1 + include/scsi/scsi_transport_iscsi.h | 1 + 11 files changed, 78 insertions(+), 11 deletions(-)
drivers/infiniband/ulp/iser/iscsi_iser.c +1 -0
@@ -1002,6 +1002,7 @@ static struct iscsi_transport iscsi_iser_transport = {/* connection management */ .create_conn = iscsi_iser_conn_create, .bind_conn = iscsi_iser_conn_bind, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = iscsi_conn_teardown, .attr_is_visible = iser_attr_is_visible, .set_param = iscsi_iser_set_param,
drivers/scsi/be2iscsi/be_main.c +1 -0
@@ -5809,6 +5809,7 @@ struct iscsi_transport beiscsi_iscsi_transport = { .destroy_session = beiscsi_session_destroy, .create_conn = beiscsi_conn_create, .bind_conn = beiscsi_conn_bind, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = iscsi_conn_teardown, .attr_is_visible = beiscsi_attr_is_visible, .set_iface_param = beiscsi_iface_set_param,
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -0
@@ -2276,6 +2276,7 @@ struct iscsi_transport bnx2i_iscsi_transport = { .destroy_session = bnx2i_session_destroy, .create_conn = bnx2i_conn_create, .bind_conn = bnx2i_conn_bind, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = bnx2i_conn_destroy, .attr_is_visible = bnx2i_attr_is_visible, .set_param = iscsi_set_param,
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +1 -0
@@ -117,6 +117,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = {/* connection management */ .create_conn = cxgbi_create_conn, .bind_conn = cxgbi_bind_conn, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = iscsi_tcp_conn_teardown, .start_conn = iscsi_conn_start, .stop_conn = iscsi_conn_stop,
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1 -0
@@ -134,6 +134,7 @@ static struct iscsi_transport cxgb4i_iscsi_transport = {/* connection management */ .create_conn = cxgbi_create_conn, .bind_conn = cxgbi_bind_conn, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = iscsi_tcp_conn_teardown, .start_conn = iscsi_conn_start, .stop_conn = iscsi_conn_stop,
drivers/scsi/libiscsi.c +62 -8
91 lines not on this page · raw message
drivers/scsi/qedi/qedi_iscsi.c +1 -0
@@ -1401,6 +1401,7 @@ struct iscsi_transport qedi_iscsi_transport = { .destroy_session = qedi_session_destroy, .create_conn = qedi_conn_create, .bind_conn = qedi_conn_bind, + .unbind_conn = iscsi_conn_unbind, .start_conn = qedi_conn_start, .stop_conn = iscsi_conn_stop, .destroy_conn = qedi_conn_destroy,
drivers/scsi/qla4xxx/ql4_os.c +1 -0
@@ -259,6 +259,7 @@ static struct iscsi_transport qla4xxx_iscsi_transport = { .start_conn = qla4xxx_conn_start, .create_conn = qla4xxx_conn_create, .bind_conn = qla4xxx_conn_bind, + .unbind_conn = iscsi_conn_unbind, .stop_conn = iscsi_conn_stop, .destroy_conn = qla4xxx_conn_destroy, .set_param = iscsi_set_param,
drivers/scsi/scsi_transport_iscsi.c +7 -3
@@ -2964,7 +2964,7 @@ release_host: }static int iscsi_if_ep_disconnect (struct iscsi_transport *transport, -u64 ep_handle) +u64 ep_handle,bool is_active) {struct iscsi_cls_conn *conn;struct iscsi_endpoint *ep;
@@ -2981,6 +2981,8 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, conn->ep =NULL ;mutex_unlock (&conn->ep_mutex); conn->state =ISCSI_CONN_FAILED ; + + transport->unbind_conn (conn, is_active); } transport->ep_disconnect (ep);
@@ -3012,7 +3014,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport,break ;case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT : rc =iscsi_if_ep_disconnect (transport, - ev->u.ep_disconnect.ep_handle); + ev->u.ep_disconnect.ep_handle, + false);break ; }return rc;
@@ -3737,7 +3740,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) conn =iscsi_conn_lookup (ev->u.b_conn.sid, ev->u.b_conn.cid);if (conn && conn->ep) -iscsi_if_ep_disconnect (transport, conn->ep->id); +iscsi_if_ep_disconnect (transport, conn->ep->id, true);if (!session || !conn) { err = -EINVAL ;
@@ -4656,6 +4659,7 @@ iscsi_register_transport(struct iscsi_transport *tt)int err;BUG_ON (!tt); +WARN_ON (tt->ep_disconnect && !tt->unbind_conn); priv =iscsi_if_transport_lookup (tt);if (priv)
include/scsi/libiscsi.h +1 -0
@@ -424,6 +424,7 @@ extern int iscsi_conn_start(struct iscsi_cls_conn *);extern void iscsi_conn_stop (struct iscsi_cls_conn *,int );extern int iscsi_conn_bind (struct iscsi_cls_session *,struct iscsi_cls_conn *,int ); +extern void iscsi_conn_unbind (struct iscsi_cls_conn *cls_conn,bool is_active);extern void iscsi_conn_failure (struct iscsi_conn *conn,enum iscsi_err err);extern void iscsi_session_failure (struct iscsi_session *session,enum iscsi_err err);
include/scsi/scsi_transport_iscsi.h +1 -0
@@ -82,6 +82,7 @@ struct iscsi_transport {void (*destroy_session) (struct iscsi_cls_session *session);struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess,uint32_t cid); +void (*unbind_conn) (struct iscsi_cls_conn *conn,bool is_active);int (*bind_conn) (struct iscsi_cls_session *session,struct iscsi_cls_conn *cls_conn,uint64_t transport_eph,int is_leading);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 663/800 scsi: iscsi: Force immediate failure during shutdown
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 06c203a5566beecebb1f8838d026de8a61c8df71 ]
If the system is not up, we can just fail immediately since iscsid is not going to ever answer our netlink events. We are already setting the recovery_tmo to 0, but by passing stop_conn STOP_CONN_TERM we never will block the session and start the recovery timer, because for that flag userspace will do the unbind and destroy events which would remove the devices and wake up and kill the eh.
Since the conn is dead and the system is going dowm this just has us use STOP_CONN_RECOVER with recovery_tmo=0 so we fail immediately. However, if the user has set the recovery_tmo=-1 we let the system hang like they requested since they might have used that setting for specific reasons (one known reason is for buggy cluster software).
--- drivers/scsi/scsi_transport_iscsi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +10 -4
@@ -2513,11 +2513,17 @@ static void stop_conn_work_fn(struct work_struct *work) session =iscsi_session_lookup (sid);if (session) {if (system_state !=SYSTEM_RUNNING ) { - session->recovery_tmo =0 ; -iscsi_if_stop_conn (conn,STOP_CONN_TERM ); - }else { -iscsi_if_stop_conn (conn,STOP_CONN_RECOVER ); +/* +* If the user has set up for the session to +* never timeout then hang like they wanted. +* For all other cases fail right away since +* userspace is not going to relogin. +*/ +if (session->recovery_tmo >0 ) + session->recovery_tmo =0 ; } + +iscsi_if_stop_conn (conn,STOP_CONN_RECOVER ); }list_del_init (&conn->conn_list_err);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 664/800 scsi: iscsi: Use system_unbound_wq for destroy_work
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit b25b957d2db1585602c2c70fdf4261a5641fe6b7 ]
Use the system_unbound_wq for async session destruction. We don't need a dedicated workqueue for async session destruction because:
1. perf does not seem to be an issue since we only allow 1 active work.
2. it does not have deps with other system works and we can run them in parallel with each other.
--- drivers/scsi/scsi_transport_iscsi.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +1 -14
@@ -95,8 +95,6 @@ static DECLARE_WORK(stop_conn_work, stop_conn_work_fn);static atomic_t iscsi_session_nr;/* sysfs session id for next new session */ static struct workqueue_struct *iscsi_eh_timer_workq; -static struct workqueue_struct *iscsi_destroy_workq; -static DEFINE_IDA (iscsi_sess_ida);/* * list of registered transports and lock that must
@@ -3724,7 +3722,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)list_del_init (&session->sess_list);spin_unlock_irqrestore (&sesslock, flags); -queue_work (iscsi_destroy_workq, &session->destroy_work); +queue_work (system_unbound_wq, &session->destroy_work); }break ;case ISCSI_UEVENT_UNBIND_SESSION :
@@ -4820,18 +4818,8 @@ static __init int iscsi_transport_init(void) goto release_nls; } - iscsi_destroy_workq =alloc_workqueue ("%s" , -WQ_SYSFS | __WQ_LEGACY |WQ_MEM_RECLAIM |WQ_UNBOUND , -1 ,"iscsi_destroy" ); -if (!iscsi_destroy_workq) { - err = -ENOMEM ; - goto destroy_wq; - } -return 0 ; -destroy_wq: -destroy_workqueue (iscsi_eh_timer_workq); release_nls:netlink_kernel_release (nls); unregister_flashnode_bus:
@@ -4853,7 +4841,6 @@ unregister_transport_class: static void __exit iscsi_transport_exit(void) { -destroy_workqueue (iscsi_destroy_workq);destroy_workqueue (iscsi_eh_timer_workq);netlink_kernel_release (nls);bus_unregister (&iscsi_flashnode_bus);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 665/800 scsi: iscsi: Rel ref after iscsi_lookup_endpoint()
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 9e5fe1700896c85040943fdc0d3fee0dd3e0d36f ]
Subsequent commits allow the kernel to do ep_disconnect. In that case we will have to get a proper refcount on the ep so one thread does not delete it from under another.
--- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/scsi/be2iscsi/be_iscsi.c | 19 ++++++++++++------ drivers/scsi/bnx2i/bnx2i_iscsi.c | 23 +++++++++++++++------- drivers/scsi/cxgbi/libcxgbi.c | 12 ++++++++---- drivers/scsi/qedi/qedi_iscsi.c | 25 +++++++++++++++++------- drivers/scsi/qla4xxx/ql4_os.c | 1 + drivers/scsi/scsi_transport_iscsi.c | 25 ++++++++++++++++-------- include/scsi/scsi_transport_iscsi.h | 1 + 8 files changed, 75 insertions(+), 32 deletions(-)
drivers/infiniband/ulp/iser/iscsi_iser.c +1 -0
@@ -506,6 +506,7 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, iser_conn->iscsi_conn = conn; out: +iscsi_put_endpoint (ep);mutex_unlock (&iser_conn->state_mutex);return error; }
drivers/scsi/be2iscsi/be_iscsi.c +13 -6
@@ -182,6 +182,7 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,struct beiscsi_endpoint *beiscsi_ep;struct iscsi_endpoint *ep;uint16_t cri_index; +int rc =0 ; ep =iscsi_lookup_endpoint (transport_fd);if (!ep)
@@ -189,15 +190,17 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, beiscsi_ep = ep->dd_data; -if (iscsi_conn_bind (cls_session, cls_conn, is_leading)) -return -EINVAL ; +if (iscsi_conn_bind (cls_session, cls_conn, is_leading)) { + rc = -EINVAL ; + goto put_ep; + }if (beiscsi_ep->phba != phba) {beiscsi_log (phba,KERN_ERR ,BEISCSI_LOG_CONFIG ,"BS_%d : beiscsi_ep->hba=%p not equal to phba=%p\n" , beiscsi_ep->phba, phba); - -return -EEXIST ; + rc = -EEXIST ; + goto put_ep; } cri_index =BE_GET_CRI_FROM_CID (beiscsi_ep->ep_cid);if (phba->conn_table[cri_index]) {
@@ -209,7 +212,8 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, beiscsi_ep->ep_cid, beiscsi_conn, phba->conn_table[cri_index]); -return -EINVAL ; + rc = -EINVAL ; + goto put_ep; } }
@@ -226,7 +230,10 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,"BS_%d : cid %d phba->conn_table[%u]=%p\n" , beiscsi_ep->ep_cid, cri_index, beiscsi_conn); phba->conn_table[cri_index] = beiscsi_conn; -return 0 ; + +put_ep: +iscsi_put_endpoint (ep); +return rc; }static int beiscsi_iface_create_ipv4 (struct beiscsi_hba *phba)
drivers/scsi/bnx2i/bnx2i_iscsi.c +16 -7
@@ -1420,17 +1420,23 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session,* Forcefully terminate all in progress connection recovery at the * earliest, either in bind(), send_pdu(LOGIN), or conn_start() */ -if (bnx2i_adapter_ready (hba)) -return -EIO ; +if (bnx2i_adapter_ready (hba)) { + ret_code = -EIO ; + goto put_ep; + } bnx2i_ep = ep->dd_data;if ((bnx2i_ep->state ==EP_STATE_TCP_FIN_RCVD ) || - (bnx2i_ep->state ==EP_STATE_TCP_RST_RCVD )) + (bnx2i_ep->state ==EP_STATE_TCP_RST_RCVD )) {/* Peer disconnect via' FIN or RST */ -return -EINVAL ; + ret_code = -EINVAL ; + goto put_ep; + } -if (iscsi_conn_bind (cls_session, cls_conn, is_leading)) -return -EINVAL ; +if (iscsi_conn_bind (cls_session, cls_conn, is_leading)) { + ret_code = -EINVAL ; + goto put_ep; + }if (bnx2i_ep->hba != hba) {/* Error - TCP connection does not belong to this device
@@ -1441,7 +1447,8 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session,iscsi_conn_printk (KERN_ALERT , cls_conn->dd_data,"belong to hba (%s)\n" , hba->netdev->name); -return -EEXIST ; + ret_code = -EEXIST ; + goto put_ep; } bnx2i_ep->conn = bnx2i_conn; bnx2i_conn->ep = bnx2i_ep;
@@ -1458,6 +1465,8 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session,bnx2i_put_rq_buf (bnx2i_conn,0 );bnx2i_arm_cq_event_coalescing (bnx2i_conn->ep,CNIC_ARM_CQE ); +put_ep: +iscsi_put_endpoint (ep);return ret_code; }
drivers/scsi/cxgbi/libcxgbi.c +8 -4
@@ -2690,11 +2690,13 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session, err = csk->cdev->csk_ddp_setup_pgidx (csk, csk->tid, ppm->tformat.pgsz_idx_dflt);if (err <0 ) -return err; + goto put_ep; err =iscsi_conn_bind (cls_session, cls_conn, is_leading); -if (err) -return -EINVAL ; +if (err) { + err = -EINVAL ; + goto put_ep; + }/* calculate the tag idx bits needed for this conn based on cmds_max */ cconn->task_idx_bits = (__ilog2_u32 (conn->session->cmds_max -1 )) +1 ;
@@ -2715,7 +2717,9 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session,/* init recv engine */ iscsi_tcp_hdr_recv_prep (tcp_conn); -return 0 ; +put_ep: +iscsi_put_endpoint (ep); +return err; }EXPORT_SYMBOL_GPL (cxgbi_bind_conn);
drivers/scsi/qedi/qedi_iscsi.c +18 -7
@@ -377,6 +377,7 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session,struct qedi_ctx *qedi =iscsi_host_priv (shost);struct qedi_endpoint *qedi_ep;struct iscsi_endpoint *ep; +int rc =0 ; ep =iscsi_lookup_endpoint (transport_fd);if (!ep)
@@ -384,11 +385,16 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, qedi_ep = ep->dd_data;if ((qedi_ep->state ==EP_STATE_TCP_FIN_RCVD ) || - (qedi_ep->state ==EP_STATE_TCP_RST_RCVD )) -return -EINVAL ; + (qedi_ep->state ==EP_STATE_TCP_RST_RCVD )) { + rc = -EINVAL ; + goto put_ep; + } + +if (iscsi_conn_bind (cls_session, cls_conn, is_leading)) { + rc = -EINVAL ; + goto put_ep; + } -if (iscsi_conn_bind (cls_session, cls_conn, is_leading)) -return -EINVAL ; qedi_ep->conn = qedi_conn; qedi_conn->ep = qedi_ep;
@@ -398,13 +404,18 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, qedi_conn->cmd_cleanup_req =0 ; qedi_conn->cmd_cleanup_cmpl =0 ; -if (qedi_bind_conn_to_iscsi_cid (qedi, qedi_conn)) -return -EINVAL ; +if (qedi_bind_conn_to_iscsi_cid (qedi, qedi_conn)) { + rc = -EINVAL ; + goto put_ep; + } +spin_lock_init (&qedi_conn->tmf_work_lock);INIT_LIST_HEAD (&qedi_conn->tmf_work_list);init_waitqueue_head (&qedi_conn->wait_queue); -return 0 ; +put_ep: +iscsi_put_endpoint (ep); +return rc; } static int qedi_iscsi_update_conn(struct qedi_ctx *qedi,
drivers/scsi/qla4xxx/ql4_os.c +1 -0
@@ -3235,6 +3235,7 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session, conn = cls_conn->dd_data; qla_conn = conn->dd_data; qla_conn->qla_ep = ep->dd_data; +iscsi_put_endpoint (ep);return 0 ; }
drivers/scsi/scsi_transport_iscsi.c +17 -8
@@ -266,9 +266,20 @@ void iscsi_destroy_endpoint(struct iscsi_endpoint *ep) }EXPORT_SYMBOL_GPL (iscsi_destroy_endpoint); +void iscsi_put_endpoint (struct iscsi_endpoint *ep) +{ +put_device (&ep->dev); +} +EXPORT_SYMBOL_GPL (iscsi_put_endpoint); + +/** +* iscsi_lookup_endpoint - get ep from handle +* @handle: endpoint handle +* +* Caller must do a iscsi_put_endpoint. +*/ struct iscsi_endpoint *iscsi_lookup_endpoint (u64 handle) { -struct iscsi_endpoint *ep;struct device *dev; dev = class_find_device(&iscsi_endpoint_class, NULL, &handle,
@@ -276,13 +287,7 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle)if (!dev)return NULL ; - ep =iscsi_dev_to_endpoint (dev); -/* -* we can drop this now because the interface will prevent -* removals and lookups from racing. -*/ -put_device (dev); -return ep; +return iscsi_dev_to_endpoint (dev); }EXPORT_SYMBOL_GPL (iscsi_lookup_endpoint);
@@ -2990,6 +2995,7 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, } transport->ep_disconnect (ep); +iscsi_put_endpoint (ep);return 0 ; }
@@ -3015,6 +3021,7 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, ev->r.retcode = transport->ep_poll (ep, ev->u.ep_poll.timeout_ms); +iscsi_put_endpoint (ep);break ;case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT : rc = iscsi_if_ep_disconnect(transport,
@@ -3698,6 +3705,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) ev->u.c_bound_session.initial_cmdsn, ev->u.c_bound_session.cmds_max, ev->u.c_bound_session.queue_depth); +iscsi_put_endpoint (ep);break ;case ISCSI_UEVENT_DESTROY_SESSION : session =iscsi_session_lookup (ev->u.d_session.sid);
@@ -3769,6 +3777,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)mutex_lock (&conn->ep_mutex); conn->ep = ep;mutex_unlock (&conn->ep_mutex); +iscsi_put_endpoint (ep); }else iscsi_cls_conn_printk (KERN_ERR , conn, "Could not set ep conn "
include/scsi/scsi_transport_iscsi.h +1 -0
@@ -442,6 +442,7 @@ extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time);extern struct iscsi_endpoint *iscsi_create_endpoint (int dd_size);extern void iscsi_destroy_endpoint (struct iscsi_endpoint *ep);extern struct iscsi_endpoint *iscsi_lookup_endpoint (u64 handle); +extern void iscsi_put_endpoint (struct iscsi_endpoint *ep);extern int iscsi_block_scsi_eh (struct scsi_cmnd *cmd); extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost, struct iscsi_transport *t,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 666/800 scsi: iscsi: Fix in-kernel conn failure handling
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 23d6fefbb3f6b1cc29794427588b470ed06ff64e ]
Commit 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in kernel space") has the following regressions/bugs that this patch fixes:
1. It can return cmds to upper layers like dm-multipath where that can retry them. After they are successful the fs/app can send new I/O to the same sectors, but we've left the cmds running in FW or in the net layer. We need to be calling ep_disconnect if userspace is not up.
This patch only fixes the issue for offload drivers. iscsi_tcp will be fixed in separate commit because it doesn't have a ep_disconnect call.
2. The drivers that implement ep_disconnect expect that it's called before conn_stop. Besides crashes, if the cleanup_task callout is called before ep_disconnect it might free up driver/card resources for session1 then they could be allocated for session2. But because the driver's ep_disconnect is not called it has not cleaned up the firmware so the card is still using the resources for the original cmd.
3. The stop_conn_work_fn can run after userspace has done its recovery and we are happily using the session. We will then end up with various bugs depending on what is going on at the time.
We may also run stop_conn_work_fn late after userspace has called stop_conn and ep_disconnect and is now going to call start/bind conn. If stop_conn_work_fn runs after bind but before start, we would leave the conn in a unbound but sort of started state where IO might be allowed even though the drivers have been set in a state where they no longer expect I/O.
4. Returning -EAGAIN in iscsi_if_destroy_conn if we haven't yet run the in kernel stop_conn function is breaking userspace. We should have been doing this for the caller.
--- drivers/scsi/scsi_transport_iscsi.c | 471 ++++++++++++++++------------ include/scsi/scsi_transport_iscsi.h | 10 +- 2 files changed, 283 insertions(+), 198 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +274 -197
@@ -86,15 +86,11 @@ struct iscsi_internal {struct transport_container session_cont; }; -/* Worker to perform connection failure on unresponsive connections -* completely in kernel space. -*/ -static void stop_conn_work_fn (struct work_struct *work); -static DECLARE_WORK(stop_conn_work, stop_conn_work_fn); -static atomic_t iscsi_session_nr;/* sysfs session id for next new session */ static struct workqueue_struct *iscsi_eh_timer_workq; +static struct workqueue_struct *iscsi_conn_cleanup_workq; +static DEFINE_IDA (iscsi_sess_ida);/* * list of registered transports and lock that must
@@ -1623,12 +1619,6 @@ static DECLARE_TRANSPORT_CLASS(iscsi_connection_class,static struct sock *nls;static DEFINE_MUTEX (rx_queue_mutex); -/* -* conn_mutex protects the {start,bind,stop,destroy}_conn from racing -* against the kernel stop_connection recovery mechanism -*/ -static DEFINE_MUTEX (conn_mutex); -static LIST_HEAD (sesslist);static DEFINE_SPINLOCK (sesslock);static LIST_HEAD (connlist);
@@ -2245,6 +2235,123 @@ void iscsi_remove_session(struct iscsi_cls_session *session) }EXPORT_SYMBOL_GPL (iscsi_remove_session); +static void iscsi_stop_conn (struct iscsi_cls_conn *conn,int flag) +{ +ISCSI_DBG_TRANS_CONN (conn,"Stopping conn.\n" ); + +switch (flag) { +case STOP_CONN_RECOVER : + conn->state =ISCSI_CONN_FAILED ; +break ; +case STOP_CONN_TERM : + conn->state =ISCSI_CONN_DOWN ; +break ; +default : +iscsi_cls_conn_printk (KERN_ERR , conn,"invalid stop flag %d\n" , + flag); +return ; + } + + conn->transport->stop_conn (conn, flag); +ISCSI_DBG_TRANS_CONN (conn,"Stopping conn done.\n" ); +} + +static int iscsi_if_stop_conn (struct iscsi_transport *transport, +struct iscsi_uevent *ev) +{ +int flag = ev->u.stop_conn.flag; +struct iscsi_cls_conn *conn; + + conn =iscsi_conn_lookup (ev->u.stop_conn.sid, ev->u.stop_conn.cid); +if (!conn) +return -EINVAL ; + +ISCSI_DBG_TRANS_CONN (conn,"iscsi if conn stop.\n" ); +/* +* If this is a termination we have to call stop_conn with that flag +* so the correct states get set. If we haven't run the work yet try to +* avoid the extra run. +*/ +if (flag ==STOP_CONN_TERM ) { +cancel_work_sync (&conn->cleanup_work); +iscsi_stop_conn (conn, flag); + }else { +/* +* Figure out if it was the kernel or userspace initiating this. +*/ +if (!test_and_set_bit (ISCSI_CLS_CONN_BIT_CLEANUP , &conn->flags)) { +iscsi_stop_conn (conn, flag); + }else { +ISCSI_DBG_TRANS_CONN (conn, +"flush kernel conn cleanup.\n" ); +flush_work (&conn->cleanup_work); + } +/* +* Only clear for recovery to avoid extra cleanup runs during +* termination. +*/ +clear_bit (ISCSI_CLS_CONN_BIT_CLEANUP , &conn->flags); + } +ISCSI_DBG_TRANS_CONN (conn,"iscsi if conn stop done.\n" ); +return 0 ; +} + +static void iscsi_ep_disconnect (struct iscsi_cls_conn *conn,bool is_active) +{ +struct iscsi_cls_session *session =iscsi_conn_to_session (conn); +struct iscsi_endpoint *ep; + +ISCSI_DBG_TRANS_CONN (conn,"disconnect ep.\n" ); + conn->state =ISCSI_CONN_FAILED ; + +if (!conn->ep || !session->transport->ep_disconnect) +return ; + + ep = conn->ep; + conn->ep =NULL ; + + session->transport->unbind_conn (conn, is_active); + session->transport->ep_disconnect (ep); +ISCSI_DBG_TRANS_CONN (conn,"disconnect ep done.\n" ); +} + +static void iscsi_cleanup_conn_work_fn (struct work_struct *work) +{ + struct iscsi_cls_conn *conn = container_of(work, struct iscsi_cls_conn, + cleanup_work); +struct iscsi_cls_session *session =iscsi_conn_to_session (conn); + +mutex_lock (&conn->ep_mutex); +/* +* If we are not at least bound there is nothing for us to do. Userspace +* will do a ep_disconnect call if offload is used, but will not be +* doing a stop since there is nothing to clean up, so we have to clear +* the cleanup bit here. +*/ +if (conn->state !=ISCSI_CONN_BOUND && conn->state !=ISCSI_CONN_UP ) { +ISCSI_DBG_TRANS_CONN (conn,"Got error while conn is already failed. Ignoring.\n" ); +clear_bit (ISCSI_CLS_CONN_BIT_CLEANUP , &conn->flags); +mutex_unlock (&conn->ep_mutex); +return ; + } + +iscsi_ep_disconnect (conn, false); + +if (system_state !=SYSTEM_RUNNING ) { +/* +* If the user has set up for the session to never timeout +* then hang like they wanted. For all other cases fail right +* away since userspace is not going to relogin. +*/ +if (session->recovery_tmo >0 ) + session->recovery_tmo =0 ; + } + +iscsi_stop_conn (conn,STOP_CONN_RECOVER ); +mutex_unlock (&conn->ep_mutex); +ISCSI_DBG_TRANS_CONN (conn,"cleanup done.\n" ); +} +void iscsi_free_session (struct iscsi_cls_session *session) {ISCSI_DBG_TRANS_SESSION (session,"Freeing session\n" );
@@ -2284,7 +2391,7 @@ iscsi_create_conn(struct iscsi_cls_session *session, int dd_size, uint32_t cid)mutex_init (&conn->ep_mutex);INIT_LIST_HEAD (&conn->conn_list); -INIT_LIST_HEAD (&conn->conn_list_err); +INIT_WORK (&conn->cleanup_work, iscsi_cleanup_conn_work_fn); conn->transport = transport; conn->cid = cid; conn->state =ISCSI_CONN_DOWN ;
@@ -2341,7 +2448,6 @@ int iscsi_destroy_conn(struct iscsi_cls_conn *conn)spin_lock_irqsave (&connlock, flags);list_del (&conn->conn_list); -list_del (&conn->conn_list_err);spin_unlock_irqrestore (&connlock, flags);transport_unregister_device (&conn->dev);
@@ -2456,83 +2562,6 @@ int iscsi_offload_mesg(struct Scsi_Host *shost, }EXPORT_SYMBOL_GPL (iscsi_offload_mesg); -/* -* This can be called without the rx_queue_mutex, if invoked by the kernel -* stop work. But, in that case, it is guaranteed not to race with -* iscsi_destroy by conn_mutex. -*/ -static void iscsi_if_stop_conn (struct iscsi_cls_conn *conn,int flag) -{ -/* -* It is important that this path doesn't rely on -* rx_queue_mutex, otherwise, a thread doing allocation on a -* start_session/start_connection could sleep waiting on a -* writeback to a failed iscsi device, that cannot be recovered -* because the lock is held. If we don't hold it here, the -* kernel stop_conn_work_fn has a chance to stop the broken -* session and resolve the allocation. -* -* Still, the user invoked .stop_conn() needs to be serialized -* with stop_conn_work_fn by a private mutex. Not pretty, but -* it works. -*/ -mutex_lock (&conn_mutex); -switch (flag) { -case STOP_CONN_RECOVER : - conn->state =ISCSI_CONN_FAILED ; -break ; -case STOP_CONN_TERM : - conn->state =ISCSI_CONN_DOWN ; -break ; -default : -iscsi_cls_conn_printk (KERN_ERR , conn, -"invalid stop flag %d\n" , flag); - goto unlock; - } - - conn->transport->stop_conn (conn, flag); -unlock: -mutex_unlock (&conn_mutex); -} - -static void stop_conn_work_fn (struct work_struct *work) -{ -struct iscsi_cls_conn *conn, *tmp; -unsigned long flags; -LIST_HEAD (recovery_list); - -spin_lock_irqsave (&connlock, flags); -if (list_empty (&connlist_err)) { -spin_unlock_irqrestore (&connlock, flags); -return ; - } -list_splice_init (&connlist_err, &recovery_list); -spin_unlock_irqrestore (&connlock, flags); - -list_for_each_entry_safe (conn, tmp, &recovery_list, conn_list_err) { -uint32_t sid =iscsi_conn_get_sid (conn); -struct iscsi_cls_session *session; - - session =iscsi_session_lookup (sid); -if (session) { -if (system_state !=SYSTEM_RUNNING ) { -/* -* If the user has set up for the session to -* never timeout then hang like they wanted. -* For all other cases fail right away since -* userspace is not going to relogin. -*/ -if (session->recovery_tmo >0 ) - session->recovery_tmo =0 ; - } - -iscsi_if_stop_conn (conn,STOP_CONN_RECOVER ); - } - -list_del_init (&conn->conn_list_err); - } -} -void iscsi_conn_error_event (struct iscsi_cls_conn *conn,enum iscsi_err error) {struct nlmsghdr *nlh;
@@ -2540,12 +2569,9 @@ void iscsi_conn_error_event(struct iscsi_cls_conn *conn, enum iscsi_err error)struct iscsi_uevent *ev;struct iscsi_internal *priv;int len =nlmsg_total_size (sizeof (*ev)); -unsigned long flags; -spin_lock_irqsave (&connlock, flags); -list_add (&conn->conn_list_err, &connlist_err); -spin_unlock_irqrestore (&connlock, flags); -queue_work (system_unbound_wq, &stop_conn_work); +if (!test_and_set_bit (ISCSI_CLS_CONN_BIT_CLEANUP , &conn->flags)) +queue_work (iscsi_conn_cleanup_workq, &conn->cleanup_work); priv =iscsi_if_transport_lookup (conn->transport);if (!priv)
@@ -2875,26 +2901,17 @@ static int iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev) { struct iscsi_cls_conn *conn; -unsigned long flags; conn =iscsi_conn_lookup (ev->u.d_conn.sid, ev->u.d_conn.cid);if (!conn)return -EINVAL ; -spin_lock_irqsave (&connlock, flags); -if (!list_empty (&conn->conn_list_err)) { -spin_unlock_irqrestore (&connlock, flags); -return -EAGAIN ; - } -spin_unlock_irqrestore (&connlock, flags); - +ISCSI_DBG_TRANS_CONN (conn,"Flushing cleanup during destruction\n" ); +flush_work (&conn->cleanup_work);ISCSI_DBG_TRANS_CONN (conn,"Destroying transport conn\n" ); -mutex_lock (&conn_mutex);if (transport->destroy_conn) transport->destroy_conn (conn); -mutex_unlock (&conn_mutex); -return 0 ; }
@@ -2973,7 +2990,7 @@ release_host: }static int iscsi_if_ep_disconnect (struct iscsi_transport *transport, -u64 ep_handle,bool is_active) +u64 ep_handle) {struct iscsi_cls_conn *conn;struct iscsi_endpoint *ep;
@@ -2984,17 +3001,30 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, ep =iscsi_lookup_endpoint (ep_handle);if (!ep)return -EINVAL ; + conn = ep->conn; -if (conn) { -mutex_lock (&conn->ep_mutex); - conn->ep =NULL ; +if (!conn) { +/* +* conn was not even bound yet, so we can't get iscsi conn +* failures yet. +*/ + transport->ep_disconnect (ep); + goto put_ep; + } + +mutex_lock (&conn->ep_mutex); +/* Check if this was a conn error and the kernel took ownership */ +if (test_bit (ISCSI_CLS_CONN_BIT_CLEANUP , &conn->flags)) { +ISCSI_DBG_TRANS_CONN (conn,"flush kernel conn cleanup.\n" );mutex_unlock (&conn->ep_mutex); - conn->state =ISCSI_CONN_FAILED ; - transport->unbind_conn (conn, is_active); +flush_work (&conn->cleanup_work); + goto put_ep; } - transport->ep_disconnect (ep); +iscsi_ep_disconnect (conn, false); +mutex_unlock (&conn->ep_mutex); +put_ep:iscsi_put_endpoint (ep);return 0 ; }
@@ -3025,8 +3055,7 @@ iscsi_if_transport_ep(struct iscsi_transport *transport,break ;case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT : rc =iscsi_if_ep_disconnect (transport, - ev->u.ep_disconnect.ep_handle, - false); + ev->u.ep_disconnect.ep_handle);break ; }return rc;
@@ -3653,18 +3682,129 @@ exit_host_stats:return err; } +static int iscsi_if_transport_conn (struct iscsi_transport *transport, +struct nlmsghdr *nlh) +{ +struct iscsi_uevent *ev =nlmsg_data (nlh); +struct iscsi_cls_session *session; +struct iscsi_cls_conn *conn =NULL ; +struct iscsi_endpoint *ep; +uint32_t pdu_len; +int err =0 ; + +switch (nlh->nlmsg_type) { +case ISCSI_UEVENT_CREATE_CONN : +return iscsi_if_create_conn (transport, ev); +case ISCSI_UEVENT_DESTROY_CONN : +return iscsi_if_destroy_conn (transport, ev); +case ISCSI_UEVENT_STOP_CONN : +return iscsi_if_stop_conn (transport, ev); + } + +/* +* The following cmds need to be run under the ep_mutex so in kernel +* conn cleanup (ep_disconnect + unbind and conn) is not done while +* these are running. They also must not run if we have just run a conn +* cleanup because they would set the state in a way that might allow +* IO or send IO themselves. +*/ +switch (nlh->nlmsg_type) { +case ISCSI_UEVENT_START_CONN : + conn =iscsi_conn_lookup (ev->u.start_conn.sid, + ev->u.start_conn.cid); +break ; +case ISCSI_UEVENT_BIND_CONN : + conn =iscsi_conn_lookup (ev->u.b_conn.sid, ev->u.b_conn.cid); +break ; +case ISCSI_UEVENT_SEND_PDU : + conn =iscsi_conn_lookup (ev->u.send_pdu.sid, ev->u.send_pdu.cid); +break ; + } + +if (!conn) +return -EINVAL ; + +mutex_lock (&conn->ep_mutex); +if (test_bit (ISCSI_CLS_CONN_BIT_CLEANUP , &conn->flags)) { +mutex_unlock (&conn->ep_mutex); + ev->r.retcode = -ENOTCONN ; +return 0 ; + } + +switch (nlh->nlmsg_type) { +case ISCSI_UEVENT_BIND_CONN : +if (conn->ep) { +/* +* For offload boot support where iscsid is restarted +* during the pivot root stage, the ep will be intact +* here when the new iscsid instance starts up and +* reconnects. +*/ +iscsi_ep_disconnect (conn, true); + } + + session =iscsi_session_lookup (ev->u.b_conn.sid); +if (!session) { + err = -EINVAL ; +break ; + } + + ev->r.retcode = transport->bind_conn (session, conn, + ev->u.b_conn.transport_eph, + ev->u.b_conn.is_leading); +if (!ev->r.retcode) + conn->state =ISCSI_CONN_BOUND ; + +if (ev->r.retcode || !transport->ep_connect) +break ; + + ep =iscsi_lookup_endpoint (ev->u.b_conn.transport_eph); +if (ep) { + ep->conn = conn; + conn->ep = ep; +iscsi_put_endpoint (ep); + }else { + err = -ENOTCONN ; +iscsi_cls_conn_printk (KERN_ERR , conn, +"Could not set ep conn binding\n" ); + } +break ; +case ISCSI_UEVENT_START_CONN : + ev->r.retcode = transport->start_conn (conn); +if (!ev->r.retcode) + conn->state =ISCSI_CONN_UP ; +break ; +case ISCSI_UEVENT_SEND_PDU : + pdu_len = nlh->nlmsg_len -sizeof (*nlh) -sizeof (*ev); + +if ((ev->u.send_pdu.hdr_size > pdu_len) || + (ev->u.send_pdu.data_size > (pdu_len - ev->u.send_pdu.hdr_size))) { + err = -EINVAL ; +break ; + } + + ev->r.retcode = transport->send_pdu (conn, + (struct iscsi_hdr *)((char *)ev +sizeof (*ev)), + (char *)ev +sizeof (*ev) + ev->u.send_pdu.hdr_size, + ev->u.send_pdu.data_size); +break ; +default : + err = -ENOSYS ; + } + +mutex_unlock (&conn->ep_mutex); +return err; +}static int iscsi_if_recv_msg (struct sk_buff *skb,struct nlmsghdr *nlh,uint32_t *group) {int err =0 ;u32 portid; -u32 pdu_len;struct iscsi_uevent *ev =nlmsg_data (nlh);struct iscsi_transport *transport =NULL ;struct iscsi_internal *priv;struct iscsi_cls_session *session; -struct iscsi_cls_conn *conn;struct iscsi_endpoint *ep =NULL ;if (!netlink_capable (skb,CAP_SYS_ADMIN ))
@@ -3741,90 +3881,16 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)else err = -EINVAL ;break ; -case ISCSI_UEVENT_CREATE_CONN : - err =iscsi_if_create_conn (transport, ev); -break ; -case ISCSI_UEVENT_DESTROY_CONN : - err =iscsi_if_destroy_conn (transport, ev); -break ; -case ISCSI_UEVENT_BIND_CONN : - session =iscsi_session_lookup (ev->u.b_conn.sid); - conn =iscsi_conn_lookup (ev->u.b_conn.sid, ev->u.b_conn.cid); - -if (conn && conn->ep) -iscsi_if_ep_disconnect (transport, conn->ep->id, true); - -if (!session || !conn) { - err = -EINVAL ; -break ; - } - -mutex_lock (&conn_mutex); - ev->r.retcode = transport->bind_conn (session, conn, - ev->u.b_conn.transport_eph, - ev->u.b_conn.is_leading); -if (!ev->r.retcode) - conn->state =ISCSI_CONN_BOUND ; -mutex_unlock (&conn_mutex); - -if (ev->r.retcode || !transport->ep_connect) -break ; - - ep =iscsi_lookup_endpoint (ev->u.b_conn.transport_eph); -if (ep) { - ep->conn = conn; - -mutex_lock (&conn->ep_mutex); - conn->ep = ep; -mutex_unlock (&conn->ep_mutex); -iscsi_put_endpoint (ep); - }else -iscsi_cls_conn_printk (KERN_ERR , conn, -"Could not set ep conn " -"binding\n" ); -break ;case ISCSI_UEVENT_SET_PARAM : err =iscsi_set_param (transport, ev);break ; -case ISCSI_UEVENT_START_CONN : - conn =iscsi_conn_lookup (ev->u.start_conn.sid, ev->u.start_conn.cid); -if (conn) { -mutex_lock (&conn_mutex); - ev->r.retcode = transport->start_conn (conn); -if (!ev->r.retcode) - conn->state =ISCSI_CONN_UP ; -mutex_unlock (&conn_mutex); - } -else - err = -EINVAL ; -break ; +case ISCSI_UEVENT_CREATE_CONN : +case ISCSI_UEVENT_DESTROY_CONN :case ISCSI_UEVENT_STOP_CONN : - conn =iscsi_conn_lookup (ev->u.stop_conn.sid, ev->u.stop_conn.cid); -if (conn) -iscsi_if_stop_conn (conn, ev->u.stop_conn.flag); -else - err = -EINVAL ; -break ; +case ISCSI_UEVENT_START_CONN : +case ISCSI_UEVENT_BIND_CONN :case ISCSI_UEVENT_SEND_PDU : - pdu_len = nlh->nlmsg_len -sizeof (*nlh) -sizeof (*ev); - -if ((ev->u.send_pdu.hdr_size > pdu_len) || - (ev->u.send_pdu.data_size > (pdu_len - ev->u.send_pdu.hdr_size))) { - err = -EINVAL ; -break ; - } - - conn =iscsi_conn_lookup (ev->u.send_pdu.sid, ev->u.send_pdu.cid); -if (conn) { -mutex_lock (&conn_mutex); - ev->r.retcode = transport->send_pdu (conn, - (struct iscsi_hdr *)((char *)ev +sizeof (*ev)), - (char *)ev +sizeof (*ev) + ev->u.send_pdu.hdr_size, - ev->u.send_pdu.data_size); -mutex_unlock (&conn_mutex); - } -else - err = -EINVAL ; + err =iscsi_if_transport_conn (transport, nlh);break ;case ISCSI_UEVENT_GET_STATS : err =iscsi_if_get_stats (transport, nlh);
@@ -4827,8 +4893,18 @@ static __init int iscsi_transport_init(void) goto release_nls; } + iscsi_conn_cleanup_workq =alloc_workqueue ("%s" , +WQ_SYSFS |WQ_MEM_RECLAIM |WQ_UNBOUND ,0 , +"iscsi_conn_cleanup" ); +if (!iscsi_conn_cleanup_workq) { + err = -ENOMEM ; + goto destroy_wq; + } +return 0 ; +destroy_wq: +destroy_workqueue (iscsi_eh_timer_workq); release_nls:netlink_kernel_release (nls); unregister_flashnode_bus:
@@ -4850,6 +4926,7 @@ unregister_transport_class: static void __exit iscsi_transport_exit(void) { +destroy_workqueue (iscsi_conn_cleanup_workq);destroy_workqueue (iscsi_eh_timer_workq);netlink_kernel_release (nls);bus_unregister (&iscsi_flashnode_bus);
include/scsi/scsi_transport_iscsi.h +9 -1
@@ -197,15 +197,23 @@ enum iscsi_connection_state { ISCSI_CONN_BOUND, }; +#define ISCSI_CLS_CONN_BIT_CLEANUP 1 +struct iscsi_cls_conn {struct list_head conn_list;/* item in connlist */ -struct list_head conn_list_err;/* item in connlist_err */ void *dd_data;/* LLD private data */ struct iscsi_transport *transport;uint32_t cid;/* connection id */ +/* +* This protects the conn startup and binding/unbinding of the ep to +* the conn. Unbinding includes ep_disconnect and stop_conn. +*/ struct mutex ep_mutex;struct iscsi_endpoint *ep; +unsigned long flags; +struct work_struct cleanup_work; +struct device dev;/* sysfs transport/container device */ enum iscsi_connection_state state; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 667/800 scsi: iscsi: Flush block work before unblock
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 7ce9fc5ecde0d8bd64c29baee6c5e3ce7074ec9a ]
We set the max_active iSCSI EH works to 1, so all work is going to execute in order by default. However, userspace can now override this in sysfs. If max_active > 1, we can end up with the block_work on CPU1 and iscsi_unblock_session running the unblock_work on CPU2 and the session and target/device state will end up out of sync with each other.
This adds a flush of the block_work in iscsi_unblock_session.
--- drivers/scsi/scsi_transport_iscsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/scsi_transport_iscsi.c +2 -0
@@ -1969,6 +1969,8 @@ static void __iscsi_unblock_session(struct work_struct *work)*/ void iscsi_unblock_session (struct iscsi_cls_session *session) { +flush_work (&session->block_work); +queue_work (iscsi_eh_timer_workq, &session->unblock_work);/* * Blocking the session can be done from any context so we only
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 668/800 mfd: mp2629: Select MFD_CORE to fix build error
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit a933272041d852a1ef1c85f0c18b93e9999a41fa ]
MFD_MP2629 should select MFD_CORE to a prevent build error:
ERROR: modpost: "devm_mfd_add_devices" [drivers/mfd/mp2629.ko] undefined!
--- drivers/mfd/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/Kconfig +1 -0
@@ -465,6 +465,7 @@ config MFD_MP2629 tristate "Monolithic Power Systems MP2629 ADC and Battery charger" depends on I2C select REGMAP_I2C + select MFD_CORE help Select this option to enable support for Monolithic Power Systems battery charger. This provides ADC, thermal and battery charger power
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 669/800 mfd: Remove software node conditionally and locate at right place
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 5a23e8b0fd6010e25ae58362292235cc9213ca57 ]
Currently the software node is removed in error case and at ->remove() stage unconditionally, that ruins the symmetry. Besides, in some cases, when mfd_add_device() fails, the device_remove_software_node() call may lead to NULL pointer dereference:
BUG: kernel NULL pointer dereference, address: 00000000 ... EIP: strlen+0x12/0x20 ... kernfs_name_hash+0x13/0x70 kernfs_find_ns+0x32/0xc0 kernfs_remove_by_name_ns+0x2a/0x90 sysfs_remove_link+0x16/0x30 software_node_notify.cold+0x34/0x6b device_remove_software_node+0x5a/0x90 mfd_add_device.cold+0x30a/0x427
Fix all these by guarding device_remove_software_node() with a conditional and locating it at the right place.
--- drivers/mfd/mfd-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/mfd/mfd-core.c +9 -6
@@ -266,18 +266,18 @@ static int mfd_add_device(struct device *parent, int id,if (has_acpi_companion (&pdev->dev)) { ret =acpi_check_resource_conflict (&res[r]);if (ret) - goto fail_of_entry; + goto fail_res_conflict; } } } ret =platform_device_add_resources (pdev, res, cell->num_resources);if (ret) - goto fail_of_entry; + goto fail_res_conflict; ret =platform_device_add (pdev);if (ret) - goto fail_of_entry; + goto fail_res_conflict;if (cell->pm_runtime_no_callbacks)pm_runtime_no_callbacks (&pdev->dev);
@@ -286,13 +286,15 @@ static int mfd_add_device(struct device *parent, int id,return 0 ; +fail_res_conflict: +if (cell->swnode) +device_remove_software_node (&pdev->dev); fail_of_entry:list_for_each_entry_safe (of_entry, tmp, &mfd_of_node_list, list)if (of_entry->dev == &pdev->dev) {list_del (&of_entry->list);kfree (of_entry); } -device_remove_software_node (&pdev->dev); fail_alias: regulator_bulk_unregister_supply_alias(&pdev->dev, cell->parent_supplies,
@@ -358,11 +360,12 @@ static int mfd_remove_devices_fn(struct device *dev, void *data)if (level && cell->level > *level)return 0 ; +if (cell->swnode) +device_remove_software_node (&pdev->dev); +regulator_bulk_unregister_supply_alias (dev, cell->parent_supplies, cell->num_parent_supplies); -device_remove_software_node (&pdev->dev); -platform_device_unregister (pdev);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 670/800 mfd: rn5t618: Fix IRQ trigger by changing it to level mode
In reply to Greg Kroah-HartmanFrom: Andreas Kemnade <[email protected]>
[ Upstream commit a1649a5260631979c68e5b2012f60f90300e646f ]
During more massive generation of interrupts, the IRQ got stuck, and the subdevices did not see any new interrupts. That happens especially at wonky USB supply in combination with ADC reads. To fix that trigger the IRQ at level low instead of falling edge.
--- drivers/mfd/rn5t618.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/rn5t618.c +1 -1
@@ -107,7 +107,7 @@ static int rn5t618_irq_init(struct rn5t618 *rn5t618) ret =devm_regmap_add_irq_chip (rn5t618->dev, rn5t618->regmap, rn5t618->irq, -IRQF_TRIGGER_FALLING |IRQF_ONESHOT , +IRQF_TRIGGER_LOW |IRQF_ONESHOT ,0 , irq_chip, &rn5t618->irq_data);if (ret)dev_err (rn5t618->dev,"Failed to register IRQ chip\n" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 671/800 fsi: core: Fix return of error values on failures
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 910810945707fe9877ca86a0dca4e585fd05e37b ]
Currently the cfam_read and cfam_write functions return the provided number of bytes given in the count parameter and not the error return code in variable rc, hence all failures of read/writes are being silently ignored. Fix this by returning the error code in rc.
Addresses-Coverity: ("Unused value")
--- drivers/fsi/fsi-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/fsi/fsi-core.c +2 -2
@@ -724,7 +724,7 @@ static ssize_t cfam_read(struct file *filep, char __user *buf, size_t count, rc = count; fail: *offset = off; -return count; +return rc; } static ssize_t cfam_write(struct file *filep, const char __user *buf,
@@ -761,7 +761,7 @@ static ssize_t cfam_write(struct file *filep, const char __user *buf, rc = count; fail: *offset = off; -return count; +return rc; }static loff_t cfam_llseek (struct file *file,loff_t offset,int whence)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 672/800 fsi: scom: Reset the FSI2PIB engine for any error
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit a5c317dac5567206ca7b6bc9d008dd6890c8bced ]
The error bits in the FSI2PIB status are only cleared by a reset. So the driver needs to perform a reset after seeing any of the FSI2PIB errors, otherwise subsequent operations will also look like failures.
--- drivers/fsi/fsi-scom.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/fsi/fsi-scom.c +9 -7
@@ -38,9 +38,10 @@#define SCOM_STATUS_PIB_RESP_MASK 0x00007000#define SCOM_STATUS_PIB_RESP_SHIFT 12 -#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_PROTECTION | \ - SCOM_STATUS_PARITY | \ - SCOM_STATUS_PIB_ABORT | \ +#define SCOM_STATUS_FSI2PIB_ERROR (SCOM_STATUS_PROTECTION | \ + SCOM_STATUS_PARITY | \ + SCOM_STATUS_PIB_ABORT) +#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_FSI2PIB_ERROR | \ SCOM_STATUS_PIB_RESP_MASK)/* SCOM address encodings */ #define XSCOM_ADDR_IND_FLAG BIT_ULL(63)
@@ -240,13 +241,14 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) {uint32_t dummy =-1 ; -if (status &SCOM_STATUS_PROTECTION ) -return -EPERM ; -if (status &SCOM_STATUS_PARITY ) { +if (status &SCOM_STATUS_FSI2PIB_ERROR )fsi_device_write (scom->fsi_dev,SCOM_FSI2PIB_RESET_REG , &dummy,sizeof (uint32_t )); + +if (status &SCOM_STATUS_PROTECTION ) +return -EPERM ; +if (status &SCOM_STATUS_PARITY )return -EIO ; - }/* Return -EBUSY on PIB abort to force a retry */ if (status &SCOM_STATUS_PIB_ABORT )return -EBUSY ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 673/800 fsi: occ: Dont accept response from un-initialized OCC
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit 8a4659be08576141f47d47d94130eb148cb5f0df ]
If the OCC is not initialized and responds as such, the driver should continue waiting for a valid response until the timeout expires.
--- drivers/fsi/fsi-occ.c | 1 + 1 file changed, 1 insertion(+)
drivers/fsi/fsi-occ.c +1 -0
@@ -495,6 +495,7 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len, goto done;if (resp->return_status ==OCC_RESP_CMD_IN_PRG || + resp->return_status ==OCC_RESP_CRIT_INIT || resp->seq_no != seq_no) { rc = -ETIMEDOUT ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 674/800 fsi/sbefifo: Clean up correct FIFO when receiving reset request from SBE
In reply to Greg Kroah-HartmanFrom: Joachim Fenkes <[email protected]>
[ Upstream commit 95152433e46fdb36652ebdbea442356a16ae1fa6 ]
When the SBE requests a reset via the down FIFO, that is also the FIFO we should go and reset ;)
--- drivers/fsi/fsi-sbefifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fsi/fsi-sbefifo.c +1 -1
@@ -400,7 +400,7 @@ static int sbefifo_cleanup_hw(struct sbefifo *sbefifo)/* The FIFO already contains a reset request from the SBE ? */ if (down_status &SBEFIFO_STS_RESET_REQ ) {dev_info (dev,"Cleanup: FIFO reset request set, resetting\n" ); - rc =sbefifo_regw (sbefifo,SBEFIFO_UP ,SBEFIFO_PERFORM_RESET ); + rc =sbefifo_regw (sbefifo,SBEFIFO_DOWN ,SBEFIFO_PERFORM_RESET );if (rc) { sbefifo->broken = true;dev_err (dev,"Cleanup: Reset reg write failed, rc=%d\n" , rc);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 675/800 fsi/sbefifo: Fix reset timeout
In reply to Greg Kroah-HartmanFrom: Joachim Fenkes <[email protected]>
[ Upstream commit 9ab1428dfe2c66b51e0b41337cd0164da0ab6080 ]
On BMCs with lower timer resolution than 1ms, msleep(1) will take way longer than 1ms, so looping 10k times won't wait for 10s but significantly longer.
Fix this by using jiffies like the rest of the code.
--- drivers/fsi/fsi-sbefifo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/fsi/fsi-sbefifo.c +5 -3
@@ -325,7 +325,8 @@ static int sbefifo_up_write(struct sbefifo *sbefifo, __be32 word)static int sbefifo_request_reset (struct sbefifo *sbefifo) {struct device *dev = &sbefifo->fsi_dev->dev; -u32 status, timeout; +unsigned long end_time; +u32 status;int rc;dev_dbg (dev,"Requesting FIFO reset\n" );
@@ -341,7 +342,8 @@ static int sbefifo_request_reset(struct sbefifo *sbefifo) }/* Wait for it to complete */ -for (timeout =0 ; timeout <SBEFIFO_RESET_TIMEOUT ; timeout++) { + end_time = jiffies +msecs_to_jiffies (SBEFIFO_RESET_TIMEOUT ); +while (!time_after (jiffies, end_time)) { rc =sbefifo_regr (sbefifo,SBEFIFO_UP |SBEFIFO_STS , &status);if (rc) { dev_err(dev, "Failed to read UP fifo status during reset"
@@ -355,7 +357,7 @@ static int sbefifo_request_reset(struct sbefifo *sbefifo)return 0 ; } -msleep (1 ); +cond_resched (); }dev_err (dev,"FIFO reset timed out\n" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 676/800 visorbus: fix error return code in visorchipset_init()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit ce52ec5beecc1079c251f60e3973b3758f60eb59 ]
Commit 1366a3db3dcf ("staging: unisys: visorbus: visorchipset_init clean up gotos") assigns the initial value -ENODEV to the local variable 'err', and the first several error branches will return this value after "goto error". But commit f1f537c2e7f5 ("staging: unisys: visorbus: Consolidate controlvm channel creation.") overwrites 'err' in the middle of the way. As a result, some error branches do not successfully return the initial value -ENODEV of 'err', but return 0.
In addition, when kzalloc() fails, -ENOMEM should be returned instead of -ENODEV.
--- drivers/visorbus/visorchipset.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/visorbus/visorchipset.c +4 -2
@@ -1561,7 +1561,7 @@ schedule_out:static int visorchipset_init (struct acpi_device *acpi_device) { -int err = -ENODEV ; +int err = -ENOMEM ;struct visorchannel *controlvm_channel; chipset_dev =kzalloc (sizeof (*chipset_dev),GFP_KERNEL );
@@ -1584,8 +1584,10 @@ static int visorchipset_init(struct acpi_device *acpi_device) "controlvm", sizeof(struct visor_controlvm_channel), VISOR_CONTROLVM_CHANNEL_VERSIONID, - VISOR_CHANNEL_SIGNATURE)) + VISOR_CHANNEL_SIGNATURE)) { + err = -ENODEV ; goto error_delete_groups; + }/* if booting in a crash kernel */ if (is_kdump_kernel ()) INIT_DELAYED_WORK(&chipset_dev->periodic_controlvm_work,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 677/800 iommu/amd: Fix extended features logging
In reply to Greg Kroah-HartmanFrom: Alexander Monakov <[email protected]>
[ Upstream commit 4b21a503adf597773e4b37db05db0e9b16a81d53 ]
print_iommu_info prints the EFR register and then the decoded list of features on a separate line:
pci 0000:00:00.2: AMD-Vi: Extended features (0x206d73ef22254ade):
PPR X2APIC NX GT IA GA PC GA_vAPIC
The second line is emitted via 'pr_cont', which causes it to have a different ('warn') loglevel compared to the previous line ('info').
Commit 9a295ff0ffc9 attempted to rectify this by removing the newline from the pci_info format string, but this doesn't work, as pci_info calls implicitly append a newline anyway.
Printing the decoded features on the same line would make it quite long. Instead, change pci_info() to pr_info() to omit PCI bus location info, which is also shown in the preceding message. This results in:
pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40
AMD-Vi: Extended features (0x206d73ef22254ade): PPR X2APIC NX GT IA GA PC GA_vAPIC
AMD-Vi: Interrupt remapping enabled
--- drivers/iommu/amd/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/amd/init.c +2 -2
@@ -1908,8 +1908,8 @@ static void print_iommu_info(void)pci_info (pdev,"Found IOMMU cap 0x%x\n" , iommu->cap_ptr);if (iommu->cap & (1 <<IOMMU_CAP_EFR )) { -pci_info (pdev,"Extended features (%#llx):" , - iommu->features); +pr_info ("Extended features (%#llx):" , iommu->features); +for (i =0 ; i <ARRAY_SIZE (feat_str); ++i) {if (iommu_feature (iommu, (1ULL << i)))pr_cont (" %s" , feat_str[i]);
Signature · 8 lines
2.30.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Greg Kroah-Hartman
maintainerPATCH 678/800 iommu/amd: Tidy up DMA ops init
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
[ Upstream commit be227f8e99a663d097536e9f9bc935fb26bdbc41 ]
Now that DMA ops are part of the core API via iommu-dma, fold the vestigial remains of the IOMMU_DMA_OPS init state into the IOMMU API phase, and clean up a few other leftovers. This should also close the race window wherein bus_set_iommu() effectively makes the DMA ops state visible before its nominal initialisation - it seems this was previously fairly benign, but since commit a250c23f15c2 ("iommu: remove DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE") it can now lead to the strict flush queue policy inadvertently being picked for default domains allocated during that window, with a corresponding unexpected perfomance impact.
--- drivers/iommu/amd/amd_iommu.h | 2 -- drivers/iommu/amd/init.c | 5 ----- drivers/iommu/amd/iommu.c | 31 +++++++++++++------------------ 3 files changed, 13 insertions(+), 25 deletions(-)
drivers/iommu/amd/amd_iommu.h +0 -2
@@ -11,8 +11,6 @@#include "amd_iommu_types.h" -extern int amd_iommu_init_dma_ops (void ); -extern int amd_iommu_init_passthrough (void );extern irqreturn_t amd_iommu_int_thread (int irq,void *data);extern irqreturn_t amd_iommu_int_handler (int irq,void *data);extern void amd_iommu_apply_erratum_63 (u16 devid);
drivers/iommu/amd/init.c +0 -5
@@ -231,7 +231,6 @@ enum iommu_init_state {IOMMU_ENABLED ,IOMMU_PCI_INIT ,IOMMU_INTERRUPTS_EN , -IOMMU_DMA_OPS ,IOMMU_INITIALIZED ,IOMMU_NOT_FOUND , IOMMU_INIT_ERROR,
@@ -2895,10 +2894,6 @@ static int __init state_next(void) init_state = ret ?IOMMU_INIT_ERROR :IOMMU_INTERRUPTS_EN ;break ;case IOMMU_INTERRUPTS_EN : - ret =amd_iommu_init_dma_ops (); - init_state = ret ?IOMMU_INIT_ERROR :IOMMU_DMA_OPS ; -break ; -case IOMMU_DMA_OPS : init_state =IOMMU_INITIALIZED ;break ;case IOMMU_INITIALIZED :
drivers/iommu/amd/iommu.c +13 -18
@@ -30,7 +30,6 @@#include <linux/msi.h> #include <linux/irqdomain.h> #include <linux/percpu.h> -#include <linux/iova.h> #include <linux/io-pgtable.h> #include <asm/irq_remapping.h> #include <asm/io_apic.h>
@@ -1773,13 +1772,22 @@ void amd_iommu_domain_update(struct protection_domain *domain)amd_iommu_domain_flush_complete (domain); } +static void __init amd_iommu_init_dma_ops (void ) +{ + swiotlb = (iommu_default_passthrough () || sme_me_mask) ?1 :0 ; + +if (amd_iommu_unmap_flush) +pr_info ("IO/TLB flush on unmap enabled\n" ); +else +pr_info ("Lazy IO/TLB flushing enabled\n" ); +iommu_set_dma_strict (amd_iommu_unmap_flush); +} +int __init amd_iommu_init_api (void ) { -int ret, err =0 ; +int err =0 ; - ret =iova_cache_get (); -if (ret) -return ret; +amd_iommu_init_dma_ops (); err =bus_set_iommu (&pci_bus_type, &amd_iommu_ops);if (err)
@@ -1796,19 +1804,6 @@ int __init amd_iommu_init_api(void)return 0 ; } -int __init amd_iommu_init_dma_ops (void ) -{ - swiotlb = (iommu_default_passthrough () || sme_me_mask) ?1 :0 ; - -if (amd_iommu_unmap_flush) -pr_info ("IO/TLB flush on unmap enabled\n" ); -else -pr_info ("Lazy IO/TLB flushing enabled\n" ); -iommu_set_dma_strict (amd_iommu_unmap_flush); -return 0 ; - -} -/***************************************************************************** * * The following functions belong to the exported interface of AMD IOMMU
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 679/800 s390: enable HAVE_IOREMAP_PROT
In reply to Greg Kroah-HartmanFrom: Niklas Schnelle <[email protected]>
[ Upstream commit d460bb6c6417588dd8b0907d34f69b237918812a ]
In commit b02002cc4c0f ("s390/pci: Implement ioremap_wc/prot() with MIO") we implemented both ioremap_wc() and ioremap_prot() however until now we had not set HAVE_IOREMAP_PROT in Kconfig, do so now.
This also requires implementing pte_pgprot() as this is used in the generic_access_phys() code enabled by CONFIG_HAVE_IOREMAP_PROT. As with ioremap_wc() we need to take the MMIO Write Back bit index into account.
Moreover since the pgprot value returned from pte_pgprot() is to be used for mappings into kernel address space we must make sure that it uses appropriate kernel page table protection bits. In particular a pgprot value originally coming from userspace could have the _PAGE_PROTECT bit set to enable fault based dirty bit accounting which would then make the mapping inaccessible when used in kernel address space.
--- arch/s390/Kconfig | 1 + arch/s390/include/asm/pgtable.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
arch/s390/Kconfig +1 -0
@@ -164,6 +164,7 @@ config S390 select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_GCC_PLUGINS select HAVE_GENERIC_VDSO + select HAVE_IOREMAP_PROT if PCI select HAVE_IRQ_EXIT_ON_IRQ_STACK select HAVE_KERNEL_BZIP2 select HAVE_KERNEL_GZIP
arch/s390/include/asm/pgtable.h +19 -0
@@ -863,6 +863,25 @@ static inline int pte_unused(pte_t pte)return pte_val (pte) & _PAGE_UNUSED; } +/* +* Extract the pgprot value from the given pte while at the same time making it +* usable for kernel address space mappings where fault driven dirty and +* young/old accounting is not supported, i.e _PAGE_PROTECT and _PAGE_INVALID +* must not be set. +*/ +static inline pgprot_t pte_pgprot (pte_t pte) +{ +unsigned long pte_flags =pte_val (pte) & _PAGE_CHG_MASK; + +if (pte_write (pte)) + pte_flags |=pgprot_val (PAGE_KERNEL ); +else + pte_flags |=pgprot_val (PAGE_KERNEL_RO ); + pte_flags |=pte_val (pte) & mio_wb_bit_mask; + +return __pgprot (pte_flags); +} +/* * pgd/pmd/pte modification functions */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 680/800 s390: appldata depends on PROC_SYSCTL
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 5d3516b3647621d5a1180672ea9e0817fb718ada ]
APPLDATA_BASE should depend on PROC_SYSCTL instead of PROC_FS. Building with PROC_FS but not PROC_SYSCTL causes a build error, since appldata_base.c uses data and APIs from fs/proc/proc_sysctl.c.
arch/s390/appldata/appldata_base.o: in function `appldata_generic_handler':
appldata_base.c:(.text+0x192): undefined reference to `sysctl_vals'
--- arch/s390/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/Kconfig +1 -1
@@ -854,7 +854,7 @@ config CMM_IUCV config APPLDATA_BASE def_bool n prompt "Linux - VM Monitor Stream, base infrastructure" - depends on PROC_FS + depends on PROC_SYSCTL help This provides a kernel interface for creating and updating z/VM APPLDATA monitor records. The monitor records are updated at certain time
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 681/800 selftests: splice: Adjust for handler fallback removal
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 6daf076b717d189f4d02a303d45edd5732341ec1 ]
Some pseudo-filesystems do not have an explicit splice fops since adding commit 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops"), and now will reject attempts to use splice() in those filesystem paths.
--- .../selftests/splice/short_splice_read.sh | 119 ++++++++++++++---- 1 file changed, 98 insertions(+), 21 deletions(-)
tools/testing/selftests/splice/short_splice_read.sh +98 -21
@@ -1,21 +1,87 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 +# +# Test for mishandling of splice() on pseudofilesystems, which should catch +# bugs like 11990a5bd7e5 ("module: Correctly truncate sysfs sections output") +# +# Since splice fallback was removed as part of the set_fs() rework, many of these +# tests expect to fail now. See https://lore.kernel.org/lkml/202009181443.C2179FB@keescook/ set -e +DIR=$(dirname "$0") + ret=0 +expect_success() +{ + title="$1" + shift + + echo "" >&2 + echo "$title ..." >&2 + + set +e + "$@" + rc=$? + set -e + + case "$rc" in + 0) + echo "ok: $title succeeded" >&2 + ;; + 1) + echo "FAIL: $title should work" >&2 + ret=$(( ret + 1 )) + ;; + *) + echo "FAIL: something else went wrong" >&2 + ret=$(( ret + 1 )) + ;; + esac +} + +expect_failure() +{ + title="$1" + shift + + echo "" >&2 + echo "$title ..." >&2 + + set +e + "$@" + rc=$? + set -e + + case "$rc" in + 0) + echo "FAIL: $title unexpectedly worked" >&2 + ret=$(( ret + 1 )) + ;; + 1) + echo "ok: $title correctly failed" >&2 + ;; + *) + echo "FAIL: something else went wrong" >&2 + ret=$(( ret + 1 )) + ;; + esac +} + do_splice() { filename="$1" bytes="$2" expected="$3" + report="$4" - out=$(./splice_read "$filename" "$bytes" | cat) + out=$("$DIR"/splice_read "$filename" "$bytes" | cat) if [ "$out" = "$expected" ] ; then - echo "ok: $filename $bytes" + echo " matched $report" >&2 + return 0 else - echo "FAIL: $filename $bytes" - ret=1 + echo " no match: '$out' vs $report" >&2 + return 1 fi }
@@ -23,34 +89,45 @@ test_splice() { filename="$1" + echo " checking $filename ..." >&2 + full=$(cat "$filename") + rc=$? + if [ $rc -ne 0 ] ; then + return 2 + fi + two=$(echo "$full" | grep -m1 . | cut -c-2) # Make sure full splice has the same contents as a standard read. - do_splice "$filename" 4096 "$full" + echo " splicing 4096 bytes ..." >&2 + if ! do_splice "$filename" 4096 "$full" "full read" ; then + return 1 + fi # Make sure a partial splice see the first two characters. - do_splice "$filename" 2 "$two" + echo " splicing 2 bytes ..." >&2 + if ! do_splice "$filename" 2 "$two" "'$two'" ; then + return 1 + fi + + return 0 } -# proc_single_open(), seq_read() -test_splice /proc/$$/limits -# special open, seq_read() -test_splice /proc/$$/comm +### /proc/$pid/ has no splice interface; these should all fail. +expect_failure "proc_single_open(), seq_read() splice" test_splice /proc/$$/limits +expect_failure "special open(), seq_read() splice" test_splice /proc/$$/comm -# proc_handler, proc_dointvec_minmax -test_splice /proc/sys/fs/nr_open -# proc_handler, proc_dostring -test_splice /proc/sys/kernel/modprobe -# proc_handler, special read -test_splice /proc/sys/kernel/version +### /proc/sys/ has a splice interface; these should all succeed. +expect_success "proc_handler: proc_dointvec_minmax() splice" test_splice /proc/sys/fs/nr_open +expect_success "proc_handler: proc_dostring() splice" test_splice /proc/sys/kernel/modprobe +expect_success "proc_handler: special read splice" test_splice /proc/sys/kernel/version +### /sys/ has no splice interface; these should all fail. if ! [ -d /sys/module/test_module/sections ] ; then - modprobe test_module + expect_success "test_module kernel module load" modprobe test_module fi -# kernfs, attr -test_splice /sys/module/test_module/coresize -# kernfs, binattr -test_splice /sys/module/test_module/sections/.init.text +expect_failure "kernfs attr splice" test_splice /sys/module/test_module/coresize +expect_failure "kernfs binattr splice" test_splice /sys/module/test_module/sections/.init.text exit $ret
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 682/800 iommu/dma: Fix IOVA reserve dma ranges
In reply to Greg Kroah-HartmanFrom: Srinath Mannam <[email protected]>
[ Upstream commit 571f316074a203e979ea90211d9acf423dfe5f46 ]
Fix IOVA reserve failure in the case when address of first memory region listed in dma-ranges is equal to 0x0.
--- drivers/iommu/dma-iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iommu/dma-iommu.c +4 -2
@@ -243,9 +243,11 @@ resv_iova: lo =iova_pfn (iovad, start); hi =iova_pfn (iovad, end);reserve_iova (iovad, lo, hi); - }else { + }else if (end < start) {/* dma_ranges list should be sorted */ -dev_err (&dev->dev,"Failed to reserve IOVA\n" ); +dev_err (&dev->dev, +"Failed to reserve IOVA [%#010llx-%#010llx]\n" , + start, end);return -EINVAL ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 683/800 ASoC: max98373-sdw: add missing memory allocation check
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 468a272ca49cc4e2f58f3c360643c3f6d313c146 ]
We forgot to test that devm_kcalloc doesn't return NULL.
--- sound/soc/codecs/max98373-sdw.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/max98373-sdw.c +2 -0
@@ -787,6 +787,8 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap) max98373->cache =devm_kcalloc (dev, max98373->cache_num,sizeof (*max98373->cache),GFP_KERNEL ); +if (!max98373->cache) +return -ENOMEM ;for (i =0 ; i < max98373->cache_num; i++) max98373->cache[i].reg = max98373_sdw_cache_reg[i];
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 684/800 ASoC: max98373-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit bf881170311ea74ff30c3be0be8fb097132ce696 ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
This patch renames the status flag to 'first_hw_init' for consistency with other drivers.
--- sound/soc/codecs/max98373-sdw.c | 12 ++++++------ sound/soc/codecs/max98373.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
sound/soc/codecs/max98373-sdw.c +6 -6
@@ -271,7 +271,7 @@ static __maybe_unused int max98373_resume(struct device *dev)struct max98373_priv *max98373 =dev_get_drvdata (dev);unsigned long time; -if (!max98373->hw_init) +if (!max98373->first_hw_init)return 0 ;if (!slave->unattach_request)
@@ -362,7 +362,7 @@ static int max98373_io_init(struct sdw_slave *slave)struct device *dev = &slave->dev;struct max98373_priv *max98373 =dev_get_drvdata (dev); -if (max98373->pm_init_once) { +if (max98373->first_hw_init) {regcache_cache_only (max98373->regmap, false);regcache_cache_bypass (max98373->regmap, true); }
@@ -370,7 +370,7 @@ static int max98373_io_init(struct sdw_slave *slave)/* * PM runtime is only enabled when a Slave reports as Attached */ -if (!max98373->pm_init_once) { +if (!max98373->first_hw_init) {/* set autosuspend parameters */ pm_runtime_set_autosuspend_delay (dev,3000 );pm_runtime_use_autosuspend (dev);
@@ -462,12 +462,12 @@ static int max98373_io_init(struct sdw_slave *slave)regmap_write (max98373->regmap,MAX98373_R20B5_BDE_EN ,1 );regmap_write (max98373->regmap,MAX98373_R20E2_LIMITER_EN ,1 ); -if (max98373->pm_init_once) { +if (max98373->first_hw_init) {regcache_cache_bypass (max98373->regmap, false);regcache_mark_dirty (max98373->regmap); } - max98373->pm_init_once = true; + max98373->first_hw_init = true; max98373->hw_init = true;pm_runtime_mark_last_busy (dev);
@@ -797,7 +797,7 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap)max98373_slot_config (dev, max98373); max98373->hw_init = false; - max98373->pm_init_once = false; + max98373->first_hw_init = false;/* codec registration */ ret = devm_snd_soc_register_component(dev, &soc_codec_dev_max98373_sdw,
sound/soc/codecs/max98373.h +1 -1
@@ -226,7 +226,7 @@ struct max98373_priv {/* variables to support soundwire */ struct sdw_slave *slave;bool hw_init; -bool pm_init_once; +bool first_hw_init;int slot;unsigned int rx_mask; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 685/800 ASoC: rt1308-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 30e102dab5fad1db71684f8ac5e1ac74e49da06d ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
--- sound/soc/codecs/rt1308-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt1308-sdw.c +1 -1
@@ -709,7 +709,7 @@ static int __maybe_unused rt1308_dev_resume(struct device *dev)struct rt1308_sdw_priv *rt1308 =dev_get_drvdata (dev);unsigned long time; -if (!rt1308->hw_init) +if (!rt1308->first_hw_init)return 0 ;if (!slave->unattach_request)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 686/800 ASoC: rt1316-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit ebe2ef60ed76c1afd8ec84e1bfd1868e3456e96b ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
--- sound/soc/codecs/rt1316-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt1316-sdw.c +1 -1
@@ -701,7 +701,7 @@ static int __maybe_unused rt1316_dev_resume(struct device *dev)struct rt1316_sdw_priv *rt1316 =dev_get_drvdata (dev);unsigned long time; -if (!rt1316->hw_init) +if (!rt1316->first_hw_init)return 0 ;if (!slave->unattach_request)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 687/800 ASoC: rt5682-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 5361a42114689f875a9748299cadb4b1adbee6f4 ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
--- sound/soc/codecs/rt5682-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt5682-sdw.c +1 -1
@@ -743,7 +743,7 @@ static int __maybe_unused rt5682_dev_resume(struct device *dev)struct rt5682_priv *rt5682 =dev_get_drvdata (dev);unsigned long time; -if (!rt5682->hw_init) +if (!rt5682->first_hw_init)return 0 ;if (!slave->unattach_request)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 688/800 ASoC: rt700-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit a9e54e5fbe396b546771cf77b43ce7c75e212278 ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
--- sound/soc/codecs/rt700-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt700-sdw.c +1 -1
@@ -498,7 +498,7 @@ static int __maybe_unused rt700_dev_resume(struct device *dev)struct rt700_priv *rt700 =dev_get_drvdata (dev);unsigned long time; -if (!rt700->hw_init) +if (!rt700->first_hw_init)return 0 ;if (!slave->unattach_request)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 689/800 ASoC: rt711-sdca-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit b32cab09707bb7fd851128633157c92716df6781 ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
--- sound/soc/codecs/rt711-sdca-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt711-sdca-sdw.c +1 -1
@@ -380,7 +380,7 @@ static int __maybe_unused rt711_sdca_dev_resume(struct device *dev)struct rt711_sdca_priv *rt711 =dev_get_drvdata (dev);unsigned long time; -if (!rt711->hw_init) +if (!rt711->first_hw_init)return 0 ;if (!slave->unattach_request)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 690/800 ASoC: rt711-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit a0897ebca669f09a2e02206a9c48a738af655329 ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
--- sound/soc/codecs/rt711-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt711-sdw.c +1 -1
@@ -501,7 +501,7 @@ static int __maybe_unused rt711_dev_resume(struct device *dev)struct rt711_priv *rt711 =dev_get_drvdata (dev);unsigned long time; -if (!rt711->hw_init) +if (!rt711->first_hw_init)return 0 ;if (!slave->unattach_request)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 691/800 ASoC: rt715-sdca-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit d34d0897a753f42c8a7a6af3866781dd57344a45 ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
This patch renames the status flag to 'first_hw_init' for consistency with other drivers (was 'first_init')
--- sound/soc/codecs/rt715-sdca-sdw.c | 2 +- sound/soc/codecs/rt715-sdca.c | 6 +++--- sound/soc/codecs/rt715-sdca.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/rt715-sdca-sdw.c +1 -1
@@ -224,7 +224,7 @@ static int __maybe_unused rt715_dev_resume(struct device *dev)struct rt715_sdca_priv *rt715 =dev_get_drvdata (dev);unsigned long time; -if (!rt715->hw_init) +if (!rt715->first_hw_init)return 0 ;if (!slave->unattach_request)
sound/soc/codecs/rt715-sdca.c +3 -3
@@ -997,7 +997,7 @@ int rt715_sdca_init(struct device *dev, struct regmap *mbq_regmap,* HW init will be performed when device reports present */ rt715->hw_init = false; - rt715->first_init = false; + rt715->first_hw_init = false; ret = devm_snd_soc_register_component(dev, &soc_codec_dev_rt715_sdca,
@@ -1018,7 +1018,7 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)/* * PM runtime is only enabled when a Slave reports as Attached */ -if (!rt715->first_init) { +if (!rt715->first_hw_init) {/* set autosuspend parameters */ pm_runtime_set_autosuspend_delay (&slave->dev,3000 );pm_runtime_use_autosuspend (&slave->dev);
@@ -1031,7 +1031,7 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)pm_runtime_enable (&slave->dev); - rt715->first_init = true; + rt715->first_hw_init = true; }pm_runtime_get_noresume (&slave->dev);
sound/soc/codecs/rt715-sdca.h +1 -1
@@ -27,7 +27,7 @@ struct rt715_sdca_priv {enum sdw_slave_status status;struct sdw_bus_params params;bool hw_init; -bool first_init; +bool first_hw_init;int l_is_unmute;int r_is_unmute;int hw_sdw_ver;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 692/800 ASoC: rt715-sdw: use first_hw_init flag on resume
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit dbc07517ab173688ef11234d1099bc1e24e4f14b ]
The intent of the status check on resume was to verify if a SoundWire peripheral reported ATTACHED before waiting for the initialization to complete. This is required to avoid timeouts that will happen with 'ghost' devices that are exposed in the platform firmware but are not populated in hardware.
Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to another error, the resume operation never timed out, but the volume settings were not properly restored.
--- sound/soc/codecs/rt715-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/rt715-sdw.c +1 -1
@@ -541,7 +541,7 @@ static int __maybe_unused rt715_dev_resume(struct device *dev)struct rt715_priv *rt715 =dev_get_drvdata (dev);unsigned long time; -if (!rt715->hw_init) +if (!rt715->first_hw_init)return 0 ;if (!slave->unattach_request)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 693/800 ASoC: rt715-sdca: fix clock stop prepare timeout issue
In reply to Greg Kroah-HartmanFrom: Jack Yu <[email protected]>
[ Upstream commit e343d34a9c912fc5c321e2a9fbc02e9dc9534ade ]
Fix clock stop prepare timeout issue (#2853).
The trigger of internal circuit which belong to “SDCA preset stuffs” was not set correctly in previous driver, which could block clock_stop_preparation state.
Add the correct register setting to fix it.
--- sound/soc/codecs/rt715-sdca-sdw.c | 1 + sound/soc/codecs/rt715-sdca-sdw.h | 1 + sound/soc/codecs/rt715-sdca.c | 3 +++ sound/soc/codecs/rt715-sdca.h | 1 + 4 files changed, 6 insertions(+)
sound/soc/codecs/rt715-sdca-sdw.c +1 -0
@@ -70,6 +70,7 @@ static bool rt715_sdca_mbq_readable_register(struct device *dev, unsigned int recase 0x2000036 :case 0x2000037 :case 0x2000039 : +case 0x2000044 :case 0x6100000 :return true;default :
sound/soc/codecs/rt715-sdca-sdw.h +1 -0
@@ -113,6 +113,7 @@ static const struct reg_default rt715_mbq_reg_defaults_sdca[] = { { 0x2000036, 0x0000 }, { 0x2000037, 0x0000 }, { 0x2000039, 0xaa81 }, + { 0x2000044, 0x0202 }, { 0x6100000, 0x0100 }, { SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_FU_ADC8_9_VOL, RT715_SDCA_FU_VOL_CTRL, CH_01), 0x00 },
sound/soc/codecs/rt715-sdca.c +3 -0
@@ -1054,6 +1054,9 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)rt715_sdca_index_update_bits (rt715,RT715_VENDOR_REG ,RT715_REV_1 ,0x40 ,0x40 ); } +/* DFLL Calibration trigger */ +rt715_sdca_index_update_bits (rt715,RT715_VENDOR_REG , +RT715_DFLL_VAD ,0x1 ,0x1 );/* trigger mode = VAD enable */ regmap_write(rt715->regmap, SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_SMPU_TRIG_ST_EN,
sound/soc/codecs/rt715-sdca.h +1 -0
@@ -81,6 +81,7 @@ struct rt715_sdca_kcontrol_private {#define RT715_AD_FUNC_EN 0x36#define RT715_REV_1 0x37#define RT715_SDW_INPUT_SEL 0x39 +#define RT715_DFLL_VAD 0x44#define RT715_EXT_DMIC_CLK_CTRL2 0x54/* Index (NID:61h) */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 694/800 ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire
In reply to Greg Kroah-HartmanFrom: Oder Chiou <[email protected]>
[ Upstream commit 9266d95405ae0c078f188ec8bca3a004631be429 ]
The device checking error should be a jump to pm_runtime_put_autosuspend() as done before returning value.
--- sound/soc/codecs/rt5682-sdw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/codecs/rt5682-sdw.c +5 -2
@@ -408,9 +408,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)usleep_range (30000 ,30005 ); loop--; } +if (val !=DEVICE_ID ) {dev_err (dev,"Device with ID register %x is not rt5682\n" , val); -return -ENODEV ; + ret = -ENODEV ; + goto err_nodev; }if (rt5682->first_hw_init) {
@@ -486,10 +488,11 @@ reinit: rt5682->hw_init = true; rt5682->first_hw_init = true; +err_nodev:pm_runtime_mark_last_busy (&slave->dev);pm_runtime_put_autosuspend (&slave->dev); -dev_dbg (&slave->dev,"%s hw_init complete\n" , __func__); +dev_dbg (&slave->dev,"%s hw_init complete: %d\n" , __func__, ret);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 695/800 ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID
In reply to Greg Kroah-HartmanFrom: Bard Liao <[email protected]>
[ Upstream commit c0372bc873dd29f325ee908351e0bd5b08d4d608 ]
RT5682_DEVICE_ID is a volatile register, we can not read it in cache only mode.
--- sound/soc/codecs/rt5682-sdw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/rt5682-sdw.c +5 -5
@@ -400,6 +400,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)pm_runtime_get_noresume (&slave->dev); +if (rt5682->first_hw_init) { +regcache_cache_only (rt5682->regmap, false); +regcache_cache_bypass (rt5682->regmap, true); + } +while (loop >0 ) {regmap_read (rt5682->regmap,RT5682_DEVICE_ID , &val);if (val ==DEVICE_ID )
@@ -415,11 +420,6 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave) goto err_nodev; } -if (rt5682->first_hw_init) { -regcache_cache_only (rt5682->regmap, false); -regcache_cache_bypass (rt5682->regmap, true); - } -rt5682_calibrate (rt5682);if (rt5682->first_hw_init) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 696/800 ASoC: rt711-sdca-sdw: add readable for SDW_SDCA_CTL() registers
In reply to Greg Kroah-HartmanFrom: Bard Liao <[email protected]>
[ Upstream commit 5ad1ba99e4784929588c79e9810f5610825f0411 ]
SDW_SDCA_CTL() registers are used but are not set to readable.
--- sound/soc/codecs/rt711-sdca-sdw.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/soc/codecs/rt711-sdca-sdw.c +10 -0
@@ -75,6 +75,16 @@ static bool rt711_sdca_mbq_readable_register(struct device *dev, unsigned int re case 0x5b00000 ... 0x5b000ff: case 0x5f00000 ... 0x5f000ff: case 0x6100000 ... 0x61000ff: +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT711_SDCA_ENT_USER_FU05 ,RT711_SDCA_CTL_FU_VOLUME ,CH_L ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT711_SDCA_ENT_USER_FU05 ,RT711_SDCA_CTL_FU_VOLUME ,CH_R ): +case SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT711_SDCA_ENT_USER_FU1E ,RT711_SDCA_CTL_FU_VOLUME ,CH_L ): +case SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT711_SDCA_ENT_USER_FU1E ,RT711_SDCA_CTL_FU_VOLUME ,CH_R ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT711_SDCA_ENT_USER_FU0F ,RT711_SDCA_CTL_FU_VOLUME ,CH_L ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT711_SDCA_ENT_USER_FU0F ,RT711_SDCA_CTL_FU_VOLUME ,CH_R ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT711_SDCA_ENT_PLATFORM_FU44 ,RT711_SDCA_CTL_FU_CH_GAIN ,CH_L ): +case SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT711_SDCA_ENT_PLATFORM_FU44 ,RT711_SDCA_CTL_FU_CH_GAIN ,CH_R ): +case SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT711_SDCA_ENT_PLATFORM_FU15 ,RT711_SDCA_CTL_FU_CH_GAIN ,CH_L ): +case SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT711_SDCA_ENT_PLATFORM_FU15 ,RT711_SDCA_CTL_FU_CH_GAIN ,CH_R ):return true;default :return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 697/800 ASoC: rt711-sdca: handle mbq_regmap in rt711_sdca_io_init
In reply to Greg Kroah-HartmanFrom: Bard Liao <[email protected]>
[ Upstream commit bcc0f0c078771e983a7e602eb14efa02f811445f ]
We currently only hangle rt711->regmap in rt711_sdca_io_init(), and rt711->mbq_regmap is missing.
--- sound/soc/codecs/rt711-sdca.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/codecs/rt711-sdca.c +4 -0
@@ -1500,6 +1500,8 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave)if (rt711->first_hw_init) {regcache_cache_only (rt711->regmap, false);regcache_cache_bypass (rt711->regmap, true); +regcache_cache_only (rt711->mbq_regmap, false); +regcache_cache_bypass (rt711->mbq_regmap, true); }else {/* * PM runtime is only enabled when a Slave reports as Attached
@@ -1565,6 +1567,8 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave)if (rt711->first_hw_init) {regcache_cache_bypass (rt711->regmap, false);regcache_mark_dirty (rt711->regmap); +regcache_cache_bypass (rt711->mbq_regmap, false); +regcache_mark_dirty (rt711->mbq_regmap); }else rt711->first_hw_init = true;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 698/800 ASoC: mediatek: mtk-btcvsd: Fix an error handling path in mtk_btcvsd_snd_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit b6052c3c7a78f5e2b9756c92ef77c0b56435f107 ]
If an error occurs after a successful 'of_iomap()' call, it must be undone by a corresponding 'iounmap()' call, as already done in the remove function.
While at it, remove the useless initialization of 'ret' at the beginning of the function.
--- sound/soc/mediatek/common/mtk-btcvsd.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
sound/soc/mediatek/common/mtk-btcvsd.c +18 -6
@@ -1281,7 +1281,7 @@ static const struct snd_soc_component_driver mtk_btcvsd_snd_platform = {static int mtk_btcvsd_snd_probe (struct platform_device *pdev) { -int ret =0 ; +int ret;int irq_id;u32 offset[5 ] = {0 ,0 ,0 ,0 ,0 };struct mtk_btcvsd_snd *btcvsd;
@@ -1337,7 +1337,8 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev) btcvsd->bt_sram_bank2_base =of_iomap (dev->of_node,1 );if (!btcvsd->bt_sram_bank2_base) {dev_err (dev,"iomap bt_sram_bank2_base fail\n" ); -return -EIO ; + ret = -EIO ; + goto unmap_pkv_err; } btcvsd->infra = syscon_regmap_lookup_by_phandle(dev->of_node,
@@ -1345,7 +1346,8 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev)if (IS_ERR (btcvsd->infra)) {dev_err (dev,"cannot find infra controller: %ld\n" ,PTR_ERR (btcvsd->infra)); -return PTR_ERR (btcvsd->infra); + ret =PTR_ERR (btcvsd->infra); + goto unmap_bank2_err; }/* get offset */
@@ -1354,7 +1356,7 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev) ARRAY_SIZE(offset));if (ret) {dev_warn (dev,"%s(), get offset fail, ret %d\n" , __func__, ret); -return ret; + goto unmap_bank2_err; } btcvsd->infra_misc_offset = offset[0 ]; btcvsd->conn_bt_cvsd_mask = offset[1 ];
@@ -1373,8 +1375,18 @@ static int mtk_btcvsd_snd_probe(struct platform_device *pdev)mtk_btcvsd_snd_set_state (btcvsd, btcvsd->tx,BT_SCO_STATE_IDLE );mtk_btcvsd_snd_set_state (btcvsd, btcvsd->rx,BT_SCO_STATE_IDLE ); -return devm_snd_soc_register_component (dev, &mtk_btcvsd_snd_platform, -NULL ,0 ); + ret =devm_snd_soc_register_component (dev, &mtk_btcvsd_snd_platform, +NULL ,0 ); +if (ret) + goto unmap_bank2_err; + +return 0 ; + +unmap_bank2_err: +iounmap (btcvsd->bt_sram_bank2_base); +unmap_pkv_err: +iounmap (btcvsd->bt_pkv_base); +return ret; }static int mtk_btcvsd_snd_remove (struct platform_device *pdev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 699/800 usb: gadget: f_fs: Fix setting of device and driver data cross-references
In reply to Greg Kroah-HartmanFrom: Andrew Gabbasov <[email protected]>
[ Upstream commit ecfbd7b9054bddb12cea07fda41bb3a79a7b0149 ]
FunctionFS device structure 'struct ffs_dev' and driver data structure 'struct ffs_data' are bound to each other with cross-reference pointers 'ffs_data->private_data' and 'ffs_dev->ffs_data'. While the first one is supposed to be valid through the whole life of 'struct ffs_data' (and while 'struct ffs_dev' exists non-freed), the second one is cleared in 'ffs_closed()' (called from 'ffs_data_reset()' or the last 'ffs_data_put()'). This can be called several times, alternating in different order with 'ffs_free_inst()', that, if possible, clears the other cross-reference.
As a result, different cases of these calls order may leave stale cross-reference pointers, used when the pointed structure is already freed. Even if it occasionally doesn't cause kernel crash, this error is reported by KASAN-enabled kernel configuration.
For example, the case [last 'ffs_data_put()' - 'ffs_free_inst()'] was fixed by commit cdafb6d8b8da ("usb: gadget: f_fs: Fix use-after-free in ffs_free_inst").
The other case ['ffs_data_reset()' - 'ffs_free_inst()' - 'ffs_data_put()'] now causes KASAN reported error [1], when 'ffs_data_reset()' clears 'ffs_dev->ffs_data', then 'ffs_free_inst()' frees the 'struct ffs_dev', but can't clear 'ffs_data->private_data', which is then accessed in 'ffs_closed()' called from 'ffs_data_put()'. This happens since 'ffs_dev->ffs_data' reference is cleared too early.
Moreover, one more use case, when 'ffs_free_inst()' is called immediately after mounting FunctionFS device (that is before the descriptors are written and 'ffs_ready()' is called), and then 'ffs_data_reset()' or 'ffs_data_put()' is called from accessing "ep0" file or unmounting the device. This causes KASAN error report like [2], since 'ffs_dev->ffs_data' is not yet set when 'ffs_free_inst()' can't properly clear 'ffs_data->private_data', that is later accessed to freed structure.
Fix these (and may be other) cases of stale pointers access by moving setting and clearing of the mentioned cross-references to the single places, setting both of them when 'struct ffs_data' is created and bound to 'struct ffs_dev', and clearing both of them when one of the structures is destroyed. It seems convenient to make this pointer initialization and structures binding in 'ffs_acquire_dev()' and make pointers clearing in 'ffs_release_dev()'. This required some changes in these functions parameters and return types.
Also, 'ffs_release_dev()' calling requires some cleanup, fixing minor issues, like (1) 'ffs_release_dev()' is not called if 'ffs_free_inst()' is called without unmounting the device, and "release_dev" callback is not called at all, or (2) "release_dev" callback is called before "ffs_closed" callback on unmounting, which seems to be not correctly nested with "acquire_dev" and "ffs_ready" callbacks.
Make this cleanup togther with other mentioned 'ffs_release_dev()' changes.
[1]
==================================================================
root@rcar-gen3:~# mkdir /dev/cfs root@rcar-gen3:~# mkdir /dev/ffs root@rcar-gen3:~# modprobe libcomposite root@rcar-gen3:~# mount -t configfs none /dev/cfs root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1 root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs [ 64.340664] file system registered root@rcar-gen3:~# mount -t functionfs ffs /dev/ffs root@rcar-gen3:~# cd /dev/ffs root@rcar-gen3:/dev/ffs# /home/root/ffs-test ffs-test: info: ep0: writing descriptors (in v2 format) [ 83.181442] read descriptors [ 83.186085] read strings ffs-test: info: ep0: writing strings ffs-test: dbg: ep1: starting ffs-test: dbg: ep2: starting ffs-test: info: ep1: starts ffs-test: info: ep2: starts ffs-test: info: ep0: starts
^C
root@rcar-gen3:/dev/ffs# cd /home/root/ root@rcar-gen3:~# rmdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs [ 98.935061] unloading root@rcar-gen3:~# umount /dev/ffs [ 102.734301] ================================================================== [ 102.742059] BUG: KASAN: use-after-free in ffs_release_dev+0x64/0xa8 [usb_f_fs] [ 102.749683] Write of size 1 at addr ffff0004d46ff549 by task umount/2997 [ 102.756709] [ 102.758311] CPU: 0 PID: 2997 Comm: umount Not tainted 5.13.0-rc4+ #8 [ 102.764971] Hardware name: Renesas Salvator-X board based on r8a77951 (DT) [ 102.772179] Call trace: [ 102.774779] dump_backtrace+0x0/0x330 [ 102.778653] show_stack+0x20/0x2c [ 102.782152] dump_stack+0x11c/0x1ac [ 102.785833] print_address_description.constprop.0+0x30/0x274 [ 102.791862] kasan_report+0x14c/0x1c8 [ 102.795719] __asan_report_store1_noabort+0x34/0x58 [ 102.800840] ffs_release_dev+0x64/0xa8 [usb_f_fs] [ 102.805801] ffs_fs_kill_sb+0x50/0x84 [usb_f_fs] [ 102.810663] deactivate_locked_super+0xa0/0xf0 [ 102.815339] deactivate_super+0x98/0xac [ 102.819378] cleanup_mnt+0xd0/0x1b0 [ 102.823057] __cleanup_mnt+0x1c/0x28 [ 102.826823] task_work_run+0x104/0x180 [ 102.830774] do_notify_resume+0x458/0x14e0 [ 102.835083] work_pending+0xc/0x5f8 [ 102.838762] [ 102.840357] Allocated by task 2988: [ 102.844032] kasan_save_stack+0x28/0x58 [ 102.848071] kasan_set_track+0x28/0x3c [ 102.852016] ____kasan_kmalloc+0x84/0x9c [ 102.856142] __kasan_kmalloc+0x10/0x1c [ 102.860088] __kmalloc+0x214/0x2f8 [ 102.863678] kzalloc.constprop.0+0x14/0x20 [usb_f_fs] [ 102.868990] ffs_alloc_inst+0x8c/0x208 [usb_f_fs] [ 102.873942] try_get_usb_function_instance+0xf0/0x164 [libcomposite] [ 102.880629] usb_get_function_instance+0x64/0x68 [libcomposite] [ 102.886858] function_make+0x128/0x1ec [libcomposite] [ 102.892185] configfs_mkdir+0x330/0x590 [configfs] [ 102.897245] vfs_mkdir+0x12c/0x1bc [ 102.900835] do_mkdirat+0x180/0x1d0 [ 102.904513] __arm64_sys_mkdirat+0x80/0x94 [ 102.908822] invoke_syscall+0xf8/0x25c [ 102.912772] el0_svc_common.constprop.0+0x150/0x1a0 [ 102.917891] do_el0_svc+0xa0/0xd4 [ 102.921386] el0_svc+0x24/0x34 [ 102.924613] el0_sync_handler+0xcc/0x154 [ 102.928743] el0_sync+0x198/0x1c0 [ 102.932238] [ 102.933832] Freed by task 2996: [ 102.937144] kasan_save_stack+0x28/0x58 [ 102.941181] kasan_set_track+0x28/0x3c [ 102.945128] kasan_set_free_info+0x28/0x4c [ 102.949435] ____kasan_slab_free+0x104/0x118 [ 102.953921] __kasan_slab_free+0x18/0x24 [ 102.958047] slab_free_freelist_hook+0x148/0x1f0 [ 102.962897] kfree+0x318/0x440 [ 102.966123] ffs_free_inst+0x164/0x2d8 [usb_f_fs] [ 102.971075] usb_put_function_instance+0x84/0xa4 [libcomposite] [ 102.977302] ffs_attr_release+0x18/0x24 [usb_f_fs] [ 102.982344] config_item_put+0x140/0x1a4 [configfs] [ 102.987486] configfs_rmdir+0x3fc/0x518 [configfs] [ 102.992535] vfs_rmdir+0x114/0x234 [ 102.996122] do_rmdir+0x274/0x2b0 [ 102.999617] __arm64_sys_unlinkat+0x94/0xc8 [ 103.004015] invoke_syscall+0xf8/0x25c [ 103.007961] el0_svc_common.constprop.0+0x150/0x1a0 [ 103.013080] do_el0_svc+0xa0/0xd4 [ 103.016575] el0_svc+0x24/0x34 [ 103.019801] el0_sync_handler+0xcc/0x154 [ 103.023930] el0_sync+0x198/0x1c0 [ 103.027426] [ 103.029020] The buggy address belongs to the object at ffff0004d46ff500 [ 103.029020] which belongs to the cache kmalloc-128 of size 128 [ 103.042079] The buggy address is located 73 bytes inside of [ 103.042079] 128-byte region [ffff0004d46ff500, ffff0004d46ff580) [ 103.054236] The buggy address belongs to the page: [ 103.059262] page:0000000021aa849b refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0004d46fee00 pfn:0x5146fe [ 103.070437] head:0000000021aa849b order:1 compound_mapcount:0 [ 103.076456] flags: 0x8000000000010200(slab|head|zone=2) [ 103.081948] raw: 8000000000010200 fffffc0013521a80 0000000d0000000d ffff0004c0002300 [ 103.090052] raw: ffff0004d46fee00 000000008020001e 00000001ffffffff 0000000000000000 [ 103.098150] page dumped because: kasan: bad access detected [ 103.103985] [ 103.105578] Memory state around the buggy address: [ 103.110602] ffff0004d46ff400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 103.118161] ffff0004d46ff480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 103.125726] >ffff0004d46ff500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 103.133284] ^ [ 103.139120] ffff0004d46ff580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 103.146679] ffff0004d46ff600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 103.154238] ================================================================== [ 103.161792] Disabling lock debugging due to kernel taint [ 103.167319] Unable to handle kernel paging request at virtual address 0037801d6000018e [ 103.175406] Mem abort info: [ 103.178457] ESR = 0x96000004 [ 103.181609] EC = 0x25: DABT (current EL), IL = 32 bits [ 103.187020] SET = 0, FnV = 0 [ 103.190185] EA = 0, S1PTW = 0 [ 103.193417] Data abort info: [ 103.196385] ISV = 0, ISS = 0x00000004 [ 103.200315] CM = 0, WnR = 0 [ 103.203366] [0037801d6000018e] address between user and kernel address ranges [ 103.210611] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 103.216231] Modules linked in: usb_f_fs libcomposite configfs ath9k_htc led_class mac80211 libarc4 ath9k_common ath9k_hw ath cfg80211 aes_ce_blk sata_rc4 [ 103.259233] CPU: 0 PID: 2997 Comm: umount Tainted: G B 5.13.0-rc4+ #8 [ 103.267031] Hardware name: Renesas Salvator-X board based on r8a77951 (DT) [ 103.273951] pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--) [ 103.280001] pc : ffs_data_clear+0x138/0x370 [usb_f_fs] [ 103.285197] lr : ffs_data_clear+0x124/0x370 [usb_f_fs] [ 103.290385] sp : ffff800014777a80 [ 103.293725] x29: ffff800014777a80 x28: ffff0004d7649c80 x27: 0000000000000000 [ 103.300931] x26: ffff800014777fb0 x25: ffff60009aec9394 x24: ffff0004d7649ca4 [ 103.308136] x23: 1fffe0009a3d063a x22: dfff800000000000 x21: ffff0004d1e831d0 [ 103.315340] x20: e1c000eb00000bb4 x19: ffff0004d1e83000 x18: 0000000000000000 [ 103.322545] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 103.329748] x14: 0720072007200720 x13: 0720072007200720 x12: 1ffff000012ef658 [ 103.336952] x11: ffff7000012ef658 x10: 0720072007200720 x9 : ffff800011322648 [ 103.344157] x8 : ffff800014777818 x7 : ffff80000977b2c7 x6 : 0000000000000000 [ 103.351359] x5 : 0000000000000001 x4 : ffff7000012ef659 x3 : 0000000000000001 [ 103.358562] x2 : 0000000000000000 x1 : 1c38001d6000018e x0 : e1c000eb00000c70 [ 103.365766] Call trace: [ 103.368235] ffs_data_clear+0x138/0x370 [usb_f_fs] [ 103.373076] ffs_data_reset+0x20/0x304 [usb_f_fs] [ 103.377829] ffs_data_closed+0x1ec/0x244 [usb_f_fs] [ 103.382755] ffs_fs_kill_sb+0x70/0x84 [usb_f_fs] [ 103.387420] deactivate_locked_super+0xa0/0xf0 [ 103.391905] deactivate_super+0x98/0xac [ 103.395776] cleanup_mnt+0xd0/0x1b0 [ 103.399299] __cleanup_mnt+0x1c/0x28 [ 103.402906] task_work_run+0x104/0x180 [ 103.406691] do_notify_resume+0x458/0x14e0 [ 103.410823] work_pending+0xc/0x5f8 [ 103.414351] Code: b4000a54 9102f280 12000802 d343fc01 (38f66821) [ 103.420490] ---[ end trace 57b43a50e8244f57 ]--- Segmentation fault root@rcar-gen3:~# ==================================================================
[2]
==================================================================
root@rcar-gen3:~# mkdir /dev/ffs root@rcar-gen3:~# modprobe libcomposite root@rcar-gen3:~# root@rcar-gen3:~# mount -t configfs none /dev/cfs root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1 root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs [ 54.766480] file system registered root@rcar-gen3:~# mount -t functionfs ffs /dev/ffs root@rcar-gen3:~# rmdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs [ 63.197597] unloading root@rcar-gen3:~# cat /dev/ffs/ep0 cat: read error:[ 67.213506] ================================================================== [ 67.222095] BUG: KASAN: use-after-free in ffs_data_clear+0x70/0x370 [usb_f_fs] [ 67.229699] Write of size 1 at addr ffff0004c26e974a by task cat/2994 [ 67.236446] [ 67.238045] CPU: 0 PID: 2994 Comm: cat Not tainted 5.13.0-rc4+ #8 [ 67.244431] Hardware name: Renesas Salvator-X board based on r8a77951 (DT) [ 67.251624] Call trace: [ 67.254212] dump_backtrace+0x0/0x330 [ 67.258081] show_stack+0x20/0x2c [ 67.261579] dump_stack+0x11c/0x1ac [ 67.265260] print_address_description.constprop.0+0x30/0x274 [ 67.271286] kasan_report+0x14c/0x1c8 [ 67.275143] __asan_report_store1_noabort+0x34/0x58 [ 67.280265] ffs_data_clear+0x70/0x370 [usb_f_fs] [ 67.285220] ffs_data_reset+0x20/0x304 [usb_f_fs] [ 67.290172] ffs_data_closed+0x240/0x244 [usb_f_fs] [ 67.295305] ffs_ep0_release+0x40/0x54 [usb_f_fs] [ 67.300256] __fput+0x304/0x580 [ 67.303576] ____fput+0x18/0x24 [ 67.306893] task_work_run+0x104/0x180 [ 67.310846] do_notify_resume+0x458/0x14e0 [ 67.315154] work_pending+0xc/0x5f8 [ 67.318834] [ 67.320429] Allocated by task 2988: [ 67.324105] kasan_save_stack+0x28/0x58 [ 67.328144] kasan_set_track+0x28/0x3c [ 67.332090] ____kasan_kmalloc+0x84/0x9c [ 67.336217] __kasan_kmalloc+0x10/0x1c [ 67.340163] __kmalloc+0x214/0x2f8 [ 67.343754] kzalloc.constprop.0+0x14/0x20 [usb_f_fs] [ 67.349066] ffs_alloc_inst+0x8c/0x208 [usb_f_fs] [ 67.354017] try_get_usb_function_instance+0xf0/0x164 [libcomposite] [ 67.360705] usb_get_function_instance+0x64/0x68 [libcomposite] [ 67.366934] function_make+0x128/0x1ec [libcomposite] [ 67.372260] configfs_mkdir+0x330/0x590 [configfs] [ 67.377320] vfs_mkdir+0x12c/0x1bc [ 67.380911] do_mkdirat+0x180/0x1d0 [ 67.384589] __arm64_sys_mkdirat+0x80/0x94 [ 67.388899] invoke_syscall+0xf8/0x25c [ 67.392850] el0_svc_common.constprop.0+0x150/0x1a0 [ 67.397969] do_el0_svc+0xa0/0xd4 [ 67.401464] el0_svc+0x24/0x34 [ 67.404691] el0_sync_handler+0xcc/0x154 [ 67.408819] el0_sync+0x198/0x1c0 [ 67.412315] [ 67.413909] Freed by task 2993: [ 67.417220] kasan_save_stack+0x28/0x58 [ 67.421257] kasan_set_track+0x28/0x3c [ 67.425204] kasan_set_free_info+0x28/0x4c [ 67.429513] ____kasan_slab_free+0x104/0x118 [ 67.434001] __kasan_slab_free+0x18/0x24 [ 67.438128] slab_free_freelist_hook+0x148/0x1f0 [ 67.442978] kfree+0x318/0x440 [ 67.446205] ffs_free_inst+0x164/0x2d8 [usb_f_fs] [ 67.451156] usb_put_function_instance+0x84/0xa4 [libcomposite] [ 67.457385] ffs_attr_release+0x18/0x24 [usb_f_fs] [ 67.462428] config_item_put+0x140/0x1a4 [configfs] [ 67.467570] configfs_rmdir+0x3fc/0x518 [configfs] [ 67.472626] vfs_rmdir+0x114/0x234 [ 67.476215] do_rmdir+0x274/0x2b0 [ 67.479710] __arm64_sys_unlinkat+0x94/0xc8 [ 67.484108] invoke_syscall+0xf8/0x25c [ 67.488055] el0_svc_common.constprop.0+0x150/0x1a0 [ 67.493175] do_el0_svc+0xa0/0xd4 [ 67.496671] el0_svc+0x24/0x34 [ 67.499896] el0_sync_handler+0xcc/0x154 [ 67.504024] el0_sync+0x198/0x1c0 [ 67.507520] [ 67.509114] The buggy address belongs to the object at ffff0004c26e9700 [ 67.509114] which belongs to the cache kmalloc-128 of size 128 [ 67.522171] The buggy address is located 74 bytes inside of [ 67.522171] 128-byte region [ffff0004c26e9700, ffff0004c26e9780) [ 67.534328] The buggy address belongs to the page: [ 67.539355] page:000000003177a217 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5026e8 [ 67.549175] head:000000003177a217 order:1 compound_mapcount:0 [ 67.555195] flags: 0x8000000000010200(slab|head|zone=2) [ 67.560687] raw: 8000000000010200 fffffc0013037100 0000000c00000002 ffff0004c0002300 [ 67.568791] raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 [ 67.576890] page dumped because: kasan: bad access detected [ 67.582725] [ 67.584318] Memory state around the buggy address: [ 67.589343] ffff0004c26e9600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 67.596903] ffff0004c26e9680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 67.604463] >ffff0004c26e9700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 67.612022] ^ [ 67.617860] ffff0004c26e9780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 67.625421] ffff0004c26e9800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 67.632981] ================================================================== [ 67.640535] Disabling lock debugging due to kernel taint File descriptor[ 67.646100] Unable to handle kernel paging request at virtual address fabb801d4000018d in bad state [ 67.655456] Mem abort info: [ 67.659619] ESR = 0x96000004 [ 67.662801] EC = 0x25: DABT (current EL), IL = 32 bits [ 67.668225] SET = 0, FnV = 0 [ 67.671375] EA = 0, S1PTW = 0 [ 67.674613] Data abort info: [ 67.677587] ISV = 0, ISS = 0x00000004 [ 67.681522] CM = 0, WnR = 0 [ 67.684588] [fabb801d4000018d] address between user and kernel address ranges [ 67.691849] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 67.697470] Modules linked in: usb_f_fs libcomposite configfs ath9k_htc led_class mac80211 libarc4 ath9k_common ath9k_hw ath cfg80211 aes_ce_blk crypto_simd cryptd aes_ce_cipher ghash_ce gf128mul sha2_ce sha1_ce evdev sata_rcar libata xhci_plat_hcd scsi_mod xhci_hcd rene4 [ 67.740467] CPU: 0 PID: 2994 Comm: cat Tainted: G B 5.13.0-rc4+ #8 [ 67.748005] Hardware name: Renesas Salvator-X board based on r8a77951 (DT) [ 67.754924] pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--) [ 67.760974] pc : ffs_data_clear+0x138/0x370 [usb_f_fs] [ 67.766178] lr : ffs_data_clear+0x124/0x370 [usb_f_fs] [ 67.771365] sp : ffff800014767ad0 [ 67.774706] x29: ffff800014767ad0 x28: ffff800009cf91c0 x27: ffff0004c54861a0 [ 67.781913] x26: ffff0004dc90b288 x25: 1fffe00099ec10f5 x24: 00000000000a801d [ 67.789118] x23: 1fffe00099f6953a x22: dfff800000000000 x21: ffff0004cfb4a9d0 [ 67.796322] x20: d5e000ea00000bb1 x19: ffff0004cfb4a800 x18: 0000000000000000 [ 67.803526] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 67.810730] x14: 0720072007200720 x13: 0720072007200720 x12: 1ffff000028ecefa [ 67.817934] x11: ffff7000028ecefa x10: 0720072007200720 x9 : ffff80001132c014 [ 67.825137] x8 : ffff8000147677d8 x7 : ffff8000147677d7 x6 : 0000000000000000 [ 67.832341] x5 : 0000000000000001 x4 : ffff7000028ecefb x3 : 0000000000000001 [ 67.839544] x2 : 0000000000000005 x1 : 1abc001d4000018d x0 : d5e000ea00000c6d [ 67.846748] Call trace: [ 67.849218] ffs_data_clear+0x138/0x370 [usb_f_fs] [ 67.854058] ffs_data_reset+0x20/0x304 [usb_f_fs] [ 67.858810] ffs_data_closed+0x240/0x244 [usb_f_fs] [ 67.863736] ffs_ep0_release+0x40/0x54 [usb_f_fs] [ 67.868488] __fput+0x304/0x580 [ 67.871665] ____fput+0x18/0x24 [ 67.874837] task_work_run+0x104/0x180 [ 67.878622] do_notify_resume+0x458/0x14e0 [ 67.882754] work_pending+0xc/0x5f8 [ 67.886282] Code: b4000a54 9102f280 12000802 d343fc01 (38f66821) [ 67.892422] ---[ end trace 6d7cedf53d7abbea ]--- Segmentation fault root@rcar-gen3:~# ==================================================================
--- drivers/usb/gadget/function/f_fs.c | 65 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 33 deletions(-)
drivers/usb/gadget/function/f_fs.c +32 -33
@@ -250,8 +250,8 @@ EXPORT_SYMBOL_GPL(ffs_lock);static struct ffs_dev *_ffs_find_dev (const char *name);static struct ffs_dev *_ffs_alloc_dev (void );static void _ffs_free_dev (struct ffs_dev *dev); -static void *ffs_acquire_dev (const char *dev_name); -static void ffs_release_dev (struct ffs_data *ffs_data); +static int ffs_acquire_dev (const char *dev_name,struct ffs_data *ffs_data); +static void ffs_release_dev (struct ffs_dev *ffs_dev);static int ffs_ready (struct ffs_data *ffs);static void ffs_closed (struct ffs_data *ffs);
@@ -1554,8 +1554,8 @@ unmapped_value:static int ffs_fs_get_tree (struct fs_context *fc) {struct ffs_sb_fill_data *ctx = fc->fs_private; -void *ffs_dev;struct ffs_data *ffs; +int ret;ENTER ();
@@ -1574,13 +1574,12 @@ static int ffs_fs_get_tree(struct fs_context *fc)return -ENOMEM ; } - ffs_dev =ffs_acquire_dev (ffs->dev_name); -if (IS_ERR (ffs_dev)) { + ret =ffs_acquire_dev (ffs->dev_name, ffs); +if (ret) {ffs_data_put (ffs); -return PTR_ERR (ffs_dev); +return ret; } - ffs->private_data = ffs_dev; ctx->ffs_data = ffs;return get_tree_nodev (fc, ffs_sb_fill); }
@@ -1591,7 +1590,6 @@ static void ffs_fs_free_fc(struct fs_context *fc)if (ctx) {if (ctx->ffs_data) { -ffs_release_dev (ctx->ffs_data);ffs_data_put (ctx->ffs_data); }
@@ -1630,10 +1628,8 @@ ffs_fs_kill_sb(struct super_block *sb)ENTER ();kill_litter_super (sb); -if (sb->s_fs_info) { -ffs_release_dev (sb->s_fs_info); +if (sb->s_fs_info)ffs_data_closed (sb->s_fs_info); - } }static struct file_system_type ffs_fs_type = {
@@ -1703,6 +1699,7 @@ static void ffs_data_put(struct ffs_data *ffs)if (refcount_dec_and_test (&ffs->ref)) {pr_info ("%s(): freeing\n" , __func__);ffs_data_clear (ffs); +ffs_release_dev (ffs->private_data);BUG_ON (waitqueue_active (&ffs->ev.waitq) ||swait_active (&ffs->ep0req_completion.wait) ||waitqueue_active (&ffs->wait));
@@ -3032,6 +3029,7 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f,struct ffs_function *func =ffs_func_from_usb (f);struct f_fs_opts *ffs_opts = container_of(f->fi, struct f_fs_opts, func_inst); +struct ffs_data *ffs_data;int ret;ENTER ();
@@ -3046,12 +3044,13 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f,if (!ffs_opts->no_configfs)ffs_dev_lock (); ret = ffs_opts->dev->desc_ready ?0 : -ENODEV ; - func->ffs = ffs_opts->dev->ffs_data; + ffs_data = ffs_opts->dev->ffs_data;if (!ffs_opts->no_configfs)ffs_dev_unlock ();if (ret)return ERR_PTR (ret); + func->ffs = ffs_data; func->conf = c; func->gadget = c->cdev->gadget;
@@ -3506,6 +3505,7 @@ static void ffs_free_inst(struct usb_function_instance *f)struct f_fs_opts *opts; opts =to_f_fs_opts (f); +ffs_release_dev (opts->dev);ffs_dev_lock ();_ffs_free_dev (opts->dev);ffs_dev_unlock ();
@@ -3693,47 +3693,48 @@ static void _ffs_free_dev(struct ffs_dev *dev) {list_del (&dev->entry); -/* Clear the private_data pointer to stop incorrect dev access */ -if (dev->ffs_data) - dev->ffs_data->private_data =NULL ; -kfree (dev);if (list_empty (&ffs_devices))functionfs_cleanup (); } -static void *ffs_acquire_dev (const char *dev_name) +static int ffs_acquire_dev (const char *dev_name,struct ffs_data *ffs_data) { +int ret =0 ;struct ffs_dev *ffs_dev;ENTER ();ffs_dev_lock (); ffs_dev =_ffs_find_dev (dev_name); -if (!ffs_dev) - ffs_dev =ERR_PTR (-ENOENT ); -else if (ffs_dev->mounted) - ffs_dev =ERR_PTR (-EBUSY ); -else if (ffs_dev->ffs_acquire_dev_callback && - ffs_dev->ffs_acquire_dev_callback (ffs_dev)) - ffs_dev =ERR_PTR (-ENOENT ); -else +if (!ffs_dev) { + ret = -ENOENT ; + }else if (ffs_dev->mounted) { + ret = -EBUSY ; + }else if (ffs_dev->ffs_acquire_dev_callback && + ffs_dev->ffs_acquire_dev_callback (ffs_dev)) { + ret = -ENOENT ; + }else { ffs_dev->mounted = true; + ffs_dev->ffs_data = ffs_data; + ffs_data->private_data = ffs_dev; + }ffs_dev_unlock (); -return ffs_dev; +return ret; } -static void ffs_release_dev (struct ffs_data *ffs_data) +static void ffs_release_dev (struct ffs_dev *ffs_dev) { -struct ffs_dev *ffs_dev; -ENTER ();ffs_dev_lock (); - ffs_dev = ffs_data->private_data; -if (ffs_dev) { +if (ffs_dev && ffs_dev->mounted) { ffs_dev->mounted = false; +if (ffs_dev->ffs_data) { + ffs_dev->ffs_data->private_data =NULL ; + ffs_dev->ffs_data =NULL ; + }if (ffs_dev->ffs_release_dev_callback) ffs_dev->ffs_release_dev_callback (ffs_dev);
@@ -3761,7 +3762,6 @@ static int ffs_ready(struct ffs_data *ffs) } ffs_obj->desc_ready = true; - ffs_obj->ffs_data = ffs;if (ffs_obj->ffs_ready_callback) { ret = ffs_obj->ffs_ready_callback (ffs);
@@ -3789,7 +3789,6 @@ static void ffs_closed(struct ffs_data *ffs) goto done; ffs_obj->desc_ready = false; - ffs_obj->ffs_data =NULL ;if (test_and_clear_bit (FFS_FL_CALL_CLOSED_CALLBACK , &ffs->flags) && ffs_obj->ffs_closed_callback)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 700/800 usb: dwc2: Dont reset the core after setting turnaround time
In reply to Greg Kroah-HartmanFrom: Clément Lassieur <[email protected]>
[ Upstream commit aafe93516b8567ab5864e1f4cd3eeabc54fb0e5a ]
Every time the hub signals a reset while we (device) are hsotg->connected, dwc2_hsotg_core_init_disconnected() is called, which in turn calls dwc2_hs_phy_init().
GUSBCFG.USBTrdTim is cleared upon Core Soft Reset, so if hsotg->params.phy_utmi_width is 8-bit, the value of GUSBCFG.USBTrdTim (the default one: 0x5, corresponding to 16-bit) is always different from hsotg->params.phy_utmi_width, thus dwc2_core_reset() is called every time (usbcfg != usbcfg_old), which causes 2 issues:
1) The call to dwc2_core_reset() does another reset 300us after the initial Chirp K of the first reset (which should last at least Tuch = 1ms), and messes up the High-speed Detection Handshake: both hub and device drive current into the D+ and D- lines at the same time.
2) GUSBCFG.USBTrdTim is cleared by the second reset, so its value is always the default one (0x5).
Setting GUSBCFG.USBTrdTim after the potential call to dwc2_core_reset() fixes both issues. It is now set even when select_phy is false because the cost of the Core Soft Reset is removed.
--- drivers/usb/dwc2/core.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/usb/dwc2/core.c +21 -9
@@ -1111,15 +1111,6 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) usbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL |GUSBCFG_PHYIF16 );if (hsotg->params.phy_utmi_width ==16 ) usbcfg |=GUSBCFG_PHYIF16 ; - -/* Set turnaround time */ -if (dwc2_is_device_mode (hsotg)) { - usbcfg &= ~GUSBCFG_USBTRDTIM_MASK ; -if (hsotg->params.phy_utmi_width ==16 ) - usbcfg |=5 <<GUSBCFG_USBTRDTIM_SHIFT ; -else - usbcfg |=9 <<GUSBCFG_USBTRDTIM_SHIFT ; - }break ;default :dev_err (hsotg->dev,"FS PHY selected at HS!\n" );
@@ -1141,6 +1132,24 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)return retval; } +static void dwc2_set_turnaround_time (struct dwc2_hsotg *hsotg) +{ +u32 usbcfg; + +if (hsotg->params.phy_type !=DWC2_PHY_TYPE_PARAM_UTMI ) +return ; + + usbcfg =dwc2_readl (hsotg,GUSBCFG ); + + usbcfg &= ~GUSBCFG_USBTRDTIM_MASK ; +if (hsotg->params.phy_utmi_width ==16 ) + usbcfg |=5 <<GUSBCFG_USBTRDTIM_SHIFT ; +else + usbcfg |=9 <<GUSBCFG_USBTRDTIM_SHIFT ; + +dwc2_writel (hsotg, usbcfg,GUSBCFG ); +} +int dwc2_phy_init (struct dwc2_hsotg *hsotg,bool select_phy) {u32 usbcfg;
@@ -1158,6 +1167,9 @@ int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) retval =dwc2_hs_phy_init (hsotg, select_phy);if (retval)return retval; + +if (dwc2_is_device_mode (hsotg)) +dwc2_set_turnaround_time (hsotg); } if (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI &&
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 701/800 eeprom: idt_89hpesx: Put fwnode in matching case during ->probe()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 3f6ee1c095156a74ab2df605af13020f1ce3e600 ]
device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.
--- drivers/misc/eeprom/idt_89hpesx.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/eeprom/idt_89hpesx.c +1 -0
@@ -1161,6 +1161,7 @@ static void idt_get_fw_data(struct idt_89hpesx_dev *pdev)else /* if (!fwnode_property_read_bool(node, "read-only")) */ pdev->eero = false; +fwnode_handle_put (fwnode);dev_info (dev,"EEPROM of %d bytes found by 0x%x" , pdev->eesize, pdev->eeaddr); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 702/800 eeprom: idt_89hpesx: Restore printing the unsupported fwnode name
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit e0db3deea73ba418bf5dc21f5a4e32ca87d16dde ]
When iterating over child firmware nodes restore printing the name of ones that are not supported.
While at it, refactor loop body to clearly show that we stop at the first match.
--- drivers/misc/eeprom/idt_89hpesx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/misc/eeprom/idt_89hpesx.c +3 -4
@@ -1126,11 +1126,10 @@ static void idt_get_fw_data(struct idt_89hpesx_dev *pdev)device_for_each_child_node (dev, fwnode) { ee_id =idt_ee_match_id (fwnode); -if (!ee_id) { -dev_warn (dev,"Skip unsupported EEPROM device" ); -continue ; - }else +if (ee_id)break ; + +dev_warn (dev,"Skip unsupported EEPROM device %pfw\n" , fwnode); }/* If there is no fwnode EEPROM device, then set zero size */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 703/800 mtd: spi-nor: otp: fix access to security registers in 4 byte mode
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit b97b1a769849beb6b40b740817b06f1a50e1c589 ]
The security registers either take a 3 byte or a 4 byte address offset, depending on the address mode of the flash. Thus just leave the nor->addr_width as is.
--- drivers/mtd/spi-nor/otp.c | 2 -- 1 file changed, 2 deletions(-)
drivers/mtd/spi-nor/otp.c +0 -2
@@ -40,7 +40,6 @@ int spi_nor_otp_read_secr(struct spi_nor *nor, loff_t addr, size_t len, u8 *buf) rdesc = nor->dirmap.rdesc; nor->read_opcode =SPINOR_OP_RSECR ; - nor->addr_width =3 ; nor->read_dummy =8 ; nor->read_proto =SNOR_PROTO_1_1_1 ; nor->dirmap.rdesc =NULL ;
@@ -84,7 +83,6 @@ int spi_nor_otp_write_secr(struct spi_nor *nor, loff_t addr, size_t len, wdesc = nor->dirmap.wdesc; nor->program_opcode =SPINOR_OP_PSECR ; - nor->addr_width =3 ; nor->write_proto =SNOR_PROTO_1_1_1 ; nor->dirmap.wdesc =NULL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 704/800 mtd: spi-nor: otp: return -EROFS if region is read-only
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 388161ca45c911f566b71716bce5ff0119fb5522 ]
SPI NOR flashes will just ignore program commands if the OTP region is locked. Thus, a user might not notice that the intended write didn't end up in the flash. Return -EROFS to the user in this case. From what I can tell, chips/cfi_cmdset_0001.c also return this error code.
One could optimize spi_nor_mtd_otp_range_is_locked() to read the status register only once and not for every OTP region, but for that we would need some more invasive changes. Given that this is one-time-programmable memory and the normal access mode is reading, we just live with the small overhead.
By moving the code around a bit, we can just check the length before calling spi_nor_mtd_otp_range_is_locked() and avoid an underflow there if a len is 0. This way we don't need to take the lock either. We also skip the "*retlen = 0" assignment, mtdcore already takes care of that for us.
--- drivers/mtd/spi-nor/otp.c | 41 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-)
drivers/mtd/spi-nor/otp.c +38 -3
@@ -238,6 +238,29 @@ out:return ret; } +static int spi_nor_mtd_otp_range_is_locked (struct spi_nor *nor,loff_t ofs, +size_t len) +{ +const struct spi_nor_otp_ops *ops = nor->params->otp.ops; +unsigned int region; +int locked; + +/* +* If any of the affected OTP regions are locked the entire range is +* considered locked. +*/ +for (region =spi_nor_otp_offset_to_region (nor, ofs); + region <=spi_nor_otp_offset_to_region (nor, ofs + len -1 ); + region++) { + locked = ops->is_locked (nor, region); +/* take the branch it is locked or in case of an error */ +if (locked) +return locked; + } + +return 0 ; +} +static int spi_nor_mtd_otp_read_write (struct mtd_info *mtd,loff_t ofs,size_t total_len,size_t *retlen,const u8 *buf,bool is_write)
@@ -253,14 +276,26 @@ static int spi_nor_mtd_otp_read_write(struct mtd_info *mtd, loff_t ofs,if (ofs <0 || ofs >=spi_nor_otp_size (nor))return 0 ; +/* don't access beyond the end */ + total_len =min_t (size_t, total_len,spi_nor_otp_size (nor) - ofs); + +if (!total_len) +return 0 ; + ret =spi_nor_lock_and_prep (nor);if (ret)return ret; -/* don't access beyond the end */ - total_len =min_t (size_t, total_len,spi_nor_otp_size (nor) - ofs); +if (is_write) { + ret =spi_nor_mtd_otp_range_is_locked (nor, ofs, total_len); +if (ret <0 ) { + goto out; + }else if (ret) { + ret = -EROFS ; + goto out; + } + } - *retlen =0 ;while (total_len) {/* * The OTP regions are mapped into a contiguous area starting
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 705/800 thunderbolt: Bond lanes only when dual_link_port != NULL in alloc_dev_default()
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
[ Upstream commit a0d36fa1065901f939b04587a09c65303a64ac88 ]
We should not dereference ->dual_link_port if it is NULL and lane bonding is requested. For this reason move lane bonding configuration happen inside the block where ->dual_link_port != NULL.
--- drivers/thunderbolt/test.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/thunderbolt/test.c +7 -7
@@ -260,14 +260,14 @@ static struct tb_switch *alloc_dev_default(struct kunit *test,if (port->dual_link_port && upstream_port->dual_link_port) { port->dual_link_port->remote = upstream_port->dual_link_port; upstream_port->dual_link_port->remote = port->dual_link_port; - } -if (bonded) { -/* Bonding is used */ - port->bonded = true; - port->dual_link_port->bonded = true; - upstream_port->bonded = true; - upstream_port->dual_link_port->bonded = true; +if (bonded) { +/* Bonding is used */ + port->bonded = true; + port->dual_link_port->bonded = true; + upstream_port->bonded = true; + upstream_port->dual_link_port->bonded = true; + } }return sw;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 706/800 mtd: spinand: Fix double counting of ECC stats
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
[ Upstream commit c93081b265735db2417f0964718516044d06b1a2 ]
In the raw NAND world, ECC engines increment ecc_stats and the final caller is responsible for returning -EBADMSG if the verification failed.
In the SPI-NAND world it was a bit different until now because there was only one possible ECC engine: the on-die one. Indeed, the spinand_mtd_read() call was incrementing the ecc_stats counters depending on the outcome of spinand_check_ecc_status() directly.
So now let's split the logic like this:
- spinand_check_ecc_status() is specific to the SPI-NAND on-die engine and is kept very simple: it just returns the ECC status (bonus point:
the content of this helper can be overloaded).
- spinand_ondie_ecc_finish_io_req() is the caller of spinand_check_ecc_status() and will increment the counters and eventually return -EBADMSG.
- spinand_mtd_read() is not tied to the on-die ECC implementation and should be able to handle results coming from other ECC engines: it has the responsibility of returning the maximum number of bitflips which happened during the entire operation as this is the only helper that is aware that several pages may be read in a row.
--- drivers/mtd/nand/spi/core.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/mtd/nand/spi/core.c +11 -6
@@ -290,6 +290,8 @@ static int spinand_ondie_ecc_finish_io_req(struct nand_device *nand, {struct spinand_ondie_ecc_conf *engine_conf = nand->ecc.ctx.priv;struct spinand_device *spinand =nand_to_spinand (nand); +struct mtd_info *mtd =spinand_to_mtd (spinand); +int ret;if (req->mode ==MTD_OPS_RAW )return 0 ;
@@ -299,7 +301,13 @@ static int spinand_ondie_ecc_finish_io_req(struct nand_device *nand,return 0 ;/* Finish a page write: check the status, report errors/bitflips */ -return spinand_check_ecc_status (spinand, engine_conf->status); + ret =spinand_check_ecc_status (spinand, engine_conf->status); +if (ret == -EBADMSG ) + mtd->ecc_stats.failed++; +else if (ret >0 ) + mtd->ecc_stats.corrected += ret; + +return ret; }static struct nand_ecc_engine_ops spinand_ondie_ecc_engine_ops = {
@@ -620,13 +628,10 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,if (ret <0 && ret != -EBADMSG )break ; -if (ret == -EBADMSG ) { +if (ret == -EBADMSG ) ecc_failed = true; - mtd->ecc_stats.failed++; - }else { - mtd->ecc_stats.corrected += ret; +else max_bitflips = max_t(unsigned int, max_bitflips, ret); - } ret =0 ; ops->retlen += iter.req.datalen;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 707/800 kunit: Fix result propagation for parameterised tests
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
[ Upstream commit 384426bd101cb3cd580b18de19d4891ec5ca5bf9 ]
When one parameter of a parameterised test failed, its failure would be propagated to the overall test, but not to the suite result (unless it was the last parameter).
This is because test_case->success was being reset to the test->success result after each parameter was used, so a failing test's result would be overwritten by a non-failing result. The overall test result was handled in a third variable, test_result, but this was discarded after the status line was printed.
Instead, just propagate the result after each parameter run.
--- lib/kunit/test.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
lib/kunit/test.c +3 -4
@@ -376,7 +376,7 @@ static void kunit_run_case_catch_errors(struct kunit_suite *suite, context.test_case = test_case;kunit_try_catch_run (try_catch, &context); - test_case->success = test->success; + test_case->success &= test->success; }int kunit_run_tests (struct kunit_suite *suite)
@@ -388,7 +388,7 @@ int kunit_run_tests(struct kunit_suite *suite)kunit_suite_for_each_test_case (suite, test_case) {struct kunit test = { .param_value =NULL , .param_index =0 }; -bool test_success = true; + test_case->success = true;if (test_case->generate_params) {/* Get initial param. */
@@ -398,7 +398,6 @@ int kunit_run_tests(struct kunit_suite *suite) do { kunit_run_case_catch_errors(suite, test_case, &test); - test_success &= test_case->success; if (test_case->generate_params) { if (param_desc[0] == '\0') {
@@ -420,7 +419,7 @@ int kunit_run_tests(struct kunit_suite *suite) } }while (test.param_value); -kunit_print_ok_not_ok (&test, true, test_success, +kunit_print_ok_not_ok (&test, true, test_case->success,kunit_test_case_num (suite, test_case), test_case->name); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 708/800 iio: dummy: Fix build error when CONFIG_IIO_TRIGGERED_BUFFER is not set
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 94588c1bf1c8701392e1dc105c670d0d2fc7676a ]
Gcc reports build error when CONFIG_IIO_TRIGGERED_BUFFER is not set:
riscv64-linux-gnu-ld: drivers/iio/dummy/iio_simple_dummy_buffer.o: in function `iio_simple_dummy_configure_buffer':
iio_simple_dummy_buffer.c:(.text+0x2b0): undefined reference to `iio_triggered_buffer_setup_ext'
riscv64-linux-gnu-ld: drivers/iio/dummy/iio_simple_dummy_buffer.o: in function `.L0 ':
iio_simple_dummy_buffer.c:(.text+0x2fc): undefined reference to `iio_triggered_buffer_cleanup'
Fix it by select IIO_TRIGGERED_BUFFER for config IIO_SIMPLE_DUMMY_BUFFER.
--- drivers/iio/dummy/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/dummy/Kconfig +1 -0
@@ -34,6 +34,7 @@ config IIO_SIMPLE_DUMMY_BUFFER select IIO_BUFFER select IIO_TRIGGER select IIO_KFIFO_BUF + select IIO_TRIGGERED_BUFFER help Add buffered data capture to the simple dummy driver.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 709/800 iio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 8f884758966259fa8c50c137ac6d4ce9bb7859db ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/adc/at91-sama5d2_adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/at91-sama5d2_adc.c +2 -1
@@ -403,7 +403,8 @@ struct at91_adc_state {struct at91_adc_dma dma_st;struct at91_adc_touch touch_st;struct iio_dev *indio_dev; -u16 buffer[AT91_BUFFER_MAX_HWORDS ]; +/* Ensure naturally aligned timestamp */ +u16 buffer[AT91_BUFFER_MAX_HWORDS ]__aligned(8) ;/* * lock to prevent concurrent 'single conversion' requests through * sysfs.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 710/800 iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit afe2a789fbf7acd1a05407fc7839cc08d23825e3 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/adc/hx711.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/hx711.c +2 -2
@@ -86,9 +86,9 @@ struct hx711_data {struct mutex lock;/* * triggered buffer -* 2x32-bit channel + 64-bit timestamp +* 2x32-bit channel + 64-bit naturally aligned timestamp */ -u32 buffer[4 ]; +u32 buffer[4 ]__aligned(8) ;/* * delay after a rising edge on SCK until the data is ready DOUT * this is dependent on the hx711 where the datasheet tells a
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 711/800 iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 6a6be221b8bd561b053f0701ec752a5ed9007f69 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Add a comment on why the buffer is the size it is as not immediately obvious.
Found during an audit of all calls of this function.
--- drivers/iio/adc/mxs-lradc-adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/mxs-lradc-adc.c +2 -1
@@ -115,7 +115,8 @@ struct mxs_lradc_adc {struct device *dev;void __iomem *base; -u32 buffer[10 ]; +/* Maximum of 8 channels + 8 byte ts */ +u32 buffer[10 ]__aligned(8) ;struct iio_trigger *trig;struct completion completion;spinlock_t lock;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 712/800 iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 61fa5dfa5f52806f5ce37a0ba5712c271eb22f98 ]
Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted.
--- drivers/iio/adc/ti-ads8688.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-ads8688.c +2 -1
@@ -383,7 +383,8 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) {struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev; -u16 buffer[ADS8688_MAX_CHANNELS +sizeof (s64)/sizeof (u16)]; +/* Ensure naturally aligned timestamp */ +u16 buffer[ADS8688_MAX_CHANNELS +sizeof (s64)/sizeof (u16)]__aligned(8) ;int i, j =0 ;for (i =0 ; i < indio_dev->masklength; i++) {
Signature · 1 line
2.30.2