5.0.20-stable review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 54/346 blk-mq: split blk_mq_alloc_and_init_hctx into two parts
In reply to Greg Kroah-Hartman[ Upstream commit 7c6c5b7c9186e3fb5b10afb8e5f710ae661144c6 ]
Split blk_mq_alloc_and_init_hctx into two parts, and one is blk_mq_alloc_hctx() for allocating all hctx resources, another is blk_mq_init_hctx() for initializing hctx, which serves as counter-part of blk_mq_exit_hctx().
--- block/blk-mq.c | 139 ++++++++++++++++++++++++++----------------------- 1 file changed, 75 insertions(+), 64 deletions(-)
block/blk-mq.c +75 -64
@@ -2287,15 +2287,65 @@ static void blk_mq_exit_hw_queues(struct request_queue *q, } } +static int blk_mq_hw_ctx_size (struct blk_mq_tag_set *tag_set) +{ +int hw_ctx_size =sizeof (struct blk_mq_hw_ctx ); + +BUILD_BUG_ON (ALIGN (offsetof(struct blk_mq_hw_ctx , srcu), + __alignof__(struct blk_mq_hw_ctx )) != +sizeof (struct blk_mq_hw_ctx )); + +if (tag_set->flags &BLK_MQ_F_BLOCKING ) + hw_ctx_size +=sizeof (struct srcu_struct ); + +return hw_ctx_size; +} +static int blk_mq_init_hctx (struct request_queue *q,struct blk_mq_tag_set *set,struct blk_mq_hw_ctx *hctx,unsigned hctx_idx) { -int node; + hctx->queue_num = hctx_idx; + +cpuhp_state_add_instance_nocalls (CPUHP_BLK_MQ_DEAD , &hctx->cpuhp_dead); + + hctx->tags = set->tags[hctx_idx]; + +if (set->ops->init_hctx && + set->ops->init_hctx (hctx, set->driver_data, hctx_idx)) + goto unregister_cpu_notifier; - node = hctx->numa_node; +if (blk_mq_init_request (set, hctx->fq->flush_rq, hctx_idx, + hctx->numa_node)) + goto exit_hctx; +return 0 ; + + exit_hctx: +if (set->ops->exit_hctx) + set->ops->exit_hctx (hctx, hctx_idx); + unregister_cpu_notifier: +blk_mq_remove_cpuhp (hctx); +return -1 ; +} + +static struct blk_mq_hw_ctx * +blk_mq_alloc_hctx (struct request_queue *q,struct blk_mq_tag_set *set, +int node) +{ +struct blk_mq_hw_ctx *hctx; +gfp_t gfp =GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY; + + hctx =kzalloc_node (blk_mq_hw_ctx_size (set), gfp, node); +if (!hctx) + goto fail_alloc_hctx; + +if (!zalloc_cpumask_var_node (&hctx->cpumask, gfp, node)) + goto free_hctx; + +atomic_set (&hctx->nr_active,0 );if (node ==NUMA_NO_NODE ) - node = hctx->numa_node = set->numa_node; + node = set->numa_node; + hctx->numa_node = node;INIT_DELAYED_WORK (&hctx->run_work, blk_mq_run_work_fn);spin_lock_init (&hctx->lock);
@@ -2303,58 +2353,45 @@ static int blk_mq_init_hctx(struct request_queue *q, hctx->queue = q; hctx->flags = set->flags & ~BLK_MQ_F_TAG_SHARED ; -cpuhp_state_add_instance_nocalls (CPUHP_BLK_MQ_DEAD , &hctx->cpuhp_dead); - - hctx->tags = set->tags[hctx_idx]; -/* * Allocate space for all possible cpus to avoid allocation at * runtime */ hctx->ctxs =kmalloc_array_node (nr_cpu_ids,sizeof (void *), -GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, node); + gfp, node);if (!hctx->ctxs) - goto unregister_cpu_notifier; + goto free_cpumask;if (sbitmap_init_node (&hctx->ctx_map, nr_cpu_ids,ilog2 (8 ), -GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, node)) + gfp, node)) goto free_ctxs; - hctx->nr_ctx =0 ;spin_lock_init (&hctx->dispatch_wait_lock);init_waitqueue_func_entry (&hctx->dispatch_wait, blk_mq_dispatch_wake);INIT_LIST_HEAD (&hctx->dispatch_wait.entry); -if (set->ops->init_hctx && - set->ops->init_hctx (hctx, set->driver_data, hctx_idx)) - goto free_bitmap; - hctx->fq =blk_alloc_flush_queue (q, hctx->numa_node, set->cmd_size, -GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY); + gfp);if (!hctx->fq) - goto exit_hctx; - -if (blk_mq_init_request (set, hctx->fq->flush_rq, hctx_idx, node)) - goto free_fq; + goto free_bitmap;if (hctx->flags &BLK_MQ_F_BLOCKING )init_srcu_struct (hctx->srcu); +blk_mq_hctx_kobj_init (hctx); -return 0 ; +return hctx; - free_fq: -blk_free_flush_queue (hctx->fq); - exit_hctx: -if (set->ops->exit_hctx) - set->ops->exit_hctx (hctx, hctx_idx); free_bitmap:sbitmap_free (&hctx->ctx_map); free_ctxs:kfree (hctx->ctxs); - unregister_cpu_notifier: -blk_mq_remove_cpuhp (hctx); -return -1 ; + free_cpumask: +free_cpumask_var (hctx->cpumask); + free_hctx: +kfree (hctx); + fail_alloc_hctx: +return NULL ; } static void blk_mq_init_cpu_queues(struct request_queue *q,
@@ -2691,51 +2728,25 @@ struct request_queue *blk_mq_init_sq_queue(struct blk_mq_tag_set *set, }EXPORT_SYMBOL (blk_mq_init_sq_queue); -static int blk_mq_hw_ctx_size (struct blk_mq_tag_set *tag_set) -{ -int hw_ctx_size =sizeof (struct blk_mq_hw_ctx ); - -BUILD_BUG_ON (ALIGN (offsetof(struct blk_mq_hw_ctx , srcu), - __alignof__(struct blk_mq_hw_ctx )) != -sizeof (struct blk_mq_hw_ctx )); - -if (tag_set->flags &BLK_MQ_F_BLOCKING ) - hw_ctx_size +=sizeof (struct srcu_struct ); - -return hw_ctx_size; -} -static struct blk_mq_hw_ctx *blk_mq_alloc_and_init_hctx (struct blk_mq_tag_set *set,struct request_queue *q,int hctx_idx,int node) {struct blk_mq_hw_ctx *hctx; - hctx =kzalloc_node (blk_mq_hw_ctx_size (set), -GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, - node); + hctx =blk_mq_alloc_hctx (q, set, node);if (!hctx) -return NULL ; - -if (!zalloc_cpumask_var_node (&hctx->cpumask, -GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, - node)) { -kfree (hctx); -return NULL ; - } - -atomic_set (&hctx->nr_active,0 ); - hctx->numa_node = node; - hctx->queue_num = hctx_idx; + goto fail; -if (blk_mq_init_hctx (q, set, hctx, hctx_idx)) { -free_cpumask_var (hctx->cpumask); -kfree (hctx); -return NULL ; - } -blk_mq_hctx_kobj_init (hctx); +if (blk_mq_init_hctx (q, set, hctx, hctx_idx)) + goto free_hctx;return hctx; + + free_hctx: +kobject_put (&hctx->kobj); + fail: +return NULL ; } static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 55/346 blk-mq: grab .q_usage_counter when queuing request from plug code path
In reply to Greg Kroah-Hartman[ Upstream commit e87eb301bee183d82bb3d04bd71b6660889a2588 ]
Just like aio/io_uring, we need to grab 2 refcount for queuing one request, one is for submission, another is for completion.
If the request isn't queued from plug code path, the refcount grabbed in generic_make_request() serves for submission. In theroy, this refcount should have been released after the sumission(async run queue) is done. blk_freeze_queue() works with blk_sync_queue() together for avoiding race between cleanup queue and IO submission, given async run queue activities are canceled because hctx->run_work is scheduled with the refcount held, so it is fine to not hold the refcount when running the run queue work function for dispatch IO.
However, if request is staggered into plug list, and finally queued from plug code path, the refcount in submission side is actually missed. And we may start to run queue after queue is removed because the queue's kobject refcount isn't guaranteed to be grabbed in flushing plug list context, then kernel oops is triggered, see the following race:
blk_mq_flush_plug_list():
blk_mq_sched_insert_requests()
insert requests to sw queue or scheduler queue blk_mq_run_hw_queue
Because of concurrent run queue, all requests inserted above may be completed before calling the above blk_mq_run_hw_queue. Then queue can be freed during the above blk_mq_run_hw_queue().
Fixes the issue by grab .q_usage_counter before calling blk_mq_sched_insert_requests() in blk_mq_flush_plug_list(). This way is safe because the queue is absolutely alive before inserting request.
--- block/blk-mq-sched.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
block/blk-mq-sched.c +11 -1
@@ -413,6 +413,14 @@ void blk_mq_sched_insert_requests(struct blk_mq_hw_ctx *hctx, struct list_head *list, bool run_queue_async) {struct elevator_queue *e; +struct request_queue *q = hctx->queue; + +/* +* blk_mq_sched_insert_requests() is called from flush plug +* context only, and hold one usage counter to prevent queue +* from being released. +*/ +percpu_ref_get (&q->q_usage_counter); e = hctx->queue->elevator;if (e && e->type->ops.insert_requests)
@@ -426,12 +434,14 @@ void blk_mq_sched_insert_requests(struct blk_mq_hw_ctx *hctx,if (!hctx->dispatch_busy && !e && !run_queue_async) {blk_mq_try_issue_list_directly (hctx, list);if (list_empty (list)) -return ; + goto out; }blk_mq_insert_requests (hctx, ctx, list); }blk_mq_run_hw_queue (hctx, run_queue_async); + out: +percpu_ref_put (&q->q_usage_counter); } static void blk_mq_sched_free_tags(struct blk_mq_tag_set *set,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/346 pinctrl: zte: fix leaked of_node references
In reply to Greg Kroah-Hartman[ Upstream commit 02d15f0d80720545f1f4922a1550ea4aaad4e152 ]
The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/zte/pinctrl-zx.c:415:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:422:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:436:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:444:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function. ./drivers/pinctrl/zte/pinctrl-zx.c:448:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
--- drivers/pinctrl/zte/pinctrl-zx.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/zte/pinctrl-zx.c +1 -0
@@ -411,6 +411,7 @@ int zx_pinctrl_init(struct platform_device *pdev, } zpctl->aux_base =of_iomap (np,0 ); +of_node_put (np);if (!zpctl->aux_base)return -ENOMEM ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 79/346 x86/ftrace: Set trampoline pages as executable
In reply to Greg Kroah-Hartman[ Upstream commit 3c0dab44e22782359a0a706cbce72de99a22aa75 ]
Since alloc_module() will not set the pages as executable soon, set ftrace trampoline pages as executable after they are allocated.
For the time being, do not change ftrace to use the text_poke() interface. As a result, ftrace still breaks W^X.
--- arch/x86/kernel/ftrace.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/kernel/ftrace.c +8 -0
@@ -748,6 +748,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)unsigned long end_offset;unsigned long op_offset;unsigned long offset; +unsigned long npages;unsigned long size;unsigned long retq;unsigned long *ptr;
@@ -780,6 +781,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)return 0 ; *tramp_size = size +RET_SIZE +sizeof (void *); + npages =DIV_ROUND_UP (*tramp_size,PAGE_SIZE );/* Copy ftrace_caller onto the trampoline memory */ ret =probe_kernel_read (trampoline, (void *)start_offset, size);
@@ -824,6 +826,12 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)/* ALLOC_TRAMP flags lets us know we created it */ ops->flags |=FTRACE_OPS_FL_ALLOC_TRAMP ; +/* +* Module allocation needs to be completed by making the page +* executable. The page is still writable, which is a security hazard, +* but anyhow ftrace breaks W^X completely. +*/ +set_memory_x ((unsigned long )trampoline, npages);return (unsigned long )trampoline; fail:tramp_free (trampoline, *tramp_size);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 86/346 x86/modules: Avoid breaking W^X while loading modules
In reply to Greg Kroah-Hartman[ Upstream commit f2c65fb3221adc6b73b0549fc7ba892022db9797 ]
When modules and BPF filters are loaded, there is a time window in which some memory is both writable and executable. An attacker that has already found another vulnerability (e.g., a dangling pointer) might be able to exploit this behavior to overwrite kernel code. Prevent having writable executable PTEs in this stage.
In addition, avoiding having W+X mappings can also slightly simplify the patching of modules code on initialization (e.g., by alternatives and static-key), as would be done in the next patch. This was actually the main motivation for this patch.
To avoid having W+X mappings, set them initially as RW (NX) and after they are set as RO set them as X as well. Setting them as executable is done as a separate step to avoid one core in which the old PTE is cached (hence writable), and another which sees the updated PTE (executable), which would break the W^X protection.
--- arch/x86/kernel/alternative.c | 28 +++++++++++++++++++++------- arch/x86/kernel/module.c | 2 +- include/linux/filter.h | 1 + kernel/module.c | 5 +++++ 4 files changed, 28 insertions(+), 8 deletions(-)
arch/x86/kernel/alternative.c +21 -7
@@ -666,15 +666,29 @@ void __init alternative_instructions(void)* handlers seeing an inconsistent instruction while you patch. */ void *__init_or_module text_poke_early(void *addr, const void *opcode, -size_t len) +size_t len) {unsigned long flags; -local_irq_save (flags); -memcpy (addr, opcode, len); -local_irq_restore (flags); -sync_core (); -/* Could also do a CLFLUSH here to speed up CPU recovery; but -that causes hangs on some VIA CPUs. */ + +if (boot_cpu_has (X86_FEATURE_NX ) && +is_module_text_address ((unsigned long )addr)) { +/* +* Modules text is marked initially as non-executable, so the +* code cannot be running and speculative code-fetches are +* prevented. Just change the code. +*/ +memcpy (addr, opcode, len); + }else { +local_irq_save (flags); +memcpy (addr, opcode, len); +local_irq_restore (flags); +sync_core (); + +/* +* Could also do a CLFLUSH here to speed up CPU recovery; but +* that causes hangs on some VIA CPUs. +*/ + }return addr; }
arch/x86/kernel/module.c +1 -1
@@ -87,7 +87,7 @@ void *module_alloc(unsigned long size) p =__vmalloc_node_range (size,MODULE_ALIGN ,MODULES_VADDR +get_module_load_offset (),MODULES_END ,GFP_KERNEL , -PAGE_KERNEL_EXEC ,0 ,NUMA_NO_NODE , +PAGE_KERNEL ,0 ,NUMA_NO_NODE ,__builtin_return_address (0 ));if (p && (kasan_module_alloc (p, size) <0 )) {vfree (p);
include/linux/filter.h +1 -0
@@ -709,6 +709,7 @@ static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)static inline void bpf_jit_binary_lock_ro (struct bpf_binary_header *hdr) {set_memory_ro ((unsigned long )hdr, hdr->pages); +set_memory_x ((unsigned long )hdr, hdr->pages); }static inline void bpf_jit_binary_unlock_ro (struct bpf_binary_header *hdr)
kernel/module.c +5 -0
@@ -1950,8 +1950,13 @@ void module_enable_ro(const struct module *mod, bool after_init)return ;frob_text (&mod->core_layout, set_memory_ro); +frob_text (&mod->core_layout, set_memory_x); +frob_rodata (&mod->core_layout, set_memory_ro); +frob_text (&mod->init_layout, set_memory_ro); +frob_text (&mod->init_layout, set_memory_x); +frob_rodata (&mod->init_layout, set_memory_ro);if (after_init)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 132/346 pinctrl: pistachio: fix leaked of_node references
In reply to Greg Kroah-Hartman[ Upstream commit 44a4455ac2c6b0981eace683a2b6eccf47689022 ]
The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/pinctrl-pistachio.c:1422:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1360, but without a corresponding object release within this function.
--- drivers/pinctrl/pinctrl-pistachio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/pinctrl-pistachio.c +2 -0
@@ -1367,6 +1367,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)if (!of_find_property (child,"gpio-controller" ,NULL )) {dev_err (pctl->dev,"No gpio-controller property for bank %u\n" , i); +of_node_put (child); ret = -ENODEV ; goto err; }
@@ -1374,6 +1375,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) irq =irq_of_parse_and_map (child,0 );if (irq <0 ) {dev_err (pctl->dev,"No IRQ for bank %u: %d\n" , i, irq); +of_node_put (child); ret = irq; goto err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 133/346 pinctrl: st: fix leaked of_node references
In reply to Greg Kroah-Hartman[ Upstream commit 483d70d73beaecab55882fcd2a357af72674e24c ]
The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/pinctrl-st.c:1188:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function. ./drivers/pinctrl/pinctrl-st.c:1188:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function. ./drivers/pinctrl/pinctrl-st.c:1199:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function. ./drivers/pinctrl/pinctrl-st.c:1199:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
--- drivers/pinctrl/pinctrl-st.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/pinctrl/pinctrl-st.c +10 -5
@@ -1170,7 +1170,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np,struct property *pp;struct st_pinconf *conf;struct device_node *pins; -int i =0 , npins =0 , nr_props; +int i =0 , npins =0 , nr_props, ret =0 ; pins =of_get_child_by_name (np,"st,pins" );if (!pins)
@@ -1185,7 +1185,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np, npins++; }else {pr_warn ("Invalid st,pins in %pOFn node\n" , np); -return -EINVAL ; + ret = -EINVAL ; + goto out_put_node; } }
@@ -1195,8 +1196,10 @@ static int st_pctl_dt_parse_groups(struct device_node *np, grp->pin_conf =devm_kcalloc (info->dev, npins,sizeof (*conf),GFP_KERNEL ); -if (!grp->pins || !grp->pin_conf) -return -ENOMEM ; +if (!grp->pins || !grp->pin_conf) { + ret = -ENOMEM ; + goto out_put_node; + }/* <bank offset mux direction rt_type rt_delay rt_clk> */ for_each_property_of_node (pins, pp) {
@@ -1229,9 +1232,11 @@ static int st_pctl_dt_parse_groups(struct device_node *np, } i++; } + +out_put_node:of_node_put (pins); -return 0 ; +return ret; } static int st_pctl_parse_functions(struct device_node *np,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 134/346 pinctrl: samsung: fix leaked of_node references
In reply to Greg Kroah-Hartman[ Upstream commit 44b9f86cd41db6c522effa5aec251d664a52fbc0 ]
The call to of_find_compatible_node returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:76:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function. ./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:82:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
--- drivers/pinctrl/samsung/pinctrl-exynos-arm.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/samsung/pinctrl-exynos-arm.c +1 -0
@@ -71,6 +71,7 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata, } clk_base =of_iomap (np,0 ); +of_node_put (np);if (!clk_base) {pr_err ("%s: failed to map clock registers\n" , __func__);return ERR_PTR (-EINVAL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 158/346 drm/msm: a5xx: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit 6cd5235c3135ea84b32469ea51b2aae384eda8af ]
The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:57:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:66:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:118:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 47, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:57:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:66:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function. drivers/gpu/drm/msm/adreno/a5xx_gpu.c:118:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 51, but without a corresponding object release within this function.
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +6 -4
@@ -34,7 +34,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) {struct device *dev = &gpu->pdev->dev;const struct firmware *fw; -struct device_node *np; +struct device_node *np, *mem_np;struct resource r;phys_addr_t mem_phys;ssize_t mem_size;
@@ -48,11 +48,13 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname)if (!np)return -ENODEV ; - np =of_parse_phandle (np,"memory-region" ,0 ); -if (!np) + mem_np =of_parse_phandle (np,"memory-region" ,0 ); +of_node_put (np); +if (!mem_np)return -EINVAL ; - ret =of_address_to_resource (np,0 , &r); + ret =of_address_to_resource (mem_np,0 , &r); +of_node_put (mem_np);if (ret)return ret;
Signature · 8 lines
2.20.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Greg Kroah-Hartman
maintainerPATCH 3/346 ext4: wait for outstanding dio during truncate in nojournal mode
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 82a25b027ca48d7ef197295846b352345853dfa8 upstream.
We didn't wait for outstanding direct IO during truncate in nojournal mode (as we skip orphan handling in that case). This can lead to fs corruption or stale data exposure if truncate ends up freeing blocks and these get reallocated before direct IO finishes. Fix the condition determining whether the wait is necessary.
--- fs/ext4/inode.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
fs/ext4/inode.c +9 -12
@@ -5632,20 +5632,17 @@ int ext4_setattr(struct dentry *dentry, goto err_out; } } -if (!shrink) +if (!shrink) {pagecache_isize_extended (inode, oldsize, inode->i_size); - -/* -* Blocks are going to be removed from the inode. Wait -* for dio in flight. Temporarily disable -* dioread_nolock to prevent livelock. -*/ -if (orphan) { -if (!ext4_should_journal_data (inode)) { -inode_dio_wait (inode); - }else -ext4_wait_for_tail_page_commit (inode); + }else { +/* +* Blocks are going to be removed from the inode. Wait +* for dio in flight. +*/ +inode_dio_wait (inode); } +if (orphan &&ext4_should_journal_data (inode)) +ext4_wait_for_tail_page_commit (inode);down_write (&EXT4_I (inode)->i_mmap_sem); rc =ext4_break_layouts (inode);
Greg Kroah-Hartman
maintainerPATCH 8/346 crypto: hash - fix incorrect HASH_MAX_DESCSIZE
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit e1354400b25da645c4764ed6844d12f1582c3b66 upstream.
The "hmac(sha3-224-generic)" algorithm has a descsize of 368 bytes, which is greater than HASH_MAX_DESCSIZE (360) which is only enough for sha3-224-generic. The check in shash_prepare_alg() doesn't catch this because the HMAC template doesn't set descsize on the algorithms, but rather sets it on each individual HMAC transform.
This causes a stack buffer overflow when SHASH_DESC_ON_STACK() is used with hmac(sha3-224-generic).
Fix it by increasing HASH_MAX_DESCSIZE to the real maximum. Also add a sanity check to hmac_init().
This was detected by the improved crypto self-tests in v5.2, by loading the tcrypt module with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y enabled. I didn't notice this bug when I ran the self-tests by requesting the algorithms via AF_ALG (i.e., not using tcrypt), probably because the stack layout differs in the two cases and that made a difference here.
KASAN report:
BUG: KASAN: stack-out-of-bounds in memcpy include/linux/string.h:359 [inline]
BUG: KASAN: stack-out-of-bounds in shash_default_import+0x52/0x80 crypto/shash.c:223
Write of size 360 at addr ffff8880651defc8 by task insmod/3689
CPU: 2 PID: 3689 Comm: insmod Tainted: G E 5.1.0-10741-g35c99ffa20edd #11
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x86/0xc5 lib/dump_stack.c:113
print_address_description+0x7f/0x260 mm/kasan/report.c:188
__kasan_report+0x144/0x187 mm/kasan/report.c:317
kasan_report+0x12/0x20 mm/kasan/common.c:614
check_memory_region_inline mm/kasan/generic.c:185 [inline]
check_memory_region+0x137/0x190 mm/kasan/generic.c:191
memcpy+0x37/0x50 mm/kasan/common.c:125
memcpy include/linux/string.h:359 [inline]
shash_default_import+0x52/0x80 crypto/shash.c:223
crypto_shash_import include/crypto/hash.h:880 [inline]
hmac_import+0x184/0x240 crypto/hmac.c:102
hmac_init+0x96/0xc0 crypto/hmac.c:107
crypto_shash_init include/crypto/hash.h:902 [inline]
shash_digest_unaligned+0x9f/0xf0 crypto/shash.c:194
crypto_shash_digest+0xe9/0x1b0 crypto/shash.c:211
generate_random_hash_testvec.constprop.11+0x1ec/0x5b0 crypto/testmgr.c:1331
test_hash_vs_generic_impl+0x3f7/0x5c0 crypto/testmgr.c:1420
__alg_test_hash+0x26d/0x340 crypto/testmgr.c:1502
alg_test_hash+0x22e/0x330 crypto/testmgr.c:1552
alg_test.part.7+0x132/0x610 crypto/testmgr.c:4931
alg_test+0x1f/0x40 crypto/testmgr.c:4952--- crypto/hmac.c | 2 ++ include/crypto/hash.h | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-)
crypto/hmac.c +2 -0
@@ -168,6 +168,8 @@ static int hmac_init_tfm(struct crypto_t parent->descsize =sizeof (struct shash_desc ) +crypto_shash_descsize (hash); +if (WARN_ON (parent->descsize >HASH_MAX_DESCSIZE )) +return -EINVAL ; ctx->hash = hash;return 0 ;
include/crypto/hash.h +7 -1
@@ -152,7 +152,13 @@ struct shash_desc { };#define HASH_MAX_DIGESTSIZE 64 -#define HASH_MAX_DESCSIZE 360 + +/* +* Worst case is hmac(sha3-224-generic). Its context is a nested 'shash_desc' +* containing a 'struct sha3_state'. +*/ +#define HASH_MAX_DESCSIZE (sizeof(struct shash_desc) + 360) +#define HASH_MAX_STATESIZE 512#define SHASH_DESC_ON_STACK (shash, ctx) \
Greg Kroah-Hartman
maintainerPATCH 27/346 arm64: errata: Add workaround for Cortex-A76 erratum #1463225
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 969f5ea627570e91c9d54403287ee3ed657f58fe upstream.
Revisions of the Cortex-A76 CPU prior to r4p0 are affected by an erratum that can prevent interrupts from being taken when single-stepping.
This patch implements a software workaround to prevent userspace from effectively being able to disable interrupts.
--- Documentation/arm64/silicon-errata.txt | 1 arch/arm64/Kconfig | 18 ++++++++++++++++ arch/arm64/include/asm/cpucaps.h | 3 +- arch/arm64/kernel/cpu_errata.c | 24 +++++++++++++++++++++ arch/arm64/kernel/syscall.c | 31 +++++++++++++++++++++++++++ arch/arm64/mm/fault.c | 37 +++++++++++++++++++++++++++++++-- 6 files changed, 111 insertions(+), 3 deletions(-)
Documentation/arm64/silicon-errata.txt +1 -0
@@ -61,6 +61,7 @@ stable kernels. | ARM | Cortex-A76 | #1188873 | ARM64_ERRATUM_1188873 | | ARM | Cortex-A76 | #1165522 | ARM64_ERRATUM_1165522 | | ARM | Cortex-A76 | #1286807 | ARM64_ERRATUM_1286807 | +| ARM | Cortex-A76 | #1463225 | ARM64_ERRATUM_1463225 | | ARM | MMU-500 | #841119,#826419 | N/A | | | | | | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |
arch/arm64/Kconfig +18 -0
@@ -518,6 +518,24 @@ config ARM64_ERRATUM_1286807 If unsure, say Y. +config ARM64_ERRATUM_1463225 + bool "Cortex-A76: Software Step might prevent interrupt recognition" + default y + help + This option adds a workaround for Arm Cortex-A76 erratum 1463225. + + On the affected Cortex-A76 cores (r0p0 to r3p1), software stepping + of a system call instruction (SVC) can prevent recognition of + subsequent interrupts when software stepping is disabled in the + exception handler of the system call and either kernel debugging + is enabled or VHE is in use. + + Work around the erratum by triggering a dummy step exception + when handling a system call from a task that is being stepped + in a VHE configuration of the kernel. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y
arch/arm64/include/asm/cpucaps.h +2 -1
@@ -60,7 +60,8 @@#define ARM64_HAS_ADDRESS_AUTH_IMP_DEF 39#define ARM64_HAS_GENERIC_AUTH_ARCH 40#define ARM64_HAS_GENERIC_AUTH_IMP_DEF 41 +#define ARM64_WORKAROUND_1463225 42 -#define ARM64_NCAPS 42 +#define ARM64_NCAPS 43#endif /* __ASM_CPUCAPS_H */
arch/arm64/kernel/cpu_errata.c +24 -0
@@ -464,6 +464,22 @@ out_printmsg: }#endif /* CONFIG_ARM64_SSBD */ +#ifdef CONFIG_ARM64_ERRATUM_1463225 +DEFINE_PER_CPU (int, __in_cortex_a76_erratum_1463225_wa); + +static bool +has_cortex_a76_erratum_1463225 (const struct arm64_cpu_capabilities *entry, +int scope) +{ +u32 midr =read_cpuid_id (); +/* Cortex-A76 r0p0 - r3p1 */ +struct midr_range range =MIDR_RANGE (MIDR_CORTEX_A76 ,0 ,0 ,3 ,1 ); + +WARN_ON (scope !=SCOPE_LOCAL_CPU ||preemptible ()); +return is_midr_in_range (midr, &range) &&is_kernel_in_hyp_mode (); +} +#endif +static void __maybe_unused cpu_enable_cache_maint_trap (const struct arm64_cpu_capabilities *__unused) {
@@ -739,6 +755,14 @@ const struct arm64_cpu_capabilities arm6 ERRATA_MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 2, 0), },#endif +#ifdef CONFIG_ARM64_ERRATUM_1463225 + { + .desc = "ARM erratum 1463225", + .capability = ARM64_WORKAROUND_1463225, + .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, + .matches = has_cortex_a76_erratum_1463225, + }, +#endif { } };
arch/arm64/kernel/syscall.c +31 -0
@@ -8,6 +8,7 @@#include <linux/syscalls.h> #include <asm/daifflags.h> +#include <asm/debug-monitors.h> #include <asm/fpsimd.h> #include <asm/syscall.h> #include <asm/thread_info.h>
@@ -60,6 +61,35 @@ static inline bool has_syscall_work(unsiint syscall_trace_enter (struct pt_regs *regs);void syscall_trace_exit (struct pt_regs *regs); +#ifdef CONFIG_ARM64_ERRATUM_1463225 +DECLARE_PER_CPU (int, __in_cortex_a76_erratum_1463225_wa); + +static void cortex_a76_erratum_1463225_svc_handler (void ) +{ +u32 reg, val; + +if (!unlikely (test_thread_flag (TIF_SINGLESTEP ))) +return ; + +if (!unlikely (this_cpu_has_cap (ARM64_WORKAROUND_1463225 ))) +return ; + +__this_cpu_write (__in_cortex_a76_erratum_1463225_wa,1 ); + reg =read_sysreg (mdscr_el1); + val = reg |DBG_MDSCR_SS |DBG_MDSCR_KDE ; +write_sysreg (val, mdscr_el1); + asmvolatile ("msr daifclr, #8" ); +isb (); + +/* We will have taken a single-step exception by this point */ + +write_sysreg (reg, mdscr_el1); +__this_cpu_write (__in_cortex_a76_erratum_1463225_wa,0 ); +} +#else +static void cortex_a76_erratum_1463225_svc_handler (void ) { } +#endif /* CONFIG_ARM64_ERRATUM_1463225 */ +static void el0_svc_common (struct pt_regs *regs,int scno,int sc_nr,const syscall_fn_t syscall_table[]) {
@@ -68,6 +98,7 @@ static void el0_svc_common(struct pt_reg regs->orig_x0 = regs->regs[0 ]; regs->syscallno = scno; +cortex_a76_erratum_1463225_svc_handler ();local_daif_restore (DAIF_PROCCTX );user_exit ();
arch/arm64/mm/fault.c +35 -2
@@ -824,14 +824,47 @@ void __init hook_debug_fault_code(int nr debug_fault_info[nr].name = name; } +#ifdef CONFIG_ARM64_ERRATUM_1463225 +DECLARE_PER_CPU (int, __in_cortex_a76_erratum_1463225_wa); + +static int __exception +cortex_a76_erratum_1463225_debug_handler (struct pt_regs *regs) +{ +if (user_mode (regs)) +return 0 ; + +if (!__this_cpu_read (__in_cortex_a76_erratum_1463225_wa)) +return 0 ; + +/* +* We've taken a dummy step exception from the kernel to ensure +* that interrupts are re-enabled on the syscall path. Return back +* to cortex_a76_erratum_1463225_svc_handler() with debug exceptions +* masked so that we can safely restore the mdscr and get on with +* handling the syscall. +*/ + regs->pstate |=PSR_D_BIT ; +return 1 ; +} +#else +static int __exception +cortex_a76_erratum_1463225_debug_handler (struct pt_regs *regs) +{ +return 0 ; +} +#endif /* CONFIG_ARM64_ERRATUM_1463225 */ + asmlinkage int __exception do_debug_exception(unsigned long addr_if_watchpoint, -unsigned int esr, -struct pt_regs *regs) +unsigned int esr, +struct pt_regs *regs) {const struct fault_info *inf =esr_to_debug_fault_info (esr);unsigned long pc =instruction_pointer (regs);int rv; +if (cortex_a76_erratum_1463225_debug_handler (regs)) +return 0 ; +/* * Tell lockdep we disabled irqs in entry.S. Do nothing if they were * already disabled to preserve the last enabled/disabled addresses.
Greg Kroah-Hartman
maintainerPATCH 29/346 ovl: relax WARN_ON() for overlapping layers use case
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit acf3062a7e1ccf67c6f7e7c28671a6708fde63b0 upstream.
This nasty little syzbot repro:
https://syzkaller.appspot.com/x/repro.syz?x=12c7a94f400000
Creates overlay mounts where the same directory is both in upper and lower layers. Simplified example:
mkdir foo work
mount -t overlay none foo -o"lowerdir=.,upperdir=foo,workdir=work"
The repro runs several threads in parallel that attempt to chdir into foo and attempt to symlink/rename/exec/mkdir the file bar.
The repro hits a WARN_ON() I placed in ovl_instantiate(), which suggests that an overlay inode already exists in cache and is hashed by the pointer of the real upper dentry that ovl_create_real() has just created. At the point of the WARN_ON(), for overlay dir inode lock is held and upper dir inode lock, so at first, I did not see how this was possible.
On a closer look, I see that after ovl_create_real(), because of the overlapping upper and lower layers, a lookup by another thread can find the file foo/bar that was just created in upper layer, at overlay path foo/foo/bar and hash the an overlay inode with the new real dentry as lower dentry. This is possible because the overlay directory foo/foo is not locked and the upper dentry foo/bar is in dcache, so ovl_lookup() can find it without taking upper dir inode shared lock.
Overlapping layers is considered a wrong setup which would result in unexpected behavior, but it shouldn't crash the kernel and it shouldn't trigger WARN_ON() either, so relax this WARN_ON() and leave a pr_warn() instead to cover all cases of failure to get an overlay inode.
The error returned from failure to insert new inode to cache with inode_insert5() was changed to -EEXIST, to distinguish from the error -ENOMEM returned on failure to get/allocate inode with iget5_locked().
--- fs/overlayfs/dir.c | 2 +- fs/overlayfs/inode.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
fs/overlayfs/dir.c +1 -1
@@ -260,7 +260,7 @@ static int ovl_instantiate(struct dentry* hashed directory inode aliases. */ inode =ovl_get_inode (dentry->d_sb, &oip); -if (WARN_ON (IS_ERR (inode))) +if (IS_ERR (inode))return PTR_ERR (inode); }else {WARN_ON (ovl_inode_real (inode) !=d_inode (newdentry));
fs/overlayfs/inode.c +2 -1
@@ -832,7 +832,7 @@ struct inode *ovl_get_inode(struct superint fsid = bylower ? oip->lowerpath->layer->fsid :0 ;bool is_dir, metacopy = false;unsigned long ino =0 ; -int err = -ENOMEM ; +int err = oip->newinode ? -EEXIST : -ENOMEM ;if (!realinode) realinode =d_inode (lowerdentry);
@@ -917,6 +917,7 @@ out:return inode; out_err: +pr_warn_ratelimited ("overlayfs: failed to get inode (%i)\n" , err); inode =ERR_PTR (err); goto out; }
Greg Kroah-Hartman
maintainerPATCH 18/346 Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 72bd2323ec87722c115a5906bc6a1b31d11e8f54 upstream.
Currently when we fail to COW a path at btrfs_update_root() we end up always aborting the transaction. However all the current callers of btrfs_update_root() are able to deal with errors returned from it, many do end up aborting the transaction themselves (directly or not, such as the transaction commit path), other BUG_ON() or just gracefully cancel whatever they were doing.
When syncing the fsync log, we call btrfs_update_root() through tree-log.c:update_log_root(), and if it returns an -ENOSPC error, the log sync code does not abort the transaction, instead it gracefully handles the error and returns -EAGAIN to the fsync handler, so that it falls back to a transaction commit. Any other error different from -ENOSPC, makes the log sync code abort the transaction.
So remove the transaction abort from btrfs_update_log() when we fail to COW a path to update the root item, so that if an -ENOSPC failure happens we avoid aborting the current transaction and have a chance of the fsync succeeding after falling back to a transaction commit.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203413
--- fs/btrfs/root-tree.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/root-tree.c +1 -3
@@ -132,10 +132,8 @@ int btrfs_update_root(struct btrfs_transreturn -ENOMEM ; ret =btrfs_search_slot (trans, root, key, path,0 ,1 ); -if (ret <0 ) { -btrfs_abort_transaction (trans, ret); +if (ret <0 ) goto out; - }if (ret !=0 ) {btrfs_print_leaf (path->nodes[0 ]);
Greg Kroah-Hartman
maintainerPATCH 48/346 gfs2: Fix occasional glock use-after-free
In reply to Greg Kroah-Hartman[ Upstream commit 9287c6452d2b1f24ea8e84bd3cf6f3c6f267f712 ]
This patch has to do with the life cycle of glocks and buffers. When gfs2 metadata or journaled data is queued to be written, a gfs2_bufdata object is assigned to track the buffer, and that is queued to various lists, including the glock's gl_ail_list to indicate it's on the active items list. Once the page associated with the buffer has been written, it is removed from the ail list, but its life isn't over until a revoke has been successfully written.
So after the block is written, its bufdata object is moved from the glock's gl_ail_list to a file-system-wide list of pending revokes, sd_log_le_revoke. At that point the glock still needs to track how many revokes it contributed to that list (in gl_revokes) so that things like glock go_sync can ensure all the metadata has been not only written, but also revoked before the glock is granted to a different node. This is to guarantee journal replay doesn't replay the block once the glock has been granted to another node.
Ross Lagerwall recently discovered a race in which an inode could be evicted, and its glock freed after its ail list had been synced, but while it still had unwritten revokes on the sd_log_le_revoke list. The evict decremented the glock reference count to zero, which allowed the glock to be freed. After the revoke was written, function revoke_lo_after_commit tried to adjust the glock's gl_revokes counter and clear its GLF_LFLUSH flag, at which time it referenced the freed glock.
This patch fixes the problem by incrementing the glock reference count in gfs2_add_revoke when the glock's first bufdata object is moved from the glock to the global revokes list. Later, when the glock's last such bufdata object is freed, the reference count is decremented. This guarantees that whichever process finishes last (the revoke writing or the evict) will properly free the glock, and neither will reference the glock after it has been freed.
--- fs/gfs2/glock.c | 1 + fs/gfs2/log.c | 3 ++- fs/gfs2/lops.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-)
fs/gfs2/glock.c +1 -0
@@ -140,6 +140,7 @@ void gfs2_glock_free(struct gfs2_glock *gl) {struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; +BUG_ON (atomic_read (&gl->gl_revokes));rhashtable_remove_fast (&gl_hash_table, &gl->gl_node, ht_parms);smp_mb ();wake_up_glock (gl);
fs/gfs2/log.c +2 -1
@@ -606,7 +606,8 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)gfs2_remove_from_ail (bd);/* drops ref on bh */ bd->bd_bh =NULL ; sdp->sd_log_num_revoke++; -atomic_inc (&gl->gl_revokes); +if (atomic_inc_return (&gl->gl_revokes) ==1 ) +gfs2_glock_hold (gl);set_bit (GLF_LFLUSH , &gl->gl_flags);list_add (&bd->bd_list, &sdp->sd_log_le_revoke); }
fs/gfs2/lops.c +4 -2
@@ -667,8 +667,10 @@ static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) bd = list_entry(head->next, struct gfs2_bufdata, bd_list);list_del_init (&bd->bd_list); gl = bd->bd_gl; -atomic_dec (&gl->gl_revokes); -clear_bit (GLF_LFLUSH , &gl->gl_flags); +if (atomic_dec_return (&gl->gl_revokes) ==0 ) { +clear_bit (GLF_LFLUSH , &gl->gl_flags); +gfs2_glock_queue_put (gl); + }kmem_cache_free (gfs2_bufdata_cachep, bd); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/346 selftests/bpf: set RLIMIT_MEMLOCK properly for test_libbpf_open.c
In reply to Greg Kroah-Hartman[ Upstream commit 6cea33701eb024bc6c920ab83940ee22afd29139 ]
Test test_libbpf.sh failed on my development server with failure
-bash-4.4$ sudo ./test_libbpf.sh
[0] libbpf: Error in bpf_object__probe_name():Operation not permitted(1). Couldn't load basic 'r0 = 0' BPF program.
test_libbpf: failed at file test_l4lb.o
selftests: test_libbpf [FAILED]
-bash-4.4$
The reason is because my machine has 64KB locked memory by default which is not enough for this program to get locked memory.
Similar to other bpf selftests, let us increase RLIMIT_MEMLOCK to infinity, which fixed the issue.
--- tools/testing/selftests/bpf/test_libbpf_open.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/test_libbpf_open.c +2 -0
@@ -11,6 +11,8 @@ static const char *__doc__ =#include <bpf/libbpf.h> #include <getopt.h> +#include "bpf_rlimit.h" +static const struct option long_options[] = { {"help" , no_argument,NULL ,'h' }, {"debug" , no_argument,NULL ,'D' },
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 52/346 bpftool: exclude bash-completion/bpftool from .gitignore pattern
In reply to Greg Kroah-Hartman[ Upstream commit a7d006714724de4334c5e3548701b33f7b12ca96 ]
tools/bpf/bpftool/.gitignore has the "bpftool" pattern, which is intended to ignore the following build artifact:
tools/bpf/bpftool/bpftool
However, the .gitignore entry is effective not only for the current directory, but also for any sub-directories.
So, from the point of .gitignore grammar, the following check-in file is also considered to be ignored:
tools/bpf/bpftool/bash-completion/bpftool
As the manual gitignore(5) says "Files already tracked by Git are not affected", this is not a problem as far as Git is concerned.
However, Git is not the only program that parses .gitignore because .gitignore is useful to distinguish build artifacts from source files.
For example, tar(1) supports the --exclude-vcs-ignore option. As of writing, this option does not work perfectly, but it intends to create a tarball excluding files specified by .gitignore.
So, I believe it is better to fix this issue.
You can fix it by prefixing the pattern with a slash; the leading slash means the specified pattern is relative to the current directory.
--- tools/bpf/bpftool/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/.gitignore +1 -1
@@ -1,5 +1,5 @@ *.d -bpftool +/bpftool bpftool*.8 bpf-helpers.* FEATURE-DUMP.bpftool
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/346 dmaengine: tegra210-dma: free dma controller in remove()
In reply to Greg Kroah-Hartman[ Upstream commit f030e419501cb95e961e9ed35c493b5d46a04eca ]
Following kernel panic is seen during DMA driver unload->load sequence
==========================================================================
Unable to handle kernel paging request at virtual address ffffff8001198880 Internal error: Oops: 86000007 [#1] PREEMPT SMP CPU: 0 PID: 5907 Comm: HwBinder:4123_1 Tainted: G C 4.9.128-tegra-g065839f Hardware name: galen (DT) task: ffffffc3590d1a80 task.stack: ffffffc3d0678000 PC is at 0xffffff8001198880 LR is at of_dma_request_slave_channel+0xd8/0x1f8 pc : [<ffffff8001198880>] lr : [<ffffff8008746f30>] pstate: 60400045
sp : ffffffc3d067b710
x29: ffffffc3d067b710 x28: 000000000000002f
x27: ffffff800949e000 x26: ffffff800949e750
x25: ffffff800949e000 x24: ffffffbefe817d84
x23: ffffff8009f77cb0 x22: 0000000000000028
x21: ffffffc3ffda49c8 x20: 0000000000000029
x19: 0000000000000001 x18: ffffffffffffffff
x17: 0000000000000000 x16: ffffff80082b66a0
x15: ffffff8009e78250 x14: 000000000000000a
x13: 0000000000000038 x12: 0101010101010101
x11: 0000000000000030 x10: 0101010101010101
x9 : fffffffffffffffc x8 : 7f7f7f7f7f7f7f7f
x7 : 62ff726b6b64622c x6 : 0000000000008064
x5 : 6400000000000000 x4 : ffffffbefe817c44
x3 : ffffffc3ffda3e08 x2 : ffffff8001198880
x1 : ffffffc3d48323c0 x0 : ffffffc3d067b788
Process HwBinder:4123_1 (pid: 5907, stack limit = 0xffffffc3d0678028)
Call trace: [<ffffff8001198880>] 0xffffff8001198880 [<ffffff80087459f8>] dma_request_chan+0x50/0x1f0 [<ffffff8008745bc0>] dma_request_slave_channel+0x28/0x40 [<ffffff8001552c44>] tegra_alt_pcm_open+0x114/0x170 [<ffffff8008d65fa4>] soc_pcm_open+0x10c/0x878 [<ffffff8008d18618>] snd_pcm_open_substream+0xc0/0x170 [<ffffff8008d1878c>] snd_pcm_open+0xc4/0x240 [<ffffff8008d189e0>] snd_pcm_playback_open+0x58/0x80 [<ffffff8008cfc6d4>] snd_open+0xb4/0x178 [<ffffff8008250628>] chrdev_open+0xb8/0x1d0 [<ffffff8008246fdc>] do_dentry_open+0x214/0x318 [<ffffff80082485d0>] vfs_open+0x58/0x88 [<ffffff800825bce0>] do_last+0x450/0xde0 [<ffffff800825c718>] path_openat+0xa8/0x368 [<ffffff800825dd84>] do_filp_open+0x8c/0x110 [<ffffff8008248a74>] do_sys_open+0x164/0x220 [<ffffff80082b66dc>] compat_SyS_openat+0x3c/0x50 [<ffffff8008083040>] el0_svc_naked+0x34/0x38 ---[ end trace 67e6d544e65b5145 ]--- Kernel panic - not syncing: Fatal exception ==========================================================================
In device probe(), of_dma_controller_register() registers DMA controller. But when driver is removed, this is not freed. During driver reload this results in data abort and kernel panic. Add of_dma_controller_free() in driver remove path to fix the issue.
--- drivers/dma/tegra210-adma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/tegra210-adma.c +1 -0
@@ -786,6 +786,7 @@ static int tegra_adma_remove(struct platform_device *pdev)struct tegra_adma *tdma =platform_get_drvdata (pdev);int i; +of_dma_controller_free (pdev->dev.of_node);dma_async_device_unregister (&tdma->dma_dev);for (i =0 ; i < tdma->nr_channels; ++i)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 74/346 ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
In reply to Greg Kroah-Hartman[ Upstream commit 23583f7795025e3c783b680d906509366b0906ad ]
When the DSDT tables expose devices with subdevices and a set of hierarchical _DSD properties, the data returned by acpi_get_next_subnode() is incorrect, with the results suggesting a bad pointer assignment. The parser works fine with device_nodes or data_nodes, but not with a combination of the two.
The problem is traced to an invalid pointer used when jumping from handling device_nodes to data nodes. The existing code looks for data nodes below the last subdevice found instead of the common root. Fix by forcing the acpi_device pointer to be derived from the same fwnode for the two types of subnodes.
This same problem of handling device and data nodes was already fixed in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data node parsing in acpi_get_next_subnode()")' but broken later by 'commit 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so this should probably go to linux-stable all the way to 4.12
--- drivers/acpi/property.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/property.c +8 -0
@@ -1031,6 +1031,14 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,const struct acpi_data_node *data =to_acpi_data_node (fwnode);struct acpi_data_node *dn; +/* +* We can have a combination of device and data nodes, e.g. with +* hierarchical _DSD properties. Make sure the adev pointer is +* restored before going through data nodes, otherwise we will +* be looking for data_nodes below the last device found instead +* of the common fwnode shared by device_nodes and data_nodes. +*/ + adev =to_acpi_device_node (fwnode);if (adev) head = &adev->data.subnodes;else if (data)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/346 usb: dwc3: move synchronize_irq() out of the spinlock protected block
In reply to Greg Kroah-Hartman[ Upstream commit 41a91c606e7d2b74358a944525267cc451c271e8 ]
dwc3_gadget_suspend() is called under dwc->lock spinlock. In such context calling synchronize_irq() is not allowed. Move the problematic call out of the protected block to fix the following kernel BUG during system suspend:
BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
in_atomic(): 1, irqs_disabled(): 128, pid: 1601, name: rtcwake
6 locks held by rtcwake/1601:
#0: f70ac2a2 (sb_writers#7){.+.+}, at: vfs_write+0x130/0x16c
#1: b5fe1270 (&of->mutex){+.+.}, at: kernfs_fop_write+0xc0/0x1e4 #2: 7e597705 (kn->count#60){.+.+}, at: kernfs_fop_write+0xc8/0x1e4 #3: 8b3527d0 (system_transition_mutex){+.+.}, at: pm_suspend+0xc4/0xc04 #4: fc7f1c42 (&dev->mutex){....}, at: __device_suspend+0xd8/0x74c #5: 4b36507e (&(&dwc->lock)->rlock){....}, at: dwc3_gadget_suspend+0x24/0x3c
irq event stamp: 11252 hardirqs last enabled at (11251): [<c09c54a4>] _raw_spin_unlock_irqrestore+0x6c/0x74 hardirqs last disabled at (11252): [<c09c4d44>] _raw_spin_lock_irqsave+0x1c/0x5c softirqs last enabled at (9744): [<c0102564>] __do_softirq+0x3a4/0x66c softirqs last disabled at (9737): [<c0128528>] irq_exit+0x140/0x168 Preemption disabled at: [<00000000>] (null) CPU: 7 PID: 1601 Comm: rtcwake Not tainted 5.0.0-rc3-next-20190122-00039-ga3f4ee4f8a52 #5252 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c01110f0>] (unwind_backtrace) from [<c010d120>] (show_stack+0x10/0x14) [<c010d120>] (show_stack) from [<c09a4d04>] (dump_stack+0x90/0xc8) [<c09a4d04>] (dump_stack) from [<c014c700>] (___might_sleep+0x22c/0x2c8) [<c014c700>] (___might_sleep) from [<c0189d68>] (synchronize_irq+0x28/0x84) [<c0189d68>] (synchronize_irq) from [<c05cbbf8>] (dwc3_gadget_suspend+0x34/0x3c) [<c05cbbf8>] (dwc3_gadget_suspend) from [<c05bd020>] (dwc3_suspend_common+0x154/0x410) [<c05bd020>] (dwc3_suspend_common) from [<c05bd34c>] (dwc3_suspend+0x14/0x2c) [<c05bd34c>] (dwc3_suspend) from [<c051c730>] (platform_pm_suspend+0x2c/0x54) [<c051c730>] (platform_pm_suspend) from [<c05285d4>] (dpm_run_callback+0xa4/0x3dc) [<c05285d4>] (dpm_run_callback) from [<c0528a40>] (__device_suspend+0x134/0x74c) [<c0528a40>] (__device_suspend) from [<c052c508>] (dpm_suspend+0x174/0x588) [<c052c508>] (dpm_suspend) from [<c0182134>] (suspend_devices_and_enter+0xc0/0xe74) [<c0182134>] (suspend_devices_and_enter) from [<c0183658>] (pm_suspend+0x770/0xc04) [<c0183658>] (pm_suspend) from [<c0180ddc>] (state_store+0x6c/0xcc) [<c0180ddc>] (state_store) from [<c09a9a70>] (kobj_attr_store+0x14/0x20) [<c09a9a70>] (kobj_attr_store) from [<c02d6800>] (sysfs_kf_write+0x4c/0x50) [<c02d6800>] (sysfs_kf_write) from [<c02d594c>] (kernfs_fop_write+0xfc/0x1e4) [<c02d594c>] (kernfs_fop_write) from [<c02593d8>] (__vfs_write+0x2c/0x160) [<c02593d8>] (__vfs_write) from [<c0259694>] (vfs_write+0xa4/0x16c) [<c0259694>] (vfs_write) from [<c0259870>] (ksys_write+0x40/0x8c) [<c0259870>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28) Exception stack(0xed55ffa8 to 0xed55fff0)
...
--- drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/gadget.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc3/core.c +2 -0
@@ -1600,6 +1600,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)spin_lock_irqsave (&dwc->lock, flags);dwc3_gadget_suspend (dwc);spin_unlock_irqrestore (&dwc->lock, flags); +synchronize_irq (dwc->irq_gadget);dwc3_core_exit (dwc);break ;case DWC3_GCTL_PRTCAP_HOST :
@@ -1632,6 +1633,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)spin_lock_irqsave (&dwc->lock, flags);dwc3_gadget_suspend (dwc);spin_unlock_irqrestore (&dwc->lock, flags); +synchronize_irq (dwc->irq_gadget); }dwc3_otg_exit (dwc);
drivers/usb/dwc3/gadget.c +0 -2
@@ -3385,8 +3385,6 @@ int dwc3_gadget_suspend(struct dwc3 *dwc)dwc3_disconnect_gadget (dwc);__dwc3_gadget_stop (dwc); -synchronize_irq (dwc->irq_gadget); -return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 82/346 scsi: qla2xxx: Fix a qla24xx_enable_msix() error path
In reply to Greg Kroah-Hartman[ Upstream commit 24afabdbd0b3553963a2bbf465895492b14d1107 ]
Make sure that the allocated interrupts are freed if allocating memory for the msix_entries array fails.
--- drivers/scsi/qla2xxx/qla_isr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_isr.c +5 -1
@@ -3454,7 +3454,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)ql_log (ql_log_fatal, vha,0x00c8 ,"Failed to allocate memory for ha->msix_entries.\n" ); ret = -ENOMEM ; - goto msix_out; + goto free_irqs; } ha->flags.msix_enabled =1 ;
@@ -3537,6 +3537,10 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) msix_out:return ret; + +free_irqs: +pci_free_irq_vectors (ha->pdev); + goto msix_out; }int
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 97/346 net: ethernet: ti: cpsw: fix allmulti cfg in dual_mac mode
In reply to Greg Kroah-Hartman[ Upstream commit 06095f34f8a0a2c4c83a19514c272699edd5f80b ]
Now CPSW ALE will set/clean Host port bit in Unregistered Multicast Flood Mask (UNREG_MCAST_FLOOD_MASK) for every VLAN without checking if this port belongs to VLAN or not when ALLMULTI mode flag is set for nedev. This is working in non dual_mac mode, but in dual_mac - it causes enabling/disabling ALLMULTI flag for both ports.
Hence fix it by adding additional parameter to cpsw_ale_set_allmulti() to specify ALE port number for which ALLMULTI has to be enabled and check if port belongs to VLAN before modifying UNREG_MCAST_FLOOD_MASK.
--- drivers/net/ethernet/ti/cpsw.c | 12 +++++++++--- drivers/net/ethernet/ti/cpsw_ale.c | 19 ++++++++++--------- drivers/net/ethernet/ti/cpsw_ale.h | 3 +-- 3 files changed, 20 insertions(+), 14 deletions(-)
drivers/net/ethernet/ti/cpsw.c +9 -3
@@ -800,12 +800,17 @@ static int cpsw_purge_all_mc(struct net_device *ndev, const u8 *addr, int num)static void cpsw_ndo_set_rx_mode (struct net_device *ndev) { -struct cpsw_common *cpsw =ndev_to_cpsw (ndev); +struct cpsw_priv *priv =netdev_priv (ndev); +struct cpsw_common *cpsw = priv->cpsw; +int slave_port =-1 ; + +if (cpsw->data.dual_emac) + slave_port = priv->emac_port +1 ;if (ndev->flags &IFF_PROMISC ) {/* Enable promiscuous mode */ cpsw_set_promiscious (ndev, true); -cpsw_ale_set_allmulti (cpsw->ale,IFF_ALLMULTI ); +cpsw_ale_set_allmulti (cpsw->ale,IFF_ALLMULTI , slave_port);return ; }else {/* Disable promiscuous mode */
@@ -813,7 +818,8 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev) }/* Restore allmulti on vlans if necessary */ -cpsw_ale_set_allmulti (cpsw->ale, ndev->flags &IFF_ALLMULTI ); +cpsw_ale_set_allmulti (cpsw->ale, + ndev->flags &IFF_ALLMULTI , slave_port);/* add/remove mcast address either for real netdev or for vlan */ __hw_addr_ref_sync_dev(&ndev->mc, ndev, cpsw_add_mc_addr,
drivers/net/ethernet/ti/cpsw_ale.c +10 -9
@@ -482,24 +482,25 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) }EXPORT_SYMBOL_GPL (cpsw_ale_del_vlan); -void cpsw_ale_set_allmulti (struct cpsw_ale *ale,int allmulti) +void cpsw_ale_set_allmulti (struct cpsw_ale *ale,int allmulti,int port) {u32 ale_entry[ALE_ENTRY_WORDS ]; -int type, idx;int unreg_mcast =0 ; - -/* Only bother doing the work if the setting is actually changing */ -if (ale->allmulti == allmulti) -return ; - -/* Remember the new setting to check against next time */ - ale->allmulti = allmulti; +int type, idx;for (idx =0 ; idx < ale->params.ale_entries; idx++) { +int vlan_members; +cpsw_ale_read (ale, idx, ale_entry); type =cpsw_ale_get_entry_type (ale_entry);if (type !=ALE_TYPE_VLAN )continue ; + vlan_members = +cpsw_ale_get_vlan_member_list (ale_entry, + ale->vlan_field_bits); + +if (port !=-1 && !(vlan_members &BIT (port))) +continue ; unreg_mcast = cpsw_ale_get_vlan_unreg_mcast(ale_entry,
drivers/net/ethernet/ti/cpsw_ale.h +1 -2
@@ -37,7 +37,6 @@ struct cpsw_ale {struct cpsw_ale_params params;struct timer_list timer;unsigned long ageout; -int allmulti;u32 version;/* These bits are different on NetCP NU Switch ALE */ u32 port_mask_bits;
@@ -116,7 +115,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask,int cpsw_ale_add_vlan (struct cpsw_ale *ale,u16 vid,int port,int untag,int reg_mcast,int unreg_mcast);int cpsw_ale_del_vlan (struct cpsw_ale *ale,u16 vid,int port); -void cpsw_ale_set_allmulti (struct cpsw_ale *ale,int allmulti); +void cpsw_ale_set_allmulti (struct cpsw_ale *ale,int allmulti,int port);int cpsw_ale_control_get (struct cpsw_ale *ale,int port,int control); int cpsw_ale_control_set(struct cpsw_ale *ale, int port,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 105/346 libbpf: fix samples/bpf build failure due to undefined UINT32_MAX
In reply to Greg Kroah-Hartman[ Upstream commit 32e621e55496a0009f44fe4914cd4a23cade4984 ]
Currently, building bpf samples will cause the following error.
./tools/lib/bpf/bpf.h:132:27: error: 'UINT32_MAX' undeclared here (not in a function) ..
#define BPF_LOG_BUF_SIZE (UINT32_MAX >> 8) /* verifier maximum in kernels <= 5.1 */
^
./samples/bpf/bpf_load.h:31:25: note: in expansion of macro 'BPF_LOG_BUF_SIZE'
extern char bpf_log_buf[BPF_LOG_BUF_SIZE];
^~~~~~~~~~~~~~~~Due to commit 4519efa6f8ea ("libbpf: fix BPF_LOG_BUF_SIZE off-by-one error") hard-coded size of BPF_LOG_BUF_SIZE has been replaced with UINT32_MAX which is defined in <stdint.h> header.
Even with this change, bpf selftests are running fine since these are built with clang and it includes header(-idirafter) from clang/6.0.0/include. (it has <stdint.h>)
clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /usr/include \
-idirafter /usr/lib/llvm-6.0/lib/clang/6.0.0/include -idirafter /usr/include/x86_64-linux-gnu \
-Wno-compare-distinct-pointer-types -O2 -target bpf -emit-llvm -c progs/test_sysctl_prog.c -o - | \
llc -march=bpf -mcpu=generic -filetype=obj -o /linux/tools/testing/selftests/bpf/test_sysctl_prog.oBut bpf samples are compiled with GCC, and it only searches and includes headers declared at the target file. As '#include <stdint.h>' hasn't been declared in tools/lib/bpf/bpf.h, it causes build failure of bpf samples.
gcc -Wp,-MD,./samples/bpf/.sockex3_user.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes \
-O2 -fomit-frame-pointer -std=gnu89 -I./usr/include -I./tools/lib/ -I./tools/testing/selftests/bpf/ \
-I./tools/ lib/ -I./tools/include -I./tools/perf -c -o ./samples/bpf/sockex3_user.o ./samples/bpf/sockex3_user.c;This commit add declaration of '#include <stdint.h>' to tools/lib/bpf/bpf.h to fix this problem.
--- tools/lib/bpf/bpf.h | 1 + 1 file changed, 1 insertion(+)
tools/lib/bpf/bpf.h +1 -0
@@ -26,6 +26,7 @@#include <linux/bpf.h> #include <stdbool.h> #include <stddef.h> +#include <stdint.h> #ifdef __cplusplusextern "C" {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 106/346 slimbus: fix a potential NULL pointer dereference in of_qcom_slim_ngd_register
In reply to Greg Kroah-Hartman[ Upstream commit 06d5d6b7f9948a89543e1160ef852d57892c750d ]
In case platform_device_alloc fails, the fix returns an error code to avoid the NULL pointer dereference.
--- drivers/slimbus/qcom-ngd-ctrl.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/slimbus/qcom-ngd-ctrl.c +4 -0
@@ -1342,6 +1342,10 @@ static int of_qcom_slim_ngd_register(struct device *parent,return -ENOMEM ; ngd->pdev =platform_device_alloc (QCOM_SLIM_NGD_DRV_NAME , id); +if (!ngd->pdev) { +kfree (ngd); +return -ENOMEM ; + } ngd->id = id; ngd->pdev->dev.parent = parent; ngd->pdev->driver_override =QCOM_SLIM_NGD_DRV_NAME ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 70/346 spi: atmel-quadspi: fix crash while suspending
In reply to Greg Kroah-Hartman[ Upstream commit e5c27498a0403b270620b1a8a0a66e3efc222fb6 ]
atmel_qspi objects are kept in spi_controller objects, so, first get pointer to spi_controller object and then get atmel_qspi object from spi_controller object.
--- drivers/spi/atmel-quadspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/atmel-quadspi.c +4 -2
@@ -506,7 +506,8 @@ static int atmel_qspi_remove(struct platform_device *pdev)static int __maybe_unused atmel_qspi_suspend (struct device *dev) { -struct atmel_qspi *aq =dev_get_drvdata (dev); +struct spi_controller *ctrl =dev_get_drvdata (dev); +struct atmel_qspi *aq =spi_controller_get_devdata (ctrl);clk_disable_unprepare (aq->clk);
@@ -515,7 +516,8 @@ static int __maybe_unused atmel_qspi_suspend(struct device *dev)static int __maybe_unused atmel_qspi_resume (struct device *dev) { -struct atmel_qspi *aq =dev_get_drvdata (dev); +struct spi_controller *ctrl =dev_get_drvdata (dev); +struct atmel_qspi *aq =spi_controller_get_devdata (ctrl);clk_prepare_enable (aq->clk);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 143/346 media: stm32-dcmi: fix crash when subdev do not expose any formats
In reply to Greg Kroah-Hartman[ Upstream commit 33dfeb62e23c31619d2197850f7e8b50e8cc5466 ]
Do not access sd_formats[] if num_of_sd_formats is zero, ie subdev sensor didn't expose any formats.
--- drivers/media/platform/stm32/stm32-dcmi.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/platform/stm32/stm32-dcmi.c +6 -0
@@ -811,6 +811,9 @@ static int dcmi_try_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f, sd_fmt =find_format_by_fourcc (dcmi, pix->pixelformat);if (!sd_fmt) { +if (!dcmi->num_of_sd_formats) +return -ENODATA ; + sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats -1 ]; pix->pixelformat = sd_fmt->fourcc; }
@@ -989,6 +992,9 @@ static int dcmi_set_sensor_format(struct stm32_dcmi *dcmi, sd_fmt =find_format_by_fourcc (dcmi, pix->pixelformat);if (!sd_fmt) { +if (!dcmi->num_of_sd_formats) +return -ENODATA ; + sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats -1 ]; pix->pixelformat = sd_fmt->fourcc; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 176/346 perf/x86/msr: Add Icelake support
In reply to Greg Kroah-Hartman[ Upstream commit cf50d79a8cfe5adae37fec026220b009559bbeed ]
Icelake is the same as the existing Skylake parts.
--- arch/x86/events/msr.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/msr.c +1 -0
@@ -89,6 +89,7 @@ static bool test_intel(int idx)case INTEL_FAM6_SKYLAKE_X :case INTEL_FAM6_KABYLAKE_MOBILE :case INTEL_FAM6_KABYLAKE_DESKTOP : +case INTEL_FAM6_ICELAKE_MOBILE :if (idx ==PERF_MSR_SMI || idx ==PERF_MSR_PPERF )return true;break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 185/346 scsi: libsas: Do discovery on empty PHY to update PHY info
In reply to Greg Kroah-Hartman[ Upstream commit d8649fc1c5e40e691d589ed825998c36a947491c ]
When we discover the PHY is empty in sas_rediscover_dev(), the PHY information (like negotiated linkrate) is not updated.
As such, for a user examining sysfs for that PHY, they would see incorrect values:
root@(none)$ cd /sys/class/sas_phy/phy-0:0:20 root@(none)$ more negotiated_linkrate 3.0 Gbit root@(none)$ echo 0 > enable root@(none)$ more negotiated_linkrate 3.0 Gbit
So fix this, simply discover the PHY again, even though we know it's empty; in the above example, this gives us:
root@(none)$ more negotiated_linkrate Phy disabled
We must do this after unregistering the device associated with the PHY (in sas_unregister_devs_sas_addr()).
--- drivers/scsi/libsas/sas_expander.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/libsas/sas_expander.c +5 -0
@@ -2024,6 +2024,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)if ((SAS_ADDR (sas_addr) ==0 ) || (res == -ECOMM )) { phy->phy_state =PHY_EMPTY ;sas_unregister_devs_sas_addr (dev, phy_id, last); +/* +* Even though the PHY is empty, for convenience we discover +* the PHY to update the PHY info, like negotiated linkrate. +*/ +sas_ex_phy_discover (dev, phy_id);return res; }else if (SAS_ADDR (sas_addr) ==SAS_ADDR (phy->attached_sas_addr) &&dev_type_flutter (type, phy->attached_dev_type)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 192/346 drm/amdgpu: fix old fence check in amdgpu_fence_emit
In reply to Greg Kroah-Hartman[ Upstream commit 3d2aca8c8620346abdba96c6300d2c0b90a1d0cc ]
We don't hold a reference to the old fence, so it can go away any time we are waiting for it to signal.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 24 ++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +17 -7
@@ -136,8 +136,9 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, {struct amdgpu_device *adev = ring->adev;struct amdgpu_fence *fence; -struct dma_fence *old, **ptr; +struct dma_fence __rcu **ptr;uint32_t seq; +int r; fence =kmem_cache_alloc (amdgpu_fence_slab,GFP_KERNEL );if (fence ==NULL )
@@ -153,15 +154,24 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, seq, flags | AMDGPU_FENCE_FLAG_INT); ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask]; +if (unlikely (rcu_dereference_protected (*ptr,1 ))) { +struct dma_fence *old; + +rcu_read_lock (); + old =dma_fence_get_rcu_safe (ptr); +rcu_read_unlock (); + +if (old) { + r =dma_fence_wait (old, false); +dma_fence_put (old); +if (r) +return r; + } + } +/* This function can't be called concurrently anyway, otherwise * emitting the fence would mess up the hardware ring buffer. */ - old =rcu_dereference_protected (*ptr,1 ); -if (old && !dma_fence_is_signaled (old)) { -DRM_INFO ("rcu slot is busy\n" ); -dma_fence_wait (old, false); - } -rcu_assign_pointer (*ptr,dma_fence_get (&fence->base)); *f = &fence->base;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 194/346 clk: rockchip: Fix video codec clocks on rk3288
In reply to Greg Kroah-Hartman[ Upstream commit 00c0cd9e59d265b393553e9afa54fee8b10e8158 ]
It appears that there is a typo in the rk3288 TRM. For GRF_SOC_CON0[7] it says that 0 means "vepu" and 1 means "vdpu". It's the other way around.
How do I know? Here's my evidence:
1. Prior to commit 4d3e84f99628 ("clk: rockchip: describe aclk_vcodec using the new muxgrf type on rk3288") we always pretended that we were using "aclk_vdpu" and the comment in the code said that this matched the default setting in the system. In fact the default setting is 0 according to the TRM and according to reading memory at bootup. In addition rk3288-based Chromebooks ran like this and the video codecs worked.
2. With the existing clock code if you boot up and try to enable the new VIDEO_ROCKCHIP_VPU as a module (and without "clk_ignore_unused" on the command line), you get errors like "failed to get ack on domain 'pd_video', val=0x80208". After flipping vepu/vdpu things init OK.
3. If I export and add both the vepu and vdpu to the list of clocks for RK3288_PD_VIDEO I can get past the power domain errors, but now I freeze when the vpu_mmu gets initted.
4. If I just mark the "vdpu" as IGNORE_UNUSED then everything boots up and probes OK showing that somehow the "vdpu" was important to keep enabled. This is because we were actually using it as a parent.
5. After this change I can hack "aclk_vcodec_pre" to parent from "aclk_vepu" using assigned-clocks and the video codec still probes OK.
6. Rockchip has said so on the mailing list [1].
...so let's fix it.
Let's also add CLK_SET_RATE_PARENT to "aclk_vcodec_pre" as suggested by Jonas Karlman. Prior to the same commit you could do clk_set_rate() on "aclk_vcodec" and it would change "aclk_vdpu". That's because "aclk_vcodec" was a simple gate clock (always gets CLK_SET_RATE_PARENT) and its direct parent was "aclk_vdpu". After that commit "aclk_vcodec_pre" gets in the way so we need to add CLK_SET_RATE_PARENT to it too.
[1] https://lkml.kernel.org/r/[email protected]
--- drivers/clk/rockchip/clk-rk3288.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/rockchip/clk-rk3288.c +2 -2
@@ -219,7 +219,7 @@ PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" };PNAME (mux_edp_24m_p) = {"ext_edp_24m" ,"xin24m" };PNAME (mux_tspout_p) = {"cpll" ,"gpll" ,"npll" ,"xin27m" }; -PNAME (mux_aclk_vcodec_pre_p) = {"aclk_vepu" ,"aclk_vdpu" }; +PNAME (mux_aclk_vcodec_pre_p) = {"aclk_vdpu" ,"aclk_vepu" };PNAME (mux_usbphy480m_p) = {"sclk_otgphy1_480m" ,"sclk_otgphy2_480m" ,"sclk_otgphy0_480m" };PNAME (mux_hsicphy480m_p) = {"cpll" ,"gpll" ,"usbphy480m_src" };
@@ -420,7 +420,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {COMPOSITE (0 ,"aclk_vdpu" , mux_pll_src_cpll_gpll_usb480m_p,0 ,RK3288_CLKSEL_CON (32 ),14 ,2 ,MFLAGS ,8 ,5 ,DFLAGS ,RK3288_CLKGATE_CON (3 ),11 ,GFLAGS ), -MUXGRF (0 ,"aclk_vcodec_pre" , mux_aclk_vcodec_pre_p,0 , +MUXGRF (0 ,"aclk_vcodec_pre" , mux_aclk_vcodec_pre_p,CLK_SET_RATE_PARENT ,RK3288_GRF_SOC_CON (0 ),7 ,1 ,MFLAGS ),GATE (ACLK_VCODEC ,"aclk_vcodec" ,"aclk_vcodec_pre" ,0 , RK3288_CLKGATE_CON(9), 0, GFLAGS),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 196/346 clk: rockchip: Make rkpwm a critical clock on rk3288
In reply to Greg Kroah-Hartman[ Upstream commit dfe7fb21cd9e730230d55a79bc72cf2ece67cdd5 ]
Most rk3288-based boards are derived from the EVB and thus use a PWM regulator for the logic rail. However, most rk3288-based boards don't specify the PWM regulator in their device tree. We'll deal with that by making it critical.
NOTE: it's important to make it critical and not just IGNORE_UNUSED because all PWMs in the system share the same clock. We don't want another PWM user to turn the clock on and off and kill the logic rail.
This change is in preparation for actually having the PWMs in the rk3288 device tree actually point to the proper PWM clock. Up until now they've all pointed to the clock for the old IP block and they've all worked due to the fact that rkpwm was IGNORE_UNUSED and that the clock rates for both clocks were the same.
--- drivers/clk/rockchip/clk-rk3288.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3288.c +3 -1
@@ -697,7 +697,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {GATE (PCLK_TZPC ,"pclk_tzpc" ,"pclk_cpu" ,0 ,RK3288_CLKGATE_CON (11 ),3 ,GFLAGS ),GATE (PCLK_UART2 ,"pclk_uart2" ,"pclk_cpu" ,0 ,RK3288_CLKGATE_CON (11 ),9 ,GFLAGS ),GATE (PCLK_EFUSE256 ,"pclk_efuse_256" ,"pclk_cpu" ,0 ,RK3288_CLKGATE_CON (11 ),10 ,GFLAGS ), -GATE (PCLK_RKPWM ,"pclk_rkpwm" ,"pclk_cpu" ,CLK_IGNORE_UNUSED ,RK3288_CLKGATE_CON (11 ),11 ,GFLAGS ), +GATE (PCLK_RKPWM ,"pclk_rkpwm" ,"pclk_cpu" ,0 ,RK3288_CLKGATE_CON (11 ),11 ,GFLAGS ),/* ddrctrl [DDR Controller PHY clock] gates */ GATE(0, "nclk_ddrupctl0", "ddrphy", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(11), 4, GFLAGS),
@@ -838,6 +838,8 @@ static const char *const rk3288_critical_clocks[] __initconst = {"pclk_pd_pmu" ,"pclk_pmu_niu" ,"pmu_hclk_otg0" , +/* pwm-regulators on some boards, so handoff-critical later */ + "pclk_rkpwm", };static void __iomem *rk3288_cru_base;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 204/346 qmi_wwan: Add quirk for Quectel dynamic config
In reply to Greg Kroah-Hartman[ Upstream commit e4bf63482c309287ca84d91770ffa7dcc18e37eb ]
Most, if not all, Quectel devices use dynamic interface numbers, and users are able to change the USB configuration at will. Matching on for example interface number is therefore not possible.
Instead, the QMI device can be identified by looking at the interface class, subclass and protocol (all 0xff), as well as the number of endpoints. The reason we need to look at the number of endpoints, is that the diagnostic port interface has the same class, subclass and protocol as QMI. However, the diagnostic port only has two endpoints, while QMI has three.
Until now, we have identified the QMI device by combining a match on class, subclass and protocol, with a call to the function quectel_diag_detect(). In quectel_diag_detect(), we check if the number of endpoints matches for known Quectel vendor/product ids.
Adding new vendor/product ids to quectel_diag_detect() is not a good long-term solution. This commit replaces the function with a quirk, and applies the quirk to affected Quectel devices that I have been able to test the change with (EP06, EM12 and EC25). If the quirk is set and the number of endpoints equal two, we return from qmi_wwan_probe() with -ENODEV.
--- drivers/net/usb/qmi_wwan.c | 65 ++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 34 deletions(-)
drivers/net/usb/qmi_wwan.c +31 -34
@@ -63,6 +63,7 @@ enum qmi_wwan_flags {enum qmi_wwan_quirks {QMI_WWAN_QUIRK_DTR =1 <<0 ,/* needs "set DTR" request */ +QMI_WWAN_QUIRK_QUECTEL_DYNCFG =1 <<1 ,/* check num. endpoints */ };struct qmimux_hdr {
@@ -845,6 +846,16 @@ static const struct driver_info qmi_wwan_info_quirk_dtr = { .data = QMI_WWAN_QUIRK_DTR, }; +static const struct driver_info qmi_wwan_info_quirk_quectel_dyncfg = { + .description ="WWAN/QMI device" , + .flags =FLAG_WWAN |FLAG_SEND_ZLP , + .bind = qmi_wwan_bind, + .unbind = qmi_wwan_unbind, + .manage_power = qmi_wwan_manage_power, + .rx_fixup = qmi_wwan_rx_fixup, + .data =QMI_WWAN_QUIRK_DTR |QMI_WWAN_QUIRK_QUECTEL_DYNCFG , +}; +#define HUAWEI_VENDOR_ID 0x12D1/* map QMI/wwan function by a fixed interface number */
@@ -865,6 +876,15 @@ static const struct driver_info qmi_wwan_info_quirk_dtr = {#define QMI_GOBI_DEVICE (vend, prod) \ QMI_FIXED_INTF(vend, prod, 0) +/* Quectel does not use fixed interface numbers on at least some of their +* devices. We need to check the number of endpoints to ensure that we bind to +* the correct interface. +*/ +#define QMI_QUIRK_QUECTEL_DYNCFG (vend, prod) \ + USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_VENDOR_SPEC, \ + USB_SUBCLASS_VENDOR_SPEC, 0xff), \ + .driver_info = (unsigned long)&qmi_wwan_info_quirk_quectel_dyncfg +static const struct usb_device_id products[] = {/* 1. CDC ECM like devices match on the control interface */ {/* Huawei E392, E398 and possibly others sharing both device id and more... */
@@ -969,20 +989,9 @@ static const struct usb_device_id products[] = { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7), .driver_info = (unsigned long )&qmi_wwan_info, }, - { /* Quectel EP06/EG06/EM06 */ -USB_DEVICE_AND_INTERFACE_INFO (0x2c7c ,0x0306 , -USB_CLASS_VENDOR_SPEC , -USB_SUBCLASS_VENDOR_SPEC , -0xff ), - .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr, - }, - { /* Quectel EG12/EM12 */ -USB_DEVICE_AND_INTERFACE_INFO (0x2c7c ,0x0512 , -USB_CLASS_VENDOR_SPEC , -USB_SUBCLASS_VENDOR_SPEC , -0xff ), - .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr, - }, + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 *//* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
@@ -1283,7 +1292,6 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ {QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */ - {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */ {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
@@ -1363,27 +1371,12 @@ static bool quectel_ec20_detected(struct usb_interface *intf)return false; } -static bool quectel_diag_detected (struct usb_interface *intf) -{ -struct usb_device *dev =interface_to_usbdev (intf); -struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc; -u16 id_vendor =le16_to_cpu (dev->descriptor.idVendor); -u16 id_product =le16_to_cpu (dev->descriptor.idProduct); - -if (id_vendor !=0x2c7c || intf_desc.bNumEndpoints !=2 ) -return false; - -if (id_product ==0x0306 || id_product ==0x0512 ) -return true; -else -return false; -} -static int qmi_wwan_probe (struct usb_interface *intf,const struct usb_device_id *prod) {struct usb_device_id *id = (struct usb_device_id *)prod;struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; +const struct driver_info *info;/* Workaround to enable dynamic IDs. This disables usbnet * blacklisting functionality. Which, if required, can be
@@ -1417,10 +1410,14 @@ static int qmi_wwan_probe(struct usb_interface *intf,* we need to match on class/subclass/protocol. These values are * identical for the diagnostic- and QMI-interface, but bNumEndpoints is * different. Ignore the current interface if the number of endpoints -* the number for the diag interface (two). +* equals the number for the diag interface (two). */ -if (quectel_diag_detected (intf)) -return -ENODEV ; + info = (void *)&id->driver_info; + +if (info->data &QMI_WWAN_QUIRK_QUECTEL_DYNCFG ) { +if (desc->bNumEndpoints ==2 ) +return -ENODEV ; + }return usbnet_probe (intf, id); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 215/346 drm/pl111: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit bc29d3a69d4c1bd1a103e8b3c1ed81b807c1870b ]
The call to of_find_matching_node_and_match returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
drivers/gpu/drm/pl111/pl111_versatile.c:333:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:340:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:346:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:354:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:395:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:402:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function.
--- drivers/gpu/drm/pl111/pl111_versatile.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/pl111/pl111_versatile.c +4 -0
@@ -330,6 +330,7 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) ret =vexpress_muxfpga_init ();if (ret) {dev_err (dev,"unable to initialize muxfpga driver\n" ); +of_node_put (np);return ret; }
@@ -337,17 +338,20 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) pdev =of_find_device_by_node (np);if (!pdev) {dev_err (dev,"can't find the sysreg device, deferring\n" ); +of_node_put (np);return -EPROBE_DEFER ; } map =dev_get_drvdata (&pdev->dev);if (!map) {dev_err (dev,"sysreg has not yet probed\n" );platform_device_put (pdev); +of_node_put (np);return -EPROBE_DEFER ; } }else { map =syscon_node_to_regmap (np); } +of_node_put (np);if (IS_ERR (map)) {dev_err (dev,"no Versatile syscon regmap\n" );
Signature · 8 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Greg Kroah-Hartman
maintainerPATCH 235/346 drm/panel: otm8009a: Add delay at the end of initialization
In reply to Greg Kroah-Hartman[ Upstream commit 0084c3c71126fc878c6dab8a6ab8ecc484c2be02 ]
At the end of initialization, a delay is required by the panel. Without this delay, the panel could received a frame early & generate a crash of panel (black screen).
--- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +3 -0
@@ -248,6 +248,9 @@ static int otm8009a_init_sequence(struct otm8009a *ctx)/* Send Command GRAM memory write (no parameters) */ dcs_write_seq (ctx,MIPI_DCS_WRITE_MEMORY_START ); +/* Wait a short while to let the panel be ready before the 1st frame */ +mdelay (10 ); +return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 246/346 sh: sh7786: Add explicit I/O cast to sh7786_mm_sel()
In reply to Greg Kroah-Hartman[ Upstream commit 8440bb9b944c02222c7a840d406141ed42e945cd ]
When compile-testing on arm:
arch/sh/include/cpu-sh4/cpu/sh7786.h: In function ‘sh7786_mm_sel’:
arch/sh/include/cpu-sh4/cpu/sh7786.h:135:21: warning: passing argument 1 of ‘__raw_readl’ makes pointer from integer without a cast [-Wint-conversion]
return __raw_readl(0xFC400020) & 0x7;
^~~~~~~~~~
In file included from include/linux/io.h:25:0,
from arch/sh/include/cpu-sh4/cpu/sh7786.h:14,
from drivers/pinctrl/sh-pfc/pfc-sh7786.c:15:
arch/arm/include/asm/io.h:113:21: note: expected ‘const volatile void *’ but argument is of type ‘unsigned int’
#define __raw_readl __raw_readl
^
arch/arm/include/asm/io.h:114:19: note: in expansion of macro ‘__raw_readl’
static inline u32 __raw_readl(const volatile void __iomem *addr)
^~~~~~~~~~~__raw_readl() on SuperH is a macro that casts the passed I/O address to the correct type, while the implementations on most other architectures expect to be passed the correct pointer type.
Add an explicit cast to fix this.
Note that this also gets rid of a sparse warning on SuperH:
arch/sh/include/cpu-sh4/cpu/sh7786.h:135:16: warning: incorrect type in argument 1 (different base types)
arch/sh/include/cpu-sh4/cpu/sh7786.h:135:16: expected void const volatile [noderef] <asn:2>*<noident>
arch/sh/include/cpu-sh4/cpu/sh7786.h:135:16: got unsigned int--- arch/sh/include/cpu-sh4/cpu/sh7786.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/include/cpu-sh4/cpu/sh7786.h +1 -1
@@ -132,7 +132,7 @@ enum {static inline u32 sh7786_mm_sel (void ) { -return __raw_readl (0xFC400020 ) &0x7 ; +return __raw_readl ((const volatile void __iomem *)0xFC400020 ) &0x7 ; }#endif /* __CPU_SH7786_H__ */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 248/346 ASoC: eukrea-tlv320: fix a leaked reference by adding missing of_node_put
In reply to Greg Kroah-Hartman[ Upstream commit b820d52e7eed7b30b2dfef5f4213a2bc3cbea6f3 ]
The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./sound/soc/fsl/eukrea-tlv320.c:121:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 102, but without a correspo nding object release within this function.
./sound/soc/fsl/eukrea-tlv320.c:127:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 102, but without a correspo nding object release within this function.
--- sound/soc/fsl/eukrea-tlv320.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/fsl/eukrea-tlv320.c +2 -2
@@ -118,13 +118,13 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)if (ret) {dev_err (&pdev->dev,"fsl,mux-int-port node missing or invalid.\n" ); -return ret; + goto err; } ret =of_property_read_u32 (np,"fsl,mux-ext-port" , &ext_port);if (ret) {dev_err (&pdev->dev,"fsl,mux-ext-port node missing or invalid.\n" ); -return ret; + goto err; }/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 249/346 ASoC: fsl_utils: fix a leaked reference by adding missing of_node_put
In reply to Greg Kroah-Hartman[ Upstream commit c705247136a523488eac806bd357c3e5d79a7acd ]
The call to of_parse_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./sound/soc/fsl/fsl_utils.c:74:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 38, but without a corresponding object release within this function.
--- sound/soc/fsl/fsl_utils.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/fsl_utils.c +1 -0
@@ -71,6 +71,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, iprop =of_get_property (dma_np,"cell-index" ,NULL );if (!iprop) {of_node_put (dma_np); +of_node_put (dma_channel_np);return -EINVAL ; } *dma_id =be32_to_cpup (iprop);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 237/346 arm64: cpu_ops: fix a leaked reference by adding missing of_node_put
In reply to Greg Kroah-Hartman[ Upstream commit 92606ec9285fb84cd9b5943df23f07d741384bfc ]
The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./arch/arm64/kernel/cpu_ops.c:102:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 69, but without a corresponding object release within this function.
--- arch/arm64/kernel/cpu_ops.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/cpu_ops.c +1 -0
@@ -85,6 +85,7 @@ static const char *__init cpu_read_enable_method(int cpu)pr_err ("%pOF: missing enable-method property\n" , dn); } +of_node_put (dn); }else { enable_method =acpi_get_enable_method (cpu);if (!enable_method) {
Signature · 9 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 252/346 block: pass page to xen_biovec_phys_mergeable
In reply to Greg Kroah-Hartman[ Upstream commit 0383ad4374f7ad7edd925a2ee4753035c3f5508a ]
xen_biovec_phys_mergeable() only needs .bv_page of the 2nd bio bvec for checking if the two bvecs can be merged, so pass page to xen_biovec_phys_mergeable() directly.
No function change.
--- block/blk.h | 2 +- drivers/xen/biomerge.c | 5 +++-- include/xen/xen.h | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-)
block/blk.h +1 -1
@@ -75,7 +75,7 @@ static inline bool biovec_phys_mergeable(struct request_queue *q,if (addr1 + vec1->bv_len != addr2)return false; -if (xen_domain () && !xen_biovec_phys_mergeable (vec1, vec2)) +if (xen_domain () && !xen_biovec_phys_mergeable (vec1, vec2->bv_page))return false;if ((addr1 | mask) != ((addr2 + vec2->bv_len -1 ) | mask))return false;
drivers/xen/biomerge.c +3 -2
@@ -4,12 +4,13 @@#include <xen/xen.h> #include <xen/page.h> +/* check if @page can be merged with 'vec1' */ bool xen_biovec_phys_mergeable (const struct bio_vec *vec1, -const struct bio_vec *vec2) +const struct page *page) {#if XEN_PAGE_SIZE ==PAGE_SIZE unsigned long bfn1 =pfn_to_bfn (page_to_pfn (vec1->bv_page)); -unsigned long bfn2 =pfn_to_bfn (page_to_pfn (vec2->bv_page)); +unsigned long bfn2 =pfn_to_bfn (page_to_pfn (page));return bfn1 +PFN_DOWN (vec1->bv_offset + vec1->bv_len) == bfn2;#else
include/xen/xen.h +3 -1
@@ -43,7 +43,9 @@ extern struct hvm_start_info pvh_start_info;#endif /* CONFIG_XEN_DOM0 */ struct bio_vec ; +struct page ; +bool xen_biovec_phys_mergeable (const struct bio_vec *vec1, -const struct bio_vec *vec2); +const struct page *page);#endif /* _XEN_XEN_H */
Signature · 9 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Greg Kroah-Hartman
maintainerPATCH 255/346 spi: tegra114: reset controller on probe
In reply to Greg Kroah-Hartman[ Upstream commit 019194933339b3e9b486639c8cb3692020844d65 ]
Fixes: SPI driver can be built as module so perform SPI controller reset on probe to make sure it is in valid state before initiating transfer.
--- drivers/spi/spi-tegra114.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
drivers/spi/spi-tegra114.c +18 -14
@@ -1067,27 +1067,19 @@ static int tegra_spi_probe(struct platform_device *pdev) spi_irq =platform_get_irq (pdev,0 ); tspi->irq = spi_irq; - ret =request_threaded_irq (tspi->irq, tegra_spi_isr, - tegra_spi_isr_thread,IRQF_ONESHOT , -dev_name (&pdev->dev), tspi); -if (ret <0 ) { -dev_err (&pdev->dev,"Failed to register ISR for IRQ %d\n" , - tspi->irq); - goto exit_free_master; - } tspi->clk =devm_clk_get (&pdev->dev,"spi" );if (IS_ERR (tspi->clk)) {dev_err (&pdev->dev,"can not get clock\n" ); ret =PTR_ERR (tspi->clk); - goto exit_free_irq; + goto exit_free_master; } tspi->rst =devm_reset_control_get_exclusive (&pdev->dev,"spi" );if (IS_ERR (tspi->rst)) {dev_err (&pdev->dev,"can not get reset\n" ); ret =PTR_ERR (tspi->rst); - goto exit_free_irq; + goto exit_free_master; } tspi->max_buf_size =SPI_FIFO_DEPTH <<2 ;
@@ -1095,7 +1087,7 @@ static int tegra_spi_probe(struct platform_device *pdev) ret =tegra_spi_init_dma_param (tspi, true);if (ret <0 ) - goto exit_free_irq; + goto exit_free_master; ret =tegra_spi_init_dma_param (tspi, false);if (ret <0 ) goto exit_rx_dma_free;
@@ -1117,18 +1109,32 @@ static int tegra_spi_probe(struct platform_device *pdev)dev_err (&pdev->dev,"pm runtime get failed, e = %d\n" , ret); goto exit_pm_disable; } + +reset_control_assert (tspi->rst); +udelay (2 ); +reset_control_deassert (tspi->rst); tspi->def_command1_reg =SPI_M_S ;tegra_spi_writel (tspi, tspi->def_command1_reg,SPI_COMMAND1 );pm_runtime_put (&pdev->dev); + ret =request_threaded_irq (tspi->irq, tegra_spi_isr, + tegra_spi_isr_thread,IRQF_ONESHOT , +dev_name (&pdev->dev), tspi); +if (ret <0 ) { +dev_err (&pdev->dev,"Failed to register ISR for IRQ %d\n" , + tspi->irq); + goto exit_pm_disable; + } master->dev.of_node = pdev->dev.of_node; ret =devm_spi_register_master (&pdev->dev, master);if (ret <0 ) {dev_err (&pdev->dev,"can not register to master err %d\n" , ret); - goto exit_pm_disable; + goto exit_free_irq; }return ret; +exit_free_irq: +free_irq (spi_irq, tspi); exit_pm_disable:pm_runtime_disable (&pdev->dev);if (!pm_runtime_status_suspended (&pdev->dev))
@@ -1136,8 +1142,6 @@ static int tegra_spi_probe(struct platform_device *pdev)tegra_spi_deinit_dma_param (tspi, false); exit_rx_dma_free:tegra_spi_deinit_dma_param (tspi, true); -exit_free_irq: -free_irq (spi_irq, tspi); exit_free_master:spi_master_put (master);return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 273/346 rcuperf: Fix cleanup path for invalid perf_type strings
In reply to Greg Kroah-Hartman[ Upstream commit ad092c027713a68a34168942a5ef422e42e039f4 ]
If the specified rcuperf.perf_type is not in the rcu_perf_init() function's perf_ops[] array, rcuperf prints some console messages and then invokes rcu_perf_cleanup() to set state so that a future torture test can run. However, rcu_perf_cleanup() also attempts to end the test that didn't actually start, and in doing so relies on the value of cur_ops, a value that is not particularly relevant in this case. This can result in confusing output or even follow-on failures due to attempts to use facilities that have not been properly initialized.
This commit therefore sets the value of cur_ops to NULL in this case and inserts a check near the beginning of rcu_perf_cleanup(), thus avoiding relying on an irrelevant cur_ops value.
--- kernel/rcu/rcuperf.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/rcu/rcuperf.c +5 -0
@@ -501,6 +501,10 @@ rcu_perf_cleanup(void)if (torture_cleanup_begin ())return ; +if (!cur_ops) { +torture_cleanup_end (); +return ; + }if (reader_tasks) {for (i =0 ; i < nrealreaders; i++)
@@ -621,6 +625,7 @@ rcu_perf_init(void)pr_cont ("\n" );WARN_ON (!IS_MODULE (CONFIG_RCU_PERF_TEST )); firsterr = -EINVAL ; + cur_ops =NULL ; goto unwind; }if (cur_ops->init)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 210/346 cpufreq: imx6q: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit ddb64c5db3cc8fb9c1242214d5798b2c2865681c ]
The call to of_node_get returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/cpufreq/imx6q-cpufreq.c:391:4-10: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 348, but without a corresponding object release within this function. ./drivers/cpufreq/imx6q-cpufreq.c:395:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 348, but without a corresponding object release within this function.
--- drivers/cpufreq/imx6q-cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +2 -2
@@ -407,11 +407,11 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) ret =imx6ul_opp_check_speed_grading (cpu_dev);if (ret) {if (ret == -EPROBE_DEFER ) -return ret; + goto put_node;dev_err (cpu_dev,"failed to read ocotp: %d\n" , ret); -return ret; + goto put_node; } }else {imx6q_opp_check_speed_grading (cpu_dev);
Signature · 9 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 297/346 media: si2165: fix a missing check of return value
In reply to Greg Kroah-Hartman[ Upstream commit 0ab34a08812a3334350dbaf69a018ee0ab3d2ddd ]
si2165_readreg8() may fail. Looking into si2165_readreg8(), we will find that "val_tmp" will be an uninitialized value when regmap_read() fails. "val_tmp" is then assigned to "val". So if si2165_readreg8() fails, "val" will be a random value. Further use will lead to undefined behaviors. The fix checks if si2165_readreg8() fails, and if so, returns its error code upstream.
--- drivers/media/dvb-frontends/si2165.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/si2165.c +5 -3
@@ -275,18 +275,20 @@ static u32 si2165_get_fe_clk(struct si2165_state *state)static int si2165_wait_init_done (struct si2165_state *state) { -int ret = -EINVAL ; +int ret;u8 val =0 ;int i;for (i =0 ; i <3 ; ++i) { -si2165_readreg8 (state,REG_INIT_DONE , &val); + ret =si2165_readreg8 (state,REG_INIT_DONE , &val); +if (ret <0 ) +return ret;if (val ==0x01 )return 0 ;usleep_range (1000 ,50000 ); }dev_err (&state->client->dev,"init_done was not set\n" ); -return ret; +return -EINVAL ; } static int si2165_upload_firmware_block(struct si2165_state *state,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 261/346 thunderbolt: property: Fix a missing check of kzalloc
In reply to Greg Kroah-Hartman[ Upstream commit 6183d5a51866f3acdeeb66b75e87d44025b01a55 ]
No check is enforced for the return value of kzalloc, which may lead to NULL-pointer dereference.
The patch fixes this issue.
--- drivers/thunderbolt/property.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/thunderbolt/property.c +6 -1
@@ -578,7 +578,12 @@ int tb_property_add_text(struct tb_property_dir *parent, const char *key,return -ENOMEM ; property->length = size /4 ; - property->value.data =kzalloc (size,GFP_KERNEL ); + property->value.text =kzalloc (size,GFP_KERNEL ); +if (!property->value.text) { +kfree (property); +return -ENOMEM ; + } +strcpy (property->value.text, text);list_add_tail (&property->list, &parent->properties);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/346 brcmfmac: add subtype check for event handling in data path
In reply to Greg Kroah-HartmanFrom: Arend van Spriel <[email protected]>
commit a4176ec356c73a46c07c181c6d04039fafa34a9f upstream.
For USB there is no separate channel being used to pass events from firmware to the host driver and as such are passed over the data path. In order to detect mock event messages an additional check is needed on event subtype. This check is added conditionally using unlikely() keyword.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 ++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h | 16 ++++++++++---- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 - 3 files changed, 16 insertions(+), 7 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +3 -2
@@ -464,7 +464,8 @@ void brcmf_rx_frame(struct device *dev, }else {/* Process special event packets */ if (handle_event) -brcmf_fweh_process_skb (ifp->drvr, skb); +brcmf_fweh_process_skb (ifp->drvr, skb, +BCMILCP_SUBTYPE_VENDOR_LONG );brcmf_netif_rx (ifp, skb); }
@@ -481,7 +482,7 @@ void brcmf_rx_event(struct device *dev,if (brcmf_rx_hdrpull (drvr, skb, &ifp))return ; -brcmf_fweh_process_skb (ifp->drvr, skb); +brcmf_fweh_process_skb (ifp->drvr, skb,0 );brcmu_pkt_buf_free_skb (skb); }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h +12 -4
@@ -211,7 +211,7 @@ enum brcmf_fweh_event_code {*/ #define BRCM_OUI "\x00\x10\x18"#define BCMILCP_BCM_SUBTYPE_EVENT 1 - +#define BCMILCP_SUBTYPE_VENDOR_LONG 32769/** * struct brcm_ethhdr - broadcom specific ether header.
@@ -334,10 +334,10 @@ void brcmf_fweh_process_event(struct brcvoid brcmf_fweh_p2pdev_setup (struct brcmf_if *ifp,bool ongoing);static inline void brcmf_fweh_process_skb (struct brcmf_pub *drvr, -struct sk_buff *skb) +struct sk_buff *skb,u16 stype) {struct brcmf_event *event_packet; -u16 usr_stype; +u16 subtype, usr_stype;/* only process events when protocol matches */ if (skb->protocol !=cpu_to_be16 (ETH_P_LINK_CTL ))
@@ -346,8 +346,16 @@ static inline void brcmf_fweh_process_skif ((skb->len +ETH_HLEN ) <sizeof (*event_packet))return ; -/* check for BRCM oui match */ event_packet = (struct brcmf_event *)skb_mac_header (skb); + +/* check subtype if needed */ +if (unlikely (stype)) { + subtype =get_unaligned_be16 (&event_packet->hdr.subtype); +if (subtype != stype) +return ; + } + +/* check for BRCM oui match */ if (memcmp (BRCM_OUI , &event_packet->hdr.oui[0 ],sizeof (event_packet->hdr.oui)))return ;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +1 -1
@@ -1116,7 +1116,7 @@ static void brcmf_msgbuf_process_event(s skb->protocol =eth_type_trans (skb, ifp->ndev); -brcmf_fweh_process_skb (ifp->drvr, skb); +brcmf_fweh_process_skb (ifp->drvr, skb,0 ); exit:brcmu_pkt_buf_free_skb (skb);
Greg Kroah-Hartman
maintainerPATCH 30/346 fbdev: fix WARNING in __alloc_pages_nodemask bug
In reply to Greg Kroah-HartmanFrom: Jiufei Xue <[email protected]>
commit 8c40292be9169a9cbe19aadd1a6fc60cbd1af82f upstream.
Syzkaller hit 'WARNING in __alloc_pages_nodemask' bug.
WARNING: CPU: 1 PID: 1473 at mm/page_alloc.c:4377 __alloc_pages_nodemask+0x4da/0x2130 Kernel panic - not syncing: panic_on_warn set ... Call Trace: alloc_pages_current+0xb1/0x1e0 kmalloc_order+0x1f/0x60 kmalloc_order_trace+0x1d/0x120 fb_alloc_cmap_gfp+0x85/0x2b0 fb_set_user_cmap+0xff/0x370 do_fb_ioctl+0x949/0xa20 fb_ioctl+0xdd/0x120 do_vfs_ioctl+0x186/0x1070 ksys_ioctl+0x89/0xa0 __x64_sys_ioctl+0x74/0xb0 do_syscall_64+0xc8/0x550 entry_SYSCALL_64_after_hwframe+0x49/0xbe
This is a warning about order >= MAX_ORDER and the order is from userspace ioctl. Add flag __NOWARN to silence this warning.
--- drivers/video/fbdev/core/fbcmap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/video/fbdev/core/fbcmap.c +2 -0
@@ -94,6 +94,8 @@ int fb_alloc_cmap_gfp(struct fb_cmap *cmint size = len *sizeof (u16);int ret = -ENOMEM ; + flags |= __GFP_NOWARN; +if (cmap->len != len) {fb_dealloc_cmap (cmap);if (!len)
Greg Kroah-Hartman
maintainerPATCH 316/346 audit: fix a memleak caused by auditing load module
In reply to Greg Kroah-Hartman[ Upstream commit 95e0b46fcebd7dbf6850dee96046e4c4ddc7f69c ]
module.name will be allocated unconditionally when auditing load module, and audit_log_start() can fail with other reasons, or audit_log_exit maybe not called, caused module.name is not freed
so free module.name in audit_free_context and __audit_syscall_exit
unreferenced object 0xffff88af90837d20 (size 8):
comm "modprobe", pid 1036, jiffies 4294704867 (age 3069.138s) hex dump (first 8 bytes):
69 78 67 62 65 00 ff ff ixgbe...
backtrace:
[<0000000008da28fe>] __audit_log_kern_module+0x33/0x80
[<00000000c1491e61>] load_module+0x64f/0x3850
[<000000007fc9ae3f>] __do_sys_init_module+0x218/0x250
[<0000000000d4a478>] do_syscall_64+0x117/0x400
[<000000004924ded8>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[<000000007dc331dd>] 0xffffffffffffffff--- kernel/auditsc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
kernel/auditsc.c +9 -1
@@ -837,6 +837,13 @@ static inline void audit_proctitle_free(struct audit_context *context) context->proctitle.len =0 ; } +static inline void audit_free_module (struct audit_context *context) +{ +if (context->type ==AUDIT_KERN_MODULE ) { +kfree (context->module.name); + context->module.name =NULL ; + } +}static inline void audit_free_names (struct audit_context *context) {struct audit_names *n, *next;
@@ -920,6 +927,7 @@ int audit_alloc(struct task_struct *tsk)static inline void audit_free_context (struct audit_context *context) { +audit_free_module (context);audit_free_names (context);unroll_tree_refs (context,NULL ,0 );free_tree_refs (context);
@@ -1237,7 +1245,6 @@ static void show_special(struct audit_context *context, int *call_panic)audit_log_format (ab,"name=" );if (context->module.name) {audit_log_untrustedstring (ab, context->module.name); -kfree (context->module.name); }else audit_log_format (ab,"(null)" );
@@ -1574,6 +1581,7 @@ void __audit_syscall_exit(int success, long return_code) context->in_syscall =0 ; context->prio = context->state ==AUDIT_RECORD_CONTEXT ? ~0ULL :0 ; +audit_free_module (context);audit_free_names (context);unroll_tree_refs (context,NULL ,0 );audit_free_aux (context);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/346 media: serial_ir: Fix use-after-free in serial_ir_init_module
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit 56cd26b618855c9af48c8301aa6754ced8dd0beb upstream.
Syzkaller report this:
BUG: KASAN: use-after-free in sysfs_remove_file_ns+0x5f/0x70 fs/sysfs/file.c:468
Read of size 8 at addr ffff8881dc7ae030 by task syz-executor.0/6249
CPU: 1 PID: 6249 Comm: syz-executor.0 Not tainted 5.0.0-rc8+ #3
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xfa/0x1ce lib/dump_stack.c:113
print_address_description+0x65/0x270 mm/kasan/report.c:187
kasan_report+0x149/0x18d mm/kasan/report.c:317
? 0xffffffffc1728000
sysfs_remove_file_ns+0x5f/0x70 fs/sysfs/file.c:468
sysfs_remove_file include/linux/sysfs.h:519 [inline]
driver_remove_file+0x40/0x50 drivers/base/driver.c:122
remove_bind_files drivers/base/bus.c:585 [inline]
bus_remove_driver+0x186/0x220 drivers/base/bus.c:725
driver_unregister+0x6c/0xa0 drivers/base/driver.c:197
serial_ir_init_module+0x169/0x1000 [serial_ir]
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x462e99
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f9450132c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99
RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000003
RBP: 00007f9450132c70 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f94501336bc
R13: 00000000004bcefa R14: 00000000006f6fb0 R15: 0000000000000004
Allocated by task 6249:
set_track mm/kasan/common.c:85 [inline]
__kasan_kmalloc.constprop.3+0xa0/0xd0 mm/kasan/common.c:495
kmalloc include/linux/slab.h:545 [inline]
kzalloc include/linux/slab.h:740 [inline]
bus_add_driver+0xc0/0x610 drivers/base/bus.c:651
driver_register+0x1bb/0x3f0 drivers/base/driver.c:170
serial_ir_init_module+0xe8/0x1000 [serial_ir]
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 6249:
set_track mm/kasan/common.c:85 [inline]
__kasan_slab_free+0x130/0x180 mm/kasan/common.c:457
slab_free_hook mm/slub.c:1430 [inline]
slab_free_freelist_hook mm/slub.c:1457 [inline]
slab_free mm/slub.c:3005 [inline]
kfree+0xe1/0x270 mm/slub.c:3957
kobject_cleanup lib/kobject.c:662 [inline]
kobject_release lib/kobject.c:691 [inline]
kref_put include/linux/kref.h:67 [inline]
kobject_put+0x146/0x240 lib/kobject.c:708
bus_remove_driver+0x10e/0x220 drivers/base/bus.c:732
driver_unregister+0x6c/0xa0 drivers/base/driver.c:197
serial_ir_init_module+0x14c/0x1000 [serial_ir]
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
The buggy address belongs to the object at ffff8881dc7ae000
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 48 bytes inside of
256-byte region [ffff8881dc7ae000, ffff8881dc7ae100)
The buggy address belongs to the page:
page:ffffea000771eb80 count:1 mapcount:0 mapping:ffff8881f6c02e00 index:0x0
flags: 0x2fffc0000000200(slab)
raw: 02fffc0000000200 ffffea0007d14800 0000000400000002 ffff8881f6c02e00
raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8881dc7adf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8881dc7adf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881dc7ae000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881dc7ae080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881dc7ae100: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00There are already cleanup handlings in serial_ir_init error path, no need to call serial_ir_exit do it again in serial_ir_init_module, otherwise will trigger a use-after-free issue.
--- drivers/media/rc/serial_ir.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/media/rc/serial_ir.c +1 -8
@@ -773,8 +773,6 @@ static void serial_ir_exit(void)static int __init serial_ir_init_module (void ) { -int result; -switch (type) {case IR_HOMEBREW :case IR_IRDEO :
@@ -802,12 +800,7 @@ static int __init serial_ir_init_module(if (sense !=-1 ) sense = !!sense; - result =serial_ir_init (); -if (!result) -return 0 ; - -serial_ir_exit (); -return result; +return serial_ir_init (); } static void __exit serial_ir_exit_module(void)
Greg Kroah-Hartman
maintainerPATCH 34/346 media: vivid: use vfree() instead of kfree() for dev->bitmap_cap
In reply to Greg Kroah-HartmanFrom: Alexander Potapenko <[email protected]>
commit dad7e270ba712ba1c99cd2d91018af6044447a06 upstream.
syzkaller reported crashes on kfree() called from vivid_vid_cap_s_selection(). This looks like a simple typo, as dev->bitmap_cap is allocated with vzalloc() throughout the file.
parts")
--- drivers/media/platform/vivid/vivid-vid-cap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vivid/vivid-vid-cap.c +1 -1
@@ -1003,7 +1003,7 @@ int vivid_vid_cap_s_selection(struct filv4l2_rect_map_inside (&s->r, &dev->fmt_cap_rect);if (dev->bitmap_cap && (compose->width != s->r.width || compose->height != s->r.height)) { -kfree (dev->bitmap_cap); +vfree (dev->bitmap_cap); dev->bitmap_cap =NULL ; } *compose = s->r;
Greg Kroah-Hartman
maintainerPATCH 17/346 btrfs: dont double unlock on error in btrfs_punch_hole
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 8fca955057b9c58467d1b231e43f19c4cf26ae8c upstream.
If we have an error writing out a delalloc range in btrfs_punch_hole_lock_range we'll unlock the inode and then goto out_only_mutex, where we will again unlock the inode. This is bad, don't do this.
--- fs/btrfs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/file.c +1 -3
@@ -2546,10 +2546,8 @@ static int btrfs_punch_hole(struct inode ret =btrfs_punch_hole_lock_range (inode, lockstart, lockend, &cached_state); -if (ret) { -inode_unlock (inode); +if (ret) goto out_only_mutex; - } path =btrfs_alloc_path ();if (!path) {
Greg Kroah-Hartman
maintainerPATCH 334/346 regulator: da9062: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 978995def0f6030aa6b3b494682f673aca13881b ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/da9062-regulator.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/da9062-regulator.c +2 -0
@@ -974,8 +974,10 @@ static irqreturn_t da9062_ldo_lim_event(int irq, void *data)continue ;if (BIT (regl->info->oc_event.lsb) & bits) { +regulator_lock (regl->rdev);regulator_notifier_call_chain (regl->rdev,REGULATOR_EVENT_OVER_CURRENT ,NULL ); +regulator_unlock (regl->rdev); handled =IRQ_HANDLED ; } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 335/346 regulator: da9055: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 5e6afb3832bedf420dd8e4c5b32ed85117c5087d ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/da9055-regulator.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/da9055-regulator.c +2 -0
@@ -515,8 +515,10 @@ static irqreturn_t da9055_ldo5_6_oc_irq(int irq, void *data) {struct da9055_regulator *regulator = data; +regulator_lock (regulator->rdev);regulator_notifier_call_chain (regulator->rdev,REGULATOR_EVENT_OVER_CURRENT ,NULL ); +regulator_unlock (regulator->rdev);return IRQ_HANDLED ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/346 bpf: devmap: fix use-after-free Read in __dev_map_entry_free
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 2baae3545327632167c0180e9ca1d467416f1919 upstream.
synchronize_rcu() is fine when the rcu callbacks only need to free memory (kfree_rcu() or direct kfree() call rcu call backs)
__dev_map_entry_free() is a bit more complex, so we need to make sure that call queued __dev_map_entry_free() callbacks have completed.
sysbot report:
BUG: KASAN: use-after-free in dev_map_flush_old kernel/bpf/devmap.c:365 [inline] BUG: KASAN: use-after-free in __dev_map_entry_free+0x2a8/0x300 kernel/bpf/devmap.c:379 Read of size 8 at addr ffff8801b8da38c8 by task ksoftirqd/1/18 CPU: 1 PID: 18 Comm: ksoftirqd/1 Not tainted 4.17.0+ #39 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1b9/0x294 lib/dump_stack.c:113 print_address_description+0x6c/0x20b mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 dev_map_flush_old kernel/bpf/devmap.c:365 [inline] __dev_map_entry_free+0x2a8/0x300 kernel/bpf/devmap.c:379 __rcu_reclaim kernel/rcu/rcu.h:178 [inline] rcu_do_batch kernel/rcu/tree.c:2558 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2818 [inline] __rcu_process_callbacks kernel/rcu/tree.c:2785 [inline] rcu_process_callbacks+0xe9d/0x1760 kernel/rcu/tree.c:2802 __do_softirq+0x2e0/0xaf5 kernel/softirq.c:284 run_ksoftirqd+0x86/0x100 kernel/softirq.c:645 smpboot_thread_fn+0x417/0x870 kernel/smpboot.c:164 kthread+0x345/0x410 kernel/kthread.c:240 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412 Allocated by task 6675: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620 kmalloc include/linux/slab.h:513 [inline] kzalloc include/linux/slab.h:706 [inline] dev_map_alloc+0x208/0x7f0 kernel/bpf/devmap.c:102 find_and_alloc_map kernel/bpf/syscall.c:129 [inline] map_create+0x393/0x1010 kernel/bpf/syscall.c:453 __do_sys_bpf kernel/bpf/syscall.c:2351 [inline] __se_sys_bpf kernel/bpf/syscall.c:2328 [inline] __x64_sys_bpf+0x303/0x510 kernel/bpf/syscall.c:2328 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 26: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3498 [inline] kfree+0xd9/0x260 mm/slab.c:3813 dev_map_free+0x4fa/0x670 kernel/bpf/devmap.c:191 bpf_map_free_deferred+0xba/0xf0 kernel/bpf/syscall.c:262 process_one_work+0xc64/0x1b70 kernel/workqueue.c:2153 worker_thread+0x181/0x13a0 kernel/workqueue.c:2296 kthread+0x345/0x410 kernel/kthread.c:240 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412 The buggy address belongs to the object at ffff8801b8da37c0 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 264 bytes inside of 512-byte region [ffff8801b8da37c0, ffff8801b8da39c0) The buggy address belongs to the page: page:ffffea0006e368c0 count:1 mapcount:0 mapping:ffff8801da800940 index:0xffff8801b8da3540 flags: 0x2fffc0000000100(slab) raw: 02fffc0000000100 ffffea0007217b88 ffffea0006e30cc8 ffff8801da800940 raw: ffff8801b8da3540 ffff8801b8da3040 0000000100000004 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801b8da3780: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ffff8801b8da3800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
Quoted 1 line
ffff8801b8da3880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8801b8da3900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801b8da3980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
--- kernel/bpf/devmap.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/bpf/devmap.c +3 -0
@@ -164,6 +164,9 @@ static void dev_map_free(struct bpf_mapbpf_clear_redirect_map (map);synchronize_rcu (); +/* Make sure prior __dev_map_entry_free() have completed. */ +rcu_barrier (); +/* To ensure all pending flush operations have completed wait for flush * bitmap to indicate all flush_needed bits to be zero on _all_ cpus. * Because the above synchronize_rcu() ensures the map is disconnected
Greg Kroah-Hartman
maintainerPATCH 345/346 drm/sun4i: dsi: Enforce boundaries on the start delay
In reply to Greg Kroah-Hartman[ Upstream commit efa31801203ac2f5c6a82a28cb991c7163ee0f1d ]
The Allwinner BSP makes sure that we don't end up with a null start delay or with a delay larger than vtotal.
The former condition is likely to happen now with the reworked start delay, so make sure we enforce the same boundaries.
--- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +5 -1
@@ -358,8 +358,12 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) {u16 start =clamp (mode->vtotal - mode->vdisplay -10 ,8 ,100 ); +u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; -return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; +if (delay > mode->vtotal) + delay = delay % mode->vtotal; + +return max_t (u16, delay,1 ); } static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/346 at76c50x-usb: Dont register led_trigger if usb_register_driver failed
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit 09ac2694b0475f96be895848687ebcbba97eeecf upstream.
Syzkaller report this:
[ 1213.468581] BUG: unable to handle kernel paging request at fffffbfff83bf338 [ 1213.469530] #PF error: [normal kernel read fault] [ 1213.469530] PGD 237fe4067 P4D 237fe4067 PUD 237e60067 PMD 1c868b067 PTE 0 [ 1213.473514] Oops: 0000 [#1] SMP KASAN PTI [ 1213.473514] CPU: 0 PID: 6321 Comm: syz-executor.0 Tainted: G C 5.1.0-rc3+ #8 [ 1213.473514] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 [ 1213.473514] RIP: 0010:strcmp+0x31/0xa0 [ 1213.473514] Code: 00 00 00 00 fc ff df 55 53 48 83 ec 08 eb 0a 84 db 48 89 ef 74 5a 4c 89 e6 48 89 f8 48 89 fa 48 8d 6f 01 48 c1 e8 03 83 e2 07 <42> 0f b6 04 28 38 d0 7f 04 84 c0 75 50 48 89 f0 48 89 f2 0f b6 5d [ 1213.473514] RSP: 0018:ffff8881f2b7f950 EFLAGS: 00010246 [ 1213.473514] RAX: 1ffffffff83bf338 RBX: ffff8881ea6f7240 RCX: ffffffff825350c6 [ 1213.473514] RDX: 0000000000000000 RSI: ffffffffc1ee19c0 RDI: ffffffffc1df99c0 [ 1213.473514] RBP: ffffffffc1df99c1 R08: 0000000000000001 R09: 0000000000000004 [ 1213.473514] R10: 0000000000000000 R11: ffff8881de353f00 R12: ffff8881ee727900 [ 1213.473514] R13: dffffc0000000000 R14: 0000000000000001 R15: ffffffffc1eeaaf0 [ 1213.473514] FS: 00007fa66fa01700(0000) GS:ffff8881f7200000(0000) knlGS:0000000000000000 [ 1213.473514] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1213.473514] CR2: fffffbfff83bf338 CR3: 00000001ebb9e005 CR4: 00000000007606f0 [ 1213.473514] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1213.473514] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1213.473514] PKRU: 55555554 [ 1213.473514] Call Trace: [ 1213.473514] led_trigger_register+0x112/0x3f0 [ 1213.473514] led_trigger_register_simple+0x7a/0x110 [ 1213.473514] ? 0xffffffffc1c10000 [ 1213.473514] at76_mod_init+0x77/0x1000 [at76c50x_usb] [ 1213.473514] do_one_initcall+0xbc/0x47d [ 1213.473514] ? perf_trace_initcall_level+0x3a0/0x3a0 [ 1213.473514] ? kasan_unpoison_shadow+0x30/0x40 [ 1213.473514] ? kasan_unpoison_shadow+0x30/0x40 [ 1213.473514] do_init_module+0x1b5/0x547 [ 1213.473514] load_module+0x6405/0x8c10 [ 1213.473514] ? module_frob_arch_sections+0x20/0x20 [ 1213.473514] ? kernel_read_file+0x1e6/0x5d0 [ 1213.473514] ? find_held_lock+0x32/0x1c0 [ 1213.473514] ? cap_capable+0x1ae/0x210 [ 1213.473514] ? __do_sys_finit_module+0x162/0x190 [ 1213.473514] __do_sys_finit_module+0x162/0x190 [ 1213.473514] ? __ia32_sys_init_module+0xa0/0xa0 [ 1213.473514] ? __mutex_unlock_slowpath+0xdc/0x690 [ 1213.473514] ? wait_for_completion+0x370/0x370 [ 1213.473514] ? vfs_write+0x204/0x4a0 [ 1213.473514] ? do_syscall_64+0x18/0x450 [ 1213.473514] do_syscall_64+0x9f/0x450 [ 1213.473514] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 1213.473514] RIP: 0033:0x462e99 [ 1213.473514] Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 [ 1213.473514] RSP: 002b:00007fa66fa00c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 1213.473514] RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 [ 1213.473514] RDX: 0000000000000000 RSI: 0000000020000300 RDI: 0000000000000003 [ 1213.473514] RBP: 00007fa66fa00c70 R08: 0000000000000000 R09: 0000000000000000 [ 1213.473514] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fa66fa016bc [ 1213.473514] R13: 00000000004bcefa R14: 00000000006f6fb0 R15: 0000000000000004
If usb_register failed, no need to call led_trigger_register_simple.
--- drivers/net/wireless/atmel/at76c50x-usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/atmel/at76c50x-usb.c +2 -2
@@ -2585,8 +2585,8 @@ static int __init at76_mod_init(void)if (result <0 ) printk(KERN_ERR DRIVER_NAME": usb_register failed (status %d)\n" , result); - -led_trigger_register_simple ("at76_usb-tx" , &ledtrig_tx); +else +led_trigger_register_simple ("at76_usb-tx" , &ledtrig_tx);return result; }
Greg Kroah-Hartman
maintainerPATCH 47/346 IB/hfi1: Fix WQ_MEM_RECLAIM warning
In reply to Greg Kroah-Hartman[ Upstream commit 4c4b1996b5db688e2dcb8242b0a3bf7b1e845e42 ]
The work_item cancels that occur when a QP is destroyed can elicit the following trace:
workqueue: WQ_MEM_RECLAIM ipoib_wq:ipoib_cm_tx_reap [ib_ipoib] is flushing !WQ_MEM_RECLAIM hfi0_0:_hfi1_do_send [hfi1]
WARNING: CPU: 7 PID: 1403 at kernel/workqueue.c:2486 check_flush_dependency+0xb1/0x100 Call Trace: __flush_work.isra.29+0x8c/0x1a0 ? __switch_to_asm+0x40/0x70 __cancel_work_timer+0x103/0x190 ? schedule+0x32/0x80 iowait_cancel_work+0x15/0x30 [hfi1] rvt_reset_qp+0x1f8/0x3e0 [rdmavt] rvt_destroy_qp+0x65/0x1f0 [rdmavt] ? _cond_resched+0x15/0x30 ib_destroy_qp+0xe9/0x230 [ib_core] ipoib_cm_tx_reap+0x21c/0x560 [ib_ipoib] process_one_work+0x171/0x370 worker_thread+0x49/0x3f0 kthread+0xf8/0x130 ? max_active_store+0x80/0x80 ? kthread_bind+0x10/0x10 ret_from_fork+0x35/0x40
Since QP destruction frees memory, hfi1_wq should have the WQ_MEM_RECLAIM.
The hfi1_wq does not allocate memory with GFP_KERNEL or otherwise become entangled with memory reclaim, so this flag is appropriate.
--- drivers/infiniband/hw/hfi1/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/init.c +2 -1
@@ -797,7 +797,8 @@ static int create_workqueues(struct hfi1_devdata *dd) ppd->hfi1_wq =alloc_workqueue ("hfi%d_%d" , -WQ_SYSFS |WQ_HIGHPRI |WQ_CPU_INTENSIVE , +WQ_SYSFS |WQ_HIGHPRI |WQ_CPU_INTENSIVE | +WQ_MEM_RECLAIM ,HFI1_MAX_ACTIVE_WORKQUEUE_ENTRIES , dd->unit, pidx);if (!ppd->hfi1_wq)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/346 mmc: core: Verify SD bus width
In reply to Greg Kroah-Hartman[ Upstream commit 9e4be8d03f50d1b25c38e2b59e73b194c130df7d ]
The SD Physical Layer Spec says the following: Since the SD Memory Card shall support at least the two bus modes 1-bit or 4-bit width, then any SD Card shall set at least bits 0 and 2 (SD_BUS_WIDTH="0101").
This change verifies the card has specified a bus width.
AMD SDHC Device 7806 can get into a bad state after a card disconnect where anything transferred via the DATA lines will always result in a zero filled buffer. Currently the driver will continue without error if the HC is in this condition. A block device will be created, but reading from it will result in a zero buffer. This makes it seem like the SD device has been erased, when in actuality the data is never getting copied from the DATA lines to the data buffer.
SCR is the first command in the SD initialization sequence that uses the DATA lines. By checking that the response was invalid, we can abort mounting the card.
--- drivers/mmc/core/sd.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mmc/core/sd.c +8 -0
@@ -216,6 +216,14 @@ static int mmc_decode_scr(struct mmc_card *card)if (scr->sda_spec3) scr->cmds =UNSTUFF_BITS (resp,32 ,2 ); + +/* SD Spec says: any SD Card shall set at least bits 0 and 2 */ +if (!(scr->bus_widths &SD_SCR_BUS_WIDTH_1 ) || + !(scr->bus_widths &SD_SCR_BUS_WIDTH_4 )) { +pr_err ("%s: invalid bus width\n" ,mmc_hostname (card->host)); +return -EINVAL ; + } +return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 50/346 tools/bpf: fix perf build error with uClibc (seen on ARC)
In reply to Greg Kroah-Hartman[ Upstream commit ca31ca8247e2d3807ff5fa1d1760616a2292001c ]
When build perf for ARC recently, there was a build failure due to lack of __NR_bpf.
| Auto-detecting system features:
|
| ... get_cpuid: [ OFF ]
| ... bpf: [ on ]
|
| # error __NR_bpf not defined. libbpf does not support your arch.
^~~~~
| bpf.c: In function 'sys_bpf':
| bpf.c:66:17: error: '__NR_bpf' undeclared (first use in this function)
| return syscall(__NR_bpf, cmd, attr, size);
| ^~~~~~~~
| sys_bpf--- tools/lib/bpf/bpf.c | 2 ++ 1 file changed, 2 insertions(+)
tools/lib/bpf/bpf.c +2 -0
@@ -45,6 +45,8 @@# define __NR_bpf 349# elif defined(__s390__)# define __NR_bpf 351 +# elif defined(__arc__) +# define __NR_bpf 280# else # error __NR_bpf not defined. libbpf does not support your arch.# endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 63/346 usb: dwc2: gadget: Increase descriptors count for ISOCs
In reply to Greg Kroah-Hartman[ Upstream commit 54f37f56631747075f1f9a2f0edf6ba405e3e66c ]
Some function drivers queueing more than 128 ISOC requests at a time. To avoid "descriptor chain full" cases, increasing descriptors count from MAX_DMA_DESC_NUM_GENERIC to MAX_DMA_DESC_NUM_HS_ISOC for ISOC's only.
--- drivers/usb/dwc2/gadget.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/usb/dwc2/gadget.c +15 -12
@@ -714,13 +714,11 @@ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep)unsigned int maxsize;if (is_isoc) - maxsize = hs_ep->dir_in ?DEV_DMA_ISOC_TX_NBYTES_LIMIT : -DEV_DMA_ISOC_RX_NBYTES_LIMIT ; + maxsize = (hs_ep->dir_in ?DEV_DMA_ISOC_TX_NBYTES_LIMIT : +DEV_DMA_ISOC_RX_NBYTES_LIMIT ) * +MAX_DMA_DESC_NUM_HS_ISOC ;else - maxsize =DEV_DMA_NBYTES_LIMIT ; - -/* Above size of one descriptor was chosen, multiple it */ - maxsize *=MAX_DMA_DESC_NUM_GENERIC ; + maxsize =DEV_DMA_NBYTES_LIMIT *MAX_DMA_DESC_NUM_GENERIC ;return maxsize; }
@@ -903,7 +901,7 @@ static int dwc2_gadget_fill_isoc_desc(struct dwc2_hsotg_ep *hs_ep,/* Update index of last configured entry in the chain */ hs_ep->next_desc++; -if (hs_ep->next_desc >=MAX_DMA_DESC_NUM_GENERIC ) +if (hs_ep->next_desc >=MAX_DMA_DESC_NUM_HS_ISOC ) hs_ep->next_desc =0 ;return 0 ;
@@ -935,7 +933,7 @@ static void dwc2_gadget_start_isoc_ddma(struct dwc2_hsotg_ep *hs_ep) }/* Initialize descriptor chain by Host Busy status */ -for (i =0 ; i <MAX_DMA_DESC_NUM_GENERIC ; i++) { +for (i =0 ; i <MAX_DMA_DESC_NUM_HS_ISOC ; i++) { desc = &hs_ep->desc_list[i]; desc->status =0 ; desc->status |= (DEV_DMA_BUFF_STS_HBUSY
@@ -2122,7 +2120,7 @@ static void dwc2_gadget_complete_isoc_request_ddma(struct dwc2_hsotg_ep *hs_ep)dwc2_hsotg_complete_request (hsotg, hs_ep, hs_req,0 ); hs_ep->compl_desc++; -if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_GENERIC -1 )) +if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_HS_ISOC -1 )) hs_ep->compl_desc =0 ; desc_sts = hs_ep->desc_list[hs_ep->compl_desc].status; }
@@ -3859,6 +3857,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,unsigned int i, val, size;int ret =0 ;unsigned char ep_type; +int desc_num; dev_dbg(hsotg->dev, "%s: ep %s: a 0x%02x, attr 0x%02x, mps 0x%04x, intr %d\n",
@@ -3905,11 +3904,15 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,dev_dbg (hsotg->dev,"%s: read DxEPCTL=0x%08x from 0x%08x\n" , __func__, epctrl, epctrl_reg); +if (using_desc_dma (hsotg) && ep_type ==USB_ENDPOINT_XFER_ISOC ) + desc_num =MAX_DMA_DESC_NUM_HS_ISOC ; +else + desc_num =MAX_DMA_DESC_NUM_GENERIC ; +/* Allocate DMA descriptor chain for non-ctrl endpoints */ if (using_desc_dma (hsotg) && !hs_ep->desc_list) { hs_ep->desc_list =dmam_alloc_coherent (hsotg->dev, -MAX_DMA_DESC_NUM_GENERIC * -sizeof (struct dwc2_dma_desc ), + desc_num *sizeof (struct dwc2_dma_desc ), &hs_ep->desc_list_dma,GFP_ATOMIC );if (!hs_ep->desc_list) { ret = -ENOMEM ;
@@ -4051,7 +4054,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, error2:if (ret &&using_desc_dma (hsotg) && hs_ep->desc_list) { -dmam_free_coherent (hsotg->dev,MAX_DMA_DESC_NUM_GENERIC * +dmam_free_coherent (hsotg->dev, desc_num *sizeof (struct dwc2_dma_desc ), hs_ep->desc_list, hs_ep->desc_list_dma); hs_ep->desc_list =NULL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 75/346 drm/nouveau/bar/nv50: ensure BAR is mapped
In reply to Greg Kroah-Hartman[ Upstream commit f10b83de1fd49216a4c657816f48001437e4bdd5 ]
If the BAR is zero size, it indicates it was never successfully mapped. Ensure that the BAR is valid during initialization before attempting to use it.
--- drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c +9 -3
@@ -109,7 +109,7 @@ nv50_bar_oneinit(struct nvkm_bar *base)struct nvkm_device *device = bar->base.subdev.device;static struct lock_class_key bar1_lock;static struct lock_class_key bar2_lock; -u64 start, limit; +u64 start, limit, size;int ret; ret =nvkm_gpuobj_new (device,0x20000 ,0 , false,NULL , &bar->mem);
@@ -127,7 +127,10 @@ nv50_bar_oneinit(struct nvkm_bar *base)/* BAR2 */ start =0x0100000000ULL ; - limit = start + device->func->resource_size (device,3 ); + size = device->func->resource_size (device,3 ); +if (!size) +return -ENOMEM ; + limit = start + size; ret =nvkm_vmm_new (device, start, limit-- - start,NULL ,0 , &bar2_lock,"bar2" , &bar->bar2_vmm);
@@ -164,7 +167,10 @@ nv50_bar_oneinit(struct nvkm_bar *base)/* BAR1 */ start =0x0000000000ULL ; - limit = start + device->func->resource_size (device,1 ); + size = device->func->resource_size (device,1 ); +if (!size) +return -ENOMEM ; + limit = start + size; ret =nvkm_vmm_new (device, start, limit-- - start,NULL ,0 , &bar1_lock,"bar1" , &bar->bar1_vmm);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 95/346 ALSA: hda: fix unregister device twice on ASoC driver
In reply to Greg Kroah-Hartman[ Upstream commit 4d95c51776b2edb4d4ebcea00b6e5a1fe538ce66 ]
snd_hda_codec_device_new() is used by both legacy HDA and ASoC driver. However, we will call snd_hdac_device_unregister() in snd_hdac_ext_bus_device_remove() for ASoC device. This patch uses the type flag in hdac_device struct to determine is it a ASoC device or legacy HDA device and call snd_hdac_device_unregister() in snd_hda_codec_dev_free() only if it is a legacy HDA device.
--- sound/pci/hda/hda_codec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/hda/hda_codec.c +7 -1
@@ -841,7 +841,13 @@ static int snd_hda_codec_dev_free(struct snd_device *device)struct hda_codec *codec = device->device_data; codec->in_freeing =1 ; -snd_hdac_device_unregister (&codec->core); +/* +* snd_hda_codec_device_new() is used by legacy HDA and ASoC driver. +* We can't unregister ASoC device since it will be unregistered in +* snd_hdac_ext_bus_device_remove(). +*/ +if (codec->core.type ==HDA_DEV_LEGACY ) +snd_hdac_device_unregister (&codec->core);codec_display_power (codec, false);put_device (hda_codec_dev (codec));return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 101/346 s390: qeth: address type mismatch warning
In reply to Greg Kroah-Hartman[ Upstream commit 46b83629dede262315aa82179d105581f11763b6 ]
clang produces a harmless warning for each use for the qeth_adp_supported macro:
drivers/s390/net/qeth_l2_main.c:559:31: warning: implicit conversion from enumeration type 'enum qeth_ipa_setadp_cmd' to
different enumeration type 'enum qeth_ipa_funcs' [-Wenum-conversion]
if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE))
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/s390/net/qeth_core.h:179:41: note: expanded from macro 'qeth_adp_supported'
qeth_is_ipa_supported(&c->options.adp, f)
~~~~~~~~~~~~~~~~~~~~~ ^Add a version of this macro that uses the correct types, and remove the unused qeth_adp_enabled() macro that has the same problem.
--- drivers/s390/net/qeth_core.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/s390/net/qeth_core.h +7 -3
@@ -215,6 +215,12 @@ struct qeth_vnicc_info {bool rx_bcast_enabled; }; +static inline int qeth_is_adp_supported (struct qeth_ipa_info *ipa, +enum qeth_ipa_setadp_cmd func) +{ +return (ipa->supported_funcs & func); +} +static inline int qeth_is_ipa_supported (struct qeth_ipa_info *ipa,enum qeth_ipa_funcs func) {
@@ -228,9 +234,7 @@ static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, }#define qeth_adp_supported (c, f) \ - qeth_is_ipa_supported(&c->options.adp, f) -#define qeth_adp_enabled (c, f) \ - qeth_is_ipa_enabled(&c->options.adp, f) + qeth_is_adp_supported(&c->options.adp, f)#define qeth_is_supported (c, f) \ qeth_is_ipa_supported(&c->options.ipa4, f)#define qeth_is_enabled (c, f) \
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 71/346 ASoC: imx: fix fiq dependencies
In reply to Greg Kroah-Hartman[ Upstream commit ea751227c813ab833609afecfeedaf0aa26f327e ]
During randconfig builds, I occasionally run into an invalid configuration of the freescale FIQ sound support:
WARNING: unmet direct dependencies detected for SND_SOC_IMX_PCM_FIQ
Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_IMX_SOC [=m]
Selected by [y]:
- SND_SOC_FSL_SPDIF [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_IMX_SOC [=m]!=n && (MXC_TZIC [=n] || MXC_AVIC [=y])
sound/soc/fsl/imx-ssi.o: In function `imx_ssi_remove':
imx-ssi.c:(.text+0x28): undefined reference to imx_pcm_fiq_exit' sound/soc/fsl/imx-ssi.o: In function imx_ssi_probe':
imx-ssi.c:(.text+0xa64): undefined reference to `imx_pcm_fiq_init'
The Kconfig warning is a result of the symbol being defined inside of the "if SND_IMX_SOC" block, and is otherwise harmless. The link error is more tricky and happens with SND_SOC_IMX_SSI=y, which may or may not imply FIQ support. However, if SND_SOC_FSL_SSI is set to =m at the same time, that selects SND_SOC_IMX_PCM_FIQ as a loadable module dependency, which then causes a link failure from imx-ssi.
The solution here is to make SND_SOC_IMX_PCM_FIQ built-in whenever one of its potential users is built-in.
--- sound/soc/fsl/Kconfig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/fsl/Kconfig +5 -4
@@ -173,16 +173,17 @@ config SND_MPC52xx_SOC_EFIKA endif # SND_POWERPC_SOC +config SND_SOC_IMX_PCM_FIQ + tristate + default y if SND_SOC_IMX_SSI=y && (SND_SOC_FSL_SSI=m || SND_SOC_FSL_SPDIF=m) && (MXC_TZIC || MXC_AVIC) + select FIQ + if SND_IMX_SOC config SND_SOC_IMX_SSI tristate select SND_SOC_FSL_UTILS -config SND_SOC_IMX_PCM_FIQ - tristate - select FIQ - comment "SoC Audio support for Freescale i.MX boards:" config SND_MXC_SOC_WM1133_EV1
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 125/346 smpboot: Place the __percpu annotation correctly
In reply to Greg Kroah-Hartman[ Upstream commit d4645d30b50d1691c26ff0f8fa4e718b08f8d3bb ]
The test robot reported a wrong assignment of a per-CPU variable which it detected by using sparse and sent a report. The assignment itself is correct. The annotation for sparse was wrong and hence the report. The first pointer is a "normal" pointer and points to the per-CPU memory area. That means that the __percpu annotation has to be moved.
Move the __percpu annotation to pointer which points to the per-CPU area. This change affects only the sparse tool (and is ignored by the compiler).
--- include/linux/smpboot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/smpboot.h +1 -1
@@ -29,7 +29,7 @@ struct smpboot_thread_data;* @thread_comm: The base name of the thread */ struct smp_hotplug_thread { -struct task_struct __percpu **store; +struct task_struct *__percpu *store;struct list_head list;int (*thread_should_run)(unsigned int cpu);void (*thread_fn)(unsigned int cpu);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 111/346 net: cw1200: fix a NULL pointer dereference
In reply to Greg Kroah-Hartman[ Upstream commit 0ed2a005347400500a39ea7c7318f1fea57fb3ca ]
In case create_singlethread_workqueue fails, the fix free the hardware and returns NULL to avoid NULL pointer dereference.
--- drivers/net/wireless/st/cw1200/main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/st/cw1200/main.c +5 -0
@@ -345,6 +345,11 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,mutex_init (&priv->wsm_cmd_mux);mutex_init (&priv->conf_mutex); priv->workqueue =create_singlethread_workqueue ("cw1200_wq" ); +if (!priv->workqueue) { +ieee80211_free_hw (hw); +return NULL ; + } +sema_init (&priv->scan.lock,1 );INIT_WORK (&priv->scan.work, cw1200_scan_work);INIT_DELAYED_WORK (&priv->scan.probe_work, cw1200_probe_work);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 139/346 media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper
In reply to Greg Kroah-Hartman[ Upstream commit ccdd85d518d8b9320ace1d87271f0ba2175f21fa ]
In preparation for adding asynchronous subdevice support to the driver, don't acquire v4l2_clk from the driver .probe() callback as that may fail if the clock is provided by a bridge driver which may be not yet initialized. Move the v4l2_clk_get() to ov6650_video_probe() helper which is going to be converted to v4l2_subdev_internal_ops.registered() callback, executed only when the bridge driver is ready.
--- drivers/media/i2c/ov6650.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/media/i2c/ov6650.c +14 -11
@@ -810,9 +810,16 @@ static int ov6650_video_probe(struct i2c_client *client)u8 pidh, pidl, midh, midl;int ret; + priv->clk =v4l2_clk_get (&client->dev,NULL ); +if (IS_ERR (priv->clk)) { + ret =PTR_ERR (priv->clk); +dev_err (&client->dev,"v4l2_clk request err: %d\n" , ret); +return ret; + } + ret =ov6650_s_power (&priv->subdev,1 );if (ret <0 ) -return ret; + goto eclkput;msleep (20 );
@@ -849,6 +856,11 @@ static int ov6650_video_probe(struct i2c_client *client) done:ov6650_s_power (&priv->subdev,0 ); +if (!ret) +return 0 ; +eclkput: +v4l2_clk_put (priv->clk); +return ret; }
@@ -991,18 +1003,9 @@ static int ov6650_probe(struct i2c_client *client, priv->code =MEDIA_BUS_FMT_YUYV8_2X8 ; priv->colorspace =V4L2_COLORSPACE_JPEG ; - priv->clk =v4l2_clk_get (&client->dev,NULL ); -if (IS_ERR (priv->clk)) { - ret =PTR_ERR (priv->clk); - goto eclkget; - } - ret =ov6650_video_probe (client); -if (ret) { -v4l2_clk_put (priv->clk); -eclkget: +if (ret)v4l2_ctrl_handler_free (&priv->hdl); - }return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 140/346 media: au0828: stop video streaming only when last user stops
In reply to Greg Kroah-Hartman[ Upstream commit f604f0f5afb88045944567f604409951b5eb6af8 ]
If the application was streaming from both videoX and vbiX, and streaming from videoX was stopped, then the vbi streaming also stopped.
The cause being that stop_streaming for video stopped the subdevs as well, instead of only doing that if dev->streaming_users reached 0.
au0828_stop_vbi_streaming was also wrong since it didn't stop the subdevs at all when dev->streaming_users reached 0.
--- drivers/media/usb/au0828/au0828-video.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/media/usb/au0828/au0828-video.c +8 -5
@@ -839,9 +839,9 @@ int au0828_start_analog_streaming(struct vb2_queue *vq, unsigned int count)return rc; } +v4l2_device_call_all (&dev->v4l2_dev,0 , video, s_stream,1 ); +if (vq->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) { -v4l2_device_call_all (&dev->v4l2_dev,0 , video, - s_stream,1 ); dev->vid_timeout_running =1 ;mod_timer (&dev->vid_timeout, jiffies + (HZ /10 )); }else if (vq->type ==V4L2_BUF_TYPE_VBI_CAPTURE ) {
@@ -861,10 +861,11 @@ static void au0828_stop_streaming(struct vb2_queue *vq)dprintk (1 ,"au0828_stop_streaming called %d\n" , dev->streaming_users); -if (dev->streaming_users-- ==1 ) +if (dev->streaming_users-- ==1 ) {au0828_uninit_isoc (dev); +v4l2_device_call_all (&dev->v4l2_dev,0 , video, s_stream,0 ); + } -v4l2_device_call_all (&dev->v4l2_dev,0 , video, s_stream,0 ); dev->vid_timeout_running =0 ;del_timer_sync (&dev->vid_timeout);
@@ -893,8 +894,10 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq)dprintk (1 ,"au0828_stop_vbi_streaming called %d\n" , dev->streaming_users); -if (dev->streaming_users-- ==1 ) +if (dev->streaming_users-- ==1 ) {au0828_uninit_isoc (dev); +v4l2_device_call_all (&dev->v4l2_dev,0 , video, s_stream,0 ); + }spin_lock_irqsave (&dev->slock, flags);if (dev->isoc_ctl.vbi_buf !=NULL ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 150/346 random: fix CRNG initialization when random.trust_cpu=1
In reply to Greg Kroah-Hartman[ Upstream commit fe6f1a6a8eedc1aa538fee0baa612b6a59639cf8 ]
When the system boots with random.trust_cpu=1 it doesn't initialize the per-NUMA CRNGs because it skips the rest of the CRNG startup code. This means that the code from 1e7f583af67b ("random: make /dev/urandom scalable for silly userspace programs") is not used when random.trust_cpu=1.
crash> dmesg | grep random:
[ 0.000000] random: get_random_bytes called from start_kernel+0x94/0x530 with crng_init=0 [ 0.314029] random: crng done (trusting CPU's manufacturer)
crash> print crng_node_pool
$6 = (struct crng_state **) 0x0
After adding the missing call to numa_crng_init() the per-NUMA CRNGs are initialized again:
crash> dmesg | grep random:
[ 0.000000] random: get_random_bytes called from start_kernel+0x94/0x530 with crng_init=0 [ 0.314031] random: crng done (trusting CPU's manufacturer)
crash> print crng_node_pool
$1 = (struct crng_state **) 0xffff9a915f4014a0
The call to invalidate_batched_entropy() was also missing. This is important for architectures like PPC and S390 which only have the arch_get_random_seed_* functions.
--- drivers/char/random.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/char/random.c +4 -1
@@ -777,6 +777,7 @@ static struct crng_state **crng_node_pool __read_mostly;#endif static void invalidate_batched_entropy (void ); +static void numa_crng_init (void );static bool trust_cpu__ro_after_init =IS_ENABLED (CONFIG_RANDOM_TRUST_CPU );static int __init parse_trust_cpu (char *arg)
@@ -805,7 +806,9 @@ static void crng_initialize(struct crng_state *crng) } crng->state[i] ^= rv; } -if (trust_cpu && arch_init) { +if (trust_cpu && arch_init && crng == &primary_crng) { +invalidate_batched_entropy (); +numa_crng_init (); crng_init =2 ;pr_notice ("random: crng done (trusting CPU's manufacturer)\n" ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 154/346 sched/rt: Check integer overflow at usec to nsec conversion
In reply to Greg Kroah-Hartman[ Upstream commit 1a010e29cfa00fee2888fd2fd4983f848cbafb58 ]
Example of unhandled overflows:
# echo 18446744073709651 > cpu.rt_runtime_us # cat cpu.rt_runtime_us 99
# echo 18446744073709900 > cpu.rt_period_us # cat cpu.rt_period_us 348
After this patch they will fail with -EINVAL.
--- kernel/sched/rt.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/sched/rt.c +5 -0
@@ -2555,6 +2555,8 @@ int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us) rt_runtime = (u64 )rt_runtime_us *NSEC_PER_USEC ;if (rt_runtime_us <0 ) rt_runtime =RUNTIME_INF ; +else if ((u64 )rt_runtime_us >U64_MAX /NSEC_PER_USEC ) +return -EINVAL ;return tg_set_rt_bandwidth (tg, rt_period, rt_runtime); }
@@ -2575,6 +2577,9 @@ int sched_group_set_rt_period(struct task_group *tg, u64 rt_period_us) {u64 rt_runtime, rt_period; +if (rt_period_us >U64_MAX /NSEC_PER_USEC ) +return -EINVAL ; + rt_period = rt_period_us *NSEC_PER_USEC ; rt_runtime = tg->rt_bandwidth.rt_runtime;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 115/346 crypto: sun4i-ss - Fix invalid calculation of hash end
In reply to Greg Kroah-Hartman[ Upstream commit f87391558acf816b48f325a493d81d45dec40da0 ]
When nbytes < 4, end is wronlgy set to a negative value which, due to uint, is then interpreted to a large value leading to a deadlock in the following code.
This patch fix this problem.
--- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/crypto/sunxi-ss/sun4i-ss-hash.c +4 -1
@@ -240,7 +240,10 @@ static int sun4i_hash(struct ahash_request *areq) } }else {/* Since we have the flag final, we can go up to modulo 4 */ - end = ((areq->nbytes + op->len) /4 ) *4 - op->len; +if (areq->nbytes <4 ) + end =0 ; +else + end = ((areq->nbytes + op->len) /4 ) *4 - op->len; }/* TODO if SGlen % 4 and !op->len then DMA */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 174/346 arm64: vdso: Fix clock_getres() for CLOCK_REALTIME
In reply to Greg Kroah-Hartman[ Upstream commit 81fb8736dd81da3fe94f28968dac60f392ec6746 ]
clock_getres() in the vDSO library has to preserve the same behaviour of posix_get_hrtimer_res().
In particular, posix_get_hrtimer_res() does:
sec = 0;
ns = hrtimer_resolution;where 'hrtimer_resolution' depends on whether or not high resolution timers are enabled, which is a runtime decision.
The vDSO incorrectly returns the constant CLOCK_REALTIME_RES. Fix this by exposing 'hrtimer_resolution' in the vDSO datapage and returning that instead.
--- arch/arm64/include/asm/vdso_datapage.h | 1 + arch/arm64/kernel/asm-offsets.c | 2 +- arch/arm64/kernel/vdso.c | 3 +++ arch/arm64/kernel/vdso/gettimeofday.S | 7 +++---- 4 files changed, 8 insertions(+), 5 deletions(-)
arch/arm64/include/asm/vdso_datapage.h +1 -0
@@ -38,6 +38,7 @@ struct vdso_data {__u32 tz_minuteswest;/* Whacky timezone stuff */ __u32 tz_dsttime;__u32 use_syscall; + __u32 hrtimer_res; };#endif /* !__ASSEMBLY__ */
arch/arm64/kernel/asm-offsets.c +1 -1
@@ -102,7 +102,7 @@ int main(void)DEFINE (CLOCK_REALTIME ,CLOCK_REALTIME );DEFINE (CLOCK_MONOTONIC ,CLOCK_MONOTONIC );DEFINE (CLOCK_MONOTONIC_RAW ,CLOCK_MONOTONIC_RAW ); -DEFINE (CLOCK_REALTIME_RES ,MONOTONIC_RES_NSEC ); +DEFINE (CLOCK_REALTIME_RES , offsetof(struct vdso_data , hrtimer_res));DEFINE (CLOCK_REALTIME_COARSE ,CLOCK_REALTIME_COARSE );DEFINE (CLOCK_MONOTONIC_COARSE ,CLOCK_MONOTONIC_COARSE );DEFINE (CLOCK_COARSE_RES ,LOW_RES_NSEC );
arch/arm64/kernel/vdso.c +3 -0
@@ -232,6 +232,9 @@ void update_vsyscall(struct timekeeper *tk) vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; +/* Read without the seqlock held by clock_getres() */ +WRITE_ONCE (vdso_data->hrtimer_res, hrtimer_resolution); +if (!use_syscall) {/* tkr_mono.cycle_last == tkr_raw.cycle_last */ vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last;
arch/arm64/kernel/vdso/gettimeofday.S +3 -4
@@ -308,13 +308,14 @@ ENTRY(__kernel_clock_getres) ccmp w0, #CLOCK_MONOTONIC_RAW, #0x4, ne b.ne 1f - ldr x2, 5f + adr vdso_data, _vdso_data + ldr w2, [vdso_data, #CLOCK_REALTIME_RES] b 2f 1: cmp w0, #CLOCK_REALTIME_COARSE ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne b.ne 4f - ldr x2, 6f + ldr x2, 5f 2: cbz x1, 3f stp xzr, x2, [x1]
@@ -328,8 +329,6 @@ ENTRY(__kernel_clock_getres) svc #0 ret 5: - .quad CLOCK_REALTIME_RES -6: .quad CLOCK_COARSE_RES .cfi_endproc ENDPROC(__kernel_clock_getres)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 181/346 hwmon: (smsc47m1) Use request_muxed_region for Super-IO accesses
In reply to Greg Kroah-Hartman[ Upstream commit d6410408ad2a798c4cc685252c1baa713be0ad69 ]
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/smsc47m1.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/hwmon/smsc47m1.c +19 -9
@@ -73,16 +73,21 @@ superio_inb(int reg)/* logical device for fans is 0x0A */ #define superio_select () superio_outb(0x07, 0x0A) -static inline void +static inline int superio_enter (void ) { +if (!request_muxed_region (REG ,2 ,DRVNAME )) +return -EBUSY ; +outb (0x55 ,REG ); +return 0 ; }static inline void superio_exit (void ) {outb (0xAA ,REG ); +release_region (REG ,2 ); }#define SUPERIO_REG_ACT 0x30
@@ -531,8 +536,12 @@ static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) {u8 val;unsigned short addr; +int err; + + err =superio_enter (); +if (err) +return err; -superio_enter (); val = force_id ? force_id :superio_inb (SUPERIO_REG_DEVID );/*
@@ -608,13 +617,14 @@ static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data)static void smsc47m1_restore (const struct smsc47m1_sio_data *sio_data) {if ((sio_data->activate &0x01 ) ==0 ) { -superio_enter (); -superio_select (); - -pr_info ("Disabling device\n" ); -superio_outb (SUPERIO_REG_ACT , sio_data->activate); - -superio_exit (); +if (!superio_enter ()) { +superio_select (); +pr_info ("Disabling device\n" ); +superio_outb (SUPERIO_REG_ACT , sio_data->activate); +superio_exit (); + }else { +pr_warn ("Failed to disable device\n" ); + } } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 183/346 hwmon: (pc87427) Use request_muxed_region for Super-IO accesses
In reply to Greg Kroah-Hartman[ Upstream commit 755a9b0f8aaa5639ba5671ca50080852babb89ce ]
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/pc87427.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/hwmon/pc87427.c +13 -1
@@ -106,6 +106,13 @@ static const char *logdev_str[2] = { DRVNAME " FMC", DRVNAME " HMC" };#define LD_IN 1#define LD_TEMP 1 +static inline int superio_enter (int sioaddr) +{ +if (!request_muxed_region (sioaddr,2 ,DRVNAME )) +return -EBUSY ; +return 0 ; +} +static inline void superio_outb (int sioaddr,int reg,int val) {outb (reg, sioaddr);
@@ -122,6 +129,7 @@ static inline void superio_exit(int sioaddr) {outb (0x02 , sioaddr);outb (0x02 , sioaddr +1 ); +release_region (sioaddr,2 ); }/*
@@ -1220,7 +1228,11 @@ static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data) {u16 val;u8 cfg, cfg_b; -int i, err =0 ; +int i, err; + + err =superio_enter (sioaddr); +if (err) +return err;/* Identify device */ val = force_id ? force_id :superio_inb (sioaddr,SIOREG_DEVID );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 190/346 mmc: sdhci-of-esdhc: add erratum eSDHC-A001 and A-008358 support
In reply to Greg Kroah-Hartman[ Upstream commit 05cb6b2a66fa7837211a060878e91be5eb10cb07 ]
eSDHC-A001: The data timeout counter (SYSCTL[DTOCV]) is not reliable for DTOCV values 0x4(2^17 SD clock), 0x8(2^21 SD clock), and 0xC(2^25 SD clock). The data timeout counter can count from 2^13–2^27, but for values 2^17, 2^21, and 2^25, the timeout counter counts for only 2^13 SD clocks.
A-008358: The data timeout counter value loaded into the timeout counter is less than expected and can result into early timeout error in case of eSDHC data transactions. The table below shows the expected vs actual timeout period for different values of SYSCTL[DTOCV]:
these two erratum has the same quirk to control it, and set SDHCI_QUIRK_RESET_AFTER_REQUEST to fix above issue.
--- drivers/mmc/host/sdhci-of-esdhc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-of-esdhc.c +3 -1
@@ -1077,8 +1077,10 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)if (esdhc->vendor_ver >VENDOR_V_22 ) host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ ; -if (of_find_compatible_node (NULL ,NULL ,"fsl,p2020-esdhc" )) +if (of_find_compatible_node (NULL ,NULL ,"fsl,p2020-esdhc" )) { host->quirks2 |=SDHCI_QUIRK_RESET_AFTER_REQUEST ; + host->quirks2 |=SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ; + } if (of_device_is_compatible(np, "fsl,p5040-esdhc") || of_device_is_compatible(np, "fsl,p5020-esdhc") ||
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 193/346 PM / core: Propagate dev->power.wakeup_path when no callbacks
In reply to Greg Kroah-Hartman[ Upstream commit dc351d4c5f4fe4d0f274d6d660227be0c3a03317 ]
The dev->power.direct_complete flag may become set in device_prepare() in case the device don't have any PM callbacks (dev->power.no_pm_callbacks is set). This leads to a broken behaviour, when there is child having wakeup enabled and relies on its parent to be used in the wakeup path.
More precisely, when the direct complete path becomes selected for the child in __device_suspend(), the propagation of the dev->power.wakeup_path becomes skipped as well.
Let's address this problem, by checking if the device is a part the wakeup path or has wakeup enabled, then prevent the direct complete path from being used.
--- drivers/base/power/main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/base/power/main.c +4 -0
@@ -1738,6 +1738,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)if (dev->power.syscore) goto Complete; +/* Avoid direct_complete to let wakeup_path propagate. */ +if (device_may_wakeup (dev) || dev->power.wakeup_path) + dev->power.direct_complete = false; +if (dev->power.direct_complete) {if (pm_runtime_status_suspended (dev)) {pm_runtime_disable (dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 195/346 extcon: arizona: Disable mic detect if running when driver is removed
In reply to Greg Kroah-Hartman[ Upstream commit 00053de52231117ddc154042549f2256183ffb86 ]
Microphone detection provides the button detection features on the Arizona CODECs as such it will be running if the jack is currently inserted. If the driver is unbound whilst the jack is still inserted this will cause warnings from the regulator framework as the MICVDD regulator is put but was never disabled.
Correct this by disabling microphone detection on driver removal and if the microphone detection was running disable the regulator and put the runtime reference that was currently held.
--- drivers/extcon/extcon-arizona.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/extcon/extcon-arizona.c +10 -0
@@ -1726,6 +1726,16 @@ static int arizona_extcon_remove(struct platform_device *pdev)struct arizona_extcon_info *info =platform_get_drvdata (pdev);struct arizona *arizona = info->arizona;int jack_irq_rise, jack_irq_fall; +bool change; + +regmap_update_bits_check (arizona->regmap,ARIZONA_MIC_DETECT_1 , +ARIZONA_MICD_ENA ,0 , + &change); + +if (change) { +regulator_disable (info->micvdd); +pm_runtime_put (info->dev); + }gpiod_put (info->micd_pol_gpio);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 225/346 brcmfmac: fix missing checks for kmemdup
In reply to Greg Kroah-Hartman[ Upstream commit 46953f97224d56a12ccbe9c6acaa84ca0dab2780 ]
In case kmemdup fails, the fix sets conn_info->req_ie_len and conn_info->resp_ie_len to zero to avoid buffer overflows.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +4 -0
@@ -5376,6 +5376,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, conn_info->req_ie =kmemdup (cfg->extra_buf, conn_info->req_ie_len,GFP_KERNEL ); +if (!conn_info->req_ie) + conn_info->req_ie_len =0 ; }else { conn_info->req_ie_len =0 ; conn_info->req_ie =NULL ;
@@ -5392,6 +5394,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, conn_info->resp_ie =kmemdup (cfg->extra_buf, conn_info->resp_ie_len,GFP_KERNEL ); +if (!conn_info->resp_ie) + conn_info->resp_ie_len =0 ; }else { conn_info->resp_ie_len =0 ; conn_info->resp_ie =NULL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 245/346 RDMA/hns: Fix bad endianess of port_pd variable
In reply to Greg Kroah-Hartman[ Upstream commit 6734b2973565e36659e97e12ab0d0faf1d9f3fbe ]
port_pd is treated as le32 in declaration and read, fix assignment to be in le32 too. This change fixes the following compilation warnings.
drivers/infiniband/hw/hns/hns_roce_ah.c:67:24: warning: incorrect type
in assignment (different base types) drivers/infiniband/hw/hns/hns_roce_ah.c:67:24: expected restricted __le32 [usertype] port_pd drivers/infiniband/hw/hns/hns_roce_ah.c:67:24: got restricted __be32 [usertype]
--- drivers/infiniband/hw/hns/hns_roce_ah.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_ah.c +1 -1
@@ -70,7 +70,7 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd, HNS_ROCE_VLAN_SL_BIT_MASK) <<HNS_ROCE_VLAN_SL_SHIFT ; - ah->av.port_pd =cpu_to_be32 (to_hr_pd (ibpd)->pdn | + ah->av.port_pd =cpu_to_le32 (to_hr_pd (ibpd)->pdn | (rdma_ah_get_port_num (ah_attr) <<HNS_ROCE_PORT_NUM_SHIFT )); ah->av.gid_index = grh->sgid_index;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 213/346 x86/build: Keep local relocations with ld.lld
In reply to Greg Kroah-Hartman[ Upstream commit 7c21383f3429dd70da39c0c7f1efa12377a47ab6 ]
The LLVM linker (ld.lld) defaults to removing local relocations, which causes KASLR boot failures. ld.bfd and ld.gold already handle this correctly. This adds the explicit instruction "--discard-none" during the link phase. There is no change in output for ld.bfd and ld.gold, but ld.lld now produces an image with all the needed relocations.
--- arch/x86/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Makefile +1 -1
@@ -47,7 +47,7 @@ export REALMODE_CFLAGS export BITS ifdef CONFIG_X86_NEED_RELOCS - LDFLAGS_vmlinux := --emit-relocs + LDFLAGS_vmlinux := --emit-relocs --discard-none endif #
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 279/346 ice: Prevent unintended multiple chain resets
In reply to Greg Kroah-Hartman[ Upstream commit 2ebd4428d93a2f6ce0c813b10a1a43b6a8241fe5 ]
In the current implementation of ice_reset_subtask, if multiple reset types are set in the pf->state, the most intrusive one is meant to be performed only, but the bits requesting the other types are not being cleared. This would lead to another reset being performed the next time the service task is scheduled.
Change the flow of ice_reset_subtask so that all reset request bits in pf->state are cleared, and we still perform the most intrusive of the resets requested.
--- drivers/net/ethernet/intel/ice/ice_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +8 -2
@@ -416,8 +416,14 @@ static void ice_reset_subtask(struct ice_pf *pf)* for the reset now), poll for reset done, rebuild and return. */ if (test_bit (__ICE_RESET_OICR_RECV, pf->state)) { -clear_bit (__ICE_GLOBR_RECV, pf->state); -clear_bit (__ICE_CORER_RECV, pf->state); +/* Perform the largest reset requested */ +if (test_and_clear_bit (__ICE_CORER_RECV, pf->state)) + reset_type =ICE_RESET_CORER ; +if (test_and_clear_bit (__ICE_GLOBR_RECV, pf->state)) + reset_type =ICE_RESET_GLOBR ; +/* return if no valid reset type requested */ +if (reset_type ==ICE_RESET_INVAL ) +return ;if (!test_bit (__ICE_PREPARED_FOR_RESET, pf->state))ice_prepare_for_reset (pf);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 292/346 media: v4l2-fwnode: The first default data lane is 0 on C-PHY
In reply to Greg Kroah-Hartman[ Upstream commit fff35d45e16fae125c6000cb87e254cb634ac7fb ]
C-PHY has no clock lanes. Therefore the first data lane is 0 by default.
--- drivers/media/v4l2-core/v4l2-fwnode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-fwnode.c +5 -1
@@ -225,6 +225,10 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode,if (bus_type ==V4L2_MBUS_CSI2_DPHY || bus_type ==V4L2_MBUS_CSI2_CPHY || lanes_used || have_clk_lane || (flags & ~V4L2_MBUS_CSI2_CONTINUOUS_CLOCK )) { +/* Only D-PHY has a clock lane. */ +unsigned int dfl_data_lane_index = + bus_type ==V4L2_MBUS_CSI2_DPHY ; + bus->flags = flags;if (bus_type ==V4L2_MBUS_UNKNOWN ) vep->bus_type =V4L2_MBUS_CSI2_DPHY ;
@@ -233,7 +237,7 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode,if (use_default_lane_mapping) { bus->clock_lane =0 ;for (i =0 ; i < num_data_lanes; i++) - bus->data_lanes[i] =1 + i; + bus->data_lanes[i] = dfl_data_lane_index + i; }else { bus->clock_lane = clock_lane;for (i =0 ; i < num_data_lanes; i++)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 300/346 drm/amd/display: add pipe lock during stream update
In reply to Greg Kroah-Hartman[ Upstream commit e6bddf6c67f9a3abf6f1ef75e52bc1cd228dfe4d ]
[why]
Stream update will adjust both info packets and stream params, need to make sure all things are applied togather.
[how]
add pipe lock during stream update
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -0
@@ -1511,6 +1511,7 @@ static void commit_planes_do_stream_update(struct dc *dc,continue ;if (stream_update->dpms_off) { + dc->hwss.pipe_control_lock (dc, pipe_ctx, true);if (*stream_update->dpms_off) {core_link_disable_stream (pipe_ctx,KEEP_ACQUIRED_RESOURCE ); dc->hwss.optimize_bandwidth (dc, dc->current_state);
@@ -1518,6 +1519,7 @@ static void commit_planes_do_stream_update(struct dc *dc, dc->hwss.prepare_bandwidth (dc, dc->current_state);core_link_enable_stream (dc->current_state, pipe_ctx); } + dc->hwss.pipe_control_lock (dc, pipe_ctx, false); }if (stream_update->abm_level && pipe_ctx->stream_res.abm) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 319/346 drm/omap: dsi: Fix PM for display blank with paired dss_pll calls
In reply to Greg Kroah-Hartman[ Upstream commit fe4ed1b457943113ee1138c939fbdeede4af6cf3 ]
Currently dsi_display_init_dsi() calls dss_pll_enable() but it is not paired with dss_pll_disable() in dsi_display_uninit_dsi(). This leaves the DSS clocks enabled when the display is blanked wasting about extra 5mW of power while idle.
The clock that is left on by not calling dss_pll_disable() is DSS_CLKCTRL bit 10 OPTFCLKEN_SYS_CLK that is the source clock for DSI PLL.
We can fix this issue by by making the current dsi_pll_uninit() into dsi_pll_disable(). This way we can just call dss_pll_disable() from dsi_display_uninit_dsi() and the code becomes a bit easier to follow.
However, we need to also consider that DSI PLL can be muxed for DVI too as pointed out by Tomi Valkeinen <[email protected]>. In the DVI case, we want to unconditionally disable the clocks. To get around this issue, we separate out the DSI lane handling from dsi_pll_enable() and dsi_pll_disable() as suggested by Tomi in an earlier experimental patch.
So we must only toggle the DSI regulator based on the vdds_dsi_enabled flag from dsi_display_init_dsi() and dsi_display_uninit_dsi().
We need to make these two changes together to avoid breaking things for DVI when fixing the DSI clock handling. And this all causes a slight renumbering of the error path for dsi_display_init_dsi().
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 60 ++++++++++++++++--------------- 1 file changed, 31 insertions(+), 29 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +31 -29
@@ -1342,12 +1342,9 @@ static int dsi_pll_enable(struct dss_pll *pll)*/ dsi_enable_scp_clk (dsi); -if (!dsi->vdds_dsi_enabled) { - r =regulator_enable (dsi->vdds_dsi_reg); -if (r) - goto err0; - dsi->vdds_dsi_enabled = true; - } + r =regulator_enable (dsi->vdds_dsi_reg); +if (r) + goto err0;/* XXX PLL does not come out of reset without this... */ dispc_pck_free_enable (dsi->dss->dispc,1 );
@@ -1372,36 +1369,25 @@ static int dsi_pll_enable(struct dss_pll *pll)return 0 ; err1: -if (dsi->vdds_dsi_enabled) { -regulator_disable (dsi->vdds_dsi_reg); - dsi->vdds_dsi_enabled = false; - } +regulator_disable (dsi->vdds_dsi_reg); err0:dsi_disable_scp_clk (dsi);dsi_runtime_put (dsi);return r; } -static void dsi_pll_uninit (struct dsi_data *dsi,bool disconnect_lanes) +static void dsi_pll_disable (struct dss_pll *pll) { + struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); +dsi_pll_power (dsi,DSI_PLL_POWER_OFF ); -if (disconnect_lanes) { -WARN_ON (!dsi->vdds_dsi_enabled); -regulator_disable (dsi->vdds_dsi_reg); - dsi->vdds_dsi_enabled = false; - } + +regulator_disable (dsi->vdds_dsi_reg);dsi_disable_scp_clk (dsi);dsi_runtime_put (dsi); -DSSDBG ("PLL uninit done\n" ); -} - -static void dsi_pll_disable (struct dss_pll *pll) -{ - struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); - -dsi_pll_uninit (dsi, true); +DSSDBG ("PLL disable done\n" ); }static int dsi_dump_dsi_clocks (struct seq_file *s,void *p)
@@ -4096,11 +4082,11 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) r =dss_pll_enable (&dsi->pll);if (r) - goto err0; +return r; r =dsi_configure_dsi_clocks (dsi);if (r) - goto err1; + goto err0; dss_select_dsi_clk_source(dsi->dss, dsi->module_id, dsi->module_id == 0 ?
@@ -4108,6 +4094,14 @@ static int dsi_display_init_dsi(struct dsi_data *dsi)DSSDBG ("PLL OK\n" ); +if (!dsi->vdds_dsi_enabled) { + r =regulator_enable (dsi->vdds_dsi_reg); +if (r) + goto err1; + + dsi->vdds_dsi_enabled = true; + } + r =dsi_cio_init (dsi);if (r) goto err2;
@@ -4136,10 +4130,13 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) err3:dsi_cio_uninit (dsi); err2: -dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK ); +regulator_disable (dsi->vdds_dsi_reg); + dsi->vdds_dsi_enabled = false; err1: -dss_pll_disable (&dsi->pll); +dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK ); err0: +dss_pll_disable (&dsi->pll); +return r; }
@@ -4158,7 +4155,12 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,dss_select_dsi_clk_source (dsi->dss, dsi->module_id,DSS_CLK_SRC_FCK );dsi_cio_uninit (dsi); -dsi_pll_uninit (dsi, disconnect_lanes); +dss_pll_disable (&dsi->pll); + +if (disconnect_lanes) { +regulator_disable (dsi->vdds_dsi_reg); + dsi->vdds_dsi_enabled = false; + } }static int dsi_display_enable (struct omap_dss_device *dssdev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 304/346 scsi: ufs: fix a missing check of devm_reset_control_get
In reply to Greg Kroah-Hartman[ Upstream commit 63a06181d7ce169d09843645c50fea1901bc9f0a ]
devm_reset_control_get could fail, so the fix checks its return value and passes the error code upstream in case it fails.
--- drivers/scsi/ufs/ufs-hisi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/ufs/ufs-hisi.c +4 -0
@@ -544,6 +544,10 @@ static int ufs_hisi_init_common(struct ufs_hba *hba)ufshcd_set_variant (hba, host); host->rst =devm_reset_control_get (dev,"rst" ); +if (IS_ERR (host->rst)) { +dev_err (dev,"%s: failed to get reset control\n" , __func__); +return PTR_ERR (host->rst); + }ufs_hisi_set_pm_lvl (hba);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 329/346 regulator: da9211: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 65378de3359d30ebce44762d8b8027f372b5b1c4 ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/da9211-regulator.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/regulator/da9211-regulator.c +4 -0
@@ -322,8 +322,10 @@ static irqreturn_t da9211_irq_handler(int irq, void *data) goto error_i2c;if (reg_val &DA9211_E_OV_CURR_A ) { +regulator_lock (chip->rdev[0 ]);regulator_notifier_call_chain (chip->rdev[0 ],REGULATOR_EVENT_OVER_CURRENT ,NULL ); +regulator_unlock (chip->rdev[0 ]); err =regmap_write (chip->regmap,DA9211_REG_EVENT_B ,DA9211_E_OV_CURR_A );
@@ -334,8 +336,10 @@ static irqreturn_t da9211_irq_handler(int irq, void *data) }if (reg_val &DA9211_E_OV_CURR_B ) { +regulator_lock (chip->rdev[1 ]);regulator_notifier_call_chain (chip->rdev[1 ],REGULATOR_EVENT_OVER_CURRENT ,NULL ); +regulator_unlock (chip->rdev[1 ]); err =regmap_write (chip->regmap,DA9211_REG_EVENT_B ,DA9211_E_OV_CURR_B );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 330/346 regulator: da9063: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 29d40b4a5776ec4727c9f0e00a884423dd5e3366 ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/da9063-regulator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/regulator/da9063-regulator.c +4 -1
@@ -615,9 +615,12 @@ static irqreturn_t da9063_ldo_lim_event(int irq, void *data)if (regl->info->oc_event.reg !=DA9063_REG_STATUS_D )continue ; -if (BIT (regl->info->oc_event.lsb) & bits) +if (BIT (regl->info->oc_event.lsb) & bits) { +regulator_lock (regl->rdev);regulator_notifier_call_chain (regl->rdev,REGULATOR_EVENT_OVER_CURRENT ,NULL ); +regulator_unlock (regl->rdev); + } }return IRQ_HANDLED ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 333/346 regulator: pv88090: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 275513b7695a61b75b2546406ecd0f8e3d9fc8be ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/pv88090-regulator.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/regulator/pv88090-regulator.c +4 -0
@@ -274,9 +274,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data)if (reg_val &PV88090_E_VDD_FLT ) {for (i =0 ; i <PV88090_MAX_REGULATORS ; i++) {if (chip->rdev[i] !=NULL ) { +regulator_lock (chip->rdev[i]);regulator_notifier_call_chain (chip->rdev[i],REGULATOR_EVENT_UNDER_VOLTAGE ,NULL ); +regulator_unlock (chip->rdev[i]); } }
@@ -291,9 +293,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data)if (reg_val &PV88090_E_OVER_TEMP ) {for (i =0 ; i <PV88090_MAX_REGULATORS ; i++) {if (chip->rdev[i] !=NULL ) { +regulator_lock (chip->rdev[i]);regulator_notifier_call_chain (chip->rdev[i],REGULATOR_EVENT_OVER_TEMP ,NULL ); +regulator_unlock (chip->rdev[i]); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 337/346 ASoC: davinci-mcasp: Fix clang warning without CONFIG_PM
In reply to Greg Kroah-Hartman[ Upstream commit 8ca5104715cfd14254ea5aecc390ae583b707607 ]
Building with clang shows a variable that is only used by the suspend/resume functions but defined outside of their #ifdef block:
sound/soc/ti/davinci-mcasp.c:48:12: error: variable 'context_regs' is not needed and will not be emitted
We commonly fix these by marking the PM functions as __maybe_unused, but here that would grow the davinci_mcasp structure, so instead add another #ifdef here.
--- sound/soc/ti/davinci-mcasp.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/ti/davinci-mcasp.c +2 -0
@@ -44,6 +44,7 @@#define MCASP_MAX_AFIFO_DEPTH 64 +#ifdef CONFIG_PM static u32 context_regs[] = {DAVINCI_MCASP_TXFMCTL_REG , DAVINCI_MCASP_RXFMCTL_REG,
@@ -66,6 +67,7 @@ struct davinci_mcasp_context {u32 *xrsr_regs;/* for serializer configuration */ bool pm_state; }; +#endif struct davinci_mcasp_ruledata {struct davinci_mcasp *mcasp;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 306/346 media: gspca: do not resubmit URBs when streaming has stopped
In reply to Greg Kroah-Hartman[ Upstream commit e6f8bd59c28f758feea403a70d6c3ef28c50959f ]
When streaming is stopped all URBs are killed, but in fill_frame and in bulk_irq this results in an attempt to resubmit the killed URB. That is not what you want and causes spurious kernel messages.
So check if streaming has stopped before resubmitting.
Also check against gspca_dev->streaming rather than vb2_start_streaming_called() since vb2_start_streaming_called() will return true when in stop_streaming, but gspca_dev->streaming is set to false when stop_streaming is called.
--- drivers/media/usb/gspca/gspca.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/usb/gspca/gspca.c +6 -2
@@ -314,6 +314,8 @@ static void fill_frame(struct gspca_dev *gspca_dev, } resubmit: +if (!gspca_dev->streaming) +return ;/* resubmit the URB */ st =usb_submit_urb (urb,GFP_ATOMIC );if (st <0 )
@@ -330,7 +332,7 @@ static void isoc_irq(struct urb *urb)struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;gspca_dbg (gspca_dev,D_PACK ,"isoc irq\n" ); -if (!vb2_start_streaming_called (&gspca_dev->queue)) +if (!gspca_dev->streaming)return ;fill_frame (gspca_dev, urb); }
@@ -344,7 +346,7 @@ static void bulk_irq(struct urb *urb)int st;gspca_dbg (gspca_dev,D_PACK ,"bulk irq\n" ); -if (!vb2_start_streaming_called (&gspca_dev->queue)) +if (!gspca_dev->streaming)return ;switch (urb->status) {case 0 :
@@ -367,6 +369,8 @@ static void bulk_irq(struct urb *urb) urb->actual_length); resubmit: +if (!gspca_dev->streaming) +return ;/* resubmit the URB */ if (gspca_dev->cam.bulk_nurbs !=0 ) { st =usb_submit_urb (urb,GFP_ATOMIC );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 343/346 vfio-ccw: Prevent quiesce function going into an infinite loop
In reply to Greg Kroah-Hartman[ Upstream commit d1ffa760d22aa1d8190478e5ef555c59a771db27 ]
The quiesce function calls cio_cancel_halt_clear() and if we get an -EBUSY we go into a loop where we:
- wait for any interrupts
- flush all I/O in the workqueue
- retry cio_cancel_halt_clear
During the period where we are waiting for interrupts or flushing all I/O, the channel subsystem could have completed a halt/clear action and turned off the corresponding activity control bits in the subchannel status word. This means the next time we call cio_cancel_halt_clear(), we will again start by calling cancel subchannel and so we can be stuck between calling cancel and halt forever.
Rather than calling cio_cancel_halt_clear() immediately after waiting, let's try to disable the subchannel. If we succeed in disabling the subchannel then we know nothing else can happen with the device.
Message-Id: <4d5a4b98ab1b41ac6131b5c36de18b76c5d66898.1555449329.git.alifm@linux.ibm.com>
--- drivers/s390/cio/vfio_ccw_drv.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +18 -14
@@ -40,26 +40,30 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch)if (ret != -EBUSY ) goto out_unlock; + iretry =255 ;do { - iretry =255 ; ret =cio_cancel_halt_clear (sch, &iretry); -while (ret == -EBUSY ) { -/* -* Flush all I/O and wait for -* cancel/halt/clear completion. -*/ - private->completion = &completion; -spin_unlock_irq (sch->lock); -wait_for_completion_timeout (&completion,3 *HZ ); +if (ret == -EIO ) { +pr_err ("vfio_ccw: could not quiesce subchannel 0.%x.%04x!\n" , + sch->schid.ssid, sch->schid.sch_no); +break ; + } + +/* +* Flush all I/O and wait for +* cancel/halt/clear completion. +*/ + private->completion = &completion; +spin_unlock_irq (sch->lock); - private->completion =NULL ; -flush_workqueue (vfio_ccw_work_q); -spin_lock_irq (sch->lock); - ret =cio_cancel_halt_clear (sch, &iretry); - }; +if (ret == -EBUSY ) +wait_for_completion_timeout (&completion,3 *HZ ); + private->completion =NULL ; +flush_workqueue (vfio_ccw_work_q); +spin_lock_irq (sch->lock); ret =cio_disable_subchannel (sch); }while (ret == -EBUSY ); out_unlock:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 346/346 NFS: Fix a double unlock from nfs_match,get_client
In reply to Greg Kroah-Hartman[ Upstream commit c260121a97a3e4df6536edbc2f26e166eff370ce ]
Now that nfs_match_client drops the nfs_client_lock, we should be careful
to always return it in the same condition: locked.
--- fs/nfs/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/client.c +1 -1
@@ -299,9 +299,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *datspin_unlock (&nn->nfs_client_lock); error =nfs_wait_client_init_complete (clp);nfs_put_client (clp); +spin_lock (&nn->nfs_client_lock);if (error <0 )return ERR_PTR (error); -spin_lock (&nn->nfs_client_lock); goto again; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 207/346 cpufreq/pasemi: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit a9acc26b75f652f697e02a9febe2ab0da648a571 ]
The call to of_get_cpu_node returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/cpufreq/pasemi-cpufreq.c:212:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function. ./drivers/cpufreq/pasemi-cpufreq.c:220:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function.
--- drivers/cpufreq/pasemi-cpufreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/pasemi-cpufreq.c +1 -0
@@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) cpu =of_get_cpu_node (policy->cpu,NULL ); +of_node_put (cpu);if (!cpu) goto out;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 208/346 cpufreq: pmac32: fix possible object reference leak
In reply to Greg Kroah-Hartman[ Upstream commit 8d10dc28a9ea6e8c02e825dab28699f3c72b02d9 ]
The call to of_find_node_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/cpufreq/pmac32-cpufreq.c:557:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function. ./drivers/cpufreq/pmac32-cpufreq.c:569:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function. ./drivers/cpufreq/pmac32-cpufreq.c:598:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 587, but without a corresponding object release within this function.
--- drivers/cpufreq/pmac32-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/pmac32-cpufreq.c +2 -0
@@ -552,6 +552,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) volt_gpio_np =of_find_node_by_name (NULL ,"cpu-vcore-select" );if (volt_gpio_np) voltage_gpio =read_gpio (volt_gpio_np); +of_node_put (volt_gpio_np);if (!voltage_gpio){pr_err ("missing cpu-vcore-select gpio\n" );return 1 ;
@@ -588,6 +589,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode)if (volt_gpio_np) voltage_gpio =read_gpio (volt_gpio_np); +of_node_put (volt_gpio_np); pvr =mfspr (SPRN_PVR ); has_cpu_l2lve = !((pvr &0xf00 ) ==0x100 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 141/346 media: ov2659: make S_FMT succeed even if requested format doesnt match
In reply to Greg Kroah-Hartman[ Upstream commit bccb89cf9cd07a0690d519696a00c00a973b3fe4 ]
This driver returns an error if unsupported media bus pixel code is requested by VIDIOC_SUBDEV_S_FMT.
But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst,
Drivers must not return an error solely because the requested format doesn't match the device capabilities. They must instead modify the format to match what the hardware can provide.
So select default format code and return success in that case.
This is detected by v4l2-compliance.
--- drivers/media/i2c/ov2659.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/i2c/ov2659.c +4 -2
@@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,if (ov2659_formats[index].code == mf->code)break ; -if (index <0 ) -return -EINVAL ; +if (index <0 ) { + index =0 ; + mf->code = ov2659_formats[index].code; + } mf->colorspace =V4L2_COLORSPACE_SRGB ; mf->field =V4L2_FIELD_NONE ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 136/346 perf/arm-cci: Remove broken race mitigation
In reply to Greg Kroah-Hartman[ Upstream commit 0d2e2a82d4de298d006bf8eddc86829e3c7da820 ]
Uncore PMU drivers face an awkward cyclic dependency wherein:
- They have to pick a valid online CPU to associate with before registering the PMU device, since it will get exposed to userspace immediately.
- The PMU registration has to be be at least partly complete before hotplug events can be handled, since trying to migrate an uninitialised context would be bad.
- The hotplug handler has to be ready as soon as a CPU is chosen, lest it go offline without the user-visible cpumask value getting updated.
The arm-cci driver has tried to solve this by using get_cpu() to pick the current CPU and prevent it from disappearing while both registrations are performed, but that results in taking mutexes with preemption disabled, which makes certain configurations very unhappy:
[ 1.983337] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:2004 [ 1.983340] in_atomic(): 1, irqs_disabled(): 0, pid: 1, name: swapper/0 [ 1.983342] Preemption disabled at: [ 1.983353] [<ffffff80089801f4>] cci_pmu_probe+0x1dc/0x488 [ 1.983360] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.18.20-rt8-yocto-preempt-rt #1 [ 1.983362] Hardware name: ZynqMP ZCU102 Rev1.0 (DT) [ 1.983364] Call trace: [ 1.983369] dump_backtrace+0x0/0x158 [ 1.983372] show_stack+0x24/0x30 [ 1.983378] dump_stack+0x80/0xa4 [ 1.983383] ___might_sleep+0x138/0x160 [ 1.983386] __might_sleep+0x58/0x90 [ 1.983391] __rt_mutex_lock_state+0x30/0xc0 [ 1.983395] _mutex_lock+0x24/0x30 [ 1.983400] perf_pmu_register+0x2c/0x388 [ 1.983404] cci_pmu_probe+0x2bc/0x488 [ 1.983409] platform_drv_probe+0x58/0xa8
It is not feasible to resolve all the possible races outside of the perf core itself, so address the immediate bug by following the example of nearly every other PMU driver and not even trying to do so. Registering the hotplug notifier first should minimise the window in which things can go wrong, so that's about as much as we can reasonably do here. This also revealed an additional race in assigning the global pointer too late relative to the hotplug notifier, which gets fixed in the process.
--- drivers/perf/arm-cci.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/perf/arm-cci.c +12 -9
@@ -1692,21 +1692,24 @@ static int cci_pmu_probe(struct platform_device *pdev)raw_spin_lock_init (&cci_pmu->hw_events.pmu_lock);mutex_init (&cci_pmu->reserve_mutex);atomic_set (&cci_pmu->active_events,0 ); - cci_pmu->cpu =get_cpu (); - - ret =cci_pmu_init (cci_pmu, pdev); -if (ret) { -put_cpu (); -return ret; - } + cci_pmu->cpu =raw_smp_processor_id (); + g_cci_pmu = cci_pmu;cpuhp_setup_state_nocalls (CPUHP_AP_PERF_ARM_CCI_ONLINE ,"perf/arm/cci:online" ,NULL , cci_pmu_offline_cpu); -put_cpu (); - g_cci_pmu = cci_pmu; + + ret =cci_pmu_init (cci_pmu, pdev); +if (ret) + goto error_pmu_init; +pr_info ("ARM %s PMU driver probed" , cci_pmu->model->name);return 0 ; + +error_pmu_init: +cpuhp_remove_state (CPUHP_AP_PERF_ARM_CCI_ONLINE ); + g_cci_pmu =NULL ; +return ret; }static int cci_pmu_remove (struct platform_device *pdev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 341/346 drm: Wake up next in drm_read() chain if we are forced to putback the event
In reply to Greg Kroah-Hartman[ Upstream commit 60b801999c48b6c1dd04e653a38e2e613664264e ]
After an event is sent, we try to copy it into the user buffer of the first waiter in drm_read() and if the user buffer doesn't have enough room we put it back onto the list. However, we didn't wake up any subsequent waiter, so that event may sit on the list until either a new vblank event is sent or a new waiter appears. Rare, but in the worst case may lead to a stuck process.
Testcase: igt/drm_read/short-buffer-wakeup
--- drivers/gpu/drm/drm_file.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_file.c +1 -0
@@ -567,6 +567,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer, file_priv->event_space -= length;list_add (&e->link, &file_priv->event_list);spin_unlock_irq (&dev->event_lock); +wake_up_interruptible (&file_priv->event_wait);break ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 340/346 drm/drv: Hold ref on parent device during drm_device lifetime
In reply to Greg Kroah-Hartman[ Upstream commit 56be6503aab2bc3a30beae408071b9be5e1bae51 ]
This makes it safe to access drm_device->dev after the parent device has been removed/unplugged.
--- drivers/gpu/drm/drm_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +4 -1
@@ -499,7 +499,7 @@ int drm_dev_init(struct drm_device *dev,BUG_ON (!parent);kref_init (&dev->ref); - dev->dev = parent; + dev->dev =get_device (parent); dev->driver = driver;/* no per-device feature limits by default */
@@ -569,6 +569,7 @@ int drm_dev_init(struct drm_device *dev,drm_minor_free (dev,DRM_MINOR_RENDER );drm_fs_inode_free (dev->anon_inode); err_free: +put_device (dev->dev);mutex_destroy (&dev->master_mutex);mutex_destroy (&dev->ctxlist_mutex);mutex_destroy (&dev->clientlist_mutex);
@@ -604,6 +605,8 @@ void drm_dev_fini(struct drm_device *dev)drm_minor_free (dev,DRM_MINOR_PRIMARY );drm_minor_free (dev,DRM_MINOR_RENDER ); +put_device (dev->dev); +mutex_destroy (&dev->master_mutex);mutex_destroy (&dev->ctxlist_mutex);mutex_destroy (&dev->clientlist_mutex);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 339/346 drm/v3d: Handle errors from IRQ setup.
In reply to Greg Kroah-Hartman[ Upstream commit fc22771547e7e8a63679f0218e943d72b107de65 ]
Noted in review by Dave Emett for V3D 4.2 support.
--- drivers/gpu/drm/v3d/v3d_drv.c | 8 ++++++-- drivers/gpu/drm/v3d/v3d_drv.h | 2 +- drivers/gpu/drm/v3d/v3d_irq.c | 13 +++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +6 -2
@@ -312,14 +312,18 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)if (ret) goto dev_destroy; -v3d_irq_init (v3d); + ret =v3d_irq_init (v3d); +if (ret) + goto gem_destroy; ret =drm_dev_register (drm,0 );if (ret) - goto gem_destroy; + goto irq_disable;return 0 ; +irq_disable: +v3d_irq_disable (v3d); gem_destroy:v3d_gem_destroy (drm); dev_destroy:
drivers/gpu/drm/v3d/v3d_drv.h +1 -1
@@ -311,7 +311,7 @@ void v3d_invalidate_caches(struct v3d_dev *v3d);void v3d_flush_caches (struct v3d_dev *v3d);/* v3d_irq.c */ -void v3d_irq_init (struct v3d_dev *v3d); +int v3d_irq_init (struct v3d_dev *v3d);void v3d_irq_enable (struct v3d_dev *v3d);void v3d_irq_disable (struct v3d_dev *v3d);void v3d_irq_reset (struct v3d_dev *v3d);
drivers/gpu/drm/v3d/v3d_irq.c +11 -2
@@ -156,7 +156,7 @@ v3d_hub_irq(int irq, void *arg)return status; } -void +int v3d_irq_init (struct v3d_dev *v3d) {int ret, core;
@@ -173,13 +173,22 @@ v3d_irq_init(struct v3d_dev *v3d) ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,0 ), v3d_hub_irq,IRQF_SHARED ,"v3d_hub" , v3d); +if (ret) + goto fail; + ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,1 ), v3d_irq,IRQF_SHARED ,"v3d_core0" , v3d);if (ret) -dev_err (v3d->dev,"IRQ setup failed: %d\n" , ret); + goto fail;v3d_irq_enable (v3d); +return 0 ; + +fail: +if (ret != -EPROBE_DEFER ) +dev_err (v3d->dev,"IRQ setup failed: %d\n" , ret); +return ret; }void
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 326/346 regulator: pv88060: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit f58213637206e190453e3bd91f98f535566290a3 ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/pv88060-regulator.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/regulator/pv88060-regulator.c +4 -0
@@ -276,9 +276,11 @@ static irqreturn_t pv88060_irq_handler(int irq, void *data)if (reg_val &PV88060_E_VDD_FLT ) {for (i =0 ; i <PV88060_MAX_REGULATORS ; i++) {if (chip->rdev[i] !=NULL ) { +regulator_lock (chip->rdev[i]);regulator_notifier_call_chain (chip->rdev[i],REGULATOR_EVENT_UNDER_VOLTAGE ,NULL ); +regulator_unlock (chip->rdev[i]); } }
@@ -293,9 +295,11 @@ static irqreturn_t pv88060_irq_handler(int irq, void *data)if (reg_val &PV88060_E_OVER_TEMP ) {for (i =0 ; i <PV88060_MAX_REGULATORS ; i++) {if (chip->rdev[i] !=NULL ) { +regulator_lock (chip->rdev[i]);regulator_notifier_call_chain (chip->rdev[i],REGULATOR_EVENT_OVER_TEMP ,NULL ); +regulator_unlock (chip->rdev[i]); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 324/346 regulator: ltc3676: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 769fc8d4182c1d1875db7859852afeb436714c5c ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/ltc3676.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/regulator/ltc3676.c +8 -2
@@ -338,17 +338,23 @@ static irqreturn_t ltc3676_isr(int irq, void *dev_id)if (irqstat <C3676_IRQSTAT_THERMAL_WARN ) {dev_warn (dev,"Over-temperature Warning\n" ); event =REGULATOR_EVENT_OVER_TEMP ; -for (i =0 ; i <LTC3676_NUM_REGULATORS ; i++) +for (i =0 ; i <LTC3676_NUM_REGULATORS ; i++) { +regulator_lock (ltc3676->regulators[i]);regulator_notifier_call_chain (ltc3676->regulators[i], event,NULL ); +regulator_unlock (ltc3676->regulators[i]); + } }if (irqstat <C3676_IRQSTAT_UNDERVOLT_WARN ) {dev_info (dev,"Undervoltage Warning\n" ); event =REGULATOR_EVENT_UNDER_VOLTAGE ; -for (i =0 ; i <LTC3676_NUM_REGULATORS ; i++) +for (i =0 ; i <LTC3676_NUM_REGULATORS ; i++) { +regulator_lock (ltc3676->regulators[i]);regulator_notifier_call_chain (ltc3676->regulators[i], event,NULL ); +regulator_unlock (ltc3676->regulators[i]); + } }/* Clear warning condition */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 321/346 spi: rspi: Fix sequencer reset during initialization
In reply to Greg Kroah-Hartman[ Upstream commit 26843bb128590edd7eba1ad7ce22e4b9f1066ce3 ]
While the sequencer is reset after each SPI message since commit 880c6d114fd79a69 ("spi: rspi: Add support for Quad and Dual SPI Transfers on QSPI"), it was never reset for the first message, thus relying on reset state or bootloader settings.
Fix this by initializing it explicitly during configuration.
--- drivers/spi/spi-rspi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/spi/spi-rspi.c +6 -3
@@ -271,7 +271,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size)/* Sets parity, interrupt mask */ rspi_write8 (rspi,0x00 ,RSPI_SPCR2 ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR ); rspi->spcmd |=SPCMD_SPB_8_TO_16 (access_size);rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );
@@ -315,7 +316,8 @@ static int rspi_rz_set_config_register(struct rspi_data *rspi, int access_size)rspi_write8 (rspi,0x00 ,RSPI_SSLND );rspi_write8 (rspi,0x00 ,RSPI_SPND ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR ); rspi->spcmd |=SPCMD_SPB_8_TO_16 (access_size);rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );
@@ -366,7 +368,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size)/* Sets buffer to allow normal operation */ rspi_write8 (rspi,0x00 ,QSPI_SPBFCR ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR );rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );/* Sets RSPI mode */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 317/346 spi : spi-topcliff-pch: Fix to handle empty DMA buffers
In reply to Greg Kroah-Hartman[ Upstream commit f37d8e67f39e6d3eaf4cc5471e8a3d21209843c6 ]
pch_alloc_dma_buf allocated tx, rx DMA buffers which can fail. Further, these buffers are used without a check. The patch checks for these failures and sends the error upstream.
--- drivers/spi/spi-topcliff-pch.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/spi/spi-topcliff-pch.c +13 -2
@@ -1294,18 +1294,27 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat, dma->rx_buf_virt, dma->rx_buf_dma); } -static void pch_alloc_dma_buf (struct pch_spi_board_data *board_dat, +static int pch_alloc_dma_buf (struct pch_spi_board_data *board_dat,struct pch_spi_data *data) {struct pch_spi_dma_ctrl *dma; +int ret; dma = &data->dma; + ret =0 ;/* Get Consistent memory for Tx DMA */ dma->tx_buf_virt =dma_alloc_coherent (&board_dat->pdev->dev,PCH_BUF_SIZE , &dma->tx_buf_dma,GFP_KERNEL ); +if (!dma->tx_buf_virt) + ret = -ENOMEM ; +/* Get Consistent memory for Rx DMA */ dma->rx_buf_virt =dma_alloc_coherent (&board_dat->pdev->dev,PCH_BUF_SIZE , &dma->rx_buf_dma,GFP_KERNEL ); +if (!dma->rx_buf_virt) + ret = -ENOMEM ; + +return ret; }static int pch_spi_pd_probe (struct platform_device *plat_dev)
@@ -1382,7 +1391,9 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)if (use_dma) {dev_info (&plat_dev->dev,"Use DMA for data transfers\n" ); -pch_alloc_dma_buf (board_dat, data); + ret =pch_alloc_dma_buf (board_dat, data); +if (ret) + goto err_spi_register_master; } ret =spi_register_master (master);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 314/346 scsi: lpfc: Fix SLI3 commands being issued on SLI4 devices
In reply to Greg Kroah-Hartman[ Upstream commit c95a3b4b0fb8d351e2329a96f87c4fc96a149505 ]
During debug, it was seen that the driver is issuing commands specific to SLI3 on SLI4 devices. Although the adapter correctly rejected the command, this should not be done.
Revise the code to stop sending these commands on a SLI4 adapter.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +10 -1
@@ -935,7 +935,11 @@ lpfc_linkdown(struct lpfc_hba *phba) } }lpfc_destroy_vport_work_array (phba, vports); -/* Clean up any firmware default rpi's */ + +/* Clean up any SLI3 firmware default rpi's */ +if (phba->sli_rev >LPFC_SLI_REV3 ) + goto skip_unreg_did; + mb =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (mb) {lpfc_unreg_did (phba,0xffff ,LPFC_UNREG_ALL_DFLT_RPIS , mb);
@@ -947,6 +951,7 @@ lpfc_linkdown(struct lpfc_hba *phba) } } + skip_unreg_did:/* Setup myDID for link up if we are in pt2pt mode */ if (phba->pport->fc_flag &FC_PT2PT ) { mb =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );
@@ -4985,6 +4990,10 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport)LPFC_MBOXQ_t *mbox;int rc; +/* Unreg DID is an SLI3 operation. */ +if (phba->sli_rev >LPFC_SLI_REV3 ) +return ; + mbox =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (mbox) { lpfc_unreg_did(phba, vport->vpi, LPFC_UNREG_ALL_DFLT_RPIS,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 299/346 media: m88ds3103: serialize reset messages in m88ds3103_set_frontend
In reply to Greg Kroah-Hartman[ Upstream commit 981fbe3da20a6f35f17977453bce7dfc1664d74f ]
Ref: https://bugzilla.kernel.org/show_bug.cgi?id=199323
Users are experiencing problems with the DVBSky S960/S960C USB devices since the following commit:
9d659ae: ("locking/mutex: Add lock handoff to avoid starvation")
The device malfunctions after running for an indeterminable period of time, and the problem can only be cleared by rebooting the machine.
It is possible to encourage the problem to surface by blocking the signal to the LNB.
Further debugging revealed the cause of the problem.
In the following capture:
- thread #1325 is running m88ds3103_set_frontend
- thread #42 is running ts2020_stat_work
a> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 80
[1325] usb 1-1: dvb_usb_v2_generic_io: <<< 08
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 68 3f
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 08 ff
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 3d
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
b> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 00
[1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 21
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 66
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11 [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07 [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 60 02 10 0b [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
Two i2c messages are sent to perform a reset in m88ds3103_set_frontend:
a. 0x07, 0x80
b. 0x07, 0x00
However, as shown in the capture, the regmap mutex is being handed over to another thread (ts2020_stat_work) in between these two messages.
Quoted 1 line
From here, the device responds to every i2c message with an 07 message,
and will only return to normal operation following a power cycle.
Use regmap_multi_reg_write to group the two reset messages, ensuring both are processed before the regmap mutex is unlocked.
--- drivers/media/dvb-frontends/m88ds3103.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/dvb-frontends/m88ds3103.c +4 -5
@@ -309,6 +309,9 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)u16 u16tmp;u32 tuner_frequency_khz, target_mclk;s32 s32tmp; +static const struct reg_sequence reset_buf[] = { + {0x07 ,0x80 }, {0x07 ,0x00 } + }; dev_dbg(&client->dev, "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n",
@@ -321,11 +324,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) }/* reset */ - ret =regmap_write (dev->regmap,0x07 ,0x80 ); -if (ret) - goto err; - - ret =regmap_write (dev->regmap,0x07 ,0x00 ); + ret =regmap_multi_reg_write (dev->regmap, reset_buf,2 );if (ret) goto err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 296/346 igb: Exclude device from suspend direct complete optimization
In reply to Greg Kroah-Hartman[ Upstream commit 5b6e13216be29ced7350d9c354a1af8fe0ad9a3e ]
igb sets different WoL settings in system suspend callback and runtime suspend callback.
The suspend direct complete optimization leaves igb in runtime suspended state with wrong WoL setting during system suspend.
To fix this, we need to disable suspend direct complete optimization to let igb always use suspend callback to set correct WoL during system suspend.
--- drivers/net/ethernet/intel/igb/igb_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +3 -0
@@ -3467,6 +3467,9 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)break ; } } + +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NEVER_SKIP ); +pm_runtime_put_noidle (&pdev->dev);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 295/346 tinydrm/mipi-dbi: Use dma-safe buffers for all SPI transfers
In reply to Greg Kroah-Hartman[ Upstream commit a89bfc5d9a0732d84b4de311e27133daa0586316 ]
Buffers passed to spi_sync() must be dma-safe even for tiny buffers since some SPI controllers use DMA for all transfers.
Example splat with CONFIG_DMA_API_DEBUG enabled:
[ 23.750467] DMA-API: dw_dmac_pci 0000:00:15.0: device driver maps memory from stack [probable addr=000000001e49185d] [ 23.750529] WARNING: CPU: 1 PID: 1296 at kernel/dma/debug.c:1161 check_for_stack+0xb7/0x190 [ 23.750533] Modules linked in: mmc_block(+) spi_pxa2xx_platform(+) pwm_lpss_pci pwm_lpss spi_pxa2xx_pci sdhci_pci cqhci intel_mrfld_pwrbtn extcon_intel_mrfld sdhci intel_mrfld_adc led_class mmc_core ili9341 mipi_dbi tinydrm backlight ti_ads7950 industrialio_triggered_buffer kfifo_buf intel_soc_pmic_mrfld hci_uart btbcm [ 23.750599] CPU: 1 PID: 1296 Comm: modprobe Not tainted 5.0.0-rc7+ #236 [ 23.750605] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48 [ 23.750620] RIP: 0010:check_for_stack+0xb7/0x190 [ 23.750630] Code: 8b 6d 50 4d 85 ed 75 04 4c 8b 6d 10 48 89 ef e8 2f 8b 44 00 48 89 c6 4a 8d 0c 23 4c 89 ea 48 c7 c7 88 d0 82 b4 e8 40 7c f9 ff <0f> 0b 8b 05 79 00 4b 01 85 c0 74 07 5b 5d 41 5c 41 5d c3 8b 05 54 [ 23.750637] RSP: 0000:ffff97bbc0292fa0 EFLAGS: 00010286 [ 23.750646] RAX: 0000000000000000 RBX: ffff97bbc0290000 RCX: 0000000000000006 [ 23.750652] RDX: 0000000000000007 RSI: 0000000000000002 RDI: ffff94b33e115450 [ 23.750658] RBP: ffff94b33c8578b0 R08: 0000000000000002 R09: 00000000000201c0 [ 23.750664] R10: 00000006ecb0ccc6 R11: 0000000000034f38 R12: 000000000000316c [ 23.750670] R13: ffff94b33c84b250 R14: ffff94b33dedd5a0 R15: 0000000000000001 [ 23.750679] FS: 0000000000000000(0000) GS:ffff94b33e100000(0063) knlGS:00000000f7faf690 [ 23.750686] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 [ 23.750691] CR2: 00000000f7f54faf CR3: 000000000722c000 CR4: 00000000001006e0 [ 23.750696] Call Trace: [ 23.750713] debug_dma_map_sg+0x100/0x340 [ 23.750727] ? dma_direct_map_sg+0x3b/0xb0 [ 23.750739] spi_map_buf+0x25a/0x300 [ 23.750751] __spi_pump_messages+0x2a4/0x680 [ 23.750762] __spi_sync+0x1dd/0x1f0 [ 23.750773] spi_sync+0x26/0x40 [ 23.750790] mipi_dbi_typec3_command_read+0x14d/0x240 [mipi_dbi] [ 23.750802] ? spi_finalize_current_transfer+0x10/0x10 [ 23.750821] mipi_dbi_typec3_command+0x1bc/0x1d0 [mipi_dbi]
--- drivers/gpu/drm/tinydrm/ili9225.c | 6 ++-- drivers/gpu/drm/tinydrm/mipi-dbi.c | 58 +++++++++++++++++++++--------- include/drm/tinydrm/mipi-dbi.h | 5 +-- 3 files changed, 48 insertions(+), 21 deletions(-)
drivers/gpu/drm/tinydrm/ili9225.c +3 -3
@@ -279,7 +279,7 @@ static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe) mipi->enabled = false; } -static int ili9225_dbi_command (struct mipi_dbi *mipi,u8 cmd,u8 *par, +static int ili9225_dbi_command (struct mipi_dbi *mipi,u8 *cmd,u8 *par,size_t num) {struct spi_device *spi = mipi->spi;
@@ -289,11 +289,11 @@ static int ili9225_dbi_command(struct mipi_dbi *mipi, u8 cmd, u8 *par,gpiod_set_value_cansleep (mipi->dc,0 ); speed_hz =mipi_dbi_spi_cmd_max_speed (spi,1 ); - ret =tinydrm_spi_transfer (spi, speed_hz,NULL ,8 , &cmd,1 ); + ret =tinydrm_spi_transfer (spi, speed_hz,NULL ,8 , cmd,1 );if (ret || !num)return ret; -if (cmd ==ILI9225_WRITE_DATA_TO_GRAM && !mipi->swap_bytes) +if (*cmd ==ILI9225_WRITE_DATA_TO_GRAM && !mipi->swap_bytes) bpw =16 ;gpiod_set_value_cansleep (mipi->dc,1 );
drivers/gpu/drm/tinydrm/mipi-dbi.c +42 -16
130 lines not on this page · raw message
include/drm/tinydrm/mipi-dbi.h +3 -2
@@ -42,7 +42,7 @@ struct mipi_dbi {struct spi_device *spi;bool enabled;struct mutex cmdlock; -int (*command)(struct mipi_dbi *mipi,u8 cmd,u8 *param,size_t num); +int (*command)(struct mipi_dbi *mipi,u8 *cmd,u8 *param,size_t num);const u8 *read_commands;struct gpio_desc *dc;u16 *tx_buf;
@@ -79,6 +79,7 @@ u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len);int mipi_dbi_command_read (struct mipi_dbi *mipi,u8 cmd,u8 *val);int mipi_dbi_command_buf (struct mipi_dbi *mipi,u8 cmd,u8 *data,size_t len); +int mipi_dbi_command_stackbuf (struct mipi_dbi *mipi,u8 cmd,u8 *data,size_t len);int mipi_dbi_buf_copy (void *dst,struct drm_framebuffer *fb,struct drm_clip_rect *clip,bool swap);/**
@@ -96,7 +97,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, #define mipi_dbi_command(mipi, cmd, seq...) \ ({ \ u8 d[] = { seq }; \ - mipi_dbi_command_buf(mipi, cmd, d, ARRAY_SIZE(d)); \ + mipi_dbi_command_stackbuf(mipi, cmd, d, ARRAY_SIZE(d)); \ })#ifdef CONFIG_DEBUG_FS
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 298/346 media: dvbsky: Avoid leaking dvb frontend
In reply to Greg Kroah-Hartman[ Upstream commit fdfa59cd63b184e1e96d51ff170fcac739bc6f6f ]
Commit 14f4eaeddabc ("media: dvbsky: fix driver unregister logic") fixed a use-after-free by removing the reference to the frontend after deleting the backing i2c device.
This has the unfortunate side effect the frontend device is never freed in the dvb core leaving a dangling device, leading to errors when the dvb core tries to register the frontend after e.g. a replug as reported
here: https://www.spinics.net/lists/linux-media/msg138181.html
media: dvbsky: issues with DVBSky T680CI
===
[ 561.119145] sp2 8-0040: CIMaX SP2 successfully attached [ 561.119161] usb 2-3: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)... [ 561.119174] sysfs: cannot create duplicate filename '/class/dvb/
dvb0.frontend0'
===
The use after free happened as dvb_usbv2_disconnect calls in this order:
- dvb_usb_device::props->exit(...)
- dvb_usbv2_adapter_frontend_exit(...)
+ if (fe) dvb_unregister_frontend(fe)
+ dvb_usb_device::props->frontend_detach(...)
Moving the release of the i2c device from exit() to frontend_detach() avoids the dangling pointer access and allows the core to unregister the frontend.
This was originally reported for a DVBSky T680CI, but it also affects the MyGica T230C. As all supported devices structure the registration/ unregistration identically, apply the change for all device types.
--- drivers/media/usb/dvb-usb-v2/dvbsky.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/media/usb/dvb-usb-v2/dvbsky.c +10 -8
@@ -615,16 +615,18 @@ static int dvbsky_init(struct dvb_usb_device *d)return 0 ; } -static void dvbsky_exit (struct dvb_usb_device *d) +static int dvbsky_frontend_detach (struct dvb_usb_adapter *adap) { +struct dvb_usb_device *d =adap_to_d (adap);struct dvbsky_state *state =d_to_priv (d); -struct dvb_usb_adapter *adap = &d->adapter[0 ]; + +dev_dbg (&d->udev->dev,"%s: adap=%d\n" , __func__, adap->id);dvb_module_release (state->i2c_client_tuner);dvb_module_release (state->i2c_client_demod);dvb_module_release (state->i2c_client_ci); - adap->fe[0 ] =NULL ; +return 0 ; }/* DVB USB Driver stuff */
@@ -640,11 +642,11 @@ static struct dvb_usb_device_properties dvbsky_s960_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_s960_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .read_mac_address = dvbsky_read_mac_addr, .num_adapters = 1,
@@ -667,11 +669,11 @@ static struct dvb_usb_device_properties dvbsky_s960c_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_s960c_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .read_mac_address = dvbsky_read_mac_addr, .num_adapters = 1,
@@ -694,11 +696,11 @@ static struct dvb_usb_device_properties dvbsky_t680c_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_t680c_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .read_mac_address = dvbsky_read_mac_addr, .num_adapters = 1,
@@ -721,11 +723,11 @@ static struct dvb_usb_device_properties dvbsky_t330_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_t330_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .read_mac_address = dvbsky_read_mac_addr, .num_adapters = 1,
@@ -748,11 +750,11 @@ static struct dvb_usb_device_properties mygica_t230c_props = { .i2c_algo = &dvbsky_i2c_algo, .frontend_attach = dvbsky_mygica_t230c_attach, + .frontend_detach = dvbsky_frontend_detach, .init = dvbsky_init, .get_rc_config = dvbsky_get_rc_config, .streaming_ctrl = dvbsky_streaming_ctrl, .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, .num_adapters = 1, .adapter = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 281/346 batman-adv: allow updating DAT entry timeouts on incoming ARP Replies
In reply to Greg Kroah-Hartman[ Upstream commit 099e6cc1582dc2903fecb898bbeae8f7cf4262c7 ]
Currently incoming ARP Replies, for example via a DHT-PUT message, do not update the timeout for an already existing DAT entry. These ARP Replies are dropped instead.
This however defeats the purpose of the DHCPACK snooping, for instance. Right now, a DAT entry in the DHT will be purged every five minutes, likely leading to a mesh-wide ARP Request broadcast after this timeout. Which then recreates the entry. The idea of the DHCPACK snooping is to be able to update an entry before a timeout happens, to avoid ARP Request flooding.
This patch fixes this issue by updating a DAT entry on incoming ARP Replies even if a matching DAT entry already exists. While still filtering the ARP Reply towards the soft-interface, to avoid duplicate messages on the client device side.
--- net/batman-adv/distributed-arp-table.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/batman-adv/distributed-arp-table.c +3 -1
@@ -1398,7 +1398,6 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, hw_src, &ip_src, hw_dst, &ip_dst, dat_entry->mac_addr, &dat_entry->ip); dropped = true; - goto out; }/* Update our internal cache with both the IP addresses the node got
@@ -1407,6 +1406,9 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,batadv_dat_entry_add (bat_priv, ip_src, hw_src, vid);batadv_dat_entry_add (bat_priv, ip_dst, hw_dst, vid); +if (dropped) + goto out; +/* If BLA is enabled, only forward ARP replies if we have claimed the * source of the ARP reply or if no one else of the same backbone has * already claimed that client. This prevents that different gateways
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 233/346 scsi: ufs: Fix regulator load and icc-level configuration
In reply to Greg Kroah-Hartman[ Upstream commit 0487fff76632ec023d394a05b82e87a971db8c03 ]
Currently if a regulator has "<name>-fixed-regulator" property in device tree, it will skip current limit initialization. This lead to a zero "max_uA" value in struct ufs_vreg.
However, "regulator_set_load" operation shall be required on regulators which have valid current limits, otherwise a zero "max_uA" set by "regulator_set_load" may cause unexpected behavior when this regulator is enabled or set as high power mode.
Similarly, in device's icc_level configuration flow, the target icc_level shall be updated if regulator also has valid current limit, otherwise a wrong icc_level will be calculated by zero "max_uA" and thus causes unexpected results after it is written to device.
--- drivers/scsi/ufs/ufshcd.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufshcd.c +12 -3
@@ -6286,19 +6286,19 @@ static u32 ufshcd_find_max_sup_active_icc_level(struct ufs_hba *hba, goto out; } -if (hba->vreg_info.vcc) +if (hba->vreg_info.vcc && hba->vreg_info.vcc->max_uA) icc_level =ufshcd_get_max_icc_level ( hba->vreg_info.vcc->max_uA,POWER_DESC_MAX_ACTV_ICC_LVLS -1 , &desc_buf[PWR_DESC_ACTIVE_LVLS_VCC_0 ]); -if (hba->vreg_info.vccq) +if (hba->vreg_info.vccq && hba->vreg_info.vccq->max_uA) icc_level =ufshcd_get_max_icc_level ( hba->vreg_info.vccq->max_uA, icc_level, &desc_buf[PWR_DESC_ACTIVE_LVLS_VCCQ_0 ]); -if (hba->vreg_info.vccq2) +if (hba->vreg_info.vccq2 && hba->vreg_info.vccq2->max_uA) icc_level = ufshcd_get_max_icc_level( hba->vreg_info.vccq2->max_uA, icc_level,
@@ -7001,6 +7001,15 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,if (!vreg)return 0 ; +/* +* "set_load" operation shall be required on those regulators +* which specifically configured current limitation. Otherwise +* zero max_uA may cause unexpected behavior when regulator is +* enabled or set as high power mode. +*/ +if (!vreg->max_uA) +return 0 ; + ret =regulator_set_load (vreg->reg, ua);if (ret <0 ) { dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 226/346 b43: shut up clang -Wuninitialized variable warning
In reply to Greg Kroah-Hartman[ Upstream commit d825db346270dbceef83b7b750dbc29f1d7dcc0e ]
Clang warns about what is clearly a case of passing an uninitalized variable into a static function:
drivers/net/wireless/broadcom/b43/phy_lp.c:1852:23: error: variable 'gains' is uninitialized when used here
[-Werror,-Wuninitialized]
lpphy_papd_cal(dev, gains, 0, 1, 30);
^~~~~
drivers/net/wireless/broadcom/b43/phy_lp.c:1838:2: note: variable 'gains' is declared here
struct lpphy_tx_gains gains, oldgains;
^1 error generated.
However, this function is empty, and its arguments are never evaluated, so gcc in contrast does not warn here. Both compilers behave in a reasonable way as far as I can tell, so we should change the code to avoid the warning everywhere.
We could just eliminate the lpphy_papd_cal() function entirely, given that it has had the TODO comment in it for 10 years now and is rather unlikely to ever get done. I'm doing a simpler change here, and just pass the 'oldgains' variable in that has been initialized, based on the guess that this is what was originally meant.
--- drivers/net/wireless/broadcom/b43/phy_lp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/b43/phy_lp.c +3 -3
@@ -1835,7 +1835,7 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains,static void lpphy_papd_cal_txpwr (struct b43_wldev *dev) {struct b43_phy_lp *lpphy = dev->phy.lp; -struct lpphy_tx_gains gains, oldgains; +struct lpphy_tx_gains oldgains;int old_txpctl, old_afe_ovr, old_rf, old_bbmult;lpphy_read_tx_pctl_mode_from_hardware (dev);
@@ -1849,9 +1849,9 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev)lpphy_set_tx_power_control (dev,B43_LPPHY_TXPCTL_OFF );if (dev->dev->chip_id ==0x4325 && dev->dev->chip_rev ==0 ) -lpphy_papd_cal (dev, gains,0 ,1 ,30 ); +lpphy_papd_cal (dev, oldgains,0 ,1 ,30 );else -lpphy_papd_cal (dev, gains,0 ,1 ,65 ); +lpphy_papd_cal (dev, oldgains,0 ,1 ,65 );if (old_afe_ovr)lpphy_set_tx_gains (dev, oldgains);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 219/346 iio: adc: ti-ads7950: Fix improper use of mlock
In reply to Greg Kroah-Hartman[ Upstream commit abbde2792999c9ad3514dd25d7f8d9a96034fe16 ]
Indio->mlock is used for protecting the different iio device modes. It is currently not being used in this way. Replace the lock with an internal lock specifically used for protecting the SPI transfer buffer.
--- drivers/iio/adc/ti-ads7950.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-ads7950.c +15 -4
@@ -56,6 +56,9 @@ struct ti_ads7950_state {struct spi_message ring_msg;struct spi_message scan_single_msg; +/* Lock to protect the spi xfer buffers */ +struct mutex slock; +struct regulator *reg;unsigned int vref_mv;
@@ -268,6 +271,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq, void *p)struct ti_ads7950_state *st =iio_priv (indio_dev);int ret; +mutex_lock (&st->slock); ret =spi_sync (st->spi, &st->ring_msg);if (ret <0 ) goto out;
@@ -276,6 +280,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq, void *p) iio_get_time_ns(indio_dev)); out: +mutex_unlock (&st->slock);iio_trigger_notify_done (indio_dev->trig);return IRQ_HANDLED ;
@@ -286,7 +291,7 @@ static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch)struct ti_ads7950_state *st =iio_priv (indio_dev);int ret, cmd; -mutex_lock (&indio_dev->mlock); +mutex_lock (&st->slock); cmd =TI_ADS7950_CR_WRITE |TI_ADS7950_CR_CHAN (ch) | st->settings; st->single_tx = cmd;
@@ -298,7 +303,7 @@ static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch) ret = st->single_rx; out: -mutex_unlock (&indio_dev->mlock); +mutex_unlock (&st->slock);return ret; }
@@ -432,16 +437,19 @@ static int ti_ads7950_probe(struct spi_device *spi)if (ACPI_COMPANION (&spi->dev)) st->vref_mv =TI_ADS7950_VA_MV_ACPI_DEFAULT ; +mutex_init (&st->slock); + st->reg =devm_regulator_get (&spi->dev,"vref" );if (IS_ERR (st->reg)) {dev_err (&spi->dev,"Failed get get regulator \"vref\"\n" ); -return PTR_ERR (st->reg); + ret =PTR_ERR (st->reg); + goto error_destroy_mutex; } ret =regulator_enable (st->reg);if (ret) {dev_err (&spi->dev,"Failed to enable regulator \"vref\"\n" ); -return ret; + goto error_destroy_mutex; } ret = iio_triggered_buffer_setup(indio_dev, NULL,
@@ -463,6 +471,8 @@ static int ti_ads7950_probe(struct spi_device *spi)iio_triggered_buffer_cleanup (indio_dev); error_disable_reg:regulator_disable (st->reg); +error_destroy_mutex: +mutex_destroy (&st->slock);return ret; }
@@ -475,6 +485,7 @@ static int ti_ads7950_remove(struct spi_device *spi)iio_device_unregister (indio_dev);iio_triggered_buffer_cleanup (indio_dev);regulator_disable (st->reg); +mutex_destroy (&st->slock);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 218/346 iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data
In reply to Greg Kroah-Hartman[ Upstream commit 6f9ca1d3eb74b81f811a87002de2d51640d135b1 ]
When building with -Wsometimes-uninitialized, Clang warns:
drivers/iio/common/ssp_sensors/ssp_iio.c:95:6: warning: variable 'calculated_time' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
While it isn't wrong, this will never be a problem because iio_push_to_buffers_with_timestamp only uses calculated_time on the same condition that it is assigned (when scan_timestamp is not zero). While iio_push_to_buffers_with_timestamp is marked as inline, Clang does inlining in the optimization stage, which happens after the semantic analysis phase (plus inline is merely a hint to the compiler).
Fix this by just zero initializing calculated_time.
--- drivers/iio/common/ssp_sensors/ssp_iio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/ssp_sensors/ssp_iio.c +1 -1
@@ -81,7 +81,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf, unsigned int len, int64_t timestamp) {__le32 time; -int64_t calculated_time; +int64_t calculated_time =0 ;struct ssp_sensor_data *spd =iio_priv (indio_dev);if (indio_dev->scan_bytes ==0 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 216/346 iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion
In reply to Greg Kroah-Hartman[ Upstream commit df1d80aee963480c5c2938c64ec0ac3e4a0df2e0 ]
For devices from the SigmaDelta family we need to keep CS low when doing a conversion, since the device will use the MISO line as a interrupt to indicate that the conversion is complete.
This is why the driver locks the SPI bus and when the SPI bus is locked keeps as long as a conversion is going on. The current implementation gets one small detail wrong though. CS is only de-asserted after the SPI bus is unlocked. This means it is possible for a different SPI device on the same bus to send a message which would be wrongfully be addressed to the SigmaDelta device as well. Make sure that the last SPI transfer that is done while holding the SPI bus lock de-asserts the CS signal.
--- drivers/iio/adc/ad_sigma_delta.c | 16 +++++++++++----- include/linux/iio/adc/ad_sigma_delta.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-)
drivers/iio/adc/ad_sigma_delta.c +11 -5
@@ -62,7 +62,7 @@ int ad_sd_write_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg,struct spi_transfer t = { .tx_buf = data, .len = size +1 , - .cs_change = sigma_delta->bus_locked, + .cs_change = sigma_delta->keep_cs_asserted, };struct spi_message m;int ret;
@@ -218,6 +218,7 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta,spi_bus_lock (sigma_delta->spi->master); sigma_delta->bus_locked = true; + sigma_delta->keep_cs_asserted = true;reinit_completion (&sigma_delta->completion); ret =ad_sigma_delta_set_mode (sigma_delta, mode);
@@ -235,9 +236,10 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, ret =0 ; } out: + sigma_delta->keep_cs_asserted = false; +ad_sigma_delta_set_mode (sigma_delta,AD_SD_MODE_IDLE ); sigma_delta->bus_locked = false;spi_bus_unlock (sigma_delta->spi->master); -ad_sigma_delta_set_mode (sigma_delta,AD_SD_MODE_IDLE );return ret; }
@@ -290,6 +292,7 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev,spi_bus_lock (sigma_delta->spi->master); sigma_delta->bus_locked = true; + sigma_delta->keep_cs_asserted = true;reinit_completion (&sigma_delta->completion);ad_sigma_delta_set_mode (sigma_delta,AD_SD_MODE_SINGLE );
@@ -299,9 +302,6 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, ret =wait_for_completion_interruptible_timeout ( &sigma_delta->completion,HZ ); - sigma_delta->bus_locked = false; -spi_bus_unlock (sigma_delta->spi->master); -if (ret ==0 ) ret = -EIO ;if (ret <0 )
@@ -322,7 +322,10 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, sigma_delta->irq_dis = true; } + sigma_delta->keep_cs_asserted = false;ad_sigma_delta_set_mode (sigma_delta,AD_SD_MODE_IDLE ); + sigma_delta->bus_locked = false; +spi_bus_unlock (sigma_delta->spi->master);mutex_unlock (&indio_dev->mlock);if (ret)
@@ -359,6 +362,8 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev)spi_bus_lock (sigma_delta->spi->master); sigma_delta->bus_locked = true; + sigma_delta->keep_cs_asserted = true; + ret =ad_sigma_delta_set_mode (sigma_delta,AD_SD_MODE_CONTINUOUS );if (ret) goto err_unlock;
@@ -387,6 +392,7 @@ static int ad_sd_buffer_postdisable(struct iio_dev *indio_dev) sigma_delta->irq_dis = true; } + sigma_delta->keep_cs_asserted = false;ad_sigma_delta_set_mode (sigma_delta,AD_SD_MODE_IDLE ); sigma_delta->bus_locked = false;
include/linux/iio/adc/ad_sigma_delta.h +1 -0
@@ -69,6 +69,7 @@ struct ad_sigma_delta {bool irq_dis;bool bus_locked; +bool keep_cs_asserted;uint8_t comm;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 165/346 x86/irq/64: Limit IST stack overflow check to #DB stack
In reply to Greg Kroah-Hartman[ Upstream commit 7dbcf2b0b770eeb803a416ee8dcbef78e6389d40 ]
Commit
37fe6a42b343 ("x86: Check stack overflow in detail")
added a broad check for the full exception stack area, i.e. it considers the full exception stack area as valid.
That's wrong in two aspects:
1) It does not check the individual areas one by one
2) #DF, NMI and #MCE are not enabling interrupts which means that a regular device interrupt cannot happen in their context. In fact if a device interrupt hits one of those IST stacks that's a bug because some code path enabled interrupts while handling the exception.
Limit the check to the #DB stack and consider all other IST stacks as 'overflow' or invalid.
--- arch/x86/kernel/irq_64.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
arch/x86/kernel/irq_64.c +14 -5
@@ -26,9 +26,18 @@ int sysctl_panic_on_stackoverflow;/* * Probabilistic stack overflow check: * -* Only check the stack in process context, because everything else -* runs on the big interrupt stacks. Checking reliably is too expensive, -* so we just check from interrupts. +* Regular device interrupts can enter on the following stacks: +* +* - User stack +* +* - Kernel task stack +* +* - Interrupt stack if a device driver reenables interrupts +* which should only happen in really old drivers. +* +* - Debug IST stack +* +* All other contexts are invalid. */ static inline void stack_overflow_check (struct pt_regs *regs) {
@@ -53,8 +62,8 @@ static inline void stack_overflow_check(struct pt_regs *regs)return ; oist =this_cpu_ptr (&orig_ist); - estack_top = (u64 )oist->ist[0 ] -EXCEPTION_STKSZ +STACK_TOP_MARGIN ; - estack_bottom = (u64 )oist->ist[N_EXCEPTION_STACKS -1 ]; + estack_bottom = (u64 )oist->ist[DEBUG_STACK ]; + estack_top = estack_bottom -DEBUG_STKSZ +STACK_TOP_MARGIN ;if (regs->sp >= estack_top && regs->sp <= estack_bottom)return ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 164/346 USB: core: Dont unbind interfaces following device reset failure
In reply to Greg Kroah-Hartman[ Upstream commit 381419fa720060ba48b7bbc483be787d5b1dca6f ]
The SCSI core does not like to have devices or hosts unregistered while error recovery is in progress. Trying to do so can lead to
self-deadlock: Part of the removal code tries to obtain a lock already held by the error handler.
This can cause problems for the usb-storage and uas drivers, because their error handler routines perform a USB reset, and if the reset fails then the USB core automatically goes on to unbind all drivers from the device's interfaces -- all while still in the context of the SCSI error handler.
As it turns out, practically all the scenarios leading to a USB reset failure end up causing a device disconnect (the main error pathway in usb_reset_and_verify_device(), at the end of the routine, calls hub_port_logical_disconnect() before returning). As a result, the hub_wq thread will soon become aware of the problem and will unbind all the device's drivers in its own context, not in the error-handler's context.
This means that usb_reset_device() does not need to call usb_unbind_and_rebind_marked_interfaces() in cases where usb_reset_and_verify_device() has returned an error, because hub_wq will take care of everything anyway.
This particular problem was observed in somewhat artificial circumstances, by using usbfs to tell a hub to power-down a port connected to a USB-3 mass storage device using the UAS protocol. With the port turned off, the currently executing command timed out and the error handler started running. The USB reset naturally failed, because the hub port was off, and the error handler deadlocked as described above. Not carrying out the call to usb_unbind_and_rebind_marked_interfaces() fixes this issue.
--- drivers/usb/core/hub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +4 -1
@@ -5864,7 +5864,10 @@ int usb_reset_device(struct usb_device *udev) cintf->needs_binding =1 ; } } -usb_unbind_and_rebind_marked_interfaces (udev); + +/* If the reset failed, hub_wq will unbind drivers later */ +if (ret ==0 ) +usb_unbind_and_rebind_marked_interfaces (udev); }usb_autosuspend_device (udev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 202/346 selftests: cgroup: fix cleanup path in test_memcg_subtree_control()
In reply to Greg Kroah-Hartman[ Upstream commit e14d314c7a489f060d6d691866fef5f131281718 ]
Dan reported, that cleanup path in test_memcg_subtree_control() triggers a static checker warning:
./tools/testing/selftests/cgroup/test_memcontrol.c:76 \
test_memcg_subtree_control()
error: uninitialized symbol 'child2'.
Fix this by initializing child2 and parent2 variables and split the cleanup path into few stages.
--- .../selftests/cgroup/test_memcontrol.c | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-)
tools/testing/selftests/cgroup/test_memcontrol.c +21 -17
@@ -26,7 +26,7 @@*/ static int test_memcg_subtree_control (const char *root) { -char *parent, *child, *parent2, *child2; +char *parent, *child, *parent2 =NULL , *child2 =NULL ;int ret =KSFT_FAIL ;char buf[PAGE_SIZE ];
@@ -34,50 +34,54 @@ static int test_memcg_subtree_control(const char *root) parent =cg_name (root,"memcg_test_0" ); child =cg_name (root,"memcg_test_0/memcg_test_1" );if (!parent || !child) - goto cleanup; + goto cleanup_free;if (cg_create (parent)) - goto cleanup; + goto cleanup_free;if (cg_write (parent,"cgroup.subtree_control" ,"+memory" )) - goto cleanup; + goto cleanup_parent;if (cg_create (child)) - goto cleanup; + goto cleanup_parent;if (cg_read_strstr (child,"cgroup.controllers" ,"memory" )) - goto cleanup; + goto cleanup_child;/* Create two nested cgroups without enabling memory controller */ parent2 =cg_name (root,"memcg_test_1" ); child2 =cg_name (root,"memcg_test_1/memcg_test_1" );if (!parent2 || !child2) - goto cleanup; + goto cleanup_free2;if (cg_create (parent2)) - goto cleanup; + goto cleanup_free2;if (cg_create (child2)) - goto cleanup; + goto cleanup_parent2;if (cg_read (child2,"cgroup.controllers" , buf,sizeof (buf))) - goto cleanup; + goto cleanup_all;if (!cg_read_strstr (child2,"cgroup.controllers" ,"memory" )) - goto cleanup; + goto cleanup_all; ret =KSFT_PASS ; -cleanup: -cg_destroy (child); -cg_destroy (parent); -free (parent); -free (child); - +cleanup_all:cg_destroy (child2); +cleanup_parent2:cg_destroy (parent2); +cleanup_free2:free (parent2);free (child2); +cleanup_child: +cg_destroy (child); +cleanup_parent: +cg_destroy (parent); +cleanup_free: +free (parent); +free (child);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 187/346 mmc_spi: add a status check for spi_sync_locked
In reply to Greg Kroah-Hartman[ Upstream commit 611025983b7976df0183390a63a2166411d177f1 ]
In case spi_sync_locked fails, the fix reports the error and returns the error code upstream.
--- drivers/mmc/host/mmc_spi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mmc/host/mmc_spi.c +4 -0
@@ -819,6 +819,10 @@ mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t, } status =spi_sync_locked (spi, &host->m); +if (status <0 ) { +dev_dbg (&spi->dev,"read error %d\n" , status); +return status; + }if (host->dma_dev) { dma_sync_single_for_cpu(host->dma_dev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 180/346 hwmon: (vt1211) Use request_muxed_region for Super-IO accesses
In reply to Greg Kroah-Hartman[ Upstream commit 14b97ba5c20056102b3dd22696bf17b057e60976 ]
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/vt1211.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/hwmon/vt1211.c +12 -3
@@ -226,15 +226,21 @@ static inline void superio_select(int sio_cip, int ldn)outb (ldn, sio_cip +1 ); } -static inline void superio_enter (int sio_cip) +static inline int superio_enter (int sio_cip) { +if (!request_muxed_region (sio_cip,2 ,DRVNAME )) +return -EBUSY ; +outb (0x87 , sio_cip);outb (0x87 , sio_cip); + +return 0 ; }static inline void superio_exit (int sio_cip) {outb (0xaa , sio_cip); +release_region (sio_cip,2 ); }/* ---------------------------------------------------------------------
@@ -1282,11 +1288,14 @@ static int __init vt1211_device_add(unsigned short address)static int __init vt1211_find (int sio_cip,unsigned short *address) { -int err = -ENODEV ; +int err;int devid; -superio_enter (sio_cip); + err =superio_enter (sio_cip); +if (err) +return err; + err = -ENODEV ; devid = force_id ? force_id :superio_inb (sio_cip,SIO_VT1211_DEVID );if (devid !=SIO_VT1211_ID ) goto EXIT;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 179/346 PM / devfreq: Fix static checker warning in try_then_request_governor
In reply to Greg Kroah-Hartman[ Upstream commit b53b0128052ffd687797d5f4deeb76327e7b5711 ]
The patch 23c7b54ca1cd: "PM / devfreq: Fix devfreq_add_device() when drivers are built as modules." leads to the following static checker warning:
drivers/devfreq/devfreq.c:1043 governor_store()
warn: 'governor' can also be NULL
The reason is that the try_then_request_governor() function returns both error pointers and NULL. It should just return error pointers, so fix this by returning a ERR_PTR to the error intead of returning NULL.
--- drivers/devfreq/devfreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/devfreq/devfreq.c +2 -2
@@ -228,7 +228,7 @@ static struct devfreq_governor *find_devfreq_governor(const char *name)* if is not found. This can happen when both drivers (the governor driver * and the driver that call devfreq_add_device) are built as modules. * devfreq_list_lock should be held by the caller. Returns the matched -* governor's pointer. +* governor's pointer or an error pointer. */ static struct devfreq_governor *try_then_request_governor (const char *name) {
@@ -254,7 +254,7 @@ static struct devfreq_governor *try_then_request_governor(const char *name)/* Restore previous state before return */ mutex_lock (&devfreq_list_lock);if (err) -return NULL ; +return ERR_PTR (err); governor =find_devfreq_governor (name); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 178/346 perf/x86/intel/cstate: Add Icelake support
In reply to Greg Kroah-Hartman[ Upstream commit f08c47d1f86c6dc666c7e659d94bf6d4492aa9d7 ]
Icelake uses the same C-state residency events as Sandy Bridge.
--- arch/x86/events/intel/cstate.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/events/intel/cstate.c +2 -0
@@ -584,6 +584,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {X86_CSTATES_MODEL (INTEL_FAM6_ATOM_GOLDMONT_X , glm_cstates),X86_CSTATES_MODEL (INTEL_FAM6_ATOM_GOLDMONT_PLUS , glm_cstates), + +X86_CSTATES_MODEL (INTEL_FAM6_ICELAKE_MOBILE , snb_cstates), { }, };MODULE_DEVICE_TABLE (x86cpu, intel_cstates_match);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 171/346 i40e: Able to add up to 16 MAC filters on an untrusted VF
In reply to Greg Kroah-Hartman[ Upstream commit 06b6e2a2333eb3581567a7ac43ca465ef45f4daa ]
This patch fixes the problem with the driver being able to add only 7 multicast MAC address filters instead of 16. The problem is fixed by changing the maximum number of MAC address filters to 16+1+1 (two extra are needed because the driver uses 1 for unicast MAC address and 1 for broadcast).
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +4 -2
@@ -2449,8 +2449,10 @@ static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg) (u8 *)&stats, sizeof(stats)); } -/* If the VF is not trusted restrict the number of MAC/VLAN it can program */ -#define I40E_VC_MAX_MAC_ADDR_PER_VF 12 +/* If the VF is not trusted restrict the number of MAC/VLAN it can program +* MAC filters: 16 for multicast, 1 for MAC, 1 for broadcast +*/ +#define I40E_VC_MAX_MAC_ADDR_PER_VF (16 + 1 + 1)#define I40E_VC_MAX_VLAN_PER_VF 8/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 172/346 i40e: dont allow changes to HW VLAN stripping on active port VLANs
In reply to Greg Kroah-Hartman[ Upstream commit bfb0ebed53857cfc57f11c63fa3689940d71c1c8 ]
Modifying the VLAN stripping options when a port VLAN is configured will break traffic for the VSI, and conceptually doesn't make sense, so don't allow this.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +8 -0
@@ -2654,6 +2654,10 @@ void i40e_vlan_stripping_enable(struct i40e_vsi *vsi)struct i40e_vsi_context ctxt;i40e_status ret; +/* Don't modify stripping options if a port VLAN is active */ +if (vsi->info.pvid) +return ; +if ((vsi->info.valid_sections &cpu_to_le16 (I40E_AQ_VSI_PROP_VLAN_VALID )) && ((vsi->info.port_vlan_flags &I40E_AQ_VSI_PVLAN_MODE_MASK ) ==0 ))
@@ -2684,6 +2688,10 @@ void i40e_vlan_stripping_disable(struct i40e_vsi *vsi)struct i40e_vsi_context ctxt;i40e_status ret; +/* Don't modify stripping options if a port VLAN is active */ +if (vsi->info.pvid) +return ; + if ((vsi->info.valid_sections & cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) && ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_EMOD_MASK) ==
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 156/346 staging: vc04_services: handle kzalloc failure
In reply to Greg Kroah-Hartman[ Upstream commit a5112277872a56017b777770e2fd4324d4a6c866 ]
The kzalloc here was being used without checking the return - if the kzalloc fails return VCHIQ_ERROR. The call-site of vchiq_platform_init_state() vchiq_init_state() was not responding to an allocation failure so checks for != VCHIQ_SUCCESS and pass VCHIQ_ERROR up to vchiq_platform_init() which then will fail with -EINVAL.
--- .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 3 +++ drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 ++ 2 files changed, 5 insertions(+)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +3 -0
@@ -209,6 +209,9 @@ vchiq_platform_init_state(struct vchiq_state *state)struct vchiq_2835_state *platform_state; state->platform_state =kzalloc (sizeof (*platform_state),GFP_KERNEL ); +if (!state->platform_state) +return VCHIQ_ERROR ; + platform_state = (struct vchiq_2835_state *)state->platform_state; platform_state->inited =1 ;
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +2 -0
@@ -2239,6 +2239,8 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) local->debug[DEBUG_ENTRIES ] =DEBUG_MAX ; status =vchiq_platform_init_state (state); +if (status !=VCHIQ_SUCCESS ) +return VCHIQ_ERROR ;/* bring up slot handler thread
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 147/346 block: fix use-after-free on gendisk
In reply to Greg Kroah-Hartman[ Upstream commit 2c88e3c7ec32d7a40cc7c9b4a487cf90e4671bdd ]
commit 2da78092dda "block: Fix dev_t minor allocation lifetime" specifically moved blk_free_devt(dev->devt) call to part_release() to avoid reallocating device number before the device is fully shutdown.
However, it can cause use-after-free on gendisk in get_gendisk(). We use md device as example to show the race scenes:
Process1 Worker Process2md_free
blkdev_opendel_gendisk
add delete_partition_work_fn() to wq
__blkdev_get get_gendiskput_disk
disk_release
kfree(disk)
find part from ext_devt_idr get_disk_and_module(disk) cause use after free
delete_partition_work_fn put_device(part) part_release
remove part from ext_devt_idr
Before <devt, hd_struct pointer> is removed from ext_devt_idr by delete_partition_work_fn(), we can find the devt and then access gendisk by hd_struct pointer. But, if we access the gendisk after it have been freed, it can cause in use-after-freeon gendisk in get_gendisk().
We fix this by adding a new helper blk_invalidate_devt() in delete_partition() and del_gendisk(). It replaces hd_struct pointer in idr with value 'NULL', and deletes the entry from idr in part_release() as we do now.
Thanks to Jan Kara for providing the solution and more clear comments for the code.
--- block/genhd.c | 19 +++++++++++++++++++ block/partition-generic.c | 7 +++++++ include/linux/genhd.h | 1 + 3 files changed, 27 insertions(+)
block/genhd.c +19 -0
@@ -531,6 +531,18 @@ void blk_free_devt(dev_t devt) } } +/** +* We invalidate devt by assigning NULL pointer for devt in idr. +*/ +void blk_invalidate_devt (dev_t devt) +{ +if (MAJOR (devt) ==BLOCK_EXT_MAJOR ) { +spin_lock_bh (&ext_devt_lock); +idr_replace (&ext_devt_idr,NULL ,blk_mangle_minor (MINOR (devt))); +spin_unlock_bh (&ext_devt_lock); + } +} +static char *bdevt_str (dev_t devt,char *buf) {if (MAJOR (devt) <=0xff &&MINOR (devt) <=0xff ) {
@@ -791,6 +803,13 @@ void del_gendisk(struct gendisk *disk)if (!(disk->flags &GENHD_FL_HIDDEN ))blk_unregister_region (disk_devt (disk), disk->minors); +/* +* Remove gendisk pointer from idr so that it cannot be looked up +* while RCU period before freeing gendisk is running to prevent +* use-after-free issues. Note that the device number stays +* "in-use" until we really free the gendisk. +*/ +blk_invalidate_devt (disk_devt (disk));kobject_put (disk->part0.holder_dir);kobject_put (disk->slave_dir);
block/partition-generic.c +7 -0
@@ -285,6 +285,13 @@ void delete_partition(struct gendisk *disk, int partno)kobject_put (part->holder_dir);device_del (part_to_dev (part)); +/* +* Remove gendisk pointer from idr so that it cannot be looked up +* while RCU period before freeing gendisk is running to prevent +* use-after-free issues. Note that the device number stays +* "in-use" until we really free the gendisk. +*/ +blk_invalidate_devt (part_devt (part));hd_struct_kill (part); }
include/linux/genhd.h +1 -0
@@ -610,6 +610,7 @@ struct unixware_disklabel {extern int blk_alloc_devt (struct hd_struct *part,dev_t *devt);extern void blk_free_devt (dev_t devt); +extern void blk_invalidate_devt (dev_t devt);extern dev_t blk_lookup_devt (const char *name,int partno);extern char *disk_name (struct gendisk *hd,int partno,char *buf);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 148/346 powerpc/numa: improve control of topology updates
In reply to Greg Kroah-Hartman[ Upstream commit 2d4d9b308f8f8dec68f6dbbff18c68ec7c6bd26f ]
When booted with "topology_updates=no", or when "off" is written to /proc/powerpc/topology_updates, NUMA reassignments are inhibited for PRRN and VPHN events. However, migration and suspend unconditionally re-enable reassignments via start_topology_update(). This is incoherent.
Check the topology_updates_enabled flag in start/stop_topology_update() so that callers of those APIs need not be aware of whether reassignments are enabled. This allows the administrative decision on reassignments to remain in force across migrations and suspensions.
--- arch/powerpc/mm/numa.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
arch/powerpc/mm/numa.c +12 -6
@@ -1494,6 +1494,9 @@ int start_topology_update(void) {int rc =0 ; +if (!topology_updates_enabled) +return 0 ; +if (firmware_has_feature (FW_FEATURE_PRRN )) {if (!prrn_enabled) { prrn_enabled =1 ;
@@ -1527,6 +1530,9 @@ int stop_topology_update(void) {int rc =0 ; +if (!topology_updates_enabled) +return 0 ; +if (prrn_enabled) { prrn_enabled =0 ;#ifdef CONFIG_SMP
@@ -1584,11 +1590,13 @@ static ssize_t topology_write(struct file *file, const char __user *buf, kbuf[read_len] ='\0' ; -if (!strncmp (kbuf,"on" ,2 )) +if (!strncmp (kbuf,"on" ,2 )) { + topology_updates_enabled = true;start_topology_update (); -else if (!strncmp (kbuf,"off" ,3 )) + }else if (!strncmp (kbuf,"off" ,3 )) {stop_topology_update (); -else + topology_updates_enabled = false; + }else return -EINVAL ;return count;
@@ -1603,9 +1611,7 @@ static const struct file_operations topology_ops = {static int topology_update_init (void ) { -/* Do not poll for changes if disabled at boot */ -if (topology_updates_enabled) -start_topology_update (); +start_topology_update ();if (vphn_enabled)topology_schedule_update ();
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 113/346 nvme-rdma: fix a NULL deref when an admin connect times out
In reply to Greg Kroah-Hartman[ Upstream commit 1007709d7d06fab09bf2d007657575958676282b ]
If we timeout the admin startup sequence we might not yet have an I/O tagset allocated which causes the teardown sequence to crash. Make nvme_tcp_teardown_io_queues safe by not iterating inflight tags if the tagset wasn't allocated.
--- drivers/nvme/host/rdma.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/nvme/host/rdma.c +6 -4
@@ -922,8 +922,9 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, {blk_mq_quiesce_queue (ctrl->ctrl.admin_q);nvme_rdma_stop_queue (&ctrl->queues[0 ]); -blk_mq_tagset_busy_iter (&ctrl->admin_tag_set, nvme_cancel_request, - &ctrl->ctrl); +if (ctrl->ctrl.admin_tagset) +blk_mq_tagset_busy_iter (ctrl->ctrl.admin_tagset, + nvme_cancel_request, &ctrl->ctrl);blk_mq_unquiesce_queue (ctrl->ctrl.admin_q);nvme_rdma_destroy_admin_queue (ctrl, remove); }
@@ -934,8 +935,9 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,if (ctrl->ctrl.queue_count >1 ) {nvme_stop_queues (&ctrl->ctrl);nvme_rdma_stop_io_queues (ctrl); -blk_mq_tagset_busy_iter (&ctrl->tag_set, nvme_cancel_request, - &ctrl->ctrl); +if (ctrl->ctrl.tagset) +blk_mq_tagset_busy_iter (ctrl->ctrl.tagset, + nvme_cancel_request, &ctrl->ctrl);if (remove)nvme_start_queues (&ctrl->ctrl);nvme_rdma_destroy_io_queues (ctrl, remove);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 112/346 nvme: set 0 capacity if namespace block size exceeds PAGE_SIZE
In reply to Greg Kroah-Hartman[ Upstream commit 01fa017484ad98fccdeaab32db0077c574b6bd6f ]
If our target exposed a namespace with a block size that is greater than PAGE_SIZE, set 0 capacity on the namespace as we do not support it.
This issue encountered when the nvmet namespace was backed by a tempfile.
--- drivers/nvme/host/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +6 -1
@@ -1551,6 +1551,10 @@ static void nvme_update_disk_info(struct gendisk *disk,sector_t capacity =le64_to_cpup (&id->nsze) << (ns->lba_shift -9 );unsigned short bs =1 << ns->lba_shift; +if (ns->lba_shift >PAGE_SHIFT ) { +/* unsupported block size, set capacity to 0 later */ + bs = (1 <<9 ); + }blk_mq_freeze_queue (disk->queue);blk_integrity_unregister (disk);
@@ -1561,7 +1565,8 @@ static void nvme_update_disk_info(struct gendisk *disk,if (ns->ms && !ns->ext && (ns->ctrl->ops->flags &NVME_F_METADATA_SUPPORTED ))nvme_init_integrity (disk, ns->ms, ns->pi_type); -if (ns->ms && !nvme_ns_has_pi (ns) && !blk_get_integrity (disk)) +if ((ns->ms && !nvme_ns_has_pi (ns) && !blk_get_integrity (disk)) || + ns->lba_shift >PAGE_SHIFT ) capacity =0 ;set_capacity (disk, capacity);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 137/346 dmaengine: at_xdmac: remove BUG_ON macro in tasklet
In reply to Greg Kroah-Hartman[ Upstream commit e2c114c06da2d9ffad5b16690abf008d6696f689 ]
Even if this case shouldn't happen when controller is properly programmed, it's still better to avoid dumping a kernel Oops for this.
As the sequence may happen only for debugging purposes, log the error and just finish the tasklet call.
--- drivers/dma/at_xdmac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/dma/at_xdmac.c +5 -1
@@ -1606,7 +1606,11 @@ static void at_xdmac_tasklet(unsigned long data) struct at_xdmac_desc, xfer_node);dev_vdbg (chan2dev (&atchan->chan),"%s: desc 0x%p\n" , __func__, desc); -BUG_ON (!desc->active_xfer); +if (!desc->active_xfer) { +dev_err (chan2dev (&atchan->chan),"Xfer not active: exiting" ); +spin_unlock_bh (&atchan->lock); +return ; + } txd = &desc->tx_dma_desc;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 131/346 HID: logitech-hidpp: use RAP instead of FAP to get the protocol version
In reply to Greg Kroah-Hartman[ Upstream commit 096377525cdb8251e4656085efc988bdf733fb4c ]
According to the logitech_hidpp_2.0_specification_draft_2012-06-04.pdf doc:
https://lekensteyn.nl/files/logitech/logitech_hidpp_2.0_specification_draft_2012-06-04.pdf
We should use a register-access-protocol request using the short input / output report ids. This is necessary because 27MHz HID++ receivers have a max-packetsize on their HIP++ endpoint of 8, so they cannot support long reports. Using a feature-access-protocol request (which is always long or very-long) with these will cause a timeout error, followed by the hidpp driver treating the device as not being HID++ capable.
This commit fixes this by switching to using a rap request to get the protocol version.
Besides being tested with a (046d:c517) 27MHz receiver with various 27MHz keyboards and mice, this has also been tested to not cause regressions on a non-unifying dual-HID++ nano receiver (046d:c534) with k270 and m185 HID++-2.0 devices connected and on a unifying/dj receiver (046d:c52b) with a HID++-2.0 Logitech Rechargeable Touchpad T650.
--- drivers/hid/hid-logitech-hidpp.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/hid/hid-logitech-hidpp.c +13 -4
@@ -836,13 +836,16 @@ static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature,static int hidpp_root_get_protocol_version (struct hidpp_device *hidpp) { +const u8 ping_byte =0x5a ; +u8 ping_data[3 ] = {0 ,0 , ping_byte };struct hidpp_report response;int ret; - ret =hidpp_send_fap_command_sync (hidpp, + ret =hidpp_send_rap_command_sync (hidpp, +REPORT_ID_HIDPP_SHORT ,HIDPP_PAGE_ROOT_IDX ,CMD_ROOT_GET_PROTOCOL_VERSION , -NULL ,0 , &response); + ping_data,sizeof (ping_data), &response);if (ret ==HIDPP_ERROR_INVALID_SUBID ) { hidpp->protocol_major =1 ;
@@ -862,8 +865,14 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)if (ret)return ret; - hidpp->protocol_major = response.fap.params[0 ]; - hidpp->protocol_minor = response.fap.params[1 ]; +if (response.rap.params[2 ] != ping_byte) { +hid_err (hidpp->hid_dev,"%s: ping mismatch 0x%02x != 0x%02x\n" , + __func__, response.rap.params[2 ], ping_byte); +return -EPROTO ; + } + + hidpp->protocol_major = response.rap.params[0 ]; + hidpp->protocol_minor = response.rap.params[1 ];return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 127/346 x86/mm: Remove in_nmi() warning from 64-bit implementation of vmalloc_fault()
In reply to Greg Kroah-Hartman[ Upstream commit a65c88e16f32aa9ef2e8caa68ea5c29bd5eb0ff0 ]
In-NMI warnings have been added to vmalloc_fault() via:
ebc8827f75 ("x86: Barf when vmalloc and kmemcheck faults happen in NMI")
back in the time when our NMI entry code could not cope with nested NMIs.
These days, it's perfectly fine to take a fault in NMI context and we don't have to care about the fact that IRET from the fault handler might cause NMI nesting.
This warning has already been removed from 32-bit implementation of vmalloc_fault() in:
6863ea0cda8 ("x86/mm: Remove in_nmi() warning from vmalloc_fault()")
but the 64-bit version was omitted.
Remove the bogus warning also from 64-bit implementation of vmalloc_fault().
--- arch/x86/mm/fault.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/mm/fault.c +0 -2
@@ -359,8 +359,6 @@ static noinline int vmalloc_fault(unsigned long address)if (!(address >=VMALLOC_START && address <VMALLOC_END ))return -1 ; -WARN_ON_ONCE (in_nmi ()); -/* * Copy kernel mappings over when needed. This can also * happen within a race in page table update. In the later
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 126/346 x86/uaccess: Dont leak the AC flag into __put_user() argument evaluation
In reply to Greg Kroah-Hartman[ Upstream commit 6ae865615fc43d014da2fd1f1bba7e81ee622d1b ]
The __put_user() macro evaluates it's @ptr argument inside the __uaccess_begin() / __uaccess_end() region. While this would normally not be expected to be an issue, an UBSAN bug (it ignored -fwrapv, fixed in GCC 8+) would transform the @ptr evaluation for:
drivers/gpu/drm/i915/i915_gem_execbuffer.c: if (unlikely(__put_user(offset, &urelocs[r-stack].presumed_offset))) {into a signed-overflow-UB check and trigger the objtool AC validation.
Finish this commit:
2a418cf3f5f1 ("x86/uaccess: Don't leak the AC flag into __put_user() value evaluation")
and explicitly evaluate all 3 arguments early.
--- arch/x86/include/asm/uaccess.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/include/asm/uaccess.h +4 -3
@@ -431,10 +431,11 @@ do { \ ({ \ __label__ __pu_label; \ int __pu_err = -EFAULT; \ - __typeof__(*(ptr)) __pu_val; \ - __pu_val = x; \ + __typeof__(*(ptr)) __pu_val = (x); \ + __typeof__(ptr) __pu_ptr = (ptr); \ + __typeof__(size) __pu_size = (size); \ __uaccess_begin(); \ - __put_user_size(__pu_val, (ptr), (size), __pu_label); \ + __put_user_size(__pu_val, __pu_ptr, __pu_size, __pu_label); \ __pu_err = 0; \ __pu_label: \ __uaccess_end(); \
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 69/346 powerpc/perf: Fix loop exit condition in nest_imc_event_init
In reply to Greg Kroah-Hartman[ Upstream commit 860b7d2286236170a36f94946d03ca9888d32571 ]
The data structure (i.e struct imc_mem_info) to hold the memory address information for nest imc units is allocated based on the number of nodes in the system.
nest_imc_event_init() traverse this struct array to calculate the memory base address for the event-cpu. If we fail to find a match for the event cpu's chip-id in imc_mem_info struct array, then the do-while loop will iterate until we crash.
Fix this by changing the loop exit condition based on the number of non zero vbase elements in the array, since the allocation is done for nr_chips + 1.
--- arch/powerpc/perf/imc-pmu.c | 2 +- arch/powerpc/platforms/powernv/opal-imc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/perf/imc-pmu.c +1 -1
@@ -508,7 +508,7 @@ static int nest_imc_event_init(struct perf_event *event)break ; } pcni++; - }while (pcni); + }while (pcni->vbase !=0 );if (!flag)return -ENODEV ;
arch/powerpc/platforms/powernv/opal-imc.c +1 -1
@@ -127,7 +127,7 @@ static int imc_get_mem_addr_nest(struct device_node *node, nr_chips)) goto error; - pmu_ptr->mem_info =kcalloc (nr_chips,sizeof (*pmu_ptr->mem_info), + pmu_ptr->mem_info =kcalloc (nr_chips +1 ,sizeof (*pmu_ptr->mem_info),GFP_KERNEL );if (!pmu_ptr->mem_info) goto error;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 104/346 mac80211/cfg80211: update bss channel on channel switch
In reply to Greg Kroah-Hartman[ Upstream commit 5dc8cdce1d722c733f8c7af14c5fb595cfedbfa8 ]
FullMAC STAs have no way to update bss channel after CSA channel switch completion. As a result, user-space tools may provide inconsistent channel info. For instance, consider the following two commands:
$ sudo iw dev wlan0 link $ sudo iw dev wlan0 info The latter command gets channel info from the hardware, so most probably its output will be correct. However the former command gets channel info from scan cache, so its output will contain outdated channel info. In fact, current bss channel info will not be updated until the next [re-]connect.
Note that mac80211 STAs have a workaround for this, but it requires access to internal cfg80211 data, see ieee80211_chswitch_work:
/* XXX: shouldn't really modify cfg80211-owned data! */ ifmgd->associated->channel = sdata->csa_chandef.chan;
This patch suggests to convert mac80211 workaround into cfg80211 behavior and to update current bss channel in cfg80211_ch_switch_notify.
--- net/mac80211/mlme.c | 3 --- net/wireless/nl80211.c | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-)
net/mac80211/mlme.c +0 -3
@@ -1167,9 +1167,6 @@ static void ieee80211_chswitch_work(struct work_struct *work) goto out; } -/* XXX: shouldn't really modify cfg80211-owned data! */ - ifmgd->associated->channel = sdata->csa_chandef.chan; - ifmgd->csa_waiting_bcn = true;ieee80211_sta_reset_beacon_monitor (sdata);
net/wireless/nl80211.c +5 -0
@@ -15667,6 +15667,11 @@ void cfg80211_ch_switch_notify(struct net_device *dev, wdev->chandef = *chandef; wdev->preset_chandef = *chandef; + +if (wdev->iftype ==NL80211_IFTYPE_STATION && + !WARN_ON (!wdev->current_bss)) + wdev->current_bss->pub.channel = chandef->chan; +nl80211_ch_switch_notify (rdev, dev, chandef,GFP_KERNEL ,NL80211_CMD_CH_SWITCH_NOTIFY ,0 ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 99/346 net: hns3: fix for TX clean num when cleaning TX BD
In reply to Greg Kroah-Hartman[ Upstream commit 63380a1ae4ced8aef67659ff9547c69ef8b9613a ]
hns3_desc_unused() returns how many BD have been cleaned, but new buffer has not been attached to them. The register of HNS3_RING_RX_RING_FBDNUM_REG returns how many BD need allocating new buffer to or need to cleaned. So the remaining BD need to be clean is HNS3_RING_RX_RING_FBDNUM_REG - hns3_desc_unused().
Also, new buffer can not attach to the pending BD when the last BD is not handled, because memcpy has not been done on the first pending BD.
This patch fixes by subtracting the pending BD num from unused_count after 'HNS3_RING_RX_RING_FBDNUM_REG - unused_count' is used to calculate the BD bum need to be clean.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +2 -1
@@ -2708,7 +2708,7 @@ int hns3_clean_rx_ring(#define RCB_NOF_ALLOC_RX_BUFF_ONCE 16struct net_device *netdev = ring->tqp->handle->kinfo.netdev;int recv_pkts, recv_bds, clean_count, err; -int unused_count =hns3_desc_unused (ring) - ring->pending_buf; +int unused_count =hns3_desc_unused (ring);struct sk_buff *skb = ring->skb;int num;
@@ -2717,6 +2717,7 @@ int hns3_clean_rx_ring( recv_pkts =0 , recv_bds =0 , clean_count =0 ; num -= unused_count; + unused_count -= ring->pending_buf;while (recv_pkts < budget && recv_bds < num) {/* Reuse or realloc buffers */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 88/346 btrfs: fix panic during relocation after ENOSPC before writeback happens
In reply to Greg Kroah-Hartman[ Upstream commit ff612ba7849964b1898fd3ccd1f56941129c6aab ]
We've been seeing the following sporadically throughout our fleet
panic: kernel BUG at fs/btrfs/relocation.c:4584!
netversion: 5.0-0
Backtrace:
#0 [ffffc90003adb880] machine_kexec at ffffffff81041da8
#1 [ffffc90003adb8c8] __crash_kexec at ffffffff8110396c
#2 [ffffc90003adb988] crash_kexec at ffffffff811048ad
#3 [ffffc90003adb9a0] oops_end at ffffffff8101c19a
#4 [ffffc90003adb9c0] do_trap at ffffffff81019114
#5 [ffffc90003adba00] do_error_trap at ffffffff810195d0
#6 [ffffc90003adbab0] invalid_op at ffffffff81a00a9b
[exception RIP: btrfs_reloc_cow_block+692]
RIP: ffffffff8143b614 RSP: ffffc90003adbb68 RFLAGS: 00010246
RAX: fffffffffffffff7 RBX: ffff8806b9c32000 RCX: ffff8806aad00690
RDX: ffff880850b295e0 RSI: ffff8806b9c32000 RDI: ffff88084f205bd0
RBP: ffff880849415000 R8: ffffc90003adbbe0 R9: ffff88085ac90000
R10: ffff8805f7369140 R11: 0000000000000000 R12: ffff880850b295e0
R13: ffff88084f205bd0 R14: 0000000000000000 R15: 0000000000000000
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#7 [ffffc90003adbbb0] __btrfs_cow_block at ffffffff813bf1cd
#8 [ffffc90003adbc28] btrfs_cow_block at ffffffff813bf4b3
#9 [ffffc90003adbc78] btrfs_search_slot at ffffffff813c2e6cThe way relocation moves data extents is by creating a reloc inode and preallocating extents in this inode and then copying the data into these preallocated extents. Once we've done this for all of our extents, we'll write out these dirty pages, which marks the extent written, and goes into btrfs_reloc_cow_block(). From here we get our current reloc_control, which _should_ match the reloc_control for the current block group we're relocating.
However if we get an ENOSPC in this path at some point we'll bail out, never initiating writeback on this inode. Not a huge deal, unless we happen to be doing relocation on a different block group, and this block group is now rc->stage == UPDATE_DATA_PTRS. This trips the BUG_ON() in btrfs_reloc_cow_block(), because we expect to be done modifying the data inode. We are in fact done modifying the metadata for the data inode we're currently using, but not the one from the failed block group, and thus we BUG_ON().
(This happens when writeback finishes for extents from the previous group, when we are at btrfs_finish_ordered_io() which updates the data reloc tree (inode item, drops/adds extent items, etc).)
Fix this by writing out the reloc data inode always, and then breaking out of the loop after that point to keep from tripping this BUG_ON() later.
--- fs/btrfs/relocation.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
fs/btrfs/relocation.c +20 -11
@@ -4271,27 +4271,36 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)mutex_lock (&fs_info->cleaner_mutex); ret =relocate_block_group (rc);mutex_unlock (&fs_info->cleaner_mutex); -if (ret <0 ) { +if (ret <0 ) err = ret; - goto out; - } - -if (rc->extents_found ==0 ) -break ; - -btrfs_info (fs_info,"found %llu extents" , rc->extents_found); +/* +* We may have gotten ENOSPC after we already dirtied some +* extents. If writeout happens while we're relocating a +* different block group we could end up hitting the +* BUG_ON(rc->stage == UPDATE_DATA_PTRS) in +* btrfs_reloc_cow_block. Make sure we write everything out +* properly so we don't trip over this problem, and then break +* out of the loop if we hit an error. +*/ if (rc->stage ==MOVE_DATA_EXTENTS && rc->found_file_extent) { ret =btrfs_wait_ordered_range (rc->data_inode,0 , (u64)-1 ); -if (ret) { +if (ret) err = ret; - goto out; - }invalidate_mapping_pages (rc->data_inode->i_mapping,0 ,-1 ); rc->stage =UPDATE_DATA_PTRS ; } + +if (err <0 ) + goto out; + +if (rc->extents_found ==0 ) +break ; + +btrfs_info (fs_info,"found %llu extents" , rc->extents_found); + }WARN_ON (rc->block_group->pinned >0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 45/346 NFS: make nfs_match_client killable
In reply to Greg Kroah-Hartman[ Upstream commit 950a578c6128c2886e295b9c7ecb0b6b22fcc92b ]
Actually we don't do anything with return value from nfs_wait_client_init_complete in nfs_match_client, as a consequence if we get a fatal signal and client is not fully initialised, we'll loop to "again" label
This has been proven to cause soft lockups on some scenarios (no-carrier but configured network interfaces)
--- fs/nfs/client.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/nfs/client.c +6 -1
@@ -284,6 +284,7 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *datstruct nfs_client *clp;const struct sockaddr *sap = data->addr;struct nfs_net *nn =net_generic (data->net, nfs_net_id); +int error; again:list_for_each_entry (clp, &nn->nfs_client_list, cl_share_link) {
@@ -296,8 +297,10 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *datif (clp->cl_cons_state >NFS_CS_READY ) {refcount_inc (&clp->cl_count);spin_unlock (&nn->nfs_client_lock); -nfs_wait_client_init_complete (clp); + error =nfs_wait_client_init_complete (clp);nfs_put_client (clp); +if (error <0 ) +return ERR_PTR (error);spin_lock (&nn->nfs_client_lock); goto again; }
@@ -407,6 +410,8 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init) clp =nfs_match_client (cl_init);if (clp) {spin_unlock (&nn->nfs_client_lock); +if (IS_ERR (clp)) +return clp;if (new) new->rpc_ops->free_client (new);return nfs_found_client (cl_init, clp);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 309/346 media: vim2m: replace devm_kzalloc by kzalloc
In reply to Greg Kroah-Hartman[ Upstream commit ea6c7e34f3b28e165988aa7391310752969842e8 ]
It is not possible to use devm_kzalloc since that memory is freed immediately when the device instance is unbound.
Various objects like the video device may still be in use since someone has the device node open, and when that is closed it expects the memory to be around.
So use kzalloc and release it at the appropriate time.
--- drivers/media/platform/vim2m.c | 35 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-)
drivers/media/platform/vim2m.c +22 -13
@@ -984,6 +984,15 @@ static int vim2m_release(struct file *file)return 0 ; } +static void vim2m_device_release (struct video_device *vdev) +{ + struct vim2m_dev *dev = container_of(vdev, struct vim2m_dev, vfd); + +v4l2_device_unregister (&dev->v4l2_dev); +v4l2_m2m_release (dev->m2m_dev); +kfree (dev); +} +static const struct v4l2_file_operations vim2m_fops = { .owner =THIS_MODULE , .open = vim2m_open,
@@ -999,7 +1008,7 @@ static const struct video_device vim2m_videodev = { .fops = &vim2m_fops, .ioctl_ops = &vim2m_ioctl_ops, .minor = -1, - .release = video_device_release_empty, + .release = vim2m_device_release, .device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING, };
@@ -1020,7 +1029,7 @@ static int vim2m_probe(struct platform_device *pdev)struct video_device *vfd;int ret; - dev =devm_kzalloc (&pdev->dev,sizeof (*dev),GFP_KERNEL ); + dev =kzalloc (sizeof (*dev),GFP_KERNEL );if (!dev)return -ENOMEM ;
@@ -1028,7 +1037,7 @@ static int vim2m_probe(struct platform_device *pdev) ret =v4l2_device_register (&pdev->dev, &dev->v4l2_dev);if (ret) -return ret; + goto error_free;atomic_set (&dev->num_inst,0 );mutex_init (&dev->dev_mutex);
@@ -1042,7 +1051,7 @@ static int vim2m_probe(struct platform_device *pdev) ret =video_register_device (vfd,VFL_TYPE_GRABBER ,0 );if (ret) {v4l2_err (&dev->v4l2_dev,"Failed to register video device\n" ); - goto unreg_v4l2; + goto error_v4l2; }video_set_drvdata (vfd, dev);
@@ -1055,7 +1064,7 @@ static int vim2m_probe(struct platform_device *pdev)if (IS_ERR (dev->m2m_dev)) {v4l2_err (&dev->v4l2_dev,"Failed to init mem2mem device\n" ); ret =PTR_ERR (dev->m2m_dev); - goto unreg_dev; + goto error_dev; }#ifdef CONFIG_MEDIA_CONTROLLER
@@ -1069,27 +1078,29 @@ static int vim2m_probe(struct platform_device *pdev) vfd, MEDIA_ENT_F_PROC_VIDEO_SCALER);if (ret) {v4l2_err (&dev->v4l2_dev,"Failed to init mem2mem media controller\n" ); - goto unreg_m2m; + goto error_m2m; } ret =media_device_register (&dev->mdev);if (ret) {v4l2_err (&dev->v4l2_dev,"Failed to register mem2mem media device\n" ); - goto unreg_m2m_mc; + goto error_m2m_mc; }#endif return 0 ;#ifdef CONFIG_MEDIA_CONTROLLER -unreg_m2m_mc: +error_m2m_mc:v4l2_m2m_unregister_media_controller (dev->m2m_dev); -unreg_m2m: +error_m2m:v4l2_m2m_release (dev->m2m_dev);#endif -unreg_dev: +error_dev:video_unregister_device (&dev->vfd); -unreg_v4l2: +error_v4l2:v4l2_device_unregister (&dev->v4l2_dev); +error_free: +kfree (dev);return ret; }
@@ -1105,9 +1116,7 @@ static int vim2m_remove(struct platform_device *pdev)v4l2_m2m_unregister_media_controller (dev->m2m_dev);media_device_cleanup (&dev->mdev);#endif -v4l2_m2m_release (dev->m2m_dev);video_unregister_device (&dev->vfd); -v4l2_device_unregister (&dev->v4l2_dev);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 311/346 scsi: lpfc: Fix FDMI manufacturer attribute value
In reply to Greg Kroah-Hartman[ Upstream commit d67f935b79a76ac9d86dde1a27bdd413feb5d987 ]
The FDMI manufacturer value being reported on Linux is inconsistent with other OS's.
Set the value to "Emulex Corporation" for consistency.
--- drivers/scsi/lpfc/lpfc_ct.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_ct.c +4 -1
@@ -2005,8 +2005,11 @@ lpfc_fdmi_hba_attr_manufacturer(struct lpfc_vport *vport, ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue;memset (ae,0 ,256 ); +/* This string MUST be consistent with other FC platforms +* supported by Broadcom. +*/ strncpy (ae->un.AttrString, -"Broadcom Inc." , +"Emulex Corporation" ,sizeof (ae->un.AttrString)); len =strnlen (ae->un.AttrString,sizeof (ae->un.AttrString));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 302/346 drm/amd/display: Fix Divide by 0 in memory calculations
In reply to Greg Kroah-Hartman[ Upstream commit 59979bf8be1784ebfc44215031c6c88ca22ae65d ]
Check if we get any values equal to 0, and set to 1 if so.
--- .../drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c +15 -5
@@ -406,15 +406,25 @@ void dpp1_dscl_calc_lb_num_partitions(int *num_part_y, int *num_part_c) { + int lb_memory_size, lb_memory_size_c, lb_memory_size_a, num_partitions_a, + lb_bpc, memory_line_size_y, memory_line_size_c, memory_line_size_a; +int line_size = scl_data->viewport.width < scl_data->recout.width ? scl_data->viewport.width : scl_data->recout.width;int line_size_c = scl_data->viewport_c.width < scl_data->recout.width ? scl_data->viewport_c.width : scl_data->recout.width; -int lb_bpc =dpp1_dscl_get_lb_depth_bpc (scl_data->lb_params.depth); -int memory_line_size_y = (line_size * lb_bpc +71 ) /72 ;/* +71 to ceil */ -int memory_line_size_c = (line_size_c * lb_bpc +71 ) /72 ;/* +71 to ceil */ -int memory_line_size_a = (line_size +5 ) /6 ;/* +5 to ceil */ -int lb_memory_size, lb_memory_size_c, lb_memory_size_a, num_partitions_a; + +if (line_size ==0 ) + line_size =1 ; + +if (line_size_c ==0 ) + line_size_c =1 ; + + + lb_bpc =dpp1_dscl_get_lb_depth_bpc (scl_data->lb_params.depth); + memory_line_size_y = (line_size * lb_bpc +71 ) /72 ;/* +71 to ceil */ + memory_line_size_c = (line_size_c * lb_bpc +71 ) /72 ;/* +71 to ceil */ + memory_line_size_a = (line_size +5 ) /6 ;/* +5 to ceil */ if (lb_config ==LB_MEMORY_CONFIG_1 ) { lb_memory_size =816 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 310/346 media: cedrus: Add a quirk for not setting DMA offset
In reply to Greg Kroah-Hartman[ Upstream commit 70a4f5cda82f7197c350099b66fd23506620810e ]
H6 VPU doesn't work if DMA offset is set.
Add a quirk for it.
--- drivers/staging/media/sunxi/cedrus/cedrus.h | 3 +++ drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/staging/media/sunxi/cedrus/cedrus.h +3 -0
@@ -28,6 +28,8 @@#define CEDRUS_CAPABILITY_UNTILED BIT(0) +#define CEDRUS_QUIRK_NO_DMA_OFFSET BIT(0) +enum cedrus_codec {CEDRUS_CODEC_MPEG2 ,
@@ -91,6 +93,7 @@ struct cedrus_dec_ops {struct cedrus_variant {unsigned int capabilities; +unsigned int quirks; };struct cedrus_dev {
drivers/staging/media/sunxi/cedrus/cedrus_hw.c +2 -1
@@ -177,7 +177,8 @@ int cedrus_hw_probe(struct cedrus_dev *dev)*/ #ifdef PHYS_PFN_OFFSET - dev->dev->dma_pfn_offset =PHYS_PFN_OFFSET ; +if (!(variant->quirks &CEDRUS_QUIRK_NO_DMA_OFFSET )) + dev->dev->dma_pfn_offset =PHYS_PFN_OFFSET ;#endif ret =of_reserved_mem_device_init (dev->dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 307/346 media: go7007: avoid clang frame overflow warning with KASAN
In reply to Greg Kroah-Hartman[ Upstream commit ed713a4a1367aca5c0f2f329579465db00c17995 ]
clang-8 warns about one function here when KASAN is enabled, even without the 'asan-stack' option:
drivers/media/usb/go7007/go7007-fw.c:1551:5: warning: stack frame size of 2656 bytes in function
I have reported this issue in the llvm bugzilla, but to make it work with the clang-8 release, a small annotation is still needed.
--- drivers/media/usb/go7007/go7007-fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/go7007/go7007-fw.c +2 -2
@@ -1499,8 +1499,8 @@ static int modet_to_package(struct go7007 *go, __le16 *code, int space)return cnt; } -static int do_special (struct go7007 *go,u16 type,__le16 *code,int space, -int *framelen) +static noinline_for_stack int do_special(struct go7007 *go, u16 type, +__le16 *code,int space,int *framelen) {switch (type) {case SPECIAL_FRM_HEAD :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 308/346 media: vimc: zero the media_device on probe
In reply to Greg Kroah-Hartman[ Upstream commit f74267b51cb36321f777807b2e04ca02167ecc08 ]
The media_device is part of a static global vimc_device struct. The media framework expects this to be zeroed before it is used, however, since this is a global this is not the case if vimc is unbound and then bound again.
So call memset to ensure any left-over values are cleared.
--- drivers/media/platform/vimc/vimc-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/vimc/vimc-core.c +2 -0
@@ -303,6 +303,8 @@ static int vimc_probe(struct platform_device *pdev)dev_dbg (&pdev->dev,"probe" ); +memset (&vimc->mdev,0 ,sizeof (vimc->mdev)); +/* Create platform_device for each entity in the topology*/ vimc->subdevs =devm_kcalloc (&vimc->pdev.dev, vimc->pipe_cfg->num_ents,sizeof (*vimc->subdevs),GFP_KERNEL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 344/346 ice: Put __ICE_PREPARED_FOR_RESET check in ice_prepare_for_reset
In reply to Greg Kroah-Hartman[ Upstream commit 5abac9d7e1bb9a373673811154774d4c89a7f85e ]
Currently we check if the __ICE_PREPARED_FOR_RESET bit is set prior to calling ice_prepare_for_reset in ice_reset_subtask(), but we aren't checking that bit in ice_do_reset() before calling ice_prepare_for_reset(). This is not consistent and can cause issues if ice_prepare_for_reset() is called prior to ice_do_reset(). Fix this by checking if the __ICE_PREPARED_FOR_RESET bit is set internal to ice_prepare_for_reset().
--- drivers/net/ethernet/intel/ice/ice_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +5 -2
@@ -342,6 +342,10 @@ ice_prepare_for_reset(struct ice_pf *pf) {struct ice_hw *hw = &pf->hw; +/* already prepared for reset */ +if (test_bit (__ICE_PREPARED_FOR_RESET, pf->state)) +return ; +/* Notify VFs of impending reset */ if (ice_check_sq_alive (hw, &hw->mailboxq))ice_vc_notify_reset (pf);
@@ -424,8 +428,7 @@ static void ice_reset_subtask(struct ice_pf *pf)/* return if no valid reset type requested */ if (reset_type ==ICE_RESET_INVAL )return ; -if (!test_bit (__ICE_PREPARED_FOR_RESET, pf->state)) -ice_prepare_for_reset (pf); +ice_prepare_for_reset (pf);/* make sure we are ready to rebuild */ if (ice_check_reset (&pf->hw)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 342/346 drm/sun4i: dsi: Change the start delay calculation
In reply to Greg Kroah-Hartman[ Upstream commit da676c6aa6413d59ab0a80c97bbc273025e640b2 ]
The current calculation for the video start delay in the current DSI driver is that it is the total vertical size, minus the front porch and sync length, plus 1. This equals to the active vertical size plus the back porch plus 1.
That 1 is coming in the Allwinner BSP from an variable that is set to 1. However, if we look at the Allwinner BSP more closely, and especially in the "legacy" code for the display (in drivers/video/sunxi/legacy/), we can see that this variable is actually computed from the porches and the sync minus 10, clamped between 8 and 100.
This fixes the start delay symptom we've seen on some panels (vblank timeouts with vertical white stripes at the bottom of the panel).
--- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +3 -1
@@ -357,7 +357,9 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,static u16 sun6i_dsi_get_video_start_delay (struct sun6i_dsi *dsi,struct drm_display_mode *mode) { -return mode->vtotal - (mode->vsync_end - mode->vdisplay) +1 ; +u16 start =clamp (mode->vtotal - mode->vdisplay -10 ,8 ,100 ); + +return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; } static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/346 ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit b2c01aab9646ed8ffb7c549afe55d5349c482425 upstream.
Syzkaller report this:
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN PTI CPU: 0 PID: 4492 Comm: syz-executor.0 Not tainted 5.0.0-rc7+ #45 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 RIP: 0010:sysfs_remove_file_ns+0x27/0x70 fs/sysfs/file.c:468 Code: 00 00 00 41 54 55 48 89 fd 53 49 89 d4 48 89 f3 e8 ee 76 9c ff 48 8d 7d 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 75 2d 48 89 da 48 b8 00 00 00 00 00 fc ff df 48 8b 6d RSP: 0018:ffff8881e9d9fc00 EFLAGS: 00010206 RAX: dffffc0000000000 RBX: ffffffff900367e0 RCX: ffffffff81a95952 RDX: 0000000000000006 RSI: ffffc90001405000 RDI: 0000000000000030 RBP: 0000000000000000 R08: fffffbfff1fa22ed R09: fffffbfff1fa22ed R10: 0000000000000001 R11: fffffbfff1fa22ec R12: 0000000000000000 R13: ffffffffc1abdac0 R14: 1ffff1103d3b3f8b R15: 0000000000000000 FS: 00007fe409dc1700(0000) GS:ffff8881f1200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b2d721000 CR3: 00000001e98b6005 CR4: 00000000007606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: sysfs_remove_file include/linux/sysfs.h:519 [inline] driver_remove_file+0x40/0x50 drivers/base/driver.c:122 pcmcia_remove_newid_file drivers/pcmcia/ds.c:163 [inline] pcmcia_unregister_driver+0x7d/0x2b0 drivers/pcmcia/ds.c:209 ssb_modexit+0xa/0x1b [ssb] __do_sys_delete_module kernel/module.c:1018 [inline] __se_sys_delete_module kernel/module.c:961 [inline] __x64_sys_delete_module+0x3dc/0x5e0 kernel/module.c:961 do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x462e99 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe409dc0c58 EFLAGS: 00000246 ORIG_RAX: 00000000000000b0 RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200000c0 RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe409dc16bc R13: 00000000004bccaa R14: 00000000006f6bc8 R15: 00000000ffffffff Modules linked in: ssb(-) 3c59x nvme_core macvlan tap pata_hpt3x3 rt2x00pci null_blk tsc40 pm_notifier_error_inject notifier_error_inject mdio cdc_wdm nf_reject_ipv4 ath9k_common ath9k_hw ath pppox ppp_generic slhc ehci_platform wl12xx wlcore tps6507x_ts ioc4 nf_synproxy_core ide_gd_mod ax25 can_dev iwlwifi can_raw atm tm2_touchkey can_gw can sundance adp5588_keys rt2800mmio rt2800lib rt2x00mmio rt2x00lib eeprom_93cx6 pn533 lru_cache elants_i2c ip_set nfnetlink gameport tipc hampshire nhc_ipv6 nhc_hop nhc_udp nhc_fragment nhc_routing nhc_mobility nhc_dest 6lowpan silead brcmutil nfc mt76_usb mt76 mac80211 iptable_security iptable_raw iptable_mangle iptable_nat nf_nat_ipv4 nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter bpfilter ip6_vti ip_gre sit hsr veth vxcan batman_adv cfg80211 rfkill chnl_net caif nlmon vcan bridge stp llc ip6_gre ip6_tunnel tunnel6 tun joydev mousedev serio_raw ide_pci_generic piix floppy ide_core sch_fq_codel ip_tables x_tables ipv6 [last unloaded: 3c59x] Dumping ftrace buffer: (ftrace buffer empty) ---[ end trace 3913cbf8011e1c05 ]---
In ssb_modinit, it does not fail SSB init when ssb_host_pcmcia_init failed, however in ssb_modexit, ssb_host_pcmcia_exit calls pcmcia_unregister_driver unconditionally, which may tigger a NULL pointer dereference issue as above.
--- drivers/ssb/bridge_pcmcia_80211.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/ssb/bridge_pcmcia_80211.c +7 -2
@@ -113,16 +113,21 @@ static struct pcmcia_driver ssb_host_pcm .resume = ssb_host_pcmcia_resume, }; +static int pcmcia_init_failed; +/* * These are not module init/exit functions! * The module_pcmcia_driver() helper cannot be used here. */ int ssb_host_pcmcia_init (void ) { -return pcmcia_register_driver (&ssb_host_pcmcia_driver); + pcmcia_init_failed =pcmcia_register_driver (&ssb_host_pcmcia_driver); + +return pcmcia_init_failed; }void ssb_host_pcmcia_exit (void ) { -pcmcia_unregister_driver (&ssb_host_pcmcia_driver); +if (!pcmcia_init_failed) +pcmcia_unregister_driver (&ssb_host_pcmcia_driver); }
Greg Kroah-Hartman
maintainerPATCH 336/346 spi: Fix zero length xfer bug
In reply to Greg Kroah-Hartman[ Upstream commit 5442dcaa0d90fc376bdfc179a018931a8f43dea4 ]
This fixes a bug for messages containing both zero length and unidirectional xfers.
The function spi_map_msg will allocate dummy tx and/or rx buffers for use with unidirectional transfers when the hardware can only do a bidirectional transfer. That dummy buffer will be used in place of a NULL buffer even when the xfer length is 0.
Then in the function __spi_map_msg, if he hardware can dma, the zero length xfer will have spi_map_buf called on the dummy buffer.
Eventually, __sg_alloc_table is called and returns -EINVAL because nents == 0.
This fix prevents the error by not using the dummy buffer when the xfer length is zero.
--- drivers/spi/spi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi.c +2 -0
@@ -1024,6 +1024,8 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)if (max_tx || max_rx) {list_for_each_entry (xfer, &msg->transfers, transfer_list) { +if (!xfer->len) +continue ;if (!xfer->tx_buf) xfer->tx_buf = ctlr->dummy_tx;if (!xfer->rx_buf)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 338/346 ASoC: ti: fix davinci_mcasp_probe dependencies
In reply to Greg Kroah-Hartman[ Upstream commit 7d7b25d05ef1c5a1a9320190e1eeb55534847558 ]
The SND_SOC_DAVINCI_MCASP driver can use either edma or sdma as a back-end, and it takes the presence of the respective dma engine drivers in the configuration as an indication to which ones should be built. However, this is flawed in multiple ways:
- With CONFIG_TI_EDMA=m and CONFIG_SND_SOC_DAVINCI_MCASP=y,
is enabled as =m, and we get a link error:
sound/soc/ti/davinci-mcasp.o: In function `davinci_mcasp_probe':
davinci-mcasp.c:(.text+0x930): undefined reference to `edma_pcm_platform_register'
- When CONFIG_SND_SOC_DAVINCI_MCASP=m has already been selected by another driver, the same link error appears even if CONFIG_TI_EDMA is disabled
There are possibly other issues here, but it seems that the only reasonable solution is to always build both SND_SOC_TI_EDMA_PCM and SND_SOC_TI_SDMA_PCM as a dependency here. Both are fairly small and do not have any other compile-time dependencies, so the cost is very small, and makes the configuration stage much more consistent.
--- sound/soc/ti/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/ti/Kconfig +2 -2
@@ -21,8 +21,8 @@ config SND_SOC_DAVINCI_ASP config SND_SOC_DAVINCI_MCASP tristate "Multichannel Audio Serial Port (McASP) support" - select SND_SOC_TI_EDMA_PCM if TI_EDMA - select SND_SOC_TI_SDMA_PCM if DMA_OMAP + select SND_SOC_TI_EDMA_PCM + select SND_SOC_TI_SDMA_PCM help Say Y or M here if you want to have support for McASP IP found in various Texas Instruments SoCs like:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 332/346 regulator: wm831x: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 119c4f5085c45b60cb23c5595e45d06135b89518 ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/wm831x-dcdc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/regulator/wm831x-dcdc.c +4 -0
@@ -183,9 +183,11 @@ static irqreturn_t wm831x_dcdc_uv_irq(int irq, void *data) {struct wm831x_dcdc *dcdc = data; +regulator_lock (dcdc->regulator);regulator_notifier_call_chain (dcdc->regulator,REGULATOR_EVENT_UNDER_VOLTAGE ,NULL ); +regulator_unlock (dcdc->regulator);return IRQ_HANDLED ; }
@@ -194,9 +196,11 @@ static irqreturn_t wm831x_dcdc_oc_irq(int irq, void *data) {struct wm831x_dcdc *dcdc = data; +regulator_lock (dcdc->regulator);regulator_notifier_call_chain (dcdc->regulator,REGULATOR_EVENT_OVER_CURRENT ,NULL ); +regulator_unlock (dcdc->regulator);return IRQ_HANDLED ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 331/346 regulator: pv88080: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 1867af94cfdf37fc70fe67b3d522e78352800196 ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/pv88080-regulator.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/regulator/pv88080-regulator.c +4 -0
@@ -384,9 +384,11 @@ static irqreturn_t pv88080_irq_handler(int irq, void *data)if (reg_val &PV88080_E_VDD_FLT ) {for (i =0 ; i <PV88080_MAX_REGULATORS ; i++) {if (chip->rdev[i] !=NULL ) { +regulator_lock (chip->rdev[i]);regulator_notifier_call_chain (chip->rdev[i],REGULATOR_EVENT_UNDER_VOLTAGE ,NULL ); +regulator_unlock (chip->rdev[i]); } }
@@ -401,9 +403,11 @@ static irqreturn_t pv88080_irq_handler(int irq, void *data)if (reg_val &PV88080_E_OVER_TEMP ) {for (i =0 ; i <PV88080_MAX_REGULATORS ; i++) {if (chip->rdev[i] !=NULL ) { +regulator_lock (chip->rdev[i]);regulator_notifier_call_chain (chip->rdev[i],REGULATOR_EVENT_OVER_TEMP ,NULL ); +regulator_unlock (chip->rdev[i]); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 305/346 media: vimc: stream: fix thread state before sleep
In reply to Greg Kroah-Hartman[ Upstream commit 2978a505aaa981b279ef359f74ba93d25098e0a0 ]
The state TASK_UNINTERRUPTIBLE should be set just before schedule_timeout() call, so it knows the sleep mode it should enter. There is no point in setting TASK_UNINTERRUPTIBLE at the initialization of the thread as schedule_timeout() will set the state back to TASK_RUNNING.
This fixes a warning in __might_sleep() call, as it's expecting the task to be in TASK_RUNNING state just before changing the state to a sleeping state.
--- drivers/media/platform/vimc/vimc-streamer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vimc/vimc-streamer.c +1 -1
@@ -120,7 +120,6 @@ static int vimc_streamer_thread(void *data)int i;set_freezable (); -set_current_state (TASK_UNINTERRUPTIBLE );for (;;) {try_to_freeze ();
@@ -137,6 +136,7 @@ static int vimc_streamer_thread(void *data)break ; }//wait for 60hz +set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (HZ /60 ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 327/346 spi: imx: stop buffer overflow in RX FIFO flush
In reply to Greg Kroah-Hartman[ Upstream commit c842749ea1d32513f9e603c074d60d7aa07cb2ef ]
Commit 71abd29057cb ("spi: imx: Add support for SPI Slave mode") added an RX FIFO flush before start of a transfer. In slave mode, the master may have sent more data than expected and this data will still be in the RX FIFO at the start of the next transfer, and so needs to be flushed.
However, the code to do the flush was accidentally saving this data into the previous transfer's RX buffer, clobbering the contents of whatever followed that buffer.
Change it to empty the FIFO and throw away the data. Every one of the RX functions for the different eCSPI versions and modes reads the RX FIFO data using the same readl() call, so just use that, rather than using the spi_imx->rx function pointer and making sure all the different rx functions have a working "throw away" mode.
There is another issue, which affects master mode when switching from DMA to PIO. There can be extra data in the RX FIFO which triggers this flush code, causing memory corruption in the same manner. I don't know why this data is unexpectedly in the FIFO. It's likely there is a different bug or erratum responsible for that. But regardless of that, I think this is proper fix the for bug at hand here.
--- drivers/spi/spi-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-imx.c +1 -1
@@ -1494,7 +1494,7 @@ static int spi_imx_transfer(struct spi_device *spi,/* flush rxfifo before transfer */ while (spi_imx->devtype_data->rx_available (spi_imx)) - spi_imx->rx (spi_imx); +readl (spi_imx->base +MXC_CSPIRXDATA );if (spi_imx->slave_mode)return spi_imx_pio_transfer_slave (spi, transfer);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 328/346 regulator: lp8755: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 89b2758c192c35068b07766a6830433bfbdc1f44 ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/lp8755.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/regulator/lp8755.c +12 -3
@@ -372,10 +372,13 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data)for (icnt =0 ; icnt <LP8755_BUCK_MAX ; icnt++)if ((flag0 & (0x4 << icnt)) && (pchip->irqmask & (0x04 << icnt)) - && (pchip->rdev[icnt] !=NULL )) + && (pchip->rdev[icnt] !=NULL )) { +regulator_lock (pchip->rdev[icnt]);regulator_notifier_call_chain (pchip->rdev[icnt],LP8755_EVENT_PWR_FAULT ,NULL ); +regulator_unlock (pchip->rdev[icnt]); + }/* read flag1 register */ ret =lp8755_read (pchip,0x0E , &flag1);
@@ -389,18 +392,24 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data)/* send OCP event to all regualtor devices */ if ((flag1 &0x01 ) && (pchip->irqmask &0x01 ))for (icnt =0 ; icnt <LP8755_BUCK_MAX ; icnt++) -if (pchip->rdev[icnt] !=NULL ) +if (pchip->rdev[icnt] !=NULL ) { +regulator_lock (pchip->rdev[icnt]);regulator_notifier_call_chain (pchip->rdev[icnt],LP8755_EVENT_OCP ,NULL ); +regulator_unlock (pchip->rdev[icnt]); + }/* send OVP event to all regualtor devices */ if ((flag1 &0x02 ) && (pchip->irqmask &0x02 ))for (icnt =0 ; icnt <LP8755_BUCK_MAX ; icnt++) -if (pchip->rdev[icnt] !=NULL ) +if (pchip->rdev[icnt] !=NULL ) { +regulator_lock (pchip->rdev[icnt]);regulator_notifier_call_chain (pchip->rdev[icnt],LP8755_EVENT_OVP ,NULL ); +regulator_unlock (pchip->rdev[icnt]); + }return IRQ_HANDLED ; err_i2c:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 325/346 regulator: ltc3589: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit f132da2534ec6599c78c4adcef15340cff2e9dd9 ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/ltc3589.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/regulator/ltc3589.c +8 -2
@@ -419,16 +419,22 @@ static irqreturn_t ltc3589_isr(int irq, void *dev_id)if (irqstat <C3589_IRQSTAT_THERMAL_WARN ) { event =REGULATOR_EVENT_OVER_TEMP ; -for (i =0 ; i <LTC3589_NUM_REGULATORS ; i++) +for (i =0 ; i <LTC3589_NUM_REGULATORS ; i++) { +regulator_lock (ltc3589->regulators[i]);regulator_notifier_call_chain (ltc3589->regulators[i], event,NULL ); +regulator_unlock (ltc3589->regulators[i]); + } }if (irqstat <C3589_IRQSTAT_UNDERVOLT_WARN ) { event =REGULATOR_EVENT_UNDER_VOLTAGE ; -for (i =0 ; i <LTC3589_NUM_REGULATORS ; i++) +for (i =0 ; i <LTC3589_NUM_REGULATORS ; i++) { +regulator_lock (ltc3589->regulators[i]);regulator_notifier_call_chain (ltc3589->regulators[i], event,NULL ); +regulator_unlock (ltc3589->regulators[i]); + } }/* Clear warning condition */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 323/346 regulator: wm831x isink: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit f7a621728a6a23bfd2c6ac4d3e42e1303aefde0f ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/wm831x-isink.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/wm831x-isink.c +2 -0
@@ -140,9 +140,11 @@ static irqreturn_t wm831x_isink_irq(int irq, void *data) {struct wm831x_isink *isink = data; +regulator_lock (isink->regulator);regulator_notifier_call_chain (isink->regulator,REGULATOR_EVENT_OVER_CURRENT ,NULL ); +regulator_unlock (isink->regulator);return IRQ_HANDLED ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 322/346 regulator: wm831x ldo: Fix notifier mutex lock warning
In reply to Greg Kroah-Hartman[ Upstream commit 8be64b6d87bd47d81753b60ddafe70102ebfd76b ]
The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.
Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.
--- drivers/regulator/wm831x-ldo.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/wm831x-ldo.c +2 -0
@@ -51,9 +51,11 @@ static irqreturn_t wm831x_ldo_uv_irq(int irq, void *data) {struct wm831x_ldo *ldo = data; +regulator_lock (ldo->regulator);regulator_notifier_call_chain (ldo->regulator,REGULATOR_EVENT_UNDER_VOLTAGE ,NULL ); +regulator_unlock (ldo->regulator);return IRQ_HANDLED ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 320/346 drm/omap: Notify all devices in the pipeline of output disconnection
In reply to Greg Kroah-Hartman[ Upstream commit 27a7e3e18419869cdcc414a404f3fe66f1b4e644 ]
For HDMI pipelines, when the output gets disconnected the device handling CEC needs to be notified. Instead of guessing which device that would be (and sometimes getting it wrong), notify all devices in the pipeline.
--- drivers/gpu/drm/omapdrm/omap_connector.c | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/gpu/drm/omapdrm/omap_connector.c +16 -12
@@ -36,18 +36,22 @@ struct omap_connector { };static void omap_connector_hpd_notify (struct drm_connector *connector, -struct omap_dss_device *src,enum drm_connector_status status) { -if (status == connector_status_disconnected) { -/* -* If the source is an HDMI encoder, notify it of disconnection. -* This is required to let the HDMI encoder reset any internal -* state related to connection status, such as the CEC address. -*/ -if (src && src->type ==OMAP_DISPLAY_TYPE_HDMI && - src->ops->hdmi.lost_hotplug) - src->ops->hdmi.lost_hotplug (src); +struct omap_connector *omap_connector =to_omap_connector (connector); +struct omap_dss_device *dssdev; + +if (status != connector_status_disconnected) +return ; + +/* +* Notify all devics in the pipeline of disconnection. This is required +* to let the HDMI encoders reset their internal state related to +* connection status, such as the CEC address. +*/ +for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) { +if (dssdev->ops && dssdev->ops->hdmi.lost_hotplug) + dssdev->ops->hdmi.lost_hotplug (dssdev); } }
@@ -67,7 +71,7 @@ static void omap_connector_hpd_cb(void *cb_data,if (old_status == status)return ; -omap_connector_hpd_notify (connector, omap_connector->hpd, status); +omap_connector_hpd_notify (connector, status);drm_kms_helper_hotplug_event (dev); }
@@ -128,7 +132,7 @@ static enum drm_connector_status omap_connector_detect( ? connector_status_connected : connector_status_disconnected; -omap_connector_hpd_notify (connector, dssdev->src, status); +omap_connector_hpd_notify (connector, status); }else {switch (omap_connector->display->type) {case OMAP_DISPLAY_TYPE_DPI :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 318/346 drm: writeback: Fix leak of writeback job
In reply to Greg Kroah-Hartman[ Upstream commit e482ae9b5fdc01a343f22f52930e85a6cfdf85eb ]
Writeback jobs are allocated when the WRITEBACK_FB_ID is set, and deleted when the jobs complete. This results in both a memory leak of the job and a leak of the framebuffer if the atomic commit returns before the job is queued for processing, for instance if the atomic check fails or if the commit runs in test-only mode.
Fix this by implementing the drm_writeback_cleanup_job() function and calling it from __drm_atomic_helper_connector_destroy_state(). As writeback jobs are removed from the state when they're queued for processing, any job left in the state when the state gets destroyed needs to be cleaned up.
The existing declaration of the drm_writeback_cleanup_job() function without an implementation hints that this problem was considered, but never addressed.
--- drivers/gpu/drm/drm_atomic_state_helper.c | 4 ++++ drivers/gpu/drm/drm_writeback.c | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic_state_helper.c +4 -0
@@ -30,6 +30,7 @@#include <drm/drm_connector.h> #include <drm/drm_atomic.h> #include <drm/drm_device.h> +#include <drm/drm_writeback.h> #include <linux/slab.h> #include <linux/dma-fence.h>
@@ -412,6 +413,9 @@ __drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state)if (state->commit)drm_crtc_commit_put (state->commit); + +if (state->writeback_job) +drm_writeback_cleanup_job (state->writeback_job); }EXPORT_SYMBOL (__drm_atomic_helper_connector_destroy_state);
drivers/gpu/drm/drm_writeback.c +11 -3
@@ -268,6 +268,15 @@ void drm_writeback_queue_job(struct drm_writeback_connector *wb_connector, }EXPORT_SYMBOL (drm_writeback_queue_job); +void drm_writeback_cleanup_job (struct drm_writeback_job *job) +{ +if (job->fb) +drm_framebuffer_put (job->fb); + +kfree (job); +} +EXPORT_SYMBOL (drm_writeback_cleanup_job); +/* * @cleanup_work: deferred cleanup of a writeback job *
@@ -280,10 +289,9 @@ static void cleanup_work(struct work_struct *work)struct drm_writeback_job *job =container_of (work, struct drm_writeback_job, cleanup_work); -drm_framebuffer_put (job->fb); -kfree (job); -} +drm_writeback_cleanup_job (job); +}/** * drm_writeback_signal_completion - Signal the completion of a writeback job
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 315/346 scsi: lpfc: Fix use-after-free mailbox cmd completion
In reply to Greg Kroah-Hartman[ Upstream commit 9b1640686470fbbd1c6efb35ada6fe1427ea8d0f ]
When unloading the driver, mailbox commands may be sent without holding a reference on the ndlp. By the time the mailbox command completes, the ndlp may have reduced its ref counts and been freed. The problem was reported by KASAN.
While unregistering due to driver unload, have the completion noop'd by setting the ndlp context NULL'd. Due to the unload, no further action was necessary. Also, while reviewing this path, the generic nulling of the context after handling should be slightly moved.
Reported by: Bart Van Assche <[email protected]>
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 4 ++++ drivers/scsi/lpfc/lpfc_sli.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +4 -0
@@ -4879,6 +4879,10 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)* accept PLOGIs after unreg_rpi_cmpl */ acc_plogi =0 ; + }else if (vport->load_flag &FC_UNLOADING ) { + mbox->ctx_ndlp =NULL ; + mbox->mbox_cmpl = + lpfc_sli_def_mbox_cmpl; }else { mbox->ctx_ndlp = ndlp; mbox->mbox_cmpl =
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -2518,8 +2518,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) }else { ndlp->nlp_flag &= ~NLP_UNREG_INP ; } + pmb->ctx_ndlp =NULL ; } - pmb->ctx_ndlp =NULL ; }/* Check security permission status on INIT_LINK mailbox command */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 313/346 media: saa7146: avoid high stack usage with clang
In reply to Greg Kroah-Hartman[ Upstream commit 03aa4f191a36f33fce015387f84efa0eee94408e ]
Two saa7146/hexium files contain a construct that causes a warning when built with clang:
drivers/media/pci/saa7146/hexium_orion.c:210:12: error: stack frame size of 2272 bytes in function 'hexium_probe'
[-Werror,-Wframe-larger-than=]
static int hexium_probe(struct saa7146_dev *dev)
^
drivers/media/pci/saa7146/hexium_gemini.c:257:12: error: stack frame size of 2304 bytes in function 'hexium_attach'
[-Werror,-Wframe-larger-than=]
static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
^This one happens regardless of KASAN, and the problem is that a constructor to initialize a dynamically allocated structure leads to a copy of that structure on the stack, whereas gcc initializes it in place.
--- drivers/media/pci/saa7146/hexium_gemini.c | 5 ++--- drivers/media/pci/saa7146/hexium_orion.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/media/pci/saa7146/hexium_gemini.c +2 -3
@@ -270,9 +270,8 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d/* enable i2c-port pins */ saa7146_write (dev,MC1 , (MASK_08 |MASK_24 |MASK_10 |MASK_26 )); - hexium->i2c_adapter = (struct i2c_adapter ) { - .name ="hexium gemini" , - }; +strscpy (hexium->i2c_adapter.name,"hexium gemini" , +sizeof (hexium->i2c_adapter.name));saa7146_i2c_adapter_prepare (dev, &hexium->i2c_adapter,SAA7146_I2C_BUS_BIT_RATE_480 );if (i2c_add_adapter (&hexium->i2c_adapter) <0 ) {DEB_S ("cannot register i2c-device. skipping.\n" );
drivers/media/pci/saa7146/hexium_orion.c +2 -3
@@ -231,9 +231,8 @@ static int hexium_probe(struct saa7146_dev *dev)saa7146_write (dev,DD1_STREAM_B ,0x00000000 );saa7146_write (dev,MC2 , (MASK_09 |MASK_25 |MASK_10 |MASK_26 )); - hexium->i2c_adapter = (struct i2c_adapter ) { - .name ="hexium orion" , - }; +strscpy (hexium->i2c_adapter.name,"hexium orion" , +sizeof (hexium->i2c_adapter.name));saa7146_i2c_adapter_prepare (dev, &hexium->i2c_adapter,SAA7146_I2C_BUS_BIT_RATE_480 );if (i2c_add_adapter (&hexium->i2c_adapter) <0 ) {DEB_S ("cannot register i2c-device. skipping.\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 312/346 scsi: lpfc: Fix fc4type information for FDMI
In reply to Greg Kroah-Hartman[ Upstream commit 32a80c093b524a0682f1c6166c910387b116ffce ]
The driver is reporting support for NVME even when not configured for NVME operation.
Fix (and make more readable) when NVME protocol support is indicated.
--- drivers/scsi/lpfc/lpfc_ct.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +10 -7
@@ -2363,10 +2363,11 @@ lpfc_fdmi_port_attr_fc4type(struct lpfc_vport *vport, ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue;memset (ae,0 ,32 ); - ae->un.AttrTypes[3 ] =0x02 ;/* Type 1 - ELS */ - ae->un.AttrTypes[2 ] =0x01 ;/* Type 8 - FCP */ - ae->un.AttrTypes[6 ] =0x01 ;/* Type 40 - NVME */ - ae->un.AttrTypes[7 ] =0x01 ;/* Type 32 - CT */ + ae->un.AttrTypes[3 ] =0x02 ;/* Type 0x1 - ELS */ + ae->un.AttrTypes[2 ] =0x01 ;/* Type 0x8 - FCP */ +if (vport->nvmei_support || vport->phba->nvmet_support) + ae->un.AttrTypes[6 ] =0x01 ;/* Type 0x28 - NVME */ + ae->un.AttrTypes[7 ] =0x01 ;/* Type 0x20 - CT */ size =FOURBYTES +32 ; ad->AttrLen =cpu_to_be16 (size); ad->AttrType =cpu_to_be16 (RPRT_SUPPORTED_FC4_TYPES );
@@ -2676,9 +2677,11 @@ lpfc_fdmi_port_attr_active_fc4type(struct lpfc_vport *vport, ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue;memset (ae,0 ,32 ); - ae->un.AttrTypes[3 ] =0x02 ;/* Type 1 - ELS */ - ae->un.AttrTypes[2 ] =0x01 ;/* Type 8 - FCP */ - ae->un.AttrTypes[7 ] =0x01 ;/* Type 32 - CT */ + ae->un.AttrTypes[3 ] =0x02 ;/* Type 0x1 - ELS */ + ae->un.AttrTypes[2 ] =0x01 ;/* Type 0x8 - FCP */ +if (vport->phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) + ae->un.AttrTypes[6 ] =0x1 ;/* Type 0x28 - NVME */ + ae->un.AttrTypes[7 ] =0x01 ;/* Type 0x20 - CT */ size =FOURBYTES +32 ; ad->AttrLen =cpu_to_be16 (size); ad->AttrType =cpu_to_be16 (RPRT_ACTIVE_FC4_TYPES );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 253/346 clk: renesas: rcar-gen3: Correct parent clock of Audio-DMAC
In reply to Greg Kroah-Hartman[ Upstream commit b9df2ea2b8d09ad850afe4d4a0403cb23d9e0c02 ]
The clock sources of the AXI-bus clock (266.66 MHz) used for Audio-DMAC DMA transfers are:
Channel R-Car H3 R-Car M3-W R-Car M3-N R-Car E3
---------------------------------------------------------------
Audio-DMAC0 S1D2 S1D2 S1D2 S1D2
Audio-DMAC1 S1D2 S1D2 S1D2 -
As a result, change the parent clocks of the Audio-DMAC{0,1} module clocks on R-Car H3, R-Car M3-W, and R-Car M3-N to S1D2, and change the parent clock of the Audio-DMAC0 module on R-Car E3 to S1D2.
NOTE: This information will be reflected in a future revision of the
R-Car Gen3 Hardware Manual.
--- drivers/clk/renesas/r8a774a1-cpg-mssr.c | 4 ++-- drivers/clk/renesas/r8a774c0-cpg-mssr.c | 2 +- drivers/clk/renesas/r8a7795-cpg-mssr.c | 4 ++-- drivers/clk/renesas/r8a7796-cpg-mssr.c | 4 ++-- drivers/clk/renesas/r8a77965-cpg-mssr.c | 4 ++-- drivers/clk/renesas/r8a77990-cpg-mssr.c | 2 +- drivers/clk/renesas/r8a77995-cpg-mssr.c | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-)
drivers/clk/renesas/r8a774a1-cpg-mssr.c +2 -2
@@ -142,8 +142,8 @@ static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = {DEF_MOD ("rwdt" ,402 ,R8A774A1_CLK_R ),DEF_MOD ("intc-ex" ,407 ,R8A774A1_CLK_CP ),DEF_MOD ("intc-ap" ,408 ,R8A774A1_CLK_S0D3 ), -DEF_MOD ("audmac1" ,501 ,R8A774A1_CLK_S0D3 ), -DEF_MOD ("audmac0" ,502 ,R8A774A1_CLK_S0D3 ), +DEF_MOD ("audmac1" ,501 ,R8A774A1_CLK_S1D2 ), +DEF_MOD ("audmac0" ,502 ,R8A774A1_CLK_S1D2 ),DEF_MOD ("hscif4" ,516 ,R8A774A1_CLK_S3D1 ),DEF_MOD ("hscif3" ,517 ,R8A774A1_CLK_S3D1 ), DEF_MOD("hscif2", 518, R8A774A1_CLK_S3D1),
drivers/clk/renesas/r8a774c0-cpg-mssr.c +1 -1
@@ -149,7 +149,7 @@ static const struct mssr_mod_clk r8a774c0_mod_clks[] __initconst = {DEF_MOD ("intc-ex" ,407 ,R8A774C0_CLK_CP ),DEF_MOD ("intc-ap" ,408 ,R8A774C0_CLK_S0D3 ), -DEF_MOD ("audmac0" ,502 ,R8A774C0_CLK_S3D4 ), +DEF_MOD ("audmac0" ,502 ,R8A774C0_CLK_S1D2 ),DEF_MOD ("hscif4" ,516 ,R8A774C0_CLK_S3D1C ),DEF_MOD ("hscif3" ,517 ,R8A774C0_CLK_S3D1C ), DEF_MOD("hscif2", 518, R8A774C0_CLK_S3D1C),
drivers/clk/renesas/r8a7795-cpg-mssr.c +2 -2
@@ -153,8 +153,8 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = {DEF_MOD ("rwdt" ,402 ,R8A7795_CLK_R ),DEF_MOD ("intc-ex" ,407 ,R8A7795_CLK_CP ),DEF_MOD ("intc-ap" ,408 ,R8A7795_CLK_S0D3 ), -DEF_MOD ("audmac1" ,501 ,R8A7795_CLK_S0D3 ), -DEF_MOD ("audmac0" ,502 ,R8A7795_CLK_S0D3 ), +DEF_MOD ("audmac1" ,501 ,R8A7795_CLK_S1D2 ), +DEF_MOD ("audmac0" ,502 ,R8A7795_CLK_S1D2 ),DEF_MOD ("drif7" ,508 ,R8A7795_CLK_S3D2 ),DEF_MOD ("drif6" ,509 ,R8A7795_CLK_S3D2 ), DEF_MOD("drif5", 510, R8A7795_CLK_S3D2),
drivers/clk/renesas/r8a7796-cpg-mssr.c +2 -2
@@ -146,8 +146,8 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {DEF_MOD ("rwdt" ,402 ,R8A7796_CLK_R ),DEF_MOD ("intc-ex" ,407 ,R8A7796_CLK_CP ),DEF_MOD ("intc-ap" ,408 ,R8A7796_CLK_S0D3 ), -DEF_MOD ("audmac1" ,501 ,R8A7796_CLK_S0D3 ), -DEF_MOD ("audmac0" ,502 ,R8A7796_CLK_S0D3 ), +DEF_MOD ("audmac1" ,501 ,R8A7796_CLK_S1D2 ), +DEF_MOD ("audmac0" ,502 ,R8A7796_CLK_S1D2 ),DEF_MOD ("drif7" ,508 ,R8A7796_CLK_S3D2 ),DEF_MOD ("drif6" ,509 ,R8A7796_CLK_S3D2 ), DEF_MOD("drif5", 510, R8A7796_CLK_S3D2),
drivers/clk/renesas/r8a77965-cpg-mssr.c +2 -2
@@ -146,8 +146,8 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = {DEF_MOD ("intc-ex" ,407 ,R8A77965_CLK_CP ),DEF_MOD ("intc-ap" ,408 ,R8A77965_CLK_S0D3 ), -DEF_MOD ("audmac1" ,501 ,R8A77965_CLK_S0D3 ), -DEF_MOD ("audmac0" ,502 ,R8A77965_CLK_S0D3 ), +DEF_MOD ("audmac1" ,501 ,R8A77965_CLK_S1D2 ), +DEF_MOD ("audmac0" ,502 ,R8A77965_CLK_S1D2 ),DEF_MOD ("drif7" ,508 ,R8A77965_CLK_S3D2 ),DEF_MOD ("drif6" ,509 ,R8A77965_CLK_S3D2 ), DEF_MOD("drif5", 510, R8A77965_CLK_S3D2),
drivers/clk/renesas/r8a77990-cpg-mssr.c +1 -1
@@ -152,7 +152,7 @@ static const struct mssr_mod_clk r8a77990_mod_clks[] __initconst = {DEF_MOD ("intc-ex" ,407 ,R8A77990_CLK_CP ),DEF_MOD ("intc-ap" ,408 ,R8A77990_CLK_S0D3 ), -DEF_MOD ("audmac0" ,502 ,R8A77990_CLK_S3D4 ), +DEF_MOD ("audmac0" ,502 ,R8A77990_CLK_S1D2 ),DEF_MOD ("drif7" ,508 ,R8A77990_CLK_S3D2 ),DEF_MOD ("drif6" ,509 ,R8A77990_CLK_S3D2 ), DEF_MOD("drif5", 510, R8A77990_CLK_S3D2),
drivers/clk/renesas/r8a77995-cpg-mssr.c +1 -1
@@ -133,7 +133,7 @@ static const struct mssr_mod_clk r8a77995_mod_clks[] __initconst = {DEF_MOD ("rwdt" ,402 ,R8A77995_CLK_R ),DEF_MOD ("intc-ex" ,407 ,R8A77995_CLK_CP ),DEF_MOD ("intc-ap" ,408 ,R8A77995_CLK_S1D2 ), -DEF_MOD ("audmac0" ,502 ,R8A77995_CLK_S3D1 ), +DEF_MOD ("audmac0" ,502 ,R8A77995_CLK_S1D2 ),DEF_MOD ("hscif3" ,517 ,R8A77995_CLK_S3D1C ),DEF_MOD ("hscif0" ,520 ,R8A77995_CLK_S3D1C ), DEF_MOD("thermal", 522, R8A77995_CLK_CP),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 303/346 drm/amd/display: Set stream->mode_changed when connectors change
In reply to Greg Kroah-Hartman[ Upstream commit b9952f93cd2cf5fca82b06a8179c0f5f7b769e83 ]
[Why]
The kms_plane@plane-position-covered-pipe-*-planes subtests can produce a sequence of atomic commits such that neither active_changed nor mode_changed but connectors_changed.
When this happens we remove the old stream from the context and add a new stream but the new stream doesn't have mode_changed=true set.
This incorrect programming sequence causes CRC mismatches to occur in the test.
The stream->mode_changed value should be set whenever a new stream is created.
[How]
A new stream is created whenever drm_atomic_crtc_needs_modeset is true. We previously covered the active_changed and mode_changed conditions for the CRTC but connectors_changed is also checked within drm_atomic_crtc_needs_modeset.
So just use drm_atomic_crtc_needs_modeset directly to determine the mode_changed flag.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -4978,8 +4978,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,static void amdgpu_dm_crtc_copy_transient_flags (struct drm_crtc_state *crtc_state,struct dc_stream_state *stream_state) { - stream_state->mode_changed = - crtc_state->mode_changed || crtc_state->active_changed; + stream_state->mode_changed =drm_atomic_crtc_needs_modeset (crtc_state); } static int amdgpu_dm_atomic_commit(struct drm_device *dev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 262/346 thunderbolt: Fix to check the return value of kmemdup
In reply to Greg Kroah-Hartman[ Upstream commit fd21b79e541e4666c938a344f3ad2df74b4f5120 ]
uuid in add_switch is allocted via kmemdup which can fail. The patch logs the error and cleans up the allocated memory for switch.
--- drivers/thunderbolt/icm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/thunderbolt/icm.c +5 -0
@@ -473,6 +473,11 @@ static void add_switch(struct tb_switch *parent_sw, u64 route, goto out; sw->uuid =kmemdup (uuid,sizeof (*uuid),GFP_KERNEL ); +if (!sw->uuid) { +tb_sw_warn (sw,"cannot allocate memory for switch\n" ); +tb_switch_put (sw); + goto out; + } sw->connection_id = connection_id; sw->connection_key = connection_key; sw->link = link;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 260/346 efifb: Omit memory map check on legacy boot
In reply to Greg Kroah-Hartman[ Upstream commit c2999c281ea2d2ebbdfce96cecc7b52e2ae7c406 ]
Since the following commit:
38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")
efifb_probe() checks its memory range via efi_mem_desc_lookup(), and this leads to a spurious error message:
EFI_MEMMAP is not enabled
at every boot on KVM. This is quite annoying since the error message appears even if you set "quiet" boot option.
Since this happens on legacy boot, which strangely enough exposes a EFI framebuffer via screen_info, let's double check that we are doing an EFI boot before attempting to access the EFI memory map.
--- drivers/video/fbdev/efifb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/fbdev/efifb.c +2 -1
@@ -464,7 +464,8 @@ static int efifb_probe(struct platform_device *dev) info->apertures->ranges[0 ].base = efifb_fix.smem_start; info->apertures->ranges[0 ].size = size_remap; -if (!efi_mem_desc_lookup (efifb_fix.smem_start, &md)) { +if (efi_enabled (EFI_BOOT ) && + !efi_mem_desc_lookup (efifb_fix.smem_start, &md)) {if ((efifb_fix.smem_start + efifb_fix.smem_len) > (md.phys_addr + (md.num_pages <<EFI_PAGE_SHIFT ))) { pr_err("efifb: video memory @ 0x%lx spans multiple EFI memory regions\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 259/346 media: gspca: Kill URBs on USB device disconnect
In reply to Greg Kroah-Hartman[ Upstream commit 9b9ea7c2b57a0c9c3341fc6db039d1f7971a432e ]
In order to prevent ISOC URBs from being infinitely resubmitted, the driver's USB disconnect handler must kill all the in-flight URBs.
While here, change the URB packet status message to a debug level, to avoid spamming the console too much.
This commit fixes a lockup caused by an interrupt storm coming from the URB completion handler.
--- drivers/media/usb/gspca/gspca.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/gspca/gspca.c +3 -1
@@ -294,7 +294,7 @@ static void fill_frame(struct gspca_dev *gspca_dev,/* check the packet status and length */ st = urb->iso_frame_desc[i].status;if (st) { -pr_err ("ISOC data error: [%d] len=%d, status=%d\n" , +gspca_dbg (gspca_dev,D_PACK ,"ISOC data error: [%d] len=%d, status=%d\n" , i, len, st); gspca_dev->last_packet_type =DISCARD_PACKET ;continue ;
@@ -1630,6 +1630,8 @@ void gspca_disconnect(struct usb_interface *intf)mutex_lock (&gspca_dev->usb_lock); gspca_dev->present = false; +destroy_urbs (gspca_dev); +gspca_input_destroy_urb (gspca_dev);vb2_queue_error (&gspca_dev->queue);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 258/346 media: wl128x: prevent two potential buffer overflows
In reply to Greg Kroah-Hartman[ Upstream commit 9c2ccc324b3a6cbc865ab8b3e1a09e93d3c8ade9 ]
Smatch marks skb->data as untrusted so it warns that "evt_hdr->dlen" can copy up to 255 bytes and we only have room for two bytes. Even if this comes from the firmware and we trust it, the new policy generally is just to fix it as kernel hardenning.
I can't test this code so I tried to be very conservative. I considered not allowing "evt_hdr->dlen == 1" because it doesn't initialize the whole variable but in the end I decided to allow it and manually initialized "asic_id" and "asic_ver" to zero.
--- drivers/media/radio/wl128x/fmdrv_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/radio/wl128x/fmdrv_common.c +5 -2
@@ -489,7 +489,8 @@ int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,return -EIO ; }/* Send response data to caller */ -if (response !=NULL && response_len !=NULL && evt_hdr->dlen) { +if (response !=NULL && response_len !=NULL && evt_hdr->dlen && + evt_hdr->dlen <= payload_len) {/* Skip header info and copy only response data */ skb_pull (skb,sizeof (struct fm_event_msg_hdr ));memcpy (response, skb->data, evt_hdr->dlen);
@@ -583,6 +584,8 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev *fmdev)return ; fm_evt_hdr = (void *)skb->data; +if (fm_evt_hdr->dlen >sizeof (fmdev->irq_info.flag)) +return ;/* Skip header info and copy only response data */ skb_pull (skb,sizeof (struct fm_event_msg_hdr ));
@@ -1308,7 +1311,7 @@ static int load_default_rx_configuration(struct fmdev *fmdev)static int fm_power_up (struct fmdev *fmdev,u8 mode) {u16 payload; -__be16 asic_id, asic_ver; +__be16 asic_id =0 , asic_ver =0 ;int resp_len, ret;u8 fw_name[50 ];
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 301/346 media: staging: davinci_vpfe: disallow building with COMPILE_TEST
In reply to Greg Kroah-Hartman[ Upstream commit 49dc762cffd8305a861ca649e82dc5533b3e3344 ]
The driver should really call dm365_isif_setup_pinmux() through a callback, but uses a hack to include a davinci specific machine header file when compile testing instead. This works almost everywhere, but not on the ARM omap1 platform, which has another header named mach/mux.h. This causes a build failure:
drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:2: error: implicit declaration of function 'davinci_cfg_reg' [-Werror,-Wimplicit-function-declaration]
davinci_cfg_reg(DM365_VIN_CAM_WEN);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:2: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:18: error: use of undeclared identifier 'DM365_VIN_CAM_WEN'
davinci_cfg_reg(DM365_VIN_CAM_WEN);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2029:18: error: use of undeclared identifier 'DM365_VIN_CAM_VD'
davinci_cfg_reg(DM365_VIN_CAM_VD);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2030:18: error: use of undeclared identifier 'DM365_VIN_CAM_HD'
davinci_cfg_reg(DM365_VIN_CAM_HD);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2031:18: error: use of undeclared identifier 'DM365_VIN_YIN4_7_EN'
davinci_cfg_reg(DM365_VIN_YIN4_7_EN);
^
drivers/staging/media/davinci_vpfe/dm365_isif.c:2032:18: error: use of undeclared identifier 'DM365_VIN_YIN0_3_EN'
davinci_cfg_reg(DM365_VIN_YIN0_3_EN);
^7 errors generated.
Exclude omap1 from compile-testing, under the assumption that all others still work.
--- drivers/staging/media/davinci_vpfe/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/davinci_vpfe/Kconfig +1 -1
@@ -1,7 +1,7 @@ config VIDEO_DM365_VPFE tristate "DM365 VPFE Media Controller Capture Driver" depends on VIDEO_V4L2 - depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || COMPILE_TEST + depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || (COMPILE_TEST && !ARCH_OMAP1) depends on VIDEO_V4L2_SUBDEV_API depends on VIDEO_DAVINCI_VPBE_DISPLAY select VIDEOBUF2_DMA_CONTIG
Signature · 1 line
2.20.1