lkml.org 
[lkml]   [2013]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] loop: prevent bdev freeing while device in use
From
On Mon, Apr 1, 2013 at 4:58 AM, Anatol Pomozov <anatol.pomozov@gmail.com> wrote:
>
> To prevent use-after-free we need to hold device inode in loop_set_fd()
> and put it later in loop_clr_fd().

Is there something that guarantees that there's only one loop_set_fd()
and one paired loop_clr_fd()?

IOW, what protects us from somebody doing loop_clr_fd() on a device
that hasn't been set up yet, or doing multiple loop_set_fd calls?

I suspect the "lo->lo_state" is part of the answer, but it's very much
not obvious, and I'd want this to be explicitly explained.

Linus


\
 
 \ /
  Last update: 2013-04-01 18:01    [W:0.055 / U:3.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site