Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5246953ybi; Tue, 30 Jul 2019 17:01:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0MRUvFn8WGllL4wtBxFDP5210AOQsrgUXPOknAVskGTdOzb4ERMqAAHyP7FxRsZHbxDkg X-Received: by 2002:a17:902:4201:: with SMTP id g1mr1313457pld.300.1564531295509; Tue, 30 Jul 2019 17:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564531295; cv=none; d=google.com; s=arc-20160816; b=EDUXZn7dhHUppfFdpFWQfQviibsgUIQQ7a6sHb4wIhHkB87UjjHEtipHVrNqTwNOjO c5IJretzjteL3oTqP5rwNnNOKOpCrjDJm6Q8izm/BUFCPTlTUzq5mX/wwkUy8s2Krts6 i1Ten/BYIa/LqL39xNgj54sHOA9sLYrNtHo3njU3xGxdXR8fiKaPM8xCDynr1xPb6M0y 4ZGEDX4FDxSc8PouJJ7Ov4LhdVJkjslS1/gyAd/qxDgELYsDep8LrRu+0VS6wHSmYrg7 97txj4MCM8zs/ga0POqzOTNbSvmOtEEAby1y6aiQigrKm5/YGjOlyOcBRljzvzZydD8b tsIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=E/XjaeNs1hr5sBVv36mjkiSpsTgrpwNf3QDgioVaMWk=; b=P4HggpGEZ25hC4wFFNEeeJAE/bwKotW/mkHemsrgZmocZoFxyMcrtoBmt9yPypYz6B Y/6NUGVVcf6QxHAw92Z45xJ0X0H82G+CSvvmNczlSUB++RQKQDTSZFUrae+BVJCpYkQ+ Ycm1ud3Kw5f+DdJ58xi8KfzZ/+j1s9kFwhez0vJ5vu6csHqbrOsvbMIPWM1MjUnZhFoC 5KJZ034T9dp8hAfXxnb4t5+6+ZCKL0y4AZJdchsDPJPTcukqumRCjaoYFf/iFdCnU/3K a0hvE3EIwjNsSnwCTS7c1jqiSwQFg8zju0k7EG0KvauB/5hHz1Z4whn9E3Sa3qv26357 vJzQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si32370849pgk.456.2019.07.30.17.01.19; Tue, 30 Jul 2019 17:01:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387924AbfG3WBG (ORCPT + 99 others); Tue, 30 Jul 2019 18:01:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47280 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387630AbfG3WBG (ORCPT ); Tue, 30 Jul 2019 18:01:06 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E44D4E8AC; Tue, 30 Jul 2019 22:01:06 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 667E719724; Tue, 30 Jul 2019 22:01:03 +0000 (UTC) Date: Tue, 30 Jul 2019 18:01:02 -0400 From: Mike Snitzer To: Dan Williams Cc: Pankaj Gupta , device-mapper development , linux-nvdimm , linux-fsdevel , Linux Kernel Mailing List , Alasdair Kergon , jencce.kernel@gmail.com Subject: Re: dm: fix dax_dev NULL dereference Message-ID: <20190730220102.GA15604@redhat.com> References: <20190730113708.14660-1-pagupta@redhat.com> <2030283543.5419072.1564486701158.JavaMail.zimbra@redhat.com> <20190730190737.GA14873@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 30 Jul 2019 22:01:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 30 2019 at 5:38pm -0400, Dan Williams wrote: > On Tue, Jul 30, 2019 at 12:07 PM Mike Snitzer wrote: > > > > I staged the fix (which I tweaked) here: > > https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.3&id=95b9ebb78c4c733f8912a195fbd0bc19960e726e > > Thanks for picking this up Mike, but I'd prefer to just teach > dax_synchronous() to return false if the passed in dax_dev is NULL. > Thoughts? I considered that too but I moved away from it because I'm so used to the various block interfaces requiring the caller pass a non-NULL pointer (e.g. request_queue): $ grep -ri return drivers/md/dm-table.c | grep \&\& drivers/md/dm-table.c: return dev->dax_dev && dax_synchronous(dev->dax_dev); drivers/md/dm-table.c: return q && blk_queue_zoned_model(q) == *zoned_model; drivers/md/dm-table.c: return q && blk_queue_zone_sectors(q) == *zone_sectors; drivers/md/dm-table.c: return q && (q->queue_flags & flush); drivers/md/dm-table.c: return q && blk_queue_nonrot(q); drivers/md/dm-table.c: return q && !blk_queue_add_random(q); drivers/md/dm-table.c: return q && !q->limits.max_write_same_sectors; drivers/md/dm-table.c: return q && !q->limits.max_write_zeroes_sectors; drivers/md/dm-table.c: return q && !blk_queue_discard(q); drivers/md/dm-table.c: return q && !blk_queue_secure_erase(q); drivers/md/dm-table.c: return q && bdi_cap_stable_pages_required(q->backing_dev_info); I'm fine with however you'd like to skin this cat though. Just let me know and I'll keep/drop this patch accordingly. Thanks, Mike