Char/Misc driver fixes for 4.14-rc6
Here are 4 small fixes for 4.14-rc6. 3 of them are binder driver fixes for reported issues, and the last one is a hyperv driver bugfix. Nothing major, but good fixes to get into 4.14-final. All of these have been in linux-next with no reported issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWe2YnQ8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ynN0ACdEfXVOyAcxhfxZzMBGL75sZhoh7IAnjGujCET +MxZZKMNFD76V0Zply+2 =C8Pu -----END PGP SIGNATURE----- Merge tag 'char-misc-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc driver fixes from Greg KH: "Here are four small fixes for 4.14-rc6. Three of them are binder driver fixes for reported issues, and the last one is a hyperv driver bugfix. Nothing major, but good fixes to get into 4.14-final. All of these have been in linux-next with no reported issues" * tag 'char-misc-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: android: binder: Fix null ptr dereference in debug msg android: binder: Don't get mm from task vmbus: hvsock: add proper sync for vmbus_hvsock_device_unregister() binder: call poll_wait() unconditionally.
This commit is contained in:
commit
17e7637f59
@ -3662,12 +3662,6 @@ static void binder_stat_br(struct binder_proc *proc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int binder_has_thread_work(struct binder_thread *thread)
|
|
||||||
{
|
|
||||||
return !binder_worklist_empty(thread->proc, &thread->todo) ||
|
|
||||||
thread->looper_need_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int binder_put_node_cmd(struct binder_proc *proc,
|
static int binder_put_node_cmd(struct binder_proc *proc,
|
||||||
struct binder_thread *thread,
|
struct binder_thread *thread,
|
||||||
void __user **ptrp,
|
void __user **ptrp,
|
||||||
@ -4297,12 +4291,9 @@ static unsigned int binder_poll(struct file *filp,
|
|||||||
|
|
||||||
binder_inner_proc_unlock(thread->proc);
|
binder_inner_proc_unlock(thread->proc);
|
||||||
|
|
||||||
if (binder_has_work(thread, wait_for_proc_work))
|
|
||||||
return POLLIN;
|
|
||||||
|
|
||||||
poll_wait(filp, &thread->wait, wait);
|
poll_wait(filp, &thread->wait, wait);
|
||||||
|
|
||||||
if (binder_has_thread_work(thread))
|
if (binder_has_work(thread, wait_for_proc_work))
|
||||||
return POLLIN;
|
return POLLIN;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -215,17 +215,12 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vma && need_mm)
|
if (!vma && need_mm && mmget_not_zero(alloc->vma_vm_mm))
|
||||||
mm = get_task_mm(alloc->tsk);
|
mm = alloc->vma_vm_mm;
|
||||||
|
|
||||||
if (mm) {
|
if (mm) {
|
||||||
down_write(&mm->mmap_sem);
|
down_write(&mm->mmap_sem);
|
||||||
vma = alloc->vma;
|
vma = alloc->vma;
|
||||||
if (vma && mm != alloc->vma_vm_mm) {
|
|
||||||
pr_err("%d: vma mm and task mm mismatch\n",
|
|
||||||
alloc->pid);
|
|
||||||
vma = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vma && need_mm) {
|
if (!vma && need_mm) {
|
||||||
@ -565,7 +560,7 @@ static void binder_delete_free_buffer(struct binder_alloc *alloc,
|
|||||||
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC,
|
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC,
|
||||||
"%d: merge free, buffer %pK do not share page with %pK or %pK\n",
|
"%d: merge free, buffer %pK do not share page with %pK or %pK\n",
|
||||||
alloc->pid, buffer->data,
|
alloc->pid, buffer->data,
|
||||||
prev->data, next->data);
|
prev->data, next ? next->data : NULL);
|
||||||
binder_update_page_range(alloc, 0, buffer_start_page(buffer),
|
binder_update_page_range(alloc, 0, buffer_start_page(buffer),
|
||||||
buffer_start_page(buffer) + PAGE_SIZE,
|
buffer_start_page(buffer) + PAGE_SIZE,
|
||||||
NULL);
|
NULL);
|
||||||
@ -720,6 +715,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc,
|
|||||||
barrier();
|
barrier();
|
||||||
alloc->vma = vma;
|
alloc->vma = vma;
|
||||||
alloc->vma_vm_mm = vma->vm_mm;
|
alloc->vma_vm_mm = vma->vm_mm;
|
||||||
|
mmgrab(alloc->vma_vm_mm);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -795,6 +791,8 @@ void binder_alloc_deferred_release(struct binder_alloc *alloc)
|
|||||||
vfree(alloc->buffer);
|
vfree(alloc->buffer);
|
||||||
}
|
}
|
||||||
mutex_unlock(&alloc->mutex);
|
mutex_unlock(&alloc->mutex);
|
||||||
|
if (alloc->vma_vm_mm)
|
||||||
|
mmdrop(alloc->vma_vm_mm);
|
||||||
|
|
||||||
binder_alloc_debug(BINDER_DEBUG_OPEN_CLOSE,
|
binder_alloc_debug(BINDER_DEBUG_OPEN_CLOSE,
|
||||||
"%s: %d buffers %d, pages %d\n",
|
"%s: %d buffers %d, pages %d\n",
|
||||||
@ -889,7 +887,6 @@ int binder_alloc_get_allocated_count(struct binder_alloc *alloc)
|
|||||||
void binder_alloc_vma_close(struct binder_alloc *alloc)
|
void binder_alloc_vma_close(struct binder_alloc *alloc)
|
||||||
{
|
{
|
||||||
WRITE_ONCE(alloc->vma, NULL);
|
WRITE_ONCE(alloc->vma, NULL);
|
||||||
WRITE_ONCE(alloc->vma_vm_mm, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -926,9 +923,9 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
|
|||||||
page_addr = (uintptr_t)alloc->buffer + index * PAGE_SIZE;
|
page_addr = (uintptr_t)alloc->buffer + index * PAGE_SIZE;
|
||||||
vma = alloc->vma;
|
vma = alloc->vma;
|
||||||
if (vma) {
|
if (vma) {
|
||||||
mm = get_task_mm(alloc->tsk);
|
if (!mmget_not_zero(alloc->vma_vm_mm))
|
||||||
if (!mm)
|
goto err_mmget;
|
||||||
goto err_get_task_mm_failed;
|
mm = alloc->vma_vm_mm;
|
||||||
if (!down_write_trylock(&mm->mmap_sem))
|
if (!down_write_trylock(&mm->mmap_sem))
|
||||||
goto err_down_write_mmap_sem_failed;
|
goto err_down_write_mmap_sem_failed;
|
||||||
}
|
}
|
||||||
@ -963,7 +960,7 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
|
|||||||
|
|
||||||
err_down_write_mmap_sem_failed:
|
err_down_write_mmap_sem_failed:
|
||||||
mmput_async(mm);
|
mmput_async(mm);
|
||||||
err_get_task_mm_failed:
|
err_mmget:
|
||||||
err_page_already_freed:
|
err_page_already_freed:
|
||||||
mutex_unlock(&alloc->mutex);
|
mutex_unlock(&alloc->mutex);
|
||||||
err_get_alloc_mutex_failed:
|
err_get_alloc_mutex_failed:
|
||||||
@ -1002,7 +999,6 @@ struct shrinker binder_shrinker = {
|
|||||||
*/
|
*/
|
||||||
void binder_alloc_init(struct binder_alloc *alloc)
|
void binder_alloc_init(struct binder_alloc *alloc)
|
||||||
{
|
{
|
||||||
alloc->tsk = current->group_leader;
|
|
||||||
alloc->pid = current->group_leader->pid;
|
alloc->pid = current->group_leader->pid;
|
||||||
mutex_init(&alloc->mutex);
|
mutex_init(&alloc->mutex);
|
||||||
INIT_LIST_HEAD(&alloc->buffers);
|
INIT_LIST_HEAD(&alloc->buffers);
|
||||||
|
@ -100,7 +100,6 @@ struct binder_lru_page {
|
|||||||
*/
|
*/
|
||||||
struct binder_alloc {
|
struct binder_alloc {
|
||||||
struct mutex mutex;
|
struct mutex mutex;
|
||||||
struct task_struct *tsk;
|
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
struct mm_struct *vma_vm_mm;
|
struct mm_struct *vma_vm_mm;
|
||||||
void *buffer;
|
void *buffer;
|
||||||
|
@ -937,7 +937,10 @@ void vmbus_hvsock_device_unregister(struct vmbus_channel *channel)
|
|||||||
{
|
{
|
||||||
BUG_ON(!is_hvsock_channel(channel));
|
BUG_ON(!is_hvsock_channel(channel));
|
||||||
|
|
||||||
channel->rescind = true;
|
/* We always get a rescind msg when a connection is closed. */
|
||||||
|
while (!READ_ONCE(channel->probe_done) || !READ_ONCE(channel->rescind))
|
||||||
|
msleep(1);
|
||||||
|
|
||||||
vmbus_device_unregister(channel->device_obj);
|
vmbus_device_unregister(channel->device_obj);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister);
|
EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister);
|
||||||
|
Loading…
Reference in New Issue
Block a user