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: <CAK5ve-Jsz9wULvuhPw98_DLEDWXVhbZrmExBPq5D80teUMuGEQ@mail.gmail.com>
Date:	Mon, 22 Oct 2012 16:12:13 -0700
From:	Bryan Wu <cooloney@...il.com>
To:	Nathan Lynch <ntl@...ox.com>
Cc:	"Rafael J. Wysocki" <rjw@...k.pl>,
	Miles Lane <miles.lane@...il.com>,
	akpm <akpm@...ux-foundation.org>,
	Linux LED Subsystem <linux-leds@...r.kernel.org>,
	Linus Walleij <linus.walleij@...aro.org>,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ledtrig-cpu: use spin_lock to replace mutex lock

On Mon, Oct 22, 2012 at 3:28 PM, Nathan Lynch <ntl@...ox.com> wrote:
> Hi Bryan,
>
> On Thu, 2012-10-18 at 11:18 -0700, Bryan Wu wrote:
>> @@ -117,14 +117,14 @@ static int __init ledtrig_cpu_init(void)
>>       for_each_possible_cpu(cpu) {
>>               struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
>>
>> -             mutex_init(&trig->lock);
>> +             spin_lock_init(&trig->lock);
>>
>>               snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
>>
>> -             mutex_lock(&trig->lock);
>> +             spin_lock(&trig->lock);
>>               led_trigger_register_simple(trig->name, &trig->_trig);
>>               trig->lock_is_inited = 1;
>> -             mutex_unlock(&trig->lock);
>> +             spin_unlock(&trig->lock);
>
> I wouldn't know how to fix the original problem, but I don't think this
> patch is okay -- led_trigger_register_simple() does things that
> potentially sleep (GFP_KERNEL allocation, down_write), so it's not safe
> to call while holding a spinlock.
>

Looks like we got a hard issue, since led_trigger_register() families
and even led_trigger_event() might use rwsem for locking, these are
all potentially sleep, which are not easy to modified for atomic
context.

Any hints are welcome.

Thanks,
-Bryan
--
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