Re: KASAN: use-after-free Read in fuse_dev_do_read

From: Miklos Szeredi
Date: Mon Sep 24 2018 - 10:27:25 EST


On Mon, Sep 24, 2018 at 2:06 PM, Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> wrote:

> Fix from my previous message makes the use-after-free does not reproduce
> with the reproducer in my setup.

Excellent.

>
> I can prepare the patch, but before this some comments from Miklos would
> be welcome.
>
> Miklos, what you think about this?

I like the patch.

We could optimize away the get/put by moving the set_bit/test_bit part
inside the fpq->lock-ed region and only get the refcount for the
(unlikely) interrupted case. OTOH it's probably not worth the extra
complexity, so let's stay with this simpler fix.

Thanks,
Miklos