Message ID | 20200608170127.20419-6-mcgrof@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=PqO3=7V=kvack.org=owner-linux-mm@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1235492A for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 8 Jun 2020 17:01:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DBC442053B for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 8 Jun 2020 17:01:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBC442053B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D052F6B0010; Mon, 8 Jun 2020 13:01:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C8D2F6B0022; Mon, 8 Jun 2020 13:01:43 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A44666B0023; Mon, 8 Jun 2020 13:01:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id 8C43B6B0010 for <linux-mm@kvack.org>; Mon, 8 Jun 2020 13:01:43 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 496A681621EB for <linux-mm@kvack.org>; Mon, 8 Jun 2020 17:01:43 +0000 (UTC) X-FDA: 76906661286.13.spot14_171192426dbb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id C079D181D376F for <linux-mm@kvack.org>; Mon, 8 Jun 2020 17:01:39 +0000 (UTC) X-Spam-Summary: 2,0,0,d331e8eb30f79996,d41d8cd98f00b204,mcgrof@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1540:1711:1714:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3351:3865:3866:3868:4321:5007:6261:9389:10004:11026:11658:11914:12043:12048:12297:12517:12519:12555:12895:12986:13069:13311:13357:13894:13972:14096:14181:14384:14394:14721:21080:21444:21451:21611:21627:30054,0,RBL:209.85.210.195:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:32,LUA_SUMMARY:none X-HE-Tag: spot14_171192426dbb X-Filterd-Recvd-Size: 3710 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf06.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Mon, 8 Jun 2020 17:01:37 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id s23so7484226pfh.7 for <linux-mm@kvack.org>; Mon, 08 Jun 2020 10:01:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f88bEORI++QIsnJdKm2ca64CmhxGUzC3g+SSrwClYUg=; b=Iip9mnSqGe+y/x/PTSw4Yzyf02jS14GiRtfB93zU9k76EeSmJJ2NnaCr2MCks5zCNl nIyocd/u+cDM82BYi7qlyDQlu+RGf3V4KvDdWij+cmDpU11M5AZjZCrtGjzMekftaA0l NeW5nkg9TzXQccDKKOe3WXHs7b5I+0MSyoCeKiicy8wKR/wJqV+8tudj9v5qPUTaYTFo ltJ/V8HT5CjDVFQLIV3yeoKg9SHcogZ+Bkf4NHH3kvWVIXqUQvnOZuG0DrHjhK1FPV1G sjiDNY/88cYuiSU25sRiEVdf73jW1IWSk0e48hsD9ORmFgRhsVY2sALqNPpLBDGKme6M RUdQ== X-Gm-Message-State: AOAM53305J+gfEdwA0ic/6zezr7xjWls0OYki4VbNWXCq6AxrbyYqhqL mzg+pKQFX8Cn1s711GomAi4= X-Google-Smtp-Source: ABdhPJwmTcpNrr37VElfNpqehHSBvOJFHFFfHrHovcAKxDpg8BeyMYMNILKDT4r2RmVxa1x2U8XKog== X-Received: by 2002:a63:f14a:: with SMTP id o10mr21710759pgk.216.1591635696982; Mon, 08 Jun 2020 10:01:36 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id iq3sm103489pjb.6.2020.06.08.10.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 10:01:32 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 9045A41DD1; Mon, 8 Jun 2020 17:01:28 +0000 (UTC) From: Luis Chamberlain <mcgrof@kernel.org> To: axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org, gregkh@linuxfoundation.org, rostedt@goodmis.org, mingo@redhat.com, jack@suse.cz, ming.lei@redhat.com, nstange@suse.de, akpm@linux-foundation.org Cc: mhocko@suse.com, yukuai3@huawei.com, martin.petersen@oracle.com, jejb@linux.ibm.com, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Luis Chamberlain <mcgrof@kernel.org>, Christoph Hellwig <hch@lst.de> Subject: [PATCH v6 5/6] loop: be paranoid on exit and prevent new additions / removals Date: Mon, 8 Jun 2020 17:01:25 +0000 Message-Id: <20200608170127.20419-6-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20200608170127.20419-1-mcgrof@kernel.org> References: <20200608170127.20419-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: C079D181D376F X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
block: fix blktrace debugfs use after free
|
expand
|
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index c33bbbfd1bd9..d55e1b52f076 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -2402,6 +2402,8 @@ static void __exit loop_exit(void) range = max_loop ? max_loop << part_shift : 1UL << MINORBITS; + mutex_lock(&loop_ctl_mutex); + idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); idr_destroy(&loop_index_idr); @@ -2409,6 +2411,8 @@ static void __exit loop_exit(void) unregister_blkdev(LOOP_MAJOR, "loop"); misc_deregister(&loop_misc); + + mutex_unlock(&loop_ctl_mutex); } module_init(loop_init);