[PATCH] media: tm6000: Fix memleak in tm6000_start_stream

2021-01-02 Thread Dinghao Liu
When usb_clear_halt() fails, dvb->bulk_urb->transfer_buffer and dvb->bulk_urb should be freed just like when usb_submit_urb() fails. Fixes: 3169c9b26fffa ("V4L/DVB (12788): tm6000: Add initial DVB-T support") Signed-off-by: Dinghao Liu --- drivers/media/usb/tm6000/tm6000-dvb

[PATCH] media: media/pci: Fix memleak in empress_init

2021-01-01 Thread Dinghao Liu
When vb2_queue_init() fails, dev->empress_dev should be released just like other error handling paths. Fixes: 2ada815fc48bb ("[media] saa7134: convert to vb2") Signed-off-by: Dinghao Liu --- drivers/media/pci/saa7134/saa7134-empress.c | 5 - 1 file changed, 4 insertions(+

[PATCH] Bluetooth: hci_qca: Fix memleak in qca_controller_memdump

2021-01-01 Thread Dinghao Liu
When __le32_to_cpu() fails, qca_memdump should be freed just like when vmalloc() fails. Fixes: d841502c79e3f ("Bluetooth: hci_qca: Collect controller memory dump during SSR") Signed-off-by: Dinghao Liu --- drivers/bluetooth/hci_qca.c | 2 ++ 1 file changed, 2 insertions(+)

[PATCH] media: em28xx: Fix use-after-free in em28xx_alloc_urbs

2020-12-28 Thread Dinghao Liu
oherent buffer for DMA transfers") Signed-off-by: Dinghao Liu --- drivers/media/usb/em28xx/em28xx-core.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index e6088b5d1b80..3daa64bb1e1d 100644

[PATCH] [v2] net/mlx5e: Fix two double free cases

2020-12-28 Thread Dinghao Liu
ter kfree() to avoid double free. Fixes: 7b3722fa9ef64 ("net/mlx5e: Support RSS for GRE tunneled packets") Fixes: 33cfaaa8f36ff ("net/mlx5e: Split the main flow steering table") Signed-off-by: Dinghao Liu --- Changelog: v2: - Set ft->g to NULL after kfree() instead of remov

Re: Re: [PATCH] net/mlx5e: Fix two double free cases

2020-12-27 Thread dinghao . liu
> On Mon, Dec 21, 2020 at 04:50:31PM +0800, Dinghao Liu wrote: > > mlx5e_create_ttc_table_groups() frees ft->g on failure of > > kvzalloc(), but such failure will be caught by its caller > > in mlx5e_create_ttc_table() and ft->g will be freed again > > in mlx5e_des

Re: Re: [PATCH] IB/sa: Fix memleak in ib_nl_make_request

2020-12-27 Thread dinghao . liu
> On Sun, Dec 20, 2020 at 04:13:14PM +0800, Dinghao Liu wrote: > > When rdma_nl_multicast() fails, skb should be freed > > just like when ibnl_put_msg() fails. > > It is not so simple as you wrote in the description. > > There are no other places in the linux ke

[PATCH] staging: rtl8192u: Add null check in rtl8192_usb_initendpoints

2020-12-26 Thread Dinghao Liu
There is an allocation for priv->rx_urb[16] has no null check, which may lead to a null pointer dereference. Signed-off-by: Dinghao Liu --- drivers/staging/rtl8192u/r8192U_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/stag

[PATCH] RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp

2020-12-25 Thread Dinghao Liu
If usnic_ib_qp_grp_create() fails at the first call, dev_list will not be freed on error, which leads to memleak. Signed-off-by: Dinghao Liu --- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b

[PATCH] habanalabs: Fix memleak in hl_device_reset

2020-12-25 Thread Dinghao Liu
When kzalloc() fails, we should execute hl_mmu_fini() to release the MMU module. It's the same when hl_ctx_init() fails. Signed-off-by: Dinghao Liu --- drivers/misc/habanalabs/common/device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/habanalabs/common/device.c b

[PATCH] [v2] scsi: scsi_debug: Fix memleak in scsi_debug_init

2020-12-25 Thread Dinghao Liu
When sdeb_zbc_model does not match BLK_ZONED_NONE, BLK_ZONED_HA or BLK_ZONED_HM, we should free sdebug_q_arr to prevent memleak. Also there is no need to execute sdebug_erase_store() on failure of sdeb_zbc_model_str(). Signed-off-by: Dinghao Liu --- Changelog: v2: - Add missed assignment

[PATCH] scsi: scsi_debug: Fix memleak in scsi_debug_init

2020-12-25 Thread Dinghao Liu
When sdeb_zbc_model does not match BLK_ZONED_NONE, BLK_ZONED_HA or BLK_ZONED_HM, we should free sdebug_q_arr to prevent memleak. Also there is no need to execute sdebug_erase_store() on failure of sdeb_zbc_model_str(). Signed-off-by: Dinghao Liu --- drivers/scsi/scsi_debug.c | 4 ++-- 1 file

[PATCH] scsi: fnic: Fix memleak in vnic_dev_init_devcmd2

2020-12-25 Thread Dinghao Liu
When ioread32() returns 0x, we should execute cleanup functions like other error handling paths before returning. Signed-off-by: Dinghao Liu --- drivers/scsi/fnic/vnic_dev.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/fnic/vnic_dev.c b

[PATCH] drm/nouveau: Fix memleak in nv50_wndw_new_

2020-12-24 Thread Dinghao Liu
When nv50_lut_init() fails, *pwndw should be freed just like when drm_universal_plane_init() fails. It's the same for the subsequent error paths. Signed-off-by: Dinghao Liu --- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions

Re: Re: [PATCH] enic: Remove redundant free in enic_set_ringparam

2020-12-24 Thread dinghao . liu
> On Wed, 23 Dec 2020 20:38:33 +0800 Dinghao Liu wrote: > > The error handling paths in enic_alloc_vnic_resources() > > have called enic_free_vnic_resources() before returning. > > So we may not need to call it again on failure at caller > > side. > > > > Si

[PATCH] enic: Remove redundant free in enic_set_ringparam

2020-12-23 Thread Dinghao Liu
The error handling paths in enic_alloc_vnic_resources() have called enic_free_vnic_resources() before returning. So we may not need to call it again on failure at caller side. Signed-off-by: Dinghao Liu --- drivers/net/ethernet/cisco/enic/enic_ethtool.c | 1 - 1 file changed, 1 deletion

[PATCH] net: ethernet: Fix memleak in ethoc_probe

2020-12-23 Thread Dinghao Liu
When mdiobus_register() fails, priv->mdio allocated by mdiobus_alloc() has not been freed, which leads to memleak. Signed-off-by: Dinghao Liu --- drivers/net/ethernet/ethoc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ethoc.c b/drivers/

[PATCH] [v2] ide: pci: Fix memleak in ide_pci_init_two

2020-12-23 Thread Dinghao Liu
When do_ide_setup_pci_device() fails, host allocated by ide_host_alloc() may not have been freed, which leads to memleak. Signed-off-by: Dinghao Liu --- Changelog: v2: - Refine the error handling on failure of ide_host_register(). --- drivers/ide/setup-pci.c | 10 ++ 1 file

Re: Re: [PATCH] ide: pci: Fix memleak in ide_pci_init_two

2020-12-23 Thread dinghao . liu
> On Sun, Dec 20, 2020 at 03:05:40PM +0800, Dinghao Liu wrote: > > When do_ide_setup_pci_device() fails, host allocated > > by ide_host_alloc() may not have been freed, which > > leads to memleak. > > > > Signed-off-by: Dinghao Liu > > --- > > dri

[PATCH] staging: fwserial: Fix error handling in fwserial_create

2020-12-21 Thread Dinghao Liu
When fw_core_add_address_handler() fails, we need to destroy the port by tty_port_destroy(). Also we need to unregister the address handler by fw_core_remove_address_handler() on failure. Signed-off-by: Dinghao Liu --- drivers/staging/fwserial/fwserial.c | 2 ++ 1 file changed, 2 insertions

[PATCH] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups

2020-12-21 Thread Dinghao Liu
When mlx5_create_flow_group() fails, ft->g should be freed just like when kvzalloc() fails. The caller of mlx5e_create_l2_table_groups() does not catch this issue on failure, which leads to memleak. Signed-off-by: Dinghao Liu --- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 1 + 1 f

[PATCH] net/mlx5e: Fix two double free cases

2020-12-21 Thread Dinghao Liu
mlx5e_create_ttc_table_groups() frees ft->g on failure of kvzalloc(), but such failure will be caught by its caller in mlx5e_create_ttc_table() and ft->g will be freed again in mlx5e_destroy_flow_table(). The same issue also occurs in mlx5e_create_ttc_table_groups(). Signed-off-by: Dingh

[PATCH] net: ethernet: mvneta: Fix error handling in mvneta_probe

2020-12-20 Thread Dinghao Liu
When mvneta_port_power_up() fails, we should execute cleanup functions after label err_netdev to avoid memleak. Fixes: 41c2b6b4f0f80 ("net: ethernet: mvneta: Add back interface mode validation") Signed-off-by: Dinghao Liu --- drivers/net/ethernet/marvell/mvneta.c | 2 +- 1 file

[PATCH] IB/sa: Fix memleak in ib_nl_make_request

2020-12-20 Thread Dinghao Liu
When rdma_nl_multicast() fails, skb should be freed just like when ibnl_put_msg() fails. Signed-off-by: Dinghao Liu --- drivers/infiniband/core/sa_query.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core

[PATCH] ide: pci: Fix memleak in ide_pci_init_two

2020-12-19 Thread Dinghao Liu
When do_ide_setup_pci_device() fails, host allocated by ide_host_alloc() may not have been freed, which leads to memleak. Signed-off-by: Dinghao Liu --- drivers/ide/setup-pci.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ide/setup-pci.c b/drivers/ide

[PATCH] net-veth: Fix memleak in veth_newlink

2020-10-21 Thread Dinghao Liu
When rtnl_configure_link() fails, peer needs to be freed just like when register_netdevice() fails. Signed-off-by: Dinghao Liu --- drivers/net/veth.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 8c737668008a..6c68094399cc 100644

Re: Re: [PATCH] can: vxcan: Fix memleak in vxcan_newlink

2020-10-21 Thread dinghao . liu
> > On 21.10.20 07:21, Dinghao Liu wrote: > > When rtnl_configure_link() fails, peer needs to be > > freed just like when register_netdevice() fails. > > > > Signed-off-by: Dinghao Liu > > Acked-by: Oliver Hartkopp > > Btw. as the vxcan.c driver b

[PATCH] btrfs: ref-verify: Fix memleak in btrfs_ref_tree_mod

2020-10-20 Thread Dinghao Liu
There is one error handling path does not free ref, which may cause a memory leak. Signed-off-by: Dinghao Liu --- fs/btrfs/ref-verify.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c index 7f03dbe5b609..78693d3dd15b 100644 --- a/fs/btrfs/ref

[PATCH] can: vxcan: Fix memleak in vxcan_newlink

2020-10-20 Thread Dinghao Liu
When rtnl_configure_link() fails, peer needs to be freed just like when register_netdevice() fails. Signed-off-by: Dinghao Liu --- drivers/net/can/vxcan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c index d6ba9426be4d..aefc5a61d239

[PATCH] [v3] rtc: sun6i: Fix memleak in sun6i_rtc_clk_init

2020-10-20 Thread Dinghao Liu
When clk_hw_register_fixed_rate_with_accuracy() fails, clk_data should be freed. It's the same for the subsequent two error paths, but we should also unregister the already registered clocks in them. Signed-off-by: Dinghao Liu --- Changelog: v2: - Unregister the already registered clocks

Re: Re: [PATCH] [v2] rtc: sun6i: Fix memleak in sun6i_rtc_clk_init

2020-10-19 Thread dinghao . liu
> Hi, > > On Sun, Oct 18, 2020 at 03:28:10PM +0800, Dinghao Liu wrote: > > When clk_hw_register_fixed_rate_with_accuracy() fails, > > clk_data should be freed. It's the same for the subsequent > > two error paths, but we should also unregister the already &g

[PATCH] [v2] rtc: sun6i: Fix memleak in sun6i_rtc_clk_init

2020-10-18 Thread Dinghao Liu
When clk_hw_register_fixed_rate_with_accuracy() fails, clk_data should be freed. It's the same for the subsequent two error paths, but we should also unregister the already registered clocks in them. Signed-off-by: Dinghao Liu --- Changelog: v2: - Unregister the already registered clocks

Re: Re: Re: [PATCH] rtc: sun6i: Fix memleak in sun6i_rtc_clk_init

2020-10-18 Thread dinghao . liu
> On 26/08/2020 16:55:14+0800, dinghao@zju.edu.cn wrote: > > > On Sun, Aug 23, 2020 at 3:59 PM Dinghao Liu > > > wrote: > > > > > > > > When clk_hw_register_fixed_rate_with_accuracy() fails, > > > > clk_data should be fr

[PATCH] [v2] HID: elan: Fix memleak in elan_input_configured

2020-08-31 Thread Dinghao Liu
When input_mt_init_slots() fails, input should be freed to prevent memleak. When input_register_device() fails, we should call input_mt_destroy_slots() to free memory allocated by input_mt_init_slots(). Signed-off-by: Dinghao Liu --- Changelog: v2: - Add input_mt_destroy_slots() on failure

Re: Re: [PATCH] HID: elan: Fix memleak in elan_input_configured

2020-08-31 Thread dinghao . liu
> On Mon, 24 Aug 2020, Dinghao Liu wrote: > > > When input_mt_init_slots() fails, input should be > > freed to prevent memleak. > > > > Fixes: 9a6a4193d65b8 ("HID: Add driver for USB ELAN Touchpad") > > Signed-off-by: Dinghao Liu > > --- >

[PATCH] ALSA: opti9xx: Fix memleak in snd_opti9xx_read_check

2020-08-29 Thread Dinghao Liu
When request_region() on chip->res_mc_indir fails, chip->res_mc_base should be freed to prevent memleak. Signed-off-by: Dinghao Liu --- sound/isa/opti9xx/opti92x-ad1848.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sou

[PATCH] [v2] ext4: Fix error handling code in add_new_gdb

2020-08-28 Thread Dinghao Liu
When ext4_journal_get_write_access() fails, we should terminate the execution flow and release n_group_desc, iloc.bh, dind and gdb_bh. Signed-off-by: Dinghao Liu --- Changelog: v2: - Remove changes to ext4_handle_dirty_super()'s error handling path. --- fs/ext4/resize.c | 4 +++- 1 file

Re: Re: [PATCH] ext4: Fix memleak in add_new_gdb

2020-08-28 Thread dinghao . liu
> On Thu 27-08-20 14:28:43, Dinghao Liu wrote: > > When ext4_journal_get_write_access() fails, we should release > > n_group_desc, iloc.bh, dind and gdb_bh to prevent memleak. > > It's the same when ext4_handle_dirty_super() fails, but we > > don't need to release di

[PATCH] fs/binfmt_elf: Fix memleak in load_elf_binary

2020-08-27 Thread Dinghao Liu
When arch_setup_additional_pages() fails, interp_elf_ex may not have been freed, which leads to memleak. It's the same when create_elf_tables() fails. Signed-off-by: Dinghao Liu --- fs/binfmt_elf.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/binfmt_elf.c b

[PATCH] gss_krb5: Fix memleak in krb5_make_rc4_seq_num

2020-08-27 Thread Dinghao Liu
When kmalloc() fails, cipher should be freed just like when krb5_rc4_setup_seq_key() fails. Fixes: e7afe6c1d486b ("sunrpc: fix 4 more call sites that were using stack memory with a scatterlist") Signed-off-by: Dinghao Liu --- net/sunrpc/auth_gss/gss_krb5_seqnum.c | 6 -- 1 file

[PATCH] btrfs: ref-verify: Fix memleak in add_extent_data_ref

2020-08-27 Thread Dinghao Liu
When lookup_root_entry() fails, ref should be freed just like when insert_ref_entry() fails. Signed-off-by: Dinghao Liu --- fs/btrfs/ref-verify.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c index 7f03dbe5b609..712f5cfde404 100644 --- a/fs

[PATCH] jfs: Fix memleak in dbAdjCtl

2020-08-27 Thread Dinghao Liu
When dbBackSplit() fails, mp should be released to prevent memleak. It's the same when dbJoin() fails. Signed-off-by: Dinghao Liu --- fs/jfs/jfs_dmap.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 7dfcab2a2da6

[PATCH] ext4: Fix memleak in add_new_gdb

2020-08-27 Thread Dinghao Liu
When ext4_journal_get_write_access() fails, we should release n_group_desc, iloc.bh, dind and gdb_bh to prevent memleak. It's the same when ext4_handle_dirty_super() fails, but we don't need to release dind here because it has been released before. Signed-off-by: Dinghao Liu --- fs/ext4

[PATCH] ice: Fix memleak in ice_set_ringparam

2020-08-26 Thread Dinghao Liu
When kcalloc() on rx_rings fails, we should free tx_rings and xdp_rings to prevent memleak. Similarly, when ice_alloc_rx_bufs() fails, we should free xdp_rings. Signed-off-by: Dinghao Liu --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 13 +++-- 1 file changed, 11 insertions(+), 2

[PATCH] drm/amd/display: Fix memleak in amdgpu_dm_mode_config_init

2020-08-26 Thread Dinghao Liu
When amdgpu_display_modeset_create_props() fails, state and state->context should be freed to prevent memleak. It's the same when amdgpu_dm_audio_init() fails. Signed-off-by: Dinghao Liu --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 -- 1 file changed, 8 insertions(+)

[PATCH] EDAC: i5100_edac: Fix error handling code in i5100_init_one

2020-08-26 Thread Dinghao Liu
When pci_get_device_func() fails, we don't need to execute pci_dev_put(). But mci should be freed to prevent memleak. When pci_enable_device() fails, we don't need to disable einj either. Fixes: 52608ba205461 ("i5100_edac: probe for device 19 function 0") Signed-off-by: Dinghao Liu --

[PATCH] rxrpc: Fix memleak in rxkad_verify_response

2020-08-26 Thread Dinghao Liu
When kmalloc() on ticket fails, response should be freed to prevent memleak. Signed-off-by: Dinghao Liu --- net/rxrpc/rxkad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index 52a24d4ef5d8..e08130e5746b 100644 --- a/net/rxrpc

[PATCH] [v2] media: mx2_emmaprp: Fix memleak in emmaprp_probe

2020-08-26 Thread Dinghao Liu
When platform_get_irq() fails, we should release vfd and unregister pcdev->v4l2_dev just like the subsequent error paths. Fixes: d4e192cc44914 ("media: mx2_emmaprp: Check for platform_get_irq() error") Signed-off-by: Dinghao Liu --- Changelog: v2: - Add 'ret = irq;'. ---

[PATCH] ide: pci: Fix memleak in ide_pci_init_two

2020-08-26 Thread Dinghao Liu
When do_ide_setup_pci_device() fails, host should be freed just like when ide_host_register() fails. Signed-off-by: Dinghao Liu --- drivers/ide/setup-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index fdc8e813170c

Re: Re: [PATCH] media: mx2_emmaprp: Fix memleak in emmaprp_probe

2020-08-26 Thread dinghao . liu
> On 25/08/2020 11:39, Dinghao Liu wrote: > > When platform_get_irq() fails, we should release > > vfd and unregister pcdev->v4l2_dev just like the > > subsequent error paths. > > > > Fixes: d4e192cc44914 ("media: mx2_emmaprp: Check for platform_get_irq(

Re: Re: [PATCH] rtc: sun6i: Fix memleak in sun6i_rtc_clk_init

2020-08-26 Thread dinghao . liu
> On Sun, Aug 23, 2020 at 3:59 PM Dinghao Liu wrote: > > > > When clk_hw_register_fixed_rate_with_accuracy() fails, > > clk_data should be freed. It's the same for the subsequent > > error paths. > > I suppose you should also unregister the already registered

[PATCH] media: mx2_emmaprp: Fix memleak in emmaprp_probe

2020-08-25 Thread Dinghao Liu
When platform_get_irq() fails, we should release vfd and unregister pcdev->v4l2_dev just like the subsequent error paths. Fixes: d4e192cc44914 ("media: mx2_emmaprp: Check for platform_get_irq() error") Signed-off-by: Dinghao Liu --- drivers/media/platform/mx2_emmaprp.c | 2 +- 1 fi

[PATCH] video: fbdev: radeon: Fix memleak in radeonfb_pci_register

2020-08-25 Thread Dinghao Liu
When radeon_kick_out_firmware_fb() fails, info should be freed just like the subsequent error paths. Fixes: 069ee21a82344 ("fbdev: Fix loading of module radeonfb on PowerMac") Signed-off-by: Dinghao Liu --- drivers/video/fbdev/aty/radeon_base.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH] media: dvbdev: Fix memleak in dvb_register_device

2020-08-24 Thread Dinghao Liu
When device_create() fails, dvbdev and dvbdevfops should be freed just like when dvb_register_media_device() fails. Signed-off-by: Dinghao Liu --- drivers/media/dvb-core/dvbdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core

[PATCH] HID: elan: Fix memleak in elan_input_configured

2020-08-24 Thread Dinghao Liu
When input_mt_init_slots() fails, input should be freed to prevent memleak. Fixes: 9a6a4193d65b8 ("HID: Add driver for USB ELAN Touchpad") Signed-off-by: Dinghao Liu --- drivers/hid/hid-elan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hid/hid-elan.c b/drivers/hid/

[PATCH] media: omap3isp: Fix memleak in isp_probe

2020-08-24 Thread Dinghao Liu
When devm_ioremap_resource() fails, isp should be freed just like other error paths in isp_probe. Fixes: 8644cdf972dd6 ("[media] omap3isp: Replace many MMIO regions by two") Signed-off-by: Dinghao Liu --- drivers/media/platform/omap3isp/isp.c | 6 -- 1 file changed, 4 insert

[PATCH] net: systemport: Fix memleak in bcm_sysport_probe

2020-08-23 Thread Dinghao Liu
When devm_kcalloc() fails, dev should be freed just like what we've done in the subsequent error paths. Fixes: 7b78be48a8eb6 ("net: systemport: Dynamically allocate number of TX rings") Signed-off-by: Dinghao Liu --- drivers/net/ethernet/broadcom/bcmsysport.c | 6 -- 1 file

[PATCH] net: hns: Fix memleak in hns_nic_dev_probe

2020-08-23 Thread Dinghao Liu
hns_nic_dev_probe allocates ndev, but not free it on two error handling paths, which may lead to memleak. Fixes: 63434888aaf1b ("net: hns: net: hns: enet adds support of acpi") Signed-off-by: Dinghao Liu --- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 9 ++--- 1 file

[PATCH] [v2] watchdog: Use put_device on error

2020-08-23 Thread Dinghao Liu
We should use put_device() instead of freeing device directly after device_initialize(). Fixes: cb36e29bb0e4b ("watchdog: initialize device before misc_register") Signed-off-by: Dinghao Liu --- Changelog: v2: - Use put_device() instead of just removing kfree. Move the me

[PATCH] watchdog: Fix memleak in watchdog_cdev_register

2020-08-23 Thread Dinghao Liu
When watchdog_kworker is NULL, we should free wd_data before the function returns to prevent memleak. Fixes: 664a39236e718 ("watchdog: Introduce hardware maximum heartbeat in watchdog core") Signed-off-by: Dinghao Liu --- drivers/watchdog/watchdog_dev.c | 4 +++- 1 file changed, 3

Re: Re: [PATCH] watchdog: Fix double-free in watchdog_cdev_register

2020-08-23 Thread dinghao . liu
> On 8/23/20 12:13 AM, Dinghao Liu wrote: > > When misc_register() fails, wd_data will be released by the > > release callback function watchdog_core_data_release(), so > > we don't need to free it again. But when watchdog_kworker is > > NULL, we should free

[PATCH] clocksource/drivers/cadence-ttc: Fix memleak in ttc_setup_clockevent

2020-08-23 Thread Dinghao Liu
When clk_notifier_register() fails, ttcce should be freed just like when clk_prepare_enable() and request_irq() fail. Signed-off-by: Dinghao Liu --- drivers/clocksource/timer-cadence-ttc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers

[PATCH] firestream: Fix memleak in fs_open

2020-08-23 Thread Dinghao Liu
When make_rate() fails, vcc should be freed just like other error paths in fs_open(). Signed-off-by: Dinghao Liu --- drivers/atm/firestream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index 2ca9ec802734..510250cf5c87 100644

[PATCH] Platform: OLPC: Fix memleak in olpc_ec_probe

2020-08-23 Thread Dinghao Liu
When devm_regulator_register() fails, ec should be freed just like when olpc_ec_cmd() fails. Fixes: 231c0c216172a ("Platform: OLPC: Add a regulator for the DCON") Signed-off-by: Dinghao Liu --- drivers/platform/olpc/olpc-ec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH] scsi: pm8001: Fix memleak in pm8001_exec_internal_task_abort

