[PATCH] net: liquidio: fix a NULL pointer dereference

2019-03-10 Thread Kangjie Lu
In case octeon_alloc_soft_command fails, the fix reports the error and returns to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/cavium/liquidio/lio_main.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/cavium/liquidio

[PATCH] net: 8390: fix potential NULL pointer dereferences

2019-03-10 Thread Kangjie Lu
In case ioremap fails, the fix returns to avoid NULL pointer dereferences. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/8390/pcnet_cs.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c index

[PATCH] net: lan9303: fix missing error handling

2019-03-10 Thread Kangjie Lu
Both lan9303_phy_write and regmap_write may fail. The fix adds the error handling to print error messages upon failure. Signed-off-by: Kangjie Lu --- drivers/net/dsa/lan9303-core.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303

[PATCH] net: spi: fix a potential NULL pointer dereference

2019-03-09 Thread Kangjie Lu
In case alloc_workqueue fails to allocate the work queue and returns NULL, the fix releases the resources and returns -ENOMEM. Signed-off-by: Kangjie Lu --- drivers/net/can/spi/mcp251x.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can

[PATCH] isdn: mISDNinfineon: fix potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case ioremap fails, the fix returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/isdn/hardware/mISDN/mISDNinfineon.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn

[PATCH] isdn: hfcpci: fix potential NULL pointer dereference

2019-03-08 Thread Kangjie Lu
In case ioremap fails, the fix reports an error and returns. Signed-off-by: Kangjie Lu --- drivers/isdn/hardware/mISDN/hfcpci.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c index ebb3fa2e1d00..b400d6528a56

[PATCH] net: ixgbevf: fix a missing check of ixgbevf_write_msg_read_ack

2019-03-08 Thread Kangjie Lu
If ixgbevf_write_msg_read_ack fails, return its error code upstream Signed-off-by: Kangjie Lu --- drivers/net/ethernet/intel/ixgbevf/vf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c

Re: [PATCH] isdn: mISDN: Fix potential NULL pointer dereference of kzalloc

2019-03-02 Thread Kangjie Lu
On 3/2/19 3:26 PM, Gustavo A. R. Silva wrote: On 3/2/19 3:20 PM, Aditya Pakki wrote: Allocating memory via kzalloc for phi may fail and causes a NULL pointer dereference. This patch avoids such a scenario. Was this detected by Coccinelle? It was detected by an LLVM-based static analyzer

[PATCH v2] libertas: add checks for the return value of sysfs_create_group

2019-01-08 Thread Kangjie Lu
sysfs_create_group() could fail. The fix checkes its return values and issue error messages if it fails. Signed-off-by: Kangjie Lu --- drivers/net/wireless/marvell/libertas/mesh.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/marvell/libertas/mesh.c b/drivers

[PATCH] net: dsa: bcm_sf2: Propagate error value from mdio_write

2018-12-26 Thread Kangjie Lu
Both bcm_sf2_sw_indir_rw and mdiobus_write_nested could fail, so let's return their error codes upstream. Signed-off-by: Kangjie Lu --- drivers/net/dsa/bcm_sf2.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_

[PATCH v2] net: dsa: bcm_sf2: Propagate error value from mdio_write

2018-12-26 Thread Kangjie Lu
Both bcm_sf2_sw_indir_rw and mdiobus_write_nested could fail, so let's return their error codes upstream. Signed-off-by: Kangjie Lu --- drivers/net/dsa/bcm_sf2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c

[PATCH] wireless: ath: return error code upstream

2018-12-25 Thread Kangjie Lu
ath6kl_wmi_cmd_send could fail, so let's return its error code upstream. Signed-off-by: Kangjie Lu --- drivers/net/wireless/ath/ath6kl/wmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/

[PATCH] isdn: eicon: fix a missing check of api_parse

2018-12-25 Thread Kangjie Lu
api_parse can fail, and if it fails, we should not use the ss_parms which can be incorrect. The fix checks its return value and stops using ss_parms if api_parse fails. Signed-off-by: Kangjie Lu --- drivers/isdn/hardware/eicon/message.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion

[PATCH] net: marvell: fix a missing check of acpi_match_device

2018-12-25 Thread Kangjie Lu
When acpi_match_device fails, its return value is NULL. Directly using the return value without a check may result in a NULL-pointer dereference. The fix checks if acpi_match_device fails, and if so, returns -EINVAL. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

[PATCH] tipc: fix a missing check of genlmsg_put

