From patchwork Thu Aug 31 05:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13370921 X-Patchwork-Delegate: paul@paul-moore.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E630C83F30 for ; Thu, 31 Aug 2023 05:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244845AbjHaFcQ (ORCPT ); Thu, 31 Aug 2023 01:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244800AbjHaFcO (ORCPT ); Thu, 31 Aug 2023 01:32:14 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2815EA; Wed, 30 Aug 2023 22:32:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=onojrvo/4J+rr41hNOyQoa+Ghh8TsydVpI3xPRsi118=; b=toc1Q8HEVJiy3fD1KHJPR2pG2g AZqJDRtIXxiVn5ZCGXmTyWhgq0PZ9mEkFCgE788OttmLNc0j4/cqtzRGw/oJQEE9+hQYkF54d7ifY oRdCYKsdayrOYO4ThcedMZyGw5+bxM4PrDpEhg1NQpZUjnE46W2CPLPvDRCVCDwPv84QcFR+ucp0f PcTCU2g49IykihM3lBmJDhbGJLJde/9tEv4jswz/IMljzhT3dhfOkznuuDIfNdS55+zgB0uilfrqs GMZVjkQJP66y6Lhex4GZ654TPleoblO+Y1KUkF0Q3JW+ckPUXwRQmTVRRxtNs+oZAT3MBK6mrcf9R UNlc9UvA==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qbaHn-00EglZ-28; Thu, 31 Aug 2023 05:32:08 +0000 From: Christoph Hellwig To: Alexander Viro , Christian Brauner Cc: Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Paul Moore , Stephen Smalley , Eric Paris , linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH 2/4] devpts: free sb->s_fs_info after shutting down the super block Date: Thu, 31 Aug 2023 07:31:55 +0200 Message-Id: <20230831053157.256319-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230831053157.256319-1-hch@lst.de> References: <20230831053157.256319-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org sb->s_fs_info can only be safely freed after generic_shutdown_super was called and all access to the super_block has stopped. Thus only free the private data after calling kill_litter_super, which calls generic_shutdown_super internally. Signed-off-by: Christoph Hellwig --- fs/devpts/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 299c295a27a03e..d46cea36c026ad 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -491,10 +491,10 @@ static void devpts_kill_sb(struct super_block *sb) { struct pts_fs_info *fsi = DEVPTS_SB(sb); + kill_litter_super(sb); if (fsi) ida_destroy(&fsi->allocated_ptys); kfree(fsi); - kill_litter_super(sb); } static struct file_system_type devpts_fs_type = {