Skip to content

Commit

Permalink
Merge tag 'LA.UM.8.3.c25-01900-sdm845.0' into canting-4.9-q
Browse files Browse the repository at this point in the history
"LA.UM.8.3.c25-01900-sdm845.0"

* tag 'LA.UM.8.3.c25-01900-sdm845.0' of https://source.codeaurora.org/quic/la/kernel/msm-4.9:
  msm: adsprpc: overflow vulnerability by race condition in adsprpc driver
  crypto: Fix possible stack out-of-bound error
  net:sockev: hold file reference till the sock event is sent
  msm: kgsl: Access map_count only if entry is successfully allocated

Signed-off-by: Khusika Dhamar Gusti <mail@khusika.com>
  • Loading branch information
Khusika Dhamar Gusti committed May 6, 2021
2 parents 31d0edd + c86a1b0 commit 5010d0a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
12 changes: 8 additions & 4 deletions drivers/char/adsprpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3604,22 +3604,26 @@ static int fastrpc_set_process_info(struct fastrpc_file *fl)
{
int err = 0, buf_size = 0;
char strpid[PID_SIZE];
char cur_comm[TASK_COMM_LEN];

memcpy(cur_comm, current->comm, TASK_COMM_LEN);
cur_comm[TASK_COMM_LEN-1] = '\0';
fl->tgid = current->tgid;
snprintf(strpid, PID_SIZE, "%d", current->pid);
buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
buf_size = strlen(cur_comm) + strlen("_") + strlen(strpid) + 1;
fl->debug_buf = kzalloc(buf_size, GFP_KERNEL);
if (!fl->debug_buf) {
err = -ENOMEM;
return err;
}
snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
current->comm, "_", current->pid);
snprintf(fl->debug_buf, buf_size, "%.10s%s%d",
cur_comm, "_", current->pid);
fl->debugfs_file = debugfs_create_file(fl->debug_buf, 0644,
debugfs_root, fl, &debugfs_fops);
if (!fl->debugfs_file)
pr_warn("Error: %s: %s: failed to create debugfs file %s\n",
current->comm, __func__, fl->debug_buf);
cur_comm, __func__, fl->debug_buf);

return err;
}

Expand Down
12 changes: 11 additions & 1 deletion drivers/crypto/msm/qce50.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* QTI Crypto Engine driver.
*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, 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
Expand Down Expand Up @@ -870,6 +870,11 @@ static int _ce_setup_cipher(struct qce_device *pce_dev, struct qce_req *creq,
break;
case CIPHER_ALG_3DES:
if (creq->mode != QCE_MODE_ECB) {
if (ivsize > MAX_IV_LENGTH) {
pr_err("%s: error: Invalid length parameter\n",
__func__);
return -EINVAL;
}
_byte_stream_to_net_words(enciv32, creq->iv, ivsize);
pce = cmdlistinfo->encr_cntr_iv;
pce->data = enciv32[0];
Expand Down Expand Up @@ -918,6 +923,11 @@ static int _ce_setup_cipher(struct qce_device *pce_dev, struct qce_req *creq,
}
}
if (creq->mode != QCE_MODE_ECB) {
if (ivsize > MAX_IV_LENGTH) {
pr_err("%s: error: Invalid length parameter\n",
__func__);
return -EINVAL;
}
if (creq->mode == QCE_MODE_XTS)
_byte_stream_swap_to_net_words(enciv32,
creq->iv, ivsize);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/msm/kgsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ kgsl_mem_entry_create(void)
kref_init(&entry->refcount);
/* put this ref in userspace memory alloc and map ioctls */
kref_get(&entry->refcount);
atomic_set(&entry->map_count, 0);
}

atomic_set(&entry->map_count, 0);
return entry;
}
#ifdef CONFIG_DMA_SHARED_BUFFER
Expand Down
6 changes: 4 additions & 2 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,9 +1426,10 @@ SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
(struct sockaddr *)
&address, addrlen);
}
fput_light(sock->file, fput_needed);
if (!err)
sockev_notify(SOCKEV_BIND, sock);

fput_light(sock->file, fput_needed);
}
return err;
}
Expand All @@ -1455,9 +1456,10 @@ SYSCALL_DEFINE2(listen, int, fd, int, backlog)
if (!err)
err = sock->ops->listen(sock, backlog);

fput_light(sock->file, fput_needed);
if (!err)
sockev_notify(SOCKEV_LISTEN, sock);

fput_light(sock->file, fput_needed);
}
return err;
}
Expand Down

0 comments on commit 5010d0a

Please sign in to comment.