Re: [GIT PULL] /dev/random bug fixes for 4.12

From: Geert Uytterhoeven
Date: Sun Jun 04 2017 - 05:47:16 EST


Hi Linus,

On Sat, Jun 3, 2017 at 1:30 AM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Jun 2, 2017 at 2:30 PM, Theodore Ts'o <tytso@xxxxxxx> wrote:
>> Fix a race on architectures with prioritized interrupts (such as m68k)
>> which can causes crashes in drivers/char/random.c:get_reg().
>
> I don't think this has anything to do with prioritized interrupts,
> just possibility of nesting (which can happen anywhere).
>
> I've pulled this, but I really am not all that happy about it. It adds
> a interrupt disable/enable in something that might be pretty
> timing-ciritcal.
>
> And I really don't think it needs it. We don't actually care about the
> reg_idx value being reliable, so the code could easily have just done
> some READ_ONCE/WRITE_ONCE thing. Something like the attached
> (UNTESTED!) patch instead.

I agree with your analysis, and your patch looks OK to me.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds