[PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

2021-01-18 Thread Liu Xiang
When CONFIG_REGULATOR is not set, sunxi_pmx_request() always return success. Even a group of pins call sunxi_pmx_request(), the refcount is only 1. This can cause a use-after-free warning in sunxi_pmx_free(). To solve this problem, go to err path if regulator_get() return NULL or error. Signed-off

Re: [PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

2021-01-21 Thread Maxime Ripard
Hi, On Tue, Jan 19, 2021 at 02:29:08PM +0800, Liu Xiang wrote: > When CONFIG_REGULATOR is not set, sunxi_pmx_request() always return > success. Even a group of pins call sunxi_pmx_request(), the refcount > is only 1. This can cause a use-after-free warning in sunxi_pmx_free(). > To solve this prob

Re: [PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

2021-01-21 Thread liu xiang
> Hi, > On Tue, Jan 19, 2021 at 02:29:08PM +0800, Liu Xiang wrote: > When CONFIG_REGULATOR is not set, sunxi_pmx_request() always return > success. Even a group of pins call sunxi_pmx_request(), the refcount > is only 1. This can cause a use-after-free warning in sunxi_pmx_free(). > To solve this

Re: [PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

2021-01-22 Thread Linus Walleij
On Thu, Jan 21, 2021 at 5:40 PM Maxime Ripard wrote: > On Tue, Jan 19, 2021 at 02:29:08PM +0800, Liu Xiang wrote: > > When CONFIG_REGULATOR is not set, sunxi_pmx_request() always return > > success. Even a group of pins call sunxi_pmx_request(), the refcount > > is only 1. This can cause a use-aft

Re: [PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

2021-01-26 Thread liu xiang
-- > On Thu, Jan 21, 2021 at 5:40 PM Maxime Ripard wrote: > On Tue, Jan 19, 2021 at 02:29:08PM +0800, Liu Xiang wrote: > > When CONFIG_REGULATOR is not set, sunxi_pmx_request() always return > > success. Even a group of pins call sun

Re: [PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

2021-01-26 Thread Linus Walleij
On Tue, Jan 26, 2021 at 7:31 AM liu xiang wrote: > > Liu can you make a patch to Kconfig to just select REGULATOR? > > Possibly even the specific regulator driver this SoC is using > > if it is very specific for this purpose. > > I found that the regulator driver is related to the specific board,

Re: [PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

2021-01-26 Thread Maxime Ripard
On Tue, Jan 26, 2021 at 04:03:29PM +0100, Linus Walleij wrote: > On Tue, Jan 26, 2021 at 7:31 AM liu xiang wrote: > > > > Liu can you make a patch to Kconfig to just select REGULATOR? > > > Possibly even the specific regulator driver this SoC is using > > > if it is very specific for this purpose

Re: [PATCH] pinctrl: sunxi: fix use-after-free in sunxi_pmx_free()

2021-01-26 Thread liu xiang
> On Thu, Jan 21, 2021 at 5:40 PM Maxime Ripard wrote: > On Tue, Jan 19, 2021 at 02:29:08PM +0800, Liu Xiang wrote: > > When CONFIG_REGULATOR is not set, sunxi_pmx_request() always return > > success. Even a group of pins call sunxi_pmx_request(), the refcount > > is only 1. This can cause a use-a