2018-12-25 Thread Kangjie Lu
genlmsg_put could fail. The fix inserts a check of its return value, and if it fails, returns -EMSGSIZE. Signed-off-by: Kangjie Lu --- net/tipc/netlink_compat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index 6376467e78f8

[PATCH] net: sfc: checks status of efx_mcdi_rpc

2018-12-25 Thread Kangjie Lu
efx_mcdi_rpc() could fail. The fix checks its status and issues an error message if it fails. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/sfc/mcdi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index dfad93fca0a6

[PATCH] wan: fix a missing check of spi_write_then_read

2018-12-25 Thread Kangjie Lu
When spi_write_then_read() fails, "data" can be uninitialized and thus may contain a random value; the following execution checks "data" with a mask, the result could be random. The fix inserts a check of spi_write_then_read(): if it fails, always returns -1. Signe

[PATCH] ethernet: atl1e: checking the status of atl1e_write_phy_reg

2018-12-25 Thread Kangjie Lu
atl1e_write_phy_reg() could fail. The fix issues an error message when it fails. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net

[PATCH] dsa: return error code upstream

2018-12-25 Thread Kangjie Lu
Both bcm_sf2_sw_indir_rw and mdiobus_write_nested could fail, so let's return their error codes upstream. Signed-off-by: Kangjie Lu --- drivers/net/dsa/bcm_sf2.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_

[PATCH] ipset: fix a missing check of nla_parse

2018-12-25 Thread Kangjie Lu
When nla_parse fails, we should not use the results (the first argument). The fix checks if it fails, and if so, returns its error code upstream. Signed-off-by: Kangjie Lu --- net/netfilter/ipset/ip_set_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/netfilter

[PATCH] wireless: marvell: add checks for the return value of sysfs_create_group

2018-12-25 Thread Kangjie Lu
sysfs_create_group() could fail, so let's check its return values and issue error messages if it fails. Signed-off-by: Kangjie Lu --- drivers/net/wireless/marvell/libertas/mesh.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/marvell/libertas/mesh.c b/driver

[PATCH] sunrpc: remove redundant code

2018-12-25 Thread Kangjie Lu
If no bytes to decode, just use "xdr->p" instead of calling xdr_inline_decode to get it. The fix cleans up the code. Signed-off-by: Kangjie Lu --- net/sunrpc/xprtrdma/rpc_rdma.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c

[PATCH] sunrpc: fix a missing check of xdr_inline_decode

2018-12-25 Thread Kangjie Lu
xdr_inline_decode() could fail. When it fails, the return value is NULL and should not be dereferenced. The fix checks if xdr_inline_decode fails, and if so, returns. Signed-off-by: Kangjie Lu --- net/sunrpc/xprtrdma/backchannel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sunrpc

[PATCH] net: stmicro: fix a missing check of clk_prepare

2018-12-25 Thread Kangjie Lu
clk_prepare() could fail, so let's check its status, and if it fails, return its error code upstream. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/

[PATCH] net: (cpts) fix a missing check of clk_prepare

2018-12-25 Thread Kangjie Lu
clk_prepare() could fail, so let's check its status, and if it fails, return its error code upstream. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/ti/cpts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethern

[PATCH] net: brcm80211: add a check for the status of usb_register

2018-12-25 Thread Kangjie Lu
usb_register() may fail, so let's check its status and issue an error message if it fails. Signed-off-by: Kangjie Lu --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm

[PATCH] ethernet: (niu) fix missing checks of niu_pci_eeprom_read

2018-12-24 Thread Kangjie Lu
niu_pci_eeprom_read() may fail, so we should check its return value before using the read data. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/sun/niu.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun

[PATCH] ethernet: (80003es2lan) fix missing checks for return value of reg write

2018-12-24 Thread Kangjie Lu
e1000_write_kmrn_reg_80003es2lan() may fail. The fix checks its return value and returns with its error code if it fails. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/intel/e1000e/80003es2lan.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net

[PATCH] bpf: fix missing checks of the return value of check_reg_arg

2018-12-24 Thread Kangjie Lu
check_reg_arg() may fail. This fix inserts checks for its return value. If check_reg_arg() fails, issues an error message. Signed-off-by: Kangjie Lu --- kernel/bpf/verifier.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf

[PATCH] netfilter: fix a missing check of nla put failure

2018-12-20 Thread Kangjie Lu
If nla_nest_start() may fail. The fix checks its return value and goes to nla_put_failure if it fails. Signed-off-by: Kangjie Lu --- net/netfilter/nf_tables_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index

