From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de ([213.95.11.211]:42660 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758052AbcHYHi2 (ORCPT ); Thu, 25 Aug 2016 03:38:28 -0400 Date: Thu, 25 Aug 2016 09:38:26 +0200 From: Christoph Hellwig To: Andrey Ryabinin Cc: Jens Axboe , Alexander Viro , linux-fsdevel@vger.kernel.org, Maxim Patlasov , Christoph Hellwig , linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs/block_dev: fix potential NULL ptr deref in freeze_bdev() Message-ID: <20160825073826.GB18622@lst.de> References: <1471967731-3465-1-git-send-email-aryabinin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1471967731-3465-1-git-send-email-aryabinin@virtuozzo.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Aug 23, 2016 at 06:55:31PM +0300, Andrey Ryabinin wrote: > Calling freeze_bdev() twice on the same block device without mounted > filesystem get_super() will return NULL, which will lead to NULL-ptr > dereference later in drop_super(). > > Check get_super() result to fix that. > > Note, that this is a purely theoretical issue. We have only 3 > freeze_bdev() callers. 2 of them are in filesystem code and used on a > device with mounted fs. The third one in lock_fs() has protection in > upper-layer code against freezing block device the second time without > thawing it first. > > Signed-off-by: Andrey Ryabinin Looks fine, Reviewed-by: Christoph Hellwig