2020-08-23 Thread Dinghao Liu
When pm8001_tag_alloc() fails, task should be freed just like what we've done in the subsequent error paths. Signed-off-by: Dinghao Liu --- drivers/scsi/pm8001/pm8001_sas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001

[PATCH] net: arc_emac: Fix memleak in arc_mdio_probe

2020-08-23 Thread Dinghao Liu
When devm_gpiod_get_optional() fails, bus should be freed just like when of_mdiobus_register() fails. Fixes: 1bddd96cba03d ("net: arc_emac: support the phy reset for emac driver") Signed-off-by: Dinghao Liu --- drivers/net/ethernet/arc/emac_mdio.c | 1 + 1 file changed, 1 insertio

[PATCH] rtc: sun6i: Fix memleak in sun6i_rtc_clk_init

2020-08-23 Thread Dinghao Liu
When clk_hw_register_fixed_rate_with_accuracy() fails, clk_data should be freed. It's the same for the subsequent error paths. Signed-off-by: Dinghao Liu --- drivers/rtc/rtc-sun6i.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc

[PATCH] Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb

2020-08-23 Thread Dinghao Liu
When kmalloc() on buf fails, urb should be freed just like when kmalloc() on dr fails. Signed-off-by: Dinghao Liu --- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 8d2608ddfd08..f88968bcdd6a 100644

