Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

DO NOT MERGE!! Debug HDMI audio issue #5

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
61d94ff
make 'user_access_begin()' do 'access_ok()'
junxiaoc Apr 9, 2019
dccb0a7
powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property()
zhanggenex May 26, 2019
84f106c
scsi: mpt3sas_ctl: fix double-fetch bug in _ctl_ioctl_main()
zhanggenex May 30, 2019
cc84a0f
ipv6_sockglue: Fix a missing-check bug in ip6_ra_control()
zhanggenex May 24, 2019
eb91910
efi/x86/Add missing error handling to old_memmap 1:1 mapping code
zhanggenex May 25, 2019
83c3f3a
ip_sockglue: Fix missing-check bug in ip_ra_control()
zhanggenex May 24, 2019
a293ee6
media: usb:zr364xx:Fix KASAN:null-ptr-deref Read in zr364xx_vidioc_qu…
vandanabn May 22, 2019
be76997
sctp: implement memory accounting on rx path
lxin Apr 15, 2019
cb73a09
sctp: implement memory accounting on tx path
lxin Apr 15, 2019
69f3300
drm/amdgpu: fix multiple memory leaks in acp_hw_init
Navidem Oct 2, 2019
b250841
rtlwifi: prevent memory leak in rtl_usb_probe
Navidem Sep 25, 2019
d4561da
iwlwifi: dbg_ini: fix memory leak in alloc_sgtable
Navidem Sep 13, 2019
ed56a77
net: qrtr: fix memort leak in qrtr_tun_write_iter
Navidem Sep 11, 2019
4d1a5c5
scsi: bfa: release allocated memory in case of error
Navidem Sep 10, 2019
7ae191e
iwlwifi: pcie: fix memory leaks in iwl_pcie_ctxt_info_gen3_init
Navidem Sep 27, 2019
7a9a390
mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
Navidem Oct 4, 2019
918c40d
rsi: release skb if rsi_prepare_beacon fails
Navidem Sep 14, 2019
18afa24
tracing: Have error path in predicate_parse() free its allocated memory
Navidem Sep 20, 2019
1102c3a
crypto: user - fix memory leak in crypto_report
Navidem Oct 4, 2019
cab11ce
rtl8xxxu: prevent leaking urb
Navidem Sep 20, 2019
e3eefcb
media: rc: prevent memory leak in cx23888_ir_probe
Navidem Sep 25, 2019
1449eee
crypto: ccp - Release all allocated memory if sha type is invalid
Navidem Sep 19, 2019
b85e2dc
mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf
Navidem Oct 4, 2019
c34d053
media: usb: fix memory leak in af9005_identify_state
Navidem Oct 9, 2019
7b4f04c
apparmor: Fix use-after-free in aa_audit_rule_init
Navidem Oct 21, 2019
173da4c
ipmi: Fix memory leak in __ipmi_bmc_register
Navidem Oct 21, 2019
e45fc3e
ath9k: release allocated buffer if timed out
Navidem Sep 6, 2019
801f120
ath10k: fix memory leak
Navidem Sep 20, 2019
e5815c5
RDMA: Fix goto target to release the allocated memory
Navidem Sep 10, 2019
7050ee7
wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
Navidem Oct 26, 2019
8acbfb4
ath9k_htc: release allocated buffer if timed out
Navidem Sep 6, 2019
cf34ba9
media: rcar_drif: fix a memory disclosure
kengiter Oct 18, 2019
36839dd
media: b2c2-flexcop-usb: add sanity checking
oneukum Jul 30, 2019
bffab09
drm/amd/display: memory leak
Navidem Sep 17, 2019
15b02da
drm/amd/display: prevent memory leak
Navidem Sep 25, 2019
4acb055
staging: android: ashmem: Disallow ashmem memory from being remapped
surenbaghdasaryan Oct 25, 2019
9e88c95
Debug HDMI audio issue
Dec 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions arch/powerpc/platforms/pseries/dlpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)

