lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202107270334.Q6YUKYBt-lkp@intel.com>
Date:   Tue, 27 Jul 2021 03:51:38 +0800
From:   kernel test robot <lkp@...el.com>
To:     Pavel Skripkin <paskripkin@...il.com>, wg@...ndegger.com,
        mkl@...gutronix.de, davem@...emloft.net, socketcan@...tkopp.net,
        mailhol.vincent@...adoo.fr, Stefan.Maetje@....eu,
        matthias.fuchs@....eu
Cc:     kbuild-all@...ts.01.org, linux-can@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] can: esd_usb2: fix memory leak

Hi Pavel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkl-can-next/testing]
[also build test ERROR on v5.14-rc3 next-20210723]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Pavel-Skripkin/can-fix-same-memory-leaks-in-can-drivers/20210726-233224
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git testing
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/14373e3834eb74f943720146607c709613b93e95
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Pavel-Skripkin/can-fix-same-memory-leaks-in-can-drivers/20210726-233224
        git checkout 14373e3834eb74f943720146607c709613b93e95
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash drivers/net/can/usb/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   drivers/net/can/usb/esd_usb2.c: In function 'esd_usb2_setup_rx_urbs':
>> drivers/net/can/usb/esd_usb2.c:582:4: error: label 'freeusrb' used but not defined
     582 |    goto freeusrb;
         |    ^~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
   Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA
   Selected by
   - SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
   - SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC


vim +/freeusrb +582 drivers/net/can/usb/esd_usb2.c

   539	
   540	static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev)
   541	{
   542		int i, err = 0;
   543	
   544		if (dev->rxinitdone)
   545			return 0;
   546	
   547		for (i = 0; i < MAX_RX_URBS; i++) {
   548			struct urb *urb = NULL;
   549			u8 *buf = NULL;
   550			dma_addr_t buf_dma;
   551	
   552			/* create a URB, and a buffer for it */
   553			urb = usb_alloc_urb(0, GFP_KERNEL);
   554			if (!urb) {
   555				err = -ENOMEM;
   556				break;
   557			}
   558	
   559			buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL,
   560						 &buf_dma);
   561			if (!buf) {
   562				dev_warn(dev->udev->dev.parent,
   563					 "No memory left for USB buffer\n");
   564				err = -ENOMEM;
   565				goto freeurb;
   566			}
   567	
   568			urb->transfer_dma = buf_dma;
   569	
   570			usb_fill_bulk_urb(urb, dev->udev,
   571					  usb_rcvbulkpipe(dev->udev, 1),
   572					  buf, RX_BUFFER_SIZE,
   573					  esd_usb2_read_bulk_callback, dev);
   574			urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
   575			usb_anchor_urb(urb, &dev->rx_submitted);
   576	
   577			err = usb_submit_urb(urb, GFP_KERNEL);
   578			if (err) {
   579				usb_unanchor_urb(urb);
   580				usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf,
   581						  urb->transfer_dma);
 > 582				goto freeusrb;
   583			}
   584	
   585			dev->rxbuf[i] = buf;
   586			dev->rxbuf_dma[i] = buf_dma;
   587	
   588	freeurb:
   589			/* Drop reference, USB core will take care of freeing it */
   590			usb_free_urb(urb);
   591			if (err)
   592				break;
   593		}
   594	
   595		/* Did we submit any URBs */
   596		if (i == 0) {
   597			dev_err(dev->udev->dev.parent, "couldn't setup read URBs\n");
   598			return err;
   599		}
   600	
   601		/* Warn if we've couldn't transmit all the URBs */
   602		if (i < MAX_RX_URBS) {
   603			dev_warn(dev->udev->dev.parent,
   604				 "rx performance may be slow\n");
   605		}
   606	
   607		dev->rxinitdone = 1;
   608		return 0;
   609	}
   610	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (55013 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