[PATCH] NFC: st95hf: Fix memleak in st95hf_in_send_cmd

2020-08-23 Thread Dinghao Liu
When down_killable() fails, skb_resp should be freed just like when st95hf_spi_send() fails. Signed-off-by: Dinghao Liu --- drivers/nfc/st95hf/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c index 9642971e89ce

[PATCH] watchdog: Fix double-free in watchdog_cdev_register

2020-08-23 Thread Dinghao Liu
efore misc_register") Signed-off-by: Dinghao Liu --- drivers/watchdog/watchdog_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 6798addabd5a..8ee78e26feb1 100644 --- a/drivers/watchdog/watchdog_d

[PATCH] ntb: intel: Fix memleak in intel_ntb_pci_probe

2020-08-23 Thread Dinghao Liu
The default error branch of a series of pdev_is_gen calls should free ndev just like what we've done in these calls. Signed-off-by: Dinghao Liu --- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b

[PATCH] vme: ca91cx42: fix memleak in ca91cx42_dma_list_add

2020-08-23 Thread Dinghao Liu
When we encounter invalid data width or address space, entry should be freed just like what we've done in the previous error paths. Signed-off-by: Dinghao Liu --- drivers/vme/bridges/vme_ca91cx42.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/vme/bridges

[PATCH] [v2] drm/omap: Fix runtime PM imbalance on error

