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>] [day] [month] [year] [list]
Date:   Sun, 14 Feb 2021 23:33:09 +0100 (CET)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     Mathieu Poirier <mathieu.poirier@...aro.org>, ohad@...ery.com,
        bjorn.andersson@...aro.org, arnaud.pouliquen@...com
cc:     robh+dt@...nel.org, mcoquelin.stm32@...il.com,
        alexandre.torgue@...com, linux-remoteproc@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, kbuild-all@...ts.01.org
Subject: Re: [PATCH v5 13/19] remoteproc: Properly deal with the resource
 table (fwd)

There are identical kfrees on lines 2078 and 2080.

julia

---------- Forwarded message ----------
Date: Fri, 12 Feb 2021 10:45:50 +0800
From: kernel test robot <lkp@...el.com>
To: kbuild@...ts.01.org
Cc: lkp@...el.com, Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH v5 13/19] remoteproc: Properly deal with the resource table

CC: kbuild-all@...ts.01.org
In-Reply-To: <20210211234627.2669674-14-mathieu.poirier@...aro.org>
References: <20210211234627.2669674-14-mathieu.poirier@...aro.org>
TO: Mathieu Poirier <mathieu.poirier@...aro.org>
TO: ohad@...ery.com
TO: bjorn.andersson@...aro.org
TO: arnaud.pouliquen@...com
CC: robh+dt@...nel.org
CC: mcoquelin.stm32@...il.com
CC: alexandre.torgue@...com
CC: linux-remoteproc@...r.kernel.org
CC: devicetree@...r.kernel.org
CC: linux-kernel@...r.kernel.org
CC: linux-arm-kernel@...ts.infradead.org

