Skip to content

Commit

Permalink
net: ipc_router: fix NULL pointer de-reference issue
Browse files Browse the repository at this point in the history
Fail cases of accept() system call on AF_MSM_IPC socket family causes
NULL pointer de-reference of sock structure variable in release operation.

Validate the sock structure pointer before using it in release operation.

CRs-Fixed: 1068888
Change-Id: I5637e52be59ea9504ea6ae317394bef0c28c7865
Signed-off-by: Arun Kumar Neelakantam <[email protected]>
mh0rst: Backport
Fixes: CVE-2016-5870
Signed-off-by: Joel Stanley <[email protected]>
Signed-off-by: Francisco Franco <[email protected]>
  • Loading branch information
Arun Kumar Neelakantam authored and franciscofranco committed Dec 9, 2017
1 parent 890cadd commit 1959830
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/arm/mach-msm/ipc_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,19 @@ static unsigned int msm_ipc_router_poll(struct file *file,
static int msm_ipc_router_close(struct socket *sock)
{
struct sock *sk = sock->sk;
struct msm_ipc_port *port_ptr = msm_ipc_sk_port(sk);
struct msm_ipc_port *port_ptr;
void *pil = msm_ipc_sk(sk)->default_pil;
int ret;

if (!sk)
return -EINVAL;

lock_sock(sk);
port_ptr = msm_ipc_sk_port(sk);
if (!port_ptr) {
release_sock(sk);
return -EINVAL;
}
ret = msm_ipc_router_close_port(port_ptr);
if (pil)
msm_ipc_unload_default_node(pil);
Expand Down

0 comments on commit 1959830

Please sign in to comment.