From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f43.google.com ([209.85.218.43]:34292 "EHLO mail-oi0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753878AbcCONcn (ORCPT ); Tue, 15 Mar 2016 09:32:43 -0400 Received: by mail-oi0-f43.google.com with SMTP id m82so12818926oif.1 for ; Tue, 15 Mar 2016 06:32:43 -0700 (PDT) Date: Tue, 15 Mar 2016 08:32:41 -0500 From: Seth Forshee To: Pavel Tikhomirov Cc: "Eric W. Biederman" , devel@openvz.org, Serge Hallyn , Alexander Viro , Jeff Layton , "J. Bruce Fields" , Andy Lutomirski , linux-security-module@vger.kernel.org, linux-mtd@lists.infradead.org, selinux@tycho.nsa.gov, linux-fsdevel@vger.kernel.org, Konstantin Khorenko , Pavel Emelyanov Subject: Re: [PATCH] fs: fix a posible leak of allocated superblock Message-ID: <20160315133241.GA27754@ubuntu-xps13> References: <1443039368-55445-2-git-send-email-seth.forshee@canonical.com> <1458043730-14296-1-git-send-email-ptikhomirov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458043730-14296-1-git-send-email-ptikhomirov@virtuozzo.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Mar 15, 2016 at 03:08:50PM +0300, Pavel Tikhomirov wrote: > We probably need to fix superblock leak in patch (v4 "fs: Add user > namesapace member to struct super_block"): > > Imagine posible code path in sget_userns: we iterate through > type->fs_supers and do not find suitable sb, we drop sb_lock to > allocate s and go to retry. After we dropped sb_lock some other > task from different userns takes sb_lock, it is already in retry > stage and has s allocated, so it puts its s in type->fs_supers > list. So in retry we will find these sb in list and check it has > a different userns, and finally we will return without freeing s. > > Signed-off-by: Pavel Tikhomirov Good catch. Acked-by: Seth Forshee