2020-08-22 Thread Dinghao Liu
the counter balanced. Signed-off-by: Dinghao Liu --- Changelog: v2: - Fix 5 additional similar cases in omapdrm. --- drivers/gpu/drm/omapdrm/dss/dispc.c | 7 +-- drivers/gpu/drm/omapdrm/dss/dsi.c | 7 +-- drivers/gpu/drm/omapdrm/dss/dss.c | 7 +-- drivers/gpu/drm/omapdrm/dss/hdmi4.c

Re: Re: [PATCH] drm/omap: Fix runtime PM imbalance in dsi_runtime_get

2020-08-22 Thread dinghao . liu
> Hi, > > On 21/08/2020 10:45, Dinghao Liu wrote: > > pm_runtime_get_sync() increments the runtime PM usage counter > > even when it returns an error code. However, users of > > dsi_runtime_get(), a direct wrapper of pm_runtime_get_sync(), > > assume that PM usage

Re: Re: [PATCH] IB/uverbs: Fix memleak in ib_uverbs_add_one

2020-08-21 Thread dinghao . liu
> > > On 21 Aug 2020, at 10:10, Dinghao Liu wrote: > > > > When ida_alloc_max() fails, uverbs_dev should be freed > > just like when init_srcu_struct() fails. It's the same > > for the error paths after this call. > > > > Signed-off-by: Din

