5.14.19-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 235/849 ath11k: Change DMA_FROM_DEVICE to DMA_TO_DEVICE when map reinjected packets
In reply to Greg Kroah-HartmanFrom: Baochen Qiang <[email protected]>
[ Upstream commit 86a03dad0f5ad8182ed5fcf7bf3eec71cd96577c ]
For fragmented packets, ath11k reassembles each fragment as a normal packet and then reinjects it into HW ring. In this case, the DMA direction should be DMA_TO_DEVICE, not DMA_FROM_DEVICE, otherwise invalid payload will be reinjected to HW and then delivered to host. What is more, since arbitrary memory could be allocated to the frame, we don't know what kind of data is contained in the buffer reinjected. Thus, as a bad result, private info may be leaked.
Note that this issue is only found on Intel platform.
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +2 -2
@@ -3315,7 +3315,7 @@ static int ath11k_dp_rx_h_defrag_reo_reinject(struct ath11k *ar, struct dp_rx_ti paddr =dma_map_single (ab->dev, defrag_skb->data, defrag_skb->len +skb_tailroom (defrag_skb), -DMA_FROM_DEVICE ); +DMA_TO_DEVICE );if (dma_mapping_error (ab->dev, paddr))return -ENOMEM ;
@@ -3380,7 +3380,7 @@ err_free_idr:spin_unlock_bh (&rx_refill_ring->idr_lock); err_unmap_dma:dma_unmap_single (ab->dev, paddr, defrag_skb->len +skb_tailroom (defrag_skb), -DMA_FROM_DEVICE ); +DMA_TO_DEVICE );return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 241/849 media: stm32: Potential NULL pointer dereference in dcmi_irq_thread()
In reply to Greg Kroah-HartmanFrom: Dmitriy Ulitin <[email protected]>
[ Upstream commit 548fa43a58696450c15b8f5564e99589c5144664 ]
At the moment of enabling irq handling:
1922 ret = devm_request_threaded_irq(&pdev->dev, irq, dcmi_irq_callback,
1923 dcmi_irq_thread, IRQF_ONESHOT,
1924 dev_name(&pdev->dev), dcmi);
there is still uninitialized field sd_format of struct stm32_dcmi *dcmi. If an interrupt occurs in the interval between the installation of the interrupt handler and the initialization of this field, NULL pointer dereference happens.
This field is dereferenced in the handler function without any check:
457 if (dcmi->sd_format->fourcc == V4L2_PIX_FMT_JPEG &&
458 dcmi->misr & IT_FRAME) {
The patch moves interrupt handler installation after initialization of the sd_format field that happens in dcmi_graph_notify_complete() via dcmi_set_default_fmt().
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/platform/stm32/stm32-dcmi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/media/platform/stm32/stm32-dcmi.c +11 -8
@@ -128,6 +128,7 @@ struct stm32_dcmi {int sequence;struct list_head buffers;struct dcmi_buf *active; +int irq;struct v4l2_device v4l2_dev;struct video_device *vdev;
@@ -1759,6 +1760,14 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)return ret; } + ret =devm_request_threaded_irq (dcmi->dev, dcmi->irq, dcmi_irq_callback, + dcmi_irq_thread,IRQF_ONESHOT , +dev_name (dcmi->dev), dcmi); +if (ret) { +dev_err (dcmi->dev,"Unable to request irq %d\n" , dcmi->irq); +return ret; + } +return 0 ; }
@@ -1914,6 +1923,8 @@ static int dcmi_probe(struct platform_device *pdev)if (irq <=0 )return irq ? irq : -ENXIO ; + dcmi->irq = irq; + dcmi->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!dcmi->res) {dev_err (&pdev->dev,"Could not get resource\n" );
@@ -1926,14 +1937,6 @@ static int dcmi_probe(struct platform_device *pdev)return PTR_ERR (dcmi->regs); } - ret =devm_request_threaded_irq (&pdev->dev, irq, dcmi_irq_callback, - dcmi_irq_thread,IRQF_ONESHOT , -dev_name (&pdev->dev), dcmi); -if (ret) { -dev_err (&pdev->dev,"Unable to request irq %d\n" , irq); -return ret; - } - mclk =devm_clk_get (&pdev->dev,"mclk" );if (IS_ERR (mclk)) {if (PTR_ERR (mclk) != -EPROBE_DEFER )
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 242/849 media: uvcvideo: Set capability in s_param
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit 97a2777a96070afb7da5d587834086c0b586c8cc ]
Fixes v4l2-compliance:
Format ioctls (Input 0):
warn: v4l2-test-formats.cpp(1339): S_PARM is supported but doesn't report V4L2_CAP_TIMEPERFRAME
fail: v4l2-test-formats.cpp(1241): node->has_frmintervals && !cap->capability
--- drivers/media/usb/uvc/uvc_v4l2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_v4l2.c +5 -2
@@ -472,10 +472,13 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,uvc_simplify_fraction (&timeperframe.numerator, &timeperframe.denominator,8 ,333 ); -if (parm->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) +if (parm->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) { parm->parm.capture.timeperframe = timeperframe; -else + parm->parm.capture.capability =V4L2_CAP_TIMEPERFRAME ; + }else { parm->parm.output.timeperframe = timeperframe; + parm->parm.output.capability =V4L2_CAP_TIMEPERFRAME ; + }return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 246/849 media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe()
In reply to Greg Kroah-HartmanFrom: Tuo Li <[email protected]>
[ Upstream commit 8515965e5e33f4feb56134348c95953f3eadfb26 ]
The variable pdev is assigned to dev->plat_dev, and dev->plat_dev is checked in:
if (!dev->plat_dev)
This indicates both dev->plat_dev and pdev can be NULL. If so, the function dev_err() is called to print error information.
dev_err(&pdev->dev, "No platform data specified\n");
However, &pdev->dev is an illegal address, and it is dereferenced in dev_err().
To fix this possible null-pointer dereference, replace dev_err() with mfc_err().
--- drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/s5p-mfc/s5p_mfc.c +1 -1
@@ -1283,7 +1283,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)spin_lock_init (&dev->condlock); dev->plat_dev = pdev;if (!dev->plat_dev) { -dev_err (&pdev->dev,"No platform data specified\n" ); +mfc_err ("No platform data specified\n" );return -ENODEV ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 208/849 drm: panel-orientation-quirks: Add quirk for the Samsung Galaxy Book 10.6
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 88fa1fde918951c175ae5ea0f31efc4bb1736ab9 ]
The Samsung Galaxy Book 10.6 uses a panel which has been mounted 90 degrees rotated. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +12 -0
@@ -109,6 +109,12 @@ static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1280x1920_rightside_up = { + .width =1280 , + .height =1920 , + .orientation =DRM_MODE_PANEL_ORIENTATION_RIGHT_UP , +}; +static const struct dmi_system_id orientation_data[] = { {/* Acer One 10 (S1003) */ .matches = {
@@ -249,6 +255,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), }, .driver_data = (void *)&onegx1_pro, + }, { /* Samsung GalaxyBook 10.6 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"SAMSUNG ELECTRONICS CO., LTD." ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"), + }, + .driver_data = (void *)&lcd1280x1920_rightside_up, }, { /* VIOS LTH17 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 236/849 ath10k: high latency fixes for beacon buffer
In reply to Greg Kroah-HartmanFrom: Alagu Sankar <[email protected]>
[ Upstream commit e263bdab9c0e8025fb7f41f153709a9cda51f6b6 ]
Beacon buffer for high latency devices does not use DMA. other similar buffer allocation methods in the driver have already been modified for high latency path. Fix the beacon buffer allocation left out in the earlier high latency changes.
--- drivers/net/wireless/ath/ath10k/mac.c | 31 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +23 -8
@@ -993,8 +993,12 @@ static void ath10k_mac_vif_beacon_cleanup(struct ath10k_vif *arvif)ath10k_mac_vif_beacon_free (arvif);if (arvif->beacon_buf) { -dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , - arvif->beacon_buf, arvif->beacon_paddr); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) +kfree (arvif->beacon_buf); +else +dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , + arvif->beacon_buf, + arvif->beacon_paddr); arvif->beacon_buf =NULL ; } }
@@ -5576,10 +5580,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,if (vif->type ==NL80211_IFTYPE_ADHOC || vif->type ==NL80211_IFTYPE_MESH_POINT || vif->type ==NL80211_IFTYPE_AP ) { - arvif->beacon_buf =dma_alloc_coherent (ar->dev, -IEEE80211_MAX_FRAME_LEN , - &arvif->beacon_paddr, -GFP_ATOMIC ); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) { + arvif->beacon_buf =kmalloc (IEEE80211_MAX_FRAME_LEN , +GFP_KERNEL ); + arvif->beacon_paddr = (dma_addr_t )arvif->beacon_buf; + }else { + arvif->beacon_buf = +dma_alloc_coherent (ar->dev, +IEEE80211_MAX_FRAME_LEN , + &arvif->beacon_paddr, +GFP_ATOMIC ); + }if (!arvif->beacon_buf) { ret = -ENOMEM ; ath10k_warn(ar, "failed to allocate beacon buffer: %d\n",
@@ -5794,8 +5805,12 @@ err_vdev_delete: err:if (arvif->beacon_buf) { -dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , - arvif->beacon_buf, arvif->beacon_paddr); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) +kfree (arvif->beacon_buf); +else +dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , + arvif->beacon_buf, + arvif->beacon_paddr); arvif->beacon_buf =NULL ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 259/849 ACPICA: Avoid evaluating methods too early during system resume
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit d3c4b6f64ad356c0d9ddbcf73fa471e6a841cc5c ]
ACPICA commit 0762982923f95eb652cf7ded27356b247c9774de
During wakeup from system-wide sleep states, acpi_get_sleep_type_data() is called and it tries to get memory from the slab allocator in order to evaluate a control method, but if KFENCE is enabled in the kernel, the memory allocation attempt causes an IRQ work to be queued and a self-IPI to be sent to the CPU running the code which requires the memory controller to be ready, so if that happens too early in the wakeup path, it doesn't work.
Prevent that from taking place by calling acpi_get_sleep_type_data() for S0 upfront, when preparing to enter a given sleep state, and saving the data obtained by it for later use during system wakeup.
--- drivers/acpi/acpica/acglobal.h | 2 ++ drivers/acpi/acpica/hwesleep.c | 8 ++------ drivers/acpi/acpica/hwsleep.c | 11 ++++------- drivers/acpi/acpica/hwxfsleep.c | 7 +++++++ 4 files changed, 15 insertions(+), 13 deletions(-)
drivers/acpi/acpica/acglobal.h +2 -0
@@ -226,6 +226,8 @@ extern struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG ];ACPI_GLOBAL (u8, acpi_gbl_sleep_type_a);ACPI_GLOBAL (u8, acpi_gbl_sleep_type_b); +ACPI_GLOBAL (u8, acpi_gbl_sleep_type_a_s0); +ACPI_GLOBAL (u8, acpi_gbl_sleep_type_b_s0);/***************************************************************************** *
drivers/acpi/acpica/hwesleep.c +2 -6
@@ -147,17 +147,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)acpi_status acpi_hw_extended_wake_prep (u8 sleep_state) { -acpi_status status;u8 sleep_type_value;ACPI_FUNCTION_TRACE (hw_extended_wake_prep); - status =acpi_get_sleep_type_data (ACPI_STATE_S0 , - &acpi_gbl_sleep_type_a, - &acpi_gbl_sleep_type_b); -if (ACPI_SUCCESS (status)) { +if (acpi_gbl_sleep_type_a_s0 !=ACPI_SLEEP_TYPE_INVALID ) { sleep_type_value = - ((acpi_gbl_sleep_type_a <<ACPI_X_SLEEP_TYPE_POSITION ) & + ((acpi_gbl_sleep_type_a_s0 <<ACPI_X_SLEEP_TYPE_POSITION ) &ACPI_X_SLEEP_TYPE_MASK ); (void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
drivers/acpi/acpica/hwsleep.c +4 -7
@@ -179,7 +179,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)acpi_status acpi_hw_legacy_wake_prep (u8 sleep_state) { -acpi_status status; +acpi_status status =AE_OK ;struct acpi_bit_register_info *sleep_type_reg_info;struct acpi_bit_register_info *sleep_enable_reg_info;u32 pm1a_control;
@@ -192,10 +192,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)* This is unclear from the ACPI Spec, but it is required * by some machines. */ - status =acpi_get_sleep_type_data (ACPI_STATE_S0 , - &acpi_gbl_sleep_type_a, - &acpi_gbl_sleep_type_b); -if (ACPI_SUCCESS (status)) { +if (acpi_gbl_sleep_type_a_s0 !=ACPI_SLEEP_TYPE_INVALID ) { sleep_type_reg_info =acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE ); sleep_enable_reg_info =
@@ -216,9 +213,9 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)/* Insert the SLP_TYP bits */ - pm1a_control |= (acpi_gbl_sleep_type_a << + pm1a_control |= (acpi_gbl_sleep_type_a_s0 << sleep_type_reg_info->bit_position); - pm1b_control |= (acpi_gbl_sleep_type_b << + pm1b_control |= (acpi_gbl_sleep_type_b_s0 << sleep_type_reg_info->bit_position);/* Write the control registers and ignore any errors */
drivers/acpi/acpica/hwxfsleep.c +7 -0
@@ -217,6 +217,13 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)return_ACPI_STATUS (status); } + status =acpi_get_sleep_type_data (ACPI_STATE_S0 , + &acpi_gbl_sleep_type_a_s0, + &acpi_gbl_sleep_type_b_s0); +if (ACPI_FAILURE (status)) { + acpi_gbl_sleep_type_a_s0 =ACPI_SLEEP_TYPE_INVALID ; + } +/* Execute the _PTS method (Prepare To Sleep) */ arg_list.count =1 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 258/849 kselftests/sched: cleanup the child processes
In reply to Greg Kroah-HartmanFrom: Li Zhijian <[email protected]>
[ Upstream commit 1c36432b278cecf1499f21fae19836e614954309 ]
Previously, 'make -C sched run_tests' will block forever when it occurs something wrong where the *selftests framework* is waiting for its child processes to exit.
[root@iaas-rpma sched]# ./cs_prctl_test
## Create a thread/process/process group hiearchy
Not a core sched system
tid=74985, / tgid=74985 / pgid=74985: ffffffffffffffff Not a core sched system
tid=74986, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74988, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74989, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74990, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74987, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74991, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74992, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74993, / tgid=74987 / pgid=74985: ffffffffffffffffNot a core sched system
(268) FAILED: get_cs_cookie(0) == 0
## Set a cookie on entire process group
-1 = prctl(62, 1, 0, 2, 0)core_sched create failed -- PGID: Invalid argument (cs_prctl_test.c:272) -
[root@iaas-rpma sched]# ps
PID TTY TIME CMD
4605 pts/2 00:00:00 bash 74986 pts/2 00:00:00 cs_prctl_test 74987 pts/2 00:00:00 cs_prctl_test 74999 pts/2 00:00:00 ps
--- tools/testing/selftests/sched/cs_prctl_test.c | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-)
tools/testing/selftests/sched/cs_prctl_test.c +18 -10
@@ -64,6 +64,17 @@ enum pid_type {PIDTYPE_PID = 0, PIDTYPE_TGID, PIDTYPE_PGID};const int THREAD_CLONE_FLAGS =CLONE_THREAD |CLONE_SIGHAND |CLONE_FS |CLONE_VM |CLONE_FILES ; +struct child_args { +int num_threads; +int pfd[2 ]; +int cpid; +int thr_tids[MAX_THREADS ]; +}; + +static struct child_args procs[MAX_PROCESSES ]; +static int num_processes =2 ; +static int need_cleanup =0 ; +static int _prctl (int option,unsigned long arg2,unsigned long arg3,unsigned long arg4,unsigned long arg5) {
@@ -80,8 +91,14 @@ static int _prctl(int option, unsigned long arg2, unsigned long arg3, unsigned l#define handle_error (msg) __handle_error(__FILE__, __LINE__, msg)static void __handle_error (char *fn,int ln,char *msg) { +int pidx;printf ("(%s:%d) - " , fn, ln);perror (msg); +if (need_cleanup) { +for (pidx =0 ; pidx < num_processes; ++pidx) +kill (procs[pidx].cpid,15 ); + need_cleanup =0 ; + }exit (EXIT_FAILURE ); }
@@ -108,13 +125,6 @@ static unsigned long get_cs_cookie(int pid)return cookie; } -struct child_args { -int num_threads; -int pfd[2 ]; -int cpid; -int thr_tids[MAX_THREADS ]; -}; -static int child_func_thread (void __attribute__((unused))*arg) {while (1 )
@@ -214,10 +224,7 @@ void _validate(int line, int val, char *msg)int main (int argc,char *argv[]) { -struct child_args procs[MAX_PROCESSES ]; -int keypress =0 ; -int num_processes =2 ;int num_threads =3 ;int delay =0 ;int res =0 ;
@@ -264,6 +271,7 @@ int main(int argc, char *argv[])printf ("\n## Create a thread/process/process group hiearchy\n" );create_processes (num_processes, num_threads, procs); + need_cleanup =1 ;disp_processes (num_processes, procs);validate (get_cs_cookie (0 ) ==0 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 260/849 cpufreq: Make policy min/max hard requirements
In reply to Greg Kroah-HartmanFrom: Vincent Donnefort <[email protected]>
[ Upstream commit 15171769069408789a72f9aa9a52cc931b839b56 ]
When applying the policy min/max limits, the requested frequency is simply clamped to not be out of range. It means, however, if one of the boundaries isn't an available frequency, the frequency resolution can return a value out of those limits, depending on the relation used.
e.g. freq{0,1,2} being available frequencies.
freq0 policy->min freq1 policy->max freq2
| | | | |
17kHz 18kHz 19kHz 20kHz 21kHz
__resolve_freq(21kHz, CPUFREQ_RELATION_L) -> 21kHz (out of bounds)
__resolve_freq(17kHz, CPUFREQ_RELATION_H) -> 17kHz (out of bounds)If, during the policy init, we resolve the requested min/max to existing frequencies, we ensure that any CPUFREQ_RELATION_* would resolve to a frequency which is inside the policy min/max range.
Making the policy limits rigid helps to introduce the inefficient frequencies support. Resolving an inefficient frequency to an efficient one should not transgress policy->max (which can be set for thermal reason) and having a value we can trust simplify this comparison.
--- drivers/cpufreq/cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/cpufreq.c +7 -0
@@ -2514,8 +2514,15 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,if (ret)return ret; +/* +* Resolve policy min/max to available frequencies. It ensures +* no frequency resolution will neither overshoot the requested maximum +* nor undershoot the requested minimum. +*/ policy->min = new_data.min; policy->max = new_data.max; + policy->min =__resolve_freq (policy, policy->min,CPUFREQ_RELATION_L ); + policy->max =__resolve_freq (policy, policy->max,CPUFREQ_RELATION_H );trace_cpu_frequency_limits (policy); policy->cached_target_freq =UINT_MAX ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 257/849 fs/proc/uptime.c: Fix idle time reporting in /proc/uptime
In reply to Greg Kroah-HartmanFrom: Josh Don <[email protected]>
[ Upstream commit a130e8fbc7de796eb6e680724d87f4737a26d0ac ]
/proc/uptime reports idle time by reading the CPUTIME_IDLE field from the per-cpu kcpustats. However, on NO_HZ systems, idle time is not continually updated on idle cpus, leading this value to appear incorrectly small.
/proc/stat performs an accounting update when reading idle time; we can use the same approach for uptime.
With this patch, /proc/stat and /proc/uptime now agree on idle time. Additionally, the following shows idle time tick up consistently on an idle machine:
(while true; do cat /proc/uptime; sleep 1; done) | awk '{print $2-prev; prev=$2}'
--- fs/proc/stat.c | 4 ++-- fs/proc/uptime.c | 14 +++++++++----- include/linux/kernel_stat.h | 1 + 3 files changed, 12 insertions(+), 7 deletions(-)
fs/proc/stat.c +2 -2
@@ -24,7 +24,7 @@#ifdef arch_idle_time -static u64 get_idle_time (struct kernel_cpustat *kcs,int cpu) +u64 get_idle_time (struct kernel_cpustat *kcs,int cpu) {u64 idle;
@@ -46,7 +46,7 @@ static u64 get_iowait_time(struct kernel_cpustat *kcs, int cpu)#else -static u64 get_idle_time (struct kernel_cpustat *kcs,int cpu) +u64 get_idle_time (struct kernel_cpustat *kcs,int cpu) {u64 idle, idle_usecs =-1ULL ;
fs/proc/uptime.c +9 -5
@@ -12,18 +12,22 @@ static int uptime_proc_show(struct seq_file *m, void *v) {struct timespec64 uptime;struct timespec64 idle; -u64 nsec; +u64 idle_nsec;u32 rem;int i; - nsec =0 ; -for_each_possible_cpu (i) - nsec += (__force u64 )kcpustat_cpu (i).cpustat[CPUTIME_IDLE ]; + idle_nsec =0 ; +for_each_possible_cpu (i) { +struct kernel_cpustat kcs; + +kcpustat_cpu_fetch (&kcs, i); + idle_nsec +=get_idle_time (&kcs, i); + }ktime_get_boottime_ts64 (&uptime);timens_add_boottime (&uptime); - idle.tv_sec =div_u64_rem (nsec,NSEC_PER_SEC , &rem); + idle.tv_sec =div_u64_rem (idle_nsec,NSEC_PER_SEC , &rem); idle.tv_nsec = rem; seq_printf(m, "%lu.%02lu %lu.%02lu\n", (unsigned long) uptime.tv_sec,
include/linux/kernel_stat.h +1 -0
@@ -102,6 +102,7 @@ extern void account_system_index_time(struct task_struct *, u64, enum cpu_usage_stat);extern void account_steal_time (u64 );extern void account_idle_time (u64 ); +extern u64 get_idle_time (struct kernel_cpustat *kcs,int cpu);#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE static inline void account_process_tick (struct task_struct *tsk,int user)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 255/849 media: rcar-csi2: Add checking to rcsi2_start_receiver()
In reply to Greg Kroah-HartmanFrom: Nadezda Lutovinova <[email protected]>
[ Upstream commit fc41665498332ad394b7db37f23e9394096ddc71 ]
If rcsi2_code_to_fmt() return NULL, then null pointer dereference occurs in the next cycle. That should not be possible now but adding checking protects from future bugs.
The patch adds checking if format is NULL.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/platform/rcar-vin/rcar-csi2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/rcar-vin/rcar-csi2.c +2 -0
@@ -553,6 +553,8 @@ static int rcsi2_start_receiver(struct rcar_csi2 *priv)/* Code is validated in set_fmt. */ format =rcsi2_code_to_fmt (priv->mf.code); +if (!format) +return -EINVAL ;/* * Enable all supported CSI-2 channels with virtual channel and
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 256/849 ipmi: Disable some operations during a panic
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
[ Upstream commit b36eb5e7b75a756baa64909a176dd4269ee05a8b ]
Don't do kfree or other risky things when oops_in_progress is set. It's easy enough to avoid doing them
--- drivers/char/ipmi/ipmi_msghandler.c | 10 +++++++--- drivers/char/ipmi/ipmi_watchdog.c | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +7 -3
@@ -4789,7 +4789,9 @@ static atomic_t recv_msg_inuse_count = ATOMIC_INIT(0);static void free_smi_msg (struct ipmi_smi_msg *msg) {atomic_dec (&smi_msg_inuse_count); -kfree (msg); +/* Try to keep as much stuff out of the panic path as possible. */ +if (!oops_in_progress) +kfree (msg); }struct ipmi_smi_msg *ipmi_alloc_smi_msg (void )
@@ -4808,7 +4810,9 @@ EXPORT_SYMBOL(ipmi_alloc_smi_msg);static void free_recv_msg (struct ipmi_recv_msg *msg) {atomic_dec (&recv_msg_inuse_count); -kfree (msg); +/* Try to keep as much stuff out of the panic path as possible. */ +if (!oops_in_progress) +kfree (msg); }static struct ipmi_recv_msg *ipmi_alloc_recv_msg (void )
@@ -4826,7 +4830,7 @@ static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void)void ipmi_free_recv_msg (struct ipmi_recv_msg *msg) { -if (msg->user) +if (msg->user && !oops_in_progress)kref_put (&msg->user->refcount, free_user); msg->done (msg); }
drivers/char/ipmi/ipmi_watchdog.c +12 -5
@@ -342,13 +342,17 @@ static atomic_t msg_tofree = ATOMIC_INIT(0);static DECLARE_COMPLETION (msg_wait);static void msg_free_smi (struct ipmi_smi_msg *msg) { -if (atomic_dec_and_test (&msg_tofree)) -complete (&msg_wait); +if (atomic_dec_and_test (&msg_tofree)) { +if (!oops_in_progress) +complete (&msg_wait); + } }static void msg_free_recv (struct ipmi_recv_msg *msg) { -if (atomic_dec_and_test (&msg_tofree)) -complete (&msg_wait); +if (atomic_dec_and_test (&msg_tofree)) { +if (!oops_in_progress) +complete (&msg_wait); + } }static struct ipmi_smi_msg smi_msg = { .done = msg_free_smi
@@ -434,8 +438,10 @@ static int _ipmi_set_timeout(int do_heartbeat) rv =__ipmi_set_timeout (&smi_msg, &recv_msg, &send_heartbeat_now); -if (rv) +if (rv) { +atomic_set (&msg_tofree,0 );return rv; + }wait_for_completion (&msg_wait);
@@ -580,6 +586,7 @@ restart: &recv_msg, 1);if (rv) { +atomic_set (&msg_tofree,0 );pr_warn ("heartbeat send failure: %d\n" , rv);return rv; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 215/849 MIPS: lantiq: dma: reset correct number of channel
In reply to Greg Kroah-HartmanFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 5ca9ce2ba4d5884cd94d1a856c675ab1242cd242 ]
Different SoCs have a different number of channels, e.g .:
* amazon-se has 10 channels,
* danube+ar9 have 20 channels,
* vr9 has 28 channels,
* ar10 has 24 channels.
We can read the ID register and, depending on the reported number of channels, reset the appropriate number of channels.
--- arch/mips/lantiq/xway/dma.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/mips/lantiq/xway/dma.c +6 -5
@@ -31,6 +31,7 @@#define LTQ_DMA_PCTRL 0x44#define LTQ_DMA_IRNEN 0xf4 +#define DMA_ID_CHNR GENMASK(26, 20)/* channel number */ #define DMA_DESCPT BIT(3)/* descriptor complete irq */ #define DMA_TX BIT(8)/* TX channel direction */ #define DMA_CHAN_ON BIT(0)/* channel on / off bit */
@@ -41,7 +42,6 @@#define DMA_POLL BIT(31)/* turn on channel polling */ #define DMA_CLK_DIV4 BIT(6)/* polling clock divider */ #define DMA_2W_BURST BIT(1)/* 2 word burst length */ -#define DMA_MAX_CHANNEL 20/* the soc has 20 channels */ #define DMA_ETOP_ENDIANNESS (0xf << 8)/* endianness swap etop channels */ #define DMA_WEIGHT (BIT(17) | BIT(16))/* default channel wheight */
@@ -207,7 +207,7 @@ ltq_dma_init(struct platform_device *pdev) {struct clk *clk;struct resource *res; -unsigned id; +unsigned int id, nchannels;int i; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -229,17 +229,18 @@ ltq_dma_init(struct platform_device *pdev)ltq_dma_w32 (0 ,LTQ_DMA_IRNEN );/* reset/configure each channel */ -for (i =0 ; i <DMA_MAX_CHANNEL ; i++) { + id =ltq_dma_r32 (LTQ_DMA_ID ); + nchannels = ((id &DMA_ID_CHNR ) >>20 ); +for (i =0 ; i < nchannels; i++) {ltq_dma_w32 (i,LTQ_DMA_CS );ltq_dma_w32 (DMA_CHAN_RST ,LTQ_DMA_CCTRL );ltq_dma_w32 (DMA_POLL |DMA_CLK_DIV4 ,LTQ_DMA_CPOLL );ltq_dma_w32_mask (DMA_CHAN_ON ,0 ,LTQ_DMA_CCTRL ); } - id =ltq_dma_r32 (LTQ_DMA_ID );dev_info (&pdev->dev,"Init done - hw rev: %X, ports: %d, channels: %d\n" , - id &0x1f , (id >>16 ) &0xf , id >>20 ); + id &0x1f , (id >>16 ) &0xf , nchannels);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 214/849 MIPS: lantiq: dma: add small delay after reset
In reply to Greg Kroah-HartmanFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit c12aa581f6d5e80c3c3675ab26a52c2b3b62f76e ]
Reading the DMA registers immediately after the reset causes Data Bus Error. Adding a small delay fixes this issue.
--- arch/mips/lantiq/xway/dma.c | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/lantiq/xway/dma.c +3 -0
@@ -11,6 +11,7 @@#include <linux/export.h> #include <linux/spinlock.h> #include <linux/clk.h> +#include <linux/delay.h> #include <linux/err.h> #include <linux/of.h>
@@ -222,6 +223,8 @@ ltq_dma_init(struct platform_device *pdev)clk_enable (clk);ltq_dma_w32_mask (0 ,DMA_RESET ,LTQ_DMA_CTRL ); +usleep_range (1 ,10 ); +/* disable all interrupts */ ltq_dma_w32 (0 ,LTQ_DMA_IRNEN );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 213/849 platform/x86: wmi: do not fail if disabling fails
In reply to Greg Kroah-HartmanFrom: Barnabás Pőcze <[email protected]>
[ Upstream commit 1975718c488a39128f1f515b23ae61a5a214cc3d ]
Previously, __query_block() would fail if the second WCxx method call failed. However, the WQxx method might have succeeded, and potentially allocated memory for the result. Instead of throwing away the result and potentially leaking memory, ignore the result of
the second WCxx call.
--- drivers/platform/x86/wmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/platform/x86/wmi.c +8 -1
@@ -353,7 +353,14 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance,* the WQxx method failed - we should disable collection anyway. */ if ((block->flags &ACPI_WMI_EXPENSIVE ) &&ACPI_SUCCESS (wc_status)) { - status =acpi_execute_simple_method (handle, wc_method,0 ); +/* +* Ignore whether this WCxx call succeeds or not since +* the previously executed WQxx method call might have +* succeeded, and returning the failing status code +* of this call would throw away the result of the WQxx +* call, potentially leaking memory. +*/ +acpi_execute_simple_method (handle, wc_method,0 ); }return status;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 216/849 locking/lockdep: Avoid RCU-induced noinstr fail
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit ce0b9c805dd66d5e49fd53ec5415ae398f4c56e6 ]
vmlinux.o: warning: objtool: look_up_lock_class()+0xc7: call to rcu_read_lock_any_held() leaves .noinstr.text section
--- kernel/locking/lockdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/lockdep.c +1 -1
@@ -888,7 +888,7 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass)if (DEBUG_LOCKS_WARN_ON (!irqs_disabled ()))return NULL ; -hlist_for_each_entry_rcu (class, hash_head, hash_entry) { +hlist_for_each_entry_rcu_notrace (class, hash_head, hash_entry) {if (class->key == key) {/* * Huh! same key, different name? Did someone trample
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 261/849 ice: Move devlink port to PF/VF struct
In reply to Greg Kroah-HartmanFrom: Wojciech Drewek <[email protected]>
[ Upstream commit 2ae0aa4758b0f4a247d45cb3bf01548a7f396751 ]
Keeping devlink port inside VSI data structure causes some issues. Since VF VSI is released during reset that means that we have to unregister devlink port and register it again every time reset is triggered. With the new changes in devlink API it
might cause deadlock issues. After calling devlink_port_register/devlink_port_unregister devlink API is going to lock rtnl_mutex. It's an issue when VF reset is triggered in netlink operation context (like setting VF MAC address or VLAN), because rtnl_lock is already taken by netlink. Another call of rtnl_lock from devlink API results in dead-lock.
By moving devlink port to PF/VF we avoid creating/destroying it during reset. Since this patch, devlink ports are created during ice_probe, destroyed during ice_remove for PF and created during ice_repr_add, destroyed during ice_repr_rem for VF.
--- drivers/net/ethernet/intel/ice/ice.h | 7 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 109 +++++++++++++----- drivers/net/ethernet/intel/ice/ice_devlink.h | 6 +- drivers/net/ethernet/intel/ice/ice_lib.c | 3 +- drivers/net/ethernet/intel/ice/ice_main.c | 4 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 2 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.h | 9 ++ 7 files changed, 103 insertions(+), 37 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +3 -4
@@ -306,10 +306,6 @@ struct ice_vsi {spinlock_t arfs_lock;/* protects aRFS hash table and filter state */ atomic_t *arfs_last_fltr_id; -/* devlink port data */ -struct devlink_port devlink_port; -bool devlink_port_registered; -u16 max_frame;u16 rx_buf_len;
@@ -421,6 +417,9 @@ struct ice_pf {struct devlink_region *nvm_region;struct devlink_region *devcaps_region; +/* devlink port data */ +struct devlink_port devlink_port; +/* OS reserved IRQ details */ struct msix_entry *msix_entries;struct ice_res_tracker *irq_tracker;
drivers/net/ethernet/intel/ice/ice_devlink.c +82 -27
142 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_devlink.h +4 -2
@@ -8,8 +8,10 @@ struct ice_pf *ice_allocate_pf(struct device *dev);int ice_devlink_register (struct ice_pf *pf);void ice_devlink_unregister (struct ice_pf *pf); -int ice_devlink_create_port (struct ice_vsi *vsi); -void ice_devlink_destroy_port (struct ice_vsi *vsi); +int ice_devlink_create_pf_port (struct ice_pf *pf); +void ice_devlink_destroy_pf_port (struct ice_pf *pf); +int ice_devlink_create_vf_port (struct ice_vf *vf); +void ice_devlink_destroy_vf_port (struct ice_vf *vf);void ice_devlink_init_regions (struct ice_pf *pf);void ice_devlink_destroy_regions (struct ice_pf *pf);
drivers/net/ethernet/intel/ice/ice_lib.c +2 -1
@@ -2860,7 +2860,8 @@ int ice_vsi_release(struct ice_vsi *vsi)clear_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state); } -ice_devlink_destroy_port (vsi); +if (vsi->type ==ICE_VSI_PF ) +ice_devlink_destroy_pf_port (pf);if (test_bit (ICE_FLAG_RSS_ENA , pf->flags))ice_rss_clean (vsi);
drivers/net/ethernet/intel/ice/ice_main.c +2 -2
@@ -4170,11 +4170,11 @@ static int ice_register_netdev(struct ice_pf *pf)set_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state);netif_carrier_off (vsi->netdev);netif_tx_stop_all_queues (vsi->netdev); - err =ice_devlink_create_port (vsi); + err =ice_devlink_create_pf_port (pf);if (err) goto err_devlink_create; -devlink_port_type_eth_set (&vsi->devlink_port, vsi->netdev); +devlink_port_type_eth_set (&pf->devlink_port, vsi->netdev);return 0 ; err_devlink_create:
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1 -1
@@ -251,7 +251,7 @@ ice_vc_hash_field_match_type ice_vc_hash_field_list_comms[] = {* ice_get_vf_vsi - get VF's VSI based on the stored index * @vf: VF used to get VSI */ -static struct ice_vsi *ice_get_vf_vsi (struct ice_vf *vf) +struct ice_vsi *ice_get_vf_vsi (struct ice_vf *vf) {return vf->pf->vsi[vf->lan_vsi_idx]; }
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h +9 -0
@@ -111,9 +111,13 @@ struct ice_vf {struct ice_mdd_vf_events mdd_rx_events;struct ice_mdd_vf_events mdd_tx_events;DECLARE_BITMAP (opcodes_allowlist,VIRTCHNL_OP_MAX ); + +/* devlink port data */ +struct devlink_port devlink_port; };#ifdef CONFIG_PCI_IOV +struct ice_vsi *ice_get_vf_vsi (struct ice_vf *vf);void ice_process_vflr_event (struct ice_pf *pf);int ice_sriov_configure (struct pci_dev *pdev,int num_vfs);int ice_set_vf_mac (struct net_device *netdev,int vf_id,u8 *mac);
@@ -171,6 +175,11 @@ static inline void ice_print_vfs_mdd_events(struct ice_pf *pf) { }static inline void ice_print_vf_rx_mdd_event (struct ice_vf *vf) { }static inline void ice_restore_all_vfs_msi_state (struct pci_dev *pdev) { } +static inline struct ice_vsi *ice_get_vf_vsi (struct ice_vf *vf) +{ +return NULL ; +} + static inline bool ice_is_malicious_vf(struct ice_pf __always_unused *pf, struct ice_rq_event_info __always_unused *event,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 262/849 media: imx-jpeg: Fix possible null pointer dereference
In reply to Greg Kroah-HartmanFrom: Mirela Rabulea <[email protected]>
[ Upstream commit 83f5f0633b156c636f5249d3c10f2a9423dd4c96 ]
Found by Coverity scan.
--- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/platform/imx-jpeg/mxc-jpeg.c +4 -0
@@ -575,6 +575,10 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) dst_buf =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx); src_buf =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); +if (!dst_buf || !src_buf) { +dev_err (dev,"No source or destination buffer.\n" ); + goto job_unlock; + } jpeg_src_buf =vb2_to_mxc_buf (&src_buf->vb2_buf);if (dec_ret &SLOT_STATUS_ENC_CONFIG_ERR ) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 272/849 iov_iter: Fix iov_iter_get_pages{,_alloc} page fault return value
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit 814a66741b9ffb5e1ba119e368b178edb0b7322d ]
Both iov_iter_get_pages and iov_iter_get_pages_alloc return the number of bytes of the iovec they could get the pages for. When they cannot get any pages, they're supposed to return 0, but when the start of the iovec isn't page aligned, the calculation goes wrong and they return a negative value. Fix both functions.
In addition, change iov_iter_get_pages_alloc to return NULL in that case to prevent resource leaks.
--- lib/iov_iter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/iov_iter.c +3 -2
@@ -1484,7 +1484,7 @@ ssize_t iov_iter_get_pages(struct iov_iter *i, res =get_user_pages_fast (addr, n,iov_iter_rw (i) !=WRITE ?FOLL_WRITE :0 , pages); -if (unlikely (res <0 )) +if (unlikely (res <=0 ))return res;return (res == n ? len : res *PAGE_SIZE ) - *start; }
@@ -1608,8 +1608,9 @@ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i,return -ENOMEM ; res =get_user_pages_fast (addr, n,iov_iter_rw (i) !=WRITE ?FOLL_WRITE :0 , p); -if (unlikely (res <0 )) { +if (unlikely (res <=0 )) {kvfree (p); + *pages =NULL ;return res; } *pages = p;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 278/849 leaking_addresses: Always print a trailing newline
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit cf2a85efdade117e2169d6e26641016cbbf03ef0 ]
For files that lack trailing newlines and match a leaking address (e.g. wchan[1]), the leaking_addresses.pl report would run together with the next line, making things look corrupted.
Unconditionally remove the newline on input, and write it back out on output.
[1] https://lore.kernel.org/all/20210103142726.GC30643@xsang-OptiPlex-9020/
--- scripts/leaking_addresses.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/leaking_addresses.pl +2 -1
@@ -455,8 +455,9 @@ sub parse_file open my $fh, "<", $file or return; while ( <$fh> ) { + chomp; if (may_leak_address($_)) { - print $file . ': ' . $_; + printf("$file: $_\n"); } } close $fh;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 279/849 thermal/core: Fix null pointer dereference in thermal_release()
In reply to Greg Kroah-HartmanFrom: Yuanzheng Song <[email protected]>
[ Upstream commit 1dd7128b839f631b31a9e9dce3aaf639bef74e9d ]
If both dev_set_name() and device_register() failed, then null pointer dereference occurs in thermal_release() which will use strncmp() to compare the name.
So fix it by adding dev_set_name() return value check.
--- drivers/thermal/thermal_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/thermal/thermal_core.c +8 -2
@@ -902,6 +902,10 @@ __thermal_cooling_device_register(struct device_node *np, goto out_kfree_cdev; cdev->id = ret; + ret =dev_set_name (&cdev->device,"cooling_device%d" , cdev->id); +if (ret) + goto out_ida_remove; + cdev->type =kstrdup (type ? type :"" ,GFP_KERNEL );if (!cdev->type) { ret = -ENOMEM ;
@@ -916,7 +920,6 @@ __thermal_cooling_device_register(struct device_node *np, cdev->device.class = &thermal_class; cdev->devdata = devdata;thermal_cooling_device_setup_sysfs (cdev); -dev_set_name (&cdev->device,"cooling_device%d" , cdev->id); ret =device_register (&cdev->device);if (ret) goto out_kfree_type;
@@ -1227,6 +1230,10 @@ thermal_zone_device_register(const char *type, int trips, int mask, tz->id = id;strlcpy (tz->type, type,sizeof (tz->type)); + result =dev_set_name (&tz->device,"thermal_zone%d" , tz->id); +if (result) + goto remove_id; +if (!ops->critical) ops->critical = thermal_zone_device_critical;
@@ -1248,7 +1255,6 @@ thermal_zone_device_register(const char *type, int trips, int mask,/* A new thermal zone needs to be updated anyway. */ atomic_set (&tz->need_update,1 ); -dev_set_name (&tz->device,"thermal_zone%d" , tz->id); result =device_register (&tz->device);if (result) goto release_device;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 276/849 drm/amdkfd: fix resume error when iommu disabled in Picasso
In reply to Greg Kroah-HartmanFrom: Yifan Zhang <[email protected]>
[ Upstream commit 6f4b590aae217da16cfa44039a2abcfb209137ab ]
When IOMMU disabled in sbios and kfd in iommuv2 path, IOMMU resume failure blocks system resume. Don't allow kfd to use iommu v2 when iommu is disabled.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -0
@@ -867,6 +867,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,kfd_double_confirm_iommu_support (kfd);if (kfd_iommu_device_init (kfd)) { + kfd->use_iommu_v2 = false;dev_err (kfd_device,"Error initializing iommuv2\n" ); goto device_iommu_error; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 248/849 media: videobuf2: rework vb2_mem_ops API
In reply to Greg Kroah-HartmanFrom: Sergey Senozhatsky <[email protected]>
[ Upstream commit a4b83deb3e76fb9385ca58e2c072a145b3a320d6 ]
With the new DMA API we need an extension of the videobuf2 API. Previously, videobuf2 core would set the non-coherent DMA bit in the vb2_queue dma_attr field (if user-space would pass a corresponding memory hint); the vb2 core then would pass the vb2_queue dma_attrs to the vb2 allocators. The vb2 allocator would use the queue's dma_attr and the DMA API would allocate either coherent or non-coherent memory.
But we cannot do this anymore, since there is no corresponding DMA attr flag and, hence, there is no way for the allocator to become aware of what type of allocation user-space has requested. So we need to pass more context from videobuf2 core to the allocators.
Fix this by changing the call_ptr_memop() macro to pass the vb2 pointer to the corresponding op callbacks.
--- .../media/common/videobuf2/videobuf2-core.c | 42 +++++++++++-------- .../common/videobuf2/videobuf2-dma-contig.c | 36 +++++++++------- .../media/common/videobuf2/videobuf2-dma-sg.c | 33 ++++++++------- .../common/videobuf2/videobuf2-vmalloc.c | 30 ++++++------- include/media/videobuf2-core.h | 37 ++++++++-------- 5 files changed, 98 insertions(+), 80 deletions(-)
drivers/media/common/videobuf2/videobuf2-core.c +24 -18
@@ -68,13 +68,13 @@ module_param(debug, int, 0644); err; \ }) -#define call_ptr_memop(vb, op, args...) \ +#define call_ptr_memop(op, vb, args...) \ ({ \ struct vb2_queue *_q = (vb)->vb2_queue; \ void *ptr; \ \ log_memop(vb, op); \ - ptr = _q->mem_ops->op ? _q->mem_ops->op(args) : NULL; \ + ptr = _q->mem_ops->op ? _q->mem_ops->op(vb, args) : NULL; \ if (!IS_ERR_OR_NULL(ptr)) \ (vb)->cnt_mem_ ## op++; \ ptr; \
@@ -144,9 +144,9 @@ module_param(debug, int, 0644); ((vb)->vb2_queue->mem_ops->op ? \ (vb)->vb2_queue->mem_ops->op(args) : 0) -#define call_ptr_memop(vb, op, args...) \ +#define call_ptr_memop(op, vb, args...) \ ((vb)->vb2_queue->mem_ops->op ? \ - (vb)->vb2_queue->mem_ops->op(args) : NULL) + (vb)->vb2_queue->mem_ops->op(vb, args) : NULL) #define call_void_memop(vb, op, args...) \ do { \
@@ -230,9 +230,10 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)if (size < vb->planes[plane].length) goto free; - mem_priv =call_ptr_memop (vb, alloc, - q->alloc_devs[plane] ? : q->dev, - q->dma_attrs, size, q->dma_dir, q->gfp_flags); + mem_priv =call_ptr_memop (alloc, + vb, + q->alloc_devs[plane] ? : q->dev, + size);if (IS_ERR_OR_NULL (mem_priv)) {if (mem_priv) ret =PTR_ERR (mem_priv);
@@ -975,7 +976,7 @@ void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no)if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv)return NULL ; -return call_ptr_memop (vb, vaddr, vb->planes[plane_no].mem_priv); +return call_ptr_memop (vaddr, vb, vb->planes[plane_no].mem_priv); }EXPORT_SYMBOL_GPL (vb2_plane_vaddr);
@@ -985,7 +986,7 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no)if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv)return NULL ; -return call_ptr_memop (vb, cookie, vb->planes[plane_no].mem_priv); +return call_ptr_memop (cookie, vb, vb->planes[plane_no].mem_priv); }EXPORT_SYMBOL_GPL (vb2_plane_cookie);
@@ -1125,10 +1126,11 @@ static int __prepare_userptr(struct vb2_buffer *vb) vb->planes[plane].data_offset =0 ;/* Acquire each plane's memory */ - mem_priv =call_ptr_memop (vb, get_userptr, - q->alloc_devs[plane] ? : q->dev, - planes[plane].m.userptr, - planes[plane].length, q->dma_dir); + mem_priv =call_ptr_memop (get_userptr, + vb, + q->alloc_devs[plane] ? : q->dev, + planes[plane].m.userptr, + planes[plane].length);if (IS_ERR (mem_priv)) {dprintk (q,1 ,"failed acquiring userspace memory for plane %d\n" , plane);
@@ -1249,9 +1251,11 @@ static int __prepare_dmabuf(struct vb2_buffer *vb) vb->planes[plane].data_offset =0 ;/* Acquire each plane's memory */ - mem_priv =call_ptr_memop (vb, attach_dmabuf, - q->alloc_devs[plane] ? : q->dev, - dbuf, planes[plane].length, q->dma_dir); + mem_priv =call_ptr_memop (attach_dmabuf, + vb, + q->alloc_devs[plane] ? : q->dev, + dbuf, + planes[plane].length);if (IS_ERR (mem_priv)) {dprintk (q,1 ,"failed to attach dmabuf\n" ); ret =PTR_ERR (mem_priv);
@@ -2187,8 +2191,10 @@ int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type, vb_plane = &vb->planes[plane]; - dbuf =call_ptr_memop (vb, get_dmabuf, vb_plane->mem_priv, - flags &O_ACCMODE ); + dbuf =call_ptr_memop (get_dmabuf, + vb, + vb_plane->mem_priv, + flags &O_ACCMODE );if (IS_ERR_OR_NULL (dbuf)) {dprintk (q,1 ,"failed to export buffer %d, plane %d\n" , index, plane);
drivers/media/common/videobuf2/videobuf2-dma-contig.c +21 -15
@@ -40,6 +40,8 @@ struct vb2_dc_buf {/* DMABUF related */ struct dma_buf_attachment *db_attach; + +struct vb2_buffer *vb; };/*********************************************/
@@ -66,14 +68,14 @@ static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)/* callbacks for all buffers */ /*********************************************/ -static void *vb2_dc_cookie (void *buf_priv) +static void *vb2_dc_cookie (struct vb2_buffer *vb,void *buf_priv) {struct vb2_dc_buf *buf = buf_priv;return &buf->dma_addr; } -static void *vb2_dc_vaddr (void *buf_priv) +static void *vb2_dc_vaddr (struct vb2_buffer *vb,void *buf_priv) {struct vb2_dc_buf *buf = buf_priv;struct dma_buf_map map;
@@ -137,9 +139,9 @@ static void vb2_dc_put(void *buf_priv)kfree (buf); } -static void *vb2_dc_alloc (struct device *dev,unsigned long attrs, -unsigned long size,enum dma_data_direction dma_dir, -gfp_t gfp_flags) +static void *vb2_dc_alloc (struct vb2_buffer *vb, +struct device *dev, +unsigned long size) {struct vb2_dc_buf *buf;
@@ -150,9 +152,10 @@ static void *vb2_dc_alloc(struct device *dev, unsigned long attrs,if (!buf)return ERR_PTR (-ENOMEM ); - buf->attrs = attrs; + buf->attrs = vb->vb2_queue->dma_attrs; buf->cookie =dma_alloc_attrs (dev, size, &buf->dma_addr, -GFP_KERNEL | gfp_flags, buf->attrs); +GFP_KERNEL | vb->vb2_queue->gfp_flags, + buf->attrs);if (!buf->cookie) {dev_err (dev,"dma_alloc_coherent of size %ld failed\n" , size);kfree (buf);
@@ -165,11 +168,12 @@ static void *vb2_dc_alloc(struct device *dev, unsigned long attrs,/* Prevent the device from being released while the buffer is used */ buf->dev =get_device (dev); buf->size = size; - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; buf->handler.refcount = &buf->refcount; buf->handler.put = vb2_dc_put; buf->handler.arg = buf; + buf->vb = vb;refcount_set (&buf->refcount,1 );
@@ -397,7 +401,9 @@ static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf)return sgt; } -static struct dma_buf *vb2_dc_get_dmabuf (void *buf_priv,unsigned long flags) +static struct dma_buf *vb2_dc_get_dmabuf (struct vb2_buffer *vb, +void *buf_priv, +unsigned long flags) {struct vb2_dc_buf *buf = buf_priv;struct dma_buf *dbuf;
@@ -459,8 +465,8 @@ static void vb2_dc_put_userptr(void *buf_priv)kfree (buf); } -static void *vb2_dc_get_userptr (struct device *dev,unsigned long vaddr, -unsigned long size,enum dma_data_direction dma_dir) +static void *vb2_dc_get_userptr (struct vb2_buffer *vb,struct device *dev, +unsigned long vaddr,unsigned long size) {struct vb2_dc_buf *buf;struct frame_vector *vec;
@@ -490,7 +496,7 @@ static void *vb2_dc_get_userptr(struct device *dev, unsigned long vaddr,return ERR_PTR (-ENOMEM ); buf->dev = dev; - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; offset =lower_32_bits (offset_in_page (vaddr)); vec =vb2_create_framevec (vaddr, size);
@@ -660,8 +666,8 @@ static void vb2_dc_detach_dmabuf(void *mem_priv)kfree (buf); } -static void *vb2_dc_attach_dmabuf (struct device *dev,struct dma_buf *dbuf, -unsigned long size,enum dma_data_direction dma_dir) +static void *vb2_dc_attach_dmabuf (struct vb2_buffer *vb,struct device *dev, +struct dma_buf *dbuf,unsigned long size) {struct vb2_dc_buf *buf;struct dma_buf_attachment *dba;
@@ -685,7 +691,7 @@ static void *vb2_dc_attach_dmabuf(struct device *dev, struct dma_buf *dbuf,return dba; } - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; buf->size = size; buf->db_attach = dba;
drivers/media/common/videobuf2/videobuf2-dma-sg.c +18 -15
@@ -51,6 +51,8 @@ struct vb2_dma_sg_buf {struct vb2_vmarea_handler handler;struct dma_buf_attachment *db_attach; + +struct vb2_buffer *vb; };static void vb2_dma_sg_put (void *buf_priv);
@@ -96,9 +98,8 @@ static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf *buf,return 0 ; } -static void *vb2_dma_sg_alloc (struct device *dev,unsigned long dma_attrs, -unsigned long size,enum dma_data_direction dma_dir, -gfp_t gfp_flags) +static void *vb2_dma_sg_alloc (struct vb2_buffer *vb,struct device *dev, +unsigned long size) {struct vb2_dma_sg_buf *buf;struct sg_table *sgt;
@@ -113,7 +114,7 @@ static void *vb2_dma_sg_alloc(struct device *dev, unsigned long dma_attrs,return ERR_PTR (-ENOMEM ); buf->vaddr =NULL ; - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; buf->offset =0 ; buf->size = size;/* size is already page aligned */
@@ -130,7 +131,7 @@ static void *vb2_dma_sg_alloc(struct device *dev, unsigned long dma_attrs,if (!buf->pages) goto fail_pages_array_alloc; - ret =vb2_dma_sg_alloc_compacted (buf, gfp_flags); + ret =vb2_dma_sg_alloc_compacted (buf, vb->vb2_queue->gfp_flags);if (ret) goto fail_pages_alloc;
@@ -154,6 +155,7 @@ static void *vb2_dma_sg_alloc(struct device *dev, unsigned long dma_attrs, buf->handler.refcount = &buf->refcount; buf->handler.put = vb2_dma_sg_put; buf->handler.arg = buf; + buf->vb = vb;refcount_set (&buf->refcount,1 );
@@ -213,9 +215,8 @@ static void vb2_dma_sg_finish(void *buf_priv)dma_sync_sgtable_for_cpu (buf->dev, sgt, buf->dma_dir); } -static void *vb2_dma_sg_get_userptr (struct device *dev,unsigned long vaddr, -unsigned long size, -enum dma_data_direction dma_dir) +static void *vb2_dma_sg_get_userptr (struct vb2_buffer *vb,struct device *dev, +unsigned long vaddr,unsigned long size) {struct vb2_dma_sg_buf *buf;struct sg_table *sgt;
@@ -230,7 +231,7 @@ static void *vb2_dma_sg_get_userptr(struct device *dev, unsigned long vaddr, buf->vaddr =NULL ; buf->dev = dev; - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; buf->offset = vaddr & ~PAGE_MASK ; buf->size = size; buf->dma_sgt = &buf->sg_table;
@@ -292,7 +293,7 @@ static void vb2_dma_sg_put_userptr(void *buf_priv)kfree (buf); } -static void *vb2_dma_sg_vaddr (void *buf_priv) +static void *vb2_dma_sg_vaddr (struct vb2_buffer *vb,void *buf_priv) {struct vb2_dma_sg_buf *buf = buf_priv;struct dma_buf_map map;
@@ -511,7 +512,9 @@ static const struct dma_buf_ops vb2_dma_sg_dmabuf_ops = { .release = vb2_dma_sg_dmabuf_ops_release, }; -static struct dma_buf *vb2_dma_sg_get_dmabuf (void *buf_priv,unsigned long flags) +static struct dma_buf *vb2_dma_sg_get_dmabuf (struct vb2_buffer *vb, +void *buf_priv, +unsigned long flags) {struct vb2_dma_sg_buf *buf = buf_priv;struct dma_buf *dbuf;
@@ -605,8 +608,8 @@ static void vb2_dma_sg_detach_dmabuf(void *mem_priv)kfree (buf); } -static void *vb2_dma_sg_attach_dmabuf (struct device *dev,struct dma_buf *dbuf, -unsigned long size,enum dma_data_direction dma_dir) +static void *vb2_dma_sg_attach_dmabuf (struct vb2_buffer *vb,struct device *dev, +struct dma_buf *dbuf,unsigned long size) {struct vb2_dma_sg_buf *buf;struct dma_buf_attachment *dba;
@@ -630,14 +633,14 @@ static void *vb2_dma_sg_attach_dmabuf(struct device *dev, struct dma_buf *dbuf,return dba; } - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; buf->size = size; buf->db_attach = dba;return buf; } -static void *vb2_dma_sg_cookie (void *buf_priv) +static void *vb2_dma_sg_cookie (struct vb2_buffer *vb,void *buf_priv) {struct vb2_dma_sg_buf *buf = buf_priv;
drivers/media/common/videobuf2/videobuf2-vmalloc.c +16 -14
@@ -34,13 +34,12 @@ struct vb2_vmalloc_buf {static void vb2_vmalloc_put (void *buf_priv); -static void *vb2_vmalloc_alloc (struct device *dev,unsigned long attrs, -unsigned long size,enum dma_data_direction dma_dir, -gfp_t gfp_flags) +static void *vb2_vmalloc_alloc (struct vb2_buffer *vb,struct device *dev, +unsigned long size) {struct vb2_vmalloc_buf *buf; - buf =kzalloc (sizeof (*buf),GFP_KERNEL | gfp_flags); + buf =kzalloc (sizeof (*buf),GFP_KERNEL | vb->vb2_queue->gfp_flags);if (!buf)return ERR_PTR (-ENOMEM );
@@ -52,7 +51,7 @@ static void *vb2_vmalloc_alloc(struct device *dev, unsigned long attrs,return ERR_PTR (-ENOMEM ); } - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; buf->handler.refcount = &buf->refcount; buf->handler.put = vb2_vmalloc_put; buf->handler.arg = buf;
@@ -71,9 +70,8 @@ static void vb2_vmalloc_put(void *buf_priv) } } -static void *vb2_vmalloc_get_userptr (struct device *dev,unsigned long vaddr, -unsigned long size, -enum dma_data_direction dma_dir) +static void *vb2_vmalloc_get_userptr (struct vb2_buffer *vb,struct device *dev, +unsigned long vaddr,unsigned long size) {struct vb2_vmalloc_buf *buf;struct frame_vector *vec;
@@ -84,7 +82,7 @@ static void *vb2_vmalloc_get_userptr(struct device *dev, unsigned long vaddr,if (!buf)return ERR_PTR (-ENOMEM ); - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; offset = vaddr & ~PAGE_MASK ; buf->size = size; vec =vb2_create_framevec (vaddr, size);
@@ -147,7 +145,7 @@ static void vb2_vmalloc_put_userptr(void *buf_priv)kfree (buf); } -static void *vb2_vmalloc_vaddr (void *buf_priv) +static void *vb2_vmalloc_vaddr (struct vb2_buffer *vb,void *buf_priv) {struct vb2_vmalloc_buf *buf = buf_priv;
@@ -339,7 +337,9 @@ static const struct dma_buf_ops vb2_vmalloc_dmabuf_ops = { .release = vb2_vmalloc_dmabuf_ops_release, }; -static struct dma_buf *vb2_vmalloc_get_dmabuf (void *buf_priv,unsigned long flags) +static struct dma_buf *vb2_vmalloc_get_dmabuf (struct vb2_buffer *vb, +void *buf_priv, +unsigned long flags) {struct vb2_vmalloc_buf *buf = buf_priv;struct dma_buf *dbuf;
@@ -403,8 +403,10 @@ static void vb2_vmalloc_detach_dmabuf(void *mem_priv)kfree (buf); } -static void *vb2_vmalloc_attach_dmabuf (struct device *dev,struct dma_buf *dbuf, -unsigned long size,enum dma_data_direction dma_dir) +static void *vb2_vmalloc_attach_dmabuf (struct vb2_buffer *vb, +struct device *dev, +struct dma_buf *dbuf, +unsigned long size) {struct vb2_vmalloc_buf *buf;
@@ -416,7 +418,7 @@ static void *vb2_vmalloc_attach_dmabuf(struct device *dev, struct dma_buf *dbuf,return ERR_PTR (-ENOMEM ); buf->dbuf = dbuf; - buf->dma_dir = dma_dir; + buf->dma_dir = vb->vb2_queue->dma_dir; buf->size = size;return buf;
include/media/videobuf2-core.h +19 -18
@@ -46,6 +46,7 @@ enum vb2_memory {struct vb2_fileio_data ;struct vb2_threadio_data ; +struct vb2_buffer ;/** * struct vb2_mem_ops - memory handling/memory allocator operations.
@@ -53,10 +54,8 @@ struct vb2_threadio_data;* return ERR_PTR() on failure or a pointer to allocator private, * per-buffer data on success; the returned private structure * will then be passed as @buf_priv argument to other ops in this -* structure. Additional gfp_flags to use when allocating the -* are also passed to this operation. These flags are from the -* gfp_flags field of vb2_queue. The size argument to this function -* shall be *page aligned*. +* structure. The size argument to this function shall be +* *page aligned*. * @put: inform the allocator that the buffer will no longer be used; * usually will result in the allocator freeing the buffer (if * no other users of this buffer are present); the @buf_priv
@@ -117,31 +116,33 @@ struct vb2_threadio_data;* map_dmabuf, unmap_dmabuf. */ struct vb2_mem_ops { -void *(*alloc)(struct device *dev,unsigned long attrs, -unsigned long size, -enum dma_data_direction dma_dir, -gfp_t gfp_flags); +void *(*alloc)(struct vb2_buffer *vb, +struct device *dev, +unsigned long size);void (*put)(void *buf_priv); -struct dma_buf *(*get_dmabuf)(void *buf_priv,unsigned long flags); - -void *(*get_userptr)(struct device *dev,unsigned long vaddr, -unsigned long size, -enum dma_data_direction dma_dir); +struct dma_buf *(*get_dmabuf)(struct vb2_buffer *vb, +void *buf_priv, +unsigned long flags); + +void *(*get_userptr)(struct vb2_buffer *vb, +struct device *dev, +unsigned long vaddr, +unsigned long size);void (*put_userptr)(void *buf_priv);void (*prepare)(void *buf_priv);void (*finish)(void *buf_priv); -void *(*attach_dmabuf)(struct device *dev, +void *(*attach_dmabuf)(struct vb2_buffer *vb, +struct device *dev,struct dma_buf *dbuf, -unsigned long size, -enum dma_data_direction dma_dir); +unsigned long size);void (*detach_dmabuf)(void *buf_priv);int (*map_dmabuf)(void *buf_priv);void (*unmap_dmabuf)(void *buf_priv); -void *(*vaddr)(void *buf_priv); -void *(*cookie)(void *buf_priv); +void *(*vaddr)(struct vb2_buffer *vb,void *buf_priv); +void *(*cookie)(struct vb2_buffer *vb,void *buf_priv);unsigned int (*num_users)(void *buf_priv);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 277/849 net: phy: micrel: make *-skew-ps check more lenient
In reply to Greg Kroah-HartmanFrom: Matthias Schiffer <[email protected]>
[ Upstream commit 67ca5159dbe2edb5dae7544447b8677d2596933a ]
It seems reasonable to fine-tune only some of the skew values when using one of the rgmii-*id PHY modes, and even when all skew values are specified, using the correct ID PHY mode makes sense for documentation purposes. Such a configuration also appears in the binding docs in Documentation/devicetree/bindings/net/micrel-ksz90x1.txt, so the driver should not warn about it.
--- drivers/net/phy/micrel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/micrel.c +2 -2
@@ -863,9 +863,9 @@ static int ksz9031_config_init(struct phy_device *phydev)MII_KSZ9031RN_TX_DATA_PAD_SKEW ,4 , tx_data_skews, 4, &update); -if (update && phydev->interface !=PHY_INTERFACE_MODE_RGMII ) +if (update && !phy_interface_is_rgmii (phydev))phydev_warn (phydev, -"*-skew-ps values should be used only with phy-mode = \"rgmii\"\n" ); +"*-skew-ps values should be used only with RGMII PHY modes\n" );/* Silicon Errata Sheet (DS80000691D or DS80000692D): * When the device links in the 1000BASE-T slave mode only,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 274/849 ACPI: scan: Release PM resources blocked by unused objects
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit c10383e8ddf4810b9a5c1595404c2724d925a0a6 ]
On some systems the ACPI namespace contains device objects that are not used in certain configurations of the system. If they start off in the D0 power state configuration, they will stay in it until the system reboots, because of the lack of any mechanism possibly causing their configuration to change. If that happens, they may prevent some power resources from being turned off or generally they may prevent the platform from getting into the deepest low-power states thus causing some energy to be wasted.
Address this issue by changing the configuration of unused ACPI device objects to the D3cold power state one after carrying out the ACPI-based enumeration of devices.
--- drivers/acpi/glue.c | 25 +++++++++++++++++++++++++ drivers/acpi/internal.h | 1 + drivers/acpi/scan.c | 6 ++++++ 3 files changed, 32 insertions(+)
drivers/acpi/glue.c +25 -0
@@ -363,3 +363,28 @@ int acpi_platform_notify(struct device *dev, enum kobject_action action) }return 0 ; } + +int acpi_dev_turn_off_if_unused (struct device *dev,void *not_used) +{ +struct acpi_device *adev =to_acpi_device (dev); + +/* +* Skip device objects with device IDs, because they may be in use even +* if they are not companions of any physical device objects. +*/ +if (adev->pnp.type.hardware_id) +return 0 ; + +mutex_lock (&adev->physical_node_lock); + +/* +* Device objects without device IDs are not in use if they have no +* corresponding physical device objects. +*/ +if (list_empty (&adev->physical_node_list)) +acpi_device_set_power (adev,ACPI_STATE_D3_COLD ); + +mutex_unlock (&adev->physical_node_lock); + +return 0 ; +}
drivers/acpi/internal.h +1 -0
@@ -117,6 +117,7 @@ bool acpi_device_is_battery(struct acpi_device *adev);bool acpi_device_is_first_physical_node (struct acpi_device *adev,const struct device *dev);int acpi_bus_register_early_device (int type); +int acpi_dev_turn_off_if_unused (struct device *dev,void *not_used);/* -------------------------------------------------------------------------- Device Matching and Notification
drivers/acpi/scan.c +6 -0
@@ -2560,6 +2560,12 @@ int __init acpi_scan_init(void) } } +/* +* Make sure that power management resources are not blocked by ACPI +* device objects with no users. +*/ +bus_for_each_dev (&acpi_bus_type,NULL ,NULL , acpi_dev_turn_off_if_unused); +acpi_turn_off_unused_power_resources (); acpi_scan_initialized = true;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 275/849 drm/amd/display: fix null pointer deref when plugging in display
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
[ Upstream commit 1f3b22e4eb162e0b1d423106a47484943a22a309 ]
[Why&How]
When system boots in headless mode, connecting a 4k display creates a null pointer dereference due to hubp for a certain plane being null. Add a condition to check for null hubp before dereferencing it.
--- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +2 -1
@@ -1002,7 +1002,8 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,/* turning off DPG */ pipe_ctx->plane_res.hubp->funcs->set_blank (pipe_ctx->plane_res.hubp, false);for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) - mpcc_pipe->plane_res.hubp->funcs->set_blank (mpcc_pipe->plane_res.hubp, false); +if (mpcc_pipe->plane_res.hubp) + mpcc_pipe->plane_res.hubp->funcs->set_blank (mpcc_pipe->plane_res.hubp, false); stream_res->opp->funcs->opp_set_disp_pattern_generator (stream_res->opp, test_pattern, color_space, color_depth, solid_color, width, height, offset);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 292/849 mwl8k: Fix use-after-free in mwl8k_fw_state_machine()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 257051a235c17e33782b6e24a4b17f2d7915aaec ]
When the driver fails to request the firmware, it calls its error handler. In the error handler, the driver detaches device from driver first before releasing the firmware, which can cause a use-after-free bug.
Fix this by releasing firmware first.
The following log reveals it:
[ 9.007301 ] BUG: KASAN: use-after-free in mwl8k_fw_state_machine+0x320/0xba0 [ 9.010143 ] Workqueue: events request_firmware_work_func [ 9.010830 ] Call Trace: [ 9.010830 ] dump_stack_lvl+0xa8/0xd1 [ 9.010830 ] print_address_description+0x87/0x3b0 [ 9.010830 ] kasan_report+0x172/0x1c0 [ 9.010830 ] ? mutex_unlock+0xd/0x10 [ 9.010830 ] ? mwl8k_fw_state_machine+0x320/0xba0 [ 9.010830 ] ? mwl8k_fw_state_machine+0x320/0xba0 [ 9.010830 ] __asan_report_load8_noabort+0x14/0x20 [ 9.010830 ] mwl8k_fw_state_machine+0x320/0xba0 [ 9.010830 ] ? mwl8k_load_firmware+0x5f0/0x5f0 [ 9.010830 ] request_firmware_work_func+0x172/0x250 [ 9.010830 ] ? read_lock_is_recursive+0x20/0x20 [ 9.010830 ] ? process_one_work+0x7a1/0x1100 [ 9.010830 ] ? request_firmware_nowait+0x460/0x460 [ 9.010830 ] ? __this_cpu_preempt_check+0x13/0x20 [ 9.010830 ] process_one_work+0x9bb/0x1100
--- drivers/net/wireless/marvell/mwl8k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwl8k.c +1 -1
@@ -5800,8 +5800,8 @@ static void mwl8k_fw_state_machine(const struct firmware *fw, void *context) fail: priv->fw_state =FW_STATE_ERROR ;complete (&priv->firmware_loading_complete); -device_release_driver (&priv->pdev->dev);mwl8k_release_firmware (priv); +device_release_driver (&priv->pdev->dev); }#define MAX_RESTART_ATTEMPTS 1
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 293/849 iwlwifi: change all JnP to NO-160 configuration
In reply to Greg Kroah-HartmanFrom: Yaara Baruch <[email protected]>
[ Upstream commit 70382b0897eeecfcd35ba5f6161dbceeb556ea1e ]
JnP should not have the 160 MHz.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +3 -3
@@ -931,9 +931,9 @@ static const struct iwl_dev_info iwl_dev_info_table[] = { IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, iwl_qu_b0_hr1_b0, iwl_ax101_name),_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , -IWL_CFG_MAC_TYPE_QU ,SILICON_C_STEP , +IWL_CFG_MAC_TYPE_QU ,SILICON_B_STEP ,IWL_CFG_RF_TYPE_HR2 ,IWL_CFG_ANY , -IWL_CFG_ANY ,IWL_CFG_ANY ,IWL_CFG_NO_CDB , +IWL_CFG_NO_160 ,IWL_CFG_ANY ,IWL_CFG_NO_CDB , iwl_qu_b0_hr_b0, iwl_ax203_name),/* Qu C step */
@@ -945,7 +945,7 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY ,IWL_CFG_MAC_TYPE_QU ,SILICON_C_STEP ,IWL_CFG_RF_TYPE_HR2 ,IWL_CFG_ANY , -IWL_CFG_ANY ,IWL_CFG_ANY ,IWL_CFG_NO_CDB , +IWL_CFG_NO_160 ,IWL_CFG_ANY ,IWL_CFG_NO_CDB , iwl_qu_c0_hr_b0, iwl_ax203_name),/* QuZ */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 296/849 drm/amdgpu/pm: properly handle sclk for profiling modes on vangogh
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 68e3871dcd6e547f6c47454492bc452356cb9eac ]
When selecting between levels in the force performance levels interface sclk (gfxclk) was not set correctly for all levels. Select the proper sclk settings for all levels.
--- .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 89 ++++++------------- 1 file changed, 29 insertions(+), 60 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +29 -60
@@ -1382,52 +1382,38 @@ static int vangogh_set_performance_level(struct smu_context *smu,uint32_t soc_mask, mclk_mask, fclk_mask;uint32_t vclk_mask =0 , dclk_mask =0 ; + smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; + smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; +switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : - smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; + smu->gfx_actual_hard_min_freq = smu->gfx_default_soft_max_freq; smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; ret =vangogh_force_dpm_limit_value (smu, true); +if (ret) +return ret;break ;case AMD_DPM_FORCED_LEVEL_LOW : smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; - smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; + smu->gfx_actual_soft_max_freq = smu->gfx_default_hard_min_freq; ret =vangogh_force_dpm_limit_value (smu, false); +if (ret) +return ret;break ;case AMD_DPM_FORCED_LEVEL_AUTO : smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - ret =vangogh_unforce_dpm_levels (smu); -break ; -case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD : - smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; - smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - - ret =smu_cmn_send_smc_msg_with_param (smu, - SMU_MSG_SetHardMinGfxClk, -VANGOGH_UMD_PSTATE_STANDARD_GFXCLK ,NULL ); -if (ret) -return ret; - - ret =smu_cmn_send_smc_msg_with_param (smu, - SMU_MSG_SetSoftMaxGfxClk, -VANGOGH_UMD_PSTATE_STANDARD_GFXCLK ,NULL );if (ret)return ret; +break ; +case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD : + smu->gfx_actual_hard_min_freq =VANGOGH_UMD_PSTATE_STANDARD_GFXCLK ; + smu->gfx_actual_soft_max_freq =VANGOGH_UMD_PSTATE_STANDARD_GFXCLK ; ret = vangogh_get_profiling_clk_mask(smu, level, &vclk_mask,
@@ -1442,32 +1428,15 @@ static int vangogh_set_performance_level(struct smu_context *smu,vangogh_force_clk_levels (smu,SMU_SOCCLK ,1 << soc_mask);vangogh_force_clk_levels (smu,SMU_VCLK ,1 << vclk_mask);vangogh_force_clk_levels (smu,SMU_DCLK ,1 << dclk_mask); -break ;case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK : smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; - smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - - ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetHardMinVcn, -VANGOGH_UMD_PSTATE_PEAK_DCLK ,NULL ); -if (ret) -return ret; - - ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetSoftMaxVcn, -VANGOGH_UMD_PSTATE_PEAK_DCLK ,NULL ); -if (ret) -return ret; + smu->gfx_actual_soft_max_freq = smu->gfx_default_hard_min_freq;break ;case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK : smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - ret = vangogh_get_profiling_clk_mask(smu, level, NULL, NULL,
@@ -1480,29 +1449,29 @@ static int vangogh_set_performance_level(struct smu_context *smu,vangogh_force_clk_levels (smu,SMU_FCLK ,1 << fclk_mask);break ;case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK : - smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; - smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - - ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetHardMinGfxClk, -VANGOGH_UMD_PSTATE_PEAK_GFXCLK ,NULL ); -if (ret) -return ret; + smu->gfx_actual_hard_min_freq =VANGOGH_UMD_PSTATE_PEAK_GFXCLK ; + smu->gfx_actual_soft_max_freq =VANGOGH_UMD_PSTATE_PEAK_GFXCLK ; - ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetSoftMaxGfxClk, -VANGOGH_UMD_PSTATE_PEAK_GFXCLK ,NULL ); + ret =vangogh_set_peak_clock_by_device (smu);if (ret)return ret; - - ret =vangogh_set_peak_clock_by_device (smu);break ;case AMD_DPM_FORCED_LEVEL_MANUAL :case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT :default : -break ; +return 0 ; } + + ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetHardMinGfxClk, + smu->gfx_actual_hard_min_freq,NULL ); +if (ret) +return ret; + + ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetSoftMaxGfxClk, + smu->gfx_actual_soft_max_freq,NULL ); +if (ret) +return ret; +return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 297/849 nvmet: fix use-after-free when a port is removed
In reply to Greg Kroah-HartmanFrom: Israel Rukshin <[email protected]>
[ Upstream commit e3e19dcc4c416d65f99f13d55be2b787f8d0050e ]
When a port is removed through configfs, any connected controllers are starting teardown flow asynchronously and can still send commands. This causes a use-after-free bug for any command that dereferences req->port (like in nvmet_parse_io_cmd).
To fix this, wait for all the teardown scheduled works to complete (like release_work at rdma/tcp drivers). This ensures there are no active controllers when the port is eventually removed.
--- drivers/nvme/target/configfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/target/configfs.c +2 -0
@@ -1553,6 +1553,8 @@ static void nvmet_port_release(struct config_item *item) {struct nvmet_port *port =to_nvmet_port (item); +/* Let inflight controllers teardown complete */ +flush_scheduled_work ();list_del (&port->global_entry);kfree (port->ana_state);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 295/849 media: allegro: ignore interrupt if mailbox is not initialized
In reply to Greg Kroah-HartmanFrom: Michael Tretter <[email protected]>
[ Upstream commit 1ecda6393db4be44aba27a243e648dc98c9b92e3 ]
The mailbox is initialized after the interrupt handler is installed. As the firmware is loaded and started even later, it should not happen that the interrupt occurs without the mailbox being initialized.
As the Linux Driver Verification project (linuxtesting.org) keeps reporting this as an error, add a check to ignore interrupts before the mailbox is initialized to fix this potential null pointer dereference.
--- drivers/media/platform/allegro-dvt/allegro-core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/platform/allegro-dvt/allegro-core.c +9 -0
@@ -2185,6 +2185,15 @@ static irqreturn_t allegro_irq_thread(int irq, void *data) {struct allegro_dev *dev = data; +/* +* The firmware is initialized after the mailbox is setup. We further +* check the AL5_ITC_CPU_IRQ_STA register, if the firmware actually +* triggered the interrupt. Although this should not happen, make sure +* that we ignore interrupts, if the mailbox is not initialized. +*/ +if (!dev->mbox_status) +return IRQ_NONE ; +allegro_mbox_notify (dev->mbox_status);return IRQ_HANDLED ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 282/849 block: bump max plugged deferred size from 16 to 32
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit ba0ffdd8ce48ad7f7e85191cd29f9674caca3745 ]
Particularly for NVMe with efficient deferred submission for many requests, there are nice benefits to be seen by bumping the default max plug count from 16 to 32. This is especially true for virtualized setups, where the submit part is more expensive. But can be noticed even on native hardware.
Reduce the multiple queue factor from 4 to 2, since we're changing the default size.
While changing it, move the defines into the block layer private header. These aren't values that anyone outside of the block layer uses, or should use.
--- block/blk-mq.c | 4 ++-- block/blk.h | 6 ++++++ include/linux/blkdev.h | 2 -- 3 files changed, 8 insertions(+), 4 deletions(-)
block/blk-mq.c +2 -2
@@ -2141,14 +2141,14 @@ static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq) }/* -* Allow 4x BLK_MAX_REQUEST_COUNT requests on plug queue for multiple +* Allow 2x BLK_MAX_REQUEST_COUNT requests on plug queue for multiple * queues. This is important for md arrays to benefit from merging * requests. */ static inline unsigned short blk_plug_max_rq_count (struct blk_plug *plug) {if (plug->multiple_queues) -return BLK_MAX_REQUEST_COUNT *4 ; +return BLK_MAX_REQUEST_COUNT *2 ;return BLK_MAX_REQUEST_COUNT ; }
block/blk.h +6 -0
@@ -181,6 +181,12 @@ bool blk_bio_list_merge(struct request_queue *q, struct list_head *list,void blk_account_io_start (struct request *req);void blk_account_io_done (struct request *req,u64 now); +/* +* Plug flush limits +*/ +#define BLK_MAX_REQUEST_COUNT 32 +#define BLK_PLUG_FLUSH_SIZE (128 * 1024) +/* * Internal elevator interface */
include/linux/blkdev.h +0 -2
@@ -1223,8 +1223,6 @@ struct blk_plug {bool multiple_queues;bool nowait; }; -#define BLK_MAX_REQUEST_COUNT 16 -#define BLK_PLUG_FLUSH_SIZE (128 * 1024)struct blk_plug_cb ;typedef void (*blk_plug_cb_fn )(struct blk_plug_cb *,bool );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 249/849 media: imx: set a media_device bus_info string
In reply to Greg Kroah-HartmanFrom: Martin Kepplinger <[email protected]>
[ Upstream commit 6d0d779b212c27293d9ccb4da092ff0ccb6efa39 ]
Some tools like v4l2-compliance let users select a media device based on the bus_info string which can be quite convenient. Use a unique string for that.
This also fixes the following v4l2-compliance warning:
warn: v4l2-test-media.cpp(52): empty bus_info
--- drivers/staging/media/imx/imx-media-dev-common.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/media/imx/imx-media-dev-common.c +2 -0
@@ -367,6 +367,8 @@ struct imx_media_dev *imx_media_dev_init(struct device *dev, imxmd->v4l2_dev.notify = imx_media_notify;strscpy (imxmd->v4l2_dev.name,"imx-media" ,sizeof (imxmd->v4l2_dev.name)); +snprintf (imxmd->md.bus_info,sizeof (imxmd->md.bus_info), +"platform:%s" ,dev_name (imxmd->md.dev));media_device_init (&imxmd->md);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 299/849 nvmet-tcp: fix use-after-free when a port is removed
In reply to Greg Kroah-HartmanFrom: Israel Rukshin <[email protected]>
[ Upstream commit 2351ead99ce9164fb42555aee3f96af84c4839e9 ]
When removing a port, all its controllers are being removed, but there are queues on the port that doesn't belong to any controller (during connection time). This causes a use-after-free bug for any command that dereferences req->port (like in nvmet_alloc_ctrl). Those queues should be destroyed before freeing the port via configfs. Destroy the remaining queues after the accept_work was cancelled guarantees that no new queue will be created.
--- drivers/nvme/target/tcp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/nvme/target/tcp.c +16 -0
@@ -1740,6 +1740,17 @@ err_port:return ret; } +static void nvmet_tcp_destroy_port_queues (struct nvmet_tcp_port *port) +{ +struct nvmet_tcp_queue *queue; + +mutex_lock (&nvmet_tcp_queue_mutex); +list_for_each_entry (queue, &nvmet_tcp_queue_list, queue_list) +if (queue->port == port) +kernel_sock_shutdown (queue->sock,SHUT_RDWR ); +mutex_unlock (&nvmet_tcp_queue_mutex); +} +static void nvmet_tcp_remove_port (struct nvmet_port *nport) {struct nvmet_tcp_port *port = nport->priv;
@@ -1749,6 +1760,11 @@ static void nvmet_tcp_remove_port(struct nvmet_port *nport) port->sock->sk->sk_user_data =NULL ;write_unlock_bh (&port->sock->sk->sk_callback_lock);cancel_work_sync (&port->accept_work); +/* +* Destroy the remaining queues, which are not belong to any +* controller yet. +*/ +nvmet_tcp_destroy_port_queues (port);sock_release (port->sock);kfree (port);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 298/849 nvmet-rdma: fix use-after-free when a port is removed
In reply to Greg Kroah-HartmanFrom: Israel Rukshin <[email protected]>
[ Upstream commit fcf73a804c7d6bbf0ea63531c6122aa363852e04 ]
When removing a port, all its controllers are being removed, but there are queues on the port that doesn't belong to any controller (during connection time). This causes a use-after-free bug for any command that dereferences req->port (like in nvmet_alloc_ctrl). Those queues should be destroyed before freeing the port via configfs. Destroy the remaining queues after the RDMA-CM was destroyed guarantees that no new queue will be created.
--- drivers/nvme/target/rdma.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/nvme/target/rdma.c +24 -0
@@ -1818,12 +1818,36 @@ restart:mutex_unlock (&nvmet_rdma_queue_mutex); } +static void nvmet_rdma_destroy_port_queues (struct nvmet_rdma_port *port) +{ +struct nvmet_rdma_queue *queue, *tmp; +struct nvmet_port *nport = port->nport; + +mutex_lock (&nvmet_rdma_queue_mutex); +list_for_each_entry_safe (queue, tmp, &nvmet_rdma_queue_list, + queue_list) { +if (queue->port != nport) +continue ; + +list_del_init (&queue->queue_list); +__nvmet_rdma_queue_disconnect (queue); + } +mutex_unlock (&nvmet_rdma_queue_mutex); +} +static void nvmet_rdma_disable_port (struct nvmet_rdma_port *port) {struct rdma_cm_id *cm_id =xchg (&port->cm_id,NULL );if (cm_id)rdma_destroy_id (cm_id); + +/* +* Destroy the remaining queues, which are not belong to any +* controller yet. Do it here after the RDMA-CM was destroyed +* guarantees that no new queue will be created. +*/ +nvmet_rdma_destroy_port_queues (port); }static int nvmet_rdma_enable_port (struct nvmet_rdma_port *port)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 294/849 block: remove inaccurate requeue check
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 037057a5a979c7eeb2ee5d12cf4c24b805192c75 ]
This check is meant to catch cases where a requeue is attempted on a request that is still inserted. It's never really been useful to catch any misuse, and now it's actively wrong. Outside of that, this should not be a BUG_ON() to begin with.
Remove the check as it's now causing active harm, as requeue off the plug path will trigger it even though the request state is just fine.
--- block/blk-mq.c | 1 - 1 file changed, 1 deletion(-)
block/blk-mq.c +0 -1
@@ -756,7 +756,6 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list)/* this request will be re-inserted to io scheduler queue */ blk_mq_sched_requeue_request (rq); -BUG_ON (!list_empty (&rq->queuelist));blk_mq_add_to_requeue_list (rq, true, kick_requeue_list); }EXPORT_SYMBOL (blk_mq_requeue_request);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 300/849 nvme: drop scan_lock and always kick requeue list when removing namespaces
In reply to Greg Kroah-HartmanFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 2b81a5f015199f3d585ce710190a9e87714d3c1e ]
When reading the partition table on initial scan hits an I/O error the I/O will hang with the scan_mutex held:
[<0>] do_read_cache_page+0x49b/0x790 [<0>] read_part_sector+0x39/0xe0 [<0>] read_lba+0xf9/0x1d0 [<0>] efi_partition+0xf1/0x7f0 [<0>] bdev_disk_changed+0x1ee/0x550 [<0>] blkdev_get_whole+0x81/0x90 [<0>] blkdev_get_by_dev+0x128/0x2e0 [<0>] device_add_disk+0x377/0x3c0 [<0>] nvme_mpath_set_live+0x130/0x1b0 [nvme_core] [<0>] nvme_mpath_add_disk+0x150/0x160 [nvme_core] [<0>] nvme_alloc_ns+0x417/0x950 [nvme_core] [<0>] nvme_validate_or_alloc_ns+0xe9/0x1e0 [nvme_core] [<0>] nvme_scan_work+0x168/0x310 [nvme_core] [<0>] process_one_work+0x231/0x420
and trying to delete the controller will deadlock as it tries to grab the scan mutex:
[<0>] nvme_mpath_clear_ctrl_paths+0x25/0x80 [nvme_core] [<0>] nvme_remove_namespaces+0x31/0xf0 [nvme_core] [<0>] nvme_do_delete_ctrl+0x4b/0x80 [nvme_core]
As we're now properly ordering the namespace list there is no need to hold the scan_mutex in nvme_mpath_clear_ctrl_paths() anymore. And we always need to kick the requeue list as the path will be marked as unusable and I/O will be requeued _without_ a current path.
--- drivers/nvme/host/multipath.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/nvme/host/multipath.c +4 -5
@@ -138,13 +138,12 @@ void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) {struct nvme_ns *ns; -mutex_lock (&ctrl->scan_lock);down_read (&ctrl->namespaces_rwsem); -list_for_each_entry (ns, &ctrl->namespaces, list) -if (nvme_mpath_clear_current_path (ns)) -kblockd_schedule_work (&ns->head->requeue_work); +list_for_each_entry (ns, &ctrl->namespaces, list) { +nvme_mpath_clear_current_path (ns); +kblockd_schedule_work (&ns->head->requeue_work); + }up_read (&ctrl->namespaces_rwsem); -mutex_unlock (&ctrl->scan_lock); }static bool nvme_path_is_disabled (struct nvme_ns *ns)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 301/849 arm64: vdso32: suppress error message for make mrproper
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 14831fad73f5ac30ac61760487d95a538e6ab3cb ]
When running the following command without arm-linux-gnueabi-gcc in one's $PATH, the following warning is observed:
$ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper make[1]: arm-linux-gnueabi-gcc: No such file or directory
This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG is not set, and we end up eagerly evaluating various variables that try to invoke CC_COMPAT.
This is a similar problem to what was observed in
commit dc960bfeedb0 ("h8300: suppress error messages for 'make clean'")
--- arch/arm64/kernel/vdso32/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/vdso32/Makefile +2 -1
@@ -40,7 +40,8 @@ cc32-as-instr = $(call try-run,\ # As a result we set our own flags here. # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile -VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include) +VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc +VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include 2>/dev/null) VDSO_CPPFLAGS += $(LINUXINCLUDE) # Common C and assembly flags
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 306/849 smackfs: use __GFP_NOFAIL for smk_cipso_doi()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit f91488ee15bd3cac467e2d6a361fc2d34d1052ae ]
syzbot is reporting kernel panic at smk_cipso_doi() due to memory allocation fault injection [1]. The reason for need to use panic() was not explained. But since no fix was proposed for 18 months, for now let's use __GFP_NOFAIL for utilizing syzbot resource on other bugs.
--- security/smack/smackfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
security/smack/smackfs.c +1 -3
@@ -693,9 +693,7 @@ static void smk_cipso_doi(void)printk (KERN_WARNING "%s:%d remove rc = %d\n" , __func__, __LINE__, rc); - doip =kmalloc (sizeof (struct cipso_v4_doi ),GFP_KERNEL ); -if (doip ==NULL ) -panic ("smack: Failed to initialize cipso DOI.\n" ); + doip =kmalloc (sizeof (struct cipso_v4_doi ),GFP_KERNEL | __GFP_NOFAIL); doip->map.std =NULL ; doip->doi = smk_cipso_doi_value; doip->type =CIPSO_V4_MAP_PASS ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 305/849 iwlwifi: mvm: disable RX-diversity in powersave
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit e5322b9ab5f63536c41301150b7ce64605ce52cc ]
Just like we have default SMPS mode as dynamic in powersave, we should not enable RX-diversity in powersave, to reduce power consumption when connected to a non-MIMO AP.
--- drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/utils.c +3 -0
@@ -405,6 +405,9 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm,lockdep_assert_held (&mvm->mutex); +if (iwlmvm_mod_params.power_scheme !=IWL_POWER_SCHEME_CAM ) +return false; +if (num_of_ant (iwl_mvm_get_valid_rx_ant (mvm)) ==1 )return false;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 284/849 md: update superblock after changing rdev flags in state_store
In reply to Greg Kroah-HartmanFrom: Xiao Ni <[email protected]>
[ Upstream commit 8b9e2291e355a0eafdd5b1e21a94a6659f24b351 ]
When the in memory flag is changed, we need to persist the change in the rdev superblock flags. This is needed for "writemostly" and "failfast".
--- drivers/md/md.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/md/md.c +10 -1
@@ -2976,7 +2976,11 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)* -write_error - clears WriteErrorSeen * {,-}failfast - set/clear FailFast */ + +struct mddev *mddev = rdev->mddev;int err = -EINVAL ; +bool need_update_sb = false; +if (cmd_match (buf,"faulty" ) && rdev->mddev->pers) {md_error (rdev->mddev, rdev);if (test_bit (Faulty, &rdev->flags))
@@ -2991,7 +2995,6 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)if (rdev->raid_disk >=0 ) err = -EBUSY ;else { -struct mddev *mddev = rdev->mddev; err =0 ;if (mddev_is_clustered (mddev)) err = md_cluster_ops->remove_disk (mddev, rdev);
@@ -3008,10 +3011,12 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) }else if (cmd_match (buf,"writemostly" )) {set_bit (WriteMostly, &rdev->flags);mddev_create_serial_pool (rdev->mddev, rdev, false); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-writemostly" )) {mddev_destroy_serial_pool (rdev->mddev, rdev, false);clear_bit (WriteMostly, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"blocked" )) {set_bit (Blocked, &rdev->flags);
@@ -3037,9 +3042,11 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) err =0 ; }else if (cmd_match (buf,"failfast" )) {set_bit (FailFast, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-failfast" )) {clear_bit (FailFast, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-insync" ) && rdev->raid_disk >=0 && !test_bit (Journal, &rdev->flags)) {
@@ -3118,6 +3125,8 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)clear_bit (ExternalBbl, &rdev->flags); err =0 ; } +if (need_update_sb) +md_update_sb (mddev,1 );if (!err)sysfs_notify_dirent_safe (rdev->sysfs_state);return err ? err : len;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 307/849 ARM: clang: Do not rely on lr register for stacktrace
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit b3ea5d56f212ad81328c82454829a736197ebccc ]
Currently the stacktrace on clang compiled arm kernel uses the 'lr' register to find the first frame address from pt_regs. However, that is wrong after calling another function, because the 'lr' register is used by 'bl' instruction and never be recovered.
As same as gcc arm kernel, directly use the frame pointer (r11) of the pt_regs to find the first frame address.
Note that this fixes kretprobe stacktrace issue only with CONFIG_UNWINDER_FRAME_POINTER=y. For the CONFIG_UNWINDER_ARM, we need another fix.
--- arch/arm/kernel/stacktrace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/kernel/stacktrace.c +1 -2
@@ -54,8 +54,7 @@ int notrace unwind_frame(struct stackframe *frame) frame->sp = frame->fp; frame->fp = *(unsigned long *)(fp); - frame->pc = frame->lr; - frame->lr = *(unsigned long *)(fp +4 ); + frame->pc = *(unsigned long *)(fp +4 );#else /* check current frame pointer is within bounds */ if (fp < low +12 || fp > high -4 )
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 315/849 vrf: run conntrack only in context of lower/physdev for locally generated packets
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 8c9c296adfae9ea05f655d69e9f6e13daa86fb4a ]
The VRF driver invokes netfilter for output+postrouting hooks so that users can create rules that check for 'oif $vrf' rather than lower device name.
This is a problem when NAT rules are configured.
To avoid any conntrack involvement in round 1, tag skbs as 'untracked' to prevent conntrack from picking them up.
This gets cleared before the packet gets handed to the ip stack so conntrack will be active on the second iteration.
One remaining issue is that a rule like
output ... oif $vrfname notrack
won't propagate to the second round because we can't tell 'notrack set via ruleset' and 'notrack set by vrf driver' apart. However, this isn't a regression: the 'notrack' removal happens instead of unconditional nf_reset_ct().
I'd also like to avoid leaking more vrf specific conditionals into the netfilter infra.
For ingress, conntrack has already been done before the packet makes it to the vrf driver, with this patch egress does connection tracking with lower/physical device as well.
--- drivers/net/vrf.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
drivers/net/vrf.c +24 -4
@@ -35,6 +35,7 @@#include <net/l3mdev.h> #include <net/fib_rules.h> #include <net/netns/generic.h> +#include <net/netfilter/nf_conntrack.h> #define DRV_NAME "vrf"#define DRV_VERSION "1.1"
@@ -424,12 +425,26 @@ static int vrf_local_xmit(struct sk_buff *skb, struct net_device *dev,return NETDEV_TX_OK ; } +static void vrf_nf_set_untracked (struct sk_buff *skb) +{ +if (skb_get_nfct (skb) ==0 ) +nf_ct_set (skb,NULL ,IP_CT_UNTRACKED ); +} + +static void vrf_nf_reset_ct (struct sk_buff *skb) +{ +if (skb_get_nfct (skb) ==IP_CT_UNTRACKED ) +nf_reset_ct (skb); +} +#if IS_ENABLED (CONFIG_IPV6 )static int vrf_ip6_local_out (struct net *net,struct sock *sk,struct sk_buff *skb) {int err; +vrf_nf_reset_ct (skb); + err =nf_hook (NFPROTO_IPV6 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL ,skb_dst (skb)->dev, dst_output);
@@ -508,6 +523,8 @@ static int vrf_ip_local_out(struct net *net, struct sock *sk, {int err; +vrf_nf_reset_ct (skb); + err =nf_hook (NFPROTO_IPV4 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL ,skb_dst (skb)->dev, dst_output);if (likely (err ==1 ))
@@ -626,8 +643,7 @@ static void vrf_finish_direct(struct sk_buff *skb)skb_pull (skb,ETH_HLEN ); } -/* reset skb device */ -nf_reset_ct (skb); +vrf_nf_reset_ct (skb); }#if IS_ENABLED (CONFIG_IPV6 )
@@ -641,7 +657,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,struct neighbour *neigh;int ret; -nf_reset_ct (skb); +vrf_nf_reset_ct (skb); skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev;
@@ -752,6 +768,8 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev, skb->dev = vrf_dev; +vrf_nf_set_untracked (skb); + err =nf_hook (NFPROTO_IPV6 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL , vrf_dev, vrf_ip6_out_direct_finish);
@@ -859,7 +877,7 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *sbool is_v6gw = false;int ret = -EINVAL ; -nf_reset_ct (skb); +vrf_nf_reset_ct (skb);/* Be paranoid, rather than too clever. */ if (unlikely (skb_headroom (skb) < hh_len && dev->header_ops)) {
@@ -987,6 +1005,8 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev, skb->dev = vrf_dev; +vrf_nf_set_untracked (skb); + err =nf_hook (NFPROTO_IPV4 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL , vrf_dev, vrf_ip_out_direct_finish);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 285/849 memstick: r592: Fix a UAF bug when removing the driver
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 738216c1953e802aa9f930c5d15b8f9092c847ff ]
In r592_remove(), the driver will free dma after freeing the host, which may cause a UAF bug.
The following log reveals it:
[ 45.361796 ] BUG: KASAN: use-after-free in r592_remove+0x269/0x350 [r592] [ 45.364286 ] Call Trace: [ 45.364472 ] dump_stack_lvl+0xa8/0xd1 [ 45.364751 ] print_address_description+0x87/0x3b0 [ 45.365137 ] kasan_report+0x172/0x1c0 [ 45.365415 ] ? r592_remove+0x269/0x350 [r592] [ 45.365834 ] ? r592_remove+0x269/0x350 [r592] [ 45.366168 ] __asan_report_load8_noabort+0x14/0x20 [ 45.366531 ] r592_remove+0x269/0x350 [r592] [ 45.378785 ] [ 45.378903 ] Allocated by task 4674: [ 45.379162 ] ____kasan_kmalloc+0xb5/0xe0 [ 45.379455 ] __kasan_kmalloc+0x9/0x10 [ 45.379730 ] __kmalloc+0x150/0x280 [ 45.379984 ] memstick_alloc_host+0x2a/0x190 [ 45.380664 ] [ 45.380781 ] Freed by task 5509: [ 45.381014 ] kasan_set_track+0x3d/0x70 [ 45.381293 ] kasan_set_free_info+0x23/0x40 [ 45.381635 ] ____kasan_slab_free+0x10b/0x140 [ 45.381950 ] __kasan_slab_free+0x11/0x20 [ 45.382241 ] slab_free_freelist_hook+0x81/0x150 [ 45.382575 ] kfree+0x13e/0x290 [ 45.382805 ] memstick_free+0x1c/0x20 [ 45.383070 ] device_release+0x9c/0x1d0 [ 45.383349 ] kobject_put+0x2ef/0x4c0 [ 45.383616 ] put_device+0x1f/0x30 [ 45.383865 ] memstick_free_host+0x24/0x30 [ 45.384162 ] r592_remove+0x242/0x350 [r592] [ 45.384473 ] pci_device_remove+0xa9/0x250
--- drivers/memstick/host/r592.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/memstick/host/r592.c +4 -4
@@ -839,15 +839,15 @@ static void r592_remove(struct pci_dev *pdev) }memstick_remove_host (dev->host); +if (dev->dummy_dma_page) +dma_free_coherent (&pdev->dev,PAGE_SIZE , dev->dummy_dma_page, + dev->dummy_dma_page_physical_address); +free_irq (dev->irq, dev);iounmap (dev->mmio);pci_release_regions (pdev);pci_disable_device (pdev);memstick_free_host (dev->host); - -if (dev->dummy_dma_page) -dma_free_coherent (&pdev->dev,PAGE_SIZE , dev->dummy_dma_page, - dev->dummy_dma_page_physical_address); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 286/849 locking/rwsem: Disable preemption for spinning region
In reply to Greg Kroah-HartmanFrom: Yanfei Xu <[email protected]>
[ Upstream commit 7cdacc5f52d68a9370f182c844b5b3e6cc975cc1 ]
The spinning region rwsem_spin_on_owner() should not be preempted, however the rwsem_down_write_slowpath() invokes it and don't disable preemption. Fix it by adding a pair of preempt_disable/enable().
--- kernel/locking/rwsem.c | 53 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-)
kernel/locking/rwsem.c +30 -23
@@ -576,6 +576,24 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem,return true; } +/* +* The rwsem_spin_on_owner() function returns the following 4 values +* depending on the lock owner state. +* OWNER_NULL : owner is currently NULL +* OWNER_WRITER: when owner changes and is a writer +* OWNER_READER: when owner changes and the new owner may be a reader. +* OWNER_NONSPINNABLE: +* when optimistic spinning has to stop because either the +* owner stops running, is unknown, or its timeslice has +* been used up. +*/ +enum owner_state { +OWNER_NULL =1 <<0 , +OWNER_WRITER =1 <<1 , +OWNER_READER =1 <<2 , +OWNER_NONSPINNABLE =1 <<3 , +}; +#ifdef CONFIG_RWSEM_SPIN_ON_OWNER /* * Try to acquire write lock before the writer has been put on wait queue.
@@ -631,23 +649,6 @@ static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem)return ret; } -/* -* The rwsem_spin_on_owner() function returns the following 4 values -* depending on the lock owner state. -* OWNER_NULL : owner is currently NULL -* OWNER_WRITER: when owner changes and is a writer -* OWNER_READER: when owner changes and the new owner may be a reader. -* OWNER_NONSPINNABLE: -* when optimistic spinning has to stop because either the -* owner stops running, is unknown, or its timeslice has -* been used up. -*/ -enum owner_state { -OWNER_NULL =1 <<0 , -OWNER_WRITER =1 <<1 , -OWNER_READER =1 <<2 , -OWNER_NONSPINNABLE =1 <<3 , -};#define OWNER_SPINNABLE (OWNER_NULL | OWNER_WRITER | OWNER_READER) static inline enum owner_state
@@ -877,12 +878,11 @@ static inline bool rwsem_optimistic_spin(struct rw_semaphore *sem)static inline void clear_nonspinnable (struct rw_semaphore *sem) { } -static inline int +static inline enum owner_state rwsem_spin_on_owner (struct rw_semaphore *sem) { -return 0 ; +return OWNER_NONSPINNABLE ; } -#define OWNER_NULL 1#endif /*
@@ -1094,9 +1094,16 @@ wait:* In this case, we attempt to acquire the lock again * without sleeping. */ -if (wstate ==WRITER_HANDOFF && -rwsem_spin_on_owner (sem) ==OWNER_NULL ) - goto trylock_again; +if (wstate ==WRITER_HANDOFF ) { +enum owner_state owner_state; + +preempt_disable (); + owner_state =rwsem_spin_on_owner (sem); +preempt_enable (); + +if (owner_state ==OWNER_NULL ) + goto trylock_again; + }/* Block until there are no active lockers. */ for (;;) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 327/849 drm/amd/display: dcn20_resource_construct reduce scope of FPU enabled
In reply to Greg Kroah-HartmanFrom: Anson Jacob <[email protected]>
[ Upstream commit bc39a69a2ac484e6575a958567c162ef56c9f278 ]
Limit when FPU is enabled to only functions that does FPU operations for dcn20_resource_construct, which gets called during driver initialization.
Enabling FPU operation disables preemption. Sleeping functions(mutex (un)lock, memory allocation using GFP_KERNEL, etc.) should not be called when preemption is disabled.
Fixes the following case caught by enablingCONFIG_DEBUG_ATOMIC_SLEEP in kernel config
[ 1.338434] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:281 [ 1.347395] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 197, name: systemd-udevd [ 1.356356] CPU: 7 PID: 197 Comm: systemd-udevd Not tainted 5.13.0+ #3 [ 1.356358] Hardware name: System manufacturer System Product Name/PRIME X570-PRO, BIOS 3405 02/01/2021 [ 1.356360] Call Trace: [ 1.356361] dump_stack+0x6b/0x86 [ 1.356366] ___might_sleep.cold+0x87/0x98 [ 1.356370] __might_sleep+0x4b/0x80 [ 1.356372] mutex_lock+0x21/0x50 [ 1.356376] smu_get_uclk_dpm_states+0x3f/0x80 [amdgpu] [ 1.356538] pp_nv_get_uclk_dpm_states+0x35/0x50 [amdgpu] [ 1.356711] init_soc_bounding_box+0xf9/0x210 [amdgpu] [ 1.356892] ? create_object+0x20d/0x340 [ 1.356897] ? dcn20_resource_construct+0x46f/0xd30 [amdgpu] [ 1.357077] dcn20_resource_construct+0x4b1/0xd30 [amdgpu]
...
Tested on: 5700XT (NAVI10 0x1002:0x731F 0x1DA2:0xE410 0xC1)
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +9 -7
@@ -3701,16 +3701,22 @@ static bool init_soc_bounding_box(struct dc *dc, clock_limits_available = (status ==PP_SMU_RESULT_OK ); } -if (clock_limits_available && uclk_states_available && num_states) +if (clock_limits_available && uclk_states_available && num_states) { +DC_FP_START ();dcn20_update_bounding_box (dc, loaded_bb, &max_clocks, uclk_states, num_states); -else if (clock_limits_available) +DC_FP_END (); + }else if (clock_limits_available) { +DC_FP_START ();dcn20_cap_soc_clocks (loaded_bb, max_clocks); +DC_FP_END (); + } } loaded_ip->max_num_otg = pool->base.res_cap->num_timing_generator; loaded_ip->max_num_dpp = pool->base.pipe_count; +DC_FP_START ();dcn20_patch_bounding_box (dc, loaded_bb); - +DC_FP_END ();return true; }
@@ -3730,8 +3736,6 @@ static bool dcn20_resource_construct(enum dml_project dml_project_version =get_dml_project_version (ctx->asic_id.hw_internal_rev); -DC_FP_START (); - ctx->dc_bios->regs = &bios_regs; pool->base.funcs = &dcn20_res_pool_funcs;
@@ -4080,12 +4084,10 @@ static bool dcn20_resource_construct( pool->base.oem_device =NULL ; } -DC_FP_END ();return true; create_fail: -DC_FP_END ();dcn20_resource_destruct (pool);return false;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 317/849 ACPI: AC: Quirk GK45 to skip reading _PSR
In reply to Greg Kroah-HartmanFrom: Stefan Schaeckeler <[email protected]>
[ Upstream commit 3d730ee686800d71ecc5c3cb8460dcdcdeaf38a3 ]
Let GK45 not go into BIOS for determining the AC power state.
The BIOS wrongly returns 0, so hardcode the power state to 1.
The mini PC GK45 by Besstar Tech Lld. (aka Kodlix) just runs off AC. It does not include any batteries. Nevertheless BIOS reports AC off:
root@kodlix:/usr/src/linux# cat /sys/class/power_supply/ADP1/online 0
root@kodlix:/usr/src/linux# modprobe acpi_dbg root@kodlix:/usr/src/linux# tools/power/acpi/acpidbg
- find _PSR
\_SB.PCI0.SBRG.H_EC.ADP1._PSR Method 000000009283cee8 001 Args 0 Len 001C Aml 00000000f54e5f67
- execute \_SB.PCI0.SBRG.H_EC.ADP1._PSR
Evaluating \_SB.PCI0.SBRG.H_EC.ADP1._PSR
Evaluation of \_SB.PCI0.SBRG.H_EC.ADP1._PSR returned object 00000000dc08c187, external buffer length 18
[Integer] = 0000000000000000
that should be
[Integer] = 0000000000000001
--- drivers/acpi/ac.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/acpi/ac.c +19 -0
@@ -61,6 +61,7 @@ static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);static int ac_sleep_before_get_state_ms;static int ac_check_pmic =1 ; +static int ac_only;static struct acpi_driver acpi_ac_driver = { .name ="ac" ,
@@ -93,6 +94,11 @@ static int acpi_ac_get_state(struct acpi_ac *ac)if (!ac)return -EINVAL ; +if (ac_only) { + ac->state =1 ; +return 0 ; + } + status =acpi_evaluate_integer (ac->device->handle,"_PSR" ,NULL , &ac->state);if (ACPI_FAILURE (status)) {
@@ -200,6 +206,12 @@ static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)return 0 ; } +static int __init ac_only_quirk (const struct dmi_system_id *d) +{ + ac_only =1 ; +return 0 ; +} +/* Please keep this list alphabetically sorted */ static const struct dmi_system_id ac_dmi_table[]__initconst = { {
@@ -209,6 +221,13 @@ static const struct dmi_system_id ac_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"), }, }, + { +/* Kodlix GK45 returning incorrect state */ + .callback = ac_only_quirk, + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "GK45"), + }, + }, {/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */ .callback = ac_do_not_check_pmic_quirk,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 326/849 x86/hyperv: Protect set_hv_tscchange_cb() against getting preempted
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 285f68afa8b20f752b0b7194d54980b5e0e27b75 ]
The following issue is observed with CONFIG_DEBUG_PREEMPT when KVM loads:
KVM: vmx: using Hyper-V Enlightened VMCS
BUG: using smp_processor_id() in preemptible [00000000] code: systemd-udevd/488 caller is set_hv_tscchange_cb+0x16/0x80 CPU: 1 PID: 488 Comm: systemd-udevd Not tainted 5.15.0-rc5+ #396 Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.0 12/17/2019 Call Trace: dump_stack_lvl+0x6a/0x9a check_preemption_disabled+0xde/0xe0 ? kvm_gen_update_masterclock+0xd0/0xd0 [kvm] set_hv_tscchange_cb+0x16/0x80 kvm_arch_init+0x23f/0x290 [kvm] kvm_init+0x30/0x310 [kvm] vmx_init+0xaf/0x134 [kvm_intel] ...
set_hv_tscchange_cb() can get preempted in between acquiring smp_processor_id() and writing to HV_X64_MSR_REENLIGHTENMENT_CONTROL. This is not an issue by itself: HV_X64_MSR_REENLIGHTENMENT_CONTROL is a partition-wide MSR and it doesn't matter which particular CPU will be used to receive reenlightenment notifications. The only real problem can (in theory) be observed if the CPU whose id was acquired with smp_processor_id() goes offline before we manage to write to the MSR, the logic in hv_cpu_die() won't be able to reassign it correctly.
--- arch/x86/hyperv/hv_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/hyperv/hv_init.c +4 -1
@@ -160,7 +160,6 @@ void set_hv_tscchange_cb(void (*cb)(void))struct hv_reenlightenment_control re_ctrl = { .vector =HYPERV_REENLIGHTENMENT_VECTOR , .enabled =1 , - .target_vp = hv_vp_index[smp_processor_id ()] };struct hv_tsc_emulation_control emu_ctrl = {.enabled =1 };
@@ -174,8 +173,12 @@ void set_hv_tscchange_cb(void (*cb)(void))/* Make sure callback is registered before we write to MSRs */ wmb (); + re_ctrl.target_vp = hv_vp_index[get_cpu ()]; +wrmsrl (HV_X64_MSR_REENLIGHTENMENT_CONTROL , *((u64 *)&re_ctrl));wrmsrl (HV_X64_MSR_TSC_EMULATION_CONTROL , *((u64 *)&emu_ctrl)); + +put_cpu (); }EXPORT_SYMBOL_GPL (set_hv_tscchange_cb);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 328/849 selftests/core: fix conflicting types compile error for close_range()
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
[ Upstream commit f35dcaa0a8a29188ed61083d153df1454cf89d08 ]
close_range() test type conflicts with close_range() library call in x86_64-linux-gnu/bits/unistd_ext.h. Fix it by changing the name to core_close_range().
gcc -g -I../../../../usr/include/ close_range_test.c -o ../tools/testing/selftests/core/close_range_test
In file included from close_range_test.c:16:
close_range_test.c:57:6: error: conflicting types for ‘close_range’; have ‘void(struct __test_metadata *)’
57 | TEST(close_range)
| ^~~~~~~~~~~
../kselftest_harness.h:181:21: note: in definition of macro ‘__TEST_IMPL’
181 | static void test_name(struct __test_metadata *_metadata); \
| ^~~~~~~~~
close_range_test.c:57:1: note: in expansion of macro ‘TEST’
57 | TEST(close_range)
| ^~~~
In file included from /usr/include/unistd.h:1204,
from close_range_test.c:13:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:56:12: note: previous declaration of ‘close_range’ with type ‘int(unsigned int, unsigned int, int)’
56 | extern int close_range (unsigned int __fd, unsigned int __max_fd,
| ^~~~~~~~~~~--- tools/testing/selftests/core/close_range_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/core/close_range_test.c +1 -1
@@ -54,7 +54,7 @@ static inline int sys_close_range(unsigned int fd, unsigned int max_fd,#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))#endif -TEST (close_range) +TEST (core_close_range) {int i, ret;int open_fds[101 ];
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 289/849 workqueue: make sysfs of unbound kworker cpumask more clever
In reply to Greg Kroah-HartmanFrom: Menglong Dong <[email protected]>
[ Upstream commit d25302e46592c97d29f70ccb1be558df31a9a360 ]
Some unfriendly component, such as dpdk, write the same mask to unbound kworker cpumask again and again. Every time it write to this interface some work is queue to cpu, even though the mask is same with the original mask.
So, fix it by return success and do nothing if the cpumask is equal with the old one.
--- kernel/workqueue.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
kernel/workqueue.c +11 -4
@@ -5340,9 +5340,6 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)int ret = -EINVAL ;cpumask_var_t saved_cpumask; -if (!zalloc_cpumask_var (&saved_cpumask,GFP_KERNEL )) -return -ENOMEM ; -/* * Not excluding isolated cpus on purpose. * If the user wishes to include them, we allow that.
@@ -5350,6 +5347,15 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)cpumask_and (cpumask, cpumask, cpu_possible_mask);if (!cpumask_empty (cpumask)) {apply_wqattrs_lock (); +if (cpumask_equal (cpumask, wq_unbound_cpumask)) { + ret =0 ; + goto out_unlock; + } + +if (!zalloc_cpumask_var (&saved_cpumask,GFP_KERNEL )) { + ret = -ENOMEM ; + goto out_unlock; + }/* save the old wq_unbound_cpumask. */ cpumask_copy (saved_cpumask, wq_unbound_cpumask);
@@ -5362,10 +5368,11 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)if (ret <0 )cpumask_copy (wq_unbound_cpumask, saved_cpumask); +free_cpumask_var (saved_cpumask); +out_unlock:apply_wqattrs_unlock (); } -free_cpumask_var (saved_cpumask);return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 288/849 lib/xz: Validate the value before assigning it to an enum variable
In reply to Greg Kroah-HartmanFrom: Lasse Collin <[email protected]>
[ Upstream commit 4f8d7abaa413c34da9d751289849dbfb7c977d05 ]
This might matter, for example, if the underlying type of enum xz_check was a signed char. In such a case the validation wouldn't have caught an unsupported header. I don't know if this problem can occur in the kernel on any arch but it's still good to fix it because some people might copy the XZ code to their own projects from Linux instead of the upstream XZ Embedded repository.
This change may increase the code size by a few bytes. An alternative would have been to use an unsigned int instead of enum xz_check but using an enumeration looks cleaner.
--- lib/xz/xz_dec_stream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/xz/xz_dec_stream.c +3 -3
@@ -402,12 +402,12 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)* we will accept other check types too, but then the check won't * be verified and a warning (XZ_UNSUPPORTED_CHECK) will be given. */ +if (s->temp.buf[HEADER_MAGIC_SIZE +1 ] >XZ_CHECK_MAX ) +return XZ_OPTIONS_ERROR ; + s->check_type = s->temp.buf[HEADER_MAGIC_SIZE +1 ];#ifdef XZ_DEC_ANY_CHECK -if (s->check_type >XZ_CHECK_MAX ) -return XZ_OPTIONS_ERROR ; -if (s->check_type >XZ_CHECK_CRC32 )return XZ_UNSUPPORTED_CHECK ;#else
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 287/849 lib/xz: Avoid overlapping memcpy() with invalid input with in-place decompression
In reply to Greg Kroah-HartmanFrom: Lasse Collin <[email protected]>
[ Upstream commit 83d3c4f22a36d005b55f44628f46cc0d319a75e8 ]
With valid files, the safety margin described in lib/decompress_unxz.c ensures that these buffers cannot overlap. But if the uncompressed size of the input is larger than the caller thought, which is possible when the input file is invalid/corrupt, the buffers can overlap. Obviously the result will then be garbage (and usually the decoder will return an error too) but no other harm will happen when such an over-run occurs.
This change only affects uncompressed LZMA2 chunks and so this should have no effect on performance.
--- lib/decompress_unxz.c | 2 +- lib/xz/xz_dec_lzma2.c | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-)
lib/decompress_unxz.c +1 -1
@@ -167,7 +167,7 @@* memeq and memzero are not used much and any remotely sane implementation * is fast enough. memcpy/memmove speed matters in multi-call mode, but * the kernel image is decompressed in single-call mode, in which only -* memcpy speed can matter and only if there is a lot of uncompressible data +* memmove speed can matter and only if there is a lot of uncompressible data * (LZMA2 stores uncompressible chunks in uncompressed form). Thus, the * functions below should just be kept small; it's probably not worth * optimizing for speed.
lib/xz/xz_dec_lzma2.c +19 -2
@@ -387,7 +387,14 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b, *left -= copy_size; -memcpy (dict->buf + dict->pos, b->in + b->in_pos, copy_size); +/* +* If doing in-place decompression in single-call mode and the +* uncompressed size of the file is larger than the caller +* thought (i.e. it is invalid input!), the buffers below may +* overlap and cause undefined behavior with memcpy(). +* With valid inputs memcpy() would be fine here. +*/ +memmove (dict->buf + dict->pos, b->in + b->in_pos, copy_size); dict->pos += copy_size;if (dict->full < dict->pos)
@@ -397,7 +404,11 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,if (dict->pos == dict->end) dict->pos =0 ; -memcpy (b->out + b->out_pos, b->in + b->in_pos, +/* +* Like above but for multi-call mode: use memmove() +* to avoid undefined behavior with invalid input. +*/ +memmove (b->out + b->out_pos, b->in + b->in_pos, copy_size); }
@@ -421,6 +432,12 @@ static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b)if (dict->pos == dict->end) dict->pos =0 ; +/* +* These buffers cannot overlap even if doing in-place +* decompression because in multi-call mode dict->buf +* has been allocated by us in this file; it's not +* provided by the caller like in single-call mode. +*/ memcpy (b->out + b->out_pos, dict->buf + dict->start, copy_size); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 329/849 perf/x86/intel: Fix ICL/SPR INST_RETIRED.PREC_DIST encodings
In reply to Greg Kroah-HartmanFrom: Stephane Eranian <[email protected]>
[ Upstream commit 2de71ee153efa93099d2ab864acffeec70a8dcd5 ]
This patch fixes the encoding for INST_RETIRED.PREC_DIST as published by Intel (download.01.org/perfmon/) for Icelake. The official encoding
is event code 0x00 umask 0x1, a change from Skylake where it was code 0xc0 umask 0x1.
With this patch applied it is possible to run:
$ perf record -a -e cpu/event=0x00,umask=0x1/pp .....
Whereas before this would fail.
To avoid problems with tools which may use the old code, we maintain the old encoding for Icelake.
--- arch/x86/events/intel/core.c | 5 +++-- arch/x86/events/intel/ds.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/x86/events/intel/core.c +3 -2
@@ -243,7 +243,8 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = {static struct event_constraint intel_icl_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* old INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */
@@ -288,7 +289,7 @@ static struct extra_reg intel_spr_extra_regs[] __read_mostly = {static struct event_constraint intel_spr_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */
arch/x86/events/intel/ds.c +3 -2
@@ -923,7 +923,8 @@ struct event_constraint intel_skl_pebs_event_constraints[] = { };struct event_constraint intel_icl_pebs_event_constraints[] = { -INTEL_FLAGS_UEVENT_CONSTRAINT (0x1c0 ,0x100000000ULL ),/* INST_RETIRED.PREC_DIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x01c0 ,0x100000000ULL ),/* old INST_RETIRED.PREC_DIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x0100 ,0x100000000ULL ),/* INST_RETIRED.PREC_DIST */ INTEL_FLAGS_UEVENT_CONSTRAINT (0x0400 ,0x800000000ULL ),/* SLOTS */ INTEL_PLD_CONSTRAINT (0x1cd ,0xff ),/* MEM_TRANS_RETIRED.LOAD_LATENCY */
@@ -943,7 +944,7 @@ struct event_constraint intel_icl_pebs_event_constraints[] = { };struct event_constraint intel_spr_pebs_event_constraints[] = { -INTEL_FLAGS_UEVENT_CONSTRAINT (0x1c0 ,0x100000000ULL ), +INTEL_FLAGS_UEVENT_CONSTRAINT (0x100 ,0x100000000ULL ),/* INST_RETIRED.PREC_DIST */ INTEL_FLAGS_UEVENT_CONSTRAINT (0x0400 ,0x800000000ULL ),INTEL_FLAGS_EVENT_CONSTRAINT (0xc0 ,0xfe ),
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 331/849 task_stack: Fix end_of_stack() for architectures with upwards-growing stack
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 9cc2fa4f4a92ccc6760d764e7341be46ee8aaaa1 ]
The function end_of_stack() returns a pointer to the last entry of a stack. For architectures like parisc where the stack grows upwards return the pointer to the highest address in the stack.
Without this change I faced a crash on parisc, because the stackleak functionality wrote STACKLEAK_POISON to the lowest address and thus overwrote the first 4 bytes of the task_struct which included the TIF_FLAGS.
--- include/linux/sched/task_stack.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/sched/task_stack.h +4 -0
@@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task)static inline unsigned long *end_of_stack (const struct task_struct *task) { +#ifdef CONFIG_STACK_GROWSUP +return (unsigned long *)((unsigned long )task->stack +THREAD_SIZE ) -1 ; +#else return task->stack; +#endif }#elif !defined(__HAVE_THREAD_FUNCTIONS)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 332/849 erofs: dont trigger WARN() when decompression fails
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
[ Upstream commit a0961f351d82d43ab0b845304caa235dfe249ae9 ]
syzbot reported a WARNING [1] due to corrupted compressed data.
As Dmitry said, "If this is not a kernel bug, then the code should not use WARN. WARN if for kernel bugs and is recognized as such by all testing systems and humans."
[1] https://lore.kernel.org/r/[email protected]
--- fs/erofs/decompressor.c | 1 - 1 file changed, 1 deletion(-)
fs/erofs/decompressor.c +0 -1
@@ -233,7 +233,6 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out)erofs_err (rq->sb,"failed to decompress %d in[%u, %u] out[%u]" , ret, rq->inputsize, inputmargin, rq->outputsize); -WARN_ON (1 );print_hex_dump (KERN_DEBUG ,"[ in]: " ,DUMP_PREFIX_OFFSET ,16 ,1 , src + inputmargin, rq->inputsize, true); print_hex_dump(KERN_DEBUG, "[out]: ", DUMP_PREFIX_OFFSET,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 336/849 selftests/bpf: Fix strobemeta selftest regression
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 0133c20480b14820d43c37c0e9502da4bffcad3a ]
After most recent nightly Clang update strobemeta selftests started failing with the following error (relevant portion of assembly included):
1624: (85) call bpf_probe_read_user_str#114
1625: (bf) r1 = r0
1626: (18) r2 = 0xfffffffe
1628: (5f) r1 &= r2
1629: (55) if r1 != 0x0 goto pc+7
1630: (07) r9 += 104
1631: (6b) *(u16 *)(r9 +0) = r0
1632: (67) r0 <<= 32
1633: (77) r0 >>= 32
1634: (79) r1 = *(u64 *)(r10 -456)
1635: (0f) r1 += r0
1636: (7b) *(u64 *)(r10 -456) = r1
1637: (79) r1 = *(u64 *)(r10 -368)
1638: (c5) if r1 s< 0x1 goto pc+778
1639: (bf) r6 = r8
1640: (0f) r6 += r7
1641: (b4) w1 = 0
1642: (6b) *(u16 *)(r6 +108) = r1
1643: (79) r3 = *(u64 *)(r10 -352)
1644: (79) r9 = *(u64 *)(r10 -456)
1645: (bf) r1 = r9
1646: (b4) w2 = 1
1647: (85) call bpf_probe_read_user_str#114
R1 unbounded memory access, make sure to bounds check any such access
In the above code r0 and r1 are implicitly related. Clang knows that, but verifier isn't able to infer this relationship.
Yonghong Song narrowed down this "regression" in code generation to a recent Clang optimization change ([0]), which for BPF target generates code pattern that BPF verifier can't handle and loses track of register boundaries.
This patch works around the issue by adding an BPF assembly-based helper that helps to prove to the verifier that upper bound of the register is a given constant by controlling the exact share of generated BPF instruction sequence. This fixes the immediate issue for strobemeta selftest.
[0] https://github.com/llvm/llvm-project/commit/acabad9ff6bf13e00305d9d8621ee8eafc1f8b08
--- tools/testing/selftests/bpf/progs/strobemeta.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/testing/selftests/bpf/progs/strobemeta.h +11 -0
@@ -10,6 +10,14 @@#include <linux/types.h> #include <bpf/bpf_helpers.h> +#define bpf_clamp_umax (VAR ,UMAX ) \ + asm volatile ( \ + "if %0 <= %[max] goto +1\n" \ + "%0 = %[max]\n" \ + : "+r"(VAR) \ + : [max]"i"(UMAX) \ + ) +typedef uint32_t pid_t ;struct task_struct {};
@@ -413,6 +421,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.tag);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->tag_len = len; payload += len; }
@@ -430,6 +439,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.entries[i].key);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->key_lens[i] = len; payload += len; }
@@ -437,6 +447,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.entries[i].val);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->val_lens[i] = len; payload += len; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 337/849 fbdev/efifb: Release PCI devices runtime PM ref during FB destroy
In reply to Greg Kroah-HartmanFrom: Imre Deak <[email protected]>
[ Upstream commit 55285e21f04517939480966164a33898c34b2af2 ]
Atm the EFI FB platform driver gets a runtime PM reference for the associated GFX PCI device during probing the EFI FB platform device and releases it only when the platform device gets unbound.
When fbcon switches to the FB provided by the PCI device's driver (for instance i915/drmfb), the EFI FB will get only unregistered without the EFI FB platform device getting unbound, keeping the runtime PM reference acquired during the platform device probing. This reference will prevent the PCI driver from runtime suspending the device.
Fix this by releasing the RPM reference from the EFI FB's destroy hook, called when the FB gets unregistered.
While at it assert that pm_runtime_get_sync() didn't fail.
v2:
- Move pm_runtime_get_sync() before register_framebuffer() to avoid its race wrt. efifb_destroy()->pm_runtime_put(). (Daniel)
- Assert that pm_runtime_get_sync() didn't fail.
- Clarify commit message wrt. platform/PCI device/driver and driver removal vs. device unbinding.
--- drivers/video/fbdev/efifb.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/video/fbdev/efifb.c +14 -7
@@ -47,6 +47,8 @@ static bool use_bgrt = true;static bool request_mem_succeeded = false;static u64 mem_flags =EFI_MEMORY_WC |EFI_MEMORY_UC ; +static struct pci_dev *efifb_pci_dev;/* dev with BAR covering the efifb */ +static struct fb_var_screeninfo efifb_defined = { .activate =FB_ACTIVATE_NOW , .height =-1 ,
@@ -243,6 +245,9 @@ static inline void efifb_show_boot_graphics(struct fb_info *info) {}static void efifb_destroy (struct fb_info *info) { +if (efifb_pci_dev) +pm_runtime_put (&efifb_pci_dev->dev); +if (info->screen_base) {if (mem_flags & (EFI_MEMORY_UC |EFI_MEMORY_WC ))iounmap (info->screen_base);
@@ -333,7 +338,6 @@ ATTRIBUTE_GROUPS(efifb);static bool pci_dev_disabled;/* FB base matches BAR of a disabled device */ -static struct pci_dev *efifb_pci_dev;/* dev with BAR covering the efifb */ static struct resource *bar_resource;static u64 bar_offset;
@@ -569,17 +573,22 @@ static int efifb_probe(struct platform_device *dev)pr_err ("efifb: cannot allocate colormap\n" ); goto err_groups; } + +if (efifb_pci_dev) +WARN_ON (pm_runtime_get_sync (&efifb_pci_dev->dev) <0 ); + err =register_framebuffer (info);if (err <0 ) {pr_err ("efifb: cannot register framebuffer\n" ); - goto err_fb_dealoc; + goto err_put_rpm_ref; }fb_info (info,"%s frame buffer device\n" , info->fix.id); -if (efifb_pci_dev) -pm_runtime_get_sync (&efifb_pci_dev->dev);return 0 ; -err_fb_dealoc: +err_put_rpm_ref: +if (efifb_pci_dev) +pm_runtime_put (&efifb_pci_dev->dev); +fb_dealloc_cmap (&info->cmap); err_groups:sysfs_remove_groups (&dev->dev.kobj, efifb_groups);
@@ -603,8 +612,6 @@ static int efifb_remove(struct platform_device *pdev)unregister_framebuffer (info);sysfs_remove_groups (&pdev->dev.kobj, efifb_groups);framebuffer_release (info); -if (efifb_pci_dev) -pm_runtime_put (&efifb_pci_dev->dev);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 330/849 parisc: fix warning in flush_tlb_all
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 1030d681319b43869e0d5b568b9d0226652d1a6f ]
I've got the following splat after enabling preemption:
[ 3.724721] BUG: using __this_cpu_add() in preemptible [00000000] code: swapper/0/1 [ 3.734630] caller is __this_cpu_preempt_check+0x38/0x50 [ 3.740635] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc4-64bit+ #324 [ 3.744605] Hardware name: 9000/785/C8000 [ 3.744605] Backtrace: [ 3.744605] [<00000000401d9d58>] show_stack+0x74/0xb0 [ 3.744605] [<0000000040c27bd4>] dump_stack_lvl+0x10c/0x188 [ 3.744605] [<0000000040c27c84>] dump_stack+0x34/0x48 [ 3.744605] [<0000000040c33438>] check_preemption_disabled+0x178/0x1b0 [ 3.744605] [<0000000040c334f8>] __this_cpu_preempt_check+0x38/0x50 [ 3.744605] [<00000000401d632c>] flush_tlb_all+0x58/0x2e0 [ 3.744605] [<00000000401075c0>] 0x401075c0 [ 3.744605] [<000000004010b8fc>] 0x4010b8fc [ 3.744605] [<00000000401080fc>] 0x401080fc [ 3.744605] [<00000000401d5224>] do_one_initcall+0x128/0x378 [ 3.744605] [<0000000040102de8>] 0x40102de8 [ 3.744605] [<0000000040c33864>] kernel_init+0x60/0x3a8 [ 3.744605] [<00000000401d1020>] ret_from_kernel_thread+0x20/0x28 [ 3.744605]
Fix this by moving the __inc_irq_stat() into the locked section.
--- arch/parisc/mm/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/mm/init.c +2 -2
@@ -842,9 +842,9 @@ void flush_tlb_all(void) {int do_recycle; -__inc_irq_stat (irq_tlb_count); do_recycle =0 ;spin_lock (&sid_lock); +__inc_irq_stat (irq_tlb_count);if (dirty_space_ids >RECYCLE_THRESHOLD ) {BUG_ON (recycle_inuse);/* FIXME: Use a semaphore/wait queue here */ get_dirty_sids (&recycle_ndirty,recycle_dirty_array);
@@ -863,8 +863,8 @@ void flush_tlb_all(void)#else void flush_tlb_all (void ) { -__inc_irq_stat (irq_tlb_count);spin_lock (&sid_lock); +__inc_irq_stat (irq_tlb_count);flush_tlb_all_local (NULL );recycle_sids ();spin_unlock (&sid_lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 333/849 parisc/unwind: fix unwinder when CONFIG_64BIT is enabled
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 8e0ba125c2bf1030af3267058019ba86da96863f ]
With 64 bit kernels unwind_special() is not working because it compares the pc to the address of the function descriptor. Add a helper function that compares pc with the dereferenced address. This fixes all of the backtraces on my c8000. Without this changes, a lot of backtraces are missing in kdb or the show-all-tasks command from /proc/sysrq-trigger.
--- arch/parisc/kernel/unwind.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
arch/parisc/kernel/unwind.c +14 -7
@@ -21,6 +21,8 @@#include <asm/ptrace.h> #include <asm/unwind.h> +#include <asm/switch_to.h> +#include <asm/sections.h> /* #define DEBUG 1 */ #ifdef DEBUG
@@ -203,6 +205,11 @@ int __init unwind_init(void)return 0 ; } +static bool pc_is_kernel_fn (unsigned long pc,void *fn) +{ +return (unsigned long )dereference_kernel_function_descriptor (fn) == pc; +} +static int unwind_special (struct unwind_frame_info *info,unsigned long pc,int frame_size) {/*
@@ -221,7 +228,7 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intextern void *const _call_on_stack;#endif /* CONFIG_IRQSTACKS */ -if (pc == (unsigned long ) &handle_interruption) { +if (pc_is_kernel_fn (pc, handle_interruption)) {struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size -PT_SZ_ALGN );dbg ("Unwinding through handle_interruption()\n" ); info->prev_sp = regs->gr[30 ];
@@ -229,13 +236,13 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc == (unsigned long ) &ret_from_kernel_thread || - pc == (unsigned long ) &syscall_exit) { +if (pc_is_kernel_fn (pc, ret_from_kernel_thread) || +pc_is_kernel_fn (pc, syscall_exit)) { info->prev_sp = info->prev_ip =0 ;return 1 ; } -if (pc == (unsigned long ) &intr_return) { +if (pc_is_kernel_fn (pc, intr_return)) {struct pt_regs *regs;dbg ("Found intr_return()\n" );
@@ -246,20 +253,20 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc == (unsigned long ) &_switch_to_ret) { +if (pc_is_kernel_fn (pc, _switch_to) || +pc_is_kernel_fn (pc, _switch_to_ret)) { info->prev_sp = info->sp -CALLEE_SAVE_FRAME_SIZE ; info->prev_ip = *(unsigned long *)(info->prev_sp -RP_OFFSET );return 1 ; }#ifdef CONFIG_IRQSTACKS -if (pc == (unsigned long ) &_call_on_stack) { +if (pc_is_kernel_fn (pc, _call_on_stack)) { info->prev_sp = *(unsigned long *)(info->sp -FRAME_SIZE -REG_SZ ); info->prev_ip = *(unsigned long *)(info->sp -FRAME_SIZE -RP_OFFSET );return 1 ; }#endif -return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 334/849 parisc/kgdb: add kgdb_roundup() to make kgdb work with idle polling
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 66e29fcda1824f0427966fbee2bd2c85bf362c82 ]
With idle polling, IPIs are not sent when a CPU idle, but queued and run later from do_idle(). The default kgdb_call_nmi_hook() implementation gets the pointer to struct pt_regs from get_irq_reqs(), which doesn't work in that case because it was not called from the IPI interrupt handler. Fix it by defining our own kgdb_roundup() function which sents an IPI_ENTER_KGDB. When that IPI is received on the target CPU kgdb_nmicallback() is called.
--- arch/parisc/kernel/smp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
arch/parisc/kernel/smp.c +17 -2
@@ -29,6 +29,7 @@#include <linux/bitops.h> #include <linux/ftrace.h> #include <linux/cpu.h> +#include <linux/kgdb.h> #include <linux/atomic.h> #include <asm/current.h>
@@ -69,7 +70,10 @@ enum ipi_message_type {IPI_CALL_FUNC ,IPI_CPU_START ,IPI_CPU_STOP , - IPI_CPU_TEST +IPI_CPU_TEST , +#ifdef CONFIG_KGDB + IPI_ENTER_KGDB, +#endif };
@@ -167,7 +171,12 @@ ipi_interrupt(int irq, void *dev_id)case IPI_CPU_TEST :smp_debug (100 ,KERN_DEBUG "CPU%d is alive!\n" , this_cpu);break ; - +#ifdef CONFIG_KGDB +case IPI_ENTER_KGDB : +smp_debug (100 ,KERN_DEBUG "CPU%d ENTER_KGDB\n" , this_cpu); +kgdb_nmicallback (raw_smp_processor_id (),get_irq_regs ()); +break ; +#endif default :printk (KERN_CRIT "Unknown IPI num on CPU%d: %lu\n" , this_cpu, which);
@@ -226,6 +235,12 @@ send_IPI_allbutself(enum ipi_message_type op) } } +#ifdef CONFIG_KGDB +void kgdb_roundup_cpus (void ) +{ +send_IPI_allbutself (IPI_ENTER_KGDB ); +} +#endif inline void smp_send_stop (void ) {send_IPI_allbutself (IPI_CPU_STOP ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 318/849 ACPI: resources: Add one more Medion model in IRQ override quirk
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
[ Upstream commit 1b26ae40092b43bb6e9c5df376227382b390b953 ]
The Medion s17 series laptops have the same issue on the keyboard as the s15 series, if skipping to call acpi_get_override_irq(), the keyboard could work well. So put the DMI info of s17 series in the IRQ override quirk table as well.
--- drivers/acpi/resource.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/resource.c +7 -0
@@ -389,6 +389,13 @@ static const struct dmi_system_id medion_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "M15T"), }, }, + { + .ident = "MEDION S17405", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), + DMI_MATCH(DMI_BOARD_NAME, "M17T"), + }, + }, { } };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 335/849 netfilter: conntrack: set on IPS_ASSURED if flows enters internal stream state
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b7b1d02fc43925a4d569ec221715db2dfa1ce4f5 ]
The internal stream state sets the timeout to 120 seconds 2 seconds after the creation of the flow, attach this internal stream state to the IPS_ASSURED flag for consistent event reporting.
Before this patch:
[NEW] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED] [DESTROY] udp 17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
Note IPS_ASSURED for the flow not yet in the internal stream state.
after this update:
[NEW] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 120 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED] [DESTROY] udp 17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
Before this patch, short-lived UDP flows never entered IPS_ASSURED, so they were already candidate flow to be deleted by early_drop under stress.
Before this patch, IPS_ASSURED is set on regardless the internal stream state, attach this internal stream state to IPS_ASSURED.
packet #1 (original direction) enters NEW state
packet #2 (reply direction) enters ESTABLISHED state, sets on IPS_SEEN_REPLY paclet #3 (any direction) sets on IPS_ASSURED (if 2 seconds since the
creation has passed by).
--- net/netfilter/nf_conntrack_proto_udp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_udp.c +5 -2
@@ -104,10 +104,13 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,*/ if (test_bit (IPS_SEEN_REPLY_BIT , &ct->status)) {unsigned long extra = timeouts[UDP_CT_UNREPLIED ]; +bool stream = false;/* Still active after two seconds? Extend timeout. */ -if (time_after (jiffies, ct->proto.udp.stream_ts)) +if (time_after (jiffies, ct->proto.udp.stream_ts)) { extra = timeouts[UDP_CT_REPLIED ]; + stream = true; + }nf_ct_refresh_acct (ct, ctinfo, skb, extra);
@@ -116,7 +119,7 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,return NF_ACCEPT ;/* Also, more likely to be important, and not a probe */ -if (!test_and_set_bit (IPS_ASSURED_BIT , &ct->status)) +if (stream && !test_and_set_bit (IPS_ASSURED_BIT , &ct->status))nf_conntrack_event_cache (IPCT_ASSURED , ct); }else {nf_ct_refresh_acct (ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED ]);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 338/849 drm/bridge: anx7625: Propagate errors from sp_tx_rst_aux()
In reply to Greg Kroah-HartmanFrom: Robert Foss <[email protected]>
[ Upstream commit 7f16d0f3b8e2d13f940e944cd17044ca8eeb8b32 ]
The return value of sp_tx_rst_aux() is not propagated, which means both compiler warnings and potential errors not being handled.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +8 -4
@@ -702,7 +702,7 @@ static int edid_read(struct anx7625_data *ctx, ret =sp_tx_aux_rd (ctx,0xf1 );if (ret) { -sp_tx_rst_aux (ctx); + ret =sp_tx_rst_aux (ctx);DRM_DEV_DEBUG_DRIVER (dev,"edid read fail, reset!\n" ); }else { ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
@@ -717,7 +717,7 @@ static int edid_read(struct anx7625_data *ctx,if (cnt >EDID_TRY_CNT )return -EIO ; -return 0 ; +return ret; } static int segments_edid_read(struct anx7625_data *ctx,
@@ -767,7 +767,7 @@ static int segments_edid_read(struct anx7625_data *ctx,if (cnt >EDID_TRY_CNT )return -EIO ; -return 0 ; +return ret; } static int sp_tx_edid_read(struct anx7625_data *ctx,
@@ -869,7 +869,11 @@ static int sp_tx_edid_read(struct anx7625_data *ctx, }/* Reset aux channel */ -sp_tx_rst_aux (ctx); + ret =sp_tx_rst_aux (ctx); +if (ret <0 ) { +DRM_DEV_ERROR (dev,"Failed to reset aux channel!\n" ); +return ret; + }return (blocks_num +1 ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 346/849 objtool: Handle __sanitize_cov*() tail calls
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit f56dae88a81fded66adf2bea9922d1d98d1da14f ]
Turns out the compilers also generate tail calls to __sanitize_cov*(), make sure to also patch those out in noinstr code.
--- tools/objtool/arch/x86/decode.c | 20 ++++ tools/objtool/check.c | 158 ++++++++++++++------------- tools/objtool/include/objtool/arch.h | 1 + 3 files changed, 105 insertions(+), 74 deletions(-)
tools/objtool/arch/x86/decode.c +20 -0
@@ -659,6 +659,26 @@ const char *arch_nop_insn(int len)return nops[len-1 ]; } +#define BYTE_RET 0xC3 + +const char *arch_ret_insn (int len) +{ +static const char ret[5 ][5 ] = { + {BYTE_RET }, + {BYTE_RET ,BYTES_NOP1 }, + {BYTE_RET ,BYTES_NOP2 }, + {BYTE_RET ,BYTES_NOP3 }, + {BYTE_RET ,BYTES_NOP4 }, + }; + +if (len <1 || len >5 ) { +WARN ("invalid RET size: %d\n" , len); +return NULL ; + } + +return ret[len-1 ]; +} +/* asm/alternative.h ? */ #define ALTINSTR_FLAG_INV (1 << 15)
tools/objtool/check.c +84 -74
213 lines not on this page · raw message
tools/objtool/include/objtool/arch.h +1 -0
@@ -82,6 +82,7 @@ unsigned long arch_jump_destination(struct instruction *insn);unsigned long arch_dest_reloc_offset (int addend);const char *arch_nop_insn (int len); +const char *arch_ret_insn (int len);int arch_decode_hint_reg (struct instruction *insn,u8 sp_reg);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 341/849 Bluetooth: fix init and cleanup of sco_conn.timeout_work
In reply to Greg Kroah-HartmanFrom: Desmond Cheong Zhi Xi <[email protected]>
[ Upstream commit 49d8a5606428ca0962d09050a5af81461ff90fbb ]
Before freeing struct sco_conn, all delayed timeout work should be cancelled. Otherwise, sco_sock_timeout could potentially use the sco_conn after it has been freed.
Additionally, sco_conn.timeout_work should be initialized when the connection is allocated, not when the channel is added. This is because an sco_conn can create channels with multiple sockets over its lifetime, which happens if sockets are released but the connection isn't deleted.
--- net/bluetooth/sco.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/bluetooth/sco.c +4 -5
@@ -134,6 +134,7 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon)return NULL ;spin_lock_init (&conn->lock); +INIT_DELAYED_WORK (&conn->timeout_work, sco_sock_timeout); hcon->sco_data = conn; conn->hcon = hcon;
@@ -197,11 +198,11 @@ static void sco_conn_del(struct hci_conn *hcon, int err)sco_chan_del (sk, err);bh_unlock_sock (sk);sock_put (sk); - -/* Ensure no more work items will run before freeing conn. */ -cancel_delayed_work_sync (&conn->timeout_work); } +/* Ensure no more work items will run before freeing conn. */ +cancel_delayed_work_sync (&conn->timeout_work); + hcon->sco_data =NULL ;kfree (conn); }
@@ -214,8 +215,6 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk,sco_pi (sk)->conn = conn; conn->sk = sk; -INIT_DELAYED_WORK (&conn->timeout_work, sco_sock_timeout); -if (parent)bt_accept_enqueue (parent, sk, true); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 342/849 libbpf: Dont crash on object files with no symbol tables
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 03e601f48b2da6fb44d0f7b86957a8f6bacfb347 ]
If libbpf encounters an ELF file that has been stripped of its symbol table, it will crash in bpf_object__add_programs() when trying to dereference the obj->efile.symbols pointer.
Fix this by erroring out of bpf_object__elf_collect() if it is not able able to find the symbol table.
v2:
- Move check into bpf_object__elf_collect() and add nice error message
--- tools/lib/bpf/libbpf.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/lib/bpf/libbpf.c +6 -0
@@ -2990,6 +2990,12 @@ static int bpf_object__elf_collect(struct bpf_object *obj) } } +if (!obj->efile.symbols) { +pr_warn ("elf: couldn't find symbol table in %s, stripped object file?\n" , + obj->path); +return -ENOENT ; + } + scn =NULL ;while ((scn =elf_nextscn (elf, scn)) !=NULL ) { idx++;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 343/849 rcu: Fix existing exp request check in sync_sched_exp_online_cleanup()
In reply to Greg Kroah-HartmanFrom: Neeraj Upadhyay <[email protected]>
[ Upstream commit f0b2b2df5423fb369ac762c77900bc7765496d58 ]
The sync_sched_exp_online_cleanup() checks to see if RCU needs an expedited quiescent state from the incoming CPU, sending it an IPI if so. Before sending IPI, it checks whether expedited qs need has been already requested for the incoming CPU, by checking rcu_data.cpu_no_qs.b.exp for the current cpu, on which sync_sched_exp_online_cleanup() is running. This works for the case where incoming CPU is same as self. However, for the case where incoming CPU is different from self, expedited request won't get marked, which can potentially delay reporting of expedited quiescent state for the incoming CPU.
--- kernel/rcu/tree_exp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_exp.h +1 -1
@@ -760,7 +760,7 @@ static void sync_sched_exp_online_cleanup(int cpu) my_cpu =get_cpu ();/* Quiescent state either not needed or already requested, leave. */ if (!(READ_ONCE (rnp->expmask) & rdp->grpmask) || -__this_cpu_read (rcu_data.cpu_no_qs.b.exp)) { + rdp->cpu_no_qs.b.exp) {put_cpu ();return ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 344/849 MIPS: lantiq: dma: fix burst length for DEU
In reply to Greg Kroah-HartmanFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 5ad74d39c51dd41b3c819f4f5396655f0629b4fd ]
The current definition of 2W burst length is invalid. This patch fixes it. Current downstream DEU driver doesn't use DMA. An incorrect burst length value doesn't cause any errors. This patch also adds other burst length values.
--- arch/mips/lantiq/xway/dma.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/lantiq/xway/dma.c +7 -2
@@ -41,7 +41,11 @@#define DMA_IRQ_ACK 0x7e/* IRQ status register */ #define DMA_POLL BIT(31)/* turn on channel polling */ #define DMA_CLK_DIV4 BIT(6)/* polling clock divider */ -#define DMA_2W_BURST BIT(1)/* 2 word burst length */ +#define DMA_PCTRL_2W_BURST 0x1/* 2 word burst length */ +#define DMA_PCTRL_4W_BURST 0x2/* 4 word burst length */ +#define DMA_PCTRL_8W_BURST 0x3/* 8 word burst length */ +#define DMA_TX_BURST_SHIFT 4/* tx burst shift */ +#define DMA_RX_BURST_SHIFT 2/* rx burst shift */ #define DMA_ETOP_ENDIANNESS (0xf << 8)/* endianness swap etop channels */ #define DMA_WEIGHT (BIT(17) | BIT(16))/* default channel wheight */
@@ -192,7 +196,8 @@ ltq_dma_init_port(int p)break ;case DMA_PORT_DEU : -ltq_dma_w32 ((DMA_2W_BURST <<4 ) | (DMA_2W_BURST <<2 ), +ltq_dma_w32 ((DMA_PCTRL_2W_BURST <<DMA_TX_BURST_SHIFT ) | + (DMA_PCTRL_2W_BURST <<DMA_RX_BURST_SHIFT ),LTQ_DMA_PCTRL );break ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 340/849 drm/bridge: it66121: Wait for next bridge to be probed
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 8b03e3fc79189b17d31a82f5e175698802a11e87 ]
If run before the next bridge is initialized, of_drm_find_bridge() will give us a NULL pointer.
If that's the case, return -EPROBE_DEFER; we may have more luck next time.
--- drivers/gpu/drm/bridge/ite-it66121.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/ite-it66121.c +3 -0
@@ -924,6 +924,9 @@ static int it66121_probe(struct i2c_client *client, ctx->next_bridge =of_drm_find_bridge (ep);of_node_put (ep); +if (!ctx->next_bridge) +return -EPROBE_DEFER ; +i2c_set_clientdata (client, ctx);mutex_init (&ctx->lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 339/849 drm/bridge: it66121: Initialize {device,vendor}_ids
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 3a5f3d61de657bc1c2b53b77d065c5526f982e10 ]
These two arrays are populated with data read from the I2C device through regmap_read(), and the data is then compared with hardcoded vendor/product ID values of supported chips.
However, the return value of regmap_read() was never checked. This is fine, as long as the two arrays are zero-initialized, so that we don't compare the vendor/product IDs against whatever garbage is left on the stack.
Address this issue by zero-initializing these two arrays.
--- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it66121.c +1 -1
@@ -889,7 +889,7 @@ unlock:static int it66121_probe (struct i2c_client *client,const struct i2c_device_id *id) { -u32 vendor_ids[2 ], device_ids[2 ], revision_id; +u32 revision_id, vendor_ids[2 ] = {0 }, device_ids[2 ] = {0 };struct device_node *ep;int ret;struct it66121_ctx *ctx;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 345/849 x86/xen: Mark cpu_bringup_and_idle() as dead_end_function
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 9af9dcf11bda3e2c0e24c1acaacb8685ad974e93 ]
The asm_cpu_bringup_and_idle() function is required to push the return value on the stack in order to make ORC happy, but the only reason objtool doesn't complain is because of a happy accident.
The thing is that asm_cpu_bringup_and_idle() doesn't return, so validate_branch() never terminates and falls through to the next function, which in the normal case is the hypercall_page. And that, as it happens, is 4095 NOPs and a RET.
Make asm_cpu_bringup_and_idle() terminate on it's own, by making the function it calls as a dead-end. This way we no longer rely on what code happens to come after.
--- tools/objtool/check.c | 1 + 1 file changed, 1 insertion(+)
tools/objtool/check.c +1 -0
@@ -173,6 +173,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,"rewind_stack_do_exit" ,"kunit_try_catch_throw" ,"xen_start_kernel" , + "cpu_bringup_and_idle", };if (!func)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 319/849 btrfs: reflink: initialize return value to 0 in btrfs_extent_same()
In reply to Greg Kroah-HartmanFrom: Sidong Yang <[email protected]>
[ Upstream commit 44bee215f72f13874c0e734a0712c2e3264c0108 ]
Fix a warning reported by smatch that ret could be returned without initialized. The dedupe operations are supposed to to return 0 for a 0 length range but the caller does not pass olen == 0. To keep this behaviour and also fix the warning initialize ret to 0.
--- fs/btrfs/reflink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/reflink.c +1 -1
@@ -649,7 +649,7 @@ static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 len,static int btrfs_extent_same (struct inode *src,u64 loff,u64 olen,struct inode *dst,u64 dst_loff) { -int ret; +int ret =0 ;u64 i, tail_len, chunk_count;struct btrfs_root *root_dst =BTRFS_I (dst)->root;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 323/849 wcn36xx: Fix packet drop on resume
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit df0697801d8aa2eebfe7f0b7388879639f8fe7cc ]
If the system is resumed because of an incoming packet, the wcn36xx RX interrupts is fired before actual resuming of the wireless/mac80211 stack, causing any received packets to be simply dropped. E.g. a ping request causes a system resume, but is dropped and so never forwarded to the IP stack.
This change fixes that, disabling DMA interrupts on suspend to no pass packets until mac80211 is resumed and ready to handle them.
Note that it's not incompatible with RX irq wake.
--- drivers/net/wireless/ath/wcn36xx/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/wcn36xx/main.c +11 -0
@@ -1115,6 +1115,13 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) goto out; ret =wcn36xx_smd_wlan_host_suspend_ind (wcn); } + +/* Disable IRQ, we don't want to handle any packet before mac80211 is +* resumed and ready to receive packets. +*/ +disable_irq (wcn->tx_irq); +disable_irq (wcn->rx_irq); + out:mutex_unlock (&wcn->conf_mutex);return ret;
@@ -1137,6 +1144,10 @@ static int wcn36xx_resume(struct ieee80211_hw *hw)wcn36xx_smd_ipv6_ns_offload (wcn, vif, false);wcn36xx_smd_arp_offload (wcn, vif, false); } + +enable_irq (wcn->tx_irq); +enable_irq (wcn->rx_irq); +mutex_unlock (&wcn->conf_mutex);return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 325/849 ftrace: do CPU checking after preemption disabled
In reply to Greg Kroah-HartmanFrom: 王贇 <[email protected]>
[ Upstream commit d33cc657372366a8959f099c619a208b4c5dc664 ]
With CONFIG_DEBUG_PREEMPT we observed reports like:
BUG: using smp_processor_id() in preemptible caller is perf_ftrace_function_call+0x6f/0x2e0 CPU: 1 PID: 680 Comm: a.out Not tainted Call Trace: <TASK> dump_stack_lvl+0x8d/0xcf check_preemption_disabled+0x104/0x110 ? optimize_nops.isra.7+0x230/0x230 ? text_poke_bp_batch+0x9f/0x310 perf_ftrace_function_call+0x6f/0x2e0 ... __text_poke+0x5/0x620 text_poke_bp_batch+0x9f/0x310
This telling us the CPU could be changed after task is preempted, and the checking on CPU before preemption will be invalid.
Since now ftrace_test_recursion_trylock() will help to disable the preemption, this patch just do the checking after trylock() to address the issue.
--- kernel/trace/trace_event_perf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_event_perf.c +3 -3
@@ -441,13 +441,13 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,if (!rcu_is_watching ())return ; -if ((unsigned long )ops->private !=smp_processor_id ()) -return ; - bit =ftrace_test_recursion_trylock (ip, parent_ip);if (bit <0 )return ; +if ((unsigned long )ops->private !=smp_processor_id ()) + goto out; + event = container_of(ops, struct perf_event, ftrace_ops);/*
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 316/849 net: annotate data-race in neigh_output()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d18785e213866935b4c3dc0c33c3e18801ce0ce8 ]
neigh_output() reads n->nud_state and hh->hh_len locklessly.
This is fine, but we need to add annotations and document this.
We evaluate skip_cache first to avoid reading these fields if the cache has to by bypassed.
syzbot report:
BUG: KCSAN: data-race in __neigh_event_send / ip_finish_output2
write to 0xffff88810798a885 of 1 bytes by interrupt on cpu 1:
__neigh_event_send+0x40d/0xac0 net/core/neighbour.c:1128 neigh_event_send include/net/neighbour.h:444 [inline] neigh_resolve_output+0x104/0x410 net/core/neighbour.c:1476 neigh_output include/net/neighbour.h:510 [inline] ip_finish_output2+0x80a/0xaa0 net/ipv4/ip_output.c:221 ip_finish_output+0x3b5/0x510 net/ipv4/ip_output.c:309 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:423 dst_output include/net/dst.h:450 [inline] ip_local_out+0x164/0x220 net/ipv4/ip_output.c:126 __ip_queue_xmit+0x9d3/0xa20 net/ipv4/ip_output.c:525 ip_queue_xmit+0x34/0x40 net/ipv4/ip_output.c:539 __tcp_transmit_skb+0x142a/0x1a00 net/ipv4/tcp_output.c:1405 tcp_transmit_skb net/ipv4/tcp_output.c:1423 [inline] tcp_xmit_probe_skb net/ipv4/tcp_output.c:4011 [inline] tcp_write_wakeup+0x4a9/0x810 net/ipv4/tcp_output.c:4064 tcp_send_probe0+0x2c/0x2b0 net/ipv4/tcp_output.c:4079 tcp_probe_timer net/ipv4/tcp_timer.c:398 [inline] tcp_write_timer_handler+0x394/0x520 net/ipv4/tcp_timer.c:626 tcp_write_timer+0xb9/0x180 net/ipv4/tcp_timer.c:642 call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1421 expire_timers+0x135/0x240 kernel/time/timer.c:1466 __run_timers+0x368/0x430 kernel/time/timer.c:1734 run_timer_softirq+0x19/0x30 kernel/time/timer.c:1747 __do_softirq+0x12c/0x26e kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu kernel/softirq.c:636 [inline] irq_exit_rcu+0x4e/0xa0 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline] acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline] acpi_idle_do_entry drivers/acpi/processor_idle.c:553 [inline] acpi_idle_enter+0x258/0x2e0 drivers/acpi/processor_idle.c:688 cpuidle_enter_state+0x2b4/0x760 drivers/cpuidle/cpuidle.c:237 cpuidle_enter+0x3c/0x60 drivers/cpuidle/cpuidle.c:351 call_cpuidle kernel/sched/idle.c:158 [inline] cpuidle_idle_call kernel/sched/idle.c:239 [inline] do_idle+0x1a3/0x250 kernel/sched/idle.c:306 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:403 secondary_startup_64_no_verify+0xb1/0xbb
read to 0xffff88810798a885 of 1 bytes by interrupt on cpu 0:
neigh_output include/net/neighbour.h:507 [inline] ip_finish_output2+0x79a/0xaa0 net/ipv4/ip_output.c:221 ip_finish_output+0x3b5/0x510 net/ipv4/ip_output.c:309 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:423 dst_output include/net/dst.h:450 [inline] ip_local_out+0x164/0x220 net/ipv4/ip_output.c:126 __ip_queue_xmit+0x9d3/0xa20 net/ipv4/ip_output.c:525 ip_queue_xmit+0x34/0x40 net/ipv4/ip_output.c:539 __tcp_transmit_skb+0x142a/0x1a00 net/ipv4/tcp_output.c:1405 tcp_transmit_skb net/ipv4/tcp_output.c:1423 [inline] tcp_xmit_probe_skb net/ipv4/tcp_output.c:4011 [inline] tcp_write_wakeup+0x4a9/0x810 net/ipv4/tcp_output.c:4064 tcp_send_probe0+0x2c/0x2b0 net/ipv4/tcp_output.c:4079 tcp_probe_timer net/ipv4/tcp_timer.c:398 [inline] tcp_write_timer_handler+0x394/0x520 net/ipv4/tcp_timer.c:626 tcp_write_timer+0xb9/0x180 net/ipv4/tcp_timer.c:642 call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1421 expire_timers+0x135/0x240 kernel/time/timer.c:1466 __run_timers+0x368/0x430 kernel/time/timer.c:1734 run_timer_softirq+0x19/0x30 kernel/time/timer.c:1747 __do_softirq+0x12c/0x26e kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu kernel/softirq.c:636 [inline] irq_exit_rcu+0x4e/0xa0 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline] acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline] acpi_idle_do_entry drivers/acpi/processor_idle.c:553 [inline] acpi_idle_enter+0x258/0x2e0 drivers/acpi/processor_idle.c:688 cpuidle_enter_state+0x2b4/0x760 drivers/cpuidle/cpuidle.c:237 cpuidle_enter+0x3c/0x60 drivers/cpuidle/cpuidle.c:351 call_cpuidle kernel/sched/idle.c:158 [inline] cpuidle_idle_call kernel/sched/idle.c:239 [inline] do_idle+0x1a3/0x250 kernel/sched/idle.c:306 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:403 rest_init+0xee/0x100 init/main.c:734 arch_call_rest_init+0xa/0xb start_kernel+0x5e4/0x669 init/main.c:1142 secondary_startup_64_no_verify+0xb1/0xbb
value changed: 0x20 -> 0x01
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/net/neighbour.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
include/net/neighbour.h +8 -3
@@ -504,10 +504,15 @@ static inline int neigh_output(struct neighbour *n, struct sk_buff *skb, {const struct hh_cache *hh = &n->hh; -if ((n->nud_state &NUD_CONNECTED ) && hh->hh_len && !skip_cache) +/* n->nud_state and hh->hh_len could be changed under us. +* neigh_hh_output() is taking care of the race later. +*/ +if (!skip_cache && + (READ_ONCE (n->nud_state) &NUD_CONNECTED ) && +READ_ONCE (hh->hh_len))return neigh_hh_output (hh, skb); -else -return n->output (n, skb); + +return n->output (n, skb); } static inline struct neighbour *
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 353/849 spi: Fixed division by zero warning
In reply to Greg Kroah-HartmanFrom: Yoshitaka Ikeda <[email protected]>
[ Upstream commit 09134c5322df9f105d9ed324051872d5d0e162aa ]
The reason for dividing by zero is because the dummy bus width is zero, but if the dummy n bytes is zero, it indicates that there is no data transfer, so there is no need for calculation.
--- drivers/spi/atmel-quadspi.c | 2 +- drivers/spi/spi-bcm-qspi.c | 3 ++- drivers/spi/spi-mtk-nor.c | 2 +- drivers/spi/spi-stm32-qspi.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)
drivers/spi/atmel-quadspi.c +1 -1
@@ -310,7 +310,7 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq,return mode; ifr |= atmel_qspi_modes[mode].config; -if (op->dummy.buswidth && op->dummy.nbytes) +if (op->dummy.nbytes) dummy_cycles = op->dummy.nbytes *8 / op->dummy.buswidth;/*
drivers/spi/spi-bcm-qspi.c +2 -1
@@ -395,7 +395,8 @@ static int bcm_qspi_bspi_set_flex_mode(struct bcm_qspi *qspi,if (addrlen ==BSPI_ADDRLEN_4BYTES ) bpp =BSPI_BPP_ADDR_SELECT_MASK ; - bpp |= (op->dummy.nbytes *8 ) / op->dummy.buswidth; +if (op->dummy.nbytes) + bpp |= (op->dummy.nbytes *8 ) / op->dummy.buswidth;switch (width) {case SPI_NBITS_SINGLE :
drivers/spi/spi-mtk-nor.c +1 -1
@@ -160,7 +160,7 @@ static bool mtk_nor_match_read(const struct spi_mem_op *op) {int dummy =0 ; -if (op->dummy.buswidth) +if (op->dummy.nbytes) dummy = op->dummy.nbytes *BITS_PER_BYTE / op->dummy.buswidth;if ((op->data.buswidth ==2 ) || (op->data.buswidth ==4 )) {
drivers/spi/spi-stm32-qspi.c +1 -1
@@ -397,7 +397,7 @@ static int stm32_qspi_send(struct spi_mem *mem, const struct spi_mem_op *op) ccr |=FIELD_PREP (CCR_ADSIZE_MASK , op->addr.nbytes -1 ); } -if (op->dummy.buswidth && op->dummy.nbytes) +if (op->dummy.nbytes) ccr |=FIELD_PREP (CCR_DCYC_MASK , op->dummy.nbytes *8 / op->dummy.buswidth);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 362/849 rxrpc: Fix _usecs_to_jiffies() by using usecs_to_jiffies()
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit acde891c243c1ed85b19d4d5042bdf00914f5739 ]
Directly using _usecs_to_jiffies() might be unsafe, so it's better to use usecs_to_jiffies() instead.
Because we can see that the result of _usecs_to_jiffies() could be larger than MAX_JIFFY_OFFSET values without the check of the input.
--- net/rxrpc/rtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/rtt.c +1 -1
@@ -22,7 +22,7 @@ static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer)static u32 __rxrpc_set_rto (const struct rxrpc_peer *peer) { -return _usecs_to_jiffies ((peer->srtt_us >>3 ) + peer->rttvar_us); +return usecs_to_jiffies ((peer->srtt_us >>3 ) + peer->rttvar_us); }static u32 rxrpc_bound_rto (u32 rto)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 363/849 fortify: Fix dropped strcpy() compile-time write overflow check
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 072af0c638dc8a5c7db2edc4dddbd6d44bee3bdb ]
The implementation for intra-object overflow in str*-family functions accidentally dropped compile-time write overflow checking in strcpy(), leaving it entirely to run-time. Add back the intended check.
--- include/linux/fortify-string.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/fortify-string.h +4 -1
@@ -280,7 +280,10 @@ __FORTIFY_INLINE char *strcpy(char *p, const char *q)if (p_size == (size_t )-1 && q_size == (size_t )-1 )return __underlying_strcpy (p, q); size =strlen (q) +1 ; -/* test here to use the more stringent object size */ +/* Compile-time check for const size overflow. */ +if (__builtin_constant_p (size) && p_size < size) +__write_overflow (); +/* Run-time check for dynamic size overflow. */ if (p_size < size)fortify_panic (__func__);memcpy (p, q, size);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 364/849 cfg80211: always free wiphy specific regdomain
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit e53e9828a8d2c6545e01ff9711f1221f2fd199ce ]
In the (somewhat unlikely) event that we allocate a wiphy, then add a regdomain to it, and then fail registration, we leak the regdomain. Fix this by just always freeing it at the end, in the normal cases we'll free (and NULL) it during wiphy_unregister(). This happened when the wiphy settings were bad, and since they can be controlled by userspace with hwsim, syzbot was able to find this issue.
--- net/wireless/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/wireless/core.c +10 -0
@@ -1081,6 +1081,16 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)list_for_each_entry_safe (scan, tmp, &rdev->bss_list, list)cfg80211_put_bss (&rdev->wiphy, &scan->pub);mutex_destroy (&rdev->wiphy.mtx); + +/* +* The 'regd' can only be non-NULL if we never finished +* initializing the wiphy and thus never went through the +* unregister path - e.g. in failure scenarios. Thus, it +* cannot have been visible to anyone if non-NULL, so we +* can just free it here. +*/ +kfree (rcu_dereference_raw (rdev->wiphy.regd)); +kfree (rdev); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 365/849 net: dsa: rtl8366rb: Fix off-by-one bug
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit 5f5f12f5d4b108399130bb5c11f07765851d9cdb ]
The max VLAN number with non-4K VLAN activated is 15, and the range is 0..15. Not 16.
The impact should be low since we by default have 4K VLAN and thus have 4095 VLANs to play with in this switch. There will not be a problem unless the code is rewritten to only use 16 VLANs.
--- drivers/net/dsa/rtl8366rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/rtl8366rb.c +1 -1
@@ -1350,7 +1350,7 @@ static int rtl8366rb_set_mc_index(struct realtek_smi *smi, int port, int index)static bool rtl8366rb_is_vlan_valid (struct realtek_smi *smi,unsigned int vlan) { -unsigned int max =RTL8366RB_NUM_VLANS ; +unsigned int max =RTL8366RB_NUM_VLANS -1 ;if (smi->vlan4k_enabled) max =RTL8366RB_NUM_VIDS -1 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 366/849 net: dsa: rtl8366: Fix a bug in deleting VLANs
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit d8251b9db34a2cbc5619b610e7e8aad1d165c531 ]
We were checking that the MC (member config) was != 0 for some reason, all we need to check is that the config has no ports, i.e. no members. Then it can be recycled. This must be some misunderstanding.
--- drivers/net/dsa/rtl8366.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/rtl8366.c +1 -1
@@ -457,7 +457,7 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port,* anymore then clear the whole member * config so it can be reused. */ -if (!vlanmc.member && vlanmc.untag) { +if (!vlanmc.member) { vlanmc.vid =0 ; vlanmc.priority =0 ; vlanmc.fid =0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 368/849 ath11k: Avoid race during regd updates
In reply to Greg Kroah-HartmanFrom: Sriram R <[email protected]>
[ Upstream commit 1db2b0d0a39102238fcbf9092cefa65a710642e9 ]
Whenever ath11k is bootup with a user country already set, cfg80211 notifies this country info to ath11k soon after registration, where the notification is sent to the firmware for fetching the rules of this user country input.
Multiple race conditions could be seen in this scenario where a new request is either lost as pointed in [1] or a new regd overwrites the default regd provided by the firmware during bootup. Note that, the default regd is used for intersection purpose and hence it should not be overwritten.
The main reason as pointed by [1] is the usage of ATH11K_FLAG_REGISTERED flag which is updated after completion of core registration, whereas the reg notification from cfg80211 and wmi events for the corresponding request can happen much before that. Since the ATH11K_FLAG_REGISTERED is currently used to determine if the event containing reg rules belong to default regd or for user request, there is a possibility of the default regd getting overwritten.
Since the default reg rules will be received only once per pdev on firmware load, the above flag based check can be replaced with a check to see if default_regd is already set, so that we can now always update the new_regd. Also if the new_regd is set, this will be always used to update the reg rules for the registered phy.
[1] https://patchwork.kernel.org/project/linux-wireless/patch/1829665.1PRlr7bOQj@ripper/
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01460-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/mac.c | 2 +- drivers/net/wireless/ath/ath11k/reg.c | 11 ++++++----- drivers/net/wireless/ath/ath11k/reg.h | 2 +- drivers/net/wireless/ath/ath11k/wmi.c | 16 ++++++---------- 4 files changed, 14 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +1 -1
@@ -6590,7 +6590,7 @@ static int __ath11k_mac_register(struct ath11k *ar) ar->hw->wiphy->interface_modes &= ~BIT (NL80211_IFTYPE_MONITOR );/* Apply the regd received during initialization */ - ret =ath11k_regd_update (ar, true); + ret =ath11k_regd_update (ar);if (ret) {ath11k_err (ar->ab,"ath11k regd update failed: %d\n" , ret); goto err_unregister_hw;
drivers/net/wireless/ath/ath11k/reg.c +6 -5
@@ -198,7 +198,7 @@ static void ath11k_copy_regd(struct ieee80211_regdomain *regd_orig, sizeof(struct ieee80211_reg_rule)); } -int ath11k_regd_update (struct ath11k *ar,bool init) +int ath11k_regd_update (struct ath11k *ar) {struct ieee80211_regdomain *regd, *regd_copy =NULL ;int ret, regd_len, pdev_id;
@@ -209,7 +209,10 @@ int ath11k_regd_update(struct ath11k *ar, bool init)spin_lock_bh (&ab->base_lock); -if (init) { +/* Prefer the latest regd update over default if it's available */ +if (ab->new_regd[pdev_id]) { + regd = ab->new_regd[pdev_id]; + }else {/* Apply the regd received during init through * WMI_REG_CHAN_LIST_CC event. In case of failure to * receive the regd, initialize with a default world
@@ -222,8 +225,6 @@ int ath11k_regd_update(struct ath11k *ar, bool init) "failed to receive default regd during init\n"); regd = (struct ieee80211_regdomain *)&ath11k_world_regd; } - }else { - regd = ab->new_regd[pdev_id]; }if (!regd) {
@@ -683,7 +684,7 @@ void ath11k_regd_update_work(struct work_struct *work) regd_update_work);int ret; - ret =ath11k_regd_update (ar, false); + ret =ath11k_regd_update (ar);if (ret) {/* Firmware has already moved to the new regd. We need * to maintain channel consistency across FW, Host driver
drivers/net/wireless/ath/ath11k/reg.h +1 -1
@@ -31,6 +31,6 @@ void ath11k_regd_update_work(struct work_struct *work);struct ieee80211_regdomain *ath11k_reg_build_regd (struct ath11k_base *ab,struct cur_regulatory_info *reg_info,bool intersect); -int ath11k_regd_update (struct ath11k *ar,bool init); +int ath11k_regd_update (struct ath11k *ar);int ath11k_reg_update_chan_list (struct ath11k *ar);#endif
drivers/net/wireless/ath/ath11k/wmi.c +6 -10
@@ -5841,10 +5841,10 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk }spin_lock (&ab->base_lock); -if (test_bit (ATH11K_FLAG_REGISTERED , &ab->dev_flags)) { -/* Once mac is registered, ar is valid and all CC events from -* fw is considered to be received due to user requests -* currently. +if (ab->default_regd[pdev_idx]) { +/* The initial rules from FW after WMI Init is to build +* the default regd. From then on, any rules updated for +* the pdev could be due to user reg changes. * Free previously built regd before assigning the newly * generated regd to ar. NULL pointer handling will be * taken care by kfree itself.
@@ -5854,13 +5854,9 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk ab->new_regd[pdev_idx] = regd;ieee80211_queue_work (ar->hw, &ar->regd_update_work); }else { -/* Multiple events for the same *ar is not expected. But we -* can still clear any previously stored default_regd if we -* are receiving this event for the same radio by mistake. -* NULL pointer handling will be taken care by kfree itself. +/* This regd would be applied during mac registration and is +* held constant throughout for regd intersection purpose */ -kfree (ab->default_regd[pdev_idx]); -/* This regd would be applied during mac registration */ ab->default_regd[pdev_idx] = regd; } ab->dfs_region = reg_info->dfs_region;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 367/849 ath11k: fix some sleeping in atomic bugs
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit aadf7c81a0771b8f1c97dabca6a48bae1b387779 ]
The ath11k_dbring_bufs_replenish() and ath11k_dbring_fill_bufs() take a "gfp" parameter but they since they take spinlocks, the allocations they do have to be atomic. This causes a bug because ath11k_dbring_buf_setup passes GFP_KERNEL for the gfp flags.
The fix is to use GFP_ATOMIC and remove the unused parameters.
--- drivers/net/wireless/ath/ath11k/dbring.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath11k/dbring.c +7 -9
@@ -8,8 +8,7 @@static int ath11k_dbring_bufs_replenish (struct ath11k *ar,struct ath11k_dbring *ring, -struct ath11k_dbring_element *buff, -gfp_t gfp) +struct ath11k_dbring_element *buff) {struct ath11k_base *ab = ar->ab;struct hal_srng *srng;
@@ -35,7 +34,7 @@ static int ath11k_dbring_bufs_replenish(struct ath11k *ar, goto err;spin_lock_bh (&ring->idr_lock); - buf_id =idr_alloc (&ring->bufs_idr, buff,0 , ring->bufs_max, gfp); + buf_id =idr_alloc (&ring->bufs_idr, buff,0 , ring->bufs_max,GFP_ATOMIC );spin_unlock_bh (&ring->idr_lock);if (buf_id <0 ) { ret = -ENOBUFS ;
@@ -72,8 +71,7 @@ err: }static int ath11k_dbring_fill_bufs (struct ath11k *ar, -struct ath11k_dbring *ring, -gfp_t gfp) +struct ath11k_dbring *ring) {struct ath11k_dbring_element *buff;struct hal_srng *srng;
@@ -92,11 +90,11 @@ static int ath11k_dbring_fill_bufs(struct ath11k *ar, size =sizeof (*buff) + ring->buf_sz + align -1 ;while (num_remain >0 ) { - buff =kzalloc (size, gfp); + buff =kzalloc (size,GFP_ATOMIC );if (!buff)break ; - ret =ath11k_dbring_bufs_replenish (ar, ring, buff, gfp); + ret =ath11k_dbring_bufs_replenish (ar, ring, buff);if (ret) {ath11k_warn (ar->ab,"failed to replenish db ring num_remain %d req_ent %d\n" , num_remain, req_entries);
@@ -176,7 +174,7 @@ int ath11k_dbring_buf_setup(struct ath11k *ar, ring->hp_addr =ath11k_hal_srng_get_hp_addr (ar->ab, srng); ring->tp_addr =ath11k_hal_srng_get_tp_addr (ar->ab, srng); - ret =ath11k_dbring_fill_bufs (ar, ring,GFP_KERNEL ); + ret =ath11k_dbring_fill_bufs (ar, ring);return ret; }
@@ -322,7 +320,7 @@ int ath11k_dbring_buffer_release_event(struct ath11k_base *ab, }memset (buff,0 , size); -ath11k_dbring_bufs_replenish (ar, ring, buff,GFP_ATOMIC ); +ath11k_dbring_bufs_replenish (ar, ring, buff); }spin_unlock_bh (&srng->lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 370/849 ath11k: Fix memory leak in ath11k_qmi_driver_event_work
In reply to Greg Kroah-HartmanFrom: Baochen Qiang <[email protected]>
[ Upstream commit 72de799aa9e3e064b35238ef053d2f0a49db055a ]
The buffer pointed to by event is not freed in case ATH11K_FLAG_UNREGISTERING bit is set, resulting in memory leak, so fix it.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/qmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/qmi.c +3 -1
@@ -2707,8 +2707,10 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)list_del (&event->list);spin_unlock (&qmi->event_lock); -if (test_bit (ATH11K_FLAG_UNREGISTERING , &ab->dev_flags)) +if (test_bit (ATH11K_FLAG_UNREGISTERING , &ab->dev_flags)) { +kfree (event);return ; + }switch (event->type) {case ATH11K_QMI_EVENT_SERVER_ARRIVE :
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 355/849 wcn36xx: Fix Antenna Diversity Switching
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 701668d3bfa03dabc5095fc383d5315544ee5b31 ]
We have been tracking a strange bug with Antenna Diversity Switching (ADS) on wcn3680b for a while.
ADS is configured like this:
A. Via a firmware configuration table baked into the NV area.
1. Defines if ADS is enabled.
2. Defines which GPIOs are connected to which antenna enable pin.
3. Defines which antenna/GPIO is primary and which is secondary.
B. WCN36XX_CFG_VAL(ANTENNA_DIVERSITY, N)
N is a bitmask of available antenna.
Setting N to 3 indicates a bitmask of enabled antenna (1 | 2).
Obviously then we can set N to 1 or N to 2 to fix to a particular antenna and disable antenna diversity.
C. WCN36XX_CFG_VAL(ASD_PROBE_INTERVAL, XX)
XX is the number of beacons between each antenna RSSI check. Setting this value to 50 means, every 50 received beacons, run the ADS algorithm.
D. WCN36XX_CFG_VAL(ASD_TRIGGER_THRESHOLD, YY)
YY is a two's complement integer which specifies the RSSI decibel threshold below which ADS will run.
We default to -60db here, meaning a measured RSSI <= -60db will trigger an ADS probe.
E. WCN36XX_CFG_VAL(ASD_RTT_RSSI_HYST_THRESHOLD, Z)
Z is a hysteresis value, indicating a delta which the RSSI must exceed for the antenna switch to be valid.
For example if HYST_THRESHOLD == 3 AntennaId1-RSSI == -60db and AntennaId-2-RSSI == -58db then firmware will not switch antenna. The threshold needs to be -57db or better to satisfy the criteria.
F. A firmware feature bit also exists ANTENNA_DIVERSITY_SELECTION.
This feature bit is used by the firmware to report if ANTENNA_DIVERSITY_SELECTION is supported. The host is not required to toggle this bit to enable or disable ADS.
ADS works like this:
A. Every XX beacons the firmware switches to or remains on the primary
antenna.
B. The firmware then sends a Request-To-Send (RTS) packet to the AP.
C. The firmware waits for a Clear-To-Send (CTS) response from the AP.
D. The firmware then notes the received RSSI on the CTS packet.
E. The firmware then repeats steps A-D on the secondary antenna.
F. Subsequently if the RSSI on the measured antenna is better than
ASD_TRIGGER_THRESHOLD + the active antenna's RSSI then the measured antenna becomes the active antenna.
G. If RSSI rises past ASD_TRIGGER_THRESHOLD then ADS doesn't run at
all even if there is a substantially better RSSI on the alternative antenna.
What we have been observing is that the RTS packet is being sent but the MAC address is a byte-swapped version of the target MAC. The ADS/RTS MAC is corrupted only when the link is encrypted, if the AP is open the RTS MAC is correct. Similarly if we configure the firmware to an RTS/CTS sequence for regular data - the transmitted RTS MAC is correctly formatted.
Internally the wcn36xx firmware uses the indexes in the SMD commands to populate and extract data from specific entries in an STA lookup table. The AP's MAC appears a number of times in different indexes within this lookup table, so the MAC address extracted for the data-transmit RTS and the MAC address extracted for the ADS/RTS packet are not the same STA table index.
Our analysis indicates the relevant firmware STA table index is "bssSelfStaIdx".
There is an STA populate function responsible for formatting the MAC address of the bssSelfStaIdx including byte-swapping the MAC address.
Its clear then that the required STA populate command did not run for bssSelfStaIdx.
So taking a look at the sequence of SMD commands sent to the firmware we see the following downstream when moving from an unencrypted to encrypted BSS setup.
- WLAN_HAL_CONFIG_BSS_REQ
- WLAN_HAL_CONFIG_STA_REQ
- WLAN_HAL_SET_STAKEY_REQ
Upstream in wcn36xx we have
- WLAN_HAL_CONFIG_BSS_REQ
- WLAN_HAL_SET_STAKEY_REQ
The solution then is to add the missing WLAN_HAL_CONFIG_STA_REQ between WLAN_HAL_CONFIG_BSS_REQ and WLAN_HAL_SET_STAKEY_REQ.
No surprise WLAN_HAL_CONFIG_STA_REQ is the routine responsible for populating the STA lookup table in the firmware and once done the MAC sent by the ADS routine is in the correct byte-order.
This bug is apparent with ADS but it is also the case that any other firmware routine that depends on the "bssSelfStaIdx" would retrieve malformed data on an encrypted link.
--- drivers/net/wireless/ath/wcn36xx/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/main.c +3 -1
@@ -571,12 +571,14 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) { sta_priv->is_data_encrypted = true;/* Reconfigure bss with encrypt_type */ -if (NL80211_IFTYPE_STATION == vif->type) +if (NL80211_IFTYPE_STATION == vif->type) {wcn36xx_smd_config_bss (wcn, vif, sta, sta->addr, true); +wcn36xx_smd_config_sta (wcn, vif, sta); + } wcn36xx_smd_set_stakey(wcn, vif_priv->encrypt_type,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 381/849 media: ttusb-dec: avoid release of non-acquired mutex
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 36b9d695aa6fb8e9a312db21af41f90824d16ab4 ]
ttusb_dec_send_command() invokes mutex_lock_interruptible() that can fail but then it releases the non-acquired mutex. The patch fixes that.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/usb/ttusb-dec/ttusb_dec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/usb/ttusb-dec/ttusb_dec.c +5 -5
@@ -327,7 +327,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, result =mutex_lock_interruptible (&dec->usb_mutex);if (result) {printk ("%s: Failed to lock usb mutex.\n" , __func__); - goto err; + goto err_free; } b[0 ] =0xaa ;
@@ -349,7 +349,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,if (result) {printk ("%s: command bulk message failed: error %d\n" , __func__, result); - goto err; + goto err_mutex_unlock; } result = usb_bulk_msg(dec->udev, dec->result_pipe, b,
@@ -358,7 +358,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,if (result) {printk ("%s: result bulk message failed: error %d\n" , __func__, result); - goto err; + goto err_mutex_unlock; }else {if (debug) { printk(KERN_DEBUG "%s: result: %*ph\n",
@@ -371,9 +371,9 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,memcpy (cmd_result, &b[4 ], b[3 ]); } -err: +err_mutex_unlock:mutex_unlock (&dec->usb_mutex); - +err_free:kfree (b);return result; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 380/849 media: cxd2880-spi: Fix a null pointer dereference on error handling path
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 11b982e950d2138e90bd120501df10a439006ff8 ]
Currently the null pointer check on dvb_spi->vcc_supply is inverted and this leads to only null values of the dvb_spi->vcc_supply being passed to the call of regulator_disable causing null pointer dereferences. Fix this by only calling regulator_disable if dvb_spi->vcc_supply is not null.
Addresses-Coverity: ("Dereference after null check")
--- drivers/media/spi/cxd2880-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/spi/cxd2880-spi.c +1 -1
@@ -618,7 +618,7 @@ fail_frontend: fail_attach:dvb_unregister_adapter (&dvb_spi->adapter); fail_adapter: -if (!dvb_spi->vcc_supply) +if (dvb_spi->vcc_supply)regulator_disable (dvb_spi->vcc_supply); fail_regulator:kfree (dvb_spi);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 382/849 media: dvb-usb: fix ununit-value in az6027_rc_query
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit afae4ef7d5ad913cab1316137854a36bea6268a5 ]
Syzbot reported ununit-value bug in az6027_rc_query(). The problem was in missing state pointer initialization. Since this function does nothing we can simply initialize state to REMOTE_NO_KEY_PRESSED.
--- drivers/media/usb/dvb-usb/az6027.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/dvb-usb/az6027.c +1 -0
@@ -391,6 +391,7 @@ static struct rc_map_table rc_map_az6027_table[] = {/* remote control stuff (does not work with my box) */ static int az6027_rc_query (struct dvb_usb_device *d,u32 *event,int *state) { + *state =REMOTE_NO_KEY_PRESSED ;return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 385/849 media: mtk-vcodec: venc: fix return value when start_streaming fails
In reply to Greg Kroah-HartmanFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit 065a7c66bd8b21db212fa86187ff12f0cac6ea6d ]
In case vb2ops_venc_start_streaming fails, the error value is overwritten by the ret value of pm_runtime_put which might be 0. Fix it.
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +4 -4
@@ -793,7 +793,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) {struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (q);struct venc_enc_param param; -int ret; +int ret, pm_ret;int i;/* Once state turn into MTK_STATE_ABORT, we need stop_streaming
@@ -845,9 +845,9 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)return 0 ; err_set_param: - ret =pm_runtime_put (&ctx->dev->plat_dev->dev); -if (ret <0 ) -mtk_v4l2_err ("pm_runtime_put fail %d" , ret); + pm_ret =pm_runtime_put (&ctx->dev->plat_dev->dev); +if (pm_ret <0 ) +mtk_v4l2_err ("pm_runtime_put fail %d" , pm_ret); err_start_stream:for (i =0 ; i < q->num_buffers; ++i) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 383/849 media: imx258: Fix getting clock frequency
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
[ Upstream commit d170b0ea1760989fe8ac053bef83e61f3bf87992 ]
Obtain the clock frequency by reading the clock-frequency property if there's no clock.
--- drivers/media/i2c/imx258.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/media/i2c/imx258.c +6 -6
@@ -1260,18 +1260,18 @@ static int imx258_probe(struct i2c_client *client)return -ENOMEM ; imx258->clk =devm_clk_get_optional (&client->dev,NULL ); +if (IS_ERR (imx258->clk)) +return dev_err_probe (&client->dev,PTR_ERR (imx258->clk), +"error getting clock\n" );if (!imx258->clk) {dev_dbg (&client->dev,"no clock provided, using clock-frequency property\n" );device_property_read_u32 (&client->dev,"clock-frequency" , &val); -if (val !=IMX258_INPUT_CLOCK_FREQ ) -return -EINVAL ; - }else if (IS_ERR (imx258->clk)) { -return dev_err_probe (&client->dev,PTR_ERR (imx258->clk), -"error getting clock\n" ); + }else { + val =clk_get_rate (imx258->clk); } -if (clk_get_rate (imx258->clk) !=IMX258_INPUT_CLOCK_FREQ ) { +if (val !=IMX258_INPUT_CLOCK_FREQ ) {dev_err (&client->dev,"input clock frequency not supported\n" );return -EINVAL ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 356/849 wilc1000: fix possible memory leak in cfg_scan_result()
In reply to Greg Kroah-HartmanFrom: Ajay Singh <[email protected]>
[ Upstream commit 3c719fed0f3a5e95b1d164609ecc81c4191ade70 ]
When the BSS reference holds a valid reference, it is not freed. The 'if' condition is wrong. Instead of the 'if (bss)' check, the 'if (!bss)' check is used.
The issue is solved by removing the unnecessary 'if' check because cfg80211_put_bss() already performs the NULL validation.
--- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +1 -2
@@ -129,8 +129,7 @@ static void cfg_scan_result(enum scan_event scan_event, info->frame_len, (s32 )info->rssi *100 , GFP_KERNEL); -if (!bss) -cfg80211_put_bss (wiphy, bss); +cfg80211_put_bss (wiphy, bss); }else if (scan_event ==SCAN_EVENT_DONE ) {mutex_lock (&priv->scan_req_lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 379/849 media: meson-ge2d: Fix rotation parameter changes detection in ge2d_s_ctrl()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 4b9e3e8af4b336eefca1f1ee535bc4b6734ed6aa ]
There is likely a typo here. To be consistent, we should compare 'fmt.height' with 'ctx->out.pix_fmt.height', not 'ctx->out.pix_fmt.width'.
Instead of fixing the test, just remove it and copy 'fmt' unconditionally.
--- drivers/media/platform/meson/ge2d/ge2d.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/media/platform/meson/ge2d/ge2d.c +1 -5
@@ -779,11 +779,7 @@ static int ge2d_s_ctrl(struct v4l2_ctrl *ctrl)* If the rotation parameter changes the OUTPUT frames * parameters, take them in account */ -if (fmt.width != ctx->out.pix_fmt.width || - fmt.height != ctx->out.pix_fmt.width || - fmt.bytesperline > ctx->out.pix_fmt.bytesperline || - fmt.sizeimage > ctx->out.pix_fmt.sizeimage) - ctx->out.pix_fmt = fmt; + ctx->out.pix_fmt = fmt;break ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 384/849 media: v4l2-ioctl: S_CTRL output the right value
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit c87ed93574e3cd8346c05bd934c617596c12541b ]
If the driver does not implement s_ctrl, but it does implement s_ext_ctrls, we convert the call.
When that happens we have also to convert back the response from s_ext_ctrls.
Fixes v4l2_compliance:
Control ioctls (Input 0):
fail: v4l2-test-controls.cpp(411): returned control value out of range
fail: v4l2-test-controls.cpp(507): invalid control 00980900
test VIDIOC_G/S_CTRL: FAIL
--- drivers/media/v4l2-core/v4l2-ioctl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +6 -3
@@ -2224,6 +2224,7 @@ static int v4l_s_ctrl(const struct v4l2_ioctl_ops *ops,test_bit (V4L2_FL_USES_V4L2_FH , &vfd->flags) ? fh :NULL ;struct v4l2_ext_controls ctrls;struct v4l2_ext_control ctrl; +int ret;if (vfh && vfh->ctrl_handler)return v4l2_s_ctrl (vfh, vfh->ctrl_handler, p);
@@ -2239,9 +2240,11 @@ static int v4l_s_ctrl(const struct v4l2_ioctl_ops *ops, ctrls.controls = &ctrl; ctrl.id = p->id; ctrl.value = p->value; -if (check_ext_ctrls (&ctrls,VIDIOC_S_CTRL )) -return ops->vidioc_s_ext_ctrls (file, fh, &ctrls); -return -EINVAL ; +if (!check_ext_ctrls (&ctrls,VIDIOC_S_CTRL )) +return -EINVAL ; + ret = ops->vidioc_s_ext_ctrls (file, fh, &ctrls); + p->value = ctrl.value; +return ret; } static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops *ops,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 358/849 drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
[ Upstream commit 6effad8abe0ba4db3d9c58ed585127858a990f35 ]
adev->rmmio is set to be NULL in amdgpu_device_unmap_mmio to prevent access after pci_remove, however, in SRIOV case, amdgpu_virt_release_full_gpu will still use adev->rmmio for access after amdgpu_device_unmap_mmio. The patch is to move such SRIOV calling earlier to fini_early stage.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -4
@@ -2689,6 +2689,11 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev) adev->ip_blocks[i].status.hw = false; } +if (amdgpu_sriov_vf (adev)) { +if (amdgpu_virt_release_full_gpu (adev, false)) +DRM_ERROR ("failed to release exclusive mode on fini\n" ); + } +return 0 ; }
@@ -2749,10 +2754,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)amdgpu_ras_fini (adev); -if (amdgpu_sriov_vf (adev)) -if (amdgpu_virt_release_full_gpu (adev, false)) -DRM_ERROR ("failed to release exclusive mode on fini\n" ); -return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 357/849 Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 3e5f2d90c28f9454e421108554707620bc23269d ]
bdev->evt_skb will get freed in the normal path and one error path of mtk_hci_wmt_sync, while the other error paths do not free it, which may cause a memleak. This bug is suggested by a static analysis tool, please advise.
--- drivers/bluetooth/btmtkuart.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/bluetooth/btmtkuart.c +8 -5
@@ -158,8 +158,10 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,int err; hlen =sizeof (*hdr) + wmt_params->dlen; -if (hlen >255 ) -return -EINVAL ; +if (hlen >255 ) { + err = -EINVAL ; + goto err_free_skb; + } hdr = (struct mtk_wmt_hdr *)&wc; hdr->dir =1 ;
@@ -173,7 +175,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, err =__hci_cmd_send (hdev,0xfc6f , hlen, &wc);if (err <0 ) {clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return err; + goto err_free_skb; }/* The vendor specific WMT commands are all answered by a vendor
@@ -190,13 +192,14 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,if (err == -EINTR ) {bt_dev_err (hdev,"Execution of wmt command interrupted" );clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return err; + goto err_free_skb; }if (err) {bt_dev_err (hdev,"Execution of wmt command timed out" );clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return -ETIMEDOUT ; + err = -ETIMEDOUT ; + goto err_free_skb; }/* Parse and handle the return WMT event */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 359/849 crypto: caam - disable pkc for non-E SoCs
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit f20311cc9c58052e0b215013046cbf390937910c ]
On newer CAAM versions, not all accelerators are disabled if the SoC is a non-E variant. While the driver checks most of the modules for availability, there is one - PKHA - which sticks out. On non-E variants it is still reported as available, that is the number of instances is non-zero, but it has limited functionality. In particular it doesn't support encryption and decryption, but just signing and verifying. This is indicated by a bit in the PKHA_MISC field. Take this bit into account if we are checking for availability.
This will the following error:
[ 8.167817] caam_jr 8020000.jr: 20000b0f: CCB: desc idx 11: : Invalid CHA selected.
Tested on an NXP LS1028A (non-E) SoC.
--- drivers/crypto/caam/caampkc.c | 19 +++++++++++++++---- drivers/crypto/caam/regs.h | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/crypto/caam/caampkc.c +15 -4
@@ -1153,16 +1153,27 @@ static struct caam_akcipher_alg caam_rsa = {int caam_pkc_init (struct device *ctrldev) {struct caam_drv_private *priv =dev_get_drvdata (ctrldev); -u32 pk_inst; +u32 pk_inst, pkha;int err; init_done = false;/* Determine public key hardware accelerator presence. */ -if (priv->era <10 ) +if (priv->era <10 ) { pk_inst = (rd_reg32 (&priv->ctrl->perfmon.cha_num_ls) &CHA_ID_LS_PK_MASK ) >>CHA_ID_LS_PK_SHIFT ; -else - pk_inst =rd_reg32 (&priv->ctrl->vreg.pkha) &CHA_VER_NUM_MASK ; + }else { + pkha =rd_reg32 (&priv->ctrl->vreg.pkha); + pk_inst = pkha &CHA_VER_NUM_MASK ; + +/* +* Newer CAAMs support partially disabled functionality. If this is the +* case, the number is non-zero, but this bit is set to indicate that +* no encryption or decryption is supported. Only signing and verifying +* is supported. +*/ +if (pkha &CHA_VER_MISC_PKHA_NO_CRYPT ) + pk_inst =0 ; + }/* Do not register algorithms if PKHA is not present. */ if (!pk_inst)
drivers/crypto/caam/regs.h +3 -0
@@ -322,6 +322,9 @@ struct version_regs {/* CHA Miscellaneous Information - AESA_MISC specific */ #define CHA_VER_MISC_AES_GCM BIT(1 + CHA_VER_MISC_SHIFT) +/* CHA Miscellaneous Information - PKHA_MISC specific */ +#define CHA_VER_MISC_PKHA_NO_CRYPT BIT(7 + CHA_VER_MISC_SHIFT) +/* * caam_perfmon - Performance Monitor/Secure Memory Status/ * CAAM Global Status/Component Version IDs
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 386/849 media: TDA1997x: handle short reads of hdmi info frame.
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 48d219f9cc667bc6fbc3e3af0b1bfd75db94fce4 ]
Static analysis reports this representative problem
tda1997x.c:1939: warning: 7th function call argument is an uninitialized value
The 7th argument is buffer[0], which is set in the earlier call to io_readn(). When io_readn() call to io_read() fails with the first read, buffer[0] is not set and 0 is returned and stored in len.
The later call to hdmi_infoframe_unpack()'s size parameter is the static size of buffer, always 40, so a short read is not caught in hdmi_infoframe_unpacks()'s checking. The variable len should be used instead.
Zero initialize buffer to 0 so it is in a known start state.
--- drivers/media/i2c/tda1997x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/i2c/tda1997x.c +4 -4
@@ -1247,13 +1247,13 @@ tda1997x_parse_infoframe(struct tda1997x_state *state, u16 addr) {struct v4l2_subdev *sd = &state->sd;union hdmi_infoframe frame; -u8 buffer[40 ]; +u8 buffer[40 ] = {0 };u8 reg;int len, err;/* read data */ len =io_readn (sd, addr,sizeof (buffer), buffer); - err =hdmi_infoframe_unpack (&frame, buffer,sizeof (buffer)); + err =hdmi_infoframe_unpack (&frame, buffer, len);if (err) { v4l_err(state->client, "failed parsing %d byte infoframe: 0x%04x/0x%02x\n",
@@ -1927,13 +1927,13 @@ static int tda1997x_log_infoframe(struct v4l2_subdev *sd, int addr) {struct tda1997x_state *state =to_state (sd);union hdmi_infoframe frame; -u8 buffer[40 ]; +u8 buffer[40 ] = {0 };int len, err;/* read data */ len =io_readn (sd, addr,sizeof (buffer), buffer);v4l2_dbg (1 , debug, sd,"infoframe: addr=%d len=%d\n" , addr, len); - err =hdmi_infoframe_unpack (&frame, buffer,sizeof (buffer)); + err =hdmi_infoframe_unpack (&frame, buffer, len);if (err) { v4l_err(state->client, "failed parsing %d byte infoframe: 0x%04x/0x%02x\n",
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 360/849 bnxt_en: Check devlink allocation and registration status
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e624c70e1131e145bd0510b8a700b5e2d112e377 ]
devlink is a software interface that doesn't depend on any hardware capabilities. The failure in SW means memory issues, wrong parameters, programmer error e.t.c.
Like any other such interface in the kernel, the returned status of devlink APIs should be checked and propagated further and not ignored.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++++- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 13 ++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 13 ------------- 3 files changed, 10 insertions(+), 21 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -1
@@ -13359,7 +13359,9 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) }bnxt_inv_fw_health_reg (bp); -bnxt_dl_register (bp); + rc =bnxt_dl_register (bp); +if (rc) + goto init_err_dl; rc =register_netdev (dev);if (rc)
@@ -13379,6 +13381,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) init_err_cleanup:bnxt_dl_unregister (bp); +init_err_dl:bnxt_shutdown_tc (bp);bnxt_clear_int_mode (bp);
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +6 -7
@@ -133,7 +133,7 @@ void bnxt_dl_fw_reporters_create(struct bnxt *bp) {struct bnxt_fw_health *health = bp->fw_health; -if (!bp->dl || !health) +if (!health)return ;if (!(bp->fw_cap &BNXT_FW_CAP_HOT_RESET ) || health->fw_reset_reporter)
@@ -187,7 +187,7 @@ void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all) {struct bnxt_fw_health *health = bp->fw_health; -if (!bp->dl || !health) +if (!health)return ; if ((all || !(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) &&
@@ -744,6 +744,7 @@ static void bnxt_dl_params_unregister(struct bnxt *bp)int bnxt_dl_register (struct bnxt *bp) {struct devlink_port_attrs attrs = {}; +struct bnxt_dl *bp_dl;struct devlink *dl;int rc;
@@ -756,7 +757,9 @@ int bnxt_dl_register(struct bnxt *bp)return -ENOMEM ; } -bnxt_link_bp_to_dl (bp, dl); + bp->dl = dl; + bp_dl =devlink_priv (dl); + bp_dl->bp = bp;/* Add switchdev eswitch mode setting, if SRIOV supported */ if (pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV) &&
@@ -794,7 +797,6 @@ err_dl_port_unreg: err_dl_unreg:devlink_unregister (dl); err_dl_free: -bnxt_link_bp_to_dl (bp,NULL );devlink_free (dl);return rc; }
@@ -803,9 +805,6 @@ void bnxt_dl_unregister(struct bnxt *bp) {struct devlink *dl = bp->dl; -if (!dl) -return ; -if (BNXT_PF (bp)) {bnxt_dl_params_unregister (bp);devlink_port_unregister (&bp->dl_port);
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +0 -13
@@ -20,19 +20,6 @@ static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)return ((struct bnxt_dl *)devlink_priv (dl))->bp; } -/* To clear devlink pointer from bp, pass NULL dl */ -static inline void bnxt_link_bp_to_dl (struct bnxt *bp,struct devlink *dl) -{ - bp->dl = dl; - -/* add a back pointer in dl to bp */ -if (dl) { -struct bnxt_dl *bp_dl =devlink_priv (dl); - - bp_dl->bp = bp; - } -} -#define NVM_OFF_MSIX_VEC_PER_PF_MAX 108#define NVM_OFF_MSIX_VEC_PER_PF_MIN 114#define NVM_OFF_IGNORE_ARI 164
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 361/849 qed: Dont ignore devlink allocation failures
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e6a54d6f221301347aaf9d83bb1f23129325c1c5 ]
devlink is a software interface that doesn't depend on any hardware capabilities. The failure in SW means memory issues, wrong parameters, programmer error e.t.c.
Like any other such interface in the kernel, the returned status of devlink APIs should be checked and propagated further and not ignored.
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 12 +++++------- drivers/scsi/qedf/qedf_main.c | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_main.c +5 -7
@@ -1184,19 +1184,17 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, edev->devlink = qed_ops->common->devlink_register (cdev);if (IS_ERR (edev->devlink)) {DP_NOTICE (edev,"Cannot register devlink\n" ); + rc =PTR_ERR (edev->devlink); edev->devlink =NULL ; -/* Go on, we can live without devlink */ + goto err3; } }else {struct net_device *ndev =pci_get_drvdata (pdev); +struct qed_devlink *qdl; edev =netdev_priv (ndev); - -if (edev->devlink) { -struct qed_devlink *qdl =devlink_priv (edev->devlink); - - qdl->cdev = cdev; - } + qdl =devlink_priv (edev->devlink); + qdl->cdev = cdev; edev->cdev = cdev;memset (&edev->stats,0 ,sizeof (edev->stats));memcpy (&edev->dev_info, &dev_info,sizeof (dev_info));
drivers/scsi/qedf/qedf_main.c +2 -0
@@ -3416,7 +3416,9 @@ retry_probe: qedf->devlink = qed_ops->common->devlink_register (qedf->cdev);if (IS_ERR (qedf->devlink)) {QEDF_ERR (&qedf->dbg_ctx,"Cannot register devlink\n" ); + rc =PTR_ERR (qedf->devlink); qedf->devlink =NULL ; + goto err2; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 387/849 media: mtk-vpu: Fix a resource leak in the error handling path of mtk_vpu_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 2143ad413c05c7be24c3a92760e367b7f6aaac92 ]
A successful 'clk_prepare()' call should be balanced by a corresponding 'clk_unprepare()' call in the error handling path of the probe, as already done in the remove function.
Update the error handling path accordingly.
--- drivers/media/platform/mtk-vpu/mtk_vpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/mtk-vpu/mtk_vpu.c +4 -1
@@ -848,7 +848,8 @@ static int mtk_vpu_probe(struct platform_device *pdev) vpu->wdt.wq =create_singlethread_workqueue ("vpu_wdt" );if (!vpu->wdt.wq) {dev_err (dev,"initialize wdt workqueue failed\n" ); -return -ENOMEM ; + ret = -ENOMEM ; + goto clk_unprepare; }INIT_WORK (&vpu->wdt.ws, vpu_wdt_reset_func);mutex_init (&vpu->vpu_mutex);
@@ -942,6 +943,8 @@ disable_vpu_clk:vpu_clock_disable (vpu); workqueue_destroy:destroy_workqueue (vpu->wdt.wq); +clk_unprepare: +clk_unprepare (vpu->clk);return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 378/849 media: em28xx: add missing em28xx_close_extension
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2c98b8a3458df03abdc6945bbef67ef91d181938 ]
If em28xx dev has ->dev_next pointer, we need to delete ->dev_next list node from em28xx_extension_devlist on disconnect to avoid UAF bugs and corrupted list bugs, since driver frees this pointer on disconnect.
--- drivers/media/usb/em28xx/em28xx-cards.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/usb/em28xx/em28xx-cards.c +4 -1
@@ -4139,8 +4139,11 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)em28xx_close_extension (dev); -if (dev->dev_next) +if (dev->dev_next) { +em28xx_close_extension (dev->dev_next);em28xx_release_resources (dev->dev_next); + } +em28xx_release_resources (dev);if (dev->dev_next) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 352/849 drm: bridge: it66121: Fix return value it66121_probe
In reply to Greg Kroah-HartmanFrom: Alex Bee <[email protected]>
[ Upstream commit f3bc07eba481942a246926c5b934199e7ccd567b ]
Currently it66121_probe returns -EPROBE_DEFER if the there is no remote endpoint found in the device tree which doesn't seem helpful, since this is not going to change later and it is never checked if the next bridge has been initialized yet. It will fail in that case later while doing drm_bridge_attach for the next bridge in it66121_bridge_attach.
Since the bindings documentation for it66121 bridge driver states there has to be a remote endpoint defined, its safe to return -EINVAL in that case.
This additonally adds a check, if the remote endpoint is enabled and returns -EPROBE_DEFER, if the remote bridge hasn't been initialized (yet).
--- drivers/gpu/drm/bridge/ite-it66121.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it66121.c +14 -2
@@ -918,11 +918,23 @@ static int it66121_probe(struct i2c_client *client,return -EINVAL ; ep =of_graph_get_remote_node (dev->of_node,1 ,-1 ); -if (!ep) -return -EPROBE_DEFER ; +if (!ep) { +dev_err (ctx->dev,"The endpoint is unconnected\n" ); +return -EINVAL ; + } + +if (!of_device_is_available (ep)) { +of_node_put (ep); +dev_err (ctx->dev,"The remote device is disabled\n" ); +return -ENODEV ; + } ctx->next_bridge =of_drm_find_bridge (ep);of_node_put (ep); +if (!ctx->next_bridge) { +dev_dbg (ctx->dev,"Next bridge not found, deferring probe\n" ); +return -EPROBE_DEFER ; + }if (!ctx->next_bridge)return -EPROBE_DEFER ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 405/849 x86/insn: Use get_unaligned() instead of memcpy()
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit f96b4675839b66168f5a07bf964dde6c2f1c4885 ]
Use get_unaligned() instead of memcpy() to access potentially unaligned memory, which, when accessed through a pointer, leads to undefined behavior. get_unaligned() describes much better what is happening there anyway even if memcpy() does the job.
In addition, since perf tool builds with -Werror, it would fire with:
util/intel-pt-decoder/../../../arch/x86/lib/insn.c: In function '__insn_get_emulate_prefix':
tools/include/../include/asm-generic/unaligned.h:10:15: error: packed attribute is unnecessary [-Werror=packed]
10 | const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \because -Werror=packed would complain if the packed attribute would have no effect on the layout of the structure.
In this case, that is intentional so disable the warning only for that compilation unit.
That part is Reported-by: Stephen Rothwell <[email protected]>
No functional changes.
--- arch/x86/lib/insn.c | 5 +++-- tools/arch/x86/lib/insn.c | 5 +++-- tools/include/asm-generic/unaligned.h | 23 +++++++++++++++++++++++ tools/perf/util/intel-pt-decoder/Build | 2 ++ 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tools/include/asm-generic/unaligned.h
arch/x86/lib/insn.c +3 -2
@@ -13,6 +13,7 @@#endif #include <asm/inat.h> /*__ignore_sync_check__ */ #include <asm/insn.h> /* __ignore_sync_check__ */ +#include <asm/unaligned.h> /* __ignore_sync_check__ */ #include <linux/errno.h> #include <linux/kconfig.h>
@@ -37,10 +38,10 @@ ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr)#define __get_next (t, insn) \ - ({ t r; memcpy(&r, insn->next_byte, sizeof(t)); insn->next_byte += sizeof(t); leXX_to_cpu(t, r); }) + ({ t r = get_unaligned((t *)(insn)->next_byte); (insn)->next_byte += sizeof(t); leXX_to_cpu(t, r); })#define __peek_nbyte_next (t, insn, n) \ - ({ t r; memcpy(&r, (insn)->next_byte + n, sizeof(t)); leXX_to_cpu(t, r); }) + ({ t r = get_unaligned((t *)(insn)->next_byte + n); leXX_to_cpu(t, r); })#define get_next (t, insn) \ ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
tools/arch/x86/lib/insn.c +3 -2
@@ -13,6 +13,7 @@#endif #include "../include/asm/inat.h" /* __ignore_sync_check__ */ #include "../include/asm/insn.h" /* __ignore_sync_check__ */ +#include "../include/asm-generic/unaligned.h" /* __ignore_sync_check__ */ #include <linux/errno.h> #include <linux/kconfig.h>
@@ -37,10 +38,10 @@ ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr)#define __get_next (t, insn) \ - ({ t r; memcpy(&r, insn->next_byte, sizeof(t)); insn->next_byte += sizeof(t); leXX_to_cpu(t, r); }) + ({ t r = get_unaligned((t *)(insn)->next_byte); (insn)->next_byte += sizeof(t); leXX_to_cpu(t, r); })#define __peek_nbyte_next (t, insn, n) \ - ({ t r; memcpy(&r, (insn)->next_byte + n, sizeof(t)); leXX_to_cpu(t, r); }) + ({ t r = get_unaligned((t *)(insn)->next_byte + n); leXX_to_cpu(t, r); })#define get_next (t, insn) \ ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
tools/include/asm-generic/unaligned.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copied from the kernel sources to tools/perf/: +*/ + +#ifndef __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H +#define __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H + +#define __get_unaligned_t (type, ptr) ({ \ + const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ + __pptr->x; \ +}) + +#define __put_unaligned_t (type, val, ptr) do { \ + struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ + __pptr->x = (val); \ +} while (0) + +#define get_unaligned (ptr) __get_unaligned_t(typeof(*(ptr)), (ptr)) +#define put_unaligned (val, ptr) __put_unaligned_t(typeof(*(ptr)), (val), (ptr)) + +#endif /* __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H */ +
tools/perf/util/intel-pt-decoder/Build +2 -0
@@ -18,3 +18,5 @@ CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder ifeq ($(CC_NO_CLANG), 1) CFLAGS_intel-pt-insn-decoder.o += -Wno-override-init endif + +CFLAGS_intel-pt-insn-decoder.o += -Wno-packed
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 398/849 crypto: ecc - fix CRYPTO_DEFAULT_RNG dependency
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 38aa192a05f22f9778f9420e630f0322525ef12e ]
The ecc.c file started out as part of the ECDH algorithm but got moved out into a standalone module later. It does not build without CRYPTO_DEFAULT_RNG, so now that other modules are using it as well we can run into this link error:
aarch64-linux-ld: ecc.c:(.text+0xfc8): undefined reference to `crypto_default_rng'
aarch64-linux-ld: ecc.c:(.text+0xff4): undefined reference to `crypto_put_default_rng'
Move the 'select CRYPTO_DEFAULT_RNG' statement into the correct symbol.
--- crypto/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/Kconfig +1 -1
@@ -233,12 +233,12 @@ config CRYPTO_DH config CRYPTO_ECC tristate + select CRYPTO_RNG_DEFAULT config CRYPTO_ECDH tristate "ECDH algorithm" select CRYPTO_ECC select CRYPTO_KPP - select CRYPTO_RNG_DEFAULT help Generic implementation of the ECDH algorithm
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 401/849 media: em28xx: Dont use ops->suspend if it is NULL
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 51fa3b70d27342baf1ea8aaab3e96e5f4f26d5b2 ]
The call to ops->suspend for the dev->dev_next case can currently trigger a call on a null function pointer if ops->suspend is null. Skip over the use of function ops->suspend if it is null.
Addresses-Coverity: ("Dereference after null check")
--- drivers/media/usb/em28xx/em28xx-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/usb/em28xx/em28xx-core.c +3 -2
@@ -1154,8 +1154,9 @@ int em28xx_suspend_extension(struct em28xx *dev)dev_info (&dev->intf->dev,"Suspending extensions\n" );mutex_lock (&em28xx_devlist_mutex);list_for_each_entry (ops, &em28xx_extension_devlist, next) { -if (ops->suspend) - ops->suspend (dev); +if (!ops->suspend) +continue ; + ops->suspend (dev);if (dev->dev_next) ops->suspend (dev->dev_next); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 403/849 ath9k: Fix potential interrupt storm on queue reset
In reply to Greg Kroah-HartmanFrom: Linus Lüssing <[email protected]>
[ Upstream commit 4925642d541278575ad1948c5924d71ffd57ef14 ]
In tests with two Lima boards from 8devices (QCA4531 based) on OpenWrt 19.07 we could force a silent restart of a device with no serial output when we were sending a high amount of UDP traffic (iperf3 at 80 MBit/s in both directions from external hosts, saturating the wifi and causing a load of about 4.5 to 6) and were then triggering an ath9k_queue_reset().
Further debugging showed that the restart was caused by the ath79 watchdog. With disabled watchdog we could observe that the device was constantly going into ath_isr() interrupt handler and was returning early after the ATH_OP_HW_RESET flag test, without clearing any interrupts. Even though ath9k_queue_reset() calls ath9k_hw_kill_interrupts().
With JTAG we could observe the following race condition:
1) ath9k_queue_reset()
...
-> ath9k_hw_kill_interrupts()
-> set_bit(ATH_OP_HW_RESET, &common->op_flags);
...
<- returns
2) ath9k_tasklet()
...
-> ath9k_hw_resume_interrupts()
...
<- returns
3) loops around:
...
handle_int()
-> ath_isr()
...
-> if (test_bit(ATH_OP_HW_RESET,
&common->op_flags))
return IRQ_HANDLED;
x) ath_reset_internal():
=> never reached <=And in ath_isr() we would typically see the following interrupts / interrupt causes:
* status: 0x00111030 or 0x00110030
* async_cause: 2 (AR_INTR_MAC_IPQ)
* sync_cause: 0
So the ath9k_tasklet() reenables the ath9k interrupts through ath9k_hw_resume_interrupts() which ath9k_queue_reset() had just disabled. And ath_isr() then keeps firing because it returns IRQ_HANDLED without actually clearing the interrupt.
To fix this IRQ storm also clear/disable the interrupts again when we are in reset state.
--- drivers/net/wireless/ath/ath9k/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/main.c +3 -1
@@ -533,8 +533,10 @@ irqreturn_t ath_isr(int irq, void *dev)ath9k_debug_sync_cause (sc, sync_cause); status &= ah->imask;/* discard unasked-for bits */ -if (test_bit (ATH_OP_HW_RESET , &common->op_flags)) +if (test_bit (ATH_OP_HW_RESET , &common->op_flags)) { +ath9k_hw_kill_interrupts (sc->sc_ah);return IRQ_HANDLED ; + }/* * If there are no status bits set, then this interrupt was not
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 407/849 rcu: Always inline rcu_dynticks_task*_{enter,exit}()
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 7663ad9a5dbcc27f3090e6bfd192c7e59222709f ]
RCU managed to grow a few noinstr violations:
vmlinux.o: warning: objtool: rcu_dynticks_eqs_enter()+0x0: call to rcu_dynticks_task_trace_enter() leaves .noinstr.text section vmlinux.o: warning: objtool: rcu_dynticks_eqs_exit()+0xe: call to rcu_dynticks_task_trace_exit() leaves .noinstr.text section
Fix them by adding __always_inline to the relevant trivial functions.
Also replace the noinstr with __always_inline for the existing rcu_dynticks_task_*() functions since noinstr would force noinline them, even when empty, which seems silly.
--- kernel/rcu/tree_plugin.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +4 -4
@@ -2964,7 +2964,7 @@ static void rcu_bind_gp_kthread(void) }/* Record the current task on dyntick-idle entry. */ -static void noinstr rcu_dynticks_task_enter(void) +static __always_inline void rcu_dynticks_task_enter(void) {#if defined(CONFIG_TASKS_RCU ) && defined(CONFIG_NO_HZ_FULL )WRITE_ONCE (current->rcu_tasks_idle_cpu,smp_processor_id ());
@@ -2972,7 +2972,7 @@ static void noinstr rcu_dynticks_task_enter(void) }/* Record no current task on dyntick-idle exit. */ -static void noinstr rcu_dynticks_task_exit(void) +static __always_inline void rcu_dynticks_task_exit(void) {#if defined(CONFIG_TASKS_RCU ) && defined(CONFIG_NO_HZ_FULL )WRITE_ONCE (current->rcu_tasks_idle_cpu,-1 );
@@ -2980,7 +2980,7 @@ static void noinstr rcu_dynticks_task_exit(void) }/* Turn on heavyweight RCU tasks trace readers on idle/user entry. */ -static void rcu_dynticks_task_trace_enter (void ) +static __always_inline void rcu_dynticks_task_trace_enter(void) {#ifdef CONFIG_TASKS_TRACE_RCU if (IS_ENABLED (CONFIG_TASKS_TRACE_RCU_READ_MB ))
@@ -2989,7 +2989,7 @@ static void rcu_dynticks_task_trace_enter(void) }/* Turn off heavyweight RCU tasks trace readers on idle/user exit. */ -static void rcu_dynticks_task_trace_exit (void ) +static __always_inline void rcu_dynticks_task_trace_exit(void) {#ifdef CONFIG_TASKS_TRACE_RCU if (IS_ENABLED (CONFIG_TASKS_TRACE_RCU_READ_MB ))
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 402/849 ath10k: Dont always treat modem stop events as crashes
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit 747ff7d3d7424876111b7559b7f6704762f89796 ]
When rebooting on sc7180 Trogdor devices I see the following crash from the wifi driver.
ath10k_snoc 18800000.wifi: firmware crashed! (guid 83493570-29a2-4e98-a83e-70048c47669c)
This is because a modem stop event looks just like a firmware crash to the driver, the qmi connection is closed in both cases. Use the qcom ssr notifier block to stop treating the qmi connection close event as a firmware crash signal when the modem hasn't actually crashed. See ath10k_qmi_event_server_exit() for more details.
This silences the crash message seen during every reboot.
--- drivers/net/wireless/ath/ath10k/qmi.c | 3 +- drivers/net/wireless/ath/ath10k/snoc.c | 77 ++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/snoc.h | 5 ++ 3 files changed, 84 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/qmi.c +2 -1
@@ -864,7 +864,8 @@ static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi)ath10k_qmi_remove_msa_permission (qmi);ath10k_core_free_board_files (ar); -if (!test_bit (ATH10K_SNOC_FLAG_UNREGISTERING , &ar_snoc->flags)) +if (!test_bit (ATH10K_SNOC_FLAG_UNREGISTERING , &ar_snoc->flags) && + !test_bit (ATH10K_SNOC_FLAG_MODEM_STOPPED , &ar_snoc->flags))ath10k_snoc_fw_crashed_dump (ar);ath10k_snoc_fw_indication (ar,ATH10K_QMI_EVENT_FW_DOWN_IND );
drivers/net/wireless/ath/ath10k/snoc.c +77 -0
105 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/snoc.h +5 -0
@@ -6,6 +6,8 @@#ifndef _SNOC_H_#define _SNOC_H_ +#include <linux/notifier.h> +#include "hw.h" #include "ce.h" #include "qmi.h"
@@ -45,6 +47,7 @@ struct ath10k_snoc_ce_irq {enum ath10k_snoc_flags {ATH10K_SNOC_FLAG_REGISTERED ,ATH10K_SNOC_FLAG_UNREGISTERING , +ATH10K_SNOC_FLAG_MODEM_STOPPED ,ATH10K_SNOC_FLAG_RECOVERY ,ATH10K_SNOC_FLAG_8BIT_HOST_CAP_QUIRK , };
@@ -75,6 +78,8 @@ struct ath10k_snoc {struct clk_bulk_data *clks;size_t num_clks;struct ath10k_qmi *qmi; +struct notifier_block nb; +void *notifier;unsigned long flags;bool xo_cal_supported;u32 xo_cal_data;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 406/849 EDAC/amd64: Handle three rank interleaving mode
In reply to Greg Kroah-HartmanFrom: Yazen Ghannam <[email protected]>
[ Upstream commit 9f4873fb6af7966de8fcbd95c36b61351c1c4b1f ]
AMD Rome systems and later support interleaving between three identical ranks within a channel.
Check for this mode by counting the number of enabled chip selects and comparing their masks. If there are exactly three enabled chip selects and their masks are identical, then three rank interleaving is enabled.
The size of a rank is determined from its mask value. However, three rank interleaving doesn't follow the method of swapping an interleave bit with the most significant bit. Rather, the interleave bit is flipped and the most significant bit remains the same. There is only a single interleave bit in this case.
Account for this when determining the chip select size by keeping the most significant bit at its original value and ignoring any zero bits. This will return a full bitmask in [MSB:1].
--- drivers/edac/amd64_edac.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/edac/amd64_edac.c +21 -1
@@ -1070,12 +1070,14 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan)#define CS_ODD_PRIMARY BIT(1)#define CS_EVEN_SECONDARY BIT(2)#define CS_ODD_SECONDARY BIT(3) +#define CS_3R_INTERLEAVE BIT(4)#define CS_EVEN (CS_EVEN_PRIMARY | CS_EVEN_SECONDARY)#define CS_ODD (CS_ODD_PRIMARY | CS_ODD_SECONDARY)static int f17_get_cs_mode (int dimm,u8 ctrl,struct amd64_pvt *pvt) { +u8 base, count =0 ;int cs_mode =0 ;if (csrow_enabled (2 * dimm, ctrl, pvt))
@@ -1088,6 +1090,20 @@ static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt)if (csrow_sec_enabled (2 * dimm +1 , ctrl, pvt)) cs_mode |=CS_ODD_SECONDARY ; +/* +* 3 Rank inteleaving support. +* There should be only three bases enabled and their two masks should +* be equal. +*/ +for_each_chip_select (base, ctrl, pvt) + count +=csrow_enabled (base, ctrl, pvt); + +if (count ==3 && + pvt->csels[ctrl].csmasks[0 ] == pvt->csels[ctrl].csmasks[1 ]) { +edac_dbg (1 ,"3R interleaving in use.\n" ); + cs_mode |=CS_3R_INTERLEAVE ; + } +return cs_mode; }
@@ -1896,10 +1912,14 @@ static int f17_addr_mask_to_cs_size(struct amd64_pvt *pvt, u8 umc,* * The MSB is the number of bits in the full mask because BIT[0] is * always 0. +* +* In the special 3 Rank interleaving case, a single bit is flipped +* without swapping with the most significant bit. This can be handled +* by keeping the MSB where it is and ignoring the single zero bit. */ msb =fls (addr_mask_orig) -1 ; weight =hweight_long (addr_mask_orig); - num_zero_bits = msb - weight; + num_zero_bits = msb - weight - !!(cs_mode &CS_3R_INTERLEAVE );/* Take the number of zero bits off from the top of the mask. */ addr_mask_deinterleaved =GENMASK_ULL (msb - num_zero_bits,1 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 399/849 drm: fb_helper: fix CONFIG_FB dependency
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 606b102876e3741851dfb09d53f3ee57f650a52c ]
With CONFIG_FB=m and CONFIG_DRM=y, we get a link error in the fb helper:
aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_alloc_fbi':
(.text+0x10cc): undefined reference to `framebuffer_alloc'
Tighten the dependency so it is only allowed in the case that DRM can link against FB.
--- drivers/gpu/drm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/Kconfig +1 -1
@@ -98,7 +98,7 @@ config DRM_DEBUG_DP_MST_TOPOLOGY_REFS config DRM_FBDEV_EMULATION bool "Enable legacy fbdev support for your modesetting driver" depends on DRM - depends on FB + depends on FB=y || FB=DRM select DRM_KMS_HELPER select FB_CFB_FILLRECT select FB_CFB_COPYAREA
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 400/849 cpuidle: Fix kobject memory leaks in error paths
In reply to Greg Kroah-HartmanFrom: Anel Orazgaliyeva <[email protected]>
[ Upstream commit e5f5a66c9aa9c331da5527c2e3fd9394e7091e01 ]
Commit c343bf1ba5ef ("cpuidle: Fix three reference count leaks") fixes the cleanup of kobjects; however, it removes kfree() calls altogether, leading to memory leaks.
Fix those and also defer the initialization of dev->kobj_dev until after the error check, so that we do not end up with a dangling pointer.
--- drivers/cpuidle/sysfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/cpuidle/sysfs.c +4 -1
@@ -488,6 +488,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device) &kdev->kobj, "state%d", i);if (ret) {kobject_put (&kobj->kobj); +kfree (kobj); goto error_state; }cpuidle_add_s2idle_attr_group (kobj);
@@ -619,6 +620,7 @@ static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev) &kdev->kobj, "driver");if (ret) {kobject_put (&kdrv->kobj); +kfree (kdrv);return ret; }
@@ -705,7 +707,6 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)if (!kdev)return -ENOMEM ; kdev->dev = dev; - dev->kobj_dev = kdev;init_completion (&kdev->kobj_unregister);
@@ -713,9 +714,11 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev) "cpuidle");if (error) {kobject_put (&kdev->kobj); +kfree (kdev);return error; } + dev->kobj_dev = kdev;kobject_uevent (&kdev->kobj,KOBJ_ADD );return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 404/849 PM: EM: Fix inefficient states detection
In reply to Greg Kroah-HartmanFrom: Vincent Donnefort <[email protected]>
[ Upstream commit aa1a43262ad5df010768f69530fa179ff81651d3 ]
Currently, a debug message is printed if an inefficient state is detected in the Energy Model. Unfortunately, it won't detect if the first state is inefficient or if two successive states are. Fix this behavior.
--- kernel/power/energy_model.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
kernel/power/energy_model.c +8 -15
@@ -107,8 +107,7 @@ static void em_debug_remove_pd(struct device *dev) {}static int em_create_perf_table (struct device *dev,struct em_perf_domain *pd,int nr_states,struct em_data_callback *cb) { -unsigned long opp_eff, prev_opp_eff =ULONG_MAX ; -unsigned long power, freq, prev_freq =0 ; +unsigned long power, freq, prev_freq =0 , prev_cost =ULONG_MAX ;struct em_perf_state *table;int i, ret;u64 fmax;
@@ -153,27 +152,21 @@ static int em_create_perf_table(struct device *dev, struct em_perf_domain *pd, table[i].power = power; table[i].frequency = prev_freq = freq; - -/* -* The hertz/watts efficiency ratio should decrease as the -* frequency grows on sane platforms. But this isn't always -* true in practice so warn the user if a higher OPP is more -* power efficient than a lower one. -*/ - opp_eff = freq / power; -if (opp_eff >= prev_opp_eff) -dev_dbg (dev,"EM: hertz/watts ratio non-monotonically decreasing: em_perf_state %d >= em_perf_state%d\n" , - i, i -1 ); - prev_opp_eff = opp_eff; }/* Compute the cost of each performance state. */ fmax = (u64 ) table[nr_states -1 ].frequency; -for (i =0 ; i < nr_states; i++) { +for (i = nr_states -1 ; i >=0 ; i--) {unsigned long power_res =em_scale_power (table[i].power); table[i].cost =div64_u64 (fmax * power_res, table[i].frequency); +if (table[i].cost >= prev_cost) { +dev_dbg (dev,"EM: OPP:%lu is inefficient\n" , + table[i].frequency); + }else { + prev_cost = table[i].cost; + } } pd->table = table;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 417/849 b43: fix a lower bounds test
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 9b793db5fca44d01f72d3564a168171acf7c4076 ]
The problem is that "channel" is an unsigned int, when it's less 5 the value of "channel - 5" is not a negative number as one would expect but is very high positive value instead.
This means that "start" becomes a very high positive value. The result of that is that we never enter the "for (i = start; i <= end; i++) {" loop. Instead of storing the result from b43legacy_radio_aci_detect() it just uses zero.
--- drivers/net/wireless/broadcom/b43/phy_g.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/phy_g.c +1 -1
@@ -2297,7 +2297,7 @@ static u8 b43_gphy_aci_scan(struct b43_wldev *dev)b43_phy_mask (dev,B43_PHY_G_CRS ,0x7FFF );b43_set_all_gains (dev,3 ,8 ,1 ); - start = (channel -5 >0 ) ? channel -5 :1 ; + start = (channel >5 ) ? channel -5 :1 ; end = (channel +5 <14 ) ? channel +5 :13 ;for (i = start; i <= end; i++) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 397/849 kprobes: Do not use local variable when creating debugfs file
In reply to Greg Kroah-HartmanFrom: Punit Agrawal <[email protected]>
[ Upstream commit 8f7262cd66699a4b02eb7549b35c81b2116aad95 ]
debugfs_create_file() takes a pointer argument that can be used during file operation callbacks (accessible via i_private in the inode structure). An obvious requirement is for the pointer to refer to valid memory when used.
When creating the debugfs file to dynamically enable / disable kprobes, a pointer to local variable is passed to debugfs_create_file(); which will go out of scope when the init function returns. The reason this hasn't triggered random memory corruption is because the pointer is not accessed during the debugfs file callbacks.
Since the enabled state is managed by the kprobes_all_disabled global variable, the local variable is not needed. Fix the incorrect (and unnecessary) usage of local variable during debugfs_file_create() by passing NULL instead.
--- kernel/kprobes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/kprobes.c +1 -2
@@ -2809,13 +2809,12 @@ static const struct file_operations fops_kp = {static int __init debugfs_kprobe_init (void ) {struct dentry *dir; -unsigned int value =1 ; dir =debugfs_create_dir ("kprobes" ,NULL );debugfs_create_file ("list" ,0400 , dir,NULL , &kprobes_fops); -debugfs_create_file ("enabled" ,0600 , dir, &value, &fops_kp); +debugfs_create_file ("enabled" ,0600 , dir,NULL , &fops_kp);debugfs_create_file ("blacklist" ,0400 , dir,NULL , &kprobe_blacklist_fops);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 433/849 crypto: octeontx2 - set assoclen in aead_do_fallback()
In reply to Greg Kroah-HartmanFrom: Ovidiu Panait <[email protected]>
[ Upstream commit 06f6e365e2ecf799c249bb464aa9d5f055e88b56 ]
Currently, in case of aead fallback, no associated data info is set in the fallback request. To fix this, call aead_request_set_ad() to pass the assoclen.
--- drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c +1 -0
@@ -1274,6 +1274,7 @@ static int aead_do_fallback(struct aead_request *req, bool is_enc) req->base.complete, req->base.data);aead_request_set_crypt (&rctx->fbk_req, req->src, req->dst, req->cryptlen, req->iv); +aead_request_set_ad (&rctx->fbk_req, req->assoclen); ret = is_enc ?crypto_aead_encrypt (&rctx->fbk_req) :crypto_aead_decrypt (&rctx->fbk_req); }else {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 395/849 media: atmel: fix the ispck initialization
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
[ Upstream commit d7f26849ed7cc875d0ff7480c2efebeeccea2bad ]
The runtime enabling of the ISPCK (internally clocks the pipeline inside the ISC) has to be done after the pm_runtime for the ISC dev has been started.
After the commit by Mauro:
the ISC failed to probe with the error:
atmel-sama5d2-isc f0008000.isc: failed to enable ispck: -13
atmel-sama5d2-isc: probe of f0008000.isc failed with error -13
This is because the enabling of the ispck is done too early in the probe, and the PM runtime returns invalid request.
Thus, moved this clock enabling after pm_runtime_idle is called.
The ISPCK is required only for sama5d2 type of ISC.
Thus, add a bool inside the isc struct that is platform dependent. For the sama7g5-isc, the enabling of the ISPCK is wrong and does not make sense. Removed it from the sama7g5 probe. In sama7g5-isc, there is only one clock, the MCK, which also clocks the internal pipeline of the ISC.
Adapted the clk_prepare and clk_unprepare to request the runtime PM for both clocks (MCK and ISPCK) in case of sama5d2-isc, and the single clock (MCK) in case of sama7g5-isc.
--- drivers/media/platform/atmel/atmel-isc-base.c | 25 ++++++------ drivers/media/platform/atmel/atmel-isc.h | 2 + .../media/platform/atmel/atmel-sama5d2-isc.c | 39 ++++++++++--------- .../media/platform/atmel/atmel-sama7g5-isc.c | 22 ++--------- 4 files changed, 38 insertions(+), 50 deletions(-)
drivers/media/platform/atmel/atmel-isc-base.c +11 -14
@@ -123,11 +123,9 @@ static int isc_clk_prepare(struct clk_hw *hw)struct isc_clk *isc_clk =to_isc_clk (hw);int ret; -if (isc_clk->id ==ISC_ISPCK ) { - ret =pm_runtime_resume_and_get (isc_clk->dev); -if (ret <0 ) -return ret; - } + ret =pm_runtime_resume_and_get (isc_clk->dev); +if (ret <0 ) +return ret;return isc_wait_clk_stable (hw); }
@@ -138,8 +136,7 @@ static void isc_clk_unprepare(struct clk_hw *hw)isc_wait_clk_stable (hw); -if (isc_clk->id ==ISC_ISPCK ) -pm_runtime_put_sync (isc_clk->dev); +pm_runtime_put_sync (isc_clk->dev); }static int isc_clk_enable (struct clk_hw *hw)
@@ -186,16 +183,13 @@ static int isc_clk_is_enabled(struct clk_hw *hw)u32 status;int ret; -if (isc_clk->id ==ISC_ISPCK ) { - ret =pm_runtime_resume_and_get (isc_clk->dev); -if (ret <0 ) -return 0 ; - } + ret =pm_runtime_resume_and_get (isc_clk->dev); +if (ret <0 ) +return 0 ;regmap_read (isc_clk->regmap,ISC_CLKSR , &status); -if (isc_clk->id ==ISC_ISPCK ) -pm_runtime_put_sync (isc_clk->dev); +pm_runtime_put_sync (isc_clk->dev);return status &ISC_CLK (isc_clk->id) ?1 :0 ; }
@@ -325,6 +319,9 @@ static int isc_clk_register(struct isc_device *isc, unsigned int id)const char *parent_names[3 ];int num_parents; +if (id ==ISC_ISPCK && !isc->ispck_required) +return 0 ; + num_parents =of_clk_get_parent_count (np);if (num_parents <1 || num_parents >3 )return -EINVAL ;
drivers/media/platform/atmel/atmel-isc.h +2 -0
@@ -178,6 +178,7 @@ struct isc_reg_offsets {* @hclock: Hclock clock input (refer datasheet) * @ispck: iscpck clock (refer datasheet) * @isc_clks: ISC clocks +* @ispck_required: ISC requires ISP Clock initialization * @dcfg: DMA master configuration, architecture dependent * * @dev: Registered device driver
@@ -252,6 +253,7 @@ struct isc_device {struct clk *hclock;struct clk *ispck;struct isc_clk isc_clks[2 ]; +bool ispck_required;u32 dcfg;struct device *dev;
drivers/media/platform/atmel/atmel-sama5d2-isc.c +21 -18
@@ -454,6 +454,9 @@ static int atmel_isc_probe(struct platform_device *pdev)/* sama5d2-isc - 8 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS8 |ISC_DCFG_CMBSIZE_BEATS8 ; +/* sama5d2-isc : ISPCK is required and mandatory */ + isc->ispck_required = true; + ret =isc_pipeline_init (isc);if (ret)return ret;
@@ -476,22 +479,6 @@ static int atmel_isc_probe(struct platform_device *pdev)dev_err (dev,"failed to init isc clock: %d\n" , ret); goto unprepare_hclk; } - - isc->ispck = isc->isc_clks[ISC_ISPCK ].clk; - - ret =clk_prepare_enable (isc->ispck); -if (ret) { -dev_err (dev,"failed to enable ispck: %d\n" , ret); - goto unprepare_hclk; - } - -/* ispck should be greater or equal to hclock */ - ret =clk_set_rate (isc->ispck,clk_get_rate (isc->hclock)); -if (ret) { -dev_err (dev,"failed to set ispck rate: %d\n" , ret); - goto unprepare_clk; - } - ret =v4l2_device_register (dev, &isc->v4l2_dev);if (ret) {dev_err (dev,"unable to register v4l2 device.\n" );
@@ -545,19 +532,35 @@ static int atmel_isc_probe(struct platform_device *pdev)pm_runtime_enable (dev);pm_request_idle (dev); + isc->ispck = isc->isc_clks[ISC_ISPCK ].clk; + + ret =clk_prepare_enable (isc->ispck); +if (ret) { +dev_err (dev,"failed to enable ispck: %d\n" , ret); + goto cleanup_subdev; + } + +/* ispck should be greater or equal to hclock */ + ret =clk_set_rate (isc->ispck,clk_get_rate (isc->hclock)); +if (ret) { +dev_err (dev,"failed to set ispck rate: %d\n" , ret); + goto unprepare_clk; + } +regmap_read (isc->regmap,ISC_VERSION + isc->offsets.version, &ver);dev_info (dev,"Microchip ISC version %x\n" , ver);return 0 ; +unprepare_clk: +clk_disable_unprepare (isc->ispck); + cleanup_subdev:isc_subdev_cleanup (isc); unregister_v4l2_device:v4l2_device_unregister (&isc->v4l2_dev); -unprepare_clk: -clk_disable_unprepare (isc->ispck); unprepare_hclk:clk_disable_unprepare (isc->hclock);
drivers/media/platform/atmel/atmel-sama7g5-isc.c +4 -18
@@ -447,6 +447,9 @@ static int microchip_xisc_probe(struct platform_device *pdev)/* sama7g5-isc RAM access port is full AXI4 - 32 bits per beat */ isc->dcfg =ISC_DCFG_YMBSIZE_BEATS32 |ISC_DCFG_CMBSIZE_BEATS32 ; +/* sama7g5-isc : ISPCK does not exist, ISC is clocked by MCK */ + isc->ispck_required = false; + ret =isc_pipeline_init (isc);if (ret)return ret;
@@ -470,25 +473,10 @@ static int microchip_xisc_probe(struct platform_device *pdev) goto unprepare_hclk; } - isc->ispck = isc->isc_clks[ISC_ISPCK ].clk; - - ret =clk_prepare_enable (isc->ispck); -if (ret) { -dev_err (dev,"failed to enable ispck: %d\n" , ret); - goto unprepare_hclk; - } - -/* ispck should be greater or equal to hclock */ - ret =clk_set_rate (isc->ispck,clk_get_rate (isc->hclock)); -if (ret) { -dev_err (dev,"failed to set ispck rate: %d\n" , ret); - goto unprepare_clk; - } - ret =v4l2_device_register (dev, &isc->v4l2_dev);if (ret) {dev_err (dev,"unable to register v4l2 device.\n" ); - goto unprepare_clk; + goto unprepare_hclk; } ret =xisc_parse_dt (dev, isc);
@@ -549,8 +537,6 @@ cleanup_subdev: unregister_v4l2_device:v4l2_device_unregister (&isc->v4l2_dev); -unprepare_clk: -clk_disable_unprepare (isc->ispck); unprepare_hclk:clk_disable_unprepare (isc->hclock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 388/849 media: imx-jpeg: Fix the error handling path of mxc_jpeg_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5c47dc6657543b3c4dffcbe741fb693b9b96796d ]
A successful 'mxc_jpeg_attach_pm_domains()' call should be balanced by a corresponding 'mxc_jpeg_detach_pm_domains()' call in the error handling path of the probe, as already done in the remove function.
Update the error handling path accordingly.
--- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/imx-jpeg/mxc-jpeg.c +2 -0
@@ -2092,6 +2092,8 @@ err_m2m:v4l2_device_unregister (&jpeg->v4l2_dev); err_register: +mxc_jpeg_detach_pm_domains (jpeg); + err_irq:return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 434/849 thermal/core: fix a UAF bug in __thermal_cooling_device_register()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 0a5c26712f963f0500161a23e0ffff8d29f742ab ]
When device_register() return failed, program will goto out_kfree_type to release 'cdev->device' by put_device(). That will call thermal_release() to free 'cdev'. But the follow-up processes access 'cdev' continually. That trggers the UAF bug.
====================================================================
BUG: KASAN: use-after-free in __thermal_cooling_device_register+0x75b/0xa90 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: dump_stack_lvl+0xe2/0x152 print_address_description.constprop.0+0x21/0x140 ? __thermal_cooling_device_register+0x75b/0xa90 kasan_report.cold+0x7f/0x11b ? __thermal_cooling_device_register+0x75b/0xa90 __thermal_cooling_device_register+0x75b/0xa90 ? memset+0x20/0x40 ? __sanitizer_cov_trace_pc+0x1d/0x50 ? __devres_alloc_node+0x130/0x180 devm_thermal_of_cooling_device_register+0x67/0xf0 max6650_probe.cold+0x557/0x6aa
......
Freed by task 258: kasan_save_stack+0x1b/0x40 kasan_set_track+0x1c/0x30 kasan_set_free_info+0x20/0x30 __kasan_slab_free+0x109/0x140 kfree+0x117/0x4c0 thermal_release+0xa0/0x110 device_release+0xa7/0x240 kobject_put+0x1ce/0x540 put_device+0x20/0x30 __thermal_cooling_device_register+0x731/0xa90 devm_thermal_of_cooling_device_register+0x67/0xf0 max6650_probe.cold+0x557/0x6aa [max6650]
Do not use 'cdev' again after put_device() to fix the problem like doing in thermal_zone_device_register().
[dlezcano]: as requested by Rafael, change the affectation into two statements.
--- drivers/thermal/thermal_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/thermal/thermal_core.c +4 -2
@@ -887,7 +887,7 @@ __thermal_cooling_device_register(struct device_node *np, {struct thermal_cooling_device *cdev;struct thermal_zone_device *pos =NULL ; -int ret; +int id, ret;if (!ops || !ops->get_max_state || !ops->get_cur_state || !ops->set_cur_state)
@@ -901,6 +901,7 @@ __thermal_cooling_device_register(struct device_node *np,if (ret <0 ) goto out_kfree_cdev; cdev->id = ret; + id = ret; ret =dev_set_name (&cdev->device,"cooling_device%d" , cdev->id);if (ret)
@@ -944,8 +945,9 @@ __thermal_cooling_device_register(struct device_node *np, out_kfree_type:kfree (cdev->type);put_device (&cdev->device); + cdev =NULL ; out_ida_remove: -ida_simple_remove (&thermal_cdev_ida, cdev->id); +ida_simple_remove (&thermal_cdev_ida, id); out_kfree_cdev:kfree (cdev);return ERR_PTR (ret);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 396/849 scs: Release kasan vmalloc poison in scs_free process
In reply to Greg Kroah-HartmanFrom: Yee Lee <[email protected]>
[ Upstream commit 528a4ab45300fa6283556d9b48e26b45a8aa15c4 ]
Since scs allocation is moved to vmalloc region, the shadow stack is protected by kasan_posion_vmalloc. However, the vfree_atomic operation needs to access its context for scs_free process and causes kasan error as the dump info below.
This patch Adds kasan_unpoison_vmalloc() before vfree_atomic, which aligns to the prior flow as using kmem_cache. The vmalloc region will go back posioned in the following vumap() operations.
==================================================================
BUG: KASAN: vmalloc-out-of-bounds in llist_add_batch+0x60/0xd4
Write of size 8 at addr ffff8000100b9000 by task kthreadd/2
CPU: 0 PID: 2 Comm: kthreadd Not tainted 5.15.0-rc2-11681-g92477dd1faa6-dirty #1
Hardware name: linux,dummy-virt (DT)
Call trace:
dump_backtrace+0x0/0x43c
show_stack+0x1c/0x2c
dump_stack_lvl+0x68/0x84
print_address_description+0x80/0x394
kasan_report+0x180/0x1dc
__asan_report_store8_noabort+0x48/0x58
llist_add_batch+0x60/0xd4
vfree_atomic+0x60/0xe0
scs_free+0x1dc/0x1fc
scs_release+0xa4/0xd4
free_task+0x30/0xe4
__put_task_struct+0x1ec/0x2e0
delayed_put_task_struct+0x5c/0xa0
rcu_do_batch+0x62c/0x8a0
rcu_core+0x60c/0xc14
rcu_core_si+0x14/0x24
__do_softirq+0x19c/0x68c
irq_exit+0x118/0x2dc
handle_domain_irq+0xcc/0x134
gic_handle_irq+0x7c/0x1bc
call_on_irq_stack+0x40/0x70
do_interrupt_handler+0x78/0x9c
el1_interrupt+0x34/0x60
el1h_64_irq_handler+0x1c/0x2c
el1h_64_irq+0x78/0x7c
_raw_spin_unlock_irqrestore+0x40/0xcc
sched_fork+0x4f0/0xb00
copy_process+0xacc/0x3648
kernel_clone+0x168/0x534
kernel_thread+0x13c/0x1b0
kthreadd+0x2bc/0x400
ret_from_fork+0x10/0x20
Memory state around the buggy address:
ffff8000100b8f00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffff8000100b8f80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>ffff8000100b9000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
^
ffff8000100b9080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffff8000100b9100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================--- kernel/scs.c | 1 + 1 file changed, 1 insertion(+)
kernel/scs.c +1 -0
@@ -78,6 +78,7 @@ void scs_free(void *s)if (this_cpu_cmpxchg (scs_cache[i],0 , s) ==NULL )return ; +kasan_unpoison_vmalloc (s,SCS_SIZE );vfree_atomic (s); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 424/849 net, neigh: Fix NTF_EXT_LEARNED in combination with NTF_USE
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit e4400bbf5b15750e1b59bf4722d18d99be60c69f ]
The NTF_EXT_LEARNED neigh flag is usually propagated back to user space upon dump of the neighbor table. However, when used in combination with NTF_USE flag this is not the case despite exempting the entry from the garbage collector. This results in inconsistent state since entries are typically marked in neigh->flags with NTF_EXT_LEARNED, but here they are not. Fix it by propagating the creation flag to ___neigh_create().
Before fix:
# ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a REACHABLE [...]
After fix:
# ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn # ./ip/ip n 192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a extern_learn REACHABLE [...]
--- net/core/neighbour.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
net/core/neighbour.c +14 -12
@@ -379,7 +379,7 @@ EXPORT_SYMBOL(neigh_ifdown);static struct neighbour *neigh_alloc (struct neigh_table *tbl,struct net_device *dev, -bool exempt_from_gc) +u8 flags,bool exempt_from_gc) {struct neighbour *n =NULL ;unsigned long now = jiffies;
@@ -412,6 +412,7 @@ do_alloc: n->updated = n->used = now; n->nud_state =NUD_NONE ; n->output = neigh_blackhole; + n->flags = flags;seqlock_init (&n->hh.hh_lock); n->parms =neigh_parms_clone (&tbl->parms);timer_setup (&n->timer, neigh_timer_handler,0 );
@@ -575,19 +576,18 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, }EXPORT_SYMBOL (neigh_lookup_nodev); -static struct neighbour *___neigh_create (struct neigh_table *tbl, -const void *pkey, -struct net_device *dev, -bool exempt_from_gc,bool want_ref) +static struct neighbour * +___neigh_create (struct neigh_table *tbl,const void *pkey, +struct net_device *dev,u8 flags, +bool exempt_from_gc,bool want_ref) { -struct neighbour *n1, *rc, *n =neigh_alloc (tbl, dev, exempt_from_gc); -u32 hash_val; -unsigned int key_len = tbl->key_len; -int error; +u32 hash_val, key_len = tbl->key_len; +struct neighbour *n1, *rc, *n;struct neigh_hash_table *nht; +int error; + n =neigh_alloc (tbl, dev, flags, exempt_from_gc);trace_neigh_create (tbl, dev, pkey, n, exempt_from_gc); -if (!n) { rc =ERR_PTR (-ENOBUFS ); goto out;
@@ -674,7 +674,7 @@ out_neigh_release:struct neighbour *__neigh_create (struct neigh_table *tbl,const void *pkey,struct net_device *dev,bool want_ref) { -return ___neigh_create (tbl, pkey, dev, false, want_ref); +return ___neigh_create (tbl, pkey, dev,0 , false, want_ref); }EXPORT_SYMBOL (__neigh_create);
@@ -1947,7 +1947,9 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, exempt_from_gc = ndm->ndm_state &NUD_PERMANENT || ndm->ndm_flags &NTF_EXT_LEARNED ; - neigh =___neigh_create (tbl, dst, dev, exempt_from_gc, true); + neigh =___neigh_create (tbl, dst, dev, + ndm->ndm_flags &NTF_EXT_LEARNED , + exempt_from_gc, true);if (IS_ERR (neigh)) { err =PTR_ERR (neigh); goto out;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 435/849 drm/msm: Fix potential Oops in a6xx_gmu_rpmh_init()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3d91e50ff58364f6572ad268b508175d27800e51 ]
There are two problems here:
1) The "seqptr" is used uninitalized when we free it at the end.
2) The a6xx_gmu_get_mmio() function returns error pointers. It never returns true.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +3 -3
@@ -516,11 +516,11 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;struct platform_device *pdev =to_platform_device (gmu->dev);void __iomem *pdcptr =a6xx_gmu_get_mmio (pdev,"gmu_pdc" ); -void __iomem *seqptr; +void __iomem *seqptr =NULL ;uint32_t pdc_address_offset;bool pdc_in_aop = false; -if (!pdcptr) +if (IS_ERR (pdcptr)) goto err;if (adreno_is_a650 (adreno_gpu) ||adreno_is_a660 (adreno_gpu))
@@ -532,7 +532,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)if (!pdc_in_aop) { seqptr =a6xx_gmu_get_mmio (pdev,"gmu_pdc_seq" ); -if (!seqptr) +if (IS_ERR (seqptr)) goto err; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 436/849 drm/msm: potential error pointer dereference in init()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b6816441a14bbe356ba8590de79cfea2de6a085c ]
The msm_iommu_new() returns error pointers on failure so check for that to avoid an Oops.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +4 -0
@@ -896,6 +896,10 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)return 0 ; mmu =msm_iommu_new (dpu_kms->dev->dev, domain); +if (IS_ERR (mmu)) { +iommu_domain_free (domain); +return PTR_ERR (mmu); + } aspace =msm_gem_address_space_create (mmu,"dpu1" ,0x1000 ,0x100000000 -0x1000 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 391/849 media: radio-wl1273: Avoid card name truncation
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit dfadec236aa99f6086141949c9dc3ec50f3ff20d ]
The "card" string only holds 31 characters (and the terminating NUL). In order to avoid truncation, use a shorter card description instead of the current result, "Texas Instruments Wl1273 FM Rad".
--- drivers/media/radio/radio-wl1273.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/radio/radio-wl1273.c +1 -1
@@ -1279,7 +1279,7 @@ static int wl1273_fm_vidioc_querycap(struct file *file, void *priv,strscpy (capability->driver,WL1273_FM_DRIVER_NAME ,sizeof (capability->driver)); -strscpy (capability->card,"Texas Instruments Wl1273 FM Radio" , +strscpy (capability->card,"TI Wl1273 FM Radio" ,sizeof (capability->card));strscpy (capability->bus_info, radio->bus_type,sizeof (capability->bus_info));
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 422/849 memstick: avoid out-of-range warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 4853396f03c3019eccf5cd113e464231e9ddf0b3 ]
clang-14 complains about a sanity check that always passes when the page size is 64KB or larger:
drivers/memstick/core/ms_block.c:1739:21: error: result of comparison of constant 65536 with expression of type 'unsigned short' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (msb->page_size > PAGE_SIZE) {
~~~~~~~~~~~~~~ ^ ~~~~~~~~~This is fine, it will still work on all architectures, so just shut up that warning with a cast.
--- drivers/memstick/core/ms_block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memstick/core/ms_block.c +1 -1
@@ -1736,7 +1736,7 @@ static int msb_init_card(struct memstick_dev *card) msb->pages_in_block = boot_block->attr.block_size *2 ; msb->block_size = msb->page_size * msb->pages_in_block; -if (msb->page_size >PAGE_SIZE ) { +if ((size_t )msb->page_size >PAGE_SIZE ) {/* this isn't supported by linux at all, anyway*/ dbg ("device page %d size isn't supported" , msb->page_size);return -EINVAL ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 393/849 media: tm6000: Avoid card name truncation
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 42bb98e420d454fef3614b70ea11cc59068395f6 ]
The "card" string only holds 31 characters (and the terminating NUL). In order to avoid truncation, use a shorter card description instead of the current result, "Trident TVMaster TM5600/6000/60".
--- drivers/media/usb/tm6000/tm6000-video.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/usb/tm6000/tm6000-video.c +1 -2
@@ -852,8 +852,7 @@ static int vidioc_querycap(struct file *file, void *priv,struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev;strscpy (cap->driver,"tm6000" ,sizeof (cap->driver)); -strscpy (cap->card,"Trident TVMaster TM5600/6000/6010" , -sizeof (cap->card)); +strscpy (cap->card,"Trident TM5600/6000/6010" ,sizeof (cap->card));usb_make_path (dev->udev, cap->bus_info,sizeof (cap->bus_info)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_READWRITE |V4L2_CAP_DEVICE_CAPS ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 392/849 media: si470x: Avoid card name truncation
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 2908249f3878a591f7918368fdf0b7b0a6c3158c ]
The "card" string only holds 31 characters (and the terminating NUL). In order to avoid truncation, use a shorter card description instead of the current result, "Silicon Labs Si470x FM Radio Re".
--- drivers/media/radio/si470x/radio-si470x-i2c.c | 2 +- drivers/media/radio/si470x/radio-si470x-usb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/radio/si470x/radio-si470x-i2c.c +1 -1
@@ -11,7 +11,7 @@/* driver definitions */ #define DRIVER_AUTHOR "Joonyoung Shim <[email protected]>"; -#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" +#define DRIVER_CARD "Silicon Labs Si470x FM Radio"#define DRIVER_DESC "I2C radio driver for Si470x FM Radio Receivers"#define DRIVER_VERSION "1.0.2"
drivers/media/radio/si470x/radio-si470x-usb.c +1 -1
@@ -16,7 +16,7 @@/* driver definitions */ #define DRIVER_AUTHOR "Tobias Lorenz <[email protected]>" -#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" +#define DRIVER_CARD "Silicon Labs Si470x FM Radio"#define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers"#define DRIVER_VERSION "1.0.10"
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 418/849 gve: Recover from queue stall due to missed IRQ
In reply to Greg Kroah-HartmanFrom: John Fraker <[email protected]>
[ Upstream commit 87a7f321bb6a45e54b7d6c90d032ee5636a6ad97 ]
Don't always reset the driver on a TX timeout. Attempt to recover by kicking the queue in case an IRQ was missed.
--- drivers/net/ethernet/google/gve/gve.h | 4 +- drivers/net/ethernet/google/gve/gve_adminq.h | 1 + drivers/net/ethernet/google/gve/gve_main.c | 48 +++++++++++++++++++- 3 files changed, 51 insertions(+), 2 deletions(-)
drivers/net/ethernet/google/gve/gve.h +3 -1
@@ -30,7 +30,7 @@#define GVE_MIN_MSIX 3/* Numbers of gve tx/rx stats in stats report. */ -#define GVE_TX_STATS_REPORT_NUM 5 +#define GVE_TX_STATS_REPORT_NUM 6#define GVE_RX_STATS_REPORT_NUM 2/* Interval to schedule a stats report update, 20000ms. */
@@ -413,7 +413,9 @@ struct gve_tx_ring {u32 q_num____cacheline_aligned ;/* queue idx */ u32 stop_queue;/* count of queue stops */ u32 wake_queue;/* count of queue wakes */ +u32 queue_timeout;/* count of queue timeouts */ u32 ntfy_id;/* notification block index */ +u32 last_kick_msec;/* Last time the queue was kicked */ dma_addr_t bus;/* dma address of the descr ring */ dma_addr_t q_resources_bus;/* dma address of the queue resources */ dma_addr_t complq_bus_dqo;/* dma address of the dqo.compl_ring */
drivers/net/ethernet/google/gve/gve_adminq.h +1 -0
@@ -270,6 +270,7 @@ enum gve_stat_names {TX_LAST_COMPLETION_PROCESSED =5 ,RX_NEXT_EXPECTED_SEQUENCE =6 ,RX_BUFFERS_POSTED =7 , +TX_TIMEOUT_CNT =8 ,// stats from NIC RX_QUEUE_DROP_CNT =65 , RX_NO_BUFFERS_POSTED = 66,
drivers/net/ethernet/google/gve/gve_main.c +47 -1
68 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 419/849 gve: Track RX buffer allocation failures
In reply to Greg Kroah-HartmanFrom: Catherine Sullivan <[email protected]>
[ Upstream commit 1b4d1c9bab091ac6e20a3ff80c30c5cefe192bf4 ]
The rx_buf_alloc_fail counter wasn't getting updated.
--- drivers/net/ethernet/google/gve/gve_rx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_rx.c +6 -1
@@ -514,8 +514,13 @@ static bool gve_rx_refill_buffers(struct gve_priv *priv, struct gve_rx_ring *rx)gve_rx_free_buffer (dev, page_info, data_slot); page_info->page =NULL ; -if (gve_rx_alloc_buffer (priv, dev, page_info, data_slot)) +if (gve_rx_alloc_buffer (priv, dev, page_info, + data_slot)) { +u64_stats_update_begin (&rx->statss); + rx->rx_buf_alloc_fail++; +u64_stats_update_end (&rx->statss);break ; + } } } fill_cnt++;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 420/849 mmc: sdhci-omap: Fix NULL pointer exception if regulator is not configured
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 8e0e7bd38b1ec7f9e5d18725ad41828be4e09859 ]
If sdhci-omap is configured for an unused device instance and the device is not set as disabled, we can get a NULL pointer dereference:
Unable to handle kernel NULL pointer dereference at virtual address
00000045
...
(regulator_set_voltage) from [<c07d7008>] (mmc_regulator_set_ocr+0x44/0xd0) (mmc_regulator_set_ocr) from [<c07e2d80>] (sdhci_set_ios+0xa4/0x490) (sdhci_set_ios) from [<c07ea690>] (sdhci_omap_set_ios+0x124/0x160) (sdhci_omap_set_ios) from [<c07c8e94>] (mmc_power_up.part.0+0x3c/0x154) (mmc_power_up.part.0) from [<c07c9d20>] (mmc_start_host+0x88/0x9c) (mmc_start_host) from [<c07cad34>] (mmc_add_host+0x58/0x7c) (mmc_add_host) from [<c07e2574>] (__sdhci_add_host+0xf0/0x22c) (__sdhci_add_host) from [<c07eaf68>] (sdhci_omap_probe+0x318/0x72c) (sdhci_omap_probe) from [<c06a39d8>] (platform_probe+0x58/0xb8)
AFAIK we are not seeing this with the devices configured in the mainline kernel but this can cause issues for folks bringing up their boards.
--- drivers/mmc/host/sdhci-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-omap.c +2 -1
@@ -682,7 +682,8 @@ static void sdhci_omap_set_power(struct sdhci_host *host, unsigned char mode, {struct mmc_host *mmc = host->mmc; -mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); +if (!IS_ERR (mmc->supply.vmmc)) +mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); }static int sdhci_omap_enable_dma (struct sdhci_host *host)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 394/849 media: cx23885: Fix snd_card_free call on null card pointer
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 7266dda2f1dfe151b12ef0c14eb4d4e622fb211c ]
Currently a call to snd_card_new that fails will set card with a NULL pointer, this causes a null pointer dereference on the error cleanup path when card it passed to snd_card_free. Fix this by adding a new error exit path that does not call snd_card_free and exiting via this new path.
Addresses-Coverity: ("Explicit null dereference")
--- drivers/media/pci/cx23885/cx23885-alsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/cx23885/cx23885-alsa.c +2 -1
@@ -550,7 +550,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 , THIS_MODULE, sizeof(struct cx23885_audio_dev), &card);if (err <0 ) - goto error; + goto error_msg; chip = (struct cx23885_audio_dev *) card->private_data; chip->dev = dev;
@@ -576,6 +576,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev) error:snd_card_free (card); +error_msg:pr_err ("%s(): Failed to register analog audio adapter\n" , __func__);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 437/849 drm/msm: fix potential NULL dereference in cleanup
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 027d052a36e56789a2134772bacb4fd0860f03a3 ]
The "msm_obj->node" list needs to be initialized earlier so that the list_del() in msm_gem_free_object() doesn't experience a NULL pointer dereference.
--- drivers/gpu/drm/msm/msm_gem.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/msm_gem.c +1 -0
@@ -1184,6 +1184,7 @@ static int msm_gem_new_impl(struct drm_device *dev, msm_obj->madv =MSM_MADV_WILLNEED ;INIT_LIST_HEAD (&msm_obj->submit_entry); +INIT_LIST_HEAD (&msm_obj->node);INIT_LIST_HEAD (&msm_obj->vmas); *obj = &msm_obj->base;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 421/849 mmc: sdhci-omap: Fix context restore
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit d806e334d0390502cd2a820ad33d65d7f9bba618 ]
We need to restore context in a specified order with HCTL set in two phases. This is similar to what omap_hsmmc_context_restore() is doing. Otherwise SDIO can stop working on resume.
And for PM runtime and SDIO cards, we need to also save SYSCTL, IE and ISE.
This should not be a problem currently, and these patches can be applied whenever suitable.
--- drivers/mmc/host/sdhci-omap.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-omap.c +14 -1
@@ -62,6 +62,8 @@#define SDHCI_OMAP_IE 0x234#define INT_CC_EN BIT(0) +#define SDHCI_OMAP_ISE 0x238 +#define SDHCI_OMAP_AC12 0x23c#define AC12_V1V8_SIGEN BIT(19)#define AC12_SCLK_SEL BIT(23)
@@ -113,6 +115,8 @@ struct sdhci_omap_host {u32 hctl;u32 sysctl;u32 capa; +u32 ie; +u32 ise; };static void sdhci_omap_start_clock (struct sdhci_omap_host *omap_host);
@@ -1245,14 +1249,23 @@ static void sdhci_omap_context_save(struct sdhci_omap_host *omap_host) { omap_host->con =sdhci_omap_readl (omap_host,SDHCI_OMAP_CON ); omap_host->hctl =sdhci_omap_readl (omap_host,SDHCI_OMAP_HCTL ); + omap_host->sysctl =sdhci_omap_readl (omap_host,SDHCI_OMAP_SYSCTL ); omap_host->capa =sdhci_omap_readl (omap_host,SDHCI_OMAP_CAPA ); + omap_host->ie =sdhci_omap_readl (omap_host,SDHCI_OMAP_IE ); + omap_host->ise =sdhci_omap_readl (omap_host,SDHCI_OMAP_ISE ); } +/* Order matters here, HCTL must be restored in two phases */ static void sdhci_omap_context_restore (struct sdhci_omap_host *omap_host) { -sdhci_omap_writel (omap_host,SDHCI_OMAP_CON , omap_host->con);sdhci_omap_writel (omap_host,SDHCI_OMAP_HCTL , omap_host->hctl);sdhci_omap_writel (omap_host,SDHCI_OMAP_CAPA , omap_host->capa); +sdhci_omap_writel (omap_host,SDHCI_OMAP_HCTL , omap_host->hctl); + +sdhci_omap_writel (omap_host,SDHCI_OMAP_SYSCTL , omap_host->sysctl); +sdhci_omap_writel (omap_host,SDHCI_OMAP_CON , omap_host->con); +sdhci_omap_writel (omap_host,SDHCI_OMAP_IE , omap_host->ie); +sdhci_omap_writel (omap_host,SDHCI_OMAP_ISE , omap_host->ise); }static int __maybe_unused sdhci_omap_suspend (struct device *dev)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 451/849 mt76: mt7921: fix endianness warning in mt7921_update_txs
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 7fc167bbc9296e6aeaaa4063db3639e8a3db75f6 ]
Fix the following sparse warning in mt7921_update_txs routine:drivers/net/wireless/mediatek/mt76/mt7921/mac.c:752:31:
warning: cast to restricted __le32drivers/net/wireless/mediatek/mt76/mt7921/mac.c:752:31:
warning: restricted __le32 degrades to integer
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +2 -1
@@ -735,8 +735,9 @@ mt7921_mac_write_txwi_80211(struct mt7921_dev *dev, __le32 *txwi,static void mt7921_update_txs (struct mt76_wcid *wcid,__le32 *txwi) { struct mt7921_sta *msta = container_of(wcid, struct mt7921_sta, wcid); -u32 pid, frame_type =FIELD_GET (MT_TXD2_FRAME_TYPE , txwi[2 ]); +u32 pid, frame_type; + frame_type =FIELD_GET (MT_TXD2_FRAME_TYPE ,le32_to_cpu (txwi[2 ]));if (!(frame_type & (IEEE80211_FTYPE_DATA >>2 )))return ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 446/849 ACPI: PM: Turn off unused wakeup power resources
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 7a63296d6f579a02b2675b4b0fe5b1cd3235e8d3 ]
If an ACPI power resource is found to be "on" during the initialization of the list of wakeup power resources of a device, it is reference counted and its wakeup_enabled flag is set, which is problematic if the deivce in question is the only user of the given power resource, it is never runtime-suspended and it is not allowed to wake up the system from sleep, because in that case the given power resource will stay "on" until the system reboots and energy will be wasted.
It is better to simply turn off wakeup power resources that are "on" during the initialization unless their reference counters are not zero, because that may be the only opportunity to prevent them from staying in the "on" state all the time.
--- drivers/acpi/power.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/acpi/power.c +9 -10
@@ -606,20 +606,19 @@ int acpi_power_wakeup_list_init(struct list_head *list, int *system_level_p)list_for_each_entry (entry, list, node) {struct acpi_power_resource *resource = entry->resource; -int result;u8 state;mutex_lock (&resource->resource_lock); - result =acpi_power_get_state (resource, &state); -if (result) { -mutex_unlock (&resource->resource_lock); -return result; - } -if (state ==ACPI_POWER_RESOURCE_STATE_ON ) { - resource->ref_count++; - resource->wakeup_enabled = true; - } +/* +* Make sure that the power resource state and its reference +* counter value are consistent with each other. +*/ +if (!resource->ref_count && + !acpi_power_get_state (resource, &state) && + state ==ACPI_POWER_RESOURCE_STATE_ON ) +__acpi_power_off (resource); +if (system_level > resource->system_level) system_level = resource->system_level;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 452/849 mt76: mt7615: fix endianness warning in mt7615_mac_write_txwi
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit d81bfb41e30c42531536c5d2baa4d275a8309715 ]
Fix the following sparse warning in mt7615_mac_write_txwi routine:drivers/net/wireless/mediatek/mt76/mt7615/mac.c:758:17:
warning: incorrect type in assignment
expected restricted __le32 [usertype]
got unsigned long
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +9 -6
@@ -755,12 +755,15 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,if (info->flags &IEEE80211_TX_CTL_NO_ACK ) txwi[3 ] |=cpu_to_le32 (MT_TXD3_NO_ACK ); - txwi[7 ] =FIELD_PREP (MT_TXD7_TYPE , fc_type) | -FIELD_PREP (MT_TXD7_SUB_TYPE , fc_stype) | -FIELD_PREP (MT_TXD7_SPE_IDX ,0x18 ); -if (!is_mmio) - txwi[8 ] =FIELD_PREP (MT_TXD8_L_TYPE , fc_type) | -FIELD_PREP (MT_TXD8_L_SUB_TYPE , fc_stype); + val =FIELD_PREP (MT_TXD7_TYPE , fc_type) | +FIELD_PREP (MT_TXD7_SUB_TYPE , fc_stype) | +FIELD_PREP (MT_TXD7_SPE_IDX ,0x18 ); + txwi[7 ] =cpu_to_le32 (val); +if (!is_mmio) { + val =FIELD_PREP (MT_TXD8_L_TYPE , fc_type) | +FIELD_PREP (MT_TXD8_L_SUB_TYPE , fc_stype); + txwi[8 ] =cpu_to_le32 (val); + }return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 449/849 mt76: mt7921: fix endianness in mt7921_mcu_tx_done_event
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit df040215c077de0c13aab12c222bd0360a0d3988 ]
Fix endianness in mt7921_mcu_tx_done_event event reported by the firmware.
--- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt7921/mcu.h | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +2 -1
@@ -532,7 +532,8 @@ mt7921_mcu_tx_done_event(struct mt7921_dev *dev, struct sk_buff *skb) peer.g8 = !!(sta->vht_cap.cap &IEEE80211_VHT_CAP_SHORT_GI_80 ); peer.g16 = !!(sta->vht_cap.cap &IEEE80211_VHT_CAP_SHORT_GI_160 );mt7921_mcu_tx_rate_parse (mphy->mt76, &peer, - &msta->stats.tx_rate, event->tx_rate); + &msta->stats.tx_rate, +le16_to_cpu (event->tx_rate));spin_lock_bh (&dev->sta_poll_lock);break ;
drivers/net/wireless/mediatek/mt76/mt7921/mcu.h +5 -5
@@ -296,11 +296,11 @@ struct mt7921_txpwr_event {struct mt7921_mcu_tx_done_event {u8 pid;u8 status; -u16 seq; +__le16 seq;u8 wlan_idx;u8 tx_cnt; -u16 tx_rate; +__le16 tx_rate;u8 flag;u8 tid;
@@ -312,9 +312,9 @@ struct mt7921_mcu_tx_done_event {u8 reason;u8 rsv0[1 ]; -u32 delay; -u32 timestamp; -u32 applied_flag; +__le32 delay; +__le32 timestamp; +__le32 applied_flag;u8 txs[28 ];
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 444/849 block: ataflop: fix breakage introduced at blk-mq refactoring
In reply to Greg Kroah-HartmanFrom: Michael Schmitz <[email protected]>
[ Upstream commit 86d46fdaa12ae5befc16b8d73fc85a3ca0399ea6 ]
Refactoring of the Atari floppy driver when converting to blk-mq has broken the state machine in not-so-subtle ways:
finish_fdc() must be called when operations on the floppy device have completed. This is crucial in order to relase the ST-DMA lock, which protects against concurrent access to the ST-DMA controller by other drivers (some DMA related, most just related to device register access - broken beyond compare, I know).
When rewriting the driver's old do_request() function, the fact that finish_fdc() was called only when all queued requests had completed appears to have been overlooked. Instead, the new request function calls finish_fdc() immediately after the last request has been queued. finish_fdc() executes a dummy seek after most requests, and this overwrites the state machine's interrupt hander that was set up to wait for completion of the read/write request just prior. To make matters worse, finish_fdc() is called before device interrupts are re-enabled, making certain that the read/write interupt is missed.
Shifting the finish_fdc() call into the read/write request completion handler ensures the driver waits for the request to actually complete. With a queue depth of 2, we won't see long request sequences, so calling finish_fdc() unconditionally just adds a little overhead for the dummy seeks, and keeps the code simple.
While we're at it, kill ataflop_commit_rqs() which does nothing but run finish_fdc() unconditionally, again likely wiping out an in-flight request.
--- drivers/block/ataflop.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
drivers/block/ataflop.c +3 -15
@@ -653,9 +653,6 @@ static inline void copy_buffer(void *from, void *to) *p2++ = *p1++; } - - -/* General Interrupt Handling */ static void (*FloppyIRQHandler)(int status ) =NULL ;
@@ -1228,6 +1225,7 @@ static void fd_rwsec_done1(int status) }else {/* all sectors finished */ +finish_fdc ();fd_end_request_cur (BLK_STS_OK ); }return ;
@@ -1475,15 +1473,6 @@ static void setup_req_params( int drive ) ReqTrack, ReqSector, (unsigned long)ReqData )); } -static void ataflop_commit_rqs (struct blk_mq_hw_ctx *hctx) -{ -spin_lock_irq (&ataflop_lock); -atari_disable_irq (IRQ_MFP_FDC ); -finish_fdc (); -atari_enable_irq (IRQ_MFP_FDC ); -spin_unlock_irq (&ataflop_lock); -} -static blk_status_t ataflop_queue_rq (struct blk_mq_hw_ctx *hctx,const struct blk_mq_queue_data *bd) {
@@ -1491,6 +1480,8 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,int drive = floppy - unit;int type = floppy->type; +DPRINT (("Queue request: drive %d type %d last %d\n" , drive, type, bd->last)); +spin_lock_irq (&ataflop_lock);if (fd_request) {spin_unlock_irq (&ataflop_lock);
@@ -1550,8 +1541,6 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,setup_req_params ( drive );do_fd_action ( drive ); -if (bd->last) -finish_fdc ();atari_enable_irq (IRQ_MFP_FDC ); out:
@@ -1962,7 +1951,6 @@ static const struct block_device_operations floppy_fops = {static const struct blk_mq_ops ataflop_mq_ops = { .queue_rq = ataflop_queue_rq, - .commit_rqs = ataflop_commit_rqs, };static int ataflop_alloc_disk (unsigned int drive,unsigned int type)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 442/849 media: ir_toy: assignment to be16 should be of correct type
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
[ Upstream commit febfe985fc2ea052a363f6525ff624b8efd5273c ]
commit f0c15b360fb6 ("media: ir_toy: prevent device from hanging during transmit") removed a cpu_to_be16() cast, which causes a sparse warning.
--- drivers/media/rc/ir_toy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ir_toy.c +1 -1
@@ -310,7 +310,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count) buf[i] =cpu_to_be16 (v); } - buf[count] =0xffff ; + buf[count] =cpu_to_be16 (0xffff ); irtoy->tx_buf = buf; irtoy->tx_len = size;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 447/849 ACPI: PM: Fix sharing of wakeup power resources
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit a2d7b2e004af6b09f21ac3d10f8f4456c16a8ddf ]
If an ACPI wakeup power resource is shared between multiple devices, it may not be managed correctly.
Suppose, for example, that two devices, A and B, share a wakeup power resource P whose wakeup_enabled flag is 0 initially. Next, suppose that wakeup power is enabled for A and B, in this order, and disabled for B. When wakeup power is enabled for A, P will be turned on and its wakeup_enabled flag will be set. Next, when wakeup power is enabled for B, P will not be touched, because its wakeup_enabled flag is set. Now, when wakeup power is disabled for B, P will be turned off which is incorrect, because A will still need P in order to signal wakeup.
Moreover, if wakeup power is enabled for A and then disabled for B, the latter will cause P to be turned off incorrectly (it will be still needed by A), because acpi_disable_wakeup_device_power() is allowed to manipulate power resources when the wakeup.prepare_count counter of the given device is 0.
While the first issue could be addressed by changing the wakeup_enabled power resource flag into a counter, addressing the second one requires modifying acpi_disable_wakeup_device_power() to do nothing when the target device's wakeup.prepare_count reference counter is zero and that would cause the new counter to be redundant. Namely, if acpi_disable_wakeup_device_power() is modified as per the above, every change of the new counter following a wakeup.prepare_count change would be reflected by the analogous change of the main reference counter of the given power resource.
Accordingly, modify acpi_disable_wakeup_device_power() to do nothing when the target device's wakeup.prepare_count reference counter is zero and drop the power resource wakeup_enabled flag altogether.
While at it, ensure that all of the power resources that can be turned off will be turned off when disabling device wakeup due to a power resource manipulation error, to prevent energy from being wasted.
--- drivers/acpi/power.c | 69 +++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 45 deletions(-)
drivers/acpi/power.c +24 -45
@@ -53,7 +53,6 @@ struct acpi_power_resource {u32 order;unsigned int ref_count;u8 state; -bool wakeup_enabled;struct mutex resource_lock;struct list_head dependents; };
@@ -701,7 +700,6 @@ int acpi_device_sleep_wake(struct acpi_device *dev,*/ int acpi_enable_wakeup_device_power (struct acpi_device *dev,int sleep_state) { -struct acpi_power_resource_entry *entry;int err =0 ;if (!dev || !dev->wakeup.flags.valid)
@@ -712,26 +710,13 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state)if (dev->wakeup.prepare_count++) goto out; -list_for_each_entry (entry, &dev->wakeup.resources, node) { -struct acpi_power_resource *resource = entry->resource; - -mutex_lock (&resource->resource_lock); - -if (!resource->wakeup_enabled) { - err =acpi_power_on_unlocked (resource); -if (!err) - resource->wakeup_enabled = true; - } - -mutex_unlock (&resource->resource_lock); - -if (err) { -dev_err (&dev->dev, -"Cannot turn wakeup power resources on\n" ); - dev->wakeup.flags.valid =0 ; - goto out; - } + err =acpi_power_on_list (&dev->wakeup.resources); +if (err) { +dev_err (&dev->dev,"Cannot turn on wakeup power resources\n" ); + dev->wakeup.flags.valid =0 ; + goto out; } +/* * Passing 3 as the third argument below means the device may be * put into arbitrary power state afterward.
@@ -761,39 +746,33 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)mutex_lock (&acpi_device_lock); -if (--dev->wakeup.prepare_count >0 ) +if (dev->wakeup.prepare_count >1 ) { + dev->wakeup.prepare_count--; goto out; + } -/* -* Executing the code below even if prepare_count is already zero when -* the function is called may be useful, for example for initialisation. -*/ -if (dev->wakeup.prepare_count <0 ) - dev->wakeup.prepare_count =0 ; +/* Do nothing if wakeup power has not been enabled for this device. */ +if (!dev->wakeup.prepare_count) + goto out; err =acpi_device_sleep_wake (dev,0 ,0 ,0 );if (err) goto out; +/* +* All of the power resources in the list need to be turned off even if +* there are errors. +*/ list_for_each_entry (entry, &dev->wakeup.resources, node) { -struct acpi_power_resource *resource = entry->resource; - -mutex_lock (&resource->resource_lock); - -if (resource->wakeup_enabled) { - err =acpi_power_off_unlocked (resource); -if (!err) - resource->wakeup_enabled = false; - } - -mutex_unlock (&resource->resource_lock); +int ret; -if (err) { -dev_err (&dev->dev, -"Cannot turn wakeup power resources off\n" ); - dev->wakeup.flags.valid =0 ; -break ; - } + ret =acpi_power_off (entry->resource); +if (ret && !err) + err = ret; + } +if (err) { +dev_err (&dev->dev,"Cannot turn off wakeup power resources\n" ); + dev->wakeup.flags.valid =0 ; } out:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 450/849 mt76: mt7915: fix endianness warning in mt7915_mac_add_txs_skb
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 08b3c8da87aed4200dab00906f149d675ca90f23 ]
Fix the following sparse warning in mt7915_mac_add_txs_skb routine:
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1235:29:
warning: cast to restricted __le32drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1235:23:
warning: restricted __le32 degrades to integer
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1 -1
@@ -1232,7 +1232,7 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid, goto out; info =IEEE80211_SKB_CB (skb); -if (!(txs_data[0 ] &le32_to_cpu (MT_TXS0_ACK_ERROR_MASK ))) +if (!(txs_data[0 ] &cpu_to_le32 (MT_TXS0_ACK_ERROR_MASK ))) info->flags |=IEEE80211_TX_STAT_ACK ; info->status.ampdu_len =1 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 425/849 hwmon: Fix possible memleak in __hwmon_device_register()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ada61aa0b1184a8fda1a89a340c7d6cc4e59aee5 ]
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff888102740438 (size 8):
comm "27", pid 859, jiffies 4295031351 (age 143.992s) hex dump (first 8 bytes):
68 77 6d 6f 6e 30 00 00 hwmon0..
backtrace:
[<00000000544b5996>] __kmalloc_track_caller+0x1a6/0x300
[<00000000df0d62b9>] kvasprintf+0xad/0x140
[<00000000d3d2a3da>] kvasprintf_const+0x62/0x190
[<000000005f8f0f29>] kobject_set_name_vargs+0x56/0x140
[<00000000b739e4b9>] dev_set_name+0xb0/0xe0
[<0000000095b69c25>] __hwmon_device_register+0xf19/0x1e50 [hwmon]
[<00000000a7e65b52>] hwmon_device_register_with_info+0xcb/0x110 [hwmon]
[<000000006f181e86>] devm_hwmon_device_register_with_info+0x85/0x100 [hwmon]
[<0000000081bdc567>] tmp421_probe+0x2d2/0x465 [tmp421]
[<00000000502cc3f8>] i2c_device_probe+0x4e1/0xbb0
[<00000000f90bda3b>] really_probe+0x285/0xc30
[<000000007eac7b77>] __driver_probe_device+0x35f/0x4f0
[<000000004953d43d>] driver_probe_device+0x4f/0x140
[<000000002ada2d41>] __device_attach_driver+0x24c/0x330
[<00000000b3977977>] bus_for_each_drv+0x15d/0x1e0
[<000000005bf2a8e3>] __device_attach+0x267/0x410When device_register() returns an error, the name allocated in dev_set_name() will be leaked, the put_device() should be used instead of calling hwmon_dev_release() to give up the device reference, then the name will be freed in kobject_cleanup().
--- drivers/hwmon/hwmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hwmon/hwmon.c +4 -2
@@ -796,8 +796,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,dev_set_drvdata (hdev, drvdata);dev_set_name (hdev,HWMON_ID_FORMAT , id); err =device_register (hdev); -if (err) - goto free_hwmon; +if (err) { +put_device (hdev); + goto ida_remove; + }INIT_LIST_HEAD (&hwdev->tzdata);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 426/849 hwmon: (pmbus/lm25066) Let compiler determine outer dimension of lm25066_coeff
In reply to Greg Kroah-HartmanFrom: Zev Weiss <[email protected]>
[ Upstream commit b7931a7b0e0df4d2a25fedd895ad32c746b77bc1 ]
Maintaining this manually is error prone (there are currently only five chips supported, not six); gcc can do it for us automatically.
--- drivers/hwmon/pmbus/lm25066.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/lm25066.c +1 -1
@@ -51,7 +51,7 @@ struct __coeff {#define PSC_CURRENT_IN_L (PSC_NUM_CLASSES)#define PSC_POWER_L (PSC_NUM_CLASSES + 1) -static struct __coeff lm25066_coeff[6 ][PSC_NUM_CLASSES +2 ] = { +static struct __coeff lm25066_coeff[][PSC_NUM_CLASSES +2 ] = { [lm25056] = { [PSC_VOLTAGE_IN ] = { .m =16296 ,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 448/849 drm/amdkfd: Fix an inappropriate error handling in allloc memory of gpu
In reply to Greg Kroah-HartmanFrom: Lang Yu <[email protected]>
[ Upstream commit 5aeeac6fa38fca450faed9770f75b1470c0e2073 ]
We should unreference a gem object instead of an amdgpu bo here.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1 -1
@@ -1490,7 +1490,7 @@ allocate_init_user_pages_failed:remove_kgd_mem_from_kfd_bo_list (*mem, avm->process_info);drm_vma_node_revoke (&gobj->vma_node, drm_priv); err_node_allow: -amdgpu_bo_unref (&bo); +drm_gem_object_put (gobj);/* Don't unreserve system mem limit twice */ goto err_reserve_limit; err_bo_create:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 445/849 platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit fd96e35ea7b95f1e216277805be89d66e4ae962d ]
A new warning in clang points out a use of bitwise OR with boolean expressions in this driver:
drivers/platform/x86/thinkpad_acpi.c:9061:11: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
else if ((strlencmp(cmd, "level disengaged") == 0) |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
||drivers/platform/x86/thinkpad_acpi.c:9061:11: note: cast one or both operands to int to silence this warning 1 error generated.
This should clearly be a logical OR so change it to fix the warning.
--- drivers/platform/x86/thinkpad_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +1 -1
@@ -9145,7 +9145,7 @@ static int fan_write_cmd_level(const char *cmd, int *rc)if (strlencmp (cmd,"level auto" ) ==0 ) level =TP_EC_FAN_AUTO ; -else if ((strlencmp (cmd,"level disengaged" ) ==0 ) | +else if ((strlencmp (cmd,"level disengaged" ) ==0 ) || (strlencmp (cmd,"level full-speed" ) ==0 )) level =TP_EC_FAN_FULLSPEED ;else if (sscanf (cmd,"level %d" , &level) !=1 )
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 443/849 mmc: mxs-mmc: disable regulator on error and in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ce5f6c2c9b0fcb4094f8e162cfd37fb4294204f7 ]
The 'reg_vmmc' regulator is enabled in the probe. It is never disabled. Neither in the error handling path of the probe nor in the remove function.
Register a devm_action to disable it when needed.
--- drivers/mmc/host/mxs-mmc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mmc/host/mxs-mmc.c +10 -0
@@ -552,6 +552,11 @@ static const struct of_device_id mxs_mmc_dt_ids[] = { };MODULE_DEVICE_TABLE (of, mxs_mmc_dt_ids); +static void mxs_mmc_regulator_disable (void *regulator) +{ +regulator_disable (regulator); +} +static int mxs_mmc_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node;
@@ -591,6 +596,11 @@ static int mxs_mmc_probe(struct platform_device *pdev) "Failed to enable vmmc regulator: %d\n", ret); goto out_mmc_free; } + + ret =devm_add_action_or_reset (&pdev->dev, mxs_mmc_regulator_disable, + reg_vmmc); +if (ret) + goto out_mmc_free; } ssp->clk =devm_clk_get (&pdev->dev,NULL );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 440/849 mailbox: Remove WARN_ON for async_cb.cb in cmdq_exec_done
In reply to Greg Kroah-HartmanFrom: jason-jh.lin <[email protected]>
[ Upstream commit ce1537fe288469bf68ee0aabdb860a790b4755ef ]
Because mtk_drm_crtc_update_config is not using cmdq_pkt_flush_async, it won't have pkt->async_cb.cb anymore.
So remove the WARN_ON check of pkt->async_cb.cb at cmdq_exec_done.
--- drivers/mailbox/mtk-cmdq-mailbox.c | 1 - 1 file changed, 1 deletion(-)
drivers/mailbox/mtk-cmdq-mailbox.c +0 -1
@@ -186,7 +186,6 @@ static void cmdq_task_exec_done(struct cmdq_task *task, int sta)struct cmdq_task_cb *cb = &task->pkt->async_cb;struct cmdq_cb_data data; -WARN_ON (cb->cb == (cmdq_async_flush_cb )NULL ); data.sta = sta; data.data = cb->data; data.pkt = task->pkt;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 438/849 drm/msm: uninitialized variable in msm_gem_import()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 2203bd0e5c12ffc53ffdd4fbd7b12d6ba27e0424 ]
The msm_gem_new_impl() function cleans up after itself so there is no need to call drm_gem_object_put(). Conceptually, it does not make sense to call a kref_put() function until after the reference counting has been initialized which happens immediately after this call in the drm_gem_(private_)object_init() functions.
In the msm_gem_import() function the "obj" pointer is uninitialized, so it will lead to a crash.
--- drivers/gpu/drm/msm/msm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/msm_gem.c +2 -2
@@ -1220,7 +1220,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, ret =msm_gem_new_impl (dev, size, flags, &obj);if (ret) - goto fail; +return ERR_PTR (ret); msm_obj =to_msm_bo (obj);
@@ -1320,7 +1320,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, ret =msm_gem_new_impl (dev, size,MSM_BO_WC , &obj);if (ret) - goto fail; +return ERR_PTR (ret);drm_gem_private_object_init (dev, obj, size);
Signature · 1 line
2.33.0