[PATCH] hostap: Fix memleak in prism2_config

2021-03-29 Thread Dinghao Liu
When prism2_hw_config() fails, we just return an error code without any resource release, which may lead to memleak. Signed-off-by: Dinghao Liu --- drivers/net/wireless/intersil/hostap/hostap_cs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless

Re: Re: [PATCH] iwlegacy: Add missing check in il4965_commit_rxon

2021-02-28 Thread dinghao . liu
> On Sun, Feb 28, 2021 at 08:25:22PM +0800, Dinghao Liu wrote: > > There is one il_set_tx_power() call in this function without > > return value check. Print error message and return error code > > on failure just like the other il_set_tx_power() call. > > We have fe

[PATCH] iwlegacy: Add missing check in il4965_commit_rxon

2021-02-28 Thread Dinghao Liu
There is one il_set_tx_power() call in this function without return value check. Print error message and return error code on failure just like the other il_set_tx_power() call. Signed-off-by: Dinghao Liu --- drivers/net/wireless/intel/iwlegacy/4965.c | 6 +- 1 file changed, 5 insertions

[PATCH] i40e: Fix error handling in i40e_vsi_open

2021-02-28 Thread Dinghao Liu
When vsi->type == I40E_VSI_FDIR, we have caught the return value of i40e_vsi_request_irq() but without further handling. Check and execute memory clean on failure just like the other i40e_vsi_request_irq(). Fixes: 8a9eb7d3cbcab ("i40e: rework fdir setup and teardown") Signed-off-by

[PATCH] e1000e: Fix error handling in e1000_set_d0_lplu_state_82571

2021-02-28 Thread Dinghao Liu
There is one e1e_wphy() call in e1000_set_d0_lplu_state_82571 that we have caught its return value but lack further handling. Check and terminate the execution flow just like other e1e_wphy() in this function. Signed-off-by: Dinghao Liu --- drivers/net/ethernet/intel/e1000e/82571.c | 2 ++ 1

[PATCH] netfilter: Fix memleak in nf_nat_init

2021-01-09 Thread Dinghao Liu
When register_pernet_subsys() fails, nf_nat_bysource should be freed just like when nf_ct_extend_register() fails. Fixes: 1cd472bf036ca ("netfilter: nf_nat: add nat hook register functions to nf_nat") Signed-off-by: Dinghao Liu --- net/netfilter/nf_nat_core.c | 1 + 1 file changed, 1

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 do

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, would

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 curiosit

[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

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

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

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

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

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

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

Re: Re: [PATCH] octeontx2-af: Fix use of uninitialized pointer bmap

2020-07-24 Thread dinghao . liu
> From: Dinghao Liu > Date: Fri, 24 Jul 2020 16:06:57 +0800 > > > If req->ctype does not match any of NIX_AQ_CTYPE_CQ, > > NIX_AQ_CTYPE_SQ or NIX_AQ_CTYPE_RQ, pointer bmap will remain > > uninitialized and be accessed in test_bit(), which can lead > > to kern

[PATCH] octeontx2-af: Fix use of uninitialized pointer bmap

2020-07-24 Thread Dinghao Liu
If req->ctype does not match any of NIX_AQ_CTYPE_CQ, NIX_AQ_CTYPE_SQ or NIX_AQ_CTYPE_RQ, pointer bmap will remain uninitialized and be accessed in test_bit(), which can lead to kernal crash. Fix this by returning an error code if this case is triggered. Signed-off-by: Dinghao Liu --- driv

[PATCH] net: smsc911x: Fix runtime PM imbalance on error

2020-05-23 Thread Dinghao Liu
Remove runtime PM usage counter decrement when the increment function has not been called to keep the counter balanced. Signed-off-by: Dinghao Liu --- drivers/net/ethernet/smsc/smsc911x.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/smsc

[PATCH] can: flexcan: Fix runtime PM imbalance on error

2020-05-22 Thread Dinghao Liu
When register_flexcandev() returns an error code, a pairing runtime PM usage counter decrement is needed to keep the counter balanced. Also, call pm_runtime_disable() when register_flexcandev() returns an error code. Signed-off-by: Dinghao Liu --- drivers/net/can/flexcan.c | 2 ++ 1 file

[PATCH] wlcore: fix runtime pm imbalance in wlcore_irq_locked

2020-05-21 Thread Dinghao Liu
When wlcore_fw_status() returns an error code, a pairing runtime PM usage counter decrement is needed to keep the counter balanced. It's the same for all error paths after wlcore_fw_status(). Signed-off-by: Dinghao Liu --- drivers/net/wireless/ti/wlcore/main.c | 17 + 1

Re: Re: [PATCH] wlcore: fix runtime pm imbalance in wl1271_op_suspend

2020-05-20 Thread dinghao . liu
There is a check against ret after out_sleep tag. If wl1271_configure_suspend_ap() returns an error code, ret will be caught by this check and a warning will be issued. "Tony Lindgren" <t...@atomide.com>写道: > * Dinghao Liu [200520 12:58]: > > When wlcore_hw_interrupt_

[PATCH] wlcore: fix runtime pm imbalance in __wl1271_op_remove_interface

2020-05-20 Thread Dinghao Liu
When wl12xx_cmd_role_disable() returns an error code, a pairing runtime PM usage counter decrement is needed to keep the counter balanced. Signed-off-by: Dinghao Liu --- drivers/net/wireless/ti/wlcore/main.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net

[PATCH] wlcore: fix runtime pm imbalance in wl1271_op_suspend

2020-05-20 Thread Dinghao Liu
When wlcore_hw_interrupt_notify() returns an error code, a pairing runtime PM usage counter decrement is needed to keep the counter balanced. Signed-off-by: Dinghao Liu --- drivers/net/wireless/ti/wlcore/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net

[PATCH] wlcore: fix runtime pm imbalance in wlcore_regdomain_config

2020-05-20 Thread Dinghao Liu
pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Dinghao Liu --- drivers/net/wireless/ti/wlcore/main.c | 4 +++- 1 file changed, 3

[PATCH] wlcore: fix runtime pm imbalance in wl1271_tx_work

2020-05-20 Thread Dinghao Liu
There are two error handling paths in this functon. When wlcore_tx_work_locked() returns an error code, we should decrease the runtime PM usage counter the same way as the error handling path beginning from pm_runtime_get_sync(). Signed-off-by: Dinghao Liu --- drivers/net/wireless/ti/wlcore

[PATCH] can: xilinx_can: fix runtime pm imbalance on error

2020-05-20 Thread Dinghao Liu
pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Dinghao Liu --- drivers/net/can/xilinx_can.c | 2 +- 1 file changed, 1 insertion(+), 1