[PATCH] crypto: ccree - fix runtime PM imbalance on error

2020-08-21 Thread dinghao . liu
the counter balanced. Fixes: 8c7849a30255c ("crypto: ccree - simplify Runtime PM handling") Signed-off-by: Dinghao Liu --- drivers/crypto/ccree/cc_pm.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccree/cc_pm.c b/drivers/crypto/ccree/cc_

[PATCH] IB/uverbs: Fix memleak in ib_uverbs_add_one

2020-08-21 Thread Dinghao Liu
When ida_alloc_max() fails, uverbs_dev should be freed just like when init_srcu_struct() fails. It's the same for the error paths after this call. Signed-off-by: Dinghao Liu --- drivers/infiniband/core/uverbs_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/core

[PATCH] drm/omap: Fix runtime PM imbalance in dsi_runtime_get

2020-08-21 Thread Dinghao Liu
to keep the counter balanced. Fixes: 4fbafaf371be7 ("OMAP: DSS2: Use PM runtime & HWMOD support") Signed-off-by: Dinghao Liu --- drivers/gpu/drm/omapdrm/dss/dsi.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/g

[PATCH] media: atomisp: fix memleak in ia_css_stream_create

2020-08-20 Thread Dinghao Liu
When aspect_ratio_crop_init() fails, curr_stream needs to be freed just like what we've done in the following error paths. However, current code is returning directly and ends up leaking memory. Signed-off-by: Dinghao Liu --- drivers/staging/media/atomisp/pci/sh_css.c | 2 +- 1 file changed, 1

