From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 In-Reply-To: <1454009704-25959-2-git-send-email-ross.zwisler@linux.intel.com> References: <1454009704-25959-1-git-send-email-ross.zwisler@linux.intel.com> <1454009704-25959-2-git-send-email-ross.zwisler@linux.intel.com> Date: Thu, 28 Jan 2016 12:21:39 -0800 Message-ID: Subject: Re: [PATCH 2/2] dax: fix bdev NULL pointer dereferences From: Dan Williams Content-Type: text/plain; charset=UTF-8 Sender: linux-fsdevel-owner@vger.kernel.org To: Ross Zwisler Cc: "linux-kernel@vger.kernel.org" , Alexander Viro , Andrew Morton , Dave Chinner , Jan Kara , Matthew Wilcox , linux-fsdevel , "linux-nvdimm@lists.01.org" List-ID: On Thu, Jan 28, 2016 at 11:35 AM, Ross Zwisler wrote: > There are a number of places in dax.c that look up the struct block_device > associated with an inode. Previously this was done by just using > inode->i_sb->s_bdev. This is correct for inodes that exist within the > filesystems supported by DAX (ext2, ext4 & XFS), but when running DAX > against raw block devices this value is NULL. This causes NULL pointer > dereferences when these block_device pointers are used. > > Instead, for raw block devices we need to look up the struct block_device > using I_BDEV(). This patch fixes all the block_device lookups in dax.c so > that they work properly for both filesystems and raw block devices. > > Signed-off-by: Ross Zwisler It's a bit odd to check if it is a raw device inode in dax_clear_blocks() since there's no use case to clear blocks in that case, but I can't think of a better alternative. Acked-by: Dan Williams From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968315AbcA1UVn (ORCPT ); Thu, 28 Jan 2016 15:21:43 -0500 Received: from mail-yk0-f175.google.com ([209.85.160.175]:34767 "EHLO mail-yk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754874AbcA1UVk (ORCPT ); Thu, 28 Jan 2016 15:21:40 -0500 MIME-Version: 1.0 In-Reply-To: <1454009704-25959-2-git-send-email-ross.zwisler@linux.intel.com> References: <1454009704-25959-1-git-send-email-ross.zwisler@linux.intel.com> <1454009704-25959-2-git-send-email-ross.zwisler@linux.intel.com> Date: Thu, 28 Jan 2016 12:21:39 -0800 Message-ID: Subject: Re: [PATCH 2/2] dax: fix bdev NULL pointer dereferences From: Dan Williams To: Ross Zwisler Cc: "linux-kernel@vger.kernel.org" , Alexander Viro , Andrew Morton , Dave Chinner , Jan Kara , Matthew Wilcox , linux-fsdevel , "linux-nvdimm@lists.01.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 28, 2016 at 11:35 AM, Ross Zwisler wrote: > There are a number of places in dax.c that look up the struct block_device > associated with an inode. Previously this was done by just using > inode->i_sb->s_bdev. This is correct for inodes that exist within the > filesystems supported by DAX (ext2, ext4 & XFS), but when running DAX > against raw block devices this value is NULL. This causes NULL pointer > dereferences when these block_device pointers are used. > > Instead, for raw block devices we need to look up the struct block_device > using I_BDEV(). This patch fixes all the block_device lookups in dax.c so > that they work properly for both filesystems and raw block devices. > > Signed-off-by: Ross Zwisler It's a bit odd to check if it is a raw device inode in dax_clear_blocks() since there's no use case to clear blocks in that case, but I can't think of a better alternative. Acked-by: Dan Williams