Hi Mathieu,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.11-rc7 next-20210211]
[cannot apply to remoteproc/for-next rpmsg/for-next]
[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/Mathieu-Poirier/remoteproc-Add-support-for-detaching-a-remote-processor/20210212-075607
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: openrisc-randconfig-c003-20210209 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0

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


"coccinelle warnings: (new ones prefixed by >>)"
>> drivers/remoteproc/remoteproc_core.c:2080:7-26: ERROR: reference preceded by free on line 2078

vim +2080 drivers/remoteproc/remoteproc_core.c

400e64df6b237e Ohad Ben-Cohen  2011-10-20  2012
eab58da78fe46f Mathieu Poirier 2021-02-11  2013  /**
eab58da78fe46f Mathieu Poirier 2021-02-11  2014   * rproc_detach() - Detach the remote processor from the
eab58da78fe46f Mathieu Poirier 2021-02-11  2015   * remoteproc core
eab58da78fe46f Mathieu Poirier 2021-02-11  2016   *
eab58da78fe46f Mathieu Poirier 2021-02-11  2017   * @rproc: the remote processor
eab58da78fe46f Mathieu Poirier 2021-02-11  2018   *
eab58da78fe46f Mathieu Poirier 2021-02-11  2019   * Detach a remote processor (previously attached to with rproc_attach()).
eab58da78fe46f Mathieu Poirier 2021-02-11  2020   *
eab58da78fe46f Mathieu Poirier 2021-02-11  2021   * In case @rproc is still being used by an additional user(s), then
eab58da78fe46f Mathieu Poirier 2021-02-11  2022   * this function will just decrement the power refcount and exit,
eab58da78fe46f Mathieu Poirier 2021-02-11  2023   * without disconnecting the device.
eab58da78fe46f Mathieu Poirier 2021-02-11  2024   *
eab58da78fe46f Mathieu Poirier 2021-02-11  2025   * Function rproc_detach() calls __rproc_detach() in order to let a remote
eab58da78fe46f Mathieu Poirier 2021-02-11  2026   * processor know that services provided by the application processor are
eab58da78fe46f Mathieu Poirier 2021-02-11  2027   * no longer available.  From there it should be possible to remove the
eab58da78fe46f Mathieu Poirier 2021-02-11  2028   * platform driver and even power cycle the application processor (if the HW
eab58da78fe46f Mathieu Poirier 2021-02-11  2029   * supports it) without needing to switch off the remote processor.
eab58da78fe46f Mathieu Poirier 2021-02-11  2030   */
eab58da78fe46f Mathieu Poirier 2021-02-11  2031  int rproc_detach(struct rproc *rproc)
eab58da78fe46f Mathieu Poirier 2021-02-11  2032  {
eab58da78fe46f Mathieu Poirier 2021-02-11  2033  	struct device *dev = &rproc->dev;
eab58da78fe46f Mathieu Poirier 2021-02-11  2034  	int ret;
eab58da78fe46f Mathieu Poirier 2021-02-11  2035
eab58da78fe46f Mathieu Poirier 2021-02-11  2036  	ret = mutex_lock_interruptible(&rproc->lock);
eab58da78fe46f Mathieu Poirier 2021-02-11  2037  	if (ret) {
eab58da78fe46f Mathieu Poirier 2021-02-11  2038  		dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, ret);
eab58da78fe46f Mathieu Poirier 2021-02-11  2039  		return ret;
eab58da78fe46f Mathieu Poirier 2021-02-11  2040  	}
eab58da78fe46f Mathieu Poirier 2021-02-11  2041
eab58da78fe46f Mathieu Poirier 2021-02-11  2042  	if (rproc->state != RPROC_RUNNING && rproc->state != RPROC_ATTACHED) {
eab58da78fe46f Mathieu Poirier 2021-02-11  2043  		ret = -EPERM;
eab58da78fe46f Mathieu Poirier 2021-02-11  2044  		goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11  2045  	}
eab58da78fe46f Mathieu Poirier 2021-02-11  2046
eab58da78fe46f Mathieu Poirier 2021-02-11  2047  	/* if the remote proc is still needed, bail out */
eab58da78fe46f Mathieu Poirier 2021-02-11  2048  	if (!atomic_dec_and_test(&rproc->power)) {
eab58da78fe46f Mathieu Poirier 2021-02-11  2049  		ret = -EBUSY;
eab58da78fe46f Mathieu Poirier 2021-02-11  2050  		goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11  2051  	}
eab58da78fe46f Mathieu Poirier 2021-02-11  2052
eab58da78fe46f Mathieu Poirier 2021-02-11  2053  	ret = __rproc_detach(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11  2054  	if (ret) {
eab58da78fe46f Mathieu Poirier 2021-02-11  2055  		atomic_inc(&rproc->power);
eab58da78fe46f Mathieu Poirier 2021-02-11  2056  		goto out;
eab58da78fe46f Mathieu Poirier 2021-02-11  2057  	}
eab58da78fe46f Mathieu Poirier 2021-02-11  2058
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2059  	/*
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2060  	 * Install a clean resource table for re-attach while
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2061  	 * rproc->table_ptr is still valid.
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2062  	 */
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2063  	ret = rproc_reset_loaded_rsc_table(rproc);
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2064  	if (ret) {
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2065  		atomic_inc(&rproc->power);
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2066  		goto out;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2067  	}
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2068
eab58da78fe46f Mathieu Poirier 2021-02-11  2069  	/* clean up all acquired resources */
eab58da78fe46f Mathieu Poirier 2021-02-11  2070  	rproc_resource_cleanup(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11  2071
eab58da78fe46f Mathieu Poirier 2021-02-11  2072  	/* release HW resources if needed */
eab58da78fe46f Mathieu Poirier 2021-02-11  2073  	rproc_unprepare_device(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11  2074
eab58da78fe46f Mathieu Poirier 2021-02-11  2075  	rproc_disable_iommu(rproc);
eab58da78fe46f Mathieu Poirier 2021-02-11  2076
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2077  	/* Free the copy of the resource table */
66e2fed7a4bb20 Mathieu Poirier 2021-02-11 @2078  	kfree(rproc->cached_table);
eab58da78fe46f Mathieu Poirier 2021-02-11  2079  	/* Follow the same sequence as in rproc_shutdown() */
eab58da78fe46f Mathieu Poirier 2021-02-11 @2080  	kfree(rproc->cached_table);
eab58da78fe46f Mathieu Poirier 2021-02-11  2081  	rproc->cached_table = NULL;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2082  	rproc->clean_table = NULL;
eab58da78fe46f Mathieu Poirier 2021-02-11  2083  	rproc->table_ptr = NULL;
66e2fed7a4bb20 Mathieu Poirier 2021-02-11  2084
eab58da78fe46f Mathieu Poirier 2021-02-11  2085  out:
eab58da78fe46f Mathieu Poirier 2021-02-11  2086  	mutex_unlock(&rproc->lock);
eab58da78fe46f Mathieu Poirier 2021-02-11  2087  	return ret;
eab58da78fe46f Mathieu Poirier 2021-02-11  2088  }
eab58da78fe46f Mathieu Poirier 2021-02-11  2089  EXPORT_SYMBOL(rproc_detach);
eab58da78fe46f Mathieu Poirier 2021-02-11  2090

---
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" (24584 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