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: <CAD=FV=XJ1VWy0JvD5-kJ611mgxKGZ8hK-7uu9GyAWbmER_UZhQ@mail.gmail.com>
Date:	Mon, 20 Oct 2014 16:57:17 -0700
From:	Doug Anderson <dianders@...omium.org>
To:	Linus Walleij <linus.walleij@...aro.org>,
	Heiko Stuebner <heiko@...ech.de>
Cc:	Chris Zhong <zyw@...k-chips.com>,
	Sonny Rao <sonnyrao@...omium.org>,
	linux-rockchip@...ts.infradead.org,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Doug Anderson <dianders@...omium.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/4] pinctrl: rockchip: Protect read-modify-write with the spinlock

Hi,

On Mon, Oct 20, 2014 at 4:27 PM, Doug Anderson <dianders@...omium.org> wrote:
> @@ -1464,15 +1474,20 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
>         if (ret < 0)
>                 return ret;
>
> +       spin_lock_irqsave(&bank->slock, flags);
> +
>         data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR);
>         data &= ~mask;
>         writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR);
>
> +       spin_unlock_irqrestore(&bank->slock, flags);
> +
>         if (type & IRQ_TYPE_EDGE_BOTH)
>                 __irq_set_handler_locked(d->irq, handle_edge_irq);
>         else
>                 __irq_set_handler_locked(d->irq, handle_level_irq);
>
> +       spin_lock_irqsave(&bank->slock, flags);
>         irq_gc_lock(gc);
>
>         level = readl_relaxed(gc->reg_base + GPIO_INTTYPE_LEVEL);
> @@ -1522,6 +1537,7 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
>         writel_relaxed(polarity, gc->reg_base + GPIO_INT_POLARITY);
>
>         irq_gc_unlock(gc);
> +       spin_unlock_irqrestore(&bank->slock, flags);

I just reviewed this again myself and I realized that there was an
error path case that I missed.  I'll plan to spin tomorrow and include
any extra feedback people have.

I'll also note that I'd love any extra scrutiny people have on this
patch.  I'm submitting it totally based on code inspection and am
nowhere near an expert on this driver.  I mostly just looked for all
of the read/modify/wites using writel and added the lock...

-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