Re: [PATCH] misc: mic: fix a DMA pool free failure

2018-12-04 Thread Wenwen Wang
On Sun, Nov 4, 2018 at 8:05 PM Sudeep Dutt wrote: > > On Thu, 2018-10-18 at 14:46 -0500, Wenwen Wang wrote: > > In _scif_prog_signal(), a DMA pool is allocated if the MIC Coprocessor is > > not X100, i.e., the boolean variable 'x100' is false. This DMA pool will be

[PATCH v2] misc: mic: fix a DMA pool free failure

2018-12-04 Thread Wenwen Wang
e., scif_cb_arg, to store the arguments required by the call back function. A variable 'cb_arg' is allocated in _scif_prog_signal() to pass the arguments. 'cb_arg' will be freed after dma_pool_free() in scif_prog_signal_cb(). Signed-off-by: Wenwen Wang --- drivers/misc/mic/sci

Re: [PATCH v2 1/2] i2c: core-smbus: fix a potential uninitialization bug

2018-05-18 Thread Wenwen Wang
18 at 3:31 PM, Peter Rosin wrote: > On 2018-05-10 13:17, Wolfram Sang wrote: >> On Sat, May 05, 2018 at 07:57:10AM -0500, Wenwen Wang wrote: >>> In i2c_smbus_xfer_emulated(), there are two buffers: msgbuf0 and msgbuf1, >>> which are used to save a series of messages, as me

Re: [PATCH] isdn: eicon: fix a missing-check bug

2018-05-18 Thread Wenwen Wang
Thanks for your suggestion, David! I will revise the patch and resubmit it. Wenwen On Fri, May 11, 2018 at 2:50 PM, David Miller wrote: > From: Wenwen Wang > Date: Sat, 5 May 2018 14:32:46 -0500 > >> To avoid such issues, this patch adds a check after the second copy in

[PATCH] crypto: chtls - fix a missing-check bug

2018-05-18 Thread Wenwen Wang
y() to set a wrong key or other issues. This patch reuses the data copied in the first try so as to ensure these checks will not be bypassed. Signed-off-by: Wenwen Wang --- drivers/crypto/chelsio/chtls/chtls_main.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/

[PATCH v2] isdn: eicon: fix a missing-check bug

2018-05-18 Thread Wenwen Wang
to an invalid number. This way, the user can bypass the verification process of the adapter number and inject inconsistent data. This patch reuses the data copied in diva_xdi_open_adapter() and passes it to diva_xdi_write(). This way, the above issues can be avoided. Signed-off-by: Wenwen Wang --- d

Re: [PATCH] scsi: sg: fix a missing-check bug

2018-05-18 Thread Wenwen Wang
On Mon, May 7, 2018 at 12:13 AM, Douglas Gilbert wrote: > On 2018-05-05 11:21 PM, Wenwen Wang wrote: >> >> In sg_write(), the opcode of the command is firstly copied from the >> userspace pointer 'buf' and saved to the kernel variable 'opcode', using >

[PATCH] gdrom: fix a memory leak bug

2018-12-26 Thread Wenwen Wang
espectively. However, this buffer is not freed after it is used, which can cause a memory leak bug. This patch simply frees the buffer 'gd.cd_info' in exit_gdrom() to fix the above issue. Signed-off-by: Wenwen Wang --- drivers/cdrom/gdrom.c | 1 + 1 file changed, 1 insertion(+) diff -

[PATCH] ALSA: intel8x0: fix a redundant check bug

2018-10-09 Thread Wenwen Wang
ck because 'codec' is greater than 2. However, since 'codec' will be updated in the following execution when 'chip->in_sdin_init' is not zero, this check will be meaningless and the execution should continue, instead of returning the error code EIO. This patch avoids

[PATCH] misc: mic: fix a DMA pool free failure

2018-10-10 Thread Wenwen Wang
hen freeing up the DMA pool because of the modified device address. This patch avoids the above issue by using the variable 'src' (with necessary calculation) to free up the DMA pool. Signed-off-by: Wenwen Wang --- drivers/misc/mic/scif/scif_fence.c | 2 +- 1 file changed, 1 inser

Re: [PATCH] intel_th: Fix a missing-check bug

2018-10-29 Thread Wenwen Wang
Hello, Can anyone confirm this bug? Thanks! Wenwen On Fri, Oct 19, 2018 at 8:47 AM Wenwen Wang wrote: > > In msc_data_sz(), the 'valid_dw' field of the msc block descriptor 'bdesc' > is firstly checked to see whether the descriptor has a valid data width. If >

Re: [PATCH] media: dvb: fix a missing-check bug

2018-10-29 Thread Wenwen Wang
Hello, Can anyone confirm this bug? Thanks! Wenwen On Fri, Oct 19, 2018 at 9:12 AM Wenwen Wang wrote: > > In dvb_audio_write(), the first byte of the user-space buffer 'buf' is > firstly copied and checked to see whether this is a TS packet, which always > starts with 0x

