Skip to content

Commit

Permalink
Merge branch 'lineage-16.0' into pie
Browse files Browse the repository at this point in the history
* lineage-16.0: (37 commits)
  lib/mpi: Fix karactx leak in mpi_powm
  ALSA: seq: fix incorrect order of dest_client/dest_ports arguments
  crypto: user - prevent operating on larval algorithms
  Bluetooth: Fix faulty expression for minimum encryption key size check
  bonding: Always enable vlan tx offload
  ipv4: Use return value of inet_iif() for __raw_v4_lookup in the while loop
  team: Always enable vlan tx offload
  sctp: change to hold sk after auth shkey is created successfully
  Abort file_remove_privs() for non-reg. files
  perf help: Remove needless use of strncpy()
  cfg80211: fix memory leak of wiphy device name
  SMB3: retry on STATUS_INSUFFICIENT_RESOURCES instead of failing write
  Bluetooth: Fix regression with minimum encryption key size alignment
  Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
  can: purge socket error queue on sock destruct
  btrfs: start readahead also in seed devices
  Btrfs: fix race between readahead and device replace/removal
  apparmor: enforce nullbyte at end of tag string
  Input: uinput - add compat ioctl number translation for UI_*_FF_UPLOAD
  tracing: Silence GCC 9 array bounds warning
  ...

Signed-off-by: Albert I <[email protected]>
  • Loading branch information
krasCGQ committed Jul 11, 2019
2 parents 7fe73b9 + d18a2e7 commit 81a7cab
Show file tree
Hide file tree
Showing 46 changed files with 463 additions and 185 deletions.
4 changes: 2 additions & 2 deletions arch/arm/boot/dts/qcom/apq8009w-memory.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2019, 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 All @@ -12,7 +12,7 @@
*/

&external_image_mem {
reg = <0x0 0x87b00000 0x0 0x0500000>;
reg = <0x0 0x87a00000 0x0 0x0600000>;
};