name = (char *)ccwa + be32_to_cpu(ccwa->name_offset);
prop->name = kstrdup(name, GFP_KERNEL);
if (!prop->name) {
dlpar_free_cc_property(prop);
return NULL;
}

prop->length = be32_to_cpu(ccwa->prop_length);
value = (char *)ccwa + be32_to_cpu(ccwa->prop_offset);
Expand Down
10 changes: 9 additions & 1 deletion arch/x86/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,15 @@ extern struct movsl_mask {
* checking before using them, but you have to surround them with the
* user_access_begin/end() pair.
*/
#define user_access_begin() __uaccess_begin()
static __must_check inline bool user_access_begin(const void __user *ptr, size_t len)
{
// access_ok's first parameter 'type' is useless
if (unlikely(!access_ok(VERIFY_WRITE, ptr, len)))
return 0;
__uaccess_begin();
return 1;
}
#define user_access_begin(a,b) user_access_begin(a,b)
#define user_access_end() __uaccess_end()

#define unsafe_put_user(x, ptr, err_label) \
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/platform/efi/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
pgd_t *save_pgd;

save_pgd = efi_call_phys_prolog();
if (!save_pgd)
return EFI_ABORTED;

/* Disable interrupts around EFI calls: */
local_irq_save(flags);
Expand Down
9 changes: 6 additions & 3 deletions arch/x86/platform/efi/efi_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ pgd_t * __init efi_call_phys_prolog(void)

if (!efi_enabled(EFI_OLD_MEMMAP)) {
efi_switch_mm(&efi_mm);
return NULL;
return efi_mm.pgd;
}

early_code_mapping_set_exec(1);

n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
if (!save_pgd)
return NULL;

/*
* Build 1:1 identity mapping for efi=old_map usage. Note that
Expand Down Expand Up @@ -138,10 +140,11 @@ pgd_t * __init efi_call_phys_prolog(void)
pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX;
}

out:
__flush_tlb_all();

return save_pgd;
out:
efi_call_phys_epilog(save_pgd);
return NULL;
}

void __init efi_call_phys_epilog(pgd_t *save_pgd)
Expand Down
4 changes: 3 additions & 1 deletion crypto/crypto_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,10 @@ static int crypto_report(struct sk_buff *in_skb, struct nlmsghdr *in_nlh,
drop_alg:
crypto_mod_put(alg);

if (err)
if (err) {
kfree_skb(skb);
return err;
}

return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).portid);
}
Expand Down
5 changes: 4 additions & 1 deletion drivers/char/ipmi/ipmi_msghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2957,8 +2957,11 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
bmc->pdev.name = "ipmi_bmc";

rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL);
if (rv < 0)
if (rv < 0) {
kfree(bmc);
goto out;
}

bmc->pdev.dev.driver = &ipmidriver.driver;
bmc->pdev.id = rv;
bmc->pdev.dev.release = release_bmc_device;
Expand Down
3 changes: 2 additions & 1 deletion drivers/crypto/ccp/ccp-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,8 +1793,9 @@ static int ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
LSB_ITEM_SIZE);
break;
default:
kfree(hmac_buf);
ret = -EINVAL;
goto e_ctx;
goto e_data;
}

memset(&hmac_cmd, 0, sizeof(hmac_cmd));
Expand Down
34 changes: 22 additions & 12 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static int acp_hw_init(void *handle)
u32 val = 0;
u32 count = 0;
struct device *dev;
struct i2s_platform_data *i2s_pdata;
struct i2s_platform_data *i2s_pdata = NULL;

struct amdgpu_device *adev = (struct amdgpu_device *)handle;

Expand Down Expand Up @@ -317,20 +317,21 @@ static int acp_hw_init(void *handle)
adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell),
GFP_KERNEL);

if (adev->acp.acp_cell == NULL)
return -ENOMEM;
if (adev->acp.acp_cell == NULL) {
r = -ENOMEM;
goto failure;
}

adev->acp.acp_res = kcalloc(5, sizeof(struct resource), GFP_KERNEL);
if (adev->acp.acp_res == NULL) {
kfree(adev->acp.acp_cell);
return -ENOMEM;
r = -ENOMEM;
goto failure;
}

i2s_pdata = kcalloc(3, sizeof(struct i2s_platform_data), GFP_KERNEL);
if (i2s_pdata == NULL) {
kfree(adev->acp.acp_res);
kfree(adev->acp.acp_cell);
return -ENOMEM;
r = -ENOMEM;
goto failure;
}

switch (adev->asic_type) {
Expand Down Expand Up @@ -427,15 +428,15 @@ static int acp_hw_init(void *handle)
r = mfd_add_hotplug_devices(adev->acp.parent, adev->acp.acp_cell,
ACP_DEVS);
if (r)
return r;
goto failure;

if (adev->asic_type != CHIP_STONEY) {
for (i = 0; i < ACP_DEVS ; i++) {
dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev);
if (r) {
dev_err(dev, "Failed to add dev to genpd\n");
return r;
goto failure;
}
}
}
Expand All @@ -454,7 +455,8 @@ static int acp_hw_init(void *handle)
break;
if (--count == 0) {
dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
return -ETIMEDOUT;
r = -ETIMEDOUT;
goto failure;
}
udelay(100);
}
Expand All @@ -471,7 +473,8 @@ static int acp_hw_init(void *handle)
break;
if (--count == 0) {
dev_err(&adev->pdev->dev, "Failed to reset ACP\n");
return -ETIMEDOUT;
r = -ETIMEDOUT;
goto failure;
}
udelay(100);
}
Expand All @@ -480,6 +483,13 @@ static int acp_hw_init(void *handle)
val &= ~ACP_SOFT_RESET__SoftResetAud_MASK;
cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val);
return 0;

failure:
kfree(i2s_pdata);
kfree(adev->acp.acp_res);
kfree(adev->acp.acp_cell);
kfree(adev->acp.acp_genpd);
return r;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ struct clock_source *dce100_clock_source_create(
return &clk_src->base;
}

kfree(clk_src);
BREAK_TO_DEBUGGER();
return NULL;
}
Expand Down Expand Up @@ -1001,6 +1002,7 @@ struct resource_pool *dce100_create_resource_pool(
if (construct(num_virtual_links, dc, pool))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ struct clock_source *dce110_clock_source_create(
return &clk_src->base;
}

kfree(clk_src);
BREAK_TO_DEBUGGER();
return NULL;
}
Expand Down Expand Up @@ -1344,6 +1345,7 @@ struct resource_pool *dce110_create_resource_pool(
if (construct(num_virtual_links, dc, pool, asic_id))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ struct clock_source *dce112_clock_source_create(
return &clk_src->base;
}

kfree(clk_src);
BREAK_TO_DEBUGGER();
return NULL;
}
Expand Down Expand Up @@ -1287,6 +1288,7 @@ struct resource_pool *dce112_create_resource_pool(
if (construct(num_virtual_links, dc, pool))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ struct clock_source *dce120_clock_source_create(
return &clk_src->base;
}

kfree(clk_src);
BREAK_TO_DEBUGGER();
return NULL;
}
Expand Down Expand Up @@ -1076,6 +1077,7 @@ struct resource_pool *dce120_create_resource_pool(
if (construct(num_virtual_links, dc, pool))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ struct clock_source *dce80_clock_source_create(
return &clk_src->base;
}

kfree(clk_src);
BREAK_TO_DEBUGGER();
return NULL;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ struct clock_source *dcn10_clock_source_create(
return &clk_src->base;
}

kfree(clk_src);
BREAK_TO_DEBUGGER();
return NULL;
}
Expand Down Expand Up @@ -1361,6 +1362,7 @@ struct resource_pool *dcn10_create_resource_pool(
if (construct(num_virtual_links, dc, pool))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
15 changes: 13 additions & 2 deletions drivers/gpu/drm/i915/i915_gem_execbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,9 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb)
* happened we would make the mistake of assuming that the
* relocations were valid.
*/
user_access_begin();
if (!user_access_begin(urelocs, size))
goto end_user;

for (copied = 0; copied < nreloc; copied++)
unsafe_put_user(-1,
&urelocs[copied].presumed_offset,
Expand Down Expand Up @@ -2649,7 +2651,16 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
unsigned int i;

/* Copy the new buffer offsets back to the user's exec list. */
user_access_begin();
/*
* Note: count * sizeof(*user_exec_list) does not overflow,
* because we checked 'count' in check_buffer_count().
*
* And this range already got effectively checked earlier
* when we did the "copy_from_user()" above.
*/
if (!user_access_begin(user_exec_list, count * sizeof(*user_exec_list)))
goto end_user;

for (i = 0; i < args->buffer_count; i++) {
if (!(exec2_list[i].offset & UPDATE))
continue;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/bnxt_re/ib_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ struct ib_srq *bnxt_re_create_srq(struct ib_pd *ib_pd,
dev_err(rdev_to_dev(rdev), "SRQ copy to udata failed!");
bnxt_qplib_destroy_srq(&rdev->qplib_res,
&srq->qplib_srq);
goto exit;
goto fail;
}
}
if (nq)
Expand Down
5 changes: 4 additions & 1 deletion drivers/media/pci/cx23885/cx23888-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,11 @@ int cx23888_ir_probe(struct cx23885_dev *dev)
return -ENOMEM;

spin_lock_init(&state->rx_kfifo_lock);
if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL))
if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE,
GFP_KERNEL)) {
kfree(state);
return -ENOMEM;
}