Re: [PATCH v4] drivers/vfio: Fix a redundant copy bug

2018-10-29 Thread Wenwen Wang
Hello, Could you please apply this patch? Thanks! Wenwen On Wed, Oct 17, 2018 at 2:18 PM Wenwen Wang wrote: > > In vfio_spapr_iommu_eeh_ioctl(), if the ioctl command is VFIO_EEH_PE_OP, > the user-space buffer 'arg' is copied to the kernel object 'op' and the > &

Re: [PATCH v4] drivers/vfio: Fix a redundant copy bug

2018-10-29 Thread Wenwen Wang
On Mon, Oct 29, 2018 at 4:32 PM Alex Williamson wrote: > > On Mon, 29 Oct 2018 13:56:54 -0500 > Wenwen Wang wrote: > > > Hello, > > > > Could you please apply this patch? Thanks! > > I'd like to see testing and/or review from David or Alexey since I also

[PATCH] thunderbolt: Fix a missing-check bug

2018-10-17 Thread Wenwen Wang
rocess, 'hdr' is then used to rewrite the header in 'req->response' after memcpy(). This way, the above issue can be avoided. Signed-off-by: Wenwen Wang --- drivers/thunderbolt/ctl.c | 39 ++- 1 file changed, 22 insertions(+), 17 deletions

Re: [PATCH v2] drivers/vfio: Fix a redundant copy bug

2018-10-17 Thread Wenwen Wang
On Mon, Oct 8, 2018 at 1:47 PM Alex Williamson wrote: > > On Mon, 8 Oct 2018 13:06:20 -0500 > Wenwen Wang wrote: > > > In vfio_spapr_iommu_eeh_ioctl(), if the ioctl command is VFIO_EEH_PE_OP, > > the user-space buffer 'arg' is copied to the kernel object &

[PATCH v3] drivers/vfio: Fix a redundant copy bug

2018-10-17 Thread Wenwen Wang
t only copies from 'err.type' to 'err.mask', which is exactly required by the VFIO_EEH_PE_INJECT_ERR op. This patch also adds a 4-byte reserved field in the structure vfio_eeh_pe_op to make sure that the u64 fields in the structure vfio_eeh_pe_err are 8-byte aligned. Sig

Re: [PATCH v3] drivers/vfio: Fix a redundant copy bug

2018-10-17 Thread Wenwen Wang
On Wed, Oct 17, 2018 at 10:45 AM Alex Williamson wrote: > > On Wed, 17 Oct 2018 09:32:04 -0500 > Wenwen Wang wrote: > > > In vfio_spapr_iommu_eeh_ioctl(), if the ioctl command is VFIO_EEH_PE_OP, > > the user-space buffer 'arg' is copied to the kernel object &

[PATCH] drivers/vfio: Fix an 8-byte alignment issue

2018-10-17 Thread Wenwen Wang
This patch adds a 4-byte reserved field in the structure vfio_eeh_pe_op to make sure that the u64 fields in the structure vfio_eeh_pe_err are 8-byte aligned. Signed-off-by: Wenwen Wang --- include/uapi/linux/vfio.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/vfio.h b

Re: [PATCH v3] drivers/vfio: Fix a redundant copy bug

2018-10-17 Thread Wenwen Wang
On Wed, Oct 17, 2018 at 2:05 PM Alex Williamson wrote: > > On Wed, 17 Oct 2018 12:58:26 -0500 > Wenwen Wang wrote: > > > On Wed, Oct 17, 2018 at 10:45 AM Alex Williamson > > wrote: > > > > > > On Wed, 17 Oct 2018 09:32:04 -0500

[PATCH v4] drivers/vfio: Fix a redundant copy bug

2018-10-17 Thread Wenwen Wang
only copies from 'err.type' to 'err.mask', which is exactly required by the VFIO_EEH_PE_INJECT_ERR op. Signed-off-by: Wenwen Wang --- drivers/vfio/vfio_spapr_eeh.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/vfio_spapr_eeh.c b/d

[PATCH] media: isif: fix a NULL pointer dereference bug

2018-10-04 Thread Wenwen Wang
rm_get_resource(). Signed-off-by: Wenwen Wang --- drivers/media/platform/davinci/isif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c index f924e76..340f821 100644 --- a/drivers/media/platfor

[PATCH] s390/qeth: fix a missing-check bug

2018-10-06 Thread Wenwen Wang
ned in the first copy, i.e., 'req_len', an error code EINVAL will be returned after the buffer 'ureq' is freed. Signed-off-by: Wenwen Wang --- drivers/s390/net/qeth_core_main.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/s390/net/qeth_core_main.c b/driver

[PATCH] drivers/vfio: Fix a redundant copy bug

2018-10-07 Thread Wenwen Wang
this case, the fields of 'op', except the field 'err', are actually not used. That is, the second copy has a redundant part. Therefore, for both performance and security reasons, the redundant part of the second copy should be removed. This patch removes such a part in the seco