Re: Re: Re: [PATCH] video: backlight: sky81452-backlight: Fix reference count imbalance on error

2020-08-20 Thread dinghao . liu
> On Thu, 20 Aug 2020, dinghao@zju.edu.cn wrote: > > > > On Wed, 19 Aug 2020, Markus Elfring wrote: > > > > > > > > When of_property_read_u32_array() returns an error code, > > > > > a pairing refcount decrement is needed to keep np's refcount balanced. > > > > > > > > Can another

[PATCH] [v2] wilc1000: Fix memleak in wilc_bus_probe

2020-08-19 Thread Dinghao Liu
When devm_clk_get() returns -EPROBE_DEFER, spi_priv should be freed just like when wilc_cfg80211_init() fails. Fixes: 854d66df74aed ("staging: wilc1000: look for rtc_clk clock in spi mode") Signed-off-by: Dinghao Liu --- Changelog: v2: - Remove 'staging' prefix in subject. --- d

[PATCH] [v2] wilc1000: Fix memleak in wilc_sdio_probe

2020-08-19 Thread Dinghao Liu
When devm_clk_get() returns -EPROBE_DEFER, sdio_priv should be freed just like when wilc_cfg80211_init() fails. Fixes: 8692b047e86cf ("staging: wilc1000: look for rtc_clk clock") Signed-off-by: Dinghao Liu --- Changelog: v2: - Remove 'staging' prefix in subject. --- drivers/ne

