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]
Date:	Mon, 1 Apr 2013 09:49:54 -0700
From:	Anatol Pomozov <anatol.pomozov@...il.com>
To:	Al Viro <viro@...iv.linux.org.uk>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	"Theodore Ts'o" <tytso@....edu>, sqazi@...gle.com,
	Guo Chao <yan@...ux.vnet.ibm.com>
Subject: Re: [PATCH] loop: prevent bdev freeing while device in use

Hi

On Mon, Apr 1, 2013 at 9:28 AM, Al Viro <viro@...iv.linux.org.uk> wrote:
> On Mon, Apr 01, 2013 at 04:58:05AM -0700, Anatol Pomozov wrote:
>>               lo->lo_flags |= LO_FLAGS_PARTSCAN;
>>       if (lo->lo_flags & LO_FLAGS_PARTSCAN)
>>               ioctl_by_bdev(bdev, BLKRRPART, 0);
>> +
>> +     /* bdev lifecycle is defined by its bd_inode (see
>> +      * struct bdev_inode usage). In case of loop device we need to make
>> +      * sure that bdev deallocation will not happen between loop_set_fd()
>> +      * and loop_clr_fd() invocations. To do this we need to hold
>> +      * bdev inode here and put it later in loop_clr_fd().
>> +      */
>> +     ihold(bdev->bd_inode);
>
> That's open-coded bdgrab()

Done. It also requires EXPORTING bdgrab.

The test still passes.

>
>> +     if (bdev) {
>> +             BUG_ON(atomic_read(&bdev->bd_inode->i_count) < 2);
>> +             iput(bdev->bd_inode);
>
> ... and that - bdput() (I'd drop that BUG_ON())
--
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