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] [day] [month] [year] [list]
Message-ID: <20180731040208.GB5090@builder>
Date:   Mon, 30 Jul 2018 21:02:08 -0700
From:   Bjorn Andersson <bjorn.andersson@...aro.org>
To:     Baolin Wang <baolin.wang@...aro.org>
Cc:     Ohad Ben-Cohen <ohad@...ery.com>, Mark Brown <broonie@...nel.org>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        linux-remoteproc@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] hwspinlock: Fix incorrect return pointers

On Mon 30 Jul 04:34 PDT 2018, Baolin Wang wrote:

> Hi Bjorn,
> 
> On 28 June 2018 at 10:32, Baolin Wang <baolin.wang@...aro.org> wrote:
> > The commit 4f1acd758b08 ("hwspinlock: Add devm_xxx() APIs to request/free
> > hwlock") introduces one bug, that will return one error pointer if failed
> > to request one hwlock, but we expect NULL pointer on error for consumers.
> > This patch will fix this issue.
> >
> > Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> > Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
> 
> Could you pick up this patch which fixes the incorrect return value
> issue? Thanks.
> 

I thought I had picked this already, it's applied now. Sorry about the
delay.

Regards,
Bjorn

> > ---
> >  drivers/hwspinlock/hwspinlock_core.c |    8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
> > index e16d648..2bad40d 100644
> > --- a/drivers/hwspinlock/hwspinlock_core.c
> > +++ b/drivers/hwspinlock/hwspinlock_core.c
> > @@ -877,10 +877,10 @@ struct hwspinlock *devm_hwspin_lock_request(struct device *dev)
> >
> >         ptr = devres_alloc(devm_hwspin_lock_release, sizeof(*ptr), GFP_KERNEL);
> >         if (!ptr)
> > -               return ERR_PTR(-ENOMEM);
> > +               return NULL;
> >
> >         hwlock = hwspin_lock_request();
> > -       if (!IS_ERR(hwlock)) {
> > +       if (hwlock) {
> >                 *ptr = hwlock;
> >                 devres_add(dev, ptr);
> >         } else {
> > @@ -913,10 +913,10 @@ struct hwspinlock *devm_hwspin_lock_request_specific(struct device *dev,
> >
> >         ptr = devres_alloc(devm_hwspin_lock_release, sizeof(*ptr), GFP_KERNEL);
> >         if (!ptr)
> > -               return ERR_PTR(-ENOMEM);
> > +               return NULL;
> >
> >         hwlock = hwspin_lock_request_specific(id);
> > -       if (!IS_ERR(hwlock)) {
> > +       if (hwlock) {
> >                 *ptr = hwlock;
> >                 devres_add(dev, ptr);
> >         } else {
> > --
> > 1.7.9.5
> >
> 
> 
> 
> -- 
> Baolin Wang
> Best Regards

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