Re: Re: [PATCH] staging: wilc1000: Fix memleak in wilc_sdio_probe

2020-08-19 Thread dinghao . liu
ajay.kat...@microchip.com写道: > Thanks for submitting the patch. The code changes looks okay to me. > > The driver is now moved out of staging so 'staging' prefix is not > required in subject. For future patches on wilc driver, the 'staging' > prefix can be removed. > > For this patch, I am not

[PATCH] ASoC: qcom: common: Fix refcount imbalance on error

2020-08-19 Thread Dinghao Liu
for_each_child_of_node returns a node pointer np with refcount incremented. So when devm_kzalloc fails, a pairing refcount decrement is needed to keep np's refcount balanced. Fixes: 16395ceee11f8 ("ASoC: qcom: common: Fix NULL pointer in of parser") Signed-off-by: Dinghao Liu --- soun

Re: Re: [PATCH] video: backlight: sky81452-backlight: Fix reference count imbalance on error

2020-08-19 Thread dinghao . liu
> On Wed, 19 Aug 2020, Markus Elfring wrote: > > > > When of_property_read_u32_array() returns an error code, > > > a pairing refcount decrement is needed to keep np's refcount balanced. > > > > Can another imperative wording be helpful for the change description? > >

[PATCH] staging: wilc1000: Fix memleak in wilc_bus_probe

2020-08-19 Thread Dinghao Liu
When devm_clk_get() returns -EPROBE_DEFER, spi_priv should be freed just like when wilc_cfg80211_init() fails. Fixes: 854d66df74aed ("staging: wilc1000: look for rtc_clk clock in spi mode") Signed-off-by: Dinghao Liu --- drivers/net/wireless/microchip/wilc1000/spi.c | 5 +++-- 1 file

[PATCH] staging: wilc1000: Fix memleak in wilc_sdio_probe

2020-08-19 Thread Dinghao Liu
When devm_clk_get() returns -EPROBE_DEFER, sdio_priv should be freed just like when wilc_cfg80211_init() fails. Fixes: 8692b047e86cf ("staging: wilc1000: look for rtc_clk clock") Signed-off-by: Dinghao Liu --- drivers/net/wireless/microchip/wilc1000/sdio.c | 5 +++-- 1 file

[PATCH] drm/crc-debugfs: Fix memleak in crc_control_write

2020-08-19 Thread Dinghao Liu
When verify_crc_source() fails, source needs to be freed. However, current code is returning directly and ends up leaking memory. Fixes: c0811a7d5befe ("drm/crc: Cleanup crtc_crc_open function") Signed-off-by: Dinghao Liu --- drivers/gpu/drm/drm_debugfs_crc.c | 4 +++- 1 file

[PATCH] RDMA/rxe: Fix memleak in rxe_mem_init_user

