Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1966921ybi; Sat, 1 Jun 2019 07:27:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyw/FsNGF8HNus2bhtUFgeo2gIkBIDe0zHl06Fhx2b6YsGa93LldEDhrX/8wTY6ZrCWFoDu X-Received: by 2002:a17:902:9885:: with SMTP id s5mr16750628plp.102.1559399261139; Sat, 01 Jun 2019 07:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559399261; cv=none; d=google.com; s=arc-20160816; b=wGcIiA3+lcZUyCAodo2a/81Zpxwlqnf6tEy71nWXI7NbXm/ws2hqm+g0KRlve+51LZ KJse9YYTjr+y7TUTcEnc8pUHRF9v8xYHOQLh7EHRfBYbboQXBssMw9tihsj9rX+ZAMQQ p/iM289o09IZge3q/+Dp6pqNz2bwpCseffWIYzI3u1LjYXDTjpBXWtL3jSx9yvNQQa1s 6I0RX9ky1N7V7XE4aqXavU3UnrAzHSlcXLsMMGLbARtRXEFn59rh6lhZ62mhIio3bpra zxSkV+CfaQSM1Fuw1Hly7gnGCMHfmG4QlWXlzMhI2n2BvyWjaMJUr3f6CZz/Fk2z3Fex RyPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=HvC78NkwKAnouXD2QP3OXjUjoi2sSorItA4cTC6qb6Q=; b=cGe4D5O55SfJSzEFHJlcJP4Wt9Nr/tvSsIJ2NMtjP/YB9MnXgjmmwWvtj4EeCHUixB BI+Y/mC6U0+Y/Vuw7+OuWJMJChDVIN1eRL3Xc/oOuBzM0elgujUTPJ8pUF5LQuvrioyi sFpP8fe3MOuTOpiRmiA8QsGS7Gyarvu+SfjprAzkN0O1EzbVSNJ+LnbEn0xIzaGU04F+ o+sRkVXoMimaDKg3WGJsIQQl/iaR1xmTsR6NJOGsTXN3OuFvty3vE+TZqCcup1ejZUpc rNFczTPTTHJ6tSqR/0sTig9b9c50JaQGuk3T/u3r+XzdQHzp29VaFlVUQrYlWBxbaIOo yMZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si11156508pfr.52.2019.06.01.07.27.08; Sat, 01 Jun 2019 07:27:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726550AbfFAOZM (ORCPT + 99 others); Sat, 1 Jun 2019 10:25:12 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36565 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbfFAOZM (ORCPT ); Sat, 1 Jun 2019 10:25:12 -0400 Received: by mail-pg1-f196.google.com with SMTP id a3so5690307pgb.3 for ; Sat, 01 Jun 2019 07:25:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=HvC78NkwKAnouXD2QP3OXjUjoi2sSorItA4cTC6qb6Q=; b=r0Bk3YmOmOryvuT+Ba0LECgX+/Pyu3blfy96417lIiTAkmXqX8YwYzeYQNsZGL6fTe QLeiMimuL2JKrzbhnSpECd4m5FGAaUk2eBOFxNvRO5ALHAJHLM45TLNC/13LlhK7bybl 9ayS+Adu5TNP+gTlXyAnIrrMD0/TpxejngmneTYed/aYbfFnq7Pne+ZZmJTMI13iI5Ps JnHiIJ8fjb4vDP6oV+/tj32DKU2WEmPYtjCEF6OSTuDbX1ZI630ueMPasL3U9H9Mv75W lGiFgSf5OHvYHCDiO1Eu+QISA/3HC0kvmtKq9+4wPFvW7z3EFaV0GCTv7Ykd2RkCLlQX suhA== X-Gm-Message-State: APjAAAV2qL/E5d8itEfcbevfGo6UntK/r6a8Z5zgQ7zQBXqrBdy0Vx3e b1Rb2zPW5u1p5pIbn05/ubY= X-Received: by 2002:aa7:9a8c:: with SMTP id w12mr17401556pfi.187.1559399111471; Sat, 01 Jun 2019 07:25:11 -0700 (PDT) Received: from asus.site ([2601:647:4000:5dd1:a41e:80b4:deb3:fb66]) by smtp.gmail.com with ESMTPSA id i17sm9431294pfo.103.2019.06.01.07.25.10 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 01 Jun 2019 07:25:10 -0700 (PDT) Subject: Re: [PATCH 4.19 130/276] block: fix use-after-free on gendisk To: Pavel Machek Cc: linux-kernel@vger.kernel.org, Al Viro , Keith Busch , Jan Kara , Yufen Yu , Jens Axboe , Sasha Levin References: <20190530030523.133519668@linuxfoundation.org> <20190530030533.910471797@linuxfoundation.org> <20190601072756.GA2215@amd> From: Bart Van Assche Openpgp: preference=signencrypt Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxMHIPcYxaJdXxrOG2UO4B60Y/BzE6OrPDT44w4cZA9DH5xialliWU447Bts8TJNa3lZKS1 AvW1ZklbvJfAJJAwzDih35LxU2fcWbmhPa7EO2D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Q+5/zjVrhhfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <41301531-6619-8230-b016-ef32dd3e07e9@acm.org> Date: Sat, 1 Jun 2019 07:25:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190601072756.GA2215@amd> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/1/19 12:27 AM, Pavel Machek wrote: > Hi! > >> +++ b/block/genhd.c >> @@ -518,6 +518,18 @@ void blk_free_devt(dev_t devt) >> } >> } >> >> +/** >> + * We invalidate devt by assigning NULL pointer for devt in idr. >> + */ >> +void blk_invalidate_devt(dev_t devt) >> +{ >> + if (MAJOR(devt) == BLOCK_EXT_MAJOR) { >> + spin_lock_bh(&ext_devt_lock); >> + idr_replace(&ext_devt_idr, NULL, blk_mangle_minor(MINOR(devt))); >> + spin_unlock_bh(&ext_devt_lock); >> + } >> +} >> + > > AFAICT /** means linuxdoc, but the comment does not have required > format. Probably should be just /*. Agreed. A fix has been queued in Jens' tree. See also commit 33c826ef19df ("block: Convert blk_invalidate_devt() header into a non-kernel-doc header"). Bart.