Re: [PATCH] drivers/vfio: Fix a redundant copy bug

2018-10-08 Thread Wenwen Wang
On Mon, Oct 8, 2018 at 11:43 AM Alex Williamson wrote: > > Hi, > > On Sun, 7 Oct 2018 09:44:25 -0500 > Wenwen Wang wrote: > > > In vfio_spapr_iommu_eeh_ioctl(), if the ioctl command is VFIO_EEH_PE_OP, > > the user-space buffer 'arg' is copied to the ke

[PATCH v2] drivers/vfio: Fix a redundant copy bug

2018-10-08 Thread Wenwen Wang
copy. It only copies from 'err.type' to 'err.mask', which is exactly required by the VFIO_EEH_PE_INJECT_ERR op. Signed-off-by: Wenwen Wang --- drivers/vfio/vfio_spapr_eeh.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/vfio_spapr_eeh.c b/d

[PATCH] firmware: coreboot: Fix a missing-check bug

2018-10-18 Thread Wenwen Wang
of the entry. This patch rewrites the header of each entry after the second copy, using the value acquired in the first copy. Through this way, the above issue can be avoided. Signed-off-by: Wenwen Wang --- drivers/firmware/google/coreboot_table.c | 1 + 1 file changed, 1 insertion(+) diff --git a

[PATCH] misc: mic: fix a DMA pool free failure

2018-10-18 Thread Wenwen Wang
e., scif_cb_arg, to store the arguments required by the call back function. A variable 'cb_arg' is allocated in _scif_prog_signal() to pass the arguments. 'cb_arg' will be freed after dma_pool_free() in scif_prog_signal_cb(). Signed-off-by: Wenwen Wang --- drivers/misc/mic/scif/sc

[PATCH] intel_th: Fix a missing-check bug

2018-10-19 Thread Wenwen Wang
valid_dw' field to a local variable and then performs the check and the calculation on the local variable to avoid the above issue. Signed-off-by: Wenwen Wang --- drivers/hwtracing/intel_th/msu.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/intel_th/

[PATCH] mcb: fix a missing-check bug

2018-10-19 Thread Wenwen Wang
urity risk. This patch adds a necessary check after the second read to make sure the descriptor type is CHAMELEON_DTYPE_GENERAL. Otherwise, an error code EINVAL will be returned. Signed-off-by: Wenwen Wang --- drivers/mcb/mcb-parse.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/m

Re: [PATCH] thunderbolt: Fix a missing-check bug

2018-10-19 Thread Wenwen Wang
On Thu, Oct 18, 2018 at 4:13 AM Mika Westerberg wrote: > > Hi Wenwen, > > On Wed, Oct 17, 2018 at 09:00:29AM -0500, Wenwen Wang wrote: > > In tb_cfg_copy(), the header of the received control package, which is in > > the buffer 'pkg->buffer', is firstly

[PATCH] thunderbolt: Fix a missing-check bug

2018-10-20 Thread Wenwen Wang
ore req->copy(). By doing so, the attacker can inject malicious data, which can cause undefined behavior of the kernel and introduce potential security risk. This patch allocates a new buffer 'buf' to hold the data in 'pkg->buffer'. By performing the checking and cop

[PATCH] thunderbolt: fix a missing-check bug

2018-10-20 Thread Wenwen Wang
the check and the calculation on the copied version to fix the above issue. This patch also rewrites the header in 'req->response + offset' using the copied header to avoid a potential inconsistency issue. Signed-off-by: Wenwen Wang --- drivers/thunderbolt/icm.c | 11 +++---

[PATCH] thunderbolt: fix a missing-check bug

2018-10-20 Thread Wenwen Wang
x27; and then performs the check and copy using 'desc_flags'. Through this way, the above issue can be avoided. Signed-off-by: Wenwen Wang --- drivers/thunderbolt/nhi.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thunderbolt/nhi.c b/drivers/thun

[PATCH] thunderbolt: fix a missing-check bug

2018-10-20 Thread Wenwen Wang
check and supply uncompleted frame, which can cause undefined behavior of the kernel and introduce potential security risk. This patch firstly copies the flag into a local variable 'desc_flags' and then performs the check and copy using 'desc_flags'. Through this way, the above issue ca

[PATCH] iw_cxgb4: fix a missing-check bug

2018-10-20 Thread Wenwen Wang
to a local variable if it is verified to be a valid CQE in t4_next_hw_cqe(). Also, the local variable will be used for the copy in create_read_req_ceq(). Signed-off-by: Wenwen Wang --- drivers/infiniband/hw/cxgb4/cq.c | 8 +--- drivers/infiniband/hw/cxgb4/t4.h | 4 ++-- 2 files changed, 7

Re: [PATCH] iw_cxgb4: fix a missing-check bug