2020-08-19 Thread Dinghao Liu
When page_address() fails, umem should be freed just like when rxe_mem_alloc() fails. Signed-off-by: Dinghao Liu --- drivers/infiniband/sw/rxe/rxe_mr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c index cdd811a45120

[PATCH] video: backlight: sky81452-backlight: Fix refcount imbalance on error

2020-08-18 Thread Dinghao Liu
When of_property_read_u32_array() returns an error code, a pairing refcount decrement is needed to keep np's refcount balanced. Fixes: f705806c9f355 ("backlight: Add support Skyworks SKY81452 backlight driver") Signed-off-by: Dinghao Liu --- drivers/video/backlight/sky81452-backl

[PATCH] [v2] ASoC: intel: Fix memleak in sst_media_open

2020-08-13 Thread Dinghao Liu
When power_up_sst() fails, stream needs to be freed just like when try_module_get() fails. However, current code is returning directly and ends up leaking memory. Fixes: 0121327c1a68b ("ASoC: Intel: mfld-pcm: add control for powering up/down dsp") Signed-off-by: Dinghao Liu --- Chan

Re: Re: [PATCH] ASoC: intel: Fix memleak in sst_media_open

2020-08-13 Thread dinghao . liu
> > On 8/9/20 3:56 AM, Dinghao Liu wrote: > > When power_up_sst() fails, stream needs to be freed > > just like when try_module_get() fails. However, current > > code is returning directly and ends up leaking memory. > > > > Fixes: 0121327c1a68b ("ASoC:

[PATCH] [v2] ALSA: echoaudio: Fix potential Oops in snd_echo_resume()

2020-08-13 Thread Dinghao Liu
Freeing chip on error may lead to an Oops at the next time the system goes to resume. Fix this by removing all snd_echo_free() calls on error. Fixes: 47b5d028fdce8 ("ALSA: Echoaudio - Add suspend support #2") Signed-off-by: Dinghao Liu --- Changelog: v2: - Remove snd_echo_free() ca

Re: Re: [PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume()

2020-08-13 Thread dinghao . liu
> On Mon, 10 Aug 2020 08:14:58 +0200, > Dinghao Liu wrote: > > > > When restore_dsp_rettings() fails, chip should be freed > > just like when init_hw() and request_irq() fails. > > > > Fixes: 47b5d028fdce8 ("ALSA: Echoaudio - Add suspend su

Re: Re: [PATCH] ALSA: pci/asihpi: Fix memory leak in snd_card_asihpi_capture_open()

2020-08-13 Thread dinghao . liu
> On Mon, 10 Aug 2020 08:39:55 +0200, > Dinghao Liu wrote: > > > > When snd_pcm_hw_constraint_pow2() fails, dpcm should be freed > > just like when hpi_instream_open() fails. > > It will be cleaned up via runtime->private_free call in the caller > side (snd_p

[PATCH] ALSA: pci/asihpi: Fix memory leak in snd_card_asihpi_capture_open()

2020-08-10 Thread Dinghao Liu
When snd_pcm_hw_constraint_pow2() fails, dpcm should be freed just like when hpi_instream_open() fails. Fixes: 719f82d3987aa ("ALSA: Add support of AudioScience ASI boards") Signed-off-by: Dinghao Liu --- sound/pci/asihpi/asihpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletio

[PATCH] ALSA: echoaudio: Fix memory leak in snd_echo_resume()

2020-08-10 Thread Dinghao Liu
When restore_dsp_rettings() fails, chip should be freed just like when init_hw() and request_irq() fails. Fixes: 47b5d028fdce8 ("ALSA: Echoaudio - Add suspend support #2") Signed-off-by: Dinghao Liu --- sound/pci/echoaudio/echoaudio.c | 1 + 1 file changed, 1 insertion(+) diff --g

[PATCH] ASoC: intel: Fix memleak in sst_media_open

2020-08-09 Thread Dinghao Liu
When power_up_sst() fails, stream needs to be freed just like when try_module_get() fails. However, current code is returning directly and ends up leaking memory. Fixes: 0121327c1a68b ("ASoC: Intel: mfld-pcm: add control for powering up/down dsp") Signed-off-by: Dinghao Liu --- sound

Re: Re: [PATCH] ALSA: usb-audio: Fix memleak in scarlett2_add_new_ctl

2020-08-07 Thread dinghao . liu
Takashi Iwai ti...@suse.de写道: > On Fri, 07 Aug 2020 09:12:27 +0200, > Dinghao Liu wrote: > > > > When snd_usb_mixer_add_control() fails, elem needs to be > > freed just like when snd_ctl_new1() fails. However, current > > code is returning direc

[PATCH] ALSA: usb-audio: Fix memleak in scarlett2_add_new_ctl

2020-08-07 Thread Dinghao Liu
When snd_usb_mixer_add_control() fails, elem needs to be freed just like when snd_ctl_new1() fails. However, current code is returning directly and ends up leaking memory. Fixes: 9e4d5c1be21f0 ("ALSA: usb-audio: Scarlett Gen 2 mixer interface") Signed-off-by: Dinghao Liu ---

<    1   2   3   4   >