[PATCH] block: Fix an error handling in add_partition

2021-01-15 Thread Dinghao Liu
Once we have called device_initialize(), we should use put_device() to give up the reference on error, just like what we have done on failure of device_add(). Signed-off-by: Dinghao Liu --- block/partitions/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block

Re: Re: [PATCH] block: Fix an error handling in add_partition

2021-01-16 Thread dinghao . liu
> On 1/15/21 11:34 PM, Dinghao Liu wrote: > > Once we have called device_initialize(), we should > > use put_device() to give up the reference on error, > > just like what we have done on failure of device_add(). > > > > Signed-off-by: Dinghao Liu > Please cons

Re: Re: [PATCH] net: ethernet: Fix memleak in ethoc_probe

2021-01-06 Thread dinghao . liu
> On Mon, 28 Dec 2020 16:14:17 -0500 Konstantin Ryabitsev wrote: > > On Mon, Dec 28, 2020 at 01:05:26PM -0800, Florian Fainelli wrote: > > > On 12/28/2020 12:23 PM, Konstantin Ryabitsev wrote: > > > > On Thu, Dec 24, 2020 at 01:57:40PM -0800, Florian Fainelli wrote: > > > Konstantin,

Re: Re: [PATCH] net: ethernet: Fix memleak in ethoc_probe

2021-01-06 Thread dinghao . liu
> On Wed, 6 Jan 2021 18:56:23 +0800 (GMT+08:00) dinghao@zju.edu.cn > wrote: > > > I used this one for a test: > > > > > > https://patchwork.kernel.org/project/netdevbpf/patch/1609312994-121032-1-git-send-email-abaci-bug...@linux.alibaba.com/ > > > > > > I'm not getting the Fixes tag when I

[PATCH] block: Fix an error handling in add_partition

2021-01-17 Thread Dinghao Liu
Once we have called device_initialize(), we should use put_device() to give up the reference on error, just like what we have done on failure of device_add(). Signed-off-by: Dinghao Liu --- Changelog: v2: - Refine commit message. --- block/partitions/core.c | 2 +- 1 file changed, 1 insertion

[PATCH] [v3] block: Fix an error handling in add_partition

2021-01-17 Thread Dinghao Liu
Once we have called device_initialize(), we should use put_device() to give up the reference on error, just like what we have done on failure of device_add(). Signed-off-by: Dinghao Liu --- Changelog: v2: - Refine commit message. v3: - Add '[v3]' to the title. --- block/partitions/core.c | 2

[PATCH] extcon: Fix error handling in extcon_dev_register

2021-01-19 Thread Dinghao Liu
When devm_kcalloc() fails, we should execute device_unregister() to unregister edev->dev from system. Fixes: 046050f6e623e ("extcon: Update the prototype of extcon_register_notifier() with enum extcon") Signed-off-by: Dinghao Liu --- drivers/extcon/extcon.c | 1 + 1 file changed

[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

[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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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

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

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

[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] 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] 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] 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

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

[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

[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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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

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] 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

[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] 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] 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] 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] 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: 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] 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

[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] 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] [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] 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] 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] 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

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

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

[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

[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

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] [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

[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] 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

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] 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] 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] 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] 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/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] 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

Re: Re: [PATCH] iommu/intel: Fix memleak in intel_irq_remapping_alloc

2021-01-04 Thread dinghao . liu
> On 1/3/21 2:22 PM, dinghao@zju.edu.cn wrote: > >> On 2021/1/3 12:08, dinghao@zju.edu.cn wrote: > >>>> Hi, > >>>> > >>>> On 2021/1/2 17:50, Dinghao Liu wrote: > >>>>> When irq_domain_get_irq_data() or

[PATCH] [v2] iommu/intel: Fix memleak in intel_irq_remapping_alloc

2021-01-04 Thread Dinghao Liu
When irq_domain_get_irq_data() or irqd_cfg() fails at i == 0, data allocated by kzalloc() has not been freed before returning, which leads to memleak. Fixes: b106ee63abccb ("irq_remapping/vt-d: Enhance Intel IR driver to support hierarchical irqdomains") Signed-off-by: D

[PATCH] ubifs: Fix memleak in ubifs_init_authentication

2021-01-04 Thread Dinghao Liu
When crypto_shash_digestsize() fails, c->hmac_tfm has not been freed before returning, which leads to memleak. Fixes: 49525e5eecca5 ("ubifs: Add helper functions for authentication support") Signed-off-by: Dinghao Liu --- fs/ubifs/auth.c | 2 +- 1 file changed, 1 insertion(+

[PATCH] media: v4l2: Fix memleak in videobuf_read_one

2021-01-05 Thread Dinghao Liu
When videobuf_waiton() fails, we should execute clean functions to prevent memleak. It's the same when __videobuf_copy_to_user() fails. Fixes: 7a7d9a89d0307 ("V4L/DVB (6251): Replace video-buf to a more generic approach") Signed-off-by: Dinghao Liu --- drivers/media/v4l2-core/video

[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: 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] 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] iommu/intel: Fix memleak in intel_irq_remapping_alloc

2021-01-02 Thread Dinghao Liu
When irq_domain_get_irq_data() or irqd_cfg() fails meanwhile i == 0, data allocated by kzalloc() has not been freed before returning, which leads to memleak. Fixes: b106ee63abccb ("irq_remapping/vt-d: Enhance Intel IR driver to support hierarchical irqdomains") Signed-off-by: D

Re: Re: [PATCH] iommu/intel: Fix memleak in intel_irq_remapping_alloc

2021-01-02 Thread dinghao . liu
> Hi, > > On 2021/1/2 17:50, Dinghao Liu wrote: > > When irq_domain_get_irq_data() or irqd_cfg() fails > > meanwhile i == 0, data allocated by kzalloc() has not > > been freed before returning, which leads to memleak. > > > > Fixes: b106ee63abccb ("

Re: Re: [PATCH] iommu/intel: Fix memleak in intel_irq_remapping_alloc

2021-01-02 Thread dinghao . liu
> On 2021/1/3 12:08, dinghao@zju.edu.cn wrote: > >> Hi, > >> > >> On 2021/1/2 17:50, Dinghao Liu wrote: > >>> When irq_domain_get_irq_data() or irqd_cfg() fails > >>> meanwhile i == 0, data allocated by kzalloc() has not >

[PATCH] net: ixgbe: Fix memleak in ixgbe_configure_clsu32

2021-01-03 Thread Dinghao Liu
When ixgbe_fdir_write_perfect_filter_82599() fails, input allocated by kzalloc() has not been freed, which leads to memleak. Signed-off-by: Dinghao Liu --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net

Re: Re: [Intel-wired-lan] [PATCH] net: ixgbe: Fix memleak in ixgbe_configure_clsu32

2021-01-03 Thread dinghao . liu
> Dear Dinghao, > > > Am 03.01.21 um 09:08 schrieb Dinghao Liu: > > When ixgbe_fdir_write_perfect_filter_82599() fails, > > input allocated by kzalloc() has not been freed, > > which leads to memleak. > > Nice find. Thank you for your patches. Out of curio

[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] 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

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] 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

[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: 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

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

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(

[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

[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] 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] 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] 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] 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] 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

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] 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] 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] [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

[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

  1   2   3   4   >