&modem_adsp_mem {
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/boot/dts/qcom/apq8009w-nowgr-memory.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2019, 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 All @@ -12,7 +12,7 @@
*/

&external_image_mem {
reg = <0x0 0x87b00000 0x0 0x0500000>;
reg = <0x0 0x87a00000 0x0 0x0600000>;
};

&modem_adsp_mem {
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/boot/dts/qcom/msm8909w-memory.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2019, 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 All @@ -12,7 +12,7 @@
*/

&external_image_mem {
reg = <0x0 0x87b00000 0x0 0x0500000>;
reg = <0x0 0x87a00000 0x0 0x0600000>;
};

&modem_adsp_mem {
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/configs/msm_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ CONFIG_USB_GADGET_DEBUG_FILES=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_RTC_CLASS=y
CONFIG_STAGING=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
CONFIG_EXT4_FS=y
CONFIG_FUSE_FS=y
CONFIG_VFAT_FS=y
Expand Down
4 changes: 0 additions & 4 deletions arch/arm64/configs/msm-perf_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,6 @@ CONFIG_CORESIGHT_HWEVENT=y
CONFIG_CORESIGHT_QPDI=y
CONFIG_SENSORS_SSC=y
CONFIG_MSM_TZ_LOG=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_QUOTA=y
Expand Down
4 changes: 0 additions & 4 deletions arch/arm64/configs/msm_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,6 @@ CONFIG_CORESIGHT_REMOTE_ETM=y
CONFIG_CORESIGHT_QPDI=y
CONFIG_SENSORS_SSC=y
CONFIG_MSM_TZ_LOG=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_QUOTA=y
Expand Down
3 changes: 3 additions & 0 deletions crypto/crypto_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ static struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact)
list_for_each_entry(q, &crypto_alg_list, cra_list) {
int match = 0;

if (crypto_is_larval(q))
continue;

if ((q->cra_flags ^ p->cru_type) & p->cru_mask)
continue;

Expand Down
59 changes: 40 additions & 19 deletions drivers/char/adsprpc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2019, 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 @@ -155,9 +155,11 @@ struct smq_invoke_ctx {
int tgid;
remote_arg_t *lpra;
remote_arg64_t *rpra;
remote_arg64_t *lrpra; /* Local copy of rpra for put_args */
int *fds;
struct fastrpc_mmap **maps;
struct fastrpc_buf *buf;
struct fastrpc_buf *lbuf;
size_t used;
struct fastrpc_file *fl;
uint32_t sc;
Expand Down Expand Up @@ -959,6 +961,7 @@ static void context_free(struct smq_invoke_ctx *ctx)
for (i = 0; i < nbufs; ++i)
fastrpc_mmap_free(ctx->maps[i]);
fastrpc_buf_free(ctx->buf, 1);
fastrpc_buf_free(ctx->lbuf, 1);
ctx->magic = 0;
ctx->ctxid = 0;

Expand Down Expand Up @@ -1071,7 +1074,7 @@ static void fastrpc_file_list_dtor(struct fastrpc_apps *me)

static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
{
remote_arg64_t *rpra;
remote_arg64_t *rpra, *lrpra;
remote_arg_t *lpra = ctx->lpra;
struct smq_invoke_buf *list;
struct smq_phy_page *pages, *ipage;
Expand All @@ -1080,10 +1083,11 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
int outbufs = REMOTE_SCALARS_OUTBUFS(sc);
int bufs = inbufs + outbufs;
uintptr_t args;
size_t rlen = 0, copylen = 0, metalen = 0;
size_t rlen = 0, copylen = 0, metalen = 0, lrpralen = 0;
int i, inh, oix;
int err = 0;
int mflags = 0;
DEFINE_DMA_ATTRS(ctx_attrs);

/* calculate size of the metadata */
rpra = NULL;
Expand All @@ -1100,7 +1104,22 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
ipage += 1;
}
metalen = copylen = (size_t)&ipage[0];
/* calculate len requreed for copying */

/* allocate new local rpra buffer */
lrpralen = (u64)(uintptr_t)&list[0];
if (lrpralen) {
err = fastrpc_buf_alloc(ctx->fl, lrpralen,
ctx_attrs, 0, 0, &ctx->lbuf);
if (err)
goto bail;
}
if (ctx->lbuf->virt)
memset(ctx->lbuf->virt, 0, lrpralen);

lrpra = ctx->lbuf->virt;
ctx->lrpra = lrpra;

/* calculate len required for copying */
for (oix = 0; oix < inbufs + outbufs; ++oix) {
int i = ctx->overps[oix]->raix;
uintptr_t mstart, mend;
Expand All @@ -1126,8 +1145,6 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)

/* allocate new buffer */
if (copylen) {
DEFINE_DMA_ATTRS(ctx_attrs);

err = fastrpc_buf_alloc(ctx->fl, copylen, ctx_attrs,
0, 0, &ctx->buf);
if (err)
Expand All @@ -1152,13 +1169,13 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
ipage++;
}
/* map ion buffers */
for (i = 0; i < inbufs + outbufs; ++i) {
for (i = 0; rpra && lrpra && i < inbufs + outbufs; ++i) {
struct fastrpc_mmap *map = ctx->maps[i];
uint64_t buf = ptr_to_uint64(lpra[i].buf.pv);
size_t len = lpra[i].buf.len;

rpra[i].buf.pv = 0;
rpra[i].buf.len = len;
rpra[i].buf.pv = lrpra[i].buf.pv = 0;
rpra[i].buf.len = lrpra[i].buf.len = len;
if (!len)
continue;
if (map) {
Expand All @@ -1183,11 +1200,11 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
pages[idx].addr = map->phys + offset;
pages[idx].size = num << PAGE_SHIFT;
}
rpra[i].buf.pv = buf;
rpra[i].buf.pv = lrpra[i].buf.pv = buf;
}
/* copy non ion buffers */
rlen = copylen - metalen;
for (oix = 0; oix < inbufs + outbufs; ++oix) {
for (oix = 0; rpra && lrpra && oix < inbufs + outbufs; ++oix) {
int i = ctx->overps[oix]->raix;
struct fastrpc_mmap *map = ctx->maps[i];
size_t mlen;
Expand All @@ -1206,7 +1223,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
VERIFY(err, rlen >= mlen);
if (err)
goto bail;
rpra[i].buf.pv = (args - ctx->overps[oix]->offset);
rpra[i].buf.pv = lrpra[i].buf.pv =
(args - ctx->overps[oix]->offset);
pages[list[i].pgidx].addr = ctx->buf->phys -
ctx->overps[oix]->offset +
(copylen - rlen);
Expand All @@ -1229,7 +1247,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
struct fastrpc_mmap *map = ctx->maps[i];
if (map && map->uncached)
continue;
if (rpra[i].buf.len && ctx->overps[oix]->mstart) {
if (rpra && lrpra && rpra[i].buf.len &&
ctx->overps[oix]->mstart) {
if (map && map->handle)
msm_ion_do_cache_op(ctx->fl->apps->client,
map->handle,
Expand All @@ -1243,10 +1262,12 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
}
}
inh = inbufs + outbufs;
for (i = 0; i < REMOTE_SCALARS_INHANDLES(sc); i++) {
rpra[inh + i].buf.pv = ptr_to_uint64(ctx->lpra[inh + i].buf.pv);
rpra[inh + i].buf.len = ctx->lpra[inh + i].buf.len;
rpra[inh + i].h = ctx->lpra[inh + i].h;
for (i = 0; rpra && lrpra && i < REMOTE_SCALARS_INHANDLES(sc); i++) {
rpra[inh + i].buf.pv = lrpra[inh + i].buf.pv =
ptr_to_uint64(ctx->lpra[inh + i].buf.pv);
rpra[inh + i].buf.len = lrpra[inh + i].buf.len =
ctx->lpra[inh + i].buf.len;
rpra[inh + i].h = lrpra[inh + i].h = ctx->lpra[inh + i].h;
}

bail:
Expand All @@ -1257,7 +1278,7 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx,
remote_arg_t *upra)
{
uint32_t sc = ctx->sc;
remote_arg64_t *rpra = ctx->rpra;
remote_arg64_t *rpra = ctx->lrpra;
int i, inbufs, outbufs, outh, size;
int err = 0;

Expand Down Expand Up @@ -1337,7 +1358,7 @@ static void inv_args(struct smq_invoke_ctx *ctx)
{
int i, inbufs, outbufs;
uint32_t sc = ctx->sc;
remote_arg64_t *rpra = ctx->rpra;
remote_arg64_t *rpra = ctx->lrpra;
int inv = 0;

inbufs = REMOTE_SCALARS_INBUFS(sc);
Expand Down
38 changes: 21 additions & 17 deletions drivers/char/diag/diag_masks.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,8 @@ static int diag_cmd_get_build_mask(unsigned char *src_buf, int src_len,
struct diag_build_mask_req_t *req = NULL;
struct diag_msg_build_mask_t rsp;

if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0) {
if (!src_buf || !dest_buf || dest_len <= 0 ||
src_len < sizeof(struct diag_build_mask_req_t)) {
pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d\n",
__func__, src_buf, src_len, dest_buf, dest_len);
return -EINVAL;
Expand Down Expand Up @@ -647,7 +648,7 @@ static int diag_cmd_get_msg_mask(unsigned char *src_buf, int src_len,
info = diag_md_session_get_pid(pid);

mask_info = (!info) ? &msg_mask : info->msg_mask;
if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
if (!src_buf || !dest_buf || dest_len <= 0 ||
!mask_info || (src_len < sizeof(struct diag_build_mask_req_t))) {
pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d, mask_info: %pK\n",
__func__, src_buf, src_len, dest_buf, dest_len,
Expand Down Expand Up @@ -729,8 +730,8 @@ static int diag_cmd_set_msg_mask(unsigned char *src_buf, int src_len,
info = diag_md_session_get_pid(pid);

mask_info = (!info) ? &msg_mask : info->msg_mask;
if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
!mask_info) {
if (!src_buf || !dest_buf || dest_len <= 0 || !mask_info ||
(src_len < sizeof(struct diag_msg_build_mask_t))) {
pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d, mask_info: %pK\n",
__func__, src_buf, src_len, dest_buf, dest_len,
mask_info);
Expand Down Expand Up @@ -814,7 +815,9 @@ static int diag_cmd_set_msg_mask(unsigned char *src_buf, int src_len,
break;
}
mask_size = mask_size * sizeof(uint32_t);
memcpy(mask->ptr + offset, src_buf + header_len, mask_size);
if (mask_size && src_len >= header_len + mask_size)
memcpy(mask->ptr + offset, src_buf + header_len,
mask_size);
mutex_unlock(&mask->lock);
mask_info->status = DIAG_CTRL_MASK_VALID;
break;
Expand Down Expand Up @@ -869,8 +872,8 @@ static int diag_cmd_set_all_msg_mask(unsigned char *src_buf, int src_len,
info = diag_md_session_get_pid(pid);

mask_info = (!info) ? &msg_mask : info->msg_mask;
if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
!mask_info) {
if (!src_buf || !dest_buf || dest_len <= 0 || !mask_info ||
(src_len < sizeof(struct diag_msg_config_rsp_t))) {
pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d, mask_info: %pK\n",
__func__, src_buf, src_len, dest_buf, dest_len,
mask_info);
Expand Down Expand Up @@ -987,8 +990,8 @@ static int diag_cmd_update_event_mask(unsigned char *src_buf, int src_len,
mutex_lock(&driver->md_session_lock);
info = diag_md_session_get_pid(pid);
mask_info = (!info) ? &event_mask : info->event_mask;
if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
!mask_info) {
if (!src_buf || !dest_buf || dest_len <= 0 || !mask_info ||
src_len < sizeof(struct diag_event_mask_config_t)) {
pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d, mask_info: %pK\n",
__func__, src_buf, src_len, dest_buf, dest_len,
mask_info);
Expand All @@ -1011,7 +1014,8 @@ static int diag_cmd_update_event_mask(unsigned char *src_buf, int src_len,
}

mutex_lock(&mask_info->lock);
memcpy(mask_info->ptr, src_buf + header_len, mask_len);
if (src_len >= header_len + mask_len)
memcpy(mask_info->ptr, src_buf + header_len, mask_len);
mask_info->status = DIAG_CTRL_MASK_VALID;
mutex_unlock(&mask_info->lock);
mutex_unlock(&driver->md_session_lock);
Expand Down Expand Up @@ -1053,8 +1057,8 @@ static int diag_cmd_toggle_events(unsigned char *src_buf, int src_len,
mutex_lock(&driver->md_session_lock);
info = diag_md_session_get_pid(pid);
mask_info = (!info) ? &event_mask : info->event_mask;
if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
!mask_info) {
if (!src_buf || !dest_buf || src_len <= sizeof(uint8_t) ||
dest_len <= 0 || !mask_info) {
pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d, mask_info: %pK\n",
__func__, src_buf, src_len, dest_buf, dest_len,
mask_info);
Expand Down Expand Up @@ -1119,8 +1123,8 @@ static int diag_cmd_get_log_mask(unsigned char *src_buf, int src_len,
info = diag_md_session_get_pid(pid);

mask_info = (!info) ? &log_mask : info->log_mask;
if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
!mask_info) {
if (!src_buf || !dest_buf || dest_len <= 0 || !mask_info ||
src_len < sizeof(struct diag_log_config_req_t)) {
pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d, mask_info: %pK\n",
__func__, src_buf, src_len, dest_buf, dest_len,
mask_info);
Expand Down Expand Up @@ -1263,8 +1267,8 @@ static int diag_cmd_set_log_mask(unsigned char *src_buf, int src_len,
info = diag_md_session_get_pid(pid);

mask_info = (!info) ? &log_mask : info->log_mask;
if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
!mask_info) {
if (!src_buf || !dest_buf || dest_len <= 0 || !mask_info ||
src_len < sizeof(struct diag_log_config_req_t)) {
pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d, mask_info: %pK\n",
__func__, src_buf, src_len, dest_buf, dest_len,
mask_info);
Expand Down Expand Up @@ -1338,7 +1342,7 @@ static int diag_cmd_set_log_mask(unsigned char *src_buf, int src_len,
mask->range_tools = mask_size;
}
req->num_items = mask->num_items_tools;
if (mask_size > 0)
if (mask_size > 0 && src_len >= read_len + mask_size)
memcpy(mask->ptr, src_buf + read_len, mask_size);
DIAG_LOG(DIAG_DEBUG_MASKS,
"copying log mask, e %d num %d range %d size %d\n",
Expand Down
Loading

0 comments on commit 81a7cab

Please sign in to comment.