diff options
author | Patrick Tjin <pattjin@google.com> | 2016-08-09 10:56:20 -0700 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2016-08-09 10:56:20 -0700 |
commit | 9d3a4ad546cb60c70f9e39a8206bb0dc40310a97 (patch) | |
tree | b4462c4d74650dfcad7bcc3d561c7090e2e81a39 | |
parent | ff4302401bfd18772fc5fd96e116e408250b1ddf (diff) | |
parent | 851412f11a7b52c96d5f456f0ccac9d395c8baeb (diff) |
Merge branch 'android-msm-bullhead-3.10-nyc-security-next' into android-msm-bullhead-3.10-nycandroid-7.0.0_r0.17
-rw-r--r-- | drivers/staging/android/ashmem.c | 42 | ||||
-rw-r--r-- | net/ipc_router/ipc_router_core.c | 4 |
2 files changed, 22 insertions, 24 deletions
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 808acd4b90dd..ee79ac8d90d6 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -766,11 +766,28 @@ static long compat_ashmem_ioctl(struct file *file, unsigned int cmd, unsigned lo } #endif +static const struct file_operations ashmem_fops = { + .owner = THIS_MODULE, + .open = ashmem_open, + .release = ashmem_release, + .read = ashmem_read, + .llseek = ashmem_llseek, + .mmap = ashmem_mmap, + .unlocked_ioctl = ashmem_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = compat_ashmem_ioctl, +#endif +}; + +static struct miscdevice ashmem_misc = { + .minor = MISC_DYNAMIC_MINOR, + .name = "ashmem", + .fops = &ashmem_fops, +}; + static int is_ashmem_file(struct file *file) { - char fname[256], *name; - name = dentry_path(file->f_dentry, fname, 256); - return strcmp(name, "/ashmem") ? 0 : 1; + return (file->f_op == &ashmem_fops); } int get_ashmem_file(int fd, struct file **filp, struct file **vm_file, @@ -819,25 +836,6 @@ void put_ashmem_file(struct file *file) } EXPORT_SYMBOL(put_ashmem_file); -static const struct file_operations ashmem_fops = { - .owner = THIS_MODULE, - .open = ashmem_open, - .release = ashmem_release, - .read = ashmem_read, - .llseek = ashmem_llseek, - .mmap = ashmem_mmap, - .unlocked_ioctl = ashmem_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = compat_ashmem_ioctl, -#endif -}; - -static struct miscdevice ashmem_misc = { - .minor = MISC_DYNAMIC_MINOR, - .name = "ashmem", - .fops = &ashmem_fops, -}; - static int __init ashmem_init(void) { int ret; diff --git a/net/ipc_router/ipc_router_core.c b/net/ipc_router/ipc_router_core.c index 7106ba2bce4c..12f264a00d86 100644 --- a/net/ipc_router/ipc_router_core.c +++ b/net/ipc_router/ipc_router_core.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -3279,7 +3279,7 @@ int msm_ipc_router_get_curr_pkt_size(struct msm_ipc_port *port_ptr) int msm_ipc_router_bind_control_port(struct msm_ipc_port *port_ptr) { - if (!port_ptr) + if (unlikely(!port_ptr || port_ptr->type != CLIENT_PORT)) return -EINVAL; down_write(&local_ports_lock_lhc2); |