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: <6ef2f777-dd96-4b07-bd4d-0567705bf837@app.fastmail.com>
Date: Mon, 22 Dec 2025 21:39:45 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Lorenz Bauer" <lmb@...valent.com>
Cc: "Amit Shah" <amit@...nel.org>,
 "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
 virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org,
 stable@...r.kernel.org
Subject: Re: [PATCH v2] virtio: console: fix lost wakeup when device is written and
 polled

On Mon, Dec 22, 2025, at 17:23, Lorenz Bauer wrote:
> On Mon, Dec 22, 2025 at 5:13 PM Arnd Bergmann <arnd@...db.de> wrote:
>> On Mon, Dec 22, 2025, at 17:04, Lorenz Bauer wrote:
>> > @@ -1705,6 +1713,10 @@ static void out_intr(struct virtqueue *vq)
>> >               return;
>> >       }
>> >
>> > +     spin_lock_irqsave(&port->outvq_lock, flags);
>> > +     reclaim_consumed_buffers(port);
>> > +     spin_unlock_irqrestore(&port->outvq_lock, flags);
>> > +
>> >       wake_up_interruptible(&port->waitqueue);
>>
>> The callback seems to always be called with interrupts
>> disabled(), so here it's safe to use spin_lock() instead
>> of spin_lock_irqsave().
>
> This is pretty much just copied from in_intr which also uses _irqsave.
> I think it makes sense to stick to that for consistency's sake. What
> do you think?

The usual rule is that you must use spin_lock_irqsave() if
the function can be called from either interrupt or non-interrupt
context. It's also safe to be used if you are not sure.

However, in interrupt handlers you usually want to use the
plain spin_lock() both for efficiency reasons and to document
the calling conventions.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