diff options
author | Tao Huang <huangtao@rock-chips.com> | 2018-03-09 19:10:14 +0800 |
---|---|---|
committer | Tao Huang <huangtao@rock-chips.com> | 2018-03-09 19:10:14 +0800 |
commit | 3430c68a3392feaf989ed276a09e57963ed62619 (patch) | |
tree | aba845aa51d491466af22a5dd60d583121486335 /drivers/android | |
parent | b8856eb8db049ab7fe1813b0281b6698caf6d68c (diff) | |
parent | 6aa8d8c0cd18d30d4a80367222eca75a0c2591ff (diff) |
Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux-linaro-stable.git
* linux-linaro-lsk-v4.4-android: (660 commits)
ANDROID: keychord: Check for write data size
ANDROID: sdcardfs: Set num in extension_details during make_item
ANDROID: sdcardfs: Hold i_mutex for i_size_write
BACKPORT, FROMGIT: crypto: speck - add test vectors for Speck64-XTS
BACKPORT, FROMGIT: crypto: speck - add test vectors for Speck128-XTS
BACKPORT, FROMGIT: crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS
FROMGIT: crypto: speck - export common helpers
BACKPORT, FROMGIT: crypto: speck - add support for the Speck block cipher
UPSTREAM: ANDROID: binder: synchronize_rcu() when using POLLFREE.
f2fs: updates on v4.16-rc1
BACKPORT: tee: shm: Potential NULL dereference calling tee_shm_register()
BACKPORT: tee: shm: don't put_page on null shm->pages
BACKPORT: tee: shm: make function __tee_shm_alloc static
BACKPORT: tee: optee: check type of registered shared memory
BACKPORT: tee: add start argument to shm_register callback
BACKPORT: tee: optee: fix header dependencies
BACKPORT: tee: shm: inline tee_shm_get_id()
BACKPORT: tee: use reference counting for tee_context
BACKPORT: tee: optee: enable dynamic SHM support
BACKPORT: tee: optee: add optee-specific shared pool implementation
...
Conflicts:
drivers/irqchip/Kconfig
drivers/media/i2c/tc35874x.c
drivers/media/v4l2-core/v4l2-compat-ioctl32.c
drivers/usb/gadget/function/f_fs.c
fs/f2fs/node.c
Change-Id: Icecd73a515821b536fa3d81ea91b63d9b3699916
Diffstat (limited to 'drivers/android')
-rw-r--r-- | drivers/android/binder.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 87ab35bae6b0..1fe8ab0144c6 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -4473,8 +4473,29 @@ static int binder_thread_release(struct binder_proc *proc, if (t) spin_lock(&t->lock); } + + /* + * If this thread used poll, make sure we remove the waitqueue + * from any epoll data structures holding it with POLLFREE. + * waitqueue_active() is safe to use here because we're holding + * the inner lock. + */ + if ((thread->looper & BINDER_LOOPER_STATE_POLL) && + waitqueue_active(&thread->wait)) { + wake_up_poll(&thread->wait, POLLHUP | POLLFREE); + } + binder_inner_proc_unlock(thread->proc); + /* + * This is needed to avoid races between wake_up_poll() above and + * and ep_remove_waitqueue() called for other reasons (eg the epoll file + * descriptor being closed); ep_remove_waitqueue() holds an RCU read + * lock, so we can be sure it's done after calling synchronize_rcu(). + */ + if (thread->looper & BINDER_LOOPER_STATE_POLL) + synchronize_rcu(); + if (send_reply) binder_send_failed_reply(send_reply, BR_DEAD_REPLY); binder_release_work(proc, &thread->todo); @@ -4490,6 +4511,8 @@ static unsigned int binder_poll(struct file *filp, bool wait_for_proc_work; thread = binder_get_thread(proc); + if (!thread) + return POLLERR; binder_inner_proc_lock(thread->proc); thread->looper |= BINDER_LOOPER_STATE_POLL; |