state->dev = dev;
sd = &state->sd;
Expand Down
1 change: 1 addition & 0 deletions drivers/media/platform/rcar_drif.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv,
{
struct rcar_drif_sdr *sdr = video_drvdata(file);

memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved));
f->fmt.sdr.pixelformat = sdr->fmt->pixelformat;
f->fmt.sdr.buffersize = sdr->fmt->buffersize;

Expand Down
3 changes: 3 additions & 0 deletions drivers/media/usb/b2c2/flexcop-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@ static int flexcop_usb_probe(struct usb_interface *intf,
struct flexcop_device *fc = NULL;
int ret;

if (intf->cur_altsetting->desc.bNumEndpoints < 1)
return -ENODEV;

if (intf->cur_altsetting->desc.bNumEndpoints < 1)
return -ENODEV;

Expand Down
5 changes: 3 additions & 2 deletions drivers/media/usb/dvb-usb/af9005.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,9 @@ static int af9005_identify_state(struct usb_device *udev,
else if (reply == 0x02)
*cold = 0;
else
return -EIO;
deb_info("Identify state cold = %d\n", *cold);
ret = -EIO;
if (!ret)
deb_info("Identify state cold = %d\n", *cold);

err:
kfree(buf);
Expand Down
7 changes: 4 additions & 3 deletions drivers/media/usb/zr364xx/zr364xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,10 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv,
{
struct zr364xx_camera *cam = video_drvdata(file);

strlcpy(cap->driver, DRIVER_DESC, sizeof(cap->driver));
strlcpy(cap->card, cam->udev->product, sizeof(cap->card));
strlcpy(cap->bus_info, dev_name(&cam->udev->dev),
strscpy(cap->driver, DRIVER_DESC, sizeof(cap->driver));
if (cam->udev->product)
strscpy(cap->card, cam->udev->product, sizeof(cap->card));
strscpy(cap->bus_info, dev_name(&cam->udev->dev),
sizeof(cap->bus_info));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_READWRITE |
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wimax/i2400m/op-rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,
error_alloc:
d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
wimax_dev, state, result);
kfree(cmd);
return result;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath10k/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ static int ath10k_usb_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
ath10k_dbg(ar, ATH10K_DBG_USB_BULK,
"usb bulk transmit failed: %d\n", ret);
usb_unanchor_urb(urb);
usb_free_urb(urb);
ret = -EINVAL;
goto err_free_urb_to_pipe;
}
Expand Down
Loading