[PATCH] net: netxen: fix a missing check and an uninitialized use

2018-12-20 Thread Kangjie Lu
When netxen_rom_fast_read() fails, "bios" is left uninitialized and may contain random value, thus should not be used. The fix ensures that if netxen_rom_fast_read() fails, we return "-EIO". Signed-off-by: Kangjie Lu --- drivers/net/ethernet/qlogic/netxen/netxen_nic_in

[PATCH] net: 80003es2lan: fix a missing check of read failure

2018-12-20 Thread Kangjie Lu
its error code if it fails. Signed-off-by: Kangjie Lu --- drivers/net/ethernet/intel/e1000e/80003es2lan.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c b/drivers/net/ethernet/intel/e1000e/80003es2lan.c index 25

[PATCH] bpf: fix a missing check of return value

2018-12-20 Thread Kangjie Lu
check_reg_arg() may fail and not mark correct data in "env". This fix inserts a check that ensures check_reg_arg() is successful, and if it is not, the fix stops further operations and returns an error upstream. Signed-off-by: Kangjie Lu --- kernel/bpf/verifier.c | 4 +++- 1 file

[PATCH] rds: fix an infoleak in rds_inc_info_copy

2016-06-02 Thread Kangjie Lu
The last field "flags" of object "minfo" is not initialized. Copying this object out may leak kernel stack data. Assign 0 to it to avoid leak. Signed-off-by: Kangjie Lu --- net/rds/recv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/rds/recv.c b/net/rds/

[PATCH] tipc: fix an infoleak in tipc_nl_compat_link_dump

2016-06-02 Thread Kangjie Lu
link_info.str is a char array of size 60. Memory after the NULL byte is not initialized. Sending the whole object out can cause a leak. Signed-off-by: Kangjie Lu --- net/tipc/netlink_compat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/tipc/netlink_compat.c b/net

[PATCH] tipc: fix an infoleak in tipc_nl_compat_link_dump

2016-06-01 Thread Kangjie Lu
link_info.str is a char array of size 60. Memory after the NULL byte is not initialized. Sending the whole object out can cause a leak. Signed-off-by: Kangjie Lu --- net/tipc/netlink_compat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/tipc/netlink_compat.c b/net/tipc

[PATCH] net: fix potential infoleak in rds_inc_info_copy

2016-06-01 Thread Kangjie Lu
The last field "flags" of object "minfo" is not initialized. Copying this object out may leak kernel stack data. Assign 0 to it to avoid leak. Signed-off-by: Kangjie Lu --- net/rds/recv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/rds/recv.c b/net/rds/

[PATCH] ethtool: fix a kernel infoleak in ethtool_get_pauseparam

2016-06-01 Thread Kangjie Lu
The field autoneg of pauseparam is not initialized in some implementations of get_pauseparam(), but the whole object is copied to userland. Signed-off-by: Kangjie Lu --- net/core/ethtool.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/core/ethtool.c b/net/core

[PATCH] fix a kernel infoleak in x25 module

2016-05-08 Thread Kangjie Lu
Stack object "dte_facilities" is allocated in x25_rx_call_request(), which is supposed to be initialized in x25_negotiate_facilities. However, 5 fields (8 bytes in total) are not initialized. This object is then copied to userland via copy_to_user, thus infoleak occurs. Signed-off-by:

[PATCH] fix infoleak in rtnetlink

2016-05-03 Thread Kangjie Lu
The stack object “map” has a total size of 32 bytes. Its last 4 bytes are padding generated by compiler. These padding bytes are not initialized and sent out via “nla_put”. Signed-off-by: Kangjie Lu --- net/core/rtnetlink.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions

[PATCH] fix infoleak in wireless

2016-05-03 Thread Kangjie Lu
The 6-bytes array “mac_addr” is not initialized in the dump_station implementations of “drivers/staging/wilc1000/wilc_wfi_cfgoperations.c” and “drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c”, so all 6 bytes may be leaked. Signed-off-by: Kangjie Lu --- net/wireless/nl80211.c | 1 + 1 file

[PATCH] fix infoleak in llc

2016-05-03 Thread Kangjie Lu
The stack object “info” has a total size of 12 bytes. Its last byte is padding which is not initialized and leaked via “put_cmsg”. Signed-off-by: Kangjie Lu --- net/llc/af_llc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index b3c52e3..8ae3ed9 100644