2018-10-20 Thread Wenwen Wang
On Sat, Oct 20, 2018 at 6:41 PM Steve Wise wrote: > > Hey Wenwen, > > > Subject: [PATCH] iw_cxgb4: fix a missing-check bug > > > > In c4iw_flush_hw_cq, the next CQE is acquired through t4_next_hw_cqe(). In > > t4_next_hw_cqe(), the CQE, i.e., 'cq->queue[cq->cidx]', is checked to see > > whether it

Re: [PATCH] thunderbolt: Fix a missing-check bug

2018-10-22 Thread Wenwen Wang
On Mon, Oct 22, 2018 at 3:04 AM Mika Westerberg wrote: > > Hi, > > On Sat, Oct 20, 2018 at 12:55:51PM -0500, Wenwen Wang wrote: > > In tb_ctl_rx_callback(), the checksum of the received control packet is > > calculated on 'pkg->buffer' through tb_crc() and s

[PATCH] staging: luster: llite: fix a potential missing-check bug when copying lumv

2018-04-27 Thread Wenwen Wang
cted, i.e., LOV_USER_MAGIC_V3, an error code will be returned: -EINVAL. Signed-off-by: Wenwen Wang --- drivers/staging/lustre/lustre/llite/dir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index d10

[PATCH] media: staging: atomisp: fix a potential missing-check bug

2018-04-28 Thread Wenwen Wang
as null pointer dereference. This patch saves the pointer returned by the first invocation and removes the second invocation. If the returned pointer is not NULL, the memory content is copied according to the original code. Signed-off-by: Wenwen Wang --- drivers/staging/media/atomisp/pci

Re: [PATCH] staging: luster: llite: fix a potential missing-check bug when copying lumv

2018-04-29 Thread Wenwen Wang
On Sun, Apr 29, 2018 at 8:20 AM, Greg Kroah-Hartman wrote: > On Sat, Apr 28, 2018 at 04:04:25PM +, Dilger, Andreas wrote: >> On Apr 27, 2018, at 17:45, Wenwen Wang wrote: >> > [PATCH] staging: luster: llite: fix potential missing-check bug when >> > copying lumv &

[PATCH] ethtool: fix a potential missing-check bug

2018-04-29 Thread Wenwen Wang
tually copied to user-space. This inconsistent data may also cause undefined behaviors based on how ops->get_rxnfc() is implemented. This patch re-verifies the flow_type field of "info" after the second copy. If the value is not as expected, an error code will be returned. Signed-

[PATCH] i2c: core-smbus: fix a potential uninitialization bug

2018-04-29 Thread Wenwen Wang
er msgbuf1 with 0 to avoid undefined behaviors or security issues. Signed-off-by: Wenwen Wang --- drivers/i2c/i2c-core-smbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c index b5aec33..0fcca75 100644 --- a/drivers/

[PATCH v2] ethtool: fix a potential missing-check bug

2018-04-30 Thread Wenwen Wang
tually copied to user-space. This inconsistent data may also cause undefined behaviors based on how ops->get_rxnfc() is implemented. This patch simply re-verifies the flow_type field of "info" after the second copy. If the value is not as expected, an error code will be returne

Re: [PATCH] staging: luster: llite: fix a potential missing-check bug when copying lumv

2018-04-30 Thread Wenwen Wang
On Mon, Apr 30, 2018 at 5:38 PM, Dilger, Andreas wrote: > On Apr 29, 2018, at 07:20, Greg Kroah-Hartman > wrote: >> >> On Sat, Apr 28, 2018 at 04:04:25PM +, Dilger, Andreas wrote: >>> On Apr 27, 2018, at 17:45, Wenwen Wang wrote: >>>> [PATCH] stagin

[PATCH v2] staging: lustre: llite: fix potential missing-check bug when copying lumv

2018-04-30 Thread Wenwen Wang
cted, i.e., LOV_USER_MAGIC_V3, an error code will be returned: -EINVAL. Signed-off-by: Wenwen Wang --- drivers/staging/lustre/lustre/llite/dir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index d10

[PATCH] tipc: fix a potential missing-check bug

2018-04-30 Thread Wenwen Wang
ication to l->backlog[imp].len (if imp is TIPC_SYSTEM_IMPORTANCE) to avoid such security issues. An error code will be returned if an unexpected value of l->backlog[imp].len is generated. Signed-off-by: Wenwen Wang --- net/tipc/link.c | 5 + 1 file changed, 5 insertions(+) diff --git a

[PATCH] sctp: fix a potential missing-check bug

2018-05-02 Thread Wenwen Wang
the expected range. If it is not, an error code -EINVAL will be returned. Signed-off-by: Wenwen Wang --- net/sctp/socket.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 80835ac..2beb601 100644 --- a/n

[PATCH] i2c: core-smbus: fix a potential uninitialization bug

