hwmon: (da9052) Synchronize access with mfd
Subsystems (50)
Sasha Levin
maintainerPATCH 1/606 hwmon: (da9052) Synchronize access with mfd
From: Samu Nuutamo <[email protected]>
[ Upstream commit 333e22db228f0bd0c839553015a6a8d3db4ba569 ]
When tsi-as-adc is configured it is possible for in7[0123]_input read to return an incorrect value if a concurrent read to in[456]_input is performed. This is caused by a concurrent manipulation of the mux channel without proper locking as hwmon and mfd use different locks for synchronization.
Switch hwmon to use the same lock as mfd when accessing the TSI channel.
--- drivers/hwmon/da9052-hwmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/da9052-hwmon.c +2 -2
@@ -244,9 +244,9 @@ static ssize_t da9052_tsi_show(struct device *dev,int channel =to_sensor_dev_attr (devattr)->index;int ret; -mutex_lock (&hwmon->hwmon_lock); +mutex_lock (&hwmon->da9052->auxadc_lock); ret =__da9052_read_tsi (dev, channel); -mutex_unlock (&hwmon->hwmon_lock); +mutex_unlock (&hwmon->da9052->auxadc_lock);if (ret <0 )return ret;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/606 s390/ism: fix error return code in ism_probe()
From: Wei Yongjun <[email protected]>
[ Upstream commit 29b74cb75e3572d83708745e81e24d37837415f9 ]
Fix to return negative error code -ENOMEM from the smcd_alloc_dev() error handling case instead of 0, as done elsewhere in this function.
--- drivers/s390/net/ism_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/s390/net/ism_drv.c +3 -1
@@ -521,8 +521,10 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id) ism->smcd =smcd_alloc_dev (&pdev->dev,dev_name (&pdev->dev), &ism_ops,ISM_NR_DMBS ); -if (!ism->smcd) +if (!ism->smcd) { + ret = -ENOMEM ; goto err_resource; + } ism->smcd->priv = ism; ret =ism_dev_init (ism);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/606 drm/i915: Handle idling during i915_gem_evict_something busy loops
In reply to Sasha LevinFrom: Chris Wilson <[email protected]>
[ Upstream commit 955da9d77435acac066139e9d7f7723ce7204a1d ]
i915_gem_evict_something() is charged with finding a slot within the GTT that we may reuse. Since our goal is not to stall, we first look for a slot that only overlaps idle vma. To this end, on the first pass we move any active vma to the end of the search list. However, we only stopped moving active vma after we see the first active vma twice. If during the search, that first active vma completed, we would not notice and keep on extending the search list.
--- drivers/gpu/drm/i915/i915_gem_evict.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_gem_evict.c +12 -14
@@ -130,6 +130,13 @@ i915_gem_evict_something(struct i915_address_space *vm, active =NULL ;INIT_LIST_HEAD (&eviction_list);list_for_each_entry_safe (vma, next, &vm->bound_list, vm_link) { +if (vma == active) {/* now seen this vma twice */ +if (flags &PIN_NONBLOCK ) +break ; + + active =ERR_PTR (-EAGAIN ); + } +/* * We keep this list in a rough least-recently scanned order * of active elements (inactive elements are cheap to reap).
@@ -145,21 +152,12 @@ i915_gem_evict_something(struct i915_address_space *vm,* To notice when we complete one full cycle, we record the * first active element seen, before moving it to the tail. */ -if (i915_vma_is_active (vma)) { -if (vma == active) { -if (flags &PIN_NONBLOCK ) -break ; - - active =ERR_PTR (-EAGAIN ); - } - -if (active !=ERR_PTR (-EAGAIN )) { -if (!active) - active = vma; +if (active !=ERR_PTR (-EAGAIN ) &&i915_vma_is_active (vma)) { +if (!active) + active = vma; -list_move_tail (&vma->vm_link, &vm->bound_list); -continue ; - } +list_move_tail (&vma->vm_link, &vm->bound_list); +continue ; }if (mark_free (&scan, vma, flags, &eviction_list))
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sasha Levin
maintainerPATCH 4/606 mm, memcg: fix inconsistent oom event behavior
In reply to Sasha LevinFrom: Yafang Shao <[email protected]>
[ Upstream commit 04fd61a4e01028210a91f0efc408c8bc61a3018c ]
A recent commit 9852ae3fe529 ("mm, memcg: consider subtrees in memory.events") changed the behavior of memcg events, which will now consider subtrees in memory.events.
But oom_kill event is a special one as it is used in both cgroup1 and cgroup2. In cgroup1, it is displayed in memory.oom_control. The file memory.oom_control is in both root memcg and non root memcg, that is different with memory.event as it only in non-root memcg. That commit is okay for cgroup2, but it is not okay for cgroup1 as it will cause inconsistent behavior between root memcg and non-root memcg.
Here's an example on why this behavior is inconsistent in cgroup1.
root memcg
/
memcg foo
/memcg bar
Suppose there's an oom_kill in memcg bar, then the oon_kill will be
root memcg : memory.oom_control(oom_kill) 0 /
memcg foo : memory.oom_control(oom_kill) 1
/
memcg bar : memory.oom_control(oom_kill) 1
For the non-root memcg, its memory.oom_control(oom_kill) includes its descendants' oom_kill, but for root memcg, it doesn't include its descendants' oom_kill. That means, memory.oom_control(oom_kill) has different meanings in different memcgs. That is inconsistent. Then the user has to know whether the memcg is root or not.
If we can't fully support it in cgroup1, for example by adding memory.events.local into cgroup1 as well, then let's don't touch its original behavior.
--- include/linux/memcontrol.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/memcontrol.h +2 -0
@@ -783,6 +783,8 @@ static inline void memcg_memory_event(struct mem_cgroup *memcg,atomic_long_inc (&memcg->memory_events[event]);cgroup_file_notify (&memcg->events_file); +if (!cgroup_subsys_on_dfl (memory_cgrp_subsys)) +break ;if (cgrp_dfl_root.flags &CGRP_ROOT_MEMORY_LOCAL_EVENTS )break ; } while ((memcg = parent_mem_cgroup(memcg)) &&
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 5/606 epoll: call final ep_events_available() check under the lock
In reply to Sasha LevinFrom: Roman Penyaev <[email protected]>
[ Upstream commit 65759097d804d2a9ad2b687db436319704ba7019 ]
There is a possible race when ep_scan_ready_list() leaves ->rdllist and ->obflist empty for a short period of time although some events are pending. It is quite likely that ep_events_available() observes empty lists and goes to sleep.
Since commit 339ddb53d373 ("fs/epoll: remove unnecessary wakeups of nested epoll") we are conservative in wakeups (there is only one place for wakeup and this is ep_poll_callback()), thus ep_events_available() must always observe correct state of two lists.
The easiest and correct way is to do the final check under the lock. This does not impact the performance, since lock is taken anyway for adding a wait entry to the wait queue.
The discussion of the problem can be found here:
https://lore.kernel.org/linux-fsdevel/[email protected]/
In this patch barrierless __set_current_state() is used. This is safe since waitqueue_active() is called under the same lock on wakeup side.
Short-circuit for fatal signals (i.e. fatal_signal_pending() check) is moved to the line just before actual events harvesting routine. This is fully compliant to what is said in the comment of the patch where the actual fatal_signal_pending() check was added: c257a340ede0 ("fs, epoll:
short circuit fetching events if thread has been killed").
--- fs/eventpoll.c | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-)
fs/eventpoll.c +28 -20
@@ -1857,34 +1857,33 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,* event delivery. */ init_wait (&wait); -write_lock_irq (&ep->lock); -__add_wait_queue_exclusive (&ep->wq, &wait); -write_unlock_irq (&ep->lock); +write_lock_irq (&ep->lock);/* -* We don't want to sleep if the ep_poll_callback() sends us -* a wakeup in between. That's why we set the task state -* to TASK_INTERRUPTIBLE before doing the checks. +* Barrierless variant, waitqueue_active() is called under +* the same lock on wakeup ep_poll_callback() side, so it +* is safe to avoid an explicit barrier. */ -set_current_state (TASK_INTERRUPTIBLE ); +__set_current_state (TASK_INTERRUPTIBLE ); +/* -* Always short-circuit for fatal signals to allow -* threads to make a timely exit without the chance of -* finding more events available and fetching -* repeatedly. +* Do the final check under the lock. ep_scan_ready_list() +* plays with two lists (->rdllist and ->ovflist) and there +* is always a race when both lists are empty for short +* period of time although events are pending, so lock is +* important. */ -if (fatal_signal_pending (current)) { - res = -EINTR ; -break ; + eavail =ep_events_available (ep); +if (!eavail) { +if (signal_pending (current)) + res = -EINTR ; +else +__add_wait_queue_exclusive (&ep->wq, &wait); } +write_unlock_irq (&ep->lock); - eavail =ep_events_available (ep); -if (eavail) -break ; -if (signal_pending (current)) { - res = -EINTR ; +if (eavail || res)break ; - }if (!schedule_hrtimeout_range (to, slack,HRTIMER_MODE_ABS )) { timed_out =1 ;
@@ -1905,6 +1904,15 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, } send_events: +if (fatal_signal_pending (current)) { +/* +* Always short-circuit for fatal signals to allow +* threads to make a timely exit without the chance of +* finding more events available and fetching +* repeatedly. +*/ + res = -EINTR ; + }/* * Try to transfer events to user space. In case we get 0 events and * there's still timeout left over, we go trying again in search of
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/606 bpf: Fix bug in mmap() implementation for BPF array map
In reply to Sasha Levin[ Upstream commit 333291ce5055f2039afc907badaf5b66bc1adfdc ]
mmap() subsystem allows user-space application to memory-map region with initial page offset. This wasn't taken into account in initial implementation of BPF array memory-mapping. This would result in wrong pages, not taking into account requested page shift, being memory-mmaped into user-space. This patch fixes this gap and adds a test for such scenario.
--- kernel/bpf/arraymap.c | 7 ++++++- tools/testing/selftests/bpf/prog_tests/mmap.c | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
kernel/bpf/arraymap.c +6 -1
@@ -486,7 +486,12 @@ static int array_map_mmap(struct bpf_map *map, struct vm_area_struct *vma)if (!(map->map_flags &BPF_F_MMAPABLE ))return -EINVAL ; -return remap_vmalloc_range (vma,array_map_vmalloc_addr (array), pgoff); +if (vma->vm_pgoff *PAGE_SIZE + (vma->vm_end - vma->vm_start) > +PAGE_ALIGN ((u64 )array->map.max_entries * array->elem_size)) +return -EINVAL ; + +return remap_vmalloc_range (vma,array_map_vmalloc_addr (array), + vma->vm_pgoff + pgoff); }const struct bpf_map_ops array_map_ops = {
tools/testing/selftests/bpf/prog_tests/mmap.c +9 -0
@@ -197,6 +197,15 @@ void test_mmap(void)CHECK_FAIL (map_data->val[far] !=3 *321 );munmap (tmp2,4 * page_size); + +/* map all 4 pages, but with pg_off=1 page, should fail */ + tmp1 =mmap (NULL ,4 * page_size,PROT_READ ,MAP_SHARED |MAP_FIXED , + data_map_fd, page_size/* initial page shift */ ); +if (CHECK (tmp1 !=MAP_FAILED ,"adv_mmap7" ,"unexpected success" )) { +munmap (tmp1,4 * page_size); + goto cleanup; + } + cleanup:if (bss_mmaped)CHECK_FAIL (munmap (bss_mmaped, bss_sz));
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 7/606 NFSv3: fix rpc receive buffer size for MOUNT call
In reply to Sasha LevinFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit 8eed292bc8cbf737e46fb1c119d4c8f6dcb00650 ]
Prior to commit e3d3ab64dd66 ("SUNRPC: Use au_rslack when computing reply buffer size"), there was enough slack in the reply buffer to commodate filehandles of size 60bytes. However, the real problem was that the reply buffer size for the MOUNT operation was not correctly calculated. Received buffer size used the filehandle size for NFSv2 (32bytes) which is much smaller than the allowed filehandle size for the v3 mounts.
Fix the reply buffer size (decode arguments size) for the MNT command.
--- fs/nfs/mount_clnt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/mount_clnt.c +2 -1
@@ -30,6 +30,7 @@#define encode_dirpath_sz (1 + XDR_QUADLEN(MNTPATHLEN))#define MNT_status_sz (1)#define MNT_fhandle_sz XDR_QUADLEN(NFS2_FHSIZE) +#define MNT_fhandlev3_sz XDR_QUADLEN(NFS3_FHSIZE)#define MNT_authflav3_sz (1 + NFS_MAX_SECFLAVORS)/*
@@ -37,7 +38,7 @@*/ #define MNT_enc_dirpath_sz encode_dirpath_sz#define MNT_dec_mountres_sz (MNT_status_sz + MNT_fhandle_sz) -#define MNT_dec_mountres3_sz (MNT_status_sz + MNT_fhandle_sz + \ +#define MNT_dec_mountres3_sz (MNT_status_sz + MNT_fhandlev3_sz + \ MNT_authflav3_sz)/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 8/606 pnp: Use list_for_each_entry() instead of open coding
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
commit 01b2bafe57b19d9119413f138765ef57990921ce upstream.
Aside from good practice, this avoids a warning from gcc 10:
./include/linux/kernel.h:997:3: warning: array subscript -31 is outside array bounds of ‘struct list_head[1]’ [-Warray-bounds]
997 | ((type *)(__mptr - offsetof(type, member))); })
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/list.h:493:2: note: in expansion of macro ‘container_of’
493 | container_of(ptr, type, member)
| ^~~~~~~~~~~~
./include/linux/pnp.h:275:30: note: in expansion of macro ‘list_entry’
275 | #define global_to_pnp_dev(n) list_entry(n, struct pnp_dev, global_list)
| ^~~~~~~~~~
./include/linux/pnp.h:281:11: note: in expansion of macro ‘global_to_pnp_dev’
281 | (dev) != global_to_pnp_dev(&pnp_global); \
| ^~~~~~~~~~~~~~~~~arch/x86/kernel/rtc.c:189:2: note: in expansion of macro ‘pnp_for_each_dev’
189 | pnp_for_each_dev(dev) {
Because the common code doesn't cast the starting list_head to the containing struct.
--- include/linux/pnp.h | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-)
include/linux/pnp.h +9 -20
@@ -220,10 +220,8 @@ struct pnp_card {#define global_to_pnp_card (n) list_entry(n, struct pnp_card, global_list)#define protocol_to_pnp_card (n) list_entry(n, struct pnp_card, protocol_list)#define to_pnp_card (n) container_of(n, struct pnp_card, dev) -#define pnp_for_each_card (card) \ - for((card) = global_to_pnp_card(pnp_cards.next); \ - (card) != global_to_pnp_card(&pnp_cards); \ - (card) = global_to_pnp_card((card)->global_list.next)) +#define pnp_for_each_card (card) \ + list_for_each_entry(card, &pnp_cards, global_list)struct pnp_card_link {struct pnp_card *card;
@@ -276,14 +274,9 @@ struct pnp_dev {#define card_to_pnp_dev (n) list_entry(n, struct pnp_dev, card_list)#define protocol_to_pnp_dev (n) list_entry(n, struct pnp_dev, protocol_list)#define to_pnp_dev (n) container_of(n, struct pnp_dev, dev) -#define pnp_for_each_dev (dev) \ - for((dev) = global_to_pnp_dev(pnp_global.next); \ - (dev) != global_to_pnp_dev(&pnp_global); \ - (dev) = global_to_pnp_dev((dev)->global_list.next)) -#define card_for_each_dev (card,dev) \ - for((dev) = card_to_pnp_dev((card)->devices.next); \ - (dev) != card_to_pnp_dev(&(card)->devices); \ - (dev) = card_to_pnp_dev((dev)->card_list.next)) +#define pnp_for_each_dev (dev) list_for_each_entry(dev, &pnp_global, global_list) +#define card_for_each_dev (card, dev) \ + list_for_each_entry(dev, &(card)->devices, card_list)#define pnp_dev_name (dev) (dev)->namestatic inline void *pnp_get_drvdata (struct pnp_dev *pdev)
@@ -437,14 +430,10 @@ struct pnp_protocol { };#define to_pnp_protocol (n) list_entry(n, struct pnp_protocol, protocol_list) -#define protocol_for_each_card (protocol,card) \ - for((card) = protocol_to_pnp_card((protocol)->cards.next); \ - (card) != protocol_to_pnp_card(&(protocol)->cards); \ - (card) = protocol_to_pnp_card((card)->protocol_list.next)) -#define protocol_for_each_dev (protocol,dev) \ - for((dev) = protocol_to_pnp_dev((protocol)->devices.next); \ - (dev) != protocol_to_pnp_dev(&(protocol)->devices); \ - (dev) = protocol_to_pnp_dev((dev)->protocol_list.next)) +#define protocol_for_each_card (protocol, card) \ + list_for_each_entry(card, &(protocol)->cards, protocol_list) +#define protocol_for_each_dev (protocol, dev) \ + list_for_each_entry(dev, &(protocol)->devices, protocol_list)extern struct bus_type pnp_bus_type;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/606 net/rds: Use ERR_PTR for rds_message_alloc_sgs()
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
commit 7dba92037baf3fa00b4880a31fd532542264994c upstream.
Returning the error code via a 'int *ret' when the function returns a pointer is very un-kernely and causes gcc 10's static analysis to choke:
net/rds/message.c: In function ‘rds_message_map_pages’:net/rds/message.c:358:10: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
358 | return ERR_PTR(ret);
Use a typical ERR_PTR return instead.
--- net/rds/message.c | 19 ++++++------------- net/rds/rdma.c | 12 ++++++++---- net/rds/rds.h | 3 +-- net/rds/send.c | 6 ++++-- 4 files changed, 19 insertions(+), 21 deletions(-)
net/rds/message.c +6 -13
@@ -308,26 +308,20 @@ struct rds_message *rds_message_alloc(unsigned int extra_len, gfp_t gfp)/* * RDS ops use this to grab SG entries from the rm's sg pool. */ -struct scatterlist *rds_message_alloc_sgs (struct rds_message *rm,int nents, -int *ret) +struct scatterlist *rds_message_alloc_sgs (struct rds_message *rm,int nents) {struct scatterlist *sg_first = (struct scatterlist *) &rm[1 ];struct scatterlist *sg_ret; -if (WARN_ON (!ret)) -return NULL ; -if (nents <=0 ) {pr_warn ("rds: alloc sgs failed! nents <= 0\n" ); - *ret = -EINVAL ; -return NULL ; +return ERR_PTR (-EINVAL ); }if (rm->m_used_sgs + nents > rm->m_total_sgs) {pr_warn ("rds: alloc sgs failed! total %d used %d nents %d\n" , rm->m_total_sgs, rm->m_used_sgs, nents); - *ret = -ENOMEM ; -return NULL ; +return ERR_PTR (-ENOMEM ); } sg_ret = &sg_first[rm->m_used_sgs];
@@ -343,7 +337,6 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned inunsigned int i;int num_sgs =DIV_ROUND_UP (total_len,PAGE_SIZE );int extra_bytes = num_sgs *sizeof (struct scatterlist ); -int ret; rm =rds_message_alloc (extra_bytes,GFP_NOWAIT );if (!rm)
@@ -352,10 +345,10 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned inset_bit (RDS_MSG_PAGEVEC , &rm->m_flags); rm->m_inc.i_hdr.h_len =cpu_to_be32 (total_len); rm->data.op_nents =DIV_ROUND_UP (total_len,PAGE_SIZE ); - rm->data.op_sg =rds_message_alloc_sgs (rm, num_sgs, &ret); -if (!rm->data.op_sg) { + rm->data.op_sg =rds_message_alloc_sgs (rm, num_sgs); +if (IS_ERR (rm->data.op_sg)) {rds_message_put (rm); -return ERR_PTR (ret); +return ERR_CAST (rm->data.op_sg); }for (i =0 ; i < rm->data.op_nents; ++i) {
net/rds/rdma.c +8 -4
@@ -664,9 +664,11 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm, op->op_odp_mr =NULL ;WARN_ON (!nr_pages); - op->op_sg =rds_message_alloc_sgs (rm, nr_pages, &ret); -if (!op->op_sg) + op->op_sg =rds_message_alloc_sgs (rm, nr_pages); +if (IS_ERR (op->op_sg)) { + ret =PTR_ERR (op->op_sg); goto out_pages; + }if (op->op_notify || op->op_recverr) {/* We allocate an uninitialized notifier here, because
@@ -905,9 +907,11 @@ int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm, rm->atomic.op_silent = !!(args->flags &RDS_RDMA_SILENT ); rm->atomic.op_active =1 ; rm->atomic.op_recverr = rs->rs_recverr; - rm->atomic.op_sg =rds_message_alloc_sgs (rm,1 , &ret); -if (!rm->atomic.op_sg) + rm->atomic.op_sg =rds_message_alloc_sgs (rm,1 ); +if (IS_ERR (rm->atomic.op_sg)) { + ret =PTR_ERR (rm->atomic.op_sg); goto err; + }/* verify 8 byte-aligned */ if (args->local_addr &0x7 ) {
net/rds/rds.h +1 -2
@@ -852,8 +852,7 @@ rds_conn_connecting(struct rds_connection *conn)/* message.c */ struct rds_message *rds_message_alloc (unsigned int nents,gfp_t gfp); -struct scatterlist *rds_message_alloc_sgs (struct rds_message *rm,int nents, -int *ret); +struct scatterlist *rds_message_alloc_sgs (struct rds_message *rm,int nents);int rds_message_copy_from_user (struct rds_message *rm,struct iov_iter *from,bool zcopy);struct rds_message *rds_message_map_pages (unsigned long *page_addrs,unsigned int total_len);
net/rds/send.c +4 -2
@@ -1274,9 +1274,11 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)/* Attach data to the rm */ if (payload_len) { - rm->data.op_sg =rds_message_alloc_sgs (rm, num_sgs, &ret); -if (!rm->data.op_sg) + rm->data.op_sg =rds_message_alloc_sgs (rm, num_sgs); +if (IS_ERR (rm->data.op_sg)) { + ret =PTR_ERR (rm->data.op_sg); goto out; + } ret =rds_message_copy_from_user (rm, &msg->msg_iter, zcopy);if (ret) goto out;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/606 Stop the ad-hoc games with -Wno-maybe-initialized
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 78a5255ffb6a1af189a83e493d916ba1c54d8c75 upstream.
We have some rather random rules about when we accept the "maybe-initialized" warnings, and when we don't.
For example, we consider it unreliable for gcc versions < 4.9, but also if -O3 is enabled, or if optimizing for size. And then various kernel config options disabled it, because they know that they trigger that warning by confusing gcc sufficiently (ie PROFILE_ALL_BRANCHES).
And now gcc-10 seems to be introducing a lot of those warnings too, so it falls under the same heading as 4.9 did.
At the same time, we have a very straightforward way to _enable_ that warning when wanted: use "W=2" to enable more warnings.
So stop playing these ad-hoc games, and just disable that warning by default, with the known and straight-forward "if you want to work on the extra compiler warnings, use W=123".
Would it be great to have code that is always so obvious that it never confuses the compiler whether a variable is used initialized or not? Yes, it would. In a perfect world, the compilers would be smarter, and our source code would be simpler.
That's currently not the world we live in, though.
--- Makefile | 7 +++---- init/Kconfig | 18 ------------------ kernel/trace/Kconfig | 1 - 3 files changed, 3 insertions(+), 23 deletions(-)
Makefile +3 -4
@@ -708,10 +708,6 @@ else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os endif -ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED -KBUILD_CFLAGS += -Wno-maybe-uninitialized -endif - # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
@@ -861,6 +857,9 @@ KBUILD_CFLAGS += -Wno-pointer-sign # disable stringop warnings in gcc 8+ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) +# Enabled with W=2, disabled by default as noisy +KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized) + # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
init/Kconfig +0 -18
@@ -36,22 +36,6 @@ config TOOLS_SUPPORT_RELR config CC_HAS_ASM_INLINE def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) -x c - -c -o /dev/null) -config CC_HAS_WARN_MAYBE_UNINITIALIZED - def_bool $(cc-option,-Wmaybe-uninitialized) - help - GCC >= 4.7 supports this option. - -config CC_DISABLE_WARN_MAYBE_UNINITIALIZED - bool - depends on CC_HAS_WARN_MAYBE_UNINITIALIZED - default CC_IS_GCC && GCC_VERSION < 40900 # unreliable for GCC < 4.9 - help - GCC's -Wmaybe-uninitialized is not reliable by definition. - Lots of false positive warnings are produced in some cases. - - If this option is enabled, -Wno-maybe-uninitialzed is passed - to the compiler to suppress maybe-uninitialized warnings. - config CONSTRUCTORS bool depends on !UML
@@ -1249,14 +1233,12 @@ config CC_OPTIMIZE_FOR_PERFORMANCE config CC_OPTIMIZE_FOR_PERFORMANCE_O3 bool "Optimize more for performance (-O3)" depends on ARC - imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives help Choosing this option will pass "-O3" to your compiler to optimize the kernel yet more for performance. config CC_OPTIMIZE_FOR_SIZE bool "Optimize for size (-Os)" - imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives help Choosing this option will pass "-Os" to your compiler resulting in a smaller kernel.
kernel/trace/Kconfig +0 -1
@@ -466,7 +466,6 @@ config PROFILE_ANNOTATED_BRANCHES config PROFILE_ALL_BRANCHES bool "Profile all if conditionals" if !FORTIFY_SOURCE select TRACE_BRANCH_PROFILING - imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives help This tracer profiles all branch conditions. Every if () taken in the kernel is recorded whether it hit or miss.
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/606 gcc-10: disable 'zero-length-bounds' warning for now
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 5c45de21a2223fe46cf9488c99a7fbcf01527670 upstream.
This is a fine warning, but we still have a number of zero-length arrays in the kernel that come from the traditional gcc extension. Yes, they are getting converted to flexible arrays, but in the meantime the gcc-10 warning about zero-length bounds is very verbose, and is hiding other issues.
I missed one actual build failure because it was hidden among hundreds of lines of warning. Thankfully I caught it on the second go before pushing things out, but it convinced me that I really need to disable the new warnings for now.
We'll hopefully be all done with our conversion to flexible arrays in the not too distant future, and we can then re-enable this warning.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -857,6 +857,9 @@ KBUILD_CFLAGS += -Wno-pointer-sign # disable stringop warnings in gcc 8+ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) +# We'll want to enable this eventually, but it's not going away for 5.7 at least +KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) + # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 12/606 gcc-10: disable 'array-bounds' warning for now
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 44720996e2d79e47d508b0abe99b931a726a3197 upstream.
This is another fine warning, related to the 'zero-length-bounds' one, but hitting the same historical code in the kernel.
Because C didn't historically support flexible array members, we have code that instead uses a one-sized array, the same way we have cases of zero-sized arrays.
The one-sized arrays come from either not wanting to use the gcc zero-sized array extension, or from a slight convenience-feature, where particularly for strings, the size of the structure now includes the allocation for the final NUL character.
So with a "char name[1];" at the end of a structure, you can do things like
v = my_malloc(sizeof(struct vendor) + strlen(name));
and avoid the "+1" for the terminator.
Yes, the modern way to do that is with a flexible array, and using 'offsetof()' instead of 'sizeof()', and adding the "+1" by hand. That also technically gets the size "more correct" in that it avoids any alignment (and thus padding) issues, but this is another long-term cleanup thing that will not happen for 5.7.
So disable the warning for now, even though it's potentially quite useful. Having a slew of warnings that then hide more urgent new issues is not an improvement.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -859,6 +859,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) # We'll want to enable this eventually, but it's not going away for 5.7 at least KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) +KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds) # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 13/606 gcc-10: disable 'stringop-overflow' warning for now
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 5a76021c2eff7fcf2f0918a08fd8a37ce7922921 upstream.
This is the final array bounds warning removal for gcc-10 for now.
Again, the warning is good, and we should re-enable all these warnings when we have converted all the legacy array declaration cases to flexible arrays. But in the meantime, it's just noise.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -860,6 +860,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) # We'll want to enable this eventually, but it's not going away for 5.7 at least KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds) +KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow) # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 14/606 gcc-10: disable 'restrict' warning for now
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit adc71920969870dfa54e8f40dac8616284832d02 upstream.
gcc-10 now warns about passing aliasing pointers to functions that take restricted pointers.
That's actually a great warning, and if we ever start using 'restrict' in the kernel, it might be quite useful. But right now we don't, and it turns out that the only thing this warns about is an idiom where we have declared a few functions to be "printf-like" (which seems to make gcc pick up the restricted pointer thing), and then we print to the same buffer that we also use as an input.
And people do that as an odd concatenation pattern, with code like this:
#define sysfs_show_gen_prop(buffer, fmt, ...) \
snprintf(buffer, PAGE_SIZE, "%s"fmt, buffer, __VA_ARGS__)where we have 'buffer' as both the destination of the final result, and as the initial argument.
Yes, it's a bit questionable. And outside of the kernel, people do have standard declarations like
int snprintf( char *restrict buffer, size_t bufsz,
const char *restrict format, ... );
where that output buffer is marked as a restrict pointer that cannot alias with any other arguments.
But in the context of the kernel, that 'use snprintf() to concatenate to the end result' does work, and the pattern shows up in multiple places. And we have not marked our own version of snprintf() as taking restrict pointers, so the warning is incorrect for now, and gcc picks it up on its own.
If we do start using 'restrict' in the kernel (and it might be a good idea if people find places where it matters), we'll need to figure out how to avoid this issue for snprintf and friends. But in the meantime, this warning is not useful.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -862,6 +862,9 @@ KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds) KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow) +# Another good warning that we'll want to enable eventually +KBUILD_CFLAGS += $(call cc-disable-warning, restrict) + # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 15/606 gcc-10 warnings: fix low-hanging fruit
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 9d82973e032e246ff5663c9805fbb5407ae932e3 upstream.
Due to a bug-report that was compiler-dependent, I updated one of my machines to gcc-10. That shows a lot of new warnings. Happily they seem to be mostly the valid kind, but it's going to cause a round of churn for getting rid of them..
This is the really low-hanging fruit of removing a couple of zero-sized arrays in some core code. We have had a round of these patches before, and we'll have many more coming, and there is nothing special about these except that they were particularly trivial, and triggered more warnings than most.
--- include/linux/fs.h | 2 +- include/linux/tty.h | 2 +- scripts/kallsyms.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
include/linux/fs.h +1 -1
@@ -978,7 +978,7 @@ struct file_handle {__u32 handle_bytes;int handle_type;/* file identifier */ -unsigned char f_handle[0 ]; +unsigned char f_handle[]; };static inline struct file *get_file (struct file *f)
include/linux/tty.h +1 -1
@@ -66,7 +66,7 @@ struct tty_buffer {int read;int flags;/* Data points here */ -unsigned long data[0 ]; +unsigned long data[]; };/* Values for .flags field of tty_buffer */
scripts/kallsyms.c +1 -1
@@ -34,7 +34,7 @@ struct sym_entry {unsigned int len;unsigned int start_pos;unsigned int percpu_absolute; -unsigned char sym[0 ]; +unsigned char sym[]; };struct addr_range {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 16/606 gcc-10: mark more functions __init to avoid section mismatch warnings
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit e99332e7b4cda6e60f5b5916cf9943a79dbef902 upstream.
It seems that for whatever reason, gcc-10 ends up not inlining a couple of functions that used to be inlined before. Even if they only have one single callsite - it looks like gcc may have decided that the code was unlikely, and not worth inlining.
The code generation difference is harmless, but caused a few new section mismatch errors, since the (now no longer inlined) function wasn't in the __init section, but called other init functions:
Section mismatch in reference from the function kexec_free_initrd() to the function .init.text:free_initrd_mem() Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memremap() Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
So add the appropriate __init annotation to make modpost not complain. In both cases there were trivially just a single callsite from another __init function.
--- drivers/firmware/efi/tpm.c | 2 +- init/initramfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/tpm.c +1 -1
@@ -16,7 +16,7 @@int efi_tpm_final_log_size;EXPORT_SYMBOL (efi_tpm_final_log_size); -static int tpm2_calc_event_log_size (void *data,int count,void *size_info) +static int __init tpm2_calc_event_log_size (void *data,int count,void *size_info) {struct tcg_pcr_event2_head *header;int event_size, size =0 ;
init/initramfs.c +1 -1
@@ -542,7 +542,7 @@ void __weak free_initrd_mem(unsigned long start, unsigned long end) }#ifdef CONFIG_KEXEC_CORE -static bool kexec_free_initrd (void ) +static bool __init kexec_free_initrd (void ) {unsigned long crashk_start = (unsigned long )__va (crashk_res.start);unsigned long crashk_end = (unsigned long )__va (crashk_res.end);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 17/606 gcc-10: avoid shadowing standard library 'free()' in crypto
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 1a263ae60b04de959d9ce9caea4889385eefcc7b upstream.
gcc-10 has started warning about conflicting types for a few new built-in functions, particularly 'free()'.
This results in warnings like:
crypto/xts.c:325:13: warning: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Wbuiltin-declaration-mismatch]
because the crypto layer had its local freeing functions called 'free()'.
Gcc-10 is in the wrong here, since that function is marked 'static', and thus there is no chance of confusion with any standard library function namespace.
But the simplest thing to do is to just use a different name here, and avoid this gcc mis-feature.
[ Side note: gcc knowing about 'free()' is in itself not the
mis-feature: the semantics of 'free()' are special enough that a compiler can validly do special things when seeing it.
So the mis-feature here is that gcc thinks that 'free()' is some restricted name, and you can't shadow it as a local static function.
Making the special 'free()' semantics be a function attribute rather than tied to the name would be the much better model ]
--- crypto/lrw.c | 4 ++-- crypto/xts.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
crypto/lrw.c +2 -2
@@ -287,7 +287,7 @@ static void exit_tfm(struct crypto_skcipher *tfm)crypto_free_skcipher (ctx->child); } -static void free (struct skcipher_instance *inst) +static void free_inst (struct skcipher_instance *inst) {crypto_drop_skcipher (skcipher_instance_ctx (inst));kfree (inst);
@@ -400,7 +400,7 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb) inst->alg.encrypt = encrypt; inst->alg.decrypt = decrypt; - inst->free = free; + inst->free = free_inst; err =skcipher_register_instance (tmpl, inst);if (err)
crypto/xts.c +2 -2
@@ -322,7 +322,7 @@ static void exit_tfm(struct crypto_skcipher *tfm)crypto_free_cipher (ctx->tweak); } -static void free (struct skcipher_instance *inst) +static void free_inst (struct skcipher_instance *inst) {crypto_drop_skcipher (skcipher_instance_ctx (inst));kfree (inst);
@@ -434,7 +434,7 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb) inst->alg.encrypt = encrypt; inst->alg.decrypt = decrypt; - inst->free = free; + inst->free = free_inst; err =skcipher_register_instance (tmpl, inst);if (err)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 18/606 bootconfig: Fix to remove bootconfig data from initrd while boot
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
commit de462e5f10718517bacf2f84c8aa2804567ef7df upstream.
If there is a bootconfig data in the tail of initrd/initramfs, initrd image sanity check caused an error while decompression stage as follows.
[ 0.883882] Unpacking initramfs... [ 2.696429] Initramfs unpacking failed: invalid magic at start of compressed archive
This error will be ignored if CONFIG_BLK_DEV_RAM=n, but CONFIG_BLK_DEV_RAM=y the kernel failed to mount rootfs and causes a panic.
To fix this issue, shrink down the initrd_end for removing tailing bootconfig data while boot the kernel.
--- init/main.c | 69 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 17 deletions(-)
init/main.c +52 -17
@@ -257,6 +257,47 @@ static int __init loglevel(char *str)early_param ("loglevel" , loglevel); +#ifdef CONFIG_BLK_DEV_INITRD +static void *__init get_boot_config_from_initrd (u32 *_size,u32 *_csum) +{ +u32 size, csum; +char *data; +u32 *hdr; + +if (!initrd_end) +return NULL ; + + data = (char *)initrd_end -BOOTCONFIG_MAGIC_LEN ; +if (memcmp (data,BOOTCONFIG_MAGIC ,BOOTCONFIG_MAGIC_LEN )) +return NULL ; + + hdr = (u32 *)(data -8 ); + size = hdr[0 ]; + csum = hdr[1 ]; + + data = ((void *)hdr) - size; +if ((unsigned long )data < initrd_start) { +pr_err ("bootconfig size %d is greater than initrd size %ld\n" , + size, initrd_end - initrd_start); +return NULL ; + } + +/* Remove bootconfig from initramfs/initrd */ + initrd_end = (unsigned long )data; +if (_size) + *_size = size; +if (_csum) + *_csum = csum; + +return data; +} +#else +static void *__init get_boot_config_from_initrd (u32 *_size,u32 *_csum) +{ +return NULL ; +} +#endif +#ifdef CONFIG_BOOT_CONFIG char xbc_namebuf[XBC_KEYLEN_MAX ]__initdata ;
@@ -355,9 +396,12 @@ static void __init setup_boot_config(const char *cmdline)static char tmp_cmdline[COMMAND_LINE_SIZE ]__initdata ;u32 size, csum;char *data, *copy; -u32 *hdr;int ret; + data =get_boot_config_from_initrd (&size, &csum); +if (!data) + goto not_found; +strlcpy (tmp_cmdline, boot_command_line,COMMAND_LINE_SIZE );parse_args ("bootconfig" , tmp_cmdline,NULL ,0 ,0 ,0 ,NULL , bootconfig_params);
@@ -365,27 +409,12 @@ static void __init setup_boot_config(const char *cmdline)if (!bootconfig_found)return ; -if (!initrd_end) - goto not_found; - - data = (char *)initrd_end -BOOTCONFIG_MAGIC_LEN ; -if (memcmp (data,BOOTCONFIG_MAGIC ,BOOTCONFIG_MAGIC_LEN )) - goto not_found; - - hdr = (u32 *)(data -8 ); - size = hdr[0 ]; - csum = hdr[1 ]; -if (size >=XBC_DATA_MAX ) {pr_err ("bootconfig size %d greater than max size %d\n" , size,XBC_DATA_MAX );return ; } - data = ((void *)hdr) - size; -if ((unsigned long )data < initrd_start) - goto not_found; -if (boot_config_checksum ((unsigned char *)data, size) != csum) {pr_err ("bootconfig checksum failed\n" );return ;
@@ -414,8 +443,14 @@ static void __init setup_boot_config(const char *cmdline) not_found: pr_err("'bootconfig' found on command line, but no bootconfig found\n"); } +#else -#define setup_boot_config (cmdline) do { } while (0) + +static void __init setup_boot_config (const char *cmdline) +{ +/* Remove bootconfig data from initrd */ +get_boot_config_from_initrd (NULL ,NULL ); +}static int __init warn_bootconfig (char *str) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 19/606 bootconfig: Fix to prevent warning message if no bootconfig option
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
commit 611d0a95d46b0977a530b4d538948c69d447b001 upstream.
Commit de462e5f1071 ("bootconfig: Fix to remove bootconfig data from initrd while boot") causes a cosmetic regression on dmesg, which warns "no bootconfig data" message without bootconfig cmdline option.
Fix setup_boot_config() by moving no bootconfig check after commandline option check.
--- init/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
init/main.c +6 -4
@@ -398,9 +398,8 @@ static void __init setup_boot_config(const char *cmdline)char *data, *copy;int ret; +/* Cut out the bootconfig data even if we have no bootconfig option */ data =get_boot_config_from_initrd (&size, &csum); -if (!data) - goto not_found;strlcpy (tmp_cmdline, boot_command_line,COMMAND_LINE_SIZE ); parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
@@ -409,6 +408,11 @@ static void __init setup_boot_config(const char *cmdline)if (!bootconfig_found)return ; +if (!data) { +pr_err ("'bootconfig' found on command line, but no bootconfig found\n" ); +return ; + } +if (size >=XBC_DATA_MAX ) {pr_err ("bootconfig size %d greater than max size %d\n" , size,XBC_DATA_MAX );
@@ -440,8 +444,6 @@ static void __init setup_boot_config(const char *cmdline) extra_init_args = xbc_make_cmdline("init"); }return ; -not_found: -pr_err ("'bootconfig' found on command line, but no bootconfig found\n" ); }#else
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 20/606 usb: usbfs: correct kernel->user page attribute mismatch
In reply to Sasha LevinFrom: Jeremy Linton <[email protected]>
commit 2bef9aed6f0e22391c8d4570749b1acc9bc3981e upstream.
On some architectures (e.g. arm64) requests for IO coherent memory may use non-cachable attributes if the relevant device isn't cache coherent. If these pages are then remapped into userspace as cacheable, they may not be coherent with the non-cacheable mappings.
In particular this happens with libusb, when it attempts to create zero-copy buffers for use by rtl-sdr
(https://github.com/osmocom/rtl-sdr/). On low end arm devices with non-coherent USB ports, the application will be unexpectedly killed, while continuing to work fine on arm machines with coherent USB controllers.
This bug has been discovered/reported a few times over the last few years. In the case of rtl-sdr a compile time option to enable/disable zero copy was implemented to work around it.
Rather than relaying on application specific workarounds, dma_mmap_coherent() can be used instead of remap_pfn_range(). The page cache/etc attributes will then be correctly set in userspace to match the kernel mapping.
--- drivers/usb/core/devio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/core/devio.c +2 -3
@@ -217,6 +217,7 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) {struct usb_memory *usbm =NULL ;struct usb_dev_state *ps = file->private_data; +struct usb_hcd *hcd =bus_to_hcd (ps->dev->bus);size_t size = vma->vm_end - vma->vm_start;void *mem;unsigned long flags;
@@ -250,9 +251,7 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) usbm->vma_use_count =1 ;INIT_LIST_HEAD (&usbm->memlist); -if (remap_pfn_range (vma, vma->vm_start, -virt_to_phys (usbm->mem) >>PAGE_SHIFT , - size, vma->vm_page_prot) <0 ) { +if (dma_mmap_coherent (hcd->self.sysdev, vma, mem, dma_handle, size)) {dec_usb_memory_use_count (usbm, &usbm->vma_use_count);return -EAGAIN ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 21/606 USB: usbfs: fix mmap dma mismatch
In reply to Sasha LevinFrom: Greg Kroah-Hartman <[email protected]>
commit a0e710a7def471b8eb779ff551fc27701da49599 upstream.
In commit 2bef9aed6f0e ("usb: usbfs: correct kernel->user page attribute mismatch") we switched from always calling remap_pfn_range() to call dma_mmap_coherent() to handle issues with systems with non-coherent USB host controller drivers. Unfortunatly, as syzbot quickly told us, not all the world is host controllers with DMA support, so we need to check what host controller we are attempting to talk to before doing this type of allocation.
Thanks to Christoph for the quick idea of how to fix this.
--- drivers/usb/core/devio.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/usb/core/devio.c +13 -3
@@ -251,9 +251,19 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) usbm->vma_use_count =1 ;INIT_LIST_HEAD (&usbm->memlist); -if (dma_mmap_coherent (hcd->self.sysdev, vma, mem, dma_handle, size)) { -dec_usb_memory_use_count (usbm, &usbm->vma_use_count); -return -EAGAIN ; +if (hcd->localmem_pool || !hcd_uses_dma (hcd)) { +if (remap_pfn_range (vma, vma->vm_start, +virt_to_phys (usbm->mem) >>PAGE_SHIFT , + size, vma->vm_page_prot) <0 ) { +dec_usb_memory_use_count (usbm, &usbm->vma_use_count); +return -EAGAIN ; + } + }else { +if (dma_mmap_coherent (hcd->self.sysdev, vma, mem, dma_handle, + size)) { +dec_usb_memory_use_count (usbm, &usbm->vma_use_count); +return -EAGAIN ; + } } vma->vm_flags |=VM_IO ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 22/606 ALSA: hda/realtek - Limit int mic boost for Thinkpad T530
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
commit b590b38ca305d6d7902ec7c4f7e273e0069f3bcc upstream.
Lenovo Thinkpad T530 seems to have a sensitive internal mic capture that needs to limit the mic boost like a few other Thinkpad models. Although we may change the quirk for ALC269_FIXUP_LENOVO_DOCK, this hits way too many other laptop models, so let's add a new fixup model that limits the internal mic boost on top of the existing quirk and apply to only T530.
--- sound/pci/hda/patch_realtek.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +9 -1
@@ -5856,6 +5856,7 @@ enum {ALC269_FIXUP_HP_LINE1_MIC1_LED ,ALC269_FIXUP_INV_DMIC ,ALC269_FIXUP_LENOVO_DOCK , +ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST ,ALC269_FIXUP_NO_SHUTUP ,ALC286_FIXUP_SONY_MIC_NO_PRESENCE , ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
@@ -6175,6 +6176,12 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT }, + [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc269_fixup_limit_int_mic_boost, + .chained = true, + .chain_id = ALC269_FIXUP_LENOVO_DOCK, + }, [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = { .type = HDA_FIXUP_FUNC, .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
@@ -7317,7 +7324,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x21b8 ,"Thinkpad Edge 14" ,ALC269_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x17aa ,0x21ca ,"Thinkpad L412" ,ALC269_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x17aa ,0x21e9 ,"Thinkpad Edge 15" ,ALC269_FIXUP_SKU_IGNORE ), -SND_PCI_QUIRK (0x17aa ,0x21f6 ,"Thinkpad T530" ,ALC269_FIXUP_LENOVO_DOCK ), +SND_PCI_QUIRK (0x17aa ,0x21f6 ,"Thinkpad T530" ,ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST ),SND_PCI_QUIRK (0x17aa ,0x21fa ,"Thinkpad X230" ,ALC269_FIXUP_LENOVO_DOCK ),SND_PCI_QUIRK (0x17aa ,0x21f3 ,"Thinkpad T430" ,ALC269_FIXUP_LENOVO_DOCK ), SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
@@ -7456,6 +7463,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"}, {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"}, {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"}, + {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"}, {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"}, {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 23/606 ALSA: hda/realtek - Add COEF workaround for ASUS ZenBook UX431DA
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
commit 1b94e59d30afecf18254ad413e953e7587645a20 upstream.
ASUS ZenBook UX431DA requires an additional COEF setup when booted from the recent Windows 10, otherwise it produces the noisy output. The quirk turns on COEF 0x1b bit 10 that has been cleared supposedly due to the pop noise reduction.
--- sound/pci/hda/patch_realtek.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/pci/hda/patch_realtek.c +13 -0
@@ -5978,6 +5978,7 @@ enum {ALC294_FIXUP_ASUS_DUAL_SPK ,ALC285_FIXUP_THINKPAD_HEADSET_JACK ,ALC294_FIXUP_ASUS_HPE , +ALC294_FIXUP_ASUS_COEF_1B , ALC285_FIXUP_HP_GPIO_LED, };
@@ -7112,6 +7113,17 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC294_FIXUP_ASUS_HEADSET_MIC }, + [ALC294_FIXUP_ASUS_COEF_1B] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb []) { +/* Set bit 10 to correct noisy output after reboot from +* Windows 10 (due to pop noise reduction?) +*/ + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x1b }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x4e4b }, + { } + }, + }, [ALC285_FIXUP_HP_GPIO_LED] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_gpio_led,
@@ -7283,6 +7295,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x19ce ,"ASUS B9450FA" ,ALC294_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x1a13 ,"Asus G73Jw" ,ALC269_FIXUP_ASUS_G73JW ),SND_PCI_QUIRK (0x1043 ,0x1a30 ,"ASUS X705UD" ,ALC256_FIXUP_ASUS_MIC ), +SND_PCI_QUIRK (0x1043 ,0x1b11 ,"ASUS UX431DA" ,ALC294_FIXUP_ASUS_COEF_1B ),SND_PCI_QUIRK (0x1043 ,0x1b13 ,"Asus U41SV" ,ALC269_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1043 ,0x1bbd ,"ASUS Z550MA" ,ALC255_FIXUP_ASUS_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 24/606 ALSA: rawmidi: Fix racy buffer resize under concurrent accesses
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
commit c1f6e3c818dd734c30f6a7eeebf232ba2cf3181d upstream.
The rawmidi core allows user to resize the runtime buffer via ioctl, and this may lead to UAF when performed during concurrent reads or
writes: the read/write functions unlock the runtime lock temporarily during copying form/to user-space, and that's the race window.
This patch fixes the hole by introducing a reference counter for the runtime buffer read/write access and returns -EBUSY error when the resize is performed concurrently against read/write.
Note that the ref count field is a simple integer instead of refcount_t here, since the all contexts accessing the buffer is basically protected with a spinlock, hence we need no expensive atomic ops. Also, note that this busy check is needed only against read / write functions, and not in receive/transmit callbacks; the race can happen only at the spinlock hole mentioned in the above, while the whole function is protected for receive / transmit callbacks.
--- include/sound/rawmidi.h | 1 + sound/core/rawmidi.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-)
include/sound/rawmidi.h +1 -0
@@ -61,6 +61,7 @@ struct snd_rawmidi_runtime {size_t avail_min;/* min avail for wakeup */ size_t avail;/* max used buffer for wakeup */ size_t xruns;/* over/underruns counter */ +int buffer_ref;/* buffer reference count */ /* misc */ spinlock_t lock;wait_queue_head_t sleep;
sound/core/rawmidi.c +27 -4
@@ -120,6 +120,17 @@ static void snd_rawmidi_input_event_work(struct work_struct *work) runtime->event (runtime->substream); } +/* buffer refcount management: call with runtime->lock held */ +static inline void snd_rawmidi_buffer_ref (struct snd_rawmidi_runtime *runtime) +{ + runtime->buffer_ref++; +} + +static inline void snd_rawmidi_buffer_unref (struct snd_rawmidi_runtime *runtime) +{ + runtime->buffer_ref--; +} +static int snd_rawmidi_runtime_create (struct snd_rawmidi_substream *substream) {struct snd_rawmidi_runtime *runtime;
@@ -669,6 +680,11 @@ static int resize_runtime_buffer(struct snd_rawmidi_runtime *runtime,if (!newbuf)return -ENOMEM ;spin_lock_irq (&runtime->lock); +if (runtime->buffer_ref) { +spin_unlock_irq (&runtime->lock); +kvfree (newbuf); +return -EBUSY ; + } oldbuf = runtime->buffer; runtime->buffer = newbuf; runtime->buffer_size = params->buffer_size;
@@ -1019,8 +1035,10 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,long result =0 , count1;struct snd_rawmidi_runtime *runtime = substream->runtime;unsigned long appl_ptr; +int err =0 ;spin_lock_irqsave (&runtime->lock, flags); +snd_rawmidi_buffer_ref (runtime);while (count >0 && runtime->avail) { count1 = runtime->buffer_size - runtime->appl_ptr;if (count1 > count)
@@ -1039,16 +1057,19 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,if (userbuf) {spin_unlock_irqrestore (&runtime->lock, flags);if (copy_to_user (userbuf + result, - runtime->buffer + appl_ptr, count1)) { -return result >0 ? result : -EFAULT ; - } + runtime->buffer + appl_ptr, count1)) + err = -EFAULT ;spin_lock_irqsave (&runtime->lock, flags); +if (err) + goto out; } result += count1; count -= count1; } + out: +snd_rawmidi_buffer_unref (runtime);spin_unlock_irqrestore (&runtime->lock, flags); -return result; +return result >0 ? result : err; } long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
@@ -1342,6 +1363,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,return -EAGAIN ; } } +snd_rawmidi_buffer_ref (runtime);while (count >0 && runtime->avail >0 ) { count1 = runtime->buffer_size - runtime->appl_ptr;if (count1 > count)
@@ -1373,6 +1395,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, } __end: count1 = runtime->avail < runtime->buffer_size; +snd_rawmidi_buffer_unref (runtime);spin_unlock_irqrestore (&runtime->lock, flags);if (count1)snd_rawmidi_output_trigger (substream,1 );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 25/606 ALSA: usb-audio: Add control message quirk delay for Kingston HyperX headset
In reply to Sasha LevinFrom: Jesus Ramos <[email protected]>
commit 073919e09ca445d4486968e3f851372ff44cf2b5 upstream.
Kingston HyperX headset with 0951:16ad also needs the same quirk for delaying the frequency controls.
--- sound/usb/quirks.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/usb/quirks.c +5 -4
@@ -1592,13 +1592,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)msleep (20 ); -/* Zoom R16/24, Logitech H650e, Jabra 550a needs a tiny delay here, -* otherwise requests like get/set frequency return as failed despite -* actually succeeding. +/* Zoom R16/24, Logitech H650e, Jabra 550a, Kingston HyperX needs a tiny +* delay here, otherwise requests like get/set frequency return as +* failed despite actually succeeding. */ if ((chip->usb_id ==USB_ID (0x1686 ,0x00dd ) || chip->usb_id ==USB_ID (0x046d ,0x0a46 ) || - chip->usb_id ==USB_ID (0x0b0e ,0x0349 )) && + chip->usb_id ==USB_ID (0x0b0e ,0x0349 ) || + chip->usb_id ==USB_ID (0x0951 ,0x16ad )) && (requesttype &USB_TYPE_MASK ) ==USB_TYPE_CLASS )usleep_range (1000 ,2000 ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 26/606 usb: core: hub: limit HUB_QUIRK_DISABLE_AUTOSUSPEND to USB5534B
In reply to Sasha LevinFrom: Eugeniu Rosca <[email protected]>
commit 76e1ef1d81a4129d7e2fb8c48c83b166d1c8e040 upstream.
On Tue, May 12, 2020 at 09:36:07PM +0800, Kai-Heng Feng wrote [1]:
Quoted 1 line
This patch prevents my Raven Ridge xHCI from getting runtime suspend.
The problem described in v5.6 commit 1208f9e1d758c9 ("USB: hub: Fix the broken detection of USB3 device in SMSC hub") applies solely to the USB5534B hub [2] present on the Kingfisher Infotainment Carrier Board, manufactured by Shimafuji Electric Inc [3].
Despite that, the aforementioned commit applied the quirk to _all_ hubs carrying vendor ID 0x424 (i.e. SMSC), of which there are more [4] than initially expected. Consequently, the quirk is now enabled on platforms carrying SMSC/Microchip hub models which potentially don't exhibit the original issue.
To avoid reports like [1], further limit the quirk's scope to USB5534B [2], by employing both Vendor and Product ID checks.
Tested on H3ULCB + Kingfisher rev. M05.
[1] https://lore.kernel.org/linux-renesas-soc/[email protected]/
[2] https://www.microchip.com/wwwproducts/en/USB5534B
[3] http://www.shimafuji.co.jp/wp/wp-content/uploads/2018/08/SBEV-RCAR-KF-M06Board_HWSpecificationEN_Rev130.pdf
[4] https://devicehunt.com/search/type/usb/vendor/0424/device/any
--- drivers/usb/core/hub.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +5 -1
@@ -39,6 +39,7 @@#define USB_VENDOR_GENESYS_LOGIC 0x05e3#define USB_VENDOR_SMSC 0x0424 +#define USB_PRODUCT_USB5534B 0x5534#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01#define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02
@@ -5621,8 +5622,11 @@ static void hub_event(struct work_struct *work) }static const struct usb_device_id hub_id_table[] = { - { .match_flags =USB_DEVICE_ID_MATCH_VENDOR |USB_DEVICE_ID_MATCH_INT_CLASS , + { .match_flags =USB_DEVICE_ID_MATCH_VENDOR + |USB_DEVICE_ID_MATCH_PRODUCT + |USB_DEVICE_ID_MATCH_INT_CLASS , .idVendor =USB_VENDOR_SMSC , + .idProduct =USB_PRODUCT_USB5534B , .bInterfaceClass =USB_CLASS_HUB , .driver_info =HUB_QUIRK_DISABLE_AUTOSUSPEND }, { .match_flags =USB_DEVICE_ID_MATCH_VENDOR
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 27/606 usb: host: xhci-plat: keep runtime active when removing host
In reply to Sasha LevinFrom: Li Jun <[email protected]>
commit 1449cb2c2253d37d998c3714aa9b95416d16d379 upstream.
While removing the host (e.g. for USB role switch from host to device), if runtime pm is enabled by user, below oops occurs on dwc3 and cdns3 platforms.
Keeping the xhci-plat device active during host removal, and disabling runtime pm before calling pm_runtime_set_suspended() fixes them.
oops1:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000240 Internal error: Oops: 96000004 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.4.3-00107-g64d454a-dirty Hardware name: FSL i.MX8MP EVK (DT) Workqueue: pm pm_runtime_work pstate: 60000005 (nZCv daif -PAN -UAO) pc : xhci_suspend+0x34/0x698 lr : xhci_plat_runtime_suspend+0x2c/0x38 sp : ffff800011ddbbc0 Call trace: xhci_suspend+0x34/0x698 xhci_plat_runtime_suspend+0x2c/0x38 pm_generic_runtime_suspend+0x28/0x40 __rpm_callback+0xd8/0x138 rpm_callback+0x24/0x98 rpm_suspend+0xe0/0x448 rpm_idle+0x124/0x140 pm_runtime_work+0xa0/0xf8 process_one_work+0x1dc/0x370 worker_thread+0x48/0x468 kthread+0xf0/0x120 ret_from_fork+0x10/0x1c
oops2:
usb 2-1: USB disconnect, device number 2
xhci-hcd xhci-hcd.1.auto: remove, state 4
usb usb2: USB disconnect, device number 1
xhci-hcd xhci-hcd.1.auto: USB bus 2 deregistered
xhci-hcd xhci-hcd.1.auto: remove, state 4
usb usb1: USB disconnect, device number 1
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000138 Internal error: Oops: 96000004 [#1] PREEMPT SMP Modules linked in: CPU: 2 PID: 7 Comm: kworker/u8:0 Not tainted 5.6.0-rc4-next-20200304-03578 Hardware name: Freescale i.MX8QXP MEK (DT) Workqueue: 1-0050 tcpm_state_machine_work pstate: 20000005 (nzCv daif -PAN -UAO) pc : xhci_free_dev+0x214/0x270 lr : xhci_plat_runtime_resume+0x78/0x88 sp : ffff80001006b5b0 Call trace: xhci_free_dev+0x214/0x270 xhci_plat_runtime_resume+0x78/0x88 pm_generic_runtime_resume+0x30/0x48 __rpm_callback+0x90/0x148 rpm_callback+0x28/0x88 rpm_resume+0x568/0x758 rpm_resume+0x260/0x758 rpm_resume+0x260/0x758 __pm_runtime_resume+0x40/0x88 device_release_driver_internal+0xa0/0x1c8 device_release_driver+0x1c/0x28 bus_remove_device+0xd4/0x158 device_del+0x15c/0x3a0 usb_disable_device+0xb0/0x268 usb_disconnect+0xcc/0x300 usb_remove_hcd+0xf4/0x1dc xhci_plat_remove+0x78/0xe0 platform_drv_remove+0x30/0x50 device_release_driver_internal+0xfc/0x1c8 device_release_driver+0x1c/0x28 bus_remove_device+0xd4/0x158 device_del+0x15c/0x3a0 platform_device_del.part.0+0x20/0x90 platform_device_unregister+0x28/0x40 cdns3_host_exit+0x20/0x40 cdns3_role_stop+0x60/0x90 cdns3_role_set+0x64/0xd8 usb_role_switch_set_role.part.0+0x3c/0x68 usb_role_switch_set_role+0x20/0x30 tcpm_mux_set+0x60/0xf8 tcpm_reset_port+0xa4/0xf0 tcpm_detach.part.0+0x28/0x50 tcpm_state_machine_work+0x12ac/0x2360 process_one_work+0x1c8/0x470 worker_thread+0x50/0x428 kthread+0xfc/0x128 ret_from_fork+0x10/0x18 Code: c8037c02 35ffffa3 17ffe7c3 f9800011 (c85f7c01) ---[ end trace 45b1a173d2679e44 ]---
--- drivers/usb/host/xhci-plat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +3 -1
@@ -363,6 +363,7 @@ static int xhci_plat_remove(struct platform_device *dev)struct clk *reg_clk = xhci->reg_clk;struct usb_hcd *shared_hcd = xhci->shared_hcd; +pm_runtime_get_sync (&dev->dev); xhci->xhc_state |=XHCI_STATE_REMOVING ;usb_remove_hcd (shared_hcd);
@@ -376,8 +377,9 @@ static int xhci_plat_remove(struct platform_device *dev)clk_disable_unprepare (reg_clk);usb_put_hcd (hcd); -pm_runtime_set_suspended (&dev->dev);pm_runtime_disable (&dev->dev); +pm_runtime_put_noidle (&dev->dev); +pm_runtime_set_suspended (&dev->dev);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 28/606 usb: cdns3: gadget: prev_req->trb is NULL for ep0
In reply to Sasha LevinFrom: Peter Chen <[email protected]>
commit 95cd7dc47abd71d1a0c9c43594ff2fa32552f46c upstream.
And there are no multiple TRBs on EP0 and WA1 workaround, so it doesn't need to change TRB for EP0. It fixes below oops.
configfs-gadget gadget: high-speed config #1: bandroid_work: sent uevent USB_STATE=CONFIGURED
Unable to handle kernel read from unreadable memory at virtual address 0000000000000008
Mem abort info:android_work: sent uevent USB_STATE=DISCONNECTED
ESR = 0x96000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=00000008b5bb7000 [0000000000000008] pgd=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP Modules linked in: CPU: 2 PID: 430 Comm: HwBinder:401_1 Not tainted 5.4.24-06071-g6fa8921409c1-dirty #77 Hardware name: Freescale i.MX8QXP MEK (DT) pstate: 60400085 (nZCv daIf +PAN -UAO) pc : cdns3_gadget_ep_dequeue+0x1d4/0x270 lr : cdns3_gadget_ep_dequeue+0x48/0x270
sp : ffff800012763ba0
x29: ffff800012763ba0 x28: ffff00082c653c00
x27: 0000000000000000 x26: ffff000068fa7b00
x25: ffff0000699b2000 x24: ffff00082c6ac000
x23: ffff000834f0a480 x22: ffff000834e87b9c
x21: 0000000000000000 x20: ffff000834e87800
x19: ffff000069eddc00 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000000001
x11: ffff80001180fbe8 x10: 0000000000000001 x9 : ffff800012101558 x8 : 0000000000000001 x7 : 0000000000000006 x6 : ffff000835d9c668 x5 : ffff000834f0a4c8 x4 : 0000000096000000 x3 : 0000000000001810 x2 : 0000000000000000 x1 : ffff800024bd001c x0 : 0000000000000001
Call trace: cdns3_gadget_ep_dequeue+0x1d4/0x270 usb_ep_dequeue+0x34/0xf8 composite_dev_cleanup+0x154/0x170 configfs_composite_unbind+0x6c/0xa8 usb_gadget_remove_driver+0x44/0x70 usb_gadget_unregister_driver+0x74/0xe0 unregister_gadget+0x28/0x58 gadget_dev_desc_UDC_store+0x80/0x110 configfs_write_file+0x1e0/0x2a0 __vfs_write+0x48/0x90 vfs_write+0xe4/0x1c8 ksys_write+0x78/0x100 __arm64_sys_write+0x24/0x30 el0_svc_common.constprop.0+0x74/0x168 el0_svc_handler+0x34/0xa0 el0_svc+0x8/0xc Code: 52830203 b9407660 f94042e4 11000400 (b9400841) ---[ end trace 1574516e4c1772ca ]--- Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x0002,20002008
Memory Limit: none
Rebooting in 5 seconds..
--- drivers/usb/cdns3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/cdns3/gadget.c +1 -1
@@ -2548,7 +2548,7 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, link_trb = priv_req->trb;/* Update ring only if removed request is on pending_req_list list */ -if (req_on_hw_ring) { +if (req_on_hw_ring && link_trb) { link_trb->buffer =TRB_BUFFER (priv_ep->trb_pool_dma + ((priv_req->end_trb +1 ) *TRB_SIZE )); link_trb->control = (link_trb->control & TRB_CYCLE) |
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 29/606 USB: gadget: fix illegal array access in binding with UDC
In reply to Sasha LevinFrom: Kyungtae Kim <[email protected]>
commit 15753588bcd4bbffae1cca33c8ced5722477fe1f upstream.
FuzzUSB (a variant of syzkaller) found an illegal array access using an incorrect index while binding a gadget with UDC.
Reference: https://www.spinics.net/lists/linux-usb/msg194331.html
This bug occurs when a size variable used for a buffer
is misused to access its strcpy-ed buffer.
Given a buffer along with its size variable (taken from user input), from which, a new buffer is created using kstrdup().
Due to the original buffer containing 0 value in the middle,
the size of the kstrdup-ed buffer becomes smaller than that of the original. So accessing the kstrdup-ed buffer with the same size variable triggers memory access violation.
The fix makes sure no zero value in the buffer,
by comparing the strlen() of the orignal buffer with the size variable, so that the access to the kstrdup-ed buffer is safe.
BUG: KASAN: slab-out-of-bounds in gadget_dev_desc_UDC_store+0x1ba/0x200 drivers/usb/gadget/configfs.c:266 Read of size 1 at addr ffff88806a55dd7e by task syz-executor.0/17208 CPU: 2 PID: 17208 Comm: syz-executor.0 Not tainted 5.6.8 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xce/0x128 lib/dump_stack.c:118 print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374 __kasan_report+0x131/0x1b0 mm/kasan/report.c:506 kasan_report+0x12/0x20 mm/kasan/common.c:641 __asan_report_load1_noabort+0x14/0x20 mm/kasan/generic_report.c:132 gadget_dev_desc_UDC_store+0x1ba/0x200 drivers/usb/gadget/configfs.c:266 flush_write_buffer fs/configfs/file.c:251 [inline] configfs_write_file+0x2f1/0x4c0 fs/configfs/file.c:283 __vfs_write+0x85/0x110 fs/read_write.c:494 vfs_write+0x1cd/0x510 fs/read_write.c:558 ksys_write+0x18a/0x220 fs/read_write.c:611 __do_sys_write fs/read_write.c:623 [inline] __se_sys_write fs/read_write.c:620 [inline] __x64_sys_write+0x73/0xb0 fs/read_write.c:620 do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe
--- drivers/usb/gadget/configfs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/gadget/configfs.c +3 -0
@@ -260,6 +260,9 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,char *name;int ret; +if (strlen (page) < len) +return -EOVERFLOW ; + name =kstrdup (page,GFP_KERNEL );if (!name)return -ENOMEM ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 30/606 usb: xhci: Fix NULL pointer dereference when enqueuing trbs from urb sg list
In reply to Sasha LevinFrom: Sriharsha Allenki <[email protected]>
commit 3c6f8cb92c9178fc0c66b580ea3df1fa3ac1155a upstream.
On platforms with IOMMU enabled, multiple SGs can be coalesced into one by the IOMMU driver. In that case the SG list processing as part of the completion of a urb on a bulk endpoint can result into a NULL pointer dereference with the below stack dump.
<6> Unable to handle kernel NULL pointer dereference at virtual address 0000000c <6> pgd = c0004000
<6> [0000000c] *pgd=00000000
<6> Internal error: Oops: 5 [#1] PREEMPT SMP ARM
<2> PC is at xhci_queue_bulk_tx+0x454/0x80c
<2> LR is at xhci_queue_bulk_tx+0x44c/0x80c
<2> pc : [<c08907c4>] lr : [<c08907bc>] psr: 000000d3
<2> sp : ca337c80 ip : 00000000 fp : ffffffff <2> r10: 00000000 r9 : 50037000 r8 : 00004000 <2> r7 : 00000000 r6 : 00004000 r5 : 00000000 r4 : 00000000 <2> r3 : 00000000 r2 : 00000082 r1 : c2c1a200 r0 : 00000000
<2> Flags: nzcv IRQs off FIQs off Mode SVC_32 ISA ARM Segment none <2> Control: 10c0383d Table: b412c06a DAC: 00000051
<6> Process usb-storage (pid: 5961, stack limit = 0xca336210) <snip>
<2> [<c08907c4>] (xhci_queue_bulk_tx)
<2> [<c0881b3c>] (xhci_urb_enqueue)
<2> [<c0831068>] (usb_hcd_submit_urb)
<2> [<c08350b4>] (usb_sg_wait)
<2> [<c089f384>] (usb_stor_bulk_transfer_sglist)
<2> [<c089f2c0>] (usb_stor_bulk_srb)
<2> [<c089fe38>] (usb_stor_Bulk_transport)
<2> [<c089f468>] (usb_stor_invoke_transport)
<2> [<c08a11b4>] (usb_stor_control_thread)
<2> [<c014a534>] (kthread)
The above NULL pointer dereference is the result of block_len and the sent_len set to zero after the first SG of the list when IOMMU driver is enabled. Because of this the loop of processing the SGs has run more than num_sgs which resulted in a sg_next on the last SG of the list which has SG_END set.
Fix this by check for the sg before any attributes of the sg are accessed.
--- drivers/usb/host/xhci-ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-ring.c +2 -2
@@ -3425,8 +3425,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,/* New sg entry */ --num_sgs; sent_len -= block_len; -if (num_sgs !=0 ) { - sg =sg_next (sg); + sg =sg_next (sg); +if (num_sgs !=0 && sg) { block_len =sg_dma_len (sg); addr = (u64 )sg_dma_address (sg); addr += sent_len;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 31/606 Make the "Reducing compressed framebufer size" message be DRM_INFO_ONCE()
In reply to Sasha LevinFrom: Peter Jones <[email protected]>
commit 82152d424b6cb6fc1ede7d03d69c04e786688740 upstream.
This was sort of annoying me:
random:~$ dmesg | tail -1 [523884.039227] [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS. random:~$ dmesg | grep -c "Reducing the compressed" 47
This patch makes it DRM_INFO_ONCE() just like the similar message farther down in that function is pr_info_once().
--- drivers/gpu/drm/i915/display/intel_fbc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_fbc.c +1 -2
@@ -478,8 +478,7 @@ static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv,if (!ret) goto err_llb;else if (ret >1 ) { -DRM_INFO ("Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.\n" ); - +DRM_INFO_ONCE ("Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.\n" ); } fbc->threshold = ret;
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sasha Levin
maintainerPATCH 32/606 ARM: dts: dra7: Fix bus_dma_limit for PCIe
In reply to Sasha LevinFrom: Kishon Vijay Abraham I <[email protected]>
commit 90d4d3f4ea45370d482fa609dbae4d2281b4074f upstream.
Even though commit cfb5d65f2595 ("ARM: dts: dra7: Add bus_dma_limit for L3 bus") added bus_dma_limit for L3 bus, the PCIe controller gets incorrect value of bus_dma_limit.
Fix it by adding empty dma-ranges property to axi@0 and axi@1 (parent device tree node of PCIe controller).
--- arch/arm/boot/dts/dra7.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/dra7.dtsi +2 -2
@@ -172,6 +172,7 @@ axi@0 { #address-cells = <1>; ranges = <0x51000000 0x51000000 0x3000 0x0 0x20000000 0x10000000>; + dma-ranges; /** * To enable PCI endpoint mode, disable the pcie1_rc * node and enable pcie1_ep mode.
@@ -185,7 +186,6 @@ pcie1_rc: pcie@51000000 { device_type = "pci"; ranges = <0x81000000 0 0 0x03000 0 0x00010000 0x82000000 0 0x20013000 0x13000 0 0xffed000>; - dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>; bus-range = <0x00 0xff>; #interrupt-cells = <1>; num-lanes = <1>;
@@ -230,6 +230,7 @@ axi@1 { #address-cells = <1>; ranges = <0x51800000 0x51800000 0x3000 0x0 0x30000000 0x10000000>; + dma-ranges; status = "disabled"; pcie2_rc: pcie@51800000 { reg = <0x51800000 0x2000>, <0x51802000 0x14c>, <0x1000 0x2000>;
@@ -240,7 +241,6 @@ pcie2_rc: pcie@51800000 { device_type = "pci"; ranges = <0x81000000 0 0 0x03000 0 0x00010000 0x82000000 0 0x30013000 0x13000 0 0xffed000>; - dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>; bus-range = <0x00 0xff>; #interrupt-cells = <1>; num-lanes = <1>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 33/606 ARM: dts: imx27-phytec-phycard-s-rdk: Fix the I2C1 pinctrl entries
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
commit 0caf34350a25907515d929a9c77b9b206aac6d1e upstream.
The I2C2 pins are already used and the following errors are seen:
imx27-pinctrl 10015000.iomuxc: pin MX27_PAD_I2C2_SDA already requested by 10012000.i2c; cannot claim for 1001d000.i2c imx27-pinctrl 10015000.iomuxc: pin-69 (1001d000.i2c) status -22
imx27-pinctrl 10015000.iomuxc: could not request pin 69 (MX27_PAD_I2C2_SDA) from group i2c2grp on device 10015000.iomuxc imx-i2c 1001d000.i2c: Error applying setting, reverse things back
imx-i2c: probe of 1001d000.i2c failed with error -22
Fix it by adding the correct I2C1 IOMUX entries for the pinctrl_i2c1 group.
--- arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts +2 -2
@@ -75,8 +75,8 @@ &iomuxc { imx27-phycard-s-rdk { pinctrl_i2c1: i2c1grp { fsl,pins = < - MX27_PAD_I2C2_SDA__I2C2_SDA 0x0 - MX27_PAD_I2C2_SCL__I2C2_SCL 0x0 + MX27_PAD_I2C_DATA__I2C_DATA 0x0 + MX27_PAD_I2C_CLK__I2C_CLK 0x0 >; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 34/606 ARM: dts: imx6dl-yapp4: Fix Ursa board Ethernet connection
In reply to Sasha LevinFrom: Michal Vokáč <[email protected]>
commit cbe63a8358310244e6007398bd2c7c70c7fd51cd upstream.
The Y Soft yapp4 platform supports up to two Ethernet ports. The Ursa board though has only one Ethernet port populated and that is the port@2. Since the introduction of this platform into mainline a wrong port was deleted and the Ethernet could never work. Fix this by deleting the correct port node.
--- arch/arm/boot/dts/imx6dl-yapp4-ursa.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6dl-yapp4-ursa.dts +1 -1
@@ -38,7 +38,7 @@ ®_usb_h1_vbus { }; &switch_ports { - /delete-node/ port@2; + /delete-node/ port@3; }; &touchscreen {
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 35/606 drm/amd/display: add basic atomic check for cursor plane
In reply to Sasha LevinFrom: Simon Ser <[email protected]>
commit 626bf90fe03fa080d8df06bb0397c95c53ae8e27 upstream.
This patch adds a basic cursor check when an atomic test-only commit is performed. The position and size of the cursor plane is checked.
This should fix user-space relying on atomic checks to assign buffers to planes.
References: https://github.com/emersion/libliftoff/issues/46
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +24 -2
@@ -7716,6 +7716,7 @@ static int dm_update_plane_state(struct dc *dc,struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct dm_crtc_state *dm_new_crtc_state, *dm_old_crtc_state;struct dm_plane_state *dm_new_plane_state, *dm_old_plane_state; +struct amdgpu_crtc *new_acrtc;bool needs_reset;int ret =0 ;
@@ -7725,9 +7726,30 @@ static int dm_update_plane_state(struct dc *dc, dm_new_plane_state =to_dm_plane_state (new_plane_state); dm_old_plane_state =to_dm_plane_state (old_plane_state); -/*TODO Implement atomic check for cursor plane */ -if (plane->type ==DRM_PLANE_TYPE_CURSOR ) +/*TODO Implement better atomic check for cursor plane */ +if (plane->type ==DRM_PLANE_TYPE_CURSOR ) { +if (!enable || !new_plane_crtc || +drm_atomic_plane_disabling (plane->state, new_plane_state)) +return 0 ; + + new_acrtc =to_amdgpu_crtc (new_plane_crtc); + +if ((new_plane_state->crtc_w > new_acrtc->max_cursor_width) || + (new_plane_state->crtc_h > new_acrtc->max_cursor_height)) { +DRM_DEBUG_ATOMIC ("Bad cursor size %d x %d\n" , + new_plane_state->crtc_w, new_plane_state->crtc_h); +return -EINVAL ; + } + +if (new_plane_state->crtc_x <= -new_acrtc->max_cursor_width || + new_plane_state->crtc_y <= -new_acrtc->max_cursor_height) { +DRM_DEBUG_ATOMIC ("Bad cursor position %d, %d\n" , + new_plane_state->crtc_x, new_plane_state->crtc_y); +return -EINVAL ; + } +return 0 ; + } needs_reset =should_reset_plane (state, plane, old_plane_state, new_plane_state);
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 36/606 drm/amd/amdgpu: add raven1 part to the gfxoff quirk list
In reply to Sasha LevinFrom: Tom St Denis <[email protected]>
commit 975f543e7522e17b8a4bf34d7daeac44819aee5a upstream.
On my raven1 system (rev c6) with VBIOS 113-RAVEN-114 GFXOFF is not stable (resulting in large block tiling noise in some applications).
Disabling GFXOFF via the quirk list fixes the problems for me.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
@@ -1177,6 +1177,8 @@ static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = { { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },/* https://bugzilla.kernel.org/show_bug.cgi?id=207171 */ { 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 }, +/* GFXOFF is unstable on C6 parts with a VBIOS 113-RAVEN-114 */ + { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 }, { 0, 0, 0, 0, 0 }, };
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 37/606 drm/i915/tgl+: Fix interrupt handling for DP AUX transactions
In reply to Sasha LevinFrom: Imre Deak <[email protected]>
commit 4457a9db2bdec2360ddb15242341696108167886 upstream.
Unmask/enable AUX interrupts on all ports on TGL+. So far the interrupts worked only on port A, which meant each transaction on other ports took 10ms.
--- drivers/gpu/drm/i915/i915_irq.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -13
@@ -3324,7 +3324,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)u32 de_pipe_masked =gen8_de_pipe_fault_mask (dev_priv) |GEN8_PIPE_CDCLK_CRC_DONE ;u32 de_pipe_enables; -u32 de_port_masked =GEN8_AUX_CHANNEL_A ; +u32 de_port_masked =gen8_de_port_aux_mask (dev_priv);u32 de_port_enables;u32 de_misc_masked =GEN8_DE_EDP_PSR ;enum pipe pipe;
@@ -3332,18 +3332,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)if (INTEL_GEN (dev_priv) <=10 ) de_misc_masked |=GEN8_DE_MISC_GSE ; -if (INTEL_GEN (dev_priv) >=9 ) { - de_port_masked |=GEN9_AUX_CHANNEL_B |GEN9_AUX_CHANNEL_C | -GEN9_AUX_CHANNEL_D ; -if (IS_GEN9_LP (dev_priv)) - de_port_masked |=BXT_DE_PORT_GMBUS ; - } - -if (INTEL_GEN (dev_priv) >=11 ) - de_port_masked |=ICL_AUX_CHANNEL_E ; - -if (IS_CNL_WITH_PORT_F (dev_priv) ||INTEL_GEN (dev_priv) >=11 ) - de_port_masked |=CNL_AUX_CHANNEL_F ; +if (IS_GEN9_LP (dev_priv)) + de_port_masked |=BXT_DE_PORT_GMBUS ; de_pipe_enables = de_pipe_masked |GEN8_PIPE_VBLANK |GEN8_PIPE_FIFO_UNDERRUN ;
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 38/606 powerpc/vdso32: Fallback on getres syscall when clock is unknown
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
commit e963b7a28b2bf2416304e1a15df967fcf662aff5 upstream.
There are other clocks than the standard ones, for instance per process clocks. Therefore, being above the last standard clock doesn't mean it is a bad clock. So, fallback to syscall instead of returning -EINVAL inconditionaly.
--- arch/powerpc/kernel/vdso32/gettimeofday.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/vdso32/gettimeofday.S +3 -3
@@ -218,11 +218,11 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) blr /* - * invalid clock + * syscall fallback */ 99: - li r3, EINVAL - crset so + li r0,__NR_clock_getres + sc blr .cfi_endproc V_FUNCTION_END(__kernel_clock_getres)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 39/606 powerpc/32s: Fix build failure with CONFIG_PPC_KUAP_DEBUG
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
commit 4833ce06e6855d526234618b746ffb71d6612c9a upstream.
gpr2 is not a parametre of kuap_check(), it doesn't exist.
Use gpr instead.
--- arch/powerpc/include/asm/book3s/32/kup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/book3s/32/kup.h +1 -1
@@ -75,7 +75,7 @@ .macro kuap_check current, gpr#ifdef CONFIG_PPC_KUAP_DEBUG - lwz \gpr2, KUAP(thread) + lwz \gpr, KUAP(thread) 999: twnei \gpr, 0 EMIT_BUG_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE)#endif
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 40/606 cifs: fix leaked reference on requeued write
In reply to Sasha LevinFrom: Adam McCoy <[email protected]>
commit a48137996063d22ffba77e077425f49873856ca5 upstream.
Failed async writes that are requeued may not clean up a refcount on the file, which can result in a leaked open. This scenario arises very reliably when using persistent handles and a reconnect occurs while writing.
cifs_writev_requeue only releases the reference if the write fails (rc != 0). The server->ops->async_writev operation will take its own reference, so the initial reference can always be released.
--- fs/cifs/cifssmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifssmb.c +1 -1
@@ -2138,8 +2138,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata) } } +kref_put (&wdata2->refcount, cifs_writedata_release);if (rc) { -kref_put (&wdata2->refcount, cifs_writedata_release);if (is_retryable_error (rc))continue ; i += nr_pages;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 41/606 KVM: x86: Fix pkru save/restore when guest CR4.PKE=0, move it to x86.c
In reply to Sasha LevinFrom: Babu Moger <[email protected]>
commit 37486135d3a7b03acc7755b63627a130437f066a upstream.
Though rdpkru and wrpkru are contingent upon CR4.PKE, the PKRU resource isn't. It can be read with XSAVE and written with XRSTOR. So, if we don't set the guest PKRU value here(kvm_load_guest_xsave_state), the guest can read the host value.
In case of kvm_load_host_xsave_state, guest with CR4.PKE clear could potentially use XRSTOR to change the host PKRU value.
While at it, move pkru state save/restore to common code and the host_pkru field to kvm_vcpu_arch. This will let SVM support protection keys.
Message-Id: <158932794619.44260.14508381096663848853.stgit@naples-babu.amd.com>
--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx/vmx.c | 18 ------------------ arch/x86/kvm/x86.c | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 18 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -0
@@ -574,6 +574,7 @@ struct kvm_vcpu_arch {unsigned long cr4;unsigned long cr4_guest_owned_bits;unsigned long cr8; +u32 host_pkru;u32 pkru;u32 hflags;u64 efer;
arch/x86/kvm/vmx/vmx.c +0 -18
@@ -1380,7 +1380,6 @@ void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)vmx_vcpu_pi_load (vcpu, cpu); - vmx->host_pkru =read_pkru (); vmx->host_debugctlmsr =get_debugctlmsr (); }
@@ -6538,11 +6537,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)kvm_load_guest_xsave_state (vcpu); -if (static_cpu_has (X86_FEATURE_PKU ) && -kvm_read_cr4_bits (vcpu,X86_CR4_PKE ) && - vcpu->arch.pkru != vmx->host_pkru) -__write_pkru (vcpu->arch.pkru); -pt_guest_enter (vmx);atomic_switch_perf_msrs (vmx);
@@ -6631,18 +6625,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)pt_guest_exit (vmx); -/* -* eager fpu is enabled if PKEY is supported and CR4 is switched -* back on host, so it is safe to read guest PKRU from current -* XSAVE. -*/ -if (static_cpu_has (X86_FEATURE_PKU ) && -kvm_read_cr4_bits (vcpu,X86_CR4_PKE )) { - vcpu->arch.pkru =rdpkru (); -if (vcpu->arch.pkru != vmx->host_pkru) -__write_pkru (vmx->host_pkru); - } -kvm_load_host_xsave_state (vcpu); vmx->nested.nested_run_pending =0 ;
arch/x86/kvm/x86.c +17 -0
@@ -809,11 +809,25 @@ void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) vcpu->arch.ia32_xss != host_xss)wrmsrl (MSR_IA32_XSS , vcpu->arch.ia32_xss); } + +if (static_cpu_has (X86_FEATURE_PKU ) && + (kvm_read_cr4_bits (vcpu,X86_CR4_PKE ) || + (vcpu->arch.xcr0 &XFEATURE_MASK_PKRU )) && + vcpu->arch.pkru != vcpu->arch.host_pkru) +__write_pkru (vcpu->arch.pkru); }EXPORT_SYMBOL_GPL (kvm_load_guest_xsave_state);void kvm_load_host_xsave_state (struct kvm_vcpu *vcpu) { +if (static_cpu_has (X86_FEATURE_PKU ) && + (kvm_read_cr4_bits (vcpu,X86_CR4_PKE ) || + (vcpu->arch.xcr0 &XFEATURE_MASK_PKRU ))) { + vcpu->arch.pkru =rdpkru (); +if (vcpu->arch.pkru != vcpu->arch.host_pkru) +__write_pkru (vcpu->arch.host_pkru); + } +if (kvm_read_cr4_bits (vcpu,X86_CR4_OSXSAVE )) {if (vcpu->arch.xcr0 != host_xcr0)
@@ -3529,6 +3543,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) kvm_x86_ops->vcpu_load (vcpu, cpu); +/* Save host pkru register if supported */ + vcpu->arch.host_pkru =read_pkru (); +/* Apply any externally detected TSC adjustments (due to suspend) */ if (unlikely (vcpu->arch.tsc_offset_adjustment)) {adjust_tsc_offset_host (vcpu, vcpu->arch.tsc_offset_adjustment);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 42/606 x86: Fix early boot crash on gcc-10, third try
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
commit a9a3ed1eff3601b63aea4fb462d8b3b92c7c1e7e upstream.
... or the odyssey of trying to disable the stack protector for the function which generates the stack canary value.
The whole story started with Sergei reporting a boot crash with a kernel built with gcc-10:
Kernel panic — not syncing: stack-protector: Kernel stack is corrupted in: start_secondary
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.6.0-rc5—00235—gfffb08b37df9 #139
Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./H77M—D3H, BIOS F12 11/14/2013
Call Trace:
dump_stack
panic
? start_secondary
__stack_chk_fail
start_secondary
secondary_startup_64
-—-[ end Kernel panic — not syncing: stack—protector: Kernel stack is corrupted in: start_secondaryThis happens because gcc-10 tail-call optimizes the last function call in start_secondary() - cpu_startup_entry() - and thus emits a stack canary check which fails because the canary value changes after the boot_init_stack_canary() call.
To fix that, the initial attempt was to mark the one function which generates the stack canary with:
__attribute__((optimize("-fno-stack-protector"))) ... start_secondary(void *unused)
however, using the optimize attribute doesn't work cumulatively as the attribute does not add to but rather replaces previously supplied optimization options - roughly all -fxxx options.
The key one among them being -fno-omit-frame-pointer and thus leading to not present frame pointer - frame pointer which the kernel needs.
The next attempt to prevent compilers from tail-call optimizing the last function call cpu_startup_entry(), shy of carving out start_secondary() into a separate compilation unit and building it with -fno-stack-protector, was to add an empty asm("").
This current solution was short and sweet, and reportedly, is supported by both compilers but we didn't get very far this time: future (LTO?) optimization passes could potentially eliminate this, which leads us to the third attempt: having an actual memory barrier there which the compiler cannot ignore or move around etc.
That should hold for a long time, but hey we said that about the other two solutions too so...
--- arch/x86/include/asm/stackprotector.h | 7 ++++++- arch/x86/kernel/smpboot.c | 8 ++++++++ arch/x86/xen/smp_pv.c | 1 + include/linux/compiler.h | 6 ++++++ init/main.c | 2 ++ 5 files changed, 23 insertions(+), 1 deletion(-)
arch/x86/include/asm/stackprotector.h +6 -1
@@ -55,8 +55,13 @@/* * Initialize the stackprotector canary value. * -* NOTE: this must only be called from functions that never return, +* NOTE: this must only be called from functions that never return * and it must always be inlined. +* +* In addition, it should be called from a compilation unit for which +* stack protector is disabled. Alternatively, the caller should not end +* with a function call which gets tail-call optimized as that would +* lead to checking a modified canary value. */ static __always_inline void boot_init_stack_canary(void) {
arch/x86/kernel/smpboot.c +8 -0
@@ -262,6 +262,14 @@ static void notrace start_secondary(void *unused)wmb ();cpu_startup_entry (CPUHP_AP_ONLINE_IDLE ); + +/* +* Prevent tail call to cpu_startup_entry() because the stack protector +* guard has been changed a couple of function calls up, in +* boot_init_stack_canary() and must not be checked before tail calling +* another function. +*/ +prevent_tail_call_optimization (); }/**
arch/x86/xen/smp_pv.c +1 -0
@@ -92,6 +92,7 @@ asmlinkage __visible void cpu_bringup_and_idle(void)cpu_bringup ();boot_init_stack_canary ();cpu_startup_entry (CPUHP_AP_ONLINE_IDLE ); +prevent_tail_call_optimization (); }void xen_smp_intr_free_pv (unsigned int cpu)
include/linux/compiler.h +6 -0
@@ -356,4 +356,10 @@ static inline void *offset_to_ptr(const int *off)/* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array (a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) +/* +* This is needed in functions which generate the stack canary, see +* arch/x86/kernel/smpboot.c::start_secondary() for an example. +*/ +#define prevent_tail_call_optimization () mb() +#endif /* __LINUX_COMPILER_H */
init/main.c +2 -0
@@ -1032,6 +1032,8 @@ asmlinkage __visible void __init start_kernel(void)/* Do the rest non-__init'ed, we're now alive */ arch_call_rest_init (); + +prevent_tail_call_optimization (); }/* Call all constructor functions linked into the kernel. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 43/606 x86/unwind/orc: Fix error handling in __unwind_start()
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
commit 71c95825289f585014fe9741b051d32a7a916680 upstream.
The unwind_state 'error' field is used to inform the reliable unwinding code that the stack trace can't be trusted. Set this field for all errors in __unwind_start().
Also, move the zeroing out of the unwind_state struct to before the ORC table initialization check, to prevent the caller from reading uninitialized data if the ORC table is corrupted.
--- arch/x86/kernel/unwind_orc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
arch/x86/kernel/unwind_orc.c +9 -7
@@ -611,23 +611,23 @@ EXPORT_SYMBOL_GPL(unwind_next_frame);void __unwind_start (struct unwind_state *state,struct task_struct *task,struct pt_regs *regs,unsigned long *first_frame) { -if (!orc_init) - goto done; -memset (state,0 ,sizeof (*state)); state->task = task; +if (!orc_init) + goto err; +/* * Refuse to unwind the stack of a task while it's executing on another * CPU. This check is racy, but that's ok: the unwinder has other * checks to prevent it from going off the rails. */ if (task_on_another_cpu (task)) - goto done; + goto err;if (regs) {if (user_mode (regs)) - goto done; + goto the_end; state->ip = regs->ip; state->sp = regs->sp;
@@ -660,6 +660,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,* generate some kind of backtrace if this happens. */ void *next_page = (void *)PAGE_ALIGN ((unsigned long )state->sp); + state->error = true;if (get_stack_info (next_page, state->task, &state->stack_info, &state->stack_mask))return ;
@@ -685,8 +686,9 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,return ; -done: +err: + state->error = true; +the_end: state->stack_info.type =STACK_TYPE_UNKNOWN ; -return ; }EXPORT_SYMBOL_GPL (__unwind_start);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 44/606 exec: Move would_dump into flush_old_exec
In reply to Sasha LevinFrom: "Eric W. Biederman" <[email protected]>
commit f87d1c9559164294040e58f5e3b74a162bf7c6e8 upstream.
I goofed when I added mm->user_ns support to would_dump. I missed the fact that in the case of binfmt_loader, binfmt_em86, binfmt_misc, and binfmt_script bprm->file is reassigned. Which made the move of would_dump from setup_new_exec to __do_execve_file before exec_binprm incorrect as it can result in would_dump running on the script instead of the interpreter of the script.
The net result is that the code stopped making unreadable interpreters undumpable. Which allows them to be ptraced and written to disk without special permissions. Oops.
The move was necessary because the call in set_new_exec was after bprm->mm was no longer valid.
To correct this mistake move the misplaced would_dump from __do_execve_file into flos_old_exec, before exec_mmap is called.
I tested and confirmed that without this fix I can attach with gdb to a script with an unreadable interpreter, and with this fix I can not.
--- fs/exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/exec.c +2 -2
@@ -1277,6 +1277,8 @@ int flush_old_exec(struct linux_binprm * bprm)*/ set_mm_exe_file (bprm->mm, bprm->file); +would_dump (bprm, bprm->file); +/* * Release all of the old mmap stuff */
@@ -1820,8 +1822,6 @@ static int __do_execve_file(int fd, struct filename *filename,if (retval <0 ) goto out; -would_dump (bprm, bprm->file); - retval =exec_binprm (bprm);if (retval <0 ) goto out;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 45/606 clk: rockchip: fix incorrect configuration of rk3228 aclk_gpu* clocks
In reply to Sasha LevinFrom: Justin Swartz <[email protected]>
commit cec9d101d70a3509da9bd2e601e0b242154ce616 upstream.
The following changes prevent the unrecoverable freezes and rcu_sched stall warnings experienced in each of my attempts to take advantage of lima.
Replace the COMPOSITE_NOGATE definition of aclk_gpu_pre with a COMPOSITE that retains the selection of HDMIPHY as the PLL source, but instead makes uses of the aclk_gpu PLL source gate and parent names defined by mux_pll_src_4plls_p rather than mux_aclk_gpu_pre_p.
Remove the now unused mux_aclk_gpu_pre_p and the four named but also unused definitions (cpll_gpu, gpll_gpu, hdmiphy_gpu and usb480m_gpu) of the aclk_gpu PLL source gate.
Use the correct gate offset for aclk_gpu and aclk_gpu_noc.
--- drivers/clk/rockchip/clk-rk3228.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/clk/rockchip/clk-rk3228.c +4 -13
@@ -156,8 +156,6 @@ PNAME(mux_i2s_out_p) = { "i2s1_pre", "xin12m" };PNAME (mux_i2s2_p) = {"i2s2_src" ,"i2s2_frac" ,"xin12m" };PNAME (mux_sclk_spdif_p) = {"sclk_spdif_src" ,"spdif_frac" ,"xin12m" }; -PNAME (mux_aclk_gpu_pre_p) = {"cpll_gpu" ,"gpll_gpu" ,"hdmiphy_gpu" ,"usb480m_gpu" }; -PNAME (mux_uart0_p) = {"uart0_src" ,"uart0_frac" ,"xin24m" };PNAME (mux_uart1_p) = {"uart1_src" ,"uart1_frac" ,"xin24m" };PNAME (mux_uart2_p) = {"uart2_src" ,"uart2_frac" ,"xin24m" };
@@ -468,16 +466,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { RK2928_CLKSEL_CON(24), 6, 10, DFLAGS, RK2928_CLKGATE_CON(2), 8, GFLAGS), -GATE (0 ,"cpll_gpu" ,"cpll" ,0 , -RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), -GATE (0 ,"gpll_gpu" ,"gpll" ,0 , -RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), -GATE (0 ,"hdmiphy_gpu" ,"hdmiphy" ,0 , -RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), -GATE (0 ,"usb480m_gpu" ,"usb480m" ,0 , +COMPOSITE (0 ,"aclk_gpu_pre" , mux_pll_src_4plls_p,0 , +RK2928_CLKSEL_CON (34 ),5 ,2 ,MFLAGS ,0 ,5 ,DFLAGS ,RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), -COMPOSITE_NOGATE (0 ,"aclk_gpu_pre" , mux_aclk_gpu_pre_p,0 , -RK2928_CLKSEL_CON (34 ),5 ,2 ,MFLAGS ,0 ,5 ,DFLAGS ), COMPOSITE(SCLK_SPI0, "sclk_spi0", mux_pll_src_2plls_p, 0, RK2928_CLKSEL_CON(25), 8, 1, MFLAGS, 0, 7, DFLAGS,
@@ -582,8 +573,8 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {GATE (0 ,"pclk_peri_noc" ,"pclk_peri" ,CLK_IGNORE_UNUSED ,RK2928_CLKGATE_CON (12 ),2 ,GFLAGS ),/* PD_GPU */ -GATE (ACLK_GPU ,"aclk_gpu" ,"aclk_gpu_pre" ,0 ,RK2928_CLKGATE_CON (13 ),14 ,GFLAGS ), -GATE (0 ,"aclk_gpu_noc" ,"aclk_gpu_pre" ,0 ,RK2928_CLKGATE_CON (13 ),15 ,GFLAGS ), +GATE (ACLK_GPU ,"aclk_gpu" ,"aclk_gpu_pre" ,0 ,RK2928_CLKGATE_CON (7 ),14 ,GFLAGS ), +GATE (0 ,"aclk_gpu_noc" ,"aclk_gpu_pre" ,0 ,RK2928_CLKGATE_CON (7 ),15 ,GFLAGS ),/* PD_BUS */ GATE(0, "sclk_initmem_mbist", "aclk_cpu", 0, RK2928_CLKGATE_CON(8), 1, GFLAGS),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 46/606 dwc3: Remove check for HWO flag in dwc3_gadget_ep_reclaim_trb_sg()
In reply to Sasha LevinFrom: John Stultz <[email protected]>
commit 00e21763f2c8cab21b7befa52996d1b18bde5c42 upstream.
The check for the HWO flag in dwc3_gadget_ep_reclaim_trb_sg() causes us to break out of the loop before we call dwc3_gadget_ep_reclaim_completed_trb(), which is what likely should be clearing the HWO flag.
This can cause odd behavior where we never reclaim all the trbs in the sg list, so we never call giveback on a usb req, and that will causes transfer stalls.
This effectively resovles the adb stalls seen on HiKey960 after userland changes started only using AIO in adbd.
--- drivers/usb/dwc3/gadget.c | 3 --- 1 file changed, 3 deletions(-)
drivers/usb/dwc3/gadget.c +0 -3
@@ -2483,9 +2483,6 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep,for_each_sg (sg, s, pending, i) { trb = &dep->trb_pool[dep->trb_dequeue]; -if (trb->ctrl &DWC3_TRB_CTRL_HWO ) -break ; - req->sg =sg_next (s); req->num_pending_sgs--;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 47/606 fanotify: fix merging marks masks with FAN_ONDIR
In reply to Sasha LevinFrom: Amir Goldstein <[email protected]>
commit 55bf882c7f13dda8bbe624040c6d5b4fbb812d16 upstream.
Change the logic of FAN_ONDIR in two ways that are similar to the logic of FAN_EVENT_ON_CHILD, that was fixed in commit 54a307ba8d3c ("fanotify:
fix logic of events on child"):
1. The flag is meaningless in ignore mask
2. The flag refers only to events in the mask of the mark where it is set
This is what the fanotify_mark.2 man page says about FAN_ONDIR:
"Without this flag, only events for files are created." It doesn't say anything about setting this flag in ignore mask to stop getting events on directories nor can I think of any setup where this capability would be useful.
Currently, when marks masks are merged, the FAN_ONDIR flag set in one mark affects the events that are set in another mark's mask and this behavior causes unexpected results. For example, a user adds a mark on a directory with mask FAN_ATTRIB | FAN_ONDIR and a mount mark with mask FAN_OPEN (without FAN_ONDIR). An opendir() of that directory (which is inside that mount) generates a FAN_OPEN event even though neither of the marks requested to get open events on directories.
--- fs/notify/fanotify/fanotify.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/notify/fanotify/fanotify.c +7 -4
@@ -171,6 +171,13 @@ static u32 fanotify_group_event_mask(struct fsnotify_group *group,if (!fsnotify_iter_should_report_type (iter_info, type))continue ; mark = iter_info->marks[type]; +/* +* If the event is on dir and this mark doesn't care about +* events on dir, don't send it! +*/ +if (event_mask &FS_ISDIR && !(mark->mask &FS_ISDIR )) +continue ; +/* * If the event is for a child and this mark doesn't care about * events on a child, don't send it!
@@ -203,10 +210,6 @@ static u32 fanotify_group_event_mask(struct fsnotify_group *group, user_mask &= ~FAN_ONDIR ; } -if (event_mask &FS_ISDIR && - !(marks_mask &FS_ISDIR & ~marks_ignored_mask)) -return 0 ; -return test_mask & user_mask; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 48/606 arm64: dts: meson-g12b-ugoos-am6: fix usb vbus-supply
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
commit 4e025fd91ba32a16ed8131158aa63cd37d141cbb upstream.
The USB supply used the wrong property, fixing:meson-g12b-ugoos-am6.dt.yaml: usb@ffe09000: 'vbus-regulator' does not match any of the regexes: '^usb@[0-9a-f]+$', 'pinctrl-[0-9]+'
--- arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts +1 -1
@@ -545,7 +545,7 @@ &uart_AO { &usb { status = "okay"; dr_mode = "host"; - vbus-regulator = <&usb_pwr_en>; + vbus-supply = <&usb_pwr_en>; }; &usb2_phy0 {
Signature · 7 lines
2.25.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 49/606 usb: gadget: tegra-xudc: Fix idle suspend/resume
In reply to Sasha LevinFrom: Thierry Reding <[email protected]>
commit 0534d40160cb9505073b0ecf5e7210daee319a66 upstream.
When the XUDC device is idle (i.e. powergated), care must be taken not to access any registers because that would lead to a crash.
Move the call to tegra_xudc_device_mode_off() into the same conditional as the tegra_xudc_powergate() call to make sure we only force device mode off if the XUDC is actually powered up.
--- drivers/usb/gadget/udc/tegra-xudc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/udc/tegra-xudc.c +4 -4
@@ -3740,11 +3740,11 @@ static int __maybe_unused tegra_xudc_suspend(struct device *dev)flush_work (&xudc->usb_role_sw_work); -/* Forcibly disconnect before powergating. */ -tegra_xudc_device_mode_off (xudc); - -if (!pm_runtime_status_suspended (dev)) +if (!pm_runtime_status_suspended (dev)) { +/* Forcibly disconnect before powergating. */ +tegra_xudc_device_mode_off (xudc);tegra_xudc_powergate (xudc); + }pm_runtime_disable (dev);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 50/606 usb: gadget: net2272: Fix a memory leak in an error handling path in 'net2272_plat_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
commit ccaef7e6e354fb65758eaddd3eae8065a8b3e295 upstream.
'dev' is allocated in 'net2272_probe_init()'. It must be freed in the error handling path, as already done in the remove function (i.e. 'net2272_plat_remove()')
--- drivers/usb/gadget/udc/net2272.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/udc/net2272.c +2 -0
@@ -2647,6 +2647,8 @@ net2272_plat_probe(struct platform_device *pdev) err_req:release_mem_region (base, len); err: +kfree (dev); +return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 51/606 usb: gadget: audio: Fix a missing error return value in audio_bind()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
commit 19b94c1f9c9a16d41a8de3ccbdb8536cf1aecdbf upstream.
If 'usb_otg_descriptor_alloc()' fails, we must return an error code, not 0.
--- drivers/usb/gadget/legacy/audio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/audio.c +3 -1
@@ -300,8 +300,10 @@ static int audio_bind(struct usb_composite_dev *cdev)struct usb_descriptor_header *usb_desc; usb_desc =usb_otg_descriptor_alloc (cdev->gadget); -if (!usb_desc) +if (!usb_desc) { + status = -ENOMEM ; goto fail; + }usb_otg_descriptor_init (cdev->gadget, usb_desc); otg_desc[0 ] = usb_desc; otg_desc[1 ] =NULL ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 52/606 usb: gadget: legacy: fix error return code in gncm_bind()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
commit e27d4b30b71c66986196d8a1eb93cba9f602904a upstream.
If 'usb_otg_descriptor_alloc()' fails, we must return a negative error code -ENOMEM, not 0.
--- drivers/usb/gadget/legacy/ncm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/ncm.c +3 -1
@@ -156,8 +156,10 @@ static int gncm_bind(struct usb_composite_dev *cdev)struct usb_descriptor_header *usb_desc; usb_desc =usb_otg_descriptor_alloc (gadget); -if (!usb_desc) +if (!usb_desc) { + status = -ENOMEM ; goto fail; + }usb_otg_descriptor_init (gadget, usb_desc); otg_desc[0 ] = usb_desc; otg_desc[1 ] =NULL ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 53/606 usb: gadget: legacy: fix error return code in cdc_bind()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
commit e8f7f9e3499a6d96f7f63a4818dc7d0f45a7783b upstream.
If 'usb_otg_descriptor_alloc()' fails, we must return a negative error code -ENOMEM, not 0.
--- drivers/usb/gadget/legacy/cdc2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/cdc2.c +3 -1
@@ -179,8 +179,10 @@ static int cdc_bind(struct usb_composite_dev *cdev)struct usb_descriptor_header *usb_desc; usb_desc =usb_otg_descriptor_alloc (gadget); -if (!usb_desc) +if (!usb_desc) { + status = -ENOMEM ; goto fail1; + }usb_otg_descriptor_init (gadget, usb_desc); otg_desc[0 ] = usb_desc; otg_desc[1 ] =NULL ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 54/606 Revert "ALSA: hda/realtek: Fix pop noise on ALC225"
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
commit f41224efcf8aafe80ea47ac870c5e32f3209ffc8 upstream.
This reverts commit 3b36b13d5e69d6f51ff1c55d1b404a74646c9757.
Enable power save node breaks some systems with ACL225. Revert the patch and use a platform specific quirk for the original issue isntead.
--- sound/pci/hda/patch_realtek.c | 2 -- 1 file changed, 2 deletions(-)
sound/pci/hda/patch_realtek.c +0 -2
@@ -8121,8 +8121,6 @@ static int patch_alc269(struct hda_codec *codec) spec->gen.mixer_nid =0 ;break ;case 0x10ec0225 : - codec->power_save_node =1 ; -/* fall through */ case 0x10ec0295 :case 0x10ec0299 : spec->codec_variant =ALC269_TYPE_ALC225 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 55/606 clk: ti: clkctrl: Fix Bad of_node_put within clkctrl_get_name
In reply to Sasha LevinFrom: Tero Kristo <[email protected]>
commit e1f9e0d28ff025564dfdb1001a7839b4af5db2e2 upstream.
clkctrl_get_name incorrectly calls of_node_put when it is not really doing of_node_get. This causes a boot time warning later on:
[ 0.000000] OF: ERROR: Bad of_node_put() on /ocp/interconnect@4a000000/segmen
t@0/target-module@5000/cm_core_aon@0/ipu-cm@500/ipu1-clkctrl@20
Fix by dropping the of_node_put from the function.
--- drivers/clk/ti/clkctrl.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/ti/clkctrl.c +0 -1
@@ -461,7 +461,6 @@ static char * __init clkctrl_get_name(struct device_node *np)return name; } } -of_node_put (np);return NULL ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 56/606 clk: Unlink clock if failed to prepare or enable
In reply to Sasha LevinFrom: Marc Zyngier <[email protected]>
commit 018d4671b9bbd4a5c55cf6eab3e1dbc70a50b66e upstream.
On failing to prepare or enable a clock, remove the core structure from the list it has been inserted as it is about to be freed.
This otherwise leads to random crashes when subsequent clocks get registered, during which parsing of the clock tree becomes adventurous.
Observed with QEMU's RPi-3 emulation.
--- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -0
@@ -3512,6 +3512,9 @@ static int __clk_core_init(struct clk_core *core) out:clk_pm_runtime_put (core); unlock: +if (ret) +hlist_del_init (&core->child_node); +clk_prepare_unlock ();if (!ret)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 57/606 arm64: dts: meson-g12b-khadas-vim3: add missing frddr_a status property
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
commit 5ac0869fb39b1c1ba84d4d75c550f82e0bf44c96 upstream.
In the process of moving the VIM3 audio nodes to a G12B specific dtsi for enabling the SM1 based VIM3L, the frddr_a status = "okay" property got dropped.
This re-enables the frddr_a node to fix audio support.
--- arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +4 -0
@@ -152,6 +152,10 @@ &cpu103 { clock-latency = <50000>; }; +&frddr_a { + status = "okay"; +}; + &frddr_b { status = "okay"; };
Signature · 7 lines
2.25.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 58/606 arm64: dts: qcom: msm8996: Reduce vdd_apc voltage
In reply to Sasha LevinFrom: Bjorn Andersson <[email protected]>
commit 28810eecae08f9458a44831978e36f14ed182c80 upstream.
Some msm8996 based devices are unstable when run with VDD_APC of 1.23V, which is listed as the maximum voltage in "Turbo" mode. Given that the CPU cluster is not run in "Turbo" mode, reduce this to 0.98V - the maximum voltage for nominal operation.
--- arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +2 -2
@@ -658,8 +658,8 @@ s10 { s11 { qcom,saw-leader; regulator-always-on; - regulator-min-microvolt = <1230000>; - regulator-max-microvolt = <1230000>; + regulator-min-microvolt = <980000>; + regulator-max-microvolt = <980000>; }; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 59/606 arm64: dts: meson-g12-common: fix dwc2 clock names
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
commit e4f634d812634067b0c661af2e3cecfd629c89b8 upstream.
Use the correct dwc2 clock name.
--- arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +1 -1
@@ -2204,7 +2204,7 @@ dwc2: usb@ff400000 { reg = <0x0 0xff400000 0x0 0x40000>; interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clkc CLKID_USB1_DDR_BRIDGE>; - clock-names = "ddr"; + clock-names = "otg"; phys = <&usb2_phy1>; phy-names = "usb2-phy"; dr_mode = "peripheral";
Signature · 7 lines
2.25.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 60/606 arm64: dts: rockchip: Replace RK805 PMIC node name with "pmic" on rk3328 boards
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
commit 83b994129fb4c18a8460fd395864a28740e5e7fb upstream.
In some board device tree files, "rk805" was used for the RK805 PMIC's node name. However the policy for device trees is that generic names should be used.
Replace the "rk805" node name with the generic "pmic" name.
--- arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3328-evb.dts +1 -1
@@ -92,7 +92,7 @@ &gmac2phy { &i2c1 { status = "okay"; - rk805: rk805@18 { + rk805: pmic@18 { compatible = "rockchip,rk805"; reg = <0x18>; interrupt-parent = <&gpio2>;
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +1 -1
@@ -169,7 +169,7 @@ &hdmiphy { &i2c1 { status = "okay"; - rk805: rk805@18 { + rk805: pmic@18 { compatible = "rockchip,rk805"; reg = <0x18>; interrupt-parent = <&gpio2>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 61/606 arm64: dts: rockchip: Rename dwc3 device nodes on rk3399 to make dtc happy
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
commit 190c7f6fd43a776d4a6da1dac44408104649e9b7 upstream.
The device tree compiler complains that the dwc3 nodes have regs properties but no matching unit addresses.
Add the unit addresses to the device node name. While at it, also rename the nodes from "dwc3" to "usb", as guidelines require device nodes have generic names.
--- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +2 -2
@@ -410,7 +410,7 @@ usbdrd3_0: usb@fe800000 { reset-names = "usb3-otg"; status = "disabled"; - usbdrd_dwc3_0: dwc3 { + usbdrd_dwc3_0: usb@fe800000 { compatible = "snps,dwc3"; reg = <0x0 0xfe800000 0x0 0x100000>; interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH 0>;
@@ -446,7 +446,7 @@ usbdrd3_1: usb@fe900000 { reset-names = "usb3-otg"; status = "disabled"; - usbdrd_dwc3_1: dwc3 { + usbdrd_dwc3_1: usb@fe900000 { compatible = "snps,dwc3"; reg = <0x0 0xfe900000 0x0 0x100000>; interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH 0>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 62/606 arm64: dts: imx8mn: Change SDMA1 ahb clock for imx8mn
In reply to Sasha LevinFrom: Adam Ford <[email protected]>
commit 15ddc3e17aec0de4c69d595b873e184432b9791d upstream.
Using SDMA1 with UART1 is causing a "Timeout waiting for CH0" error. This patch changes to ahb clock from SDMA1_ROOT to AHB which fixes the timeout error.
--- arch/arm64/boot/dts/freescale/imx8mn.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mn.dtsi +1 -1
@@ -661,7 +661,7 @@ sdma1: dma-controller@30bd0000 { reg = <0x30bd0000 0x10000>; interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk IMX8MN_CLK_SDMA1_ROOT>, - <&clk IMX8MN_CLK_SDMA1_ROOT>; + <&clk IMX8MN_CLK_AHB>; clock-names = "ipg", "ahb"; #dma-cells = <3>; fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 63/606 ARM: dts: r8a73a4: Add missing CMT1 interrupts
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
commit 0f739fdfe9e5ce668bd6d3210f310df282321837 upstream.
The R-Mobile APE6 Compare Match Timer 1 generates 8 interrupts, one for each channel, but currently only 1 is described.
Fix this by adding the missing interrupts.
--- arch/arm/boot/dts/r8a73a4.dtsi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r8a73a4.dtsi +8 -1
@@ -131,7 +131,14 @@ i2c5: i2c@e60b0000 { cmt1: timer@e6130000 { compatible = "renesas,r8a73a4-cmt1", "renesas,rcar-gen2-cmt1"; reg = <0 0xe6130000 0 0x1004>; - interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>; clocks = <&mstp3_clks R8A73A4_CLK_CMT1>; clock-names = "fck"; power-domains = <&pd_c5>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 64/606 arm64: dts: renesas: r8a77980: Fix IPMMU VIP[01] nodes
In reply to Sasha LevinFrom: Yoshihiro Shimoda <[email protected]>
commit f4d71c6ea9e58c07dd4d02d09c5dd9bb780ec4b1 upstream.
Missing the renesas,ipmmu-main property on ipmmu_vip[01] nodes.
--- arch/arm64/boot/dts/renesas/r8a77980.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/renesas/r8a77980.dtsi +2 -0
@@ -1318,6 +1318,7 @@ ipmmu_vi0: mmu@febd0000 { ipmmu_vip0: mmu@e7b00000 { compatible = "renesas,ipmmu-r8a77980"; reg = <0 0xe7b00000 0 0x1000>; + renesas,ipmmu-main = <&ipmmu_mm 4>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; #iommu-cells = <1>; };
@@ -1325,6 +1326,7 @@ ipmmu_vip0: mmu@e7b00000 { ipmmu_vip1: mmu@e7960000 { compatible = "renesas,ipmmu-r8a77980"; reg = <0 0xe7960000 0 0x1000>; + renesas,ipmmu-main = <&ipmmu_mm 11>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; #iommu-cells = <1>; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 65/606 ARM: dts: r8a7740: Add missing extal2 to CPG node
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
commit e47cb97f153193d4b41ca8d48127da14513d54c7 upstream.
The Clock Pulse Generator (CPG) device node lacks the extal2 clock. This may lead to a failure registering the "r" clock, or to a wrong parent for the "usb24s" clock, depending on MD_CK2 pin configuration and boot loader CPG_USBCKCR register configuration.
This went unnoticed, as this does not affect the single upstream board configuration, which relies on the first clock input only.
--- arch/arm/boot/dts/r8a7740.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7740.dtsi +1 -1
@@ -479,7 +479,7 @@ fsibck_clk: fsibck { cpg_clocks: cpg_clocks@e6150000 { compatible = "renesas,r8a7740-cpg-clocks"; reg = <0xe6150000 0x10000>; - clocks = <&extal1_clk>, <&extalr_clk>; + clocks = <&extal1_clk>, <&extal2_clk>, <&extalr_clk>; #clock-cells = <1>; clock-output-names = "system", "pllc0", "pllc1", "pllc2", "r",
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 66/606 dt-bindings: dma: fsl-edma: fix ls1028a-edma compatible
In reply to Sasha LevinFrom: Michael Walle <[email protected]>
commit d94a05f87327143f94f67dd256932163ac2bcd65 upstream.
The bootloader will fix up the IOMMU entries only on nodes with the compatible "fsl,vf610-edma". Thus make this compatible string mandatory for the ls1028a-edma.
While at it, fix the "fsl,fsl," typo.
--- Documentation/devicetree/bindings/dma/fsl-edma.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/dma/fsl-edma.txt +2 -1
@@ -10,7 +10,8 @@ Required properties: - compatible : - "fsl,vf610-edma" for eDMA used similar to that on Vybrid vf610 SoC - "fsl,imx7ulp-edma" for eDMA2 used similar to that on i.mx7ulp - - "fsl,fsl,ls1028a-edma" for eDMA used similar to that on Vybrid vf610 SoC + - "fsl,ls1028a-edma" followed by "fsl,vf610-edma" for eDMA used on the + LS1028A SoC. - reg : Specifies base physical address(s) and size of the eDMA registers. The 1st region is eDMA control register's address and size. The 2nd and the 3rd regions are programmable channel multiplexing
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 67/606 SUNRPC: Revert 241b1f419f0e ("SUNRPC: Remove xdr_buf_trim()")
In reply to Sasha LevinFrom: Chuck Lever <[email protected]>
commit 0a8e7b7d08466b5fc52f8e96070acc116d82a8bb upstream.
I've noticed that when krb5i or krb5p security is in use, retransmitted requests are missing the server's duplicate reply cache. The computed checksum on the retransmitted request does not match the cached checksum, resulting in the server performing the retransmitted request again instead of returning the cached reply.
The assumptions made when removing xdr_buf_trim() were not correct. In the send paths, the upper layer has already set the segment lengths correctly, and shorting the buffer's content is simply a matter of reducing buf->len.
xdr_buf_trim() is the right answer in the receive/unwrap path on both the client and the server. The buffer segment lengths have to be shortened one-by-one.
On the server side in particular, head.iov_len needs to be updated correctly to enable nfsd_cache_csum() to work correctly. The simple buf->len computation doesn't do that, and that results in checksumming stale data in the buffer.
The problem isn't noticed until there's significant instability of the RPC transport. At that point, the reliability of retransmit detection on the server becomes crucial.
--- include/linux/sunrpc/xdr.h | 1 + net/sunrpc/auth_gss/gss_krb5_wrap.c | 7 +++-- net/sunrpc/auth_gss/svcauth_gss.c | 2 +- net/sunrpc/xdr.c | 41 +++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 5 deletions(-)
include/linux/sunrpc/xdr.h +1 -0
@@ -184,6 +184,7 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p)extern void xdr_shift_buf (struct xdr_buf *,size_t );extern void xdr_buf_from_iov (struct kvec *,struct xdr_buf *);extern int xdr_buf_subsegment (struct xdr_buf *,struct xdr_buf *,unsigned int ,unsigned int ); +extern void xdr_buf_trim (struct xdr_buf *,unsigned int );extern int xdr_buf_read_mic (struct xdr_buf *,struct xdr_netobj *,unsigned int );extern int read_bytes_from_xdr_buf (struct xdr_buf *,unsigned int ,void *,unsigned int );extern int write_bytes_to_xdr_buf (struct xdr_buf *,unsigned int ,void *,unsigned int );
net/sunrpc/auth_gss/gss_krb5_wrap.c +3 -4
@@ -580,15 +580,14 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, int len,*/ movelen = min_t(unsigned int, buf->head[0].iov_len, len); movelen -= offset +GSS_KRB5_TOK_HDR_LEN + headskip; -if (offset +GSS_KRB5_TOK_HDR_LEN + headskip + movelen > - buf->head[0 ].iov_len) -return GSS_S_FAILURE ; +BUG_ON (offset +GSS_KRB5_TOK_HDR_LEN + headskip + movelen > + buf->head[0 ].iov_len);memmove (ptr, ptr +GSS_KRB5_TOK_HDR_LEN + headskip, movelen); buf->head[0 ].iov_len -=GSS_KRB5_TOK_HDR_LEN + headskip; buf->len = len -GSS_KRB5_TOK_HDR_LEN + headskip;/* Trim off the trailing "extra count" and checksum blob */ - buf->len -= ec +GSS_KRB5_TOK_HDR_LEN + tailskip; +xdr_buf_trim (buf, ec +GSS_KRB5_TOK_HDR_LEN + tailskip); *align =XDR_QUADLEN (GSS_KRB5_TOK_HDR_LEN + headskip); *slack = *align +XDR_QUADLEN (ec +GSS_KRB5_TOK_HDR_LEN + tailskip);
net/sunrpc/auth_gss/svcauth_gss.c +1 -1
@@ -900,7 +900,7 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gif (svc_getnl (&buf->head[0 ]) != seq) goto out;/* trim off the mic and padding at the end before returning */ - buf->len -=4 +round_up_to_quad (mic.len); +xdr_buf_trim (buf,round_up_to_quad (mic.len) +4 ); stat =0 ; out:kfree (mic.data);
net/sunrpc/xdr.c +41 -0
47 lines not on this page · raw message
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 68/606 bpf: Fix sk_psock refcnt leak when receiving message
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
commit 18f02ad19e2c2a1d9e1d55a4e1c0cbf51419151c upstream.
tcp_bpf_recvmsg() invokes sk_psock_get(), which returns a reference of the specified sk_psock object to "psock" with increased refcnt.
When tcp_bpf_recvmsg() returns, local variable "psock" becomes invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in several exception handling paths of tcp_bpf_recvmsg(). When those error scenarios occur such as "flags" includes MSG_ERRQUEUE, the function forgets to decrease the refcnt increased by sk_psock_get(), causing a refcnt leak.
Fix this issue by calling sk_psock_put() or pulling up the error queue read handling when those error scenarios occur.
--- net/ipv4/tcp_bpf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/ipv4/tcp_bpf.c +6 -3
@@ -121,14 +121,17 @@ int tcp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,struct sk_psock *psock;int copied, ret; +if (unlikely (flags &MSG_ERRQUEUE )) +return inet_recv_error (sk, msg, len, addr_len); + psock =sk_psock_get (sk);if (unlikely (!psock))return tcp_recvmsg (sk, msg, len, nonblock, flags, addr_len); -if (unlikely (flags &MSG_ERRQUEUE )) -return inet_recv_error (sk, msg, len, addr_len);if (!skb_queue_empty (&sk->sk_receive_queue) && -sk_psock_queue_empty (psock)) +sk_psock_queue_empty (psock)) { +sk_psock_put (sk, psock);return tcp_recvmsg (sk, msg, len, nonblock, flags, addr_len); + }lock_sock (sk); msg_bytes_ready: copied =__tcp_bpf_recvmsg (sk, psock, msg, len, flags);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 69/606 powerpc/uaccess: Evaluate macro arguments once, before user access is allowed
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
commit d02f6b7dab8228487268298ea1f21081c0b4b3eb upstream.
get/put_user() can be called with nontrivial arguments. fs/proc/page.c has a good example:
if (put_user(stable_page_flags(ppage), out)) {stable_page_flags() is quite a lot of code, including spin locks in the page allocator.
Ensure these arguments are evaluated before user access is allowed.
This improves security by reducing code with access to userspace, but it also fixes a PREEMPT bug with KUAP on powerpc/64s:stable_page_flags() is currently called with AMR set to allow writes, it ends up calling spin_unlock(), which can call preempt_schedule. But the task switch code can not be called with AMR set (it relies on interrupts saving the register), so this blows up.
It's fine if the code inside allow_user_access() is preemptible, because a timer or IPI will save the AMR, but it's not okay to explicitly cause a reschedule.
--- arch/powerpc/include/asm/uaccess.h | 49 +++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 14 deletions(-)
arch/powerpc/include/asm/uaccess.h +35 -14
@@ -166,13 +166,17 @@ do { \ ({ \long __pu_err; \ __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ + __typeof__(*(ptr)) __pu_val = (x); \ +__typeof__ (size) __pu_size = (size); \ + \if (!is_kernel_addr ((unsigned long )__pu_addr)) \might_fault (); \ -__chk_user_ptr (ptr); \ +__chk_user_ptr (__pu_addr); \if (do_allow) \ -__put_user_size ((x), __pu_addr, (size), __pu_err); \ +__put_user_size (__pu_val, __pu_addr, __pu_size, __pu_err); \else \ -__put_user_size_allowed ((x), __pu_addr, (size), __pu_err); \ +__put_user_size_allowed (__pu_val, __pu_addr, __pu_size, __pu_err); \ + \ __pu_err; \ })
@@ -180,9 +184,13 @@ do { \ ({ \long __pu_err = -EFAULT ; \ __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ + __typeof__(*(ptr)) __pu_val = (x); \ +__typeof__ (size) __pu_size = (size); \ + \might_fault (); \ -if (access_ok (__pu_addr, size)) \ -__put_user_size ((x), __pu_addr, (size), __pu_err); \ +if (access_ok (__pu_addr, __pu_size)) \ +__put_user_size (__pu_val, __pu_addr, __pu_size, __pu_err); \ + \ __pu_err; \ })
@@ -190,8 +198,12 @@ do { \ ({ \long __pu_err; \ __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ -__chk_user_ptr (ptr); \ -__put_user_size ((x), __pu_addr, (size), __pu_err); \ + __typeof__(*(ptr)) __pu_val = (x); \ +__typeof__ (size) __pu_size = (size); \ + \ +__chk_user_ptr (__pu_addr); \ +__put_user_size (__pu_val, __pu_addr, __pu_size, __pu_err); \ + \ __pu_err; \ })
@@ -283,15 +295,18 @@ do { \long __gu_err; \ __long_type(*(ptr)) __gu_val; \ __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ -__chk_user_ptr (ptr); \ +__typeof__ (size) __gu_size = (size); \ + \ +__chk_user_ptr (__gu_addr); \if (!is_kernel_addr ((unsigned long )__gu_addr)) \might_fault (); \barrier_nospec (); \if (do_allow) \ -__get_user_size (__gu_val, __gu_addr, (size), __gu_err); \ +__get_user_size (__gu_val, __gu_addr, __gu_size, __gu_err); \else \ -__get_user_size_allowed (__gu_val, __gu_addr, (size), __gu_err); \ +__get_user_size_allowed (__gu_val, __gu_addr, __gu_size, __gu_err); \ (x) = (__typeof__ (*(ptr )))__gu_val; \ + \ __gu_err; \ })
@@ -300,12 +315,15 @@ do { \long __gu_err = -EFAULT ; \ __long_type(*(ptr)) __gu_val = 0; \ __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ +__typeof__ (size) __gu_size = (size); \ + \might_fault (); \ -if (access_ok (__gu_addr, (size))) { \ +if (access_ok (__gu_addr, __gu_size)) { \barrier_nospec (); \ -__get_user_size (__gu_val, __gu_addr, (size), __gu_err); \ +__get_user_size (__gu_val, __gu_addr, __gu_size, __gu_err); \ } \ (x) = (__force __typeof__(*(ptr)))__gu_val; \ + \ __gu_err; \ })
@@ -314,10 +332,13 @@ do { \long __gu_err; \ __long_type(*(ptr)) __gu_val; \ __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ -__chk_user_ptr (ptr); \ +__typeof__ (size) __gu_size = (size); \ + \ +__chk_user_ptr (__gu_addr); \barrier_nospec (); \ -__get_user_size (__gu_val, __gu_addr, (size), __gu_err); \ +__get_user_size (__gu_val, __gu_addr, __gu_size, __gu_err); \ (x) = (__force __typeof__(*(ptr)))__gu_val; \ + \ __gu_err; \ })
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 70/606 powerpc/ima: Fix secure boot rules in ima arch policy
In reply to Sasha LevinFrom: Nayna Jain <[email protected]>
commit fa4f3f56ccd28ac031ab275e673ed4098855fed4 upstream.
To prevent verifying the kernel module appended signature twice (finit_module), once by the module_sig_check() and again by IMA, powerpc secure boot rules define an IMA architecture specific policy rule only if CONFIG_MODULE_SIG_FORCE is not enabled. This, unfortunately, does not take into account the ability of enabling "sig_enforce" on the boot command line (module.sig_enforce=1).
Including the IMA module appraise rule results in failing the finit_module syscall, unless the module signing public key is loaded onto the IMA keyring.
This patch fixes secure boot policy rules to be based on CONFIG_MODULE_SIG instead.
--- arch/powerpc/kernel/ima_arch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/ima_arch.c +3 -3
@@ -19,12 +19,12 @@ bool arch_ima_get_secureboot(void)* to be stored as an xattr or as an appended signature. * * To avoid duplicate signature verification as much as possible, the IMA -* policy rule for module appraisal is added only if CONFIG_MODULE_SIG_FORCE +* policy rule for module appraisal is added only if CONFIG_MODULE_SIG * is not enabled. */ static const char *const secure_rules[] = {"appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig" , -#ifndef CONFIG_MODULE_SIG_FORCE +#ifndef CONFIG_MODULE_SIG"appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig" , #endifNULL
@@ -50,7 +50,7 @@ static const char *const secure_and_trusted_rules[] = {"measure func=KEXEC_KERNEL_CHECK template=ima-modsig" ,"measure func=MODULE_CHECK template=ima-modsig" ,"appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig" , -#ifndef CONFIG_MODULE_SIG_FORCE +#ifndef CONFIG_MODULE_SIG"appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig" , #endifNULL
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 71/606 RDMA/uverbs: Do not discard the IB_EVENT_DEVICE_FATAL event
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
commit c485b19d52c4ba269dfd027945dee81755fdd530 upstream.
The commit below moved all of the destruction to the disassociate step and cleaned up the event channel during destroy_uobj.
However, when ib_uverbs_free_hw_resources() pushes IB_EVENT_DEVICE_FATAL and then immediately goes to destroy all uobjects this causes ib_uverbs_free_event_queue() to discard the queued event if userspace hasn't already read() it.
Unlike all other event queues async FD needs to defer the ib_uverbs_free_event_queue() until FD release. This still unregisters the handler from the IB device during disassociation.
--- drivers/infiniband/core/rdma_core.c | 3 ++- drivers/infiniband/core/uverbs.h | 1 + drivers/infiniband/core/uverbs_main.c | 2 +- .../core/uverbs_std_types_async_fd.c | 26 ++++++++++++++++++- 4 files changed, 29 insertions(+), 3 deletions(-)
drivers/infiniband/core/rdma_core.c +2 -1
@@ -459,7 +459,8 @@ alloc_begin_fd_uobject(const struct uverbs_api_object *obj,struct ib_uobject *uobj;struct file *filp; -if (WARN_ON (fd_type->fops->release != &uverbs_uobject_fd_release)) +if (WARN_ON (fd_type->fops->release != &uverbs_uobject_fd_release && + fd_type->fops->release != &uverbs_async_event_release))return ERR_PTR (-EINVAL ); new_fd =get_unused_fd_flags (O_CLOEXEC );
drivers/infiniband/core/uverbs.h +1 -0
@@ -219,6 +219,7 @@ void ib_uverbs_init_event_queue(struct ib_uverbs_event_queue *ev_queue);void ib_uverbs_init_async_event_file (struct ib_uverbs_async_event_file *ev_file);void ib_uverbs_free_event_queue (struct ib_uverbs_event_queue *event_queue);void ib_uverbs_flow_resources_free (struct ib_uflow_resources *uflow_res); +int uverbs_async_event_release (struct inode *inode,struct file *filp);int ib_alloc_ucontext (struct uverbs_attr_bundle *attrs);int ib_init_ucontext (struct uverbs_attr_bundle *attrs);
drivers/infiniband/core/uverbs_main.c +1 -1
@@ -346,7 +346,7 @@ const struct file_operations uverbs_async_event_fops = { .owner = THIS_MODULE, .read = ib_uverbs_async_event_read, .poll = ib_uverbs_async_event_poll, - .release = uverbs_uobject_fd_release, + .release = uverbs_async_event_release, .fasync = ib_uverbs_async_event_fasync, .llseek = no_llseek, };
drivers/infiniband/core/uverbs_std_types_async_fd.c +25 -1
@@ -26,10 +26,34 @@ static int uverbs_async_event_destroy_uobj(struct ib_uobject *uobj, container_of(uobj, struct ib_uverbs_async_event_file, uobj);ib_unregister_event_handler (&event_file->event_handler); -ib_uverbs_free_event_queue (&event_file->ev_queue);return 0 ; } +int uverbs_async_event_release (struct inode *inode,struct file *filp) +{ +struct ib_uverbs_async_event_file *event_file; +struct ib_uobject *uobj = filp->private_data; +int ret; + +if (!uobj) +return uverbs_uobject_fd_release (inode, filp); + + event_file = + container_of(uobj, struct ib_uverbs_async_event_file, uobj); + +/* +* The async event FD has to deliver IB_EVENT_DEVICE_FATAL even after +* disassociation, so cleaning the event list must only happen after +* release. The user knows it has reached the end of the event stream +* when it sees IB_EVENT_DEVICE_FATAL. +*/ +uverbs_uobject_get (uobj); + ret =uverbs_uobject_fd_release (inode, filp); +ib_uverbs_free_event_queue (&event_file->ev_queue); +uverbs_uobject_put (uobj); +return ret; +} + DECLARE_UVERBS_NAMED_METHOD( UVERBS_METHOD_ASYNC_EVENT_ALLOC, UVERBS_ATTR_FD(UVERBS_ATTR_ASYNC_EVENT_ALLOC_FD_HANDLE,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 72/606 RDMA/uverbs: Move IB_EVENT_DEVICE_FATAL to destroy_uobj
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
commit ccfdbaa5cf4601b9b71601893029dcc9245c002b upstream.
When multiple async FDs were allowed to exist the idea was for all broadcast events to be delivered to all async FDs, however IB_EVENT_DEVICE_FATAL was missed.
Instead of having ib_uverbs_free_hw_resources() special case the global async_fd, have it cause the event during the uobject destruction. Every async fd is now a uobject so simply generate the IB_EVENT_DEVICE_FATAL while destroying the async fd uobject. This ensures every async FD gets a copy of the event.
--- drivers/infiniband/core/uverbs.h | 3 +++ drivers/infiniband/core/uverbs_main.c | 10 +++------- drivers/infiniband/core/uverbs_std_types_async_fd.c | 4 ++++ 3 files changed, 10 insertions(+), 7 deletions(-)
drivers/infiniband/core/uverbs.h +3 -0
@@ -228,6 +228,9 @@ void ib_uverbs_release_ucq(struct ib_uverbs_completion_event_file *ev_file, struct ib_ucq_object *uobj);void ib_uverbs_release_uevent (struct ib_uevent_object *uobj);void ib_uverbs_release_file (struct kref *ref); +void ib_uverbs_async_handler (struct ib_uverbs_async_event_file *async_file, +__u64 element,__u64 event, +struct list_head *obj_list,u32 *counter);void ib_uverbs_comp_handler (struct ib_cq *cq,void *cq_context);void ib_uverbs_cq_event_handler (struct ib_event *event,void *context_ptr);
drivers/infiniband/core/uverbs_main.c +3 -7
@@ -386,10 +386,9 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)kill_fasync (&ev_queue->async_queue,SIGIO ,POLL_IN ); } -static void -ib_uverbs_async_handler (struct ib_uverbs_async_event_file *async_file, -__u64 element,__u64 event,struct list_head *obj_list, -u32 *counter) +void ib_uverbs_async_handler (struct ib_uverbs_async_event_file *async_file, +__u64 element,__u64 event, +struct list_head *obj_list,u32 *counter) {struct ib_uverbs_event *entry;unsigned long flags;
@@ -1187,9 +1186,6 @@ static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev,*/ mutex_unlock (&uverbs_dev->lists_mutex); -ib_uverbs_async_handler (READ_ONCE (file->async_file),0 , -IB_EVENT_DEVICE_FATAL ,NULL ,NULL ); -uverbs_destroy_ufile_hw (file,RDMA_REMOVE_DRIVER_REMOVE );kref_put (&file->ref, ib_uverbs_release_file);
drivers/infiniband/core/uverbs_std_types_async_fd.c +4 -0
@@ -26,6 +26,10 @@ static int uverbs_async_event_destroy_uobj(struct ib_uobject *uobj, container_of(uobj, struct ib_uverbs_async_event_file, uobj);ib_unregister_event_handler (&event_file->event_handler); + +if (why ==RDMA_REMOVE_DRIVER_REMOVE ) +ib_uverbs_async_handler (event_file,0 ,IB_EVENT_DEVICE_FATAL , +NULL ,NULL );return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 73/606 riscv: perf: RISCV_BASE_PMU should be independent
In reply to Sasha LevinFrom: Kefeng Wang <[email protected]>
commit 48084c3595cb7429f6ba734cfea1313573b9a7fa upstream.
Selecting PERF_EVENTS without selecting RISCV_BASE_PMU results in a build error.
--- arch/riscv/include/asm/perf_event.h | 8 ++------ arch/riscv/kernel/Makefile | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-)
arch/riscv/include/asm/perf_event.h +2 -6
@@ -12,19 +12,14 @@#include <linux/ptrace.h> #include <linux/interrupt.h> +#ifdef CONFIG_RISCV_BASE_PMU #define RISCV_BASE_COUNTERS 2/* * The RISCV_MAX_COUNTERS parameter should be specified. */ -#ifdef CONFIG_RISCV_BASE_PMU #define RISCV_MAX_COUNTERS 2 -#endif - -#ifndef RISCV_MAX_COUNTERS -#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU." -#endif /* * These are the indexes of bits in counteren register *minus* 1,
@@ -82,6 +77,7 @@ struct riscv_pmu { int irq; }; +#endif #ifdef CONFIG_PERF_EVENTS #define perf_arch_bpf_user_pt_regs (regs) (struct user_regs_struct *)regs#endif
arch/riscv/kernel/Makefile +1 -1
@@ -38,7 +38,7 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o -obj-$(CONFIG_PERF_EVENTS) += perf_event.o +obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o obj-$(CONFIG_RISCV_SBI) += sbi.o
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 74/606 KVM: x86: Fix off-by-one error in kvm_vcpu_ioctl_x86_setup_mce
In reply to Sasha LevinFrom: Jim Mattson <[email protected]>
commit c4e0e4ab4cf3ec2b3f0b628ead108d677644ebd9 upstream.
Bank_num is a one-based count of banks, not a zero-based index. It overflows the allocated space only when strictly greater than KVM_MAX_MCE_BANKS.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -3739,7 +3739,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,unsigned bank_num = mcg_cap &0xff , bank; r = -EINVAL ; -if (!bank_num || bank_num >=KVM_MAX_MCE_BANKS ) +if (!bank_num || bank_num >KVM_MAX_MCE_BANKS ) goto out;if (mcg_cap & ~(kvm_mce_cap_supported |0xff |0xff0000 )) goto out;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 75/606 bpf: Enforce returning 0 for fentry/fexit progs
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
commit e92888c72fbdc6f9d07b3b0604c012e81d7c0da7 upstream.
Currently, tracing/fentry and tracing/fexit prog return values are not enforced. In trampoline codes, the fentry/fexit prog return values are ignored. Let us enforce it to be 0 to avoid confusion and allows potential future extension.
This patch also explicitly added return value checking for tracing/raw_tp, tracing/fmod_ret, and freplace programs such that these program return values can be anything. The purpose are two folds:
1. to make it explicit about return value expectations for these programs in verifier.
2. for tracing prog_type, if a future attach type is added, the default is -ENOTSUPP which will enforce to specify return value ranges explicitly.
--- kernel/bpf/verifier.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
kernel/bpf/verifier.c +16 -0
@@ -6498,6 +6498,22 @@ static int check_return_code(struct bpf_verifier_env *env)return 0 ; range =tnum_const (0 );break ; +case BPF_PROG_TYPE_TRACING : +switch (env->prog->expected_attach_type) { +case BPF_TRACE_FENTRY : +case BPF_TRACE_FEXIT : + range =tnum_const (0 ); +break ; +case BPF_TRACE_RAW_TP : +return 0 ; +default : +return -ENOTSUPP ; + } +break ; +case BPF_PROG_TYPE_EXT : +/* freplace program can return anything as its return value +* depends on the to-be-replaced kernel func or bpf program. +*/ default :return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 76/606 selftests/bpf: Enforce returning 0 for fentry/fexit programs
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
commit 6d74f64b922b8394dccc52576659cb0dc0a1da7b upstream.
There are a few fentry/fexit programs returning non-0. The tests with these programs will break with the previous patch which enfoced return-0 rules. Fix them properly.
--- tools/testing/selftests/bpf/progs/test_overhead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/progs/test_overhead.c +2 -2
@@ -33,13 +33,13 @@ int prog3(struct bpf_raw_tracepoint_args *ctx) SEC("fentry/__set_task_comm")int BPF_PROG (prog4 ,struct task_struct *tsk,const char *buf,bool exec) { -return !tsk; +return 0 ; } SEC("fexit/__set_task_comm")int BPF_PROG (prog5 ,struct task_struct *tsk,const char *buf,bool exec) { -return !tsk; +return 0 ; } char _license[] SEC("license") = "GPL";
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 77/606 bpf: Restrict bpf_trace_printk()'s %s usage and add %pks, %pus specifier
In reply to Sasha LevinFrom: Daniel Borkmann <[email protected]>
commit b2a5212fb634561bb734c6356904e37f6665b955 upstream.
Usage of plain %s conversion specifier in bpf_trace_printk() suffers from the very same issue as bpf_probe_read{,str}() helpers, that is, it is broken on archs with overlapping address ranges.
While the helpers have been addressed through work in 6ae08ae3dea2 ("bpf: Add probe_read_{user, kernel} and probe_read_{user, kernel}_str helpers"), we need an option for bpf_trace_printk() as well to fix it.
Similarly as with the helpers, force users to make an explicit choice by adding %pks and %pus specifier to bpf_trace_printk() which will then pick the corresponding strncpy_from_unsafe*() variant to perform the access under KERNEL_DS or USER_DS. The %pk* (kernel specifier) and %pu* (user specifier) can later also be extended for other objects aside strings that are probed and printed under tracing, and reused out of other facilities like bpf_seq_printf() or BTF based type printing.
Existing behavior of %s for current users is still kept working for archs where it is not broken and therefore gated through CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE. For archs not having this property we fall-back to pick probing under KERNEL_DS as a sensible default.
--- Documentation/core-api/printk-formats.rst | 14 ++++ kernel/trace/bpf_trace.c | 94 +++++++++++++++-------- lib/vsprintf.c | 12 +++ 3 files changed, 88 insertions(+), 32 deletions(-)
Documentation/core-api/printk-formats.rst +14 -0
@@ -112,6 +112,20 @@ used when printing stack backtraces. The specifier takes into consideration the effect of compiler optimisations which may occur when tail-calls are used and marked with the noreturn GCC attribute. +Probed Pointers from BPF / tracing +---------------------------------- + +:: + + %pks kernel string + %pus user string + +The ``k`` and ``u`` specifiers are used for printing prior probed memory from +either kernel memory (k) or user memory (u). The subsequent ``s`` specifier +results in printing a string. For direct use in regular vsnprintf() the (k) +and (u) annotation is ignored, however, when used out of BPF's bpf_trace_printk(), +for example, it reads the memory it is pointing to without faulting. + Kernel Pointers ---------------
kernel/trace/bpf_trace.c +62 -32
125 lines not on this page · raw message
lib/vsprintf.c +12 -0
@@ -2168,6 +2168,10 @@ char *fwnode_string(char *buf, char *end, struct fwnode_handle *fwnode,* f full name * P node name, including a possible unit address * - 'x' For printing the address. Equivalent to "%lx". +* - '[ku]s' For a BPF/tracing related format specifier, e.g. used out of +* bpf_trace_printk() where [ku] prefix specifies either kernel (k) +* or user (u) memory to probe, and: +* s a string, equivalent to "%s" on direct vsnprintf() use * * ** When making changes please also update: * Documentation/core-api/printk-formats.rst
@@ -2251,6 +2255,14 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,if (!IS_ERR (ptr))break ;return err_ptr (buf, end, ptr, spec); +case 'u' : +case 'k' : +switch (fmt[1 ]) { +case 's' : +return string (buf, end, ptr, spec); +default : +return error_string (buf, end,"(einval)" , spec); + } }/* default is to _not_ leak addresses, hash before printing */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 78/606 Makefile: disallow data races on gcc-10 as well
In reply to Sasha LevinFrom: Sergei Trofimovich <[email protected]>
commit b1112139a103b4b1101d0d2d72931f2d33d8c978 upstream.
gcc-10 will rename --param=allow-store-data-races=0 to -fno-allow-store-data-races.
The flag change happened at https://gcc.gnu.org/PR92046.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -710,6 +710,7 @@ endif # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) +KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) include scripts/Makefile.kcov include scripts/Makefile.gcc-plugins
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 79/606 Linux 5.6.14
In reply to Sasha LevinFrom: Greg Kroah-Hartman <[email protected]>
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 6 -SUBLEVEL = 13 +SUBLEVEL = 14 EXTRAVERSION = NAME = Kleptomaniac Octopus
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 80/606 i2c: dev: Fix the race between the release of i2c_dev and cdev
In reply to Sasha LevinFrom: Kevin Hao <[email protected]>
commit 1413ef638abae4ab5621901cf4d8ef08a4a48ba6 upstream.
The struct cdev is embedded in the struct i2c_dev. In the current code,
we would free the i2c_dev struct directly in put_i2c_dev(), but the
cdev is manged by a kobject, and the release of it is not predictable.
So it is very possible that the i2c_dev is freed before the cdev is
entirely released. We can easily get the following call trace with CONFIG_DEBUG_KOBJECT_RELEASE and CONFIG_DEBUG_OBJECTS_TIMERS enabled.
ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x38
WARNING: CPU: 19 PID: 1 at lib/debugobjects.c:325 debug_print_object+0xb0/0xf0 Modules linked in: CPU: 19 PID: 1 Comm: swapper/0 Tainted: G W 5.2.20-yocto-standard+ #120 Hardware name: Marvell OcteonTX CN96XX board (DT) pstate: 80c00089 (Nzcv daIf +PAN +UAO) pc : debug_print_object+0xb0/0xf0 lr : debug_print_object+0xb0/0xf0 sp : ffff00001292f7d0 x29: ffff00001292f7d0 x28: ffff800b82151788 x27: 0000000000000001 x26: ffff800b892c0000 x25: ffff0000124a2558 x24: 0000000000000000 x23: ffff00001107a1d8 x22: ffff0000116b5088 x21: ffff800bdc6afca8 x20: ffff000012471ae8 x19: ffff00001168f2c8 x18: 0000000000000010 x17: 00000000fd6f304b x16: 00000000ee79de43 x15: ffff800bc0e80568 x14: 79616c6564203a74 x13: 6e6968207473696c x12: 5f72656d6974203a x11: ffff0000113f0018 x10: 0000000000000000 x9 : 000000000000001f x8 : 0000000000000000 x7 : ffff0000101294cc x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000001 x3 : 00000000ffffffff x2 : 0000000000000000 x1 : 387fc15c8ec0f200 x0 : 0000000000000000 Call trace: debug_print_object+0xb0/0xf0 __debug_check_no_obj_freed+0x19c/0x228 debug_check_no_obj_freed+0x1c/0x28 kfree+0x250/0x440 put_i2c_dev+0x68/0x78 i2cdev_detach_adapter+0x60/0xc8 i2cdev_notifier_call+0x3c/0x70 notifier_call_chain+0x8c/0xe8 blocking_notifier_call_chain+0x64/0x88 device_del+0x74/0x380 device_unregister+0x54/0x78 i2c_del_adapter+0x278/0x2d0 unittest_i2c_bus_remove+0x3c/0x80 platform_drv_remove+0x30/0x50 device_release_driver_internal+0xf4/0x1c0 driver_detach+0x58/0xa0 bus_remove_driver+0x84/0xd8 driver_unregister+0x34/0x60 platform_driver_unregister+0x20/0x30 of_unittest_overlay+0x8d4/0xbe0 of_unittest+0xae8/0xb3c do_one_initcall+0xac/0x450 do_initcall_level+0x208/0x224 kernel_init_freeable+0x2d8/0x36c kernel_init+0x18/0x108 ret_from_fork+0x10/0x1c irq event stamp: 3934661 hardirqs last enabled at (3934661): [<ffff00001009fa04>] debug_exception_exit+0x4c/0x58 hardirqs last disabled at (3934660): [<ffff00001009fb14>] debug_exception_enter+0xa4/0xe0 softirqs last enabled at (3934654): [<ffff000010081d94>] __do_softirq+0x46c/0x628 softirqs last disabled at (3934649): [<ffff0000100b4a1c>] irq_exit+0x104/0x118
This is a common issue when using cdev embedded in a struct. Fortunately, we already have a mechanism to solve this kind of issue. Please see commit 233ed09d7fda ("chardev: add helper function to register char devs with a struct device") for more detail.
In this patch, we choose to embed the struct device into the i2c_dev, and use the API provided by the commit 233ed09d7fda to make sure that the release of i2c_dev and cdev are in sequence.
--- drivers/i2c/i2c-dev.c | 48 +++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 22 deletions(-)
drivers/i2c/i2c-dev.c +26 -22
@@ -40,7 +40,7 @@struct i2c_dev {struct list_head list;struct i2c_adapter *adap; -struct device *dev; +struct device dev;struct cdev cdev; };
@@ -84,12 +84,14 @@ static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap)return i2c_dev; } -static void put_i2c_dev (struct i2c_dev *i2c_dev) +static void put_i2c_dev (struct i2c_dev *i2c_dev,bool del_cdev) {spin_lock (&i2c_dev_list_lock);list_del (&i2c_dev->list);spin_unlock (&i2c_dev_list_lock); -kfree (i2c_dev); +if (del_cdev) +cdev_device_del (&i2c_dev->cdev, &i2c_dev->dev); +put_device (&i2c_dev->dev); } static ssize_t name_show(struct device *dev,
@@ -628,6 +630,14 @@ static const struct file_operations i2cdev_fops = {static struct class *i2c_dev_class; +static void i2cdev_dev_release (struct device *dev) +{ +struct i2c_dev *i2c_dev; + + i2c_dev = container_of(dev, struct i2c_dev, dev); +kfree (i2c_dev); +} +static int i2cdev_attach_adapter (struct device *dev,void *dummy) {struct i2c_adapter *adap;
@@ -644,27 +654,23 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy)cdev_init (&i2c_dev->cdev, &i2cdev_fops); i2c_dev->cdev.owner =THIS_MODULE ; - res =cdev_add (&i2c_dev->cdev,MKDEV (I2C_MAJOR , adap->nr),1 ); -if (res) - goto error_cdev; - -/* register this i2c device with the driver core */ - i2c_dev->dev =device_create (i2c_dev_class, &adap->dev, -MKDEV (I2C_MAJOR , adap->nr),NULL , -"i2c-%d" , adap->nr); -if (IS_ERR (i2c_dev->dev)) { - res =PTR_ERR (i2c_dev->dev); - goto error; + +device_initialize (&i2c_dev->dev); + i2c_dev->dev.devt =MKDEV (I2C_MAJOR , adap->nr); + i2c_dev->dev.class = i2c_dev_class; + i2c_dev->dev.parent = &adap->dev; + i2c_dev->dev.release = i2cdev_dev_release; +dev_set_name (&i2c_dev->dev,"i2c-%d" , adap->nr); + + res =cdev_device_add (&i2c_dev->cdev, &i2c_dev->dev); +if (res) { +put_i2c_dev (i2c_dev, false); +return res; }pr_debug ("i2c-dev: adapter [%s] registered as minor %d\n" , adap->name, adap->nr);return 0 ; -error: -cdev_del (&i2c_dev->cdev); -error_cdev: -put_i2c_dev (i2c_dev); -return res; }static int i2cdev_detach_adapter (struct device *dev,void *dummy)
@@ -680,9 +686,7 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy)if (!i2c_dev)/* attach_adapter must have failed */ return 0 ; -cdev_del (&i2c_dev->cdev); -put_i2c_dev (i2c_dev); -device_destroy (i2c_dev_class,MKDEV (I2C_MAJOR , adap->nr)); +put_i2c_dev (i2c_dev, true);pr_debug ("i2c-dev: adapter [%s] unregistered\n" , adap->name);return 0 ;
Signature · 1 line
2.25.1
Re: [PATCH AUTOSEL 5.6 080/606] i2c: dev: Fix the race between the release of i2c_dev and cdev
Quoted 3 lines · Sasha Levin
From: Kevin Hao <[email protected]>
commit
1413ef638abae4ab5621901cf4d8ef08a4a48ba6upstream.
[...]
This was already applied in 5.6.15.
Ben.
Signature · 3 lines
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomSasha Levin
maintainerPATCH 81/606 ARC: [plat-hsdk]: fix USB regression
In reply to Sasha LevinFrom: Eugeniy Paltsev <[email protected]>
[ Upstream commit 4c13ca86dcf80a8c705b1f3674ff43d318e970e0 ]
As of today the CONFIG_USB isn't explicitly present in HSDK defconfig as it is implicitly forcibly enabled by UDL driver which selects CONFIG_USB in its kconfig.
The commit 5d50bd440bc2 ("drm/udl: Make udl driver depend on CONFIG_USB") reverse the dependencies between UDL and USB so UDL now depends on CONFIG_USB and not selects it. This introduces regression for ARC HSDK board as HSDK defconfig wasn't adjusted and now it misses USB support due to lack of CONFIG_USB enabled.
Fix that.
--- arch/arc/configs/hsdk_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arc/configs/hsdk_defconfig +1 -0
@@ -65,6 +65,7 @@ CONFIG_DRM_UDL=y CONFIG_DRM_ETNAVIV=y CONFIG_FB=y CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD_PLATFORM=y CONFIG_USB_OHCI_HCD=y
Signature · 7 lines
2.25.1 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Sasha Levin
maintainerPATCH 82/606 ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash()
In reply to Sasha LevinFrom: Roberto Sassu <[email protected]>
[ Upstream commit 0014cc04e8ec077dc482f00c87dfd949cfe2b98f ]
Commit a408e4a86b36 ("ima: open a new file instance if no read permissions") tries to create a new file descriptor to calculate a file digest if the file has not been opened with O_RDONLY flag. However, if a new file descriptor cannot be obtained, it sets the FMODE_READ flag to file->f_flags instead of file->f_mode.
This patch fixes this issue by replacing f_flags with f_mode as it was before that commit.
--- security/integrity/ima/ima_crypto.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
security/integrity/ima/ima_crypto.c +6 -6
@@ -413,7 +413,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)loff_t i_size;int rc;struct file *f = file; -bool new_file_instance = false, modified_flags = false; +bool new_file_instance = false, modified_mode = false;/* * For consistency, fail file's opened with the O_DIRECT flag on
@@ -433,13 +433,13 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) f =dentry_open (&file->f_path, flags, file->f_cred);if (IS_ERR (f)) {/* -* Cannot open the file again, lets modify f_flags +* Cannot open the file again, lets modify f_mode * of original and continue */ pr_info_ratelimited ("Unable to reopen file for reading.\n" ); f = file; - f->f_flags |=FMODE_READ ; - modified_flags = true; + f->f_mode |=FMODE_READ ; + modified_mode = true; }else { new_file_instance = true; }
@@ -457,8 +457,8 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) out:if (new_file_instance)fput (f); -else if (modified_flags) - f->f_flags &= ~FMODE_READ ; +else if (modified_mode) + f->f_mode &= ~FMODE_READ ;return rc; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 83/606 evm: Check also if *tfm is an error pointer in init_desc()
In reply to Sasha LevinFrom: Roberto Sassu <[email protected]>
[ Upstream commit 53de3b080d5eae31d0de219617155dcc34e7d698 ]
This patch avoids a kernel panic due to accessing an error pointer set by crypto_alloc_shash(). It occurs especially when there are many files that require an unsupported algorithm, as it would increase the likelihood of the following race condition:
Task A: *tfm = crypto_alloc_shash() <= error pointer Task B: if (*tfm == NULL) <= *tfm is not NULL, use it Task B: rc = crypto_shash_init(desc) <= panic Task A: *tfm = NULL
This patch uses the IS_ERR_OR_NULL macro to determine whether or not a new crypto context must be created.
--- security/integrity/evm/evm_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/evm/evm_crypto.c +1 -1
@@ -93,7 +93,7 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo) algo = hash_algo_name[hash_algo]; } -if (*tfm ==NULL ) { +if (IS_ERR_OR_NULL (*tfm)) {mutex_lock (&mutex);if (*tfm) goto out;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 84/606 ima: Fix return value of ima_write_policy()
In reply to Sasha LevinFrom: Roberto Sassu <[email protected]>
[ Upstream commit 2e3a34e9f409ebe83d1af7cd2f49fca7af97dfac ]
This patch fixes the return value of ima_write_policy() when a new policy is directly passed to IMA and the current policy requires appraisal of the file containing the policy. Currently, if appraisal is not in ENFORCE mode, ima_write_policy() returns 0 and leads user space applications to an endless loop. Fix this issue by denying the operation regardless of the appraisal mode.
--- security/integrity/ima/ima_fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
security/integrity/ima/ima_fs.c +1 -2
@@ -340,8 +340,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,integrity_audit_msg (AUDIT_INTEGRITY_STATUS ,NULL ,NULL ,"policy_update" ,"signed policy required" ,1 ,0 ); -if (ima_appraise &IMA_APPRAISE_ENFORCE ) - result = -EACCES ; + result = -EACCES ; }else { result =ima_parse_add_rule (data); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 85/606 ovl: potential crash in ovl_fid_to_fh()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 9aafc1b0187322fa4fd4eb905d0903172237206c ]
The "buflen" value comes from the user and there is a potential that it could be zero. In do_handle_to_path() we know that "handle->handle_bytes" is non-zero and we do:
handle_dwords = handle->handle_bytes >> 2;
So values 1-3 become zero. Then in ovl_fh_to_dentry() we do:
int len = fh_len << 2;
So now len is in the "0,4-128" range and a multiple of 4. But if "buflen" is zero it will try to copy negative bytes when we do the memcpy in ovl_fid_to_fh().
memcpy(&fh->fb, fid, buflen - OVL_FH_WIRE_OFFSET);
And that will lead to a crash. Thanks to Amir Goldstein for his help with this patch.
--- fs/overlayfs/export.c | 3 +++ 1 file changed, 3 insertions(+)
fs/overlayfs/export.c +3 -0
@@ -777,6 +777,9 @@ static struct ovl_fh *ovl_fid_to_fh(struct fid *fid, int buflen, int fh_type)if (fh_type !=OVL_FILEID_V0 )return ERR_PTR (-EINVAL ); +if (buflen <=OVL_FH_WIRE_OFFSET ) +return ERR_PTR (-EINVAL ); + fh =kzalloc (buflen,GFP_KERNEL );if (!fh)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 86/606 ubifs: fix wrong use of crypto_shash_descsize()
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit 3c3c32f85b6cc05e5db78693457deff03ac0f434 ]
crypto_shash_descsize() returns the size of the shash_desc context needed to compute the hash, not the size of the hash itself.
crypto_shash_digestsize() would be correct, or alternatively using c->hash_len and c->hmac_desc_len which already store the correct values. But actually it's simpler to just use stack arrays, so do that instead.
--- fs/ubifs/auth.c | 17 ++++------------- fs/ubifs/replay.c | 13 ++----------- 2 files changed, 6 insertions(+), 24 deletions(-)
fs/ubifs/auth.c +4 -13
@@ -79,13 +79,9 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node, struct shash_desc *inhash) {struct ubifs_auth_node *auth = node; -u8 *hash; +u8 hash[UBIFS_HASH_ARR_SZ ];int err; - hash =kmalloc (crypto_shash_descsize (c->hash_tfm),GFP_NOFS ); -if (!hash) -return -ENOMEM ; - {SHASH_DESC_ON_STACK (hash_desc, c->hash_tfm);
@@ -94,21 +90,16 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node, err =crypto_shash_final (hash_desc, hash);if (err) - goto out; +return err; } err =ubifs_hash_calc_hmac (c, hash, auth->hmac);if (err) - goto out; +return err; auth->ch.node_type =UBIFS_AUTH_NODE ;ubifs_prepare_node (c, auth,ubifs_auth_node_sz (c),0 ); - - err =0 ; -out: -kfree (hash); - -return err; +return 0 ; } static struct shash_desc *ubifs_get_desc(const struct ubifs_info *c,
fs/ubifs/replay.c +2 -11
@@ -601,18 +601,12 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,struct ubifs_scan_node *snod;int n_nodes =0 ;int err; -u8 *hash, *hmac; +u8 hash[UBIFS_HASH_ARR_SZ ]; +u8 hmac[UBIFS_HMAC_ARR_SZ ];if (!ubifs_authenticated (c))return sleb->nodes_cnt; - hash =kmalloc (crypto_shash_descsize (c->hash_tfm),GFP_NOFS ); - hmac =kmalloc (c->hmac_desc_len,GFP_NOFS ); -if (!hash || !hmac) { - err = -ENOMEM ; - goto out; - } -list_for_each_entry (snod, &sleb->nodes, list) { n_nodes++;
@@ -662,9 +656,6 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb, err =0 ; } out: -kfree (hash); -kfree (hmac); -return err ? err : n_nodes - n_not_auth; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 87/606 ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactive
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 607b9df63057a56f6172d560d5366cca6a030c76 ]
Flushing the EC work while suspended to idle when the EC GPE status is not set causes some EC wakeup events (notably power button and lid ones) to be missed after a series of spurious wakeups on the Dell XPS13 9360 in my office.
If that happens, the machine cannot be woken up from suspend-to-idle by the power button or lid status change and it needs to be woken up in some other way (eg. by a key press).
Flushing the EC work only after successful dispatching the EC GPE, which means that its status has been set, avoids the issue, so change the code in question accordingly.
--- drivers/acpi/ec.c | 6 +++++- drivers/acpi/sleep.c | 15 ++++----------- 2 files changed, 9 insertions(+), 12 deletions(-)
drivers/acpi/ec.c +5 -1
@@ -2064,9 +2064,13 @@ bool acpi_ec_dispatch_gpe(void)* to allow the caller to process events properly after that. */ ret =acpi_dispatch_gpe (NULL , first_ec->gpe); -if (ret ==ACPI_INTERRUPT_HANDLED ) +if (ret ==ACPI_INTERRUPT_HANDLED ) {pm_pr_dbg ("EC GPE dispatched\n" ); +/* Flush the event and query workqueues. */ +acpi_ec_flush_work (); + } + return false; }#endif /* CONFIG_PM_SLEEP */
drivers/acpi/sleep.c +4 -11
@@ -980,13 +980,6 @@ static int acpi_s2idle_prepare_late(void)return 0 ; } -static void acpi_s2idle_sync (void ) -{ -/* The EC driver uses special workqueues that need to be flushed. */ -acpi_ec_flush_work (); -acpi_os_wait_events_complete ();/* synchronize Notify handling */ -} -static bool acpi_s2idle_wake (void ) {if (!acpi_sci_irq_valid ())
@@ -1018,7 +1011,7 @@ static bool acpi_s2idle_wake(void)return true;/* -* Cancel the wakeup and process all pending events in case +* Cancel the SCI wakeup and process all pending events in case * there are any wakeup ones in there. * * Note that if any non-EC GPEs are active at this point, the
@@ -1026,8 +1019,7 @@ static bool acpi_s2idle_wake(void)* should be missed by canceling the wakeup here. */ pm_system_cancel_wakeup (); - -acpi_s2idle_sync (); +acpi_os_wait_events_complete ();/* * The SCI is in the "suspended" state now and it cannot produce
@@ -1060,7 +1052,8 @@ static void acpi_s2idle_restore(void)* of GPEs. */ acpi_os_wait_events_complete ();/* synchronize GPE processing */ -acpi_s2idle_sync (); +acpi_ec_flush_work ();/* flush the EC driver's workqueues */ +acpi_os_wait_events_complete ();/* synchronize Notify handling */ s2idle_wakeup = false;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 88/606 mtd: spinand: Propagate ECC information to the MTD structure
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit 3507273d5a4d3c2e46f9d3f9ed9449805f5dff07 ]
This is done by default in the raw NAND core (nand_base.c) but was missing in the SPI-NAND core. Without these two lines the ecc_strength and ecc_step_size values are not exported to the user through sysfs.
--- drivers/mtd/nand/spi/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mtd/nand/spi/core.c +4 -0
@@ -1049,6 +1049,10 @@ static int spinand_init(struct spinand_device *spinand) mtd->oobavail = ret; +/* Propagate ECC information to mtd_info */ + mtd->ecc_strength = nand->eccreq.strength; + mtd->ecc_step_size = nand->eccreq.step_size; +return 0 ; err_cleanup_nanddev:
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Sasha Levin
maintainerPATCH 89/606 fix multiplication overflow in copy_fdtable()
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 4e89b7210403fa4a8acafe7c602b6212b7af6c3b ]
cpy and set really should be size_t; we won't get an overflow on that, since sysctl_nr_open can't be set above ~(size_t)0 / sizeof(void *), so nr that would've managed to overflow size_t on that multiplication won't get anywhere near copy_fdtable() - we'll fail with EMFILE before that.
--- fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/file.c +1 -1
@@ -70,7 +70,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,*/ static void copy_fdtable (struct fdtable *nfdt,struct fdtable *ofdt) { -unsigned int cpy, set; +size_t cpy, set;BUG_ON (nfdt->max_fds < ofdt->max_fds);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 90/606 pipe: Fix pipe_full() test in opipe_prep().
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 566d136289dc57816ac290de87a9a0f7d9bd3cbb ]
syzbot is reporting that splice()ing from non-empty read side to already-full write side causes unkillable task, for opipe_prep() is by error not inverting pipe_full() test.
CPU: 0 PID: 9460 Comm: syz-executor.5 Not tainted 5.6.0-rc3-next-20200228-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:rol32 include/linux/bitops.h:105 [inline]
RIP: 0010:iterate_chain_key kernel/locking/lockdep.c:369 [inline]
RIP: 0010:__lock_acquire+0x6a3/0x5270 kernel/locking/lockdep.c:4178
Call Trace:
lock_acquire+0x197/0x420 kernel/locking/lockdep.c:4720
__mutex_lock_common kernel/locking/mutex.c:956 [inline]
__mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1103
pipe_lock_nested fs/pipe.c:66 [inline]
pipe_double_lock+0x1a0/0x1e0 fs/pipe.c:104
splice_pipe_to_pipe fs/splice.c:1562 [inline]
do_splice+0x35f/0x1520 fs/splice.c:1141
__do_sys_splice fs/splice.c:1447 [inline]
__se_sys_splice fs/splice.c:1427 [inline]
__x64_sys_splice+0x2b5/0x320 fs/splice.c:1427
do_syscall_64+0xf6/0x790 arch/x86/entry/common.c:295
entry_SYSCALL_64_after_hwframe+0x49/0xbe--- fs/splice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/splice.c +1 -1
@@ -1503,7 +1503,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)* Check pipe occupancy without the inode lock first. This function * is speculative anyways, so missing one is ok. */ -if (pipe_full (pipe->head, pipe->tail, pipe->max_usage)) +if (!pipe_full (pipe->head, pipe->tail, pipe->max_usage))return 0 ; ret =0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 91/606 ubifs: remove broken lazytime support
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit ecf84096a526f2632ee85c32a3d05de3fa60ce80 ]
When "ubifs: introduce UBIFS_ATIME_SUPPORT to ubifs" introduced atime support to ubifs, it also added lazytime support. As far as I can tell the lazytime support is terminally broken, as it causes mark_inode_dirty_sync to be called from __writeback_single_inode, which will then trigger the locking assert in ubifs_dirty_inode. Just remove the broken lazytime support for now, it can be added back later, especially as some infrastructure changes should make that easier soon.
--- fs/ubifs/file.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
fs/ubifs/file.c +1 -5
@@ -1375,7 +1375,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,struct ubifs_info *c = inode->i_sb->s_fs_info;struct ubifs_budget_req req = { .dirtied_ino =1 , .dirtied_ino_d =ALIGN (ui->data_len,8 ) }; -int iflags =I_DIRTY_TIME ;int err, release;if (!IS_ENABLED (CONFIG_UBIFS_ATIME_SUPPORT ))
@@ -1393,11 +1392,8 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,if (flags &S_MTIME ) inode->i_mtime = *time; -if (!(inode->i_sb->s_flags &SB_LAZYTIME )) - iflags |=I_DIRTY_SYNC ; - release = ui->dirty; -__mark_inode_dirty (inode, iflags); +__mark_inode_dirty (inode,I_DIRTY_SYNC );mutex_unlock (&ui->ui_mutex);if (release)ubifs_release_budget (c, &req);
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Sasha Levin
maintainerPATCH 92/606 i2c: fix missing pm_runtime_put_sync in i2c_device_probe
In reply to Sasha LevinFrom: Alain Volmat <[email protected]>
[ Upstream commit 3c3dd56f760da056e821ac177e3ad0de4209a435 ]
In case of the I2C client exposes the flag I2C_CLIENT_HOST_NOTIFY, pm_runtime_get_sync is called in order to always keep active the adapter. However later on, pm_runtime_put_sync is never called within the function in case of an error. This commit add this error handling.
--- drivers/i2c/i2c-core-base.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/i2c/i2c-core-base.c +16 -6
@@ -338,8 +338,10 @@ static int i2c_device_probe(struct device *dev) }else if (ACPI_COMPANION (dev)) { irq =i2c_acpi_get_irq (client); } -if (irq == -EPROBE_DEFER ) -return irq; +if (irq == -EPROBE_DEFER ) { + status = irq; + goto put_sync_adapter; + }if (irq <0 ) irq =0 ;
@@ -353,15 +355,19 @@ static int i2c_device_probe(struct device *dev)*/ if (!driver->id_table && !i2c_acpi_match_device (dev->driver->acpi_match_table, client) && - !i2c_of_match_device (dev->driver->of_match_table, client)) -return -ENODEV ; + !i2c_of_match_device (dev->driver->of_match_table, client)) { + status = -ENODEV ; + goto put_sync_adapter; + }if (client->flags &I2C_CLIENT_WAKE ) {int wakeirq; wakeirq =of_irq_get_byname (dev->of_node,"wakeup" ); -if (wakeirq == -EPROBE_DEFER ) -return wakeirq; +if (wakeirq == -EPROBE_DEFER ) { + status = wakeirq; + goto put_sync_adapter; + }device_init_wakeup (&client->dev, true);
@@ -408,6 +414,10 @@ static int i2c_device_probe(struct device *dev) err_clear_wakeup_irq:dev_pm_clear_wake_irq (&client->dev);device_init_wakeup (&client->dev, false); +put_sync_adapter: +if (client->flags &I2C_CLIENT_HOST_NOTIFY ) +pm_runtime_put_sync (&client->adapter->dev); +return status; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 93/606 iommu/amd: Fix over-read of ACPI UID from IVRS table
In reply to Sasha LevinFrom: Alexander Monakov <[email protected]>
[ Upstream commit e461b8c991b9202b007ea2059d953e264240b0c9 ]
IVRS parsing code always tries to read 255 bytes from memory when retrieving ACPI device path, and makes an assumption that firmware provides a zero-terminated string. Both of those are bugs: the entry is likely to be shorter than 255 bytes, and zero-termination is not guaranteed.
With Acer SF314-42 firmware these issues manifest visibly in dmesg:
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR0\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR1\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR2\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR3>\x83e\x8d\x9a\xd1...
The first three lines show how the code over-reads adjacent table entries into the UID, and in the last line it even reads garbage data beyond the end of the IVRS table itself.
Since each entry has the length of the UID (uidl member of ivhd_entry struct), use that for memcpy, and manually add a zero terminator.
Avoid zero-filling hid and uid arrays up front, and instead ensure the uid array is always zero-terminated. No change needed for the hid array, as it was already properly zero-terminated.
--- drivers/iommu/amd_iommu_init.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/iommu/amd_iommu_init.c +5 -4
@@ -1329,8 +1329,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, }case IVHD_DEV_ACPI_HID : {u16 devid; -u8 hid[ACPIHID_HID_LEN ] = {0 }; -u8 uid[ACPIHID_UID_LEN ] = {0 }; +u8 hid[ACPIHID_HID_LEN ]; +u8 uid[ACPIHID_UID_LEN ];int ret;if (h->type !=0x40 ) {
@@ -1347,6 +1347,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,break ; } + uid[0 ] ='\0' ;switch (e->uidf) {case UID_NOT_PRESENT :
@@ -1361,8 +1362,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,break ;case UID_IS_CHARACTER : -memcpy (uid, (u8 *)(&e->uid),ACPIHID_UID_LEN -1 ); - uid[ACPIHID_UID_LEN -1 ] ='\0' ; +memcpy (uid, &e->uid, e->uidl); + uid[e->uidl] ='\0' ;break ;default :
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 94/606 iommu/amd: Fix get_acpihid_device_id()
In reply to Sasha LevinFrom: Raul E Rangel <[email protected]>
[ Upstream commit ea90228c7b2ae6646bb6381385229aabb6f14cd2 ]
acpi_dev_hid_uid_match() expects a null pointer for UID if it doesn't exist. The acpihid_map_entry contains a char buffer for holding the UID. If no UID was provided in the IVRS table, this buffer will be zeroed. If we pass in a null string, acpi_dev_hid_uid_match() will return false because it will try and match an empty string to the ACPI UID of the device.
--- drivers/iommu/amd_iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +2 -1
@@ -127,7 +127,8 @@ static inline int get_acpihid_device_id(struct device *dev,return -ENODEV ;list_for_each_entry (p, &acpihid_map, list) { -if (acpi_dev_hid_uid_match (adev, p->hid, p->uid)) { +if (acpi_dev_hid_uid_match (adev, p->hid, + p->uid[0 ] ? p->uid :NULL )) {if (entry) *entry = p;return p->devid;
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 95/606 evm: Fix a small race in init_desc()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 8433856947217ebb5697a8ff9c4c9cad4639a2cf ]
The IS_ERR_OR_NULL() function has two conditions and if we got really unlucky we could hit a race where "ptr" started as an error pointer and then was set to NULL. Both conditions would be false even though the pointer at the end was NULL.
This patch fixes the problem by ensuring that "*tfm" can only be NULL or valid. I have introduced a "tmp_tfm" variable to make that work. I also reversed a condition and pulled the code in one tab.
--- security/integrity/evm/evm_crypto.c | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-)
security/integrity/evm/evm_crypto.c +22 -22
@@ -75,7 +75,7 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo) {long rc;const char *algo; -struct crypto_shash **tfm; +struct crypto_shash **tfm, *tmp_tfm;struct shash_desc *desc;if (type ==EVM_XATTR_HMAC ) {
@@ -93,31 +93,31 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo) algo = hash_algo_name[hash_algo]; } -if (IS_ERR_OR_NULL (*tfm)) { -mutex_lock (&mutex); -if (*tfm) - goto out; - *tfm =crypto_alloc_shash (algo,0 ,CRYPTO_NOLOAD ); -if (IS_ERR (*tfm)) { - rc =PTR_ERR (*tfm); -pr_err ("Can not allocate %s (reason: %ld)\n" , algo, rc); - *tfm =NULL ; +if (*tfm) + goto alloc; +mutex_lock (&mutex); +if (*tfm) + goto unlock; + + tmp_tfm =crypto_alloc_shash (algo,0 ,CRYPTO_NOLOAD ); +if (IS_ERR (tmp_tfm)) { +pr_err ("Can not allocate %s (reason: %ld)\n" , algo, +PTR_ERR (tmp_tfm)); +mutex_unlock (&mutex); +return ERR_CAST (tmp_tfm); + } +if (type ==EVM_XATTR_HMAC ) { + rc =crypto_shash_setkey (tmp_tfm, evmkey, evmkey_len); +if (rc) { +crypto_free_shash (tmp_tfm);mutex_unlock (&mutex);return ERR_PTR (rc); } -if (type ==EVM_XATTR_HMAC ) { - rc =crypto_shash_setkey (*tfm, evmkey, evmkey_len); -if (rc) { -crypto_free_shash (*tfm); - *tfm =NULL ; -mutex_unlock (&mutex); -return ERR_PTR (rc); - } - } -out: -mutex_unlock (&mutex); } - + *tfm = tmp_tfm; +unlock: +mutex_unlock (&mutex); +alloc: desc =kmalloc (sizeof (*desc) +crypto_shash_descsize (*tfm),GFP_KERNEL );if (!desc)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 96/606 i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit e9d1a0a41d4486955e96552293c1fcf1fce61602 ]
A call to 'i2c_demux_deactivate_master()' is missing in the error handling path, as already done in the remove function.
--- drivers/i2c/muxes/i2c-demux-pinctrl.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/muxes/i2c-demux-pinctrl.c +1 -0
@@ -272,6 +272,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err_rollback_available:device_remove_file (&pdev->dev, &dev_attr_available_masters); err_rollback: +i2c_demux_deactivate_master (priv);for (j =0 ; j < i; j++) {of_node_put (priv->chan[j].parent_np);of_changeset_destroy (&priv->chan[j].chgset);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 97/606 ubi: Fix seq_file usage in detailed_erase_block_info debugfs file
In reply to Sasha LevinFrom: Richard Weinberger <[email protected]>
[ Upstream commit 0e7572cffe442290c347e779bf8bd4306bb0aa7c ]
3bfa7e141b0b ("fs/seq_file.c: seq_read(): add info message about buggy .next functions") showed that we don't use seq_file correctly.
So make sure that our ->next function always updates the position.
--- drivers/mtd/ubi/debug.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/mtd/ubi/debug.c +2 -10
@@ -393,9 +393,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos) {struct ubi_device *ubi = s->private; -if (*pos ==0 ) -return SEQ_START_TOKEN ; -if (*pos < ubi->peb_count)return pos;
@@ -409,8 +406,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos) {struct ubi_device *ubi = s->private; -if (v ==SEQ_START_TOKEN ) -return pos; (*pos)++;if (*pos < ubi->peb_count)
@@ -432,11 +427,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter)int err;/* If this is the start, print a header */ -if (iter ==SEQ_START_TOKEN ) { -seq_puts (s, -"physical_block_number\terase_count\tblock_status\tread_status\n" ); -return 0 ; - } +if (*block_number ==0 ) +seq_puts (s,"physical_block_number\terase_count\n" ); err =ubi_io_is_bad (ubi, *block_number);if (err)
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Sasha Levin
maintainerPATCH 98/606 afs: Don't unlock fetched data pages until the op completes successfully
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 9d1be4f4dc5ff1c66c86acfd2c35765d9e3776b3 ]
Don't call req->page_done() on each page as we finish filling it with the data coming from the network. Whilst this might speed up the application a bit, it's a problem if there's a network failure and the operation has to be reissued.
If this happens, an oops occurs because afs_readpages_page_done() clears the pointer to each page it unlocks and when a retry happens, the pointers to the pages it wants to fill are now NULL (and the pages have been unlocked anyway).
Instead, wait till the operation completes successfully and only then release all the pages after clearing any terminal gap (the server can give us less data than we requested as we're allowed to ask for more than is available).
KASAN produces a bug like the following, and even without KASAN, it can oops and panic.
BUG: KASAN: wild-memory-access in _copy_to_iter+0x323/0x5f4
Write of size 1404 at addr 0005088000000000 by task md5sum/5235
CPU: 0 PID: 5235 Comm: md5sum Not tainted 5.7.0-rc3-fscache+ #250
Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
Call Trace:
memcpy+0x39/0x58
_copy_to_iter+0x323/0x5f4
__skb_datagram_iter+0x89/0x2a6
skb_copy_datagram_iter+0x129/0x135
rxrpc_recvmsg_data.isra.0+0x615/0xd42
rxrpc_kernel_recv_data+0x1e9/0x3ae
afs_extract_data+0x139/0x33a
yfs_deliver_fs_fetch_data64+0x47a/0x91b
afs_deliver_to_call+0x304/0x709
afs_wait_for_call_to_complete+0x1cc/0x4ad
yfs_fs_fetch_data+0x279/0x288
afs_fetch_data+0x1e1/0x38d
afs_readpages+0x593/0x72e
read_pages+0xf5/0x21e
__do_page_cache_readahead+0x128/0x23f
ondemand_readahead+0x36e/0x37f
generic_file_buffered_read+0x234/0x680
new_sync_read+0x109/0x17e
vfs_read+0xe6/0x138
ksys_read+0xd8/0x14d
do_syscall_64+0x6e/0x8a
entry_SYSCALL_64_after_hwframe+0x49/0xb3--- fs/afs/fsclient.c | 8 ++++---- fs/afs/yfsclient.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
fs/afs/fsclient.c +4 -4
@@ -385,8 +385,6 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) ASSERTCMP(req->offset, <=, PAGE_SIZE);if (req->offset ==PAGE_SIZE ) { req->offset =0 ; -if (req->page_done) - req->page_done (req); req->index++;if (req->remain >0 ) goto begin_page;
@@ -440,11 +438,13 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)if (req->offset <PAGE_SIZE )zero_user_segment (req->pages[req->index], req->offset,PAGE_SIZE ); -if (req->page_done) - req->page_done (req); req->offset =0 ; } +if (req->page_done) +for (req->index =0 ; req->index < req->nr_pages; req->index++) + req->page_done (req); +_leave (" = 0 [done]" );return 0 ; }
fs/afs/yfsclient.c +4 -4
@@ -497,8 +497,6 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) ASSERTCMP(req->offset, <=, PAGE_SIZE);if (req->offset ==PAGE_SIZE ) { req->offset =0 ; -if (req->page_done) - req->page_done (req); req->index++;if (req->remain >0 ) goto begin_page;
@@ -556,11 +554,13 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)if (req->offset <PAGE_SIZE )zero_user_segment (req->pages[req->index], req->offset,PAGE_SIZE ); -if (req->page_done) - req->page_done (req); req->offset =0 ; } +if (req->page_done) +for (req->index =0 ; req->index < req->nr_pages; req->index++) + req->page_done (req); +_leave (" = 0 [done]" );return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 99/606 mtd: Fix mtd not registered due to nvmem name collision
In reply to Sasha LevinFrom: Ricardo Ribalda Delgado <[email protected]>
[ Upstream commit 7b01b7239d0dc9832e0d0d23605c1ff047422a2c ]
When the nvmem framework is enabled, a nvmem device is created per mtd device/partition.
It is not uncommon that a device can have multiple mtd devices with partitions that have the same name. Eg, when there DT overlay is allowed and the same device with mtd is attached twice.
Under that circumstances, the mtd fails to register due to a name duplication on the nvmem framework.
With this patch we use the mtdX name instead of the partition name, which is unique.
[ 8.948991] sysfs: cannot create duplicate filename '/bus/nvmem/devices/Production Data' [ 8.948992] CPU: 7 PID: 246 Comm: systemd-udevd Not tainted 5.5.0-qtec-standard #13 [ 8.948993] Hardware name: AMD Dibbler/Dibbler, BIOS 05.22.04.0019 10/26/2019 [ 8.948994] Call Trace: [ 8.948996] dump_stack+0x50/0x70 [ 8.948998] sysfs_warn_dup.cold+0x17/0x2d [ 8.949000] sysfs_do_create_link_sd.isra.0+0xc2/0xd0 [ 8.949002] bus_add_device+0x74/0x140 [ 8.949004] device_add+0x34b/0x850 [ 8.949006] nvmem_register.part.0+0x1bf/0x640 ... [ 8.948926] mtd mtd8: Failed to register NVMEM device
--- drivers/mtd/mtdcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/mtdcore.c +1 -1
@@ -551,7 +551,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd) config.id =-1 ; config.dev = &mtd->dev; - config.name = mtd->name; + config.name =dev_name (&mtd->dev); config.owner =THIS_MODULE ; config.reg_read = mtd_nvmem_reg_read; config.size = mtd->size;
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Sasha Levin
maintainerPATCH 100/606 iommu: Fix deferred domain attachment
In reply to Sasha LevinFrom: Joerg Roedel <[email protected]>
[ Upstream commit bd421264ed307dd296eab036851221b225071a32 ]
The IOMMU core code has support for deferring the attachment of a domain to a device. This is needed in kdump kernels where the new domain must not be attached to a device before the device driver takes it over.
When the AMD IOMMU driver got converted to use the dma-iommu implementation, the deferred attaching got lost. The code in dma-iommu.c has support for deferred attaching, but it calls into iommu_attach_device() to actually do it. But iommu_attach_device() will check if the device should be deferred in it code-path and do nothing, breaking deferred attachment.
Move the is_deferred_attach() check out of the attach_device path and into iommu_group_add_device() to make deferred attaching work from the dma-iommu code.
--- drivers/iommu/iommu.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/iommu/iommu.c +11 -6
@@ -692,6 +692,15 @@ static int iommu_group_create_direct_mappings(struct iommu_group *group,return ret; } +static bool iommu_is_attach_deferred (struct iommu_domain *domain, +struct device *dev) +{ +if (domain->ops->is_attach_deferred) +return domain->ops->is_attach_deferred (domain, dev); + +return false; +} +/** * iommu_group_add_device - add a device to an iommu group * @group: the group into which to add the device (reference should be held)
@@ -746,7 +755,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)mutex_lock (&group->mutex);list_add_tail (&device->list, &group->devices); -if (group->domain) +if (group->domain && !iommu_is_attach_deferred (group->domain, dev)) ret =__iommu_attach_device (group->domain, dev);mutex_unlock (&group->mutex);if (ret)
@@ -1652,9 +1661,6 @@ static int __iommu_attach_device(struct iommu_domain *domain, struct device *dev) {int ret; -if ((domain->ops->is_attach_deferred !=NULL ) && - domain->ops->is_attach_deferred (domain, dev)) -return 0 ;if (unlikely (domain->ops->attach_dev ==NULL ))return -ENODEV ;
@@ -1726,8 +1732,7 @@ EXPORT_SYMBOL_GPL(iommu_sva_unbind_gpasid);static void __iommu_detach_device (struct iommu_domain *domain,struct device *dev) { -if ((domain->ops->is_attach_deferred !=NULL ) && - domain->ops->is_attach_deferred (domain, dev)) +if (iommu_is_attach_deferred (domain, dev))return ;if (unlikely (domain->ops->detach_dev ==NULL ))
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 101/606 kbuild: avoid concurrency issue in parallel building dtbs and dtbs_check
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit b5154bf63e5577faaaca1d942df274f7de91dd2a ]
'make dtbs_check' checks the shecma in addition to building *.dtb files, in other words, 'make dtbs_check' is a super-set of 'make dtbs'. So, you do not have to do 'make dtbs dtbs_check', but I want to keep the build system as robust as possible in any use.
Currently, 'dtbs' and 'dtbs_check' are independent of each other. In parallel building, two threads descend into arch/*/boot/dts/, one for dtbs and the other for dtbs_check, then end up with building the same DTB simultaneously.
This commit fixes the concurrency issue. Otherwise, I see build errors like follows:
$ make ARCH=arm64 defconfig $ make -j16 ARCH=arm64 DT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/psci.yaml dtbs dtbs_check <snip> DTC arch/arm64/boot/dts/qcom/sdm845-cheza-r2.dtb DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb DTC arch/arm64/boot/dts/freescale/imx8mn-evk.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb DTC arch/arm64/boot/dts/zte/zx296718-pcbox.dtb DTC arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zc1254-revA.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dtb DTC arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-inx.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb CHECK arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml fixdep: error opening file: arch/arm64/boot/dts/allwinner/.sun50i-h6-orangepi-lite2.dtb.d: No such file or directory make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb] Error 2 make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb' make[2]: *** Waiting for unfinished jobs.... DTC arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-kd.dtb DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p231.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zc1275-revA.dtb DTC arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dtb fixdep: parse error; no targets found make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb] Error 1 make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb' make[1]: *** [scripts/Makefile.build:505: arch/arm64/boot/dts/allwinner] Error 2 make[1]: *** Waiting for unfinished jobs.... DTC arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb
--- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Makefile +6 -2
@@ -1248,11 +1248,15 @@ ifneq ($(dtstree),) $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ PHONY += dtbs dtbs_install dtbs_check -dtbs dtbs_check: include/config/kernel.release scripts_dtc +dtbs: include/config/kernel.release scripts_dtc $(Q)$(MAKE) $(build)=$(dtstree) +ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) +dtbs: dt_binding_check +endif + dtbs_check: export CHECK_DTBS=1 -dtbs_check: dt_binding_check +dtbs_check: dtbs dtbs_install: $(Q)$(MAKE) $(dtbinst)=$(dtstree)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 102/606 net: drop_monitor: use IS_REACHABLE() to guard net_dm_hw_report()
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 1cd9b3abf5332102d4d967555e7ed861a75094bf ]
In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.
The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR from being 'm' when NET_DEVLINK=y.
With the planned Kconfig change that relaxes the 'imply', the combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed.
Use IS_REACHABLE() to avoid the vmlinux link error for this case.
--- include/net/drop_monitor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/drop_monitor.h +1 -1
@@ -19,7 +19,7 @@ struct net_dm_hw_metadata {struct net_device *input_dev; }; -#if IS_ENABLED (CONFIG_NET_DROP_MONITOR ) +#if IS_REACHABLE (CONFIG_NET_DROP_MONITOR )void net_dm_hw_report (struct sk_buff *skb,const struct net_dm_hw_metadata *hw_metadata);#else
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 103/606 gcc-common.h: Update for GCC 10
In reply to Sasha LevinFrom: Frédéric Pierret (fepitre) <[email protected]>
[ Upstream commit c7527373fe28f97d8a196ab562db5589be0d34b9 ]
Remove "params.h" include, which has been dropped in GCC 10.
Remove is_a_helper() macro, which is now defined in gimple.h, as seen when running './scripts/gcc-plugin.sh g++ g++ gcc':
In file included from <stdin>:1:./gcc-plugins/gcc-common.h:852:13: error: redefinition of ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’
852 | inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./gcc-plugins/gcc-common.h:125,
from <stdin>:1:
/usr/lib/gcc/x86_64-redhat-linux/10/plugin/include/gimple.h:1037:1: note: ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’ previously declared here
1037 | is_a_helper <const ggoto *>::test (const gimple *gs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~Add -Wno-format-diag to scripts/gcc-plugins/Makefile to avoid meaningless warnings from error() formats used by plugins:
scripts/gcc-plugins/structleak_plugin.c: In function ‘int plugin_init(plugin_name_args*, plugin_gcc_version*)’:scripts/gcc-plugins/structleak_plugin.c:253:12: warning: unquoted sequence of 2 consecutive punctuation characters ‘'-’ in format [-Wformat-diag]
253 | error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- scripts/gcc-plugins/Makefile | 1 + scripts/gcc-plugins/gcc-common.h | 4 ++++ 2 files changed, 5 insertions(+)
scripts/gcc-plugins/Makefile +1 -0
@@ -11,6 +11,7 @@ else HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable + HOST_EXTRACXXFLAGS += -Wno-format-diag export HOST_EXTRACXXFLAGS endif
scripts/gcc-plugins/gcc-common.h +4 -0
@@ -35,7 +35,9 @@#include "ggc.h" #include "timevar.h" +#if BUILDING_GCC_VERSION <10000 #include "params.h" +#endif #if BUILDING_GCC_VERSION <=4009 #include "pointer-set.h"
@@ -847,6 +849,7 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT); } +#if BUILDING_GCC_VERSION <10000 template <> template <> inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
@@ -860,6 +863,7 @@ inline bool is_a_helper<const greturn *>::test(const_gimple gs) {return gs->code ==GIMPLE_RETURN ; } +#endif static inline gasm *as_a_gasm (gimple stmt) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 104/606 HID: multitouch: add eGalaxTouch P80H84 support
In reply to Sasha LevinFrom: Sebastian Reichel <[email protected]>
[ Upstream commit f9e82295eec141a0569649d400d249333d74aa91 ]
Add support for P80H84 touchscreen from eGalaxy:
idVendor 0x0eef D-WAV Scientific Co., Ltd
idProduct 0xc002
iManufacturer 1 eGalax Inc.
iProduct 2 eGalaxTouch P80H84 2019 vDIVA_1204_T01 k4.02.146
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -385,6 +385,7 @@#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002 0xc002#define USB_VENDOR_ID_ELAN 0x04f3#define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401
drivers/hid/hid-multitouch.c +3 -0
@@ -1922,6 +1922,9 @@ static const struct hid_device_id mt_devices[] = { { .driver_data = MT_CLS_EGALAX_SERIAL,MT_USB_DEVICE (USB_VENDOR_ID_DWAV , USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, + { .driver_data = MT_CLS_EGALAX, +MT_USB_DEVICE (USB_VENDOR_ID_DWAV , + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002) }, /* Elitegroup panel */ { .driver_data = MT_CLS_SERIAL,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 105/606 HID: logitech: Add support for Logitech G11 extra keys
In reply to Sasha LevinFrom: Fabian Schindlatz <[email protected]>
[ Upstream commit b1bd0f75288f60e8d142a1b3e979ed0192c04931 ]
The Logitech G11 keyboard is a cheap variant of the G15 without the LCD screen. It uses the same layout for its extra and macro keys (G1 - G18, M1-M3, MR) and - from the input subsystem's perspective - behaves just like the G15, so we can treat it as such.
Tested it with my own keyboard.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-lg-g15.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -756,6 +756,7 @@#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219#define USB_DEVICE_ID_LOGITECH_G15_LCD 0xc222 +#define USB_DEVICE_ID_LOGITECH_G11 0xc225#define USB_DEVICE_ID_LOGITECH_G15_V2_LCD 0xc227#define USB_DEVICE_ID_LOGITECH_G510 0xc22d#define USB_DEVICE_ID_LOGITECH_G510_USB_AUDIO 0xc22e
drivers/hid/hid-lg-g15.c +4 -0
@@ -872,6 +872,10 @@ static int lg_g15_probe(struct hid_device *hdev, const struct hid_device_id *id) }static const struct hid_device_id lg_g15_devices[] = { +/* The G11 is a G15 without the LCD, treat it as a G15 */ + {HID_USB_DEVICE (USB_VENDOR_ID_LOGITECH , +USB_DEVICE_ID_LOGITECH_G11 ), + .driver_data =LG_G15 }, {HID_USB_DEVICE (USB_VENDOR_ID_LOGITECH ,USB_DEVICE_ID_LOGITECH_G15_LCD ), .driver_data =LG_G15 },
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 106/606 HID: alps: Add AUI1657 device ID
In reply to Sasha LevinFrom: Artem Borisov <[email protected]>
[ Upstream commit 640e403b1fd24e7f31ac6f29f0b6a21d285ed729 ]
This device is used on Lenovo V130-15IKB variants and uses the same registers as U1.
--- drivers/hid/hid-alps.c | 1 + drivers/hid/hid-ids.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-alps.c +1 -0
@@ -802,6 +802,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id)break ;case HID_DEVICE_ID_ALPS_U1_DUAL :case HID_DEVICE_ID_ALPS_U1 : +case HID_DEVICE_ID_ALPS_1657 : data->dev_type =U1 ;break ;default :
drivers/hid/hid-ids.h +1 -1
@@ -81,7 +81,7 @@#define HID_DEVICE_ID_ALPS_U1 0x1215#define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C#define HID_DEVICE_ID_ALPS_1222 0x1222 - +#define HID_DEVICE_ID_ALPS_1657 0x121E#define USB_VENDOR_ID_AMI 0x046b#define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 107/606 HID: alps: ALPS_1657 is too specific; use U1_UNICORN_LEGACY instead
In reply to Sasha LevinFrom: Jiri Kosina <[email protected]>
[ Upstream commit 185af3e775b693f773d9a4b5a8c3cda69fc8ca0f ]
HID_DEVICE_ID_ALPS_1657 PID is too specific, as there are many other ALPS hardware IDs using this particular touchpad.
Rename the identifier to HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY in order to describe reality better.
--- drivers/hid/hid-alps.c | 2 +- drivers/hid/hid-ids.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-alps.c +1 -1
@@ -802,7 +802,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id)break ;case HID_DEVICE_ID_ALPS_U1_DUAL :case HID_DEVICE_ID_ALPS_U1 : -case HID_DEVICE_ID_ALPS_1657 : +case HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY : data->dev_type =U1 ;break ;default :
drivers/hid/hid-ids.h +1 -1
@@ -79,9 +79,9 @@#define HID_DEVICE_ID_ALPS_U1_DUAL_PTP 0x121F#define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220#define HID_DEVICE_ID_ALPS_U1 0x1215 +#define HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY 0x121E#define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C#define HID_DEVICE_ID_ALPS_1222 0x1222 -#define HID_DEVICE_ID_ALPS_1657 0x121E#define USB_VENDOR_ID_AMI 0x046b#define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 108/606 scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV
In reply to Sasha LevinFrom: Arun Easi <[email protected]>
[ Upstream commit 45a76264c26fd8cfd0c9746196892d9b7e2657ee ]
In NPIV environment, a NPIV host may use a queue pair created by base host or other NPIVs, so the check for a queue pair created by this NPIV is not correct, and can cause an abort to fail, which in turn means the NVME command not returned. This leads to hang in nvme_fc layer in nvme_fc_delete_association() which waits for all I/Os to be returned, which is seen as hang in the application.
--- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mbx.c +1 -1
@@ -3117,7 +3117,7 @@ qla24xx_abort_command(srb_t *sp)ql_dbg (ql_dbg_mbx + ql_dbg_verbose, vha,0x108c ,"Entered %s.\n" , __func__); -if (vha->flags.qpairs_available && sp->qpair) +if (sp->qpair) req = sp->qpair->req;else return QLA_FUNCTION_FAILED ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 109/606 scsi: qla2xxx: Delete all sessions before unregister local nvme port
In reply to Sasha LevinFrom: Quinn Tran <[email protected]>
[ Upstream commit c48f849d3f7a4ec1025105f446e29d395c4dcc2f ]
Delete all sessions before unregistering local nvme port. This allows nvme layer to decrement all active rport count down to zero. Once the count is down to zero, nvme would call qla to continue with the npiv port deletion.
PID: 27448 TASK: ffff9e34b777c1c0 CPU: 0 COMMAND: "qaucli"
0 [ffff9e25e84abbd8] __schedule at ffffffff977858ca
1 [ffff9e25e84abc68] schedule at ffffffff97785d79
2 [ffff9e25e84abc78] schedule_timeout at ffffffff97783881
3 [ffff9e25e84abd28] wait_for_completion at ffffffff9778612d
4 [ffff9e25e84abd88] qla_nvme_delete at ffffffffc0e3024e [qla2xxx]
5 [ffff9e25e84abda8] qla24xx_vport_delete at ffffffffc0e024b9 [qla2xxx]
6 [ffff9e25e84abdf0] fc_vport_terminate at ffffffffc011c247 [scsi_transport_fc] 7 [ffff9e25e84abe28] store_fc_host_vport_delete at ffffffffc011cd94 [scsi_transport_fc] 8 [ffff9e25e84abe70] dev_attr_store at ffffffff974b376b
9 [ffff9e25e84abe80] sysfs_kf_write at ffffffff972d9a92
10 [ffff9e25e84abe90] kernfs_fop_write at ffffffff972d907b
11 [ffff9e25e84abec8] vfs_write at ffffffff9724c790
12 [ffff9e25e84abf08] sys_write at ffffffff9724d55f
13 [ffff9e25e84abf50] system_call_fastpath at ffffffff97792ed2
RIP: 00007fc0bd81a6fd RSP: 00007ffff78d9648 RFLAGS: 00010202
RAX: 0000000000000001 RBX: 0000000000000022 RCX: 00007ffff78d96e0
RDX: 0000000000000022 RSI: 00007ffff78d94e0 RDI: 0000000000000008
RBP: 00007ffff78d9440 R8: 0000000000000000 R9: 00007fc0bd48b2cd
R10: 0000000000000017 R11: 0000000000000293 R12: 0000000000000000
R13: 00005624e4dac840 R14: 00005624e4da9a10 R15: 0000000000000000
ORIG_RAX: 0000000000000001 CS: 0033 SS: 002b--- drivers/scsi/qla2xxx/qla_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_attr.c +1 -1
@@ -2928,11 +2928,11 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))msleep (1000 ); -qla_nvme_delete (vha);qla24xx_disable_vp (vha);qla2x00_wait_for_sess_deletion (vha); +qla_nvme_delete (vha); vha->flags.delete_progress =1 ;qlt_remove_target (ha, vha);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 110/606 configfs: fix config_item refcnt leak in configfs_rmdir()
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
[ Upstream commit 8aebfffacfa379ba400da573a5bf9e49634e38cb ]
configfs_rmdir() invokes configfs_get_config_item(), which returns a reference of the specified config_item object to "parent_item" with increased refcnt.
When configfs_rmdir() returns, local variable "parent_item" becomes invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one exception handling path of configfs_rmdir(). When down_write_killable() fails, the function forgets to decrease the refcnt increased by configfs_get_config_item(), causing a refcnt leak.
Fix this issue by calling config_item_put() when down_write_killable() fails.
--- fs/configfs/dir.c | 1 + 1 file changed, 1 insertion(+)
fs/configfs/dir.c +1 -0
@@ -1519,6 +1519,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)spin_lock (&configfs_dirent_lock);configfs_detach_rollback (dentry);spin_unlock (&configfs_dirent_lock); +config_item_put (parent_item);return -EINTR ; } frag->frag_dead = true;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 111/606 vhost/vsock: fix packet delivery order to monitoring devices
In reply to Sasha LevinFrom: Stefano Garzarella <[email protected]>
[ Upstream commit 107bc0766b9feb5113074c753735a3f115c2141f ]
We want to deliver packets to monitoring devices before it is put in the virtqueue, to avoid that replies can appear in the packet capture before the transmitted packet.
--- drivers/vhost/vsock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/vhost/vsock.c +5 -5
@@ -181,14 +181,14 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,break ; } -vhost_add_used (vq, head,sizeof (pkt->hdr) + payload_len); - added = true; - -/* Deliver to monitoring devices all correctly transmitted -* packets. +/* Deliver to monitoring devices all packets that we +* will transmit. */ virtio_transport_deliver_tap_pkt (pkt); +vhost_add_used (vq, head,sizeof (pkt->hdr) + payload_len); + added = true; + pkt->off += payload_len; total_len += payload_len;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 112/606 aquantia: Fix the media type of AQC100 ethernet controller in the driver
In reply to Sasha LevinFrom: Richard Clark <[email protected]>
[ Upstream commit 6de556c31061e3b9c36546ffaaac5fdb679a2f14 ]
The Aquantia AQC100 controller enables a SFP+ port, so the driver should configure the media type as '_TYPE_FIBRE' instead of '_TYPE_TP'.
--- drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +1 -1
@@ -56,7 +56,7 @@ static const struct aq_board_revision_s hw_atl_boards[] = { { AQ_DEVICE_ID_D108, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc108, }, { AQ_DEVICE_ID_D109, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc109, }, - { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, }, + { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc100, }, { AQ_DEVICE_ID_AQC107, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, }, { AQ_DEVICE_ID_AQC108, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc108, }, { AQ_DEVICE_ID_AQC109, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc109, },
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 113/606 component: Silence bind error on -EPROBE_DEFER
In reply to Sasha LevinFrom: James Hilliard <[email protected]>
[ Upstream commit 7706b0a76a9697021e2bf395f3f065c18f51043d ]
If a component fails to bind due to -EPROBE_DEFER we should not log an error as this is not a real failure.
Fixes messages like:
vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517 vc4-drm soc:gpu: master bind failed: -517
--- drivers/base/component.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/base/component.c +5 -3
@@ -256,7 +256,8 @@ static int try_to_bring_up_master(struct master *master, ret = master->ops->bind (master->dev);if (ret <0 ) {devres_release_group (master->dev,NULL ); -dev_info (master->dev,"master bind failed: %d\n" , ret); +if (ret != -EPROBE_DEFER ) +dev_info (master->dev,"master bind failed: %d\n" , ret);return ret; }
@@ -610,8 +611,9 @@ static int component_bind(struct component *component, struct master *master,devres_release_group (component->dev,NULL );devres_release_group (master->dev,NULL ); -dev_err (master->dev,"failed to bind %s (ops %ps): %d\n" , -dev_name (component->dev), component->ops, ret); +if (ret != -EPROBE_DEFER ) +dev_err (master->dev,"failed to bind %s (ops %ps): %d\n" , +dev_name (component->dev), component->ops, ret); }return ret;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 114/606 net/ena: Fix build warning in ena_xdp_set()
In reply to Sasha LevinFrom: Gavin Shan <[email protected]>
[ Upstream commit caec66198d137c26f0d234abc498866a58c64150 ]
This fixes the following build warning in ena_xdp_set(), which is observed on aarch64 with 64KB page size.
In file included from ./include/net/inet_sock.h:19,
from ./include/net/ip.h:27,
from drivers/net/ethernet/amazon/ena/ena_netdev.c:46:
drivers/net/ethernet/amazon/ena/ena_netdev.c: In function \
‘ena_xdp_set’: \
drivers/net/ethernet/amazon/ena/ena_netdev.c:557:6: warning: \
format ‘%lu’ \
expects argument of type ‘long unsigned int’, but argument 4 \
has type ‘int’ \
[-Wformat=] "Failed to set xdp program, the current MTU (%d) is \
larger than the maximum allowed MTU (%lu) while xdp is on",--- drivers/net/ethernet/amazon/ena/ena_netdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_netdev.h +1 -1
@@ -69,7 +69,7 @@* 16kB. */ #if PAGE_SIZE >SZ_16K -#define ENA_PAGE_SIZE SZ_16K +#define ENA_PAGE_SIZE (_AC(SZ_16K, UL))#else #define ENA_PAGE_SIZE PAGE_SIZE#endif
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 115/606 scsi: ibmvscsi: Fix WARN_ON during event pool release
In reply to Sasha LevinFrom: Tyrel Datwyler <[email protected]>
[ Upstream commit b36522150e5b85045f868768d46fbaaa034174b2 ]
While removing an ibmvscsi client adapter a WARN_ON like the following is seen in the kernel log:
drmgr: drmgr: -r -c slot -s U9080.M9S.783AEC8-V11-C11 -w 5 -d 1
WARNING: CPU: 9 PID: 24062 at ../kernel/dma/mapping.c:311 dma_free_attrs+0x78/0x110 Supported: No, Unreleased kernel CPU: 9 PID: 24062 Comm: drmgr Kdump: loaded Tainted: G X 5.3.18-12-default NIP: c0000000001fa758 LR: c0000000001fa744 CTR: c0000000001fa6e0 REGS: c0000002173375d0 TRAP: 0700 Tainted: G X (5.3.18-12-default) MSR: 8000000000029033 <SF,EE,ME,IR,DR,RI,LE> CR: 28088282 XER: 20000000
CFAR: c0000000001fbf0c IRQMASK: 1
GPR00: c0000000001fa744 c000000217337860 c00000000161ab00 0000000000000000
GPR04: 0000000000000000 c000011e12250000 0000000018010000 0000000000000000
GPR08: 0000000000000000 0000000000000001 0000000000000001 c0080000190f4fa8
GPR12: c0000000001fa6e0 c000000007fc2a00 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR24: 000000011420e310 0000000000000000 0000000000000000 0000000018010000
GPR28: c00000000159de50 c000011e12250000 0000000000006600 c000011e5c994848 NIP [c0000000001fa758] dma_free_attrs+0x78/0x110
LR [c0000000001fa744] dma_free_attrs+0x64/0x110
Call Trace:
[c000000217337860] [000000011420e310] 0x11420e310 (unreliable) [c0000002173378b0] [c0080000190f0280] release_event_pool+0xd8/0x120 [ibmvscsi] [c000000217337930] [c0080000190f3f74] ibmvscsi_remove+0x6c/0x160 [ibmvscsi] [c000000217337960] [c0000000000f3cac] vio_bus_remove+0x5c/0x100 [c0000002173379a0] [c00000000087a0a4] device_release_driver_internal+0x154/0x280 [c0000002173379e0] [c0000000008777cc] bus_remove_device+0x11c/0x220 [c000000217337a60] [c000000000870fc4] device_del+0x1c4/0x470 [c000000217337b10] [c0000000008712a0] device_unregister+0x30/0xa0 [c000000217337b80] [c0000000000f39ec] vio_unregister_device+0x2c/0x60 [c000000217337bb0] [c00800001a1d0964] dlpar_remove_slot+0x14c/0x250 [rpadlpar_io] [c000000217337c50] [c00800001a1d0bcc] remove_slot_store+0xa4/0x110 [rpadlpar_io] [c000000217337cd0] [c000000000c091a0] kobj_attr_store+0x30/0x50 [c000000217337cf0] [c00000000057c934] sysfs_kf_write+0x64/0x90 [c000000217337d10] [c00000000057be10] kernfs_fop_write+0x1b0/0x290 [c000000217337d60] [c000000000488c4c] __vfs_write+0x3c/0x70 [c000000217337d80] [c00000000048c648] vfs_write+0xd8/0x260 [c000000217337dd0] [c00000000048ca8c] ksys_write+0xdc/0x130 [c000000217337e20] [c00000000000b488] system_call+0x5c/0x70 Instruction dump:7c840074 f8010010 f821ffb1 20840040 eb830218 7c8407b4 48002019 60000000 2fa30000 409e003c 892d0988 792907e0 <0b090000> 2fbd0000 419e0028 2fbc0000
---[ end trace 5955b3c0cc079942 ]---
rpadlpar_io: slot U9080.M9S.783AEC8-V11-C11 removed
This is tripped as a result of irqs being disabled during the call to dma_free_coherent() by release_event_pool(). At this point in the code path we have quiesced the adapter and it is overly paranoid to be holding the host lock.
[mkp: fixed build warning reported by sfr]
--- drivers/scsi/ibmvscsi/ibmvscsi.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/ibmvscsi/ibmvscsi.c +0 -4
@@ -2320,16 +2320,12 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)static int ibmvscsi_remove (struct vio_dev *vdev) {struct ibmvscsi_host_data *hostdata =dev_get_drvdata (&vdev->dev); -unsigned long flags;srp_remove_host (hostdata->host);scsi_remove_host (hostdata->host);purge_requests (hostdata,DID_ERROR ); - -spin_lock_irqsave (hostdata->host->host_lock, flags);release_event_pool (&hostdata->pool, hostdata); -spin_unlock_irqrestore (hostdata->host->host_lock, flags);ibmvscsi_release_crq_queue (&hostdata->queue, hostdata, max_events);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 116/606 HID: i2c-hid: reset Synaptics SYNA2393 on resume
In reply to Sasha LevinFrom: Daniel Playfair Cal <[email protected]>
[ Upstream commit 538f67407e2c0e5ed2a46e7d7ffa52f2e30c7ef8 ]
On the Dell XPS 9570, the Synaptics SYNA2393 touchpad generates spurious interrupts after resuming from suspend until it receives some input or is reset. Add it to the quirk I2C_HID_QUIRK_RESET_ON_RESUME so that it is reset when resuming from suspend.
More information about the bug can be found in this mailing list
discussion: https://www.spinics.net/lists/linux-input/msg59530.html
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/i2c-hid/i2c-hid-core.c | 2 ++ 2 files changed, 5 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -1094,6 +1094,9 @@#define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300#define USB_DEVICE_ID_SYMBOL_SCANNER_3 0x1200 +#define I2C_VENDOR_ID_SYNAPTICS 0x06cb +#define I2C_PRODUCT_ID_SYNAPTICS_SYNA2393 0x7a13 +#define USB_VENDOR_ID_SYNAPTICS 0x06cb#define USB_DEVICE_ID_SYNAPTICS_TP 0x0001#define USB_DEVICE_ID_SYNAPTICS_INT_TP 0x0002
drivers/hid/i2c-hid/i2c-hid-core.c +2 -0
@@ -177,6 +177,8 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_BOGUS_IRQ }, {USB_VENDOR_ID_ALPS_JP ,HID_ANY_ID , I2C_HID_QUIRK_RESET_ON_RESUME }, + { I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393, + I2C_HID_QUIRK_RESET_ON_RESUME }, { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720, I2C_HID_QUIRK_BAD_INPUT_SIZE }, { 0, 0 }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 117/606 ibmvnic: Skip fatal error reset after passive init
In reply to Sasha LevinFrom: Juliet Kim <[email protected]>
[ Upstream commit f9c6cea0b38518741c8dcf26ac056d26ee2fd61d ]
During MTU change, the following events may happen. Client-driven CRQ initialization fails due to partner’s CRQ closed, causing client to enqueue a reset task for FATAL_ERROR. Then passive (server-driven) CRQ initialization succeeds, causing client to release CRQ and enqueue a reset task for failover. If the passive CRQ initialization occurs before the FATAL reset task is processed, the FATAL error reset task would try to access a CRQ message queue that was freed, causing an oops. The problem may be most likely to occur during DLPAR add vNIC with a non-default MTU, because the DLPAR process will automatically issue a change MTU request.
Fix this by not processing fatal error reset if CRQ is passively initialized after client-driven CRQ initialization fails.
--- drivers/net/ethernet/ibm/ibmvnic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmvnic.c +2 -1
@@ -2189,7 +2189,8 @@ static void __ibmvnic_reset(struct work_struct *work) rc =do_hard_reset (adapter, rwi, reset_state);rtnl_unlock (); } - }else { + }else if (!(rwi->reset_reason ==VNIC_RESET_FATAL && + adapter->from_passive_init)) { rc =do_reset (adapter, rwi, reset_state); }kfree (rwi);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 118/606 ftrace/selftest: make unresolved cases cause failure if --fail-unresolved set
In reply to Sasha LevinFrom: Alan Maguire <[email protected]>
[ Upstream commit b730d668138cb3dd9ce78f8003986d1adae5523a ]
Currently, ftracetest will return 1 (failure) if any unresolved cases are encountered. The unresolved status results from modules and programs not being available, and as such does not indicate any issues with ftrace itself. As such, change the behaviour of ftracetest in line with unsupported cases; if unsupported cases happen, ftracetest still returns 0 unless --fail-unsupported. Here --fail-unresolved is added and the default is to return 0 if unresolved results occur.
--- tools/testing/selftests/ftrace/ftracetest | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/testing/selftests/ftrace/ftracetest +7 -1
@@ -17,6 +17,7 @@ echo " -v|--verbose Increase verbosity of test messages" echo " -vv Alias of -v -v (Show all results in stdout)" echo " -vvv Alias of -v -v -v (Show all commands immediately)" echo " --fail-unsupported Treat UNSUPPORTED as a failure" +echo " --fail-unresolved Treat UNRESOLVED as a failure" echo " -d|--debug Debug mode (trace all shell commands)" echo " -l|--logdir <dir> Save logs on the <dir>" echo " If <dir> is -, all logs output in console only"
@@ -112,6 +113,10 @@ parse_opts() { # opts UNSUPPORTED_RESULT=1 shift 1 ;; + --fail-unresolved) + UNRESOLVED_RESULT=1 + shift 1 + ;; --logdir|-l) LOG_DIR=$2 shift 2
@@ -176,6 +181,7 @@ KEEP_LOG=0 DEBUG=0 VERBOSE=0 UNSUPPORTED_RESULT=0 +UNRESOLVED_RESULT=0 STOP_FAILURE=0 # Parse command-line options parse_opts $*
@@ -280,7 +286,7 @@ eval_result() { # sigval $UNRESOLVED) prlog " [${color_blue}UNRESOLVED${color_reset}]" UNRESOLVED_CASES="$UNRESOLVED_CASES $CASENO" - return 1 # this is a kind of bug.. something happened. + return $UNRESOLVED_RESULT # depends on use case ;; $UNTESTED) prlog " [${color_blue}UNTESTED${color_reset}]"
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 119/606 selftests: fix kvm relocatable native/cross builds and installs
In reply to Sasha LevinFrom: Shuah Khan <[email protected]>
[ Upstream commit 66d69e081b526b6a6031f0d3ca8ddff71e5707a5 ]
kvm test Makefile doesn't fully support cross-builds and installs. UNAME_M = $(shell uname -m) variable is used to define the target programs and libraries to be built from arch specific sources in sub-directories.
For cross-builds to work, UNAME_M has to map to ARCH and arch specific directories and targets in this Makefile.
UNAME_M variable to used to run the compiles pointing to the right arch directories and build the right targets for these supported architectures.
TEST_GEN_PROGS and LIBKVM are set using UNAME_M variable. LINUX_TOOL_ARCH_INCLUDE is set using ARCH variable.
x86_64 targets are named to include x86_64 as a suffix and directories for includes are in x86_64 sub-directory. s390x and aarch64 follow the same convention. "uname -m" doesn't result in the correct mapping for s390x and aarch64. Fix it to set UNAME_M correctly for s390x and aarch64 cross-builds.
In addition, Makefile doesn't create arch sub-directories in the case of relocatable builds and test programs under s390x and x86_64 directories fail to build. This is a problem for native and cross-builds. Fix it to create all necessary directories keying off of TEST_GEN_PROGS.
The following use-cases work with this change:
Native x86_64:
make O=/tmp/kselftest -C tools/testing/selftests TARGETS=kvm install \
INSTALL_PATH=$HOME/x86_64
arm64 cross-build:
make O=$HOME/arm64_build/ ARCH=arm64 HOSTCC=gcc \
CROSS_COMPILE=aarch64-linux-gnu- defconfig
make O=$HOME/arm64_build/ ARCH=arm64 HOSTCC=gcc \
CROSS_COMPILE=aarch64-linux-gnu- all
make kselftest-install TARGETS=kvm O=$HOME/arm64_build ARCH=arm64 \
HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu-
s390x cross-build:
make O=$HOME/s390x_build/ ARCH=s390 HOSTCC=gcc \ CROSS_COMPILE=s390x-linux-gnu- defconfig
make O=$HOME/s390x_build/ ARCH=s390 HOSTCC=gcc \ CROSS_COMPILE=s390x-linux-gnu- all
make kselftest-install TARGETS=kvm O=$HOME/s390x_build/ ARCH=s390 \ HOSTCC=gcc CROSS_COMPILE=s390x-linux-gnu- all
No regressions in the following use-cases:
make -C tools/testing/selftests TARGETS=kvm
make kselftest-all TARGETS=kvm
--- tools/testing/selftests/kvm/Makefile | 29 +++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
tools/testing/selftests/kvm/Makefile +28 -1
@@ -5,8 +5,34 @@ all: top_srcdir = ../../../.. KSFT_KHDR_INSTALL := 1 + +# For cross-builds to work, UNAME_M has to map to ARCH and arch specific +# directories and targets in this Makefile. "uname -m" doesn't map to +# arch specific sub-directory names. +# +# UNAME_M variable to used to run the compiles pointing to the right arch +# directories and build the right targets for these supported architectures. +# +# TEST_GEN_PROGS and LIBKVM are set using UNAME_M variable. +# LINUX_TOOL_ARCH_INCLUDE is set using ARCH variable. +# +# x86_64 targets are named to include x86_64 as a suffix and directories +# for includes are in x86_64 sub-directory. s390x and aarch64 follow the +# same convention. "uname -m" doesn't result in the correct mapping for +# s390x and aarch64. +# +# No change necessary for x86_64 UNAME_M := $(shell uname -m) +# Set UNAME_M for arm64 compile/install to work +ifeq ($(ARCH),arm64) + UNAME_M := aarch64 +endif +# Set UNAME_M s390x compile/install to work +ifeq ($(ARCH),s390) + UNAME_M := s390x +endif + LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c LIBKVM_x86_64 = lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c
@@ -47,7 +73,7 @@ LIBKVM += $(LIBKVM_$(UNAME_M)) INSTALL_HDR_PATH = $(top_srcdir)/usr LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include -LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include +LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \ -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
@@ -78,6 +104,7 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) $(AR) crs $@ $^ +x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS)))) all: $(STATIC_LIBS) $(TEST_GEN_PROGS): $(STATIC_LIBS)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 120/606 x86/apic: Move TSC deadline timer debug printk
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit c84cb3735fd53c91101ccdb191f2e3331a9262cb ]
Leon reported that the printk_once() in __setup_APIC_LVTT() triggers a lockdep splat due to a lock order violation between hrtimer_base::lock and console_sem, when the 'once' condition is reset via /sys/kernel/debug/clear_warn_once after boot.
The initial printk cannot trigger this because that happens during boot when the local APIC timer is set up on the boot CPU.
Prevent it by moving the printk to a place which is guaranteed to be only called once during boot.
Mark the deadline timer check related functions and data __init while at it.
--- arch/x86/kernel/apic/apic.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
arch/x86/kernel/apic/apic.c +14 -13
@@ -352,8 +352,6 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)* According to Intel, MFENCE can do the serialization here. */ asmvolatile ("mfence" : : :"memory" ); - -printk_once (KERN_DEBUG "TSC deadline timer enabled\n" );return ; }
@@ -552,7 +550,7 @@ static DEFINE_PER_CPU(struct clock_event_device, lapic_events);#define DEADLINE_MODEL_MATCH_REV (model, rev) \ { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)rev } -static u32 hsx_deadline_rev (void ) +static __init u32 hsx_deadline_rev (void ) {switch (boot_cpu_data.x86_stepping) {case 0x02 :return 0x3a ;/* EP */
@@ -562,7 +560,7 @@ static u32 hsx_deadline_rev(void)return ~0U ; } -static u32 bdx_deadline_rev (void ) +static __init u32 bdx_deadline_rev (void ) {switch (boot_cpu_data.x86_stepping) {case 0x02 :return 0x00000011 ;
@@ -574,7 +572,7 @@ static u32 bdx_deadline_rev(void)return ~0U ; } -static u32 skx_deadline_rev (void ) +static __init u32 skx_deadline_rev (void ) {switch (boot_cpu_data.x86_stepping) {case 0x03 :return 0x01000136 ;
@@ -587,7 +585,7 @@ static u32 skx_deadline_rev(void)return ~0U ; } -static const struct x86_cpu_id deadline_match[] = { +static const struct x86_cpu_id deadline_match[]__initconst = {DEADLINE_MODEL_MATCH_FUNC (INTEL_FAM6_HASWELL_X , hsx_deadline_rev),DEADLINE_MODEL_MATCH_REV (INTEL_FAM6_BROADWELL_X ,0x0b000020 ),DEADLINE_MODEL_MATCH_FUNC (INTEL_FAM6_BROADWELL_D , bdx_deadline_rev),
@@ -609,18 +607,19 @@ static const struct x86_cpu_id deadline_match[] = { {}, }; -static void apic_check_deadline_errata (void ) +static __init bool apic_validate_deadline_timer (void ) {const struct x86_cpu_id *m;u32 rev; -if (!boot_cpu_has (X86_FEATURE_TSC_DEADLINE_TIMER ) || -boot_cpu_has (X86_FEATURE_HYPERVISOR )) -return ; +if (!boot_cpu_has (X86_FEATURE_TSC_DEADLINE_TIMER )) +return false; +if (boot_cpu_has (X86_FEATURE_HYPERVISOR )) +return true; m =x86_match_cpu (deadline_match);if (!m) -return ; +return true;/* * Function pointers will have the MSB set due to address layout,
@@ -632,11 +631,12 @@ static void apic_check_deadline_errata(void) rev = (u32 )m->driver_data;if (boot_cpu_data.microcode >= rev) -return ; +return true;setup_clear_cpu_cap (X86_FEATURE_TSC_DEADLINE_TIMER );pr_err (FW_BUG "TSC_DEADLINE disabled due to Errata; " "please update microcode to version: 0x%x (or later)\n" , rev); +return false; }/*
@@ -2098,7 +2098,8 @@ void __init init_apic_mappings(void) {unsigned int new_apicid; -apic_check_deadline_errata (); +if (apic_validate_deadline_timer ()) +pr_debug ("TSC deadline timer available\n" );if (x2apic_mode) { boot_cpu_physical_apicid =read_apic_id ();
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 121/606 gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp()
In reply to Sasha LevinFrom: Yoshiyuki Kurauchi <[email protected]>
[ Upstream commit 846c68f7f1ac82c797a2f1db3344a2966c0fe2e1 ]
In drivers/net/gtp.c, gtp_genl_dump_pdp() should set NLM_F_MULTI flag since it returns multipart message.
This patch adds a new arg "flags" in gtp_genl_fill_info() so that flags can be set by the callers.
--- drivers/net/gtp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/gtp.c +5 -4
@@ -1169,11 +1169,11 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info)static struct genl_family gtp_genl_family;static int gtp_genl_fill_info (struct sk_buff *skb,u32 snd_portid,u32 snd_seq, -u32 type,struct pdp_ctx *pctx) +int flags,u32 type,struct pdp_ctx *pctx) {void *genlh; - genlh =genlmsg_put (skb, snd_portid, snd_seq, >p_genl_family,0 , + genlh =genlmsg_put (skb, snd_portid, snd_seq, >p_genl_family, flags, type);if (genlh ==NULL ) goto nlmsg_failure;
@@ -1227,8 +1227,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info) goto err_unlock; } - err =gtp_genl_fill_info (skb2,NETLINK_CB (skb).portid, - info->snd_seq, info->nlhdr->nlmsg_type, pctx); + err =gtp_genl_fill_info (skb2,NETLINK_CB (skb).portid, info->snd_seq, +0 , info->nlhdr->nlmsg_type, pctx);if (err <0 ) goto err_unlock_free;
@@ -1271,6 +1271,7 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb,gtp_genl_fill_info (skb,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq, +NLM_F_MULTI , cb->nlh->nlmsg_type, pctx)) { cb->args[0] = i; cb->args[1 ] = j;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 122/606 HID: quirks: Add HID_QUIRK_NO_INIT_REPORTS quirk for Dell K12A keyboard-dock
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 1e189f267015a098bdcb82cc652d13fbf2203fa0 ]
Add a HID_QUIRK_NO_INIT_REPORTS quirk for the Dell K12A keyboard-dock, which can be used with various Dell Venue 11 models.
Without this quirk the keyboard/touchpad combo works fine when connected at boot, but when hotplugged 9 out of 10 times it will not work properly. Adding the quirk fixes this.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -1111,6 +1111,7 @@#define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10#define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3#define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 +#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7
drivers/hid/hid-quirks.c +1 -0
@@ -163,6 +163,7 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K12A), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD), HID_QUIRK_BADPAD }, { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET },
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 123/606 ceph: fix double unlock in handle_cap_export()
In reply to Sasha LevinFrom: Wu Bo <[email protected]>
[ Upstream commit 4d8e28ff3106b093d98bfd2eceb9b430c70a8758 ]
If the ceph_mdsc_open_export_target_session() return fails, it will do a "goto retry", but the session mutex has already been unlocked. Re-lock the mutex in that case to ensure that we don't unlock it twice.
--- fs/ceph/caps.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/caps.c +1 -0
@@ -3707,6 +3707,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,WARN_ON (1 ); tsession =NULL ; target =-1 ; +mutex_lock (&session->s_mutex); } goto retry;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 124/606 stmmac: fix pointer check after utilization in stmmac_interrupt
In reply to Sasha LevinFrom: Maxim Petrov <[email protected]>
[ Upstream commit f42234ffd531ca6b13d9da02faa60b72eccf8334 ]
The paranoidal pointer check in IRQ handler looks very strange - it really protects us only against bogus drivers which request IRQ line with null pointer dev_id. However, the code fragment is incorrect because the dev pointer is used before the actual check which leads to undefined behavior. Remove the check to avoid confusing people with incorrect code.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -6
@@ -3988,7 +3988,7 @@ static int stmmac_set_features(struct net_device *netdev,/** * stmmac_interrupt - main ISR * @irq: interrupt number. -* @dev_id: to pass the net device pointer. +* @dev_id: to pass the net device pointer (must be valid). * Description: this is the main driver interrupt service routine. * It can call: * o DMA service routine (to manage incoming frame reception and transmission
@@ -4012,11 +4012,6 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)if (priv->irq_wake)pm_wakeup_event (priv->device,0 ); -if (unlikely (!dev)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 125/606 USB: core: Fix misleading driver bug report
In reply to Sasha LevinFrom: Alan Stern <[email protected]>
[ Upstream commit ac854131d9844f79e2fdcef67a7707227538d78a ]
The syzbot fuzzer found a race between URB submission to endpoint 0 and device reset. Namely, during the reset we call usb_ep0_reinit() because the characteristics of ep0 may have changed (if the reset follows a firmware update, for example). While usb_ep0_reinit() is running there is a brief period during which the pointers stored in udev->ep_in[0] and udev->ep_out[0] are set to NULL, and if an URB is submitted to ep0 during that period, usb_urb_ep_type_check() will report it as a driver bug. In the absence of those pointers, the routine thinks that the endpoint doesn't exist. The log message looks like this:
------------[ cut here ]------------ usb 2-1: BOGUS urb xfer, pipe 2 != type 2 WARNING: CPU: 0 PID: 9241 at drivers/usb/core/urb.c:478 usb_submit_urb+0x1188/0x1460 drivers/usb/core/urb.c:478
Now, although submitting an URB while the device is being reset is a questionable thing to do, it shouldn't count as a driver bug as severe as submitting an URB for an endpoint that doesn't exist. Indeed, endpoint 0 always exists, even while the device is in its unconfigured state.
To prevent these misleading driver bug reports, this patch updates usb_disable_endpoint() to avoid clearing the ep_in[] and ep_out[] pointers when the endpoint being disabled is ep0. There's no danger of leaving a stale pointer in place, because the usb_host_endpoint structure being pointed to is stored permanently in udev->ep0; it doesn't get deallocated until the entire usb_device structure does.
--- drivers/usb/core/message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/core/message.c +2 -2
@@ -1143,11 +1143,11 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr,if (usb_endpoint_out (epaddr)) { ep = dev->ep_out[epnum]; -if (reset_hardware) +if (reset_hardware && epnum !=0 ) dev->ep_out[epnum] =NULL ; }else { ep = dev->ep_in[epnum]; -if (reset_hardware) +if (reset_hardware && epnum !=0 ) dev->ep_in[epnum] =NULL ; }if (ep) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 126/606 platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 3bd12da7f50b8bc191fcb3bab1f55c582234df59 ]
asus-nb-wmi does not add any extra functionality on these Asus Transformer books. They have detachable keyboards, so the hotkeys are send through a HID device (and handled by the hid-asus driver) and also the rfkill functionality is not used on these devices.
Besides not adding any extra functionality, initializing the WMI interface on these devices actually has a negative side-effect. For some reason the \_SB.ATKD.INIT() function which asus_wmi_platform_init() calls drives GPO2 (INT33FC:02) pin 8, which is connected to the front facing webcam LED, high and there is no (WMI or other) interface to drive this low again causing the LED to be permanently on, even during suspend.
This commit adds a blacklist of DMI system_ids on which not to load the asus-nb-wmi and adds these Transformer books to this list. This fixes the webcam LED being permanently on under Linux.
--- drivers/platform/x86/asus-nb-wmi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +24 -0
@@ -515,9 +515,33 @@ static struct asus_wmi_driver asus_nb_wmi_driver = { .detect_quirks = asus_nb_wmi_quirks, }; +static const struct dmi_system_id asus_nb_wmi_blacklist[]__initconst = { + { +/* +* asus-nb-wm adds no functionality. The T100TA has a detachable +* USB kbd, so no hotkeys and it has no WMI rfkill; and loading +* asus-nb-wm causes the camera LED to turn and _stay_ on. +*/ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"T100TA" ), + }, + }, + { +/* The Asus T200TA has the same issue as the T100TA */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"T200TA" ), + }, + }, + {}/* Terminating entry */ +};static int __init asus_nb_wmi_init (void ) { +if (dmi_check_system (asus_nb_wmi_blacklist)) +return -ENODEV ; +return asus_wmi_register_driver (&asus_nb_wmi_driver); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 127/606 iommu/amd: Do not loop forever when trying to increase address space
In reply to Sasha LevinFrom: Joerg Roedel <[email protected]>
[ Upstream commit 5b8a9a047b6cad361405c7900c1e1cdd378c4589 ]
When increase_address_space() fails to allocate memory, alloc_pte() will call it again until it succeeds. Do not loop forever while trying to increase the address space and just return an error instead.
--- drivers/iommu/amd_iommu.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +12 -1
@@ -1500,8 +1500,19 @@ static u64 *alloc_pte(struct protection_domain *domain,amd_iommu_domain_get_pgtable (domain, &pgtable);while (address >PM_LEVEL_SIZE (pgtable.mode)) { - *updated =increase_address_space (domain, address, gfp) || *updated; +bool upd =increase_address_space (domain, address, gfp); + +/* Read new values to check if update was successful */ amd_iommu_domain_get_pgtable (domain, &pgtable); + +/* +* Return an error if there is no memory to update the +* page-table. +*/ +if (!upd && (address >PM_LEVEL_SIZE (pgtable.mode))) +return NULL ; + + *updated = *updated || upd; }
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 128/606 iommu/amd: Call domain_flush_complete() in update_domain()
In reply to Sasha LevinFrom: Joerg Roedel <[email protected]>
[ Upstream commit f44a4d7e4f1cdef73c90b1dc749c4d8a7372a8eb ]
The update_domain() function is expected to also inform the hardware about domain changes. This needs a COMPLETION_WAIT command to be sent to all IOMMUs which use the domain.
--- drivers/iommu/amd_iommu.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/amd_iommu.c +1 -0
@@ -2345,6 +2345,7 @@ static void update_domain(struct protection_domain *domain)/* Flush domain TLB(s) and wait for completion */ domain_flush_tlb_pde (domain); +domain_flush_complete (domain); }int __init amd_iommu_init_api (void )
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 129/606 drm/amd/display: fix counter in wait_for_no_pipes_pending
In reply to Sasha LevinFrom: Roman Li <[email protected]>
[ Upstream commit 80797dd6f1a525d1160c463d6a9f9d29af182cbb ]
[Why]
Wait counter is not being reset for each pipe.
[How]
Move counter reset into pipe loop scope.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -3
@@ -803,11 +803,10 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)static void wait_for_no_pipes_pending (struct dc *dc,struct dc_state *context) {int i; -int count =0 ; -struct pipe_ctx *pipe;PERF_TRACE ();for (i =0 ; i <MAX_PIPES ; i++) { - pipe = &context->res_ctx.pipe_ctx[i]; +int count =0 ; +struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];if (!pipe->plane_state)continue ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 130/606 drm/amd/display: Prevent dpcd reads with passive dongles
In reply to Sasha LevinFrom: Aurabindo Pillai <[email protected]>
[ Upstream commit e6142dd511425cb827b5db869f489eb81f5f994d ]
[why]
During hotplug, a DP port may be connected to the sink through passive adapter which does not support DPCD reads. Issuing reads without checking for this condition will result in errors
[how]
Ensure the link is in aux_mode before initiating operation that result in a DPCD read.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +11 -6
@@ -1941,17 +1941,22 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)dc_sink_retain (aconnector->dc_sink);if (sink->dc_edid.length ==0 ) { aconnector->edid =NULL ; -drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux); +if (aconnector->dc_link->aux_mode) { +drm_dp_cec_unset_edid ( + &aconnector->dm_dp_aux.aux); + } }else { aconnector->edid = - (struct edid *) sink->dc_edid.raw_edid; - + (struct edid *)sink->dc_edid.raw_edid;drm_connector_update_edid_property (connector, - aconnector->edid); -drm_dp_cec_set_edid (&aconnector->dm_dp_aux.aux, - aconnector->edid); + aconnector->edid); + +if (aconnector->dc_link->aux_mode) +drm_dp_cec_set_edid (&aconnector->dm_dp_aux.aux, + aconnector->edid); } +amdgpu_dm_update_freesync_caps (connector, aconnector->edid); }else {
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 131/606 KVM: selftests: Fix build for evmcs.h
In reply to Sasha LevinFrom: Peter Xu <[email protected]>
[ Upstream commit 8ffdaf9155ebe517cdec5edbcca19ba6e7ee9c3c ]
I got this error when building kvm selftests:
/usr/bin/ld: /home/xz/git/linux/tools/testing/selftests/kvm/libkvm.a(vmx.o):/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:222: multiple definition of `current_evmcs'; /tmp/cco1G48P.o:/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:222: first defined here /usr/bin/ld: /home/xz/git/linux/tools/testing/selftests/kvm/libkvm.a(vmx.o):/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:223: multiple definition of `current_vp_assist'; /tmp/cco1G48P.o:/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:223: first defined here
I think it's because evmcs.h is included both in a test file and a lib file so the structs have multiple declarations when linking. After all it's not a good habit to declare structs in the header files.
Message-Id: <[email protected]>
--- tools/testing/selftests/kvm/include/evmcs.h | 4 ++-- tools/testing/selftests/kvm/lib/x86_64/vmx.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/kvm/include/evmcs.h +2 -2
@@ -217,8 +217,8 @@ struct hv_enlightened_vmcs {#define HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_MASK \ (~((1ull << HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT) - 1)) -struct hv_enlightened_vmcs *current_evmcs; -struct hv_vp_assist_page *current_vp_assist; +extern struct hv_enlightened_vmcs *current_evmcs; +extern struct hv_vp_assist_page *current_vp_assist;int vcpu_enable_evmcs (struct kvm_vm *vm,int vcpu_id);
tools/testing/selftests/kvm/lib/x86_64/vmx.c +3 -0
@@ -17,6 +17,9 @@bool enable_evmcs; +struct hv_enlightened_vmcs *current_evmcs; +struct hv_vp_assist_page *current_vp_assist; +struct eptPageTableEntry {uint64_t readable:1 ;uint64_t writable:1 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 132/606 ARM: futex: Address build warning
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 8101b5a1531f3390b3a69fa7934c70a8fd6566ad ]
Stephen reported the following build warning on a ARM multi_v7_defconfig build with GCC 9.2.1:
kernel/futex.c: In function 'do_futex':kernel/futex.c:1676:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized]
1676 | return oldval == cmparg;
| ~~~~~~~^~~~~~~~~
kernel/futex.c:1652:6: note: 'oldval' was declared here
1652 | int oldval, ret;
| ^~~~~~introduced by commit a08971e9488d ("futex: arch_futex_atomic_op_inuser() calling conventions change").
While that change should not make any difference it confuses GCC which fails to work out that oldval is not referenced when the return value is not zero.
GCC fails to properly analyze arch_futex_atomic_op_inuser(). It's not the early return, the issue is with the assembly macros. GCC fails to detect that those either set 'ret' to 0 and set oldval or set 'ret' to -EFAULT which makes oldval uninteresting. The store to the callsite supplied oldval pointer is conditional on ret == 0.
The straight forward way to solve this is to make the store unconditional.
Aside of addressing the build warning this makes sense anyway because it removes the conditional from the fastpath. In the error case the stored value is uninteresting and the extra store does not matter at all.
--- arch/arm/include/asm/futex.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/include/asm/futex.h +7 -2
@@ -164,8 +164,13 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)preempt_enable ();#endif -if (!ret) - *oval = oldval; +/* +* Store unconditionally. If ret != 0 the extra store is the least +* of the worries but GCC cannot figure out that __futex_atomic_op() +* is either setting ret to -EFAULT or storing the old value in +* oldval which results in a uninitialized warning at the call site. +*/ + *oval = oldval;return ret; }
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 133/606 tools/bootconfig: Fix resource leak in apply_xbc()
In reply to Sasha LevinFrom: Yunfeng Ye <[email protected]>
[ Upstream commit 8842604446d1f005abcbf8c63c12eabdb5695094 ]
Fix the @data and @fd allocations that are leaked in the error path of apply_xbc().
--- tools/bootconfig/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tools/bootconfig/main.c +6 -3
@@ -287,6 +287,7 @@ int apply_xbc(const char *path, const char *xbc_path) ret =delete_xbc (path);if (ret <0 ) {pr_err ("Failed to delete previous boot config: %d\n" , ret); +free (data);return ret; }
@@ -294,24 +295,26 @@ int apply_xbc(const char *path, const char *xbc_path) fd =open (path,O_RDWR |O_APPEND );if (fd <0 ) {pr_err ("Failed to open %s: %d\n" , path, fd); +free (data);return fd; }/* TODO: Ensure the @path is initramfs/initrd image */ ret =write (fd, data, size +8 );if (ret <0 ) {pr_err ("Failed to apply a boot config: %d\n" , ret); -return ret; + goto out; }/* Write a magic word of the bootconfig */ ret =write (fd,BOOTCONFIG_MAGIC ,BOOTCONFIG_MAGIC_LEN );if (ret <0 ) {pr_err ("Failed to apply a boot config magic: %d\n" , ret); -return ret; + goto out; } +out:close (fd);free (data); -return 0 ; +return ret; }int usage (void )
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 134/606 scripts/gdb: repair rb_first() and rb_last()
In reply to Sasha LevinFrom: Aymeric Agon-Rambosson <[email protected]>
[ Upstream commit 50e36be1fb9572b2e4f2753340bdce3116bf2ce7 ]
The current implementations of the rb_first() and rb_last() gdb functions have a variable that references itself in its instanciation, which causes the function to throw an error if a specific condition on the argument is met. The original author rather intended to reference the argument and made a typo. Referring the argument instead makes the function work as intended.
--- scripts/gdb/linux/rbtree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/gdb/linux/rbtree.py +2 -2
@@ -12,7 +12,7 @@ rb_node_type = utils.CachedType("struct rb_node") def rb_first(root): if root.type == rb_root_type.get_type(): - node = node.address.cast(rb_root_type.get_type().pointer()) + node = root.address.cast(rb_root_type.get_type().pointer()) elif root.type != rb_root_type.get_type().pointer(): raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
@@ -28,7 +28,7 @@ def rb_first(root): def rb_last(root): if root.type == rb_root_type.get_type(): - node = node.address.cast(rb_root_type.get_type().pointer()) + node = root.address.cast(rb_root_type.get_type().pointer()) elif root.type != rb_root_type.get_type().pointer(): raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 135/606 ALSA: hda/realtek - Add supported new mute Led for HP
In reply to Sasha LevinFrom: Kailang Yang <[email protected]>
[ Upstream commit 431e76c3edd76d84a0ed1eb81a286b2ddecc5ee4 ]
HP Note Book supported new mute Led. Hardware PIN was not enough to meet old LED rule. JD2 to control playback mute led.
GPO3 to control capture mute led.
(ALC285 didn't control GPO3 via verb command) This two PIN just could control by COEF registers.
[ corrected typos by tiwai ]
--- sound/pci/hda/patch_realtek.c | 81 +++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+)
sound/pci/hda/patch_realtek.c +81 -0
@@ -86,6 +86,14 @@ struct alc_spec {unsigned int gpio_mute_led_mask;unsigned int gpio_mic_led_mask; +unsigned int mute_led_coef_idx; +unsigned int mute_led_coefbit_mask; +unsigned int mute_led_coefbit_on; +unsigned int mute_led_coefbit_off; +unsigned int mic_led_coef_idx; +unsigned int mic_led_coefbit_mask; +unsigned int mic_led_coefbit_on; +unsigned int mic_led_coefbit_off;hda_nid_t headset_mic_pin;hda_nid_t headphone_mic_pin;
@@ -4182,6 +4190,73 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, } } +/* update mute-LED according to the speaker mute state via COEF bit */ +static void alc_fixup_mute_led_coefbit_hook (void *private_data,int enabled) +{ +struct hda_codec *codec = private_data; +struct alc_spec *spec = codec->spec; + +if (spec->mute_led_polarity) + enabled = !enabled; + +/* temporarily power up/down for setting COEF bit */ + enabled ?alc_update_coef_idx (codec, spec->mute_led_coef_idx, + spec->mute_led_coefbit_mask, spec->mute_led_coefbit_off) : +alc_update_coef_idx (codec, spec->mute_led_coef_idx, + spec->mute_led_coefbit_mask, spec->mute_led_coefbit_on); +} + +static void alc285_fixup_hp_mute_led_coefbit (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mute_led_polarity =0 ; + spec->mute_led_coef_idx =0x0b ; + spec->mute_led_coefbit_mask =1 <<3 ; + spec->mute_led_coefbit_on =1 <<3 ; + spec->mute_led_coefbit_off =0 ; + spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook; + spec->gen.vmaster_mute_enum =1 ; + } +} + +/* turn on/off mic-mute LED per capture hook by coef bit */ +static void alc_hp_cap_micmute_update (struct hda_codec *codec) +{ +struct alc_spec *spec = codec->spec; + +if (spec->gen.micmute_led.led_value) +alc_update_coef_idx (codec, spec->mic_led_coef_idx, + spec->mic_led_coefbit_mask, spec->mic_led_coefbit_on); +else +alc_update_coef_idx (codec, spec->mic_led_coef_idx, + spec->mic_led_coefbit_mask, spec->mic_led_coefbit_off); +} + +static void alc285_fixup_hp_coef_micmute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mic_led_coef_idx =0x19 ; + spec->mic_led_coefbit_mask =1 <<13 ; + spec->mic_led_coefbit_on =1 <<13 ; + spec->mic_led_coefbit_off =0 ; +snd_hda_gen_add_micmute_led (codec, alc_hp_cap_micmute_update); + } +} + +static void alc285_fixup_hp_mute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +alc285_fixup_hp_mute_led_coefbit (codec, fix, action); +alc285_fixup_hp_coef_micmute_led (codec, fix, action); +} +#if IS_REACHABLE (CONFIG_INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event)
@@ -5980,6 +6055,7 @@ enum {ALC294_FIXUP_ASUS_HPE ,ALC294_FIXUP_ASUS_COEF_1B ,ALC285_FIXUP_HP_GPIO_LED , + ALC285_FIXUP_HP_MUTE_LED, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7128,6 +7204,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_gpio_led, }, + [ALC285_FIXUP_HP_MUTE_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_mute_led, + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7273,6 +7353,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8497 ,"HP Envy x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8736 ,"HP" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x877a ,"HP" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 136/606 ALSA: hda/realtek - Add HP new mute led supported for ALC236
In reply to Sasha LevinFrom: Kailang Yang <[email protected]>
[ Upstream commit 24164f434dc9c23cd34fca1e36acea9d0581bdde ]
HP new platform has new mute led feature.
COEF index 0x34 bit 5 to control playback mute led. COEF index 0x35 bit 2 and bit 3 to control Mic mute led.
[ corrected typos by tiwai ]
--- sound/pci/hda/patch_realtek.c | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
sound/pci/hda/patch_realtek.c +44 -0
@@ -4223,6 +4223,23 @@ static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, } } +static void alc236_fixup_hp_mute_led_coefbit (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mute_led_polarity =0 ; + spec->mute_led_coef_idx =0x34 ; + spec->mute_led_coefbit_mask =1 <<5 ; + spec->mute_led_coefbit_on =0 ; + spec->mute_led_coefbit_off =1 <<5 ; + spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook; + spec->gen.vmaster_mute_enum =1 ; + } +} +/* turn on/off mic-mute LED per capture hook by coef bit */ static void alc_hp_cap_micmute_update (struct hda_codec *codec) {
@@ -4250,6 +4267,20 @@ static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, } } +static void alc236_fixup_hp_coef_micmute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mic_led_coef_idx =0x35 ; + spec->mic_led_coefbit_mask =3 <<2 ; + spec->mic_led_coefbit_on =2 <<2 ; + spec->mic_led_coefbit_off =1 <<2 ; +snd_hda_gen_add_micmute_led (codec, alc_hp_cap_micmute_update); + } +} +static void alc285_fixup_hp_mute_led (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -4257,6 +4288,13 @@ static void alc285_fixup_hp_mute_led(struct hda_codec *codec,alc285_fixup_hp_coef_micmute_led (codec, fix, action); } +static void alc236_fixup_hp_mute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +alc236_fixup_hp_mute_led_coefbit (codec, fix, action); +alc236_fixup_hp_coef_micmute_led (codec, fix, action); +} +#if IS_REACHABLE (CONFIG_INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event)
@@ -6056,6 +6094,7 @@ enum {ALC294_FIXUP_ASUS_COEF_1B ,ALC285_FIXUP_HP_GPIO_LED ,ALC285_FIXUP_HP_MUTE_LED , + ALC236_FIXUP_HP_MUTE_LED, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7208,6 +7247,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_mute_led, }, + [ALC236_FIXUP_HP_MUTE_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc236_fixup_hp_mute_led, + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7354,6 +7397,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8736 ,"HP" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x877a ,"HP" ,ALC285_FIXUP_HP_MUTE_LED ), +SND_PCI_QUIRK (0x103c ,0x877d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 137/606 ALSA: hda/realtek: Add quirk for Samsung Notebook
In reply to Sasha LevinFrom: Mike Pozulp <[email protected]>
[ Upstream commit 14425f1f521fdfe274a7bb390637c786432e08b4 ]
Some models of the Samsung Notebook 9 have very quiet and distorted headphone output. This quirk changes the VREF value of the ALC298 codec NID 0x1a from default HIZ to new 100.
[ adjusted to 5.7-base and rearranged in SSID order -- tiwai ]
--- sound/pci/hda/patch_realtek.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/pci/hda/patch_realtek.c +10 -0
@@ -6095,6 +6095,7 @@ enum {ALC285_FIXUP_HP_GPIO_LED ,ALC285_FIXUP_HP_MUTE_LED ,ALC236_FIXUP_HP_MUTE_LED , + ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7251,6 +7252,13 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc236_fixup_hp_mute_led, }, + [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb []) { + {0x1a ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0xc5 }, + { } + }, + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7446,6 +7454,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x10ec ,0x10f2 ,"Intel Reference board" ,ALC700_FIXUP_INTEL_REFERENCE ),SND_PCI_QUIRK (0x10f7 ,0x8338 ,"Panasonic CF-SZ6" ,ALC269_FIXUP_HEADSET_MODE ),SND_PCI_QUIRK (0x144d ,0xc109 ,"Samsung Ativ book 9 (NP900X3G)" ,ALC269_FIXUP_INV_DMIC ), +SND_PCI_QUIRK (0x144d ,0xc169 ,"Samsung Notebook 9 Pen (NP930SBE-K01US)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ), +SND_PCI_QUIRK (0x144d ,0xc176 ,"Samsung Notebook 9 Pro (NP930MBE-K04US)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc740 ,"Samsung Ativ book 8 (NP870Z5G)" ,ALC269_FIXUP_ATIV_BOOK_8 ),SND_PCI_QUIRK (0x1458 ,0xfa53 ,"Gigabyte BXBT-2807" ,ALC283_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 138/606 ALSA: hda/realtek - Enable headset mic of ASUS GL503VM with ALC295
In reply to Sasha LevinFrom: Chris Chiu <[email protected]>
[ Upstream commit 9e43342b464f1de570a3ad8256ac77645749ef45 ]
The ASUS laptop GL503VM with ALC295 can't detect the headset microphone. The headset microphone does not work until pin 0x19 is enabled for it.
--- sound/pci/hda/patch_realtek.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
sound/pci/hda/patch_realtek.c +18 -0
@@ -6096,6 +6096,7 @@ enum {ALC285_FIXUP_HP_MUTE_LED ,ALC236_FIXUP_HP_MUTE_LED ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET , + ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7259,6 +7260,15 @@ static const struct hda_fixup alc269_fixups[] = { { } }, }, + [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x19 ,0x01a1913c },/* use as headset mic, without its own jack detect */ + { } + }, + .chained = true, + .chain_id =ALC269_FIXUP_HEADSET_MODE + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -8040,6 +8050,14 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { {0x12, 0x90a60130}, {0x17, 0x90170110}, {0x21, 0x03211020}), +SND_HDA_PIN_QUIRK (0x10ec0295 ,0x1043 ,"ASUS" ,ALC295_FIXUP_ASUS_MIC_NO_PRESENCE , + {0x12, 0x90a60130}, + {0x17, 0x90170110}, + {0x21, 0x03211020}), +SND_HDA_PIN_QUIRK (0x10ec0295 ,0x1043 ,"ASUS" ,ALC295_FIXUP_ASUS_MIC_NO_PRESENCE , + {0x12, 0x90a60130}, + {0x17, 0x90170110}, + {0x21, 0x03211020}),SND_HDA_PIN_QUIRK (0x10ec0295 ,0x1028 ,"Dell" ,ALC269_FIXUP_DELL4_MIC_NO_PRESENCE , {0x14, 0x90170110}, {0x21, 0x04211020}),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 139/606 ALSA: hda/realtek - Enable headset mic of ASUS UX550GE with ALC295
In reply to Sasha LevinFrom: Jian-Hong Pan <[email protected]>
[ Upstream commit ad97d667854c2fbce05a004e107f358ef4b04cf6 ]
The ASUS laptop UX550GE with ALC295 can't detect the headset microphone until ALC295_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -8050,6 +8050,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { {0x12, 0x90a60130}, {0x17, 0x90170110}, {0x21, 0x03211020}), + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, + {0x12, 0x90a60120}, + {0x17, 0x90170110}, + {0x21, 0x04211030}), SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, {0x12, 0x90a60130}, {0x17, 0x90170110},
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 140/606 ALSA: hda/realtek: Enable headset mic of ASUS UX581LV with ALC295
In reply to Sasha LevinFrom: Jian-Hong Pan <[email protected]>
[ Upstream commit 7900e81797613b92f855f9921392a7430cbdf88c ]
The ASUS UX581LV laptop's audio (1043:19e1) with ALC295 can't detect the headset microphone until ALC295_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -7436,6 +7436,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x18b1 ,"Asus MJ401TA" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x18f1 ,"Asus FX505DT" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x19ce ,"ASUS B9450FA" ,ALC294_FIXUP_ASUS_HPE ), +SND_PCI_QUIRK (0x1043 ,0x19e1 ,"ASUS UX581LV" ,ALC295_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1a13 ,"Asus G73Jw" ,ALC269_FIXUP_ASUS_G73JW ),SND_PCI_QUIRK (0x1043 ,0x1a30 ,"ASUS X705UD" ,ALC256_FIXUP_ASUS_MIC ), SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 141/606 bpf: Restrict bpf_probe_read{, str}() only to archs where they work
In reply to Sasha LevinFrom: Daniel Borkmann <[email protected]>
commit 0ebeea8ca8a4d1d453ad299aef0507dab04f6e8d upstream.
Given the legacy bpf_probe_read{,str}() BPF helpers are broken on archs with overlapping address ranges, we should really take the next step to disable them from BPF use there.
To generally fix the situation, we've recently added new helper variants bpf_probe_read_{user,kernel}() and bpf_probe_read_{user,kernel}_str(). For details on them, see 6ae08ae3dea2 ("bpf: Add probe_read_{user, kernel} and probe_read_{user,kernel}_str helpers").
Given bpf_probe_read{,str}() have been around for ~5 years by now, there are plenty of users at least on x86 still relying on them today, so we cannot remove them entirely w/o breaking the BPF tracing ecosystem.
However, their use should be restricted to archs with non-overlapping address ranges where they are working in their current form. Therefore, move this behind a CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE and have x86, arm64, arm select it (other archs supporting it can follow-up on it as well).
For the remaining archs, they can workaround easily by relying on the feature probe from bpftool which spills out defines that can be used out of BPF C code to implement the drop-in replacement for old/new kernels
via: bpftool feature probe macro
--- arch/arm/Kconfig | 1 + arch/arm64/Kconfig | 1 + arch/x86/Kconfig | 1 + init/Kconfig | 3 +++ kernel/trace/bpf_trace.c | 6 ++++-- 5 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/Kconfig +1 -0
@@ -13,6 +13,7 @@ config ARM select ARCH_HAS_KEEPINITRD select ARCH_HAS_KCOV select ARCH_HAS_MEMBARRIER_SYNC_CORE + select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PTE_SPECIAL if ARM_LPAE select ARCH_HAS_PHYS_TO_DMA select ARCH_HAS_SETUP_DMA_OPS
arch/arm64/Kconfig +1 -0
@@ -21,6 +21,7 @@ config ARM64 select ARCH_HAS_KCOV select ARCH_HAS_KEEPINITRD select ARCH_HAS_MEMBARRIER_SYNC_CORE + select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PTE_DEVMAP select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_SETUP_DMA_OPS
arch/x86/Kconfig +1 -0
@@ -70,6 +70,7 @@ config X86 select ARCH_HAS_KCOV if X86_64 select ARCH_HAS_MEM_ENCRYPT select ARCH_HAS_MEMBARRIER_SYNC_CORE + select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PMEM_API if X86_64 select ARCH_HAS_PTE_DEVMAP if X86_64 select ARCH_HAS_PTE_SPECIAL
init/Kconfig +3 -0
@@ -2223,6 +2223,9 @@ config ASN1 source "kernel/Kconfig.locks" +config ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + bool + config ARCH_HAS_SYNC_CORE_BEFORE_USERMODE bool
kernel/trace/bpf_trace.c +4 -2
@@ -857,14 +857,16 @@ tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)return &bpf_probe_read_user_proto;case BPF_FUNC_probe_read_kernel:return &bpf_probe_read_kernel_proto; -case BPF_FUNC_probe_read: -return &bpf_probe_read_compat_proto;case BPF_FUNC_probe_read_user_str:return &bpf_probe_read_user_str_proto;case BPF_FUNC_probe_read_kernel_str:return &bpf_probe_read_kernel_str_proto; +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE +case BPF_FUNC_probe_read: +return &bpf_probe_read_compat_proto;case BPF_FUNC_probe_read_str:return &bpf_probe_read_compat_str_proto; +#endif #ifdef CONFIG_CGROUPS case BPF_FUNC_get_current_cgroup_id:return &bpf_get_current_cgroup_id_proto;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 142/606 bpf: Add bpf_probe_read_{user, kernel}_str() to do_refine_retval_range
In reply to Sasha LevinFrom: Daniel Borkmann <[email protected]>
commit 47cc0ed574abcbbde0cf143ddb21a0baed1aa2df upstream.
Given bpf_probe_read{,str}() BPF helpers are now only available under CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE, we need to add the drop-in replacements of bpf_probe_read_{kernel,user}_str() to do_refine_retval_range() as well to avoid hitting the same issue as in 849fa50662fbc ("bpf/verifier:
refine retval R0 state for bpf_get_stack helper").
--- kernel/bpf/verifier.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/bpf/verifier.c +3 -1
@@ -4113,7 +4113,9 @@ static int do_refine_retval_range(struct bpf_verifier_env *env,if (ret_type !=RET_INTEGER || (func_id != BPF_FUNC_get_stack && - func_id != BPF_FUNC_probe_read_str)) + func_id != BPF_FUNC_probe_read_str && + func_id != BPF_FUNC_probe_read_kernel_str && + func_id != BPF_FUNC_probe_read_user_str))return 0 ;/* Error case where ret is in interval [S32MIN, -1]. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 143/606 ALSA: iec1712: Initialize STDSP24 properly when using the model=staudio option
In reply to Sasha LevinFrom: Scott Bahling <[email protected]>
commit b0cb099062b0c18246c3a20caaab4c0afc303255 upstream.
The ST Audio ADCIII is an STDSP24 card plus extension box. With commit e8a91ae18bdc ("ALSA: ice1712: Add support for STAudio ADCIII") we enabled the ADCIII ports using the model=staudio option but forgot this part to ensure the STDSP24 card is initialized properly.
--- sound/pci/ice1712/ice1712.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ice1712/ice1712.c +2 -1
@@ -2332,7 +2332,8 @@ static int snd_ice1712_chip_init(struct snd_ice1712 *ice)pci_write_config_byte (ice->pci,0x61 , ice->eeprom.data[ICE_EEP1_ACLINK ]);pci_write_config_byte (ice->pci,0x62 , ice->eeprom.data[ICE_EEP1_I2SID ]);pci_write_config_byte (ice->pci,0x63 , ice->eeprom.data[ICE_EEP1_SPDIF ]); -if (ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STDSP24 ) { +if (ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STDSP24 && + ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STAUDIO_ADCIII ) { ice->gpio.write_mask = ice->eeprom.gpiomask; ice->gpio.direction = ice->eeprom.gpiodir; snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 144/606 ALSA: pcm: fix incorrect hw_base increase
In reply to Sasha LevinFrom: Brent Lu <[email protected]>
commit e7513c5786f8b33f0c107b3759e433bc6cbb2efa upstream.
There is a corner case that ALSA keeps increasing the hw_ptr but DMA already stop working/updating the position for a long time.
In following log we can see the position returned from DMA driver does not move at all but the hw_ptr got increased at some point of time so snd_pcm_avail() will return a large number which seems to be a buffer underrun event from user space program point of view. The program thinks there is space in the buffer and fill more data.
[ 418.510086] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368 [ 418.510149] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6910 avail 9554 ... [ 418.681052] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15102 avail 1362 [ 418.681130] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0 [ 418.726515] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 16464 avail 16368
This is because the hw_base will be increased by runtime->buffer_size frames unconditionally if the hw_ptr is not updated for over half of buffer time. As the hw_base increases, so does the hw_ptr increased by the same number.
The avail value returned from snd_pcm_avail() could exceed the limit (buffer_size) easily becase the hw_ptr itself got increased by same buffer_size samples when the corner case happens. In following log, the buffer_size is 16368 samples but the avail is 21810 samples so CRAS server complains about it.
[ 418.851755] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 27390 avail 5442 [ 418.926491] sound pcmC0D5p: pos 96 hw_ptr 32832 appl_ptr 27390 avail 21810
cras_server[1907]: pcm_avail returned frames larger than buf_size:
sof-glkda7219max: :0,5: 21810 > 16368
By updating runtime->hw_ptr_jiffies each time the HWSYNC is called, the hw_base will keep the same when buffer stall happens at long as the interval between each HWSYNC call is shorter than half of buffer time.
Following is a log captured by a patched kernel. The hw_base/hw_ptr value is fixed in this corner case and user space program should be aware of the buffer stall and handle it.
[ 293.525543] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368 [ 293.525606] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6880 avail 9584 [ 293.525975] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 10976 avail 5488 [ 293.611178] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15072 avail 1392 [ 293.696429] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0 ... [ 381.139517] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
--- sound/core/pcm_lib.c | 1 + 1 file changed, 1 insertion(+)
sound/core/pcm_lib.c +1 -0
@@ -433,6 +433,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, no_delta_check:if (runtime->status->hw_ptr == new_hw_ptr) { + runtime->hw_ptr_jiffies = curr_jiffies;update_audio_tstamp (substream, &curr_tstamp, &audio_tstamp);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 145/606 ALSA: hda/realtek - Fix silent output on Gigabyte X570 Aorus Xtreme
In reply to Sasha LevinFrom: Christian Lachner <[email protected]>
commit d9e8fe0cffbfdd18de96fa68ee2a8b667a0b046e upstream.
The Gigabyte X570 Aorus Xtreme motherboard with ALC1220 codec requires a similar workaround for Clevo laptops to enforce the DAC/mixer connection path. Set up a quirk entry for that.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -2457,6 +2457,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {SND_PCI_QUIRK (0x1458 ,0xa002 ,"Gigabyte EP45-DS3/Z87X-UD3H" ,ALC889_FIXUP_FRONT_HP_NO_PRESENCE ),SND_PCI_QUIRK (0x1458 ,0xa0b8 ,"Gigabyte AZ370-Gaming" ,ALC1220_FIXUP_GB_DUAL_CODECS ),SND_PCI_QUIRK (0x1458 ,0xa0cd ,"Gigabyte X570 Aorus Master" ,ALC1220_FIXUP_CLEVO_P950 ), +SND_PCI_QUIRK (0x1458 ,0xa0ce ,"Gigabyte X570 Aorus Xtreme" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x1228 ,"MSI-GP63" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x1275 ,"MSI-GL63" ,ALC1220_FIXUP_CLEVO_P950 ), SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 146/606 ALSA: hda/realtek - Add more fixup entries for Clevo machines
In reply to Sasha LevinFrom: PeiSen Hou <[email protected]>
commit 259eb82475316672a5d682a94dc8bdd53cf8d8c3 upstream.
A few known Clevo machines (PC50, PC70, X170) with ALC1220 codec need the existing quirk for pins for PB51 and co.
--- sound/pci/hda/patch_realtek.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/patch_realtek.c +3 -0
@@ -2473,6 +2473,9 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {SND_PCI_QUIRK (0x1558 ,0x97e1 ,"Clevo P970[ER][CDFN]" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1558 ,0x65d1 ,"Clevo PB51[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x67d1 ,"Clevo PB71[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x50d3 ,"Clevo PC50[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x70d1 ,"Clevo PC70[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x7714 ,"Clevo X170" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK_VENDOR (0x1558 ,"Clevo laptop" ,ALC882_FIXUP_EAPD ),SND_PCI_QUIRK (0x161f ,0x2054 ,"Medion laptop" ,ALC883_FIXUP_EAPD ), SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 147/606 scsi: qla2xxx: Do not log message when reading port speed via sysfs
In reply to Sasha LevinFrom: "Ewan D. Milne" <[email protected]>
commit fb9024b0646939e59d8a0b6799b317070619795a upstream.
Calling ql_log() inside qla2x00_port_speed_show() is causing messages to be output to the console for no particularly good reason. The sysfs read routine should just return the information to userspace. The only reason to log a message is when the port speed actually changes, and this already occurs elsewhere.
--- drivers/scsi/qla2xxx/qla_attr.c | 3 --- 1 file changed, 3 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +0 -3
@@ -1777,9 +1777,6 @@ qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr,return -EINVAL ; } -ql_log (ql_log_info, vha,0x70d6 , -"port speed:%d\n" , ha->link_data_rate); -return scnprintf (buf,PAGE_SIZE ,"%s\n" , spd[ha->link_data_rate]); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 148/606 scsi: target: Put lun_ref at end of tmr processing
In reply to Sasha LevinFrom: Bodo Stroesser <[email protected]>
commit f2e6b75f6ee82308ef7b00f29e71e5f1c6b3d52a upstream.
Testing with Loopback I found that, after a Loopback LUN has executed a TMR, I can no longer unlink the LUN. The rm command hangs in transport_clear_lun_ref() at wait_for_completion(&lun->lun_shutdown_comp) The reason is, that transport_lun_remove_cmd() is not called at the end of target_tmr_work().
It seems, that in other fabrics this call happens implicitly when the fabric drivers call transport_generic_free_cmd() during their ->queue_tm_rsp().
Unfortunately Loopback seems to not comply to the common way of calling transport_generic_free_cmd() from ->queue_*(). Instead it calls transport_generic_free_cmd() from its
->check_stop_free() only.
But the ->check_stop_free() is called by transport_cmd_check_stop_to_fabric() after it has reset the se_cmd->se_lun pointer. Therefore the following transport_generic_free_cmd() skips the transport_lun_remove_cmd().
So this patch re-adds the transport_lun_remove_cmd() at the end of target_tmr_work(), which was removed during commit 2c9fa49e100f ("scsi:
target/core: Make ABORT and LUN RESET handling synchronous").
For fabrics using transport_generic_free_cmd() in the usual way the double call to transport_lun_remove_cmd() doesn't harm, as transport_lun_remove_cmd() checks for this situation and does not release lun_ref twice.
--- drivers/target/target_core_transport.c | 1 + 1 file changed, 1 insertion(+)
drivers/target/target_core_transport.c +1 -0
@@ -3349,6 +3349,7 @@ static void target_tmr_work(struct work_struct *work) cmd->se_tfo->queue_tm_rsp (cmd); +transport_lun_remove_cmd (cmd);transport_cmd_check_stop_to_fabric (cmd);return ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 149/606 arm64: Fix PTRACE_SYSEMU semantics
In reply to Sasha LevinFrom: Keno Fischer <[email protected]>
commit 1cf6022bd9161081215028203919c33fcfa6debb upstream.
Quoth the man page:
```
If the tracee was restarted by PTRACE_SYSCALL or PTRACE_SYSEMU, the
tracee enters syscall-enter-stop just prior to entering any system
call (which will not be executed if the restart was using
PTRACE_SYSEMU, regardless of any change made to registers at this
point or how the tracee is restarted after this stop).
```The parenthetical comment is currently true on x86 and powerpc, but not currently true on arm64. arm64 re-checks the _TIF_SYSCALL_EMU flag after the syscall entry ptrace stop. However, at this point, it reflects which method was used to re-start the syscall
at the entry stop, rather than the method that was used to reach it. Fix that by recording the original flag before performing the ptrace stop, bringing the behavior in line with documentation and x86/powerpc.
--- arch/arm64/kernel/ptrace.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm64/kernel/ptrace.c +4 -3
@@ -1829,10 +1829,11 @@ static void tracehook_report_syscall(struct pt_regs *regs,int syscall_trace_enter (struct pt_regs *regs) { -if (test_thread_flag (TIF_SYSCALL_TRACE ) || -test_thread_flag (TIF_SYSCALL_EMU )) { +unsigned long flags =READ_ONCE (current_thread_info ()->flags); + +if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {tracehook_report_syscall (regs,PTRACE_SYSCALL_ENTER ); -if (!in_syscall (regs) ||test_thread_flag (TIF_SYSCALL_EMU )) +if (!in_syscall (regs) || (flags & _TIF_SYSCALL_EMU))return -1 ; }
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 150/606 powerpc/64s: Disable STRICT_KERNEL_RWX
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
commit 8659a0e0efdd975c73355dbc033f79ba3b31e82c upstream.
Several strange crashes have been eventually traced back to STRICT_KERNEL_RWX and its interaction with code patching.
Various paths in our ftrace, kprobes and other patching code need to be hardened against patching failures, otherwise we can end up running with partially/incorrectly patched ftrace paths, kprobes or jump labels, which can then cause strange crashes.
Although fixes for those are in development, they're not -rc material.
There also seem to be problems with the underlying strict RWX logic, which needs further debugging.
So for now disable STRICT_KERNEL_RWX on 64-bit to prevent people from enabling the option and tripping over the bugs.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -129,7 +129,7 @@ config PPC select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_MEMBARRIER_CALLBACKS select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64 - select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION) + select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION) select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UACCESS_FLUSHCACHE select ARCH_HAS_UACCESS_MCSAFE if PPC64
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 151/606 drm/etnaviv: fix perfmon domain interation
In reply to Sasha LevinFrom: Christian Gmeiner <[email protected]>
commit 40b697e256ccdb88aaff424b44b4d300eb8460e8 upstream.
The GC860 has one GPU device which has a 2d and 3d core. In this case we want to expose perfmon information for both cores.
The driver has one array which contains all possible perfmon domains with some meta data - doms_meta. Here we can see that for the GC860 two elements of that array are relevant:
doms_3d: is at index 0 in the doms_meta array with 8 perfmon domains
doms_2d: is at index 1 in the doms_meta array with 1 perfmon domain
The userspace driver wants to get a list of all perfmon domains and their perfmon signals. This is done by iterating over all domains and their signals. If the userspace driver wants to access the domain with id 8 the kernel driver fails and returns invalid data from doms_3d with and invalid offset.
This results in:
Unable to handle kernel paging request at virtual address 00000000
On such a device it is not possible to use the userspace driver at all.
The fix for this off-by-one error is quite simple.
--- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +1 -1
@@ -453,7 +453,7 @@ static const struct etnaviv_pm_domain *pm_domain(const struct etnaviv_gpu *gpu,if (!(gpu->identity.features & meta->feature))continue ; -if (meta->nr_domains < (index - offset)) { +if (index - offset >= meta->nr_domains) { offset += meta->nr_domains;continue ; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 152/606 pinctrl: qcom: Add affinity callbacks to msmgpio IRQ chip
In reply to Sasha LevinFrom: Venkata Narendra Kumar Gutta <[email protected]>
commit dca4f40742e09ec5d908a7fc2862498e6cf9d911 upstream.
Wakeup capable GPIO IRQs routed via PDC are not being migrated when a CPU is hotplugged. Add affinity callbacks to msmgpio IRQ chip to update the affinity of wakeup capable IRQs.
--- drivers/pinctrl/qcom/pinctrl-msm.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/pinctrl/qcom/pinctrl-msm.c +25 -0
@@ -1010,6 +1010,29 @@ static void msm_gpio_irq_relres(struct irq_data *d)module_put (gc->owner); } +static int msm_gpio_irq_set_affinity (struct irq_data *d, +const struct cpumask *dest,bool force) +{ +struct gpio_chip *gc =irq_data_get_irq_chip_data (d); +struct msm_pinctrl *pctrl =gpiochip_get_data (gc); + +if (d->parent_data &&test_bit (d->hwirq, pctrl->skip_wake_irqs)) +return irq_chip_set_affinity_parent (d, dest, force); + +return 0 ; +} + +static int msm_gpio_irq_set_vcpu_affinity (struct irq_data *d,void *vcpu_info) +{ +struct gpio_chip *gc =irq_data_get_irq_chip_data (d); +struct msm_pinctrl *pctrl =gpiochip_get_data (gc); + +if (d->parent_data &&test_bit (d->hwirq, pctrl->skip_wake_irqs)) +return irq_chip_set_vcpu_affinity_parent (d, vcpu_info); + +return 0 ; +} +static void msm_gpio_irq_handler (struct irq_desc *desc) {struct gpio_chip *gc =irq_desc_get_handler_data (desc);
@@ -1108,6 +1131,8 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) pctrl->irq_chip.irq_set_wake = msm_gpio_irq_set_wake; pctrl->irq_chip.irq_request_resources = msm_gpio_irq_reqres; pctrl->irq_chip.irq_release_resources = msm_gpio_irq_relres; + pctrl->irq_chip.irq_set_affinity = msm_gpio_irq_set_affinity; + pctrl->irq_chip.irq_set_vcpu_affinity = msm_gpio_irq_set_vcpu_affinity; np =of_parse_phandle (pctrl->dev->of_node,"wakeup-parent" ,0 );if (np) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 153/606 apparmor: Fix use-after-free in aa_audit_rule_init
In reply to Sasha LevinFrom: Navid Emamdoost <[email protected]>
commit c54d481d71c6849e044690d3960aaebc730224cc upstream.
In the implementation of aa_audit_rule_init(), when aa_label_parse() fails the allocated memory for rule is released using aa_audit_rule_free(). But after this release, the return statement tries to access the label field of the rule which results in use-after-free. Before releasing the rule, copy errNo and return it after release.
--- security/apparmor/audit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/apparmor/audit.c +2 -1
@@ -197,8 +197,9 @@ int aa_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule) rule->label =aa_label_parse (&root_ns->unconfined->label, rulestr,GFP_KERNEL , true, false);if (IS_ERR (rule->label)) { +int err =PTR_ERR (rule->label);aa_audit_rule_free (rule); -return PTR_ERR (rule->label); +return err; } *vrule = rule;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 154/606 apparmor: fix potential label refcnt leak in aa_change_profile
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
commit a0b845ffa0d91855532b50fc040aeb2d8338dca4 upstream.
aa_change_profile() invokes aa_get_current_label(), which returns a reference of the current task's label.
According to the comment of aa_get_current_label(), the returned reference must be put with aa_put_label().
However, when the original object pointed by "label" becomes unreachable because aa_change_profile() returns or a new object is assigned to "label", reference count increased by aa_get_current_label() is not decreased, causing a refcnt leak.
Fix this by calling aa_put_label() before aa_change_profile() return and dropping unnecessary aa_get_current_label().
--- security/apparmor/domain.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
security/apparmor/domain.c +1 -2
@@ -1328,6 +1328,7 @@ int aa_change_profile(const char *fqname, int flags) ctx->nnp =aa_get_label (label);if (!fqname || !*fqname) { +aa_put_label (label);AA_DEBUG ("no profile name" );return -EINVAL ; }
@@ -1346,8 +1347,6 @@ int aa_change_profile(const char *fqname, int flags) op =OP_CHANGE_PROFILE ; } - label =aa_get_current_label (); -if (*fqname =='&' ) { stack = true;/* don't have label_parse() do stacking */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 155/606 apparmor: Fix aa_label refcnt leak in policy_update
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
commit c6b39f070722ea9963ffe756bfe94e89218c5e63 upstream.
policy_update() invokes begin_current_label_crit_section(), which returns a reference of the updated aa_label object to "label" with increased refcount.
When policy_update() returns, "label" becomes invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one exception handling path of policy_update(). When aa_may_manage_policy() returns not NULL, the refcnt increased by begin_current_label_crit_section() is not decreased, causing a refcnt leak.
Fix this issue by jumping to "end_section" label when aa_may_manage_policy() returns not NULL.
--- security/apparmor/apparmorfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/apparmor/apparmorfs.c +2 -1
@@ -454,7 +454,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size,*/ error =aa_may_manage_policy (label, ns, mask);if (error) -return error; + goto end_section; data =aa_simple_write_to_buffer (buf, size, size, pos); error =PTR_ERR (data);
@@ -462,6 +462,7 @@ static ssize_t policy_update(u32 mask, const char __user *buf, size_t size, error =aa_replace_profiles (ns, label, mask, data);aa_put_loaddata (data); } +end_section:end_current_label_crit_section (label);return error;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 156/606 dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
commit 3a5fd0dbd87853f8bd2ea275a5b3b41d6686e761 upstream.
Commit b53611fb1ce9 ("dmaengine: tegra210-adma: Fix crash during probe") has moved some code in the probe function and reordered the error handling path accordingly.
However, a goto has been missed.
Fix it and goto the right label if 'dma_async_device_register()' fails, so that all resources are released.
--- drivers/dma/tegra210-adma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +1 -1
@@ -900,7 +900,7 @@ static int tegra_adma_probe(struct platform_device *pdev) ret =dma_async_device_register (&tdma->dma_dev);if (ret <0 ) {dev_err (&pdev->dev,"ADMA registration failed: %d\n" , ret); - goto irq_dispose; + goto rpm_put; } ret = of_dma_controller_register(pdev->dev.of_node,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 157/606 drm/etnaviv: Fix a leak in submit_pin_objects()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
commit ad99cb5e783bb03d512092db3387ead9504aad3d upstream.
If the mapping address is wrong then we have to release the reference to it before returning -EINVAL.
--- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +3 -1
@@ -238,8 +238,10 @@ static int submit_pin_objects(struct etnaviv_gem_submit *submit) }if ((submit->flags &ETNA_SUBMIT_SOFTPIN ) && - submit->bos[i].va != mapping->iova) + submit->bos[i].va != mapping->iova) { +etnaviv_gem_mapping_unreference (mapping);return -EINVAL ; + }atomic_inc (&etnaviv_obj->gpu_active);
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 158/606 dmaengine: dmatest: Restore default for channel
In reply to Sasha LevinFrom: Vladimir Murzin <[email protected]>
commit 6b41030fdc79086db5d673c5ed7169f3ee8c13b9 upstream.
In case of dmatest is built-in and no channel was configured test doesn't run with:
dmatest: Could not start test, no channels configured
Even though description to "channel" parameter claims that default is any.
Add default channel back as it used to be rather than reject test with no channel configuration.
--- drivers/dma/dmatest.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/dma/dmatest.c +5 -4
@@ -1166,10 +1166,11 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)mutex_unlock (&info->lock);return ret; }else if (dmatest_run) { -if (is_threaded_test_pending (info)) -start_threaded_tests (info); -else -pr_info ("Could not start test, no channels configured\n" ); +if (!is_threaded_test_pending (info)) { +pr_info ("No channels configured, continue with any\n" ); +add_threaded_test (info); + } +start_threaded_tests (info); }else {stop_threaded_test (info); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 159/606 dmaengine: idxd: fix interrupt completion after unmasking
In reply to Sasha LevinFrom: Dave Jiang <[email protected]>
commit 4f302642b70c1348773fe7e3ded9fc315fa92990 upstream.
The current implementation may miss completions after we unmask the interrupt. In order to make sure we process all competions, we need to:
1. Do an MMIO read from the device as a barrier to ensure that all PCI writes for completions have arrived.
2. Check for any additional completions that we missed.
--- drivers/dma/idxd/device.c | 7 +++++++ drivers/dma/idxd/irq.c | 26 +++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-)
drivers/dma/idxd/device.c +7 -0
@@ -62,6 +62,13 @@ int idxd_unmask_msix_vector(struct idxd_device *idxd, int vec_id) perm.ignore =0 ;iowrite32 (perm.bits, idxd->reg_base + offset); +/* +* A readback from the device ensures that any previously generated +* completion record writes are visible to software based on PCI +* ordering rules. +*/ + perm.bits =ioread32 (idxd->reg_base + offset); +return 0 ; }
drivers/dma/idxd/irq.c +19 -7
@@ -173,6 +173,7 @@ static int irq_process_pending_llist(struct idxd_irq_entry *irq_entry,struct llist_node *head;int queued =0 ; + *processed =0 ; head =llist_del_all (&irq_entry->pending_llist);if (!head)return 0 ;
@@ -197,6 +198,7 @@ static int irq_process_work_list(struct idxd_irq_entry *irq_entry,struct list_head *node, *next;int queued =0 ; + *processed =0 ;if (list_empty (&irq_entry->work_list))return 0 ;
@@ -218,10 +220,9 @@ static int irq_process_work_list(struct idxd_irq_entry *irq_entry,return queued; } -irqreturn_t idxd_wq_thread (int irq,void *data) +static int idxd_desc_process (struct idxd_irq_entry *irq_entry) { -struct idxd_irq_entry *irq_entry = data; -int rc, processed =0 , retry =0 ; +int rc, processed, total =0 ;/* * There are two lists we are processing. The pending_llist is where
@@ -244,15 +245,26 @@ irqreturn_t idxd_wq_thread(int irq, void *data)*/ do { rc =irq_process_work_list (irq_entry, &processed); -if (rc !=0 ) { - retry++; + total += processed; +if (rc !=0 )continue ; - } rc =irq_process_pending_llist (irq_entry, &processed); - }while (rc !=0 && retry !=10 ); + total += processed; + }while (rc !=0 ); + +return total; +} + +irqreturn_t idxd_wq_thread (int irq,void *data) +{ +struct idxd_irq_entry *irq_entry = data; +int processed; + processed =idxd_desc_process (irq_entry);idxd_unmask_msix_vector (irq_entry->idxd, irq_entry->id); +/* catch anything unprocessed after unmasking */ + processed +=idxd_desc_process (irq_entry);if (processed ==0 )return IRQ_NONE ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 160/606 dmaengine: owl: Use correct lock in owl_dma_get_pchan()
In reply to Sasha LevinFrom: Cristian Ciocaltea <[email protected]>
commit f8f482deb078389b42768b2193e050a81aae137d upstream.
When the kernel is built with lockdep support and the owl-dma driver is used, the following message is shown:
[ 2.496939] INFO: trying to register non-static key. [ 2.501889] the code is fine but needs lockdep annotation. [ 2.507357] turning off the locking correctness validator. [ 2.512834] CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.6.3+ #15 [ 2.519084] Hardware name: Generic DT based system [ 2.523878] Workqueue: events_freezable mmc_rescan [ 2.528681] [<801127f0>] (unwind_backtrace) from [<8010da58>] (show_stack+0x10/0x14) [ 2.536420] [<8010da58>] (show_stack) from [<8080fbe8>] (dump_stack+0xb4/0xe0) [ 2.543645] [<8080fbe8>] (dump_stack) from [<8017efa4>] (register_lock_class+0x6f0/0x718) [ 2.551816] [<8017efa4>] (register_lock_class) from [<8017b7d0>] (__lock_acquire+0x78/0x25f0) [ 2.560330] [<8017b7d0>] (__lock_acquire) from [<8017e5e4>] (lock_acquire+0xd8/0x1f4) [ 2.568159] [<8017e5e4>] (lock_acquire) from [<80831fb0>] (_raw_spin_lock_irqsave+0x3c/0x50) [ 2.576589] [<80831fb0>] (_raw_spin_lock_irqsave) from [<8051b5fc>] (owl_dma_issue_pending+0xbc/0x120) [ 2.585884] [<8051b5fc>] (owl_dma_issue_pending) from [<80668cbc>] (owl_mmc_request+0x1b0/0x390) [ 2.594655] [<80668cbc>] (owl_mmc_request) from [<80650ce0>] (mmc_start_request+0x94/0xbc) [ 2.602906] [<80650ce0>] (mmc_start_request) from [<80650ec0>] (mmc_wait_for_req+0x64/0xd0) [ 2.611245] [<80650ec0>] (mmc_wait_for_req) from [<8065aa10>] (mmc_app_send_scr+0x10c/0x144) [ 2.619669] [<8065aa10>] (mmc_app_send_scr) from [<80659b3c>] (mmc_sd_setup_card+0x4c/0x318) [ 2.628092] [<80659b3c>] (mmc_sd_setup_card) from [<80659f0c>] (mmc_sd_init_card+0x104/0x430) [ 2.636601] [<80659f0c>] (mmc_sd_init_card) from [<8065a3e0>] (mmc_attach_sd+0xcc/0x16c) [ 2.644678] [<8065a3e0>] (mmc_attach_sd) from [<8065301c>] (mmc_rescan+0x3ac/0x40c) [ 2.652332] [<8065301c>] (mmc_rescan) from [<80143244>] (process_one_work+0x2d8/0x780) [ 2.660239] [<80143244>] (process_one_work) from [<80143730>] (worker_thread+0x44/0x598) [ 2.668323] [<80143730>] (worker_thread) from [<8014b5f8>] (kthread+0x148/0x150) [ 2.675708] [<8014b5f8>] (kthread) from [<801010b4>] (ret_from_fork+0x14/0x20) [ 2.682912] Exception stack(0xee8fdfb0 to 0xee8fdff8) [ 2.687954] dfa0: 00000000 00000000 00000000 00000000 [ 2.696118] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.704277] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
The obvious fix would be to use 'spin_lock_init()' on 'pchan->lock' before attempting to call 'spin_lock_irqsave()' in 'owl_dma_get_pchan()'.
However, according to Manivannan Sadhasivam, 'pchan->lock' was supposed to only protect 'pchan->vchan' while 'od->lock' does a similar job in 'owl_dma_terminate_pchan()'.
Therefore, this patch substitutes 'pchan->lock' with 'od->lock' and removes the 'lock' attribute in 'owl_dma_pchan' struct.
--- drivers/dma/owl-dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/owl-dma.c +3 -5
@@ -175,13 +175,11 @@ struct owl_dma_txd {* @id: physical index to this channel * @base: virtual memory base for the dma channel * @vchan: the virtual channel currently being served by this physical channel -* @lock: a lock to use when altering an instance of this struct */ struct owl_dma_pchan {u32 id;void __iomem *base;struct owl_dma_vchan *vchan; -spinlock_t lock; };/**
@@ -437,14 +435,14 @@ static struct owl_dma_pchan *owl_dma_get_pchan(struct owl_dma *od,for (i =0 ; i < od->nr_pchans; i++) { pchan = &od->pchans[i]; -spin_lock_irqsave (&pchan->lock, flags); +spin_lock_irqsave (&od->lock, flags);if (!pchan->vchan) { pchan->vchan = vchan; -spin_unlock_irqrestore (&pchan->lock, flags); +spin_unlock_irqrestore (&od->lock, flags);break ; } -spin_unlock_irqrestore (&pchan->lock, flags); +spin_unlock_irqrestore (&od->lock, flags); }return pchan;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 161/606 vsprintf: don't obfuscate NULL and error pointers
In reply to Sasha LevinFrom: Ilya Dryomov <[email protected]>
commit 7bd57fbc4a4ddedc664cad0bbced1b469e24e921 upstream.
I don't see what security concern is addressed by obfuscating NULL and IS_ERR() error pointers, printed with %p/%pK. Given the number of sites where %p is used (over 10000) and the fact that NULL pointers aren't uncommon, it probably wouldn't take long for an attacker to find the hash that corresponds to 0. Although harder, the same goes for most common error values, such as -1, -2, -11, -14, etc.
The NULL part actually fixes a regression: NULL pointers weren't obfuscated until commit 3e5903eb9cff ("vsprintf: Prevent crash when dereferencing invalid pointers") which went into 5.2. I'm tacking the IS_ERR() part on here because error pointers won't leak kernel addresses and printing them as pointers shouldn't be any different from e.g. %d with PTR_ERR_OR_ZERO(). Obfuscating them just makes debugging based on existing pr_debug and friends excruciating.
Note that the "always print 0's for %pK when kptr_restrict == 2" behaviour which goes way back is left as is.
Example output with the patch applied:
ptr error-ptr NULL
%p: 0000000001f8cc5b fffffffffffffff2 0000000000000000 %pK, kptr = 0: 0000000001f8cc5b fffffffffffffff2 0000000000000000 %px: ffff888048c04020 fffffffffffffff2 0000000000000000 %pK, kptr = 1: ffff888048c04020 fffffffffffffff2 0000000000000000 %pK, kptr = 2: 0000000000000000 0000000000000000 0000000000000000
--- lib/test_printf.c | 19 ++++++++++++++++++- lib/vsprintf.c | 7 +++++++ 2 files changed, 25 insertions(+), 1 deletion(-)
lib/test_printf.c +18 -1
@@ -214,6 +214,7 @@ test_string(void)#define PTR_STR "ffff0123456789ab"#define PTR_VAL_NO_CRNG "(____ptrval____)"#define ZEROS "00000000"/* hex 32 zero bits */ +#define ONES "ffffffff"/* hex 32 one bits */ static int __init plain_format (void )
@@ -245,6 +246,7 @@ plain_format(void)#define PTR_STR "456789ab"#define PTR_VAL_NO_CRNG "(ptrval)"#define ZEROS "" +#define ONES ""static int __init plain_format (void )
@@ -330,14 +332,28 @@ test_hashed(const char *fmt, const void *p)test (buf, fmt, p); } +/* +* NULL pointers aren't hashed. +*/ static void __init null_pointer (void ) { -test_hashed ("%p" ,NULL ); +test (ZEROS "00000000" ,"%p" ,NULL );test (ZEROS "00000000" ,"%px" ,NULL );test ("(null)" ,"%pE" ,NULL ); } +/* +* Error pointers aren't hashed. +*/ +static void __init +error_pointer (void ) +{ +test (ONES "fffffff5" ,"%p" ,ERR_PTR (-11 )); +test (ONES "fffffff5" ,"%px" ,ERR_PTR (-11 )); +test ("(efault)" ,"%pE" ,ERR_PTR (-11 )); +} +#define PTR_INVALID ((void *)0x000000ab) static void __init
@@ -649,6 +665,7 @@ test_pointer(void) {plain ();null_pointer (); +error_pointer ();invalid_pointer ();symbol_ptr ();kernel_ptr ();
lib/vsprintf.c +7 -0
@@ -794,6 +794,13 @@ static char *ptr_to_id(char *buf, char *end, const void *ptr,unsigned long hashval;int ret; +/* +* Print the real pointer value for NULL and error pointers, +* as they are not actual addresses. +*/ +if (IS_ERR_OR_NULL (ptr)) +return pointer_string (buf, end, ptr, spec); +/* When debugging early boot use non-cryptographically secure hash. */ if (unlikely (debug_boot_weak_hash)) { hashval =hash_long ((unsigned long )ptr,32 );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 162/606 drm/i915/gvt: Init DPLL/DDI vreg for virtual display instead of inheritance.
In reply to Sasha LevinFrom: Colin Xu <[email protected]>
commit f965b68188ab59a40a421ced1b05a2fea638465c upstream.
Init value of some display vregs rea inherited from host pregs. When host display in different status, i.e. all monitors unpluged, different display configurations, etc., GVT virtual display setup don't consistent thus may lead to guest driver consider display goes malfunctional.
The added init vreg values are based on PRMs and fixed by calcuation from current configuration (only PIPE_A) and the virtual EDID.
--- drivers/gpu/drm/i915/gvt/display.c | 49 +++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/gvt/display.c +44 -5
@@ -207,14 +207,41 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)SKL_FUSE_PG_DIST_STATUS (SKL_PG0 ) |SKL_FUSE_PG_DIST_STATUS (SKL_PG1 ) |SKL_FUSE_PG_DIST_STATUS (SKL_PG2 ); -vgpu_vreg_t (vgpu,LCPLL1_CTL ) |= -LCPLL_PLL_ENABLE | -LCPLL_PLL_LOCK ; -vgpu_vreg_t (vgpu,LCPLL2_CTL ) |=LCPLL_PLL_ENABLE ; - +/* +* Only 1 PIPE enabled in current vGPU display and PIPE_A is +* tied to TRANSCODER_A in HW, so it's safe to assume PIPE_A, +* TRANSCODER_A can be enabled. PORT_x depends on the input of +* setup_virtual_dp_monitor, we can bind DPLL0 to any PORT_x +* so we fixed to DPLL0 here. +* Setup DPLL0: DP link clk 1620 MHz, non SSC, DP Mode +*/ +vgpu_vreg_t (vgpu,DPLL_CTRL1 ) = +DPLL_CTRL1_OVERRIDE (DPLL_ID_SKL_DPLL0 ); +vgpu_vreg_t (vgpu,DPLL_CTRL1 ) |= +DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_1620 ,DPLL_ID_SKL_DPLL0 ); +vgpu_vreg_t (vgpu,LCPLL1_CTL ) = +LCPLL_PLL_ENABLE |LCPLL_PLL_LOCK ; +vgpu_vreg_t (vgpu,DPLL_STATUS ) =DPLL_LOCK (DPLL_ID_SKL_DPLL0 ); +/* +* Golden M/N are calculated based on: +* 24 bpp, 4 lanes, 154000 pixel clk (from virtual EDID), +* DP link clk 1620 MHz and non-constant_n. +* TODO: calculate DP link symbol clk and stream clk m/n. +*/ +vgpu_vreg_t (vgpu,PIPE_DATA_M1 (TRANSCODER_A )) =63 <<TU_SIZE_SHIFT ; +vgpu_vreg_t (vgpu,PIPE_DATA_M1 (TRANSCODER_A )) |=0x5b425e ; +vgpu_vreg_t (vgpu,PIPE_DATA_N1 (TRANSCODER_A )) =0x800000 ; +vgpu_vreg_t (vgpu,PIPE_LINK_M1 (TRANSCODER_A )) =0x3cd6e ; +vgpu_vreg_t (vgpu,PIPE_LINK_N1 (TRANSCODER_A )) =0x80000 ; }if (intel_vgpu_has_monitor_on_port (vgpu,PORT_B )) { +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) &= + ~DPLL_CTRL2_DDI_CLK_OFF (PORT_B ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_CLK_SEL (DPLL_ID_SKL_DPLL0 ,PORT_B ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_SEL_OVERRIDE (PORT_B );vgpu_vreg_t (vgpu,SFUSE_STRAP ) |=SFUSE_STRAP_DDIB_DETECTED ; vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -235,6 +262,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) }if (intel_vgpu_has_monitor_on_port (vgpu,PORT_C )) { +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) &= + ~DPLL_CTRL2_DDI_CLK_OFF (PORT_C ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_CLK_SEL (DPLL_ID_SKL_DPLL0 ,PORT_C ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_SEL_OVERRIDE (PORT_C );vgpu_vreg_t (vgpu,SDEISR ) |=SDE_PORTC_HOTPLUG_CPT ; vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -255,6 +288,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) }if (intel_vgpu_has_monitor_on_port (vgpu,PORT_D )) { +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) &= + ~DPLL_CTRL2_DDI_CLK_OFF (PORT_D ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_CLK_SEL (DPLL_ID_SKL_DPLL0 ,PORT_D ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_SEL_OVERRIDE (PORT_D );vgpu_vreg_t (vgpu,SDEISR ) |=SDE_PORTD_HOTPLUG_CPT ; vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sasha Levin
maintainerPATCH 163/606 drm/i915: Propagate error from completed fences
In reply to Sasha LevinFrom: Chris Wilson <[email protected]>
commit bc850943486887e3859597a266767f95db90aa72 upstream.
We need to preserve fatal errors from fences that are being terminated as we hook them up.
--- drivers/gpu/drm/i915/i915_request.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_request.c +3 -1
@@ -947,8 +947,10 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from)GEM_BUG_ON (to == from);GEM_BUG_ON (to->timeline == from->timeline); -if (i915_request_completed (from)) +if (i915_request_completed (from)) { +i915_sw_fence_set_error_once (&to->submit, from->fence.error);return 0 ; + }if (to->engine->schedule) { ret = i915_sched_node_add_dependency(&to->sched,
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sasha Levin
maintainerPATCH 164/606 Revert "gfs2: Don't demote a glock until its revokes are written"
In reply to Sasha LevinFrom: Bob Peterson <[email protected]>
[ Upstream commit b14c94908b1b884276a6608dea3d0b1b510338b7 ]
This reverts commit df5db5f9ee112e76b5202fbc331f990a0fc316d6.
This patch fixes a regression: patch df5db5f9ee112 allowed function run_queue() to bypass its call to do_xmote() if revokes were queued for the glock. That's wrong because its call to do_xmote() is what is responsible for calling the go_sync() glops functions to sync both the ail list and any revokes queued for it. By bypassing the call, gfs2 could get into a stand-off where the glock could not be demoted until its revokes are written back, but the revokes would not be written back because do_xmote() was never called.
It "sort of" works, however, because there are other mechanisms like the log flush daemon (logd) that can sync the ail items and revokes, if it deems it necessary. The problem is: without file system pressure, it might never deem it necessary.
--- fs/gfs2/glock.c | 3 --- 1 file changed, 3 deletions(-)
fs/gfs2/glock.c +0 -3
@@ -645,9 +645,6 @@ __acquires(&gl->gl_lockref.lock) goto out_unlock;if (nonblock) goto out_sched; -smp_mb (); -if (atomic_read (&gl->gl_revokes) !=0 ) - goto out_sched;set_bit (GLF_DEMOTE_IN_PROGRESS , &gl->gl_flags);GLOCK_BUG_ON (gl, gl->gl_demote_state ==LM_ST_EXCLUSIVE ); gl->gl_target = gl->gl_demote_state;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 165/606 virtio-balloon: Revert "virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM"
In reply to Sasha LevinFrom: "Michael S. Tsirkin" <[email protected]>
[ Upstream commit 835a6a649d0dd1b1f46759eb60fff2f63ed253a7 ]
This reverts commit 5a6b4cc5b7a1892a8d7f63d6cbac6e0ae2a9d031.
It has been queued properly in the akpm tree, this version is just creating conflicts.
--- drivers/virtio/virtio_balloon.c | 107 +++++++++++++++++++------------- 1 file changed, 63 insertions(+), 44 deletions(-)
drivers/virtio/virtio_balloon.c +63 -44
@@ -14,7 +14,6 @@#include <linux/slab.h> #include <linux/module.h> #include <linux/balloon_compaction.h> -#include <linux/oom.h> #include <linux/wait.h> #include <linux/mm.h> #include <linux/mount.h>
@@ -28,9 +27,7 @@*/ #define VIRTIO_BALLOON_PAGES_PER_PAGE (unsigned)(PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)#define VIRTIO_BALLOON_ARRAY_PFNS_MAX 256 -/* Maximum number of (4k) pages to deflate on OOM notifications. */ -#define VIRTIO_BALLOON_OOM_NR_PAGES 256 -#define VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY 80 +#define VIRTBALLOON_OOM_NOTIFY_PRIORITY 80#define VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG (__GFP_NORETRY | __GFP_NOWARN | \ __GFP_NOMEMALLOC)
@@ -115,11 +112,8 @@ struct virtio_balloon {/* Memory statistics */ struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR ]; -/* Shrinker to return free pages - VIRTIO_BALLOON_F_FREE_PAGE_HINT */ +/* To register a shrinker to shrink memory upon memory pressure */ struct shrinker shrinker; - -/* OOM notifier to deflate on OOM - VIRTIO_BALLOON_F_DEFLATE_ON_OOM */ -struct notifier_block oom_nb; };static struct virtio_device_id id_table[] = {
@@ -794,13 +788,50 @@ static unsigned long shrink_free_pages(struct virtio_balloon *vb,return blocks_freed *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; } +static unsigned long leak_balloon_pages (struct virtio_balloon *vb, +unsigned long pages_to_free) +{ +return leak_balloon (vb, pages_to_free *VIRTIO_BALLOON_PAGES_PER_PAGE ) / +VIRTIO_BALLOON_PAGES_PER_PAGE ; +} + +static unsigned long shrink_balloon_pages (struct virtio_balloon *vb, +unsigned long pages_to_free) +{ +unsigned long pages_freed =0 ; + +/* +* One invocation of leak_balloon can deflate at most +* VIRTIO_BALLOON_ARRAY_PFNS_MAX balloon pages, so we call it +* multiple times to deflate pages till reaching pages_to_free. +*/ +while (vb->num_pages && pages_freed < pages_to_free) + pages_freed +=leak_balloon_pages (vb, + pages_to_free - pages_freed); + +update_balloon_size (vb); + +return pages_freed; +} +static unsigned long virtio_balloon_shrinker_scan (struct shrinker *shrinker,struct shrink_control *sc) { +unsigned long pages_to_free, pages_freed =0 ;struct virtio_balloon *vb =container_of (shrinker, struct virtio_balloon, shrinker); -return shrink_free_pages (vb, sc->nr_to_scan); + pages_to_free = sc->nr_to_scan; + +if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) + pages_freed =shrink_free_pages (vb, pages_to_free); + +if (pages_freed >= pages_to_free) +return pages_freed; + + pages_freed +=shrink_balloon_pages (vb, pages_to_free - pages_freed); + +return pages_freed; } static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
@@ -808,22 +839,26 @@ static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker, {struct virtio_balloon *vb =container_of (shrinker, struct virtio_balloon, shrinker); +unsigned long count; + + count = vb->num_pages /VIRTIO_BALLOON_PAGES_PER_PAGE ; + count += vb->num_free_page_blocks *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; -return vb->num_free_page_blocks *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; +return count; } -static int virtio_balloon_oom_notify (struct notifier_block *nb, -unsigned long dummy,void *parm) +static void virtio_balloon_unregister_shrinker (struct virtio_balloon *vb) { -struct virtio_balloon *vb =container_of (nb, - struct virtio_balloon, oom_nb); -unsigned long *freed = parm; +unregister_shrinker (&vb->shrinker); +} - *freed +=leak_balloon (vb,VIRTIO_BALLOON_OOM_NR_PAGES ) / -VIRTIO_BALLOON_PAGES_PER_PAGE ; -update_balloon_size (vb); +static int virtio_balloon_register_shrinker (struct virtio_balloon *vb) +{ + vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; + vb->shrinker.count_objects = virtio_balloon_shrinker_count; + vb->shrinker.seeks =DEFAULT_SEEKS ; -return NOTIFY_OK ; +return register_shrinker (&vb->shrinker); }static int virtballoon_probe (struct virtio_device *vdev)
@@ -900,35 +935,22 @@ static int virtballoon_probe(struct virtio_device *vdev) virtio_cwrite(vb->vdev, struct virtio_balloon_config, poison_val, &poison_val); } - -/* -* We're allowed to reuse any free pages, even if they are -* still to be processed by the host. -*/ - vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; - vb->shrinker.count_objects = virtio_balloon_shrinker_count; - vb->shrinker.seeks =DEFAULT_SEEKS ; - err =register_shrinker (&vb->shrinker); + } +/* +* We continue to use VIRTIO_BALLOON_F_DEFLATE_ON_OOM to decide if a +* shrinker needs to be registered to relieve memory pressure. +*/ +if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) { + err =virtio_balloon_register_shrinker (vb);if (err) goto out_del_balloon_wq; } -if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) { - vb->oom_nb.notifier_call = virtio_balloon_oom_notify; - vb->oom_nb.priority =VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY ; - err =register_oom_notifier (&vb->oom_nb); -if (err <0 ) - goto out_unregister_shrinker; - } -virtio_device_ready (vdev);if (towards_target (vb))virtballoon_changed (vdev);return 0 ; -out_unregister_shrinker: -if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) -unregister_shrinker (&vb->shrinker); out_del_balloon_wq:if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT ))destroy_workqueue (vb->balloon_wq);
@@ -967,11 +989,8 @@ static void virtballoon_remove(struct virtio_device *vdev) {struct virtio_balloon *vb = vdev->priv; -if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) -unregister_oom_notifier (&vb->oom_nb); -if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) -unregister_shrinker (&vb->shrinker); - +if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) +virtio_balloon_unregister_shrinker (vb);spin_lock_irq (&vb->stop_update_lock); vb->stop_update = true;spin_unlock_irq (&vb->stop_update_lock);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 166/606 Revert "driver core: platform: Initialize dma_parms for platform devices"
In reply to Sasha Levin[ Upstream commit 1d2a14649ef5b5eb64ea5ce276d7df502bac4dbe ]
[ Upstream commit 885a64715fd81e6af6d94a038556e0b2e6deb19c ]
This reverts commit 7c8978c0837d40c302f5e90d24c298d9ca9fc097, a new version will come in the next release cycle.
--- drivers/base/platform.c | 2 -- include/linux/platform_device.h | 1 - 2 files changed, 3 deletions(-)
drivers/base/platform.c +0 -2
@@ -361,8 +361,6 @@ struct platform_object {*/ static void setup_pdev_dma_masks (struct platform_device *pdev) { - pdev->dev.dma_parms = &pdev->dma_parms; -if (!pdev->dev.coherent_dma_mask) pdev->dev.coherent_dma_mask =DMA_BIT_MASK (32 );if (!pdev->dev.dma_mask) {
include/linux/platform_device.h +0 -1
@@ -25,7 +25,6 @@ struct platform_device {bool id_auto;struct device dev;u64 platform_dma_mask; -struct device_dma_parameters dma_parms;u32 num_resources;struct resource *resource;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 167/606 tools/bootconfig: Fix apply_xbc() to return zero on success
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit 9d82ccda2bc5c148060543d249d54f8703741bb4 ]
The return of apply_xbc() returns the result of the last write() call, which is not what is expected. It should only return zero on success.
--- tools/bootconfig/main.c | 1 + 1 file changed, 1 insertion(+)
tools/bootconfig/main.c +1 -0
@@ -310,6 +310,7 @@ int apply_xbc(const char *path, const char *xbc_path)pr_err ("Failed to apply a boot config magic: %d\n" , ret); goto out; } + ret =0 ; out:close (fd);free (data);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 168/606 kbuild: Remove debug info from kallsyms linking
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit af73d78bd384aa9b8789aa6e7ddbb165f971276f ]
When CONFIG_DEBUG_INFO is enabled, the two kallsyms linking steps spend time collecting and writing the dwarf sections to the temporary output files. kallsyms does not need this information, and leaving it off halves their linking time. This is especially noticeable without CONFIG_DEBUG_INFO_REDUCED. The BTF linking stage, however, does still need those details.
Refactor the BTF and kallsyms generation stages slightly for more regularized temporary names. Skip debug during kallsyms links. Additionally move "info BTF" to the correct place since commit 8959e39272d6 ("kbuild: Parameterize kallsyms generation and correct reporting"), which added "info LD ..." to vmlinux_link calls.
For a full debug info build with BTF, my link time goes from 1m06s to 0m54s, saving about 12 seconds, or 18%.
--- scripts/link-vmlinux.sh | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
scripts/link-vmlinux.sh +19 -9
@@ -63,12 +63,18 @@ vmlinux_link() local lds="${objtree}/${KBUILD_LDS}" local output=${1} local objects + local strip_debug info LD ${output} # skip output file argument shift + # The kallsyms linking does not need debug symbols included. + if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then + strip_debug=-Wl,--strip-debug + fi + if [ "${SRCARCH}" != "um" ]; then objects="--whole-archive \ ${KBUILD_VMLINUX_OBJS} \
@@ -79,6 +85,7 @@ vmlinux_link() ${@}" ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \ + ${strip_debug#-Wl,} \ -o ${output} \ -T ${lds} ${objects} else
@@ -91,6 +98,7 @@ vmlinux_link() ${@}" ${CC} ${CFLAGS_vmlinux} \ + ${strip_debug} \ -o ${output} \ -Wl,-T,${lds} \ ${objects} \
@@ -106,6 +114,8 @@ gen_btf() { local pahole_ver local bin_arch + local bin_format + local bin_file if ! [ -x "$(command -v ${PAHOLE})" ]; then echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available"
@@ -118,8 +128,9 @@ gen_btf() return 1 fi - info "BTF" ${2} vmlinux_link ${1} + + info "BTF" ${2} LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} # dump .BTF section into raw binary file to link with final vmlinux
@@ -127,11 +138,12 @@ gen_btf() cut -d, -f1 | cut -d' ' -f2) bin_format=$(LANG=C ${OBJDUMP} -f ${1} | grep 'file format' | \ awk '{print $4}') + bin_file=.btf.vmlinux.bin ${OBJCOPY} --change-section-address .BTF=0 \ --set-section-flags .BTF=alloc -O binary \ - --only-section=.BTF ${1} .btf.vmlinux.bin + --only-section=.BTF ${1} $bin_file ${OBJCOPY} -I binary -O ${bin_format} -B ${bin_arch} \ - --rename-section .data=.BTF .btf.vmlinux.bin ${2} + --rename-section .data=.BTF $bin_file ${2} } # Create ${2} .o file with all symbols from the ${1} object file
@@ -166,8 +178,8 @@ kallsyms() kallsyms_step() { kallsymso_prev=${kallsymso} - kallsymso=.tmp_kallsyms${1}.o - kallsyms_vmlinux=.tmp_vmlinux${1} + kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1} + kallsymso=${kallsyms_vmlinux}.o vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o} kallsyms ${kallsyms_vmlinux} ${kallsymso}
@@ -190,7 +202,6 @@ cleanup() { rm -f .btf.* rm -f .tmp_System.map - rm -f .tmp_kallsyms* rm -f .tmp_vmlinux* rm -f System.map rm -f vmlinux
@@ -257,9 +268,8 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' | btf_vmlinux_bin_o="" if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then - if gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then - btf_vmlinux_bin_o=.btf.vmlinux.bin.o - else + btf_vmlinux_bin_o=.btf.vmlinux.bin.o + if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then echo >&2 "Failed to generate BTF for vmlinux" echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF" exit 1
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 169/606 staging: iio: ad2s1210: Fix SPI reading
In reply to Sasha LevinFrom: Dragos Bogdan <[email protected]>
commit 5e4f99a6b788047b0b8a7496c2e0c8f372f6edf2 upstream.
If the serial interface is used, the 8-bit address should be latched using the rising edge of the WR/FSYNC signal.
This basically means that a CS change is required between the first byte sent, and the second one.
This change splits the single-transfer transfer of 2 bytes into 2 transfers with a single byte, and CS change in-between.
Note fixes tag is not accurate, but reflects a point beyond which there are too many refactors to make backporting straight forward.
--- drivers/staging/iio/resolver/ad2s1210.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/staging/iio/resolver/ad2s1210.c +12 -5
@@ -130,17 +130,24 @@ static int ad2s1210_config_write(struct ad2s1210_state *st, u8 data)static int ad2s1210_config_read (struct ad2s1210_state *st,unsigned char address) { -struct spi_transfer xfer = { - .len =2 , - .rx_buf = st->rx, - .tx_buf = st->tx, +struct spi_transfer xfers[] = { + { + .len =1 , + .rx_buf = &st->rx[0 ], + .tx_buf = &st->tx[0 ], + .cs_change =1 , + }, { + .len =1 , + .rx_buf = &st->rx[1 ], + .tx_buf = &st->tx[1 ], + }, };int ret =0 ;ad2s1210_set_mode (MOD_CONFIG , st); st->tx[0 ] = address |AD2S1210_MSB_IS_HIGH ; st->tx[1 ] =AD2S1210_REG_FAULT ; - ret =spi_sync_transfer (st->sdev, &xfer,1 ); + ret =spi_sync_transfer (st->sdev, xfers,2 );if (ret <0 )return ret;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 170/606 staging: wfx: unlock on error path
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
commit f0b9d875faa4499afe3381404c3795e9da84bc00 upstream.
We need to release the tx_lock on the error path before returning.
--- drivers/staging/wfx/scan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/wfx/scan.c +3 -1
@@ -57,8 +57,10 @@ static int send_scan_req(struct wfx_vif *wvif, wvif->scan_abort = false;reinit_completion (&wvif->scan_complete); timeout =hif_scan (wvif, req, start_idx, i - start_idx); -if (timeout <0 ) +if (timeout <0 ) { +wfx_tx_unlock (wvif->wdev);return timeout; + } ret =wait_for_completion_timeout (&wvif->scan_complete, timeout);if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)hif_set_output_power (wvif, wvif->vif->bss_conf.txpower);
Signature · 1 line
2.25.1