2018-05-02 Thread Wenwen Wang
er msgbuf1 with 0 to avoid undefined behaviors or security issues. Signed-off-by: Wenwen Wang --- drivers/i2c/i2c-core-smbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c index b5aec33..0fcca75 100644 --- a/drivers/

[PATCH] media: staging: atomisp: fix a potential missing-check bug

2018-05-02 Thread Wenwen Wang
as null pointer dereference. This patch saves the pointer returned by the first invocation and removes the second invocation. If the returned pointer is not NULL, the memory content is copied according to the original code. Signed-off-by: Wenwen Wang --- drivers/staging/media/atomisp/pci

Re: [PATCH] sctp: fix a potential missing-check bug

2018-05-02 Thread Wenwen Wang
Hi Marcelo, I guess I worked on an old version of the kernel. I will re-submit the patch. Sorry :( Wenwen On Wed, May 2, 2018 at 6:23 PM, Marcelo Ricardo Leitner wrote: > Hi Wenwen, > > On Wed, May 02, 2018 at 05:12:45PM -0500, Wenwen Wang wrote: >> In sctp_setsockopt_maxseg

[PATCH] sctp: fix a potential missing-check bug

2018-05-02 Thread Wenwen Wang
the expected range. If it is not, an error code -EINVAL will be returned. Signed-off-by: Wenwen Wang --- net/sctp/socket.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 80835ac..03e1cc3 100644 --- a/n

Re: [PATCH] sctp: fix a potential missing-check bug

2018-05-02 Thread Wenwen Wang
On Wed, May 2, 2018 at 8:24 PM, Marcelo Ricardo Leitner wrote: > On Wed, May 02, 2018 at 08:15:45PM -0500, Wenwen Wang wrote: >> In sctp_setsockopt_maxseg(), the integer 'val' is compared against min_len >> and max_len to check whether it is in the appropriate range.

Re: [PATCH] x86/PCI: fix a memory leak bug

2019-04-16 Thread Wenwen Wang
On Tue, Apr 16, 2019 at 2:23 AM Ingo Molnar wrote: > > > * Wenwen Wang wrote: > > > In pcibios_irq_init(), the PCI IRQ routing table 'pirq_table' is firstly > > found through pirq_find_routing_table(). If the table is not found and > > 'CONFIG_PCI_BIO

[PATCH v2] x86/PCI: fix a memory leak bug

2019-04-16 Thread Wenwen Wang
ion, if the I/O APIC is used, this table is actually not used. However, in that case, the allocated table is not freed, which can lead to a memory leak bug. To fix this issue, this patch frees the allocated table if it is not used. Signed-off-by: Wenwen Wang --- arch/x86/pci/irq.c | 10 -

Re: [PATCH v2] x86/PCI: fix a memory leak bug

2019-04-16 Thread Wenwen Wang
On Tue, Apr 16, 2019 at 3:33 PM Thomas Gleixner wrote: > > On Tue, 16 Apr 2019, Wenwen Wang wrote: > > > In pcibios_irq_init(), the PCI IRQ routing table 'pirq_table' is firstly > > found through pirq_find_routing_table(). If the table is not found and > > &#

[PATCH v3] x86/PCI: fix a memory leak bug

2019-04-16 Thread Wenwen Wang
ion, if the I/O APIC is used, this table is actually not used. However, in that case, the allocated table is not freed, which is a memory leak bug. To fix this issue, free the allocated table if it is not used. Signed-off-by: Wenwen Wang --- arch/x86/pci/irq.c | 10 -- 1 file changed

Re: [PATCH v2] x86/PCI: fix a memory leak bug

2019-04-17 Thread Wenwen Wang
On Wed, Apr 17, 2019 at 12:58 AM Ingo Molnar wrote: > > > * Wenwen Wang wrote: > > > On Tue, Apr 16, 2019 at 3:33 PM Thomas Gleixner wrote: > > > > > > On Tue, 16 Apr 2019, Wenwen Wang wrote: > > > > > > > In pcibios_irq_init(), the PC

[PATCH v4] x86/PCI: fix a memory leak bug

2019-04-17 Thread Wenwen Wang
ion, if the I/O APIC is used, this table is actually not used. However, in that case, the allocated table is not freed, which is a memory leak bug. To fix this issue, free the allocated table if it is not used. Signed-off-by: Wenwen Wang Acked-by: Thomas Gleixner --- arch/x86/pci/irq.c | 1

[PATCH v2] NFSv4: Fix a memory leak bug

2019-08-20 Thread Wenwen Wang
In nfs4_try_migration(), if nfs4_begin_drain_session() fails, the previously allocated 'page' and 'locations' are not deallocated, leading to memory leaks. To fix this issue, go to the 'out' label to free 'page' and 'locations' before returning t

Re: [PATCH] ACPI / PCI: fix a memory leak bug

2019-08-20 Thread Wenwen Wang
On Mon, Aug 19, 2019 at 5:23 PM Bjorn Helgaas wrote: > > The subject line should give a clue about where the leak is, e.g., > > ACPI / PCI: fix acpi_pci_irq_enable() memory leak > > On Thu, Aug 15, 2019 at 11:33:22PM -0500, Wenwen Wang wrote: > > In acpi_pci_irq_enable

[PATCH v2] ACPI / PCI: fix acpi_pci_irq_enable() memory leak

2019-08-20 Thread Wenwen Wang
Fixes: e237a5518425 ("x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected"") Signed-off-by: Wenwen Wang --- drivers/acpi/pci_irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index d2

Re: [PATCH] net: pch_gbe: Fix memory leaks

2019-08-20 Thread Wenwen Wang
On Thu, Aug 15, 2019 at 4:51 PM David Miller wrote: > > From: Wenwen Wang > Date: Thu, 15 Aug 2019 16:46:05 -0400 > > > On Thu, Aug 15, 2019 at 4:42 PM David Miller wrote: > >> > >> From: Wenwen Wang > >> Date: Thu, 15 Aug 2019 16:03:39 -0400 >

[PATCH v2] net: pch_gbe: Fix memory leaks

2019-08-20 Thread Wenwen Wang
In pch_gbe_set_ringparam(), if netif_running() returns false, 'tx_old' and 'rx_old' are not deallocated, leading to memory leaks. To fix this issue, move the free statements to the outside of the if() statement. Signed-off-by: Wenwen Wang --- drivers/net/ether

Re: [EXT] [PATCH] qed: Add cleanup in qed_slowpath_start()

2019-08-20 Thread Wenwen Wang
On Tue, Aug 13, 2019 at 6:46 AM Sudarsana Reddy Kalluru wrote: > > > -Original Message- > > From: Wenwen Wang > > Sent: Tuesday, August 13, 2019 3:35 PM > > To: Wenwen Wang > > Cc: Ariel Elior ; GR-everest-linux-l2 > l...@marvell.com>; David

[PATCH v2] qed: Add cleanup in qed_slowpath_start()

2019-08-20 Thread Wenwen Wang
If qed_mcp_send_drv_version() fails, no cleanup is executed, leading to memory leaks. To fix this issue, introduce the label 'err4' to perform the cleanup work before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/ethernet/qlogic/qed/qed_main.c | 4 +++- 1 file

[PATCH] net: usbnet: fix a memory leak bug

2019-08-14 Thread Wenwen Wang
this execution path, leading to a memory leak bug. Signed-off-by: Wenwen Wang --- drivers/net/usb/usbnet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 72514c4..f17fafa 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/

[PATCH] cx82310_eth: fix a memory leak bug

2019-08-14 Thread Wenwen Wang
, leading to a memory leak bug. To fix this issue, free 'dev->partial_data' before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/usb/cx82310_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/u

[PATCH] hv_netvsc: Fix a memory leak bug

2019-08-14 Thread Wenwen Wang
, leading to a memory leak bug. Signed-off-by: Wenwen Wang --- drivers/net/hyperv/rndis_filter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 317dbe9..ed35085 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/dri

[PATCH] wimax/i2400m: fix a memory leak bug

2019-08-15 Thread Wenwen Wang
fix this issue, free 'options_orig' before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/wimax/i2400m/fw.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c index e9fc168..6b36f6d 100644 --- a

Re: [PATCH] net: pch_gbe: Fix memory leaks

2019-08-15 Thread Wenwen Wang
On Thu, Aug 15, 2019 at 3:34 PM David Miller wrote: > > From: Wenwen Wang > Date: Tue, 13 Aug 2019 20:33:45 -0500 > > > In pch_gbe_set_ringparam(), if netif_running() returns false, 'tx_old' and > > 'rx_old' are not deallocated, leading to memory

Re: [PATCH] wimax/i2400m: fix a memory leak bug

2019-08-15 Thread Wenwen Wang
On Thu, Aug 15, 2019 at 2:45 PM Liam R. Howlett wrote: > > * Wenwen Wang [190815 14:05]: > > In i2400m_barker_db_init(), 'options_orig' is allocated through kstrdup() > > to hold the original command line options. Then, the options are parsed. > > However, if

[PATCH v2] wimax/i2400m: fix a memory leak bug

2019-08-15 Thread Wenwen Wang
fix this issue, free 'options_orig' before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/wimax/i2400m/fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wimax/i2400m/fw.c b/drivers/net/wimax/i2400m/fw.c index e9fc168..489cba9 100644 --- a

Re: [PATCH] net: pch_gbe: Fix memory leaks

2019-08-15 Thread Wenwen Wang
On Thu, Aug 15, 2019 at 4:42 PM David Miller wrote: > > From: Wenwen Wang > Date: Thu, 15 Aug 2019 16:03:39 -0400 > > > On Thu, Aug 15, 2019 at 3:34 PM David Miller wrote: > >> > >> From: Wenwen Wang > >> Date: Tue, 13 Aug 2019 20:33:45 -05

[PATCH] airo: fix memory leaks

2019-08-15 Thread Wenwen Wang
y regions before returning the error. Signed-off-by: Wenwen Wang --- drivers/net/wireless/cisco/airo.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 9342ffb..f43c065 100644 --- a/drivers

[PATCH] ACPI / PCI: fix a memory leak bug

2019-08-15 Thread Wenwen Wang
In acpi_pci_irq_enable(), 'entry' is allocated by invoking acpi_pci_irq_lookup(). However, it is not deallocated if acpi_pci_irq_valid() returns false, leading to a memory leak. To fix this issue, free 'entry' before returning 0. Signed-off-by: Wenwen Wang --- drivers/acpi/p

[PATCH] ACPI: custom_method: fix memory leaks

2019-08-15 Thread Wenwen Wang
In cm_write(), 'buf' is allocated through kzalloc(). In the following execution, if an error occurs, 'buf' is not deallocated, leading to memory leaks. To fix this issue, free 'buf' before returning the error. Signed-off-by: Wenwen Wang --- drivers/acpi/custom_meth

[PATCH] dmaengine: ti: Fix a memory leak bug

2019-08-15 Thread Wenwen Wang
nts' before returning the error. Signed-off-by: Wenwen Wang --- drivers/dma/ti/dma-crossbar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c index ad2f0a4..f255056 100644 --- a/drivers/dma/ti/dma-cross

Re: [PATCH] dmaengine: ti: Fix a memory leak bug

2019-08-15 Thread Wenwen Wang
On Fri, Aug 16, 2019 at 2:42 AM Peter Ujfalusi wrote: > > > > On 16/08/2019 9.23, Wenwen Wang wrote: > > In ti_dra7_xbar_probe(), 'rsv_events' is allocated through kcalloc(). Then > > of_property_read_u32_array() is invoked to search for the property.

[PATCH v2] dmaengine: ti: dma-crossbar: Fix a memory leak bug

2019-08-15 Thread Wenwen Wang
nts' before returning the error. Signed-off-by: Wenwen Wang --- drivers/dma/ti/dma-crossbar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c index ad2f0a4..f255056 100644 --- a/drivers/dma/ti/dma-cross

[PATCH] dmaengine: ti: omap-dma: Add cleanup in omap_dma_probe()

2019-08-15 Thread Wenwen Wang
If devm_request_irq() fails to disable all interrupts, no cleanup is performed before retuning the error. To fix this issue, invoke omap_dma_free() to do the cleanup. Signed-off-by: Wenwen Wang --- drivers/dma/ti/omap-dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a

[PATCH] libata: Fix a memory leak bug

2019-08-16 Thread Wenwen Wang
In ata_init(), 'ata_force_tbl' is allocated through kcalloc() in ata_parse_force_param(). However, it is not deallocated if ata_attach_transport() fails, leading to a memory leak bug. To fix this issue, free 'ata_force_tbl' before go to the 'err_out' labe

[PATCH] media: cpia2_usb: fix memory leaks

2019-08-16 Thread Wenwen Wang
In submit_urbs(), 'cam->sbuf[i].data' is allocated through kmalloc_array(). However, it is not deallocated if the following allocation for urbs fails. To fix this issue, free 'cam->sbuf[i].data' if usb_alloc_urb() fails. Signed-off-by: Wenwen Wang --- drivers/media

[PATCH] media: usb: cx231xx-417: fix a memory leak bug

2019-08-16 Thread Wenwen Wang
In cx231xx_load_firmware(), 'p_buffer' is allocated through vmalloc() to hold the firmware. However, after the usage, it is not deallocated, leading to a memory leak bug. Signed-off-by: Wenwen Wang --- drivers/media/usb/cx231xx/cx231xx-417.c | 1 + 1 file changed, 1 insertion(+) di

[PATCH] media: dvb-frontends: fix memory leaks

2019-08-16 Thread Wenwen Wang
In dib7000pc_detection(), 'tx' and 'rx' are allocated through kzalloc() respectively. However, if DiB7000PC is detected, they are not deallocated, leading to memory leaks. To fix this issue, create a label to free 'tx' and 'rx' before returning from t

[PATCH] media: dvb-frontends: fix a memory leak bug

2019-08-17 Thread Wenwen Wang
In cx24117_load_firmware(), 'buf' is allocated through kmalloc() to hold the firmware. However, if i2c_transfer() fails, it is not deallocated, leading to a memory leak bug. Signed-off-by: Wenwen Wang --- drivers/media/dvb-frontends/cx24117.c | 4 +++- 1 file changed, 3 insert

[PATCH] media: dvb-core: fix a memory leak bug

2019-08-17 Thread Wenwen Wang
his issue, free 'dvbdev->entity' before returning -ENOMEM. Signed-off-by: Wenwen Wang --- drivers/media/dvb-core/dvbdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index a3393cd..7557fbf 100644

[PATCH] media: saa7146: add cleanup in hexium_attach()

2019-08-17 Thread Wenwen Wang
If saa7146_register_device(), no cleanup is executed, leading to memory/resource leaks. To fix this issue, perform necessary cleanup work before returning the error. Signed-off-by: Wenwen Wang --- drivers/media/pci/saa7146/hexium_gemini.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a

[PATCH v2] media: saa7146: add cleanup in hexium_attach()

2019-08-17 Thread Wenwen Wang
If saa7146_register_device() fails, no cleanup is executed, leading to memory/resource leaks. To fix this issue, perform necessary cleanup work before returning the error. Signed-off-by: Wenwen Wang --- drivers/media/pci/saa7146/hexium_gemini.c | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH] media: fdp1: Fix a memory leak bug

2019-08-17 Thread Wenwen Wang
In fdp1_open(), 'ctx' is allocated through kzalloc(). However, it is not deallocated if v4l2_ctrl_new_std() fails, leading to a memory leak bug. To fix this issue, free 'ctx' before going to the 'done' label. Signed-off-by: Wenwen Wang --- drivers/media/plat

[PATCH] media: ti-vpe: Add cleanup in vpdma_list_cleanup()

2019-08-17 Thread Wenwen Wang
If an error occurs in this function, no cleanup is executed, leading to memory/resource leaks. To fix this issue, introduce two labels to perform the cleanup work. Signed-off-by: Wenwen Wang --- drivers/media/platform/ti-vpe/vpdma.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions

[PATCH] mtd: rawnand: Fix a memory leak bug

2019-08-18 Thread Wenwen Wang
In nand_scan_bbt(), a temporary buffer 'buf' is allocated through vmalloc(). However, if check_create() fails, 'buf' is not deallocated, leading to a memory leak bug. To fix this issue, free 'buf' before returning the error. Signed-off-by: Wenwen Wang --- drive

[PATCH] mtd: onenand_base: Fix a memory leak bug

2019-08-18 Thread Wenwen Wang
ue, free 'this->verify_buf' before returning the error. Signed-off-by: Wenwen Wang --- drivers/mtd/nand/onenand/onenand_base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c index e082d63..77bd32

[PATCH] mtd: sm_ftl: fix memory leaks

2019-08-18 Thread Wenwen Wang
fix this issue, free them before returning -EIO. Signed-off-by: Wenwen Wang --- drivers/mtd/sm_ftl.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c index dfc47a4..4744bf9 100644 --- a/drivers/mtd/sm_ftl.c +++ b/drivers/mtd/sm_ftl.c @

[PATCH] mtd: spi-nor: fix a memory leak bug

2019-08-18 Thread Wenwen Wang
In spi_nor_parse_4bait(), 'dwords' is allocated through kmalloc(). However, it is not deallocated in the following execution if spi_nor_read_sfdp() fails, leading to a memory leak. To fix this issue, free 'dwords' before returning the error. Signed-off-by: Wenwen Wang ---

[PATCH] infiniband: hfi1: fix memory leaks

2019-08-18 Thread Wenwen Wang
In fault_opcodes_write(), 'data' is allocated through kcalloc(). However, it is not deallocated in the following execution if an error occurs, leading to memory leaks. To fix this issue, introduce the 'free_data' label to free 'data' before returning the erro

[PATCH] infiniband: hfi1: fix a memory leak bug

2019-08-18 Thread Wenwen Wang
In fault_opcodes_read(), 'data' is not deallocated if debugfs_file_get() fails, leading to a memory leak. To fix this bug, introduce the 'free_data' label to free 'data' before returning the error. Signed-off-by: Wenwen Wang --- drivers/infiniband/hw/hfi1/faul

[PATCH] IB/mlx4: Fix memory leaks

2019-08-18 Thread Wenwen Wang
In mlx4_ib_alloc_pv_bufs(), 'tun_qp->tx_ring' is allocated through kcalloc(). However, it is not always deallocated in the following execution if an error occurs, leading to memory leaks. To fix this issue, free 'tun_qp->tx_ring' whenever an error occurs. Signed-off-by:

[PATCH v2] mtd: rawnand: Fix a memory leak bug

2019-08-18 Thread Wenwen Wang
In nand_scan_bbt(), a temporary buffer 'buf' is allocated through vmalloc(). However, if check_create() fails, 'buf' is not deallocated, leading to a memory leak bug. To fix this issue, free 'buf' before returning the error. Signed-off-by: Wenwen Wang --- driver

Re: [PATCH] mtd: spi-nor: fix a memory leak bug

2019-08-19 Thread Wenwen Wang
On Mon, Aug 19, 2019 at 2:03 AM wrote: > > > > On 08/18/2019 08:39 PM, Wenwen Wang wrote: > > In spi_nor_parse_4bait(), 'dwords' is allocated through kmalloc(). However, > > it is not deallocated in the following execution if spi_nor_read_sfdp() > > fail

  1   2   >