lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPcyv4itVeM+9jkEN_wYHFWHLJEBbhm0M_L-MYOQfqJ1ta-TGw@mail.gmail.com>
Date:	Fri, 9 Oct 2015 14:12:26 -0700
From:	Dan Williams <dan.j.williams@...el.com>
To:	Logan Gunthorpe <logang@...tatee.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Jens Axboe <axboe@...nel.dk>,
	Boaz Harrosh <boaz@...xistor.com>,
	"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Linux MM <linux-mm@...ck.org>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	Ross Zwisler <ross.zwisler@...ux.intel.com>,
	Christoph Hellwig <hch@....de>,
	Stephen Bates <Stephen.Bates@...s.com>
Subject: Re: [PATCH 10/15] block, dax: fix lifetime of in-kernel dax mappings

On Wed, Oct 7, 2015 at 3:56 PM, Logan Gunthorpe <logang@...tatee.com> wrote:
> Hi Dan,
>
> We've uncovered another issue during testing with these patches. We get a
> kernel panic sometimes just while using a DAX filesystem. I've traced the
> issue back to this patch. (There's a stack trace at the end of this email.)
>
> On 22/09/15 10:42 PM, Dan Williams wrote:
>>
>> +static void dax_unmap_bh(const struct buffer_head *bh, void __pmem *addr)
>> +{
>> +       struct block_device *bdev = bh->b_bdev;
>> +       struct request_queue *q = bdev->bd_queue;
>> +
>> +       if (IS_ERR(addr))
>> +               return;
>> +       blk_dax_put(q);
>>   }
>>
>> @@ -127,9 +159,8 @@ static ssize_t dax_io(struct inode *inode, struct
>> iov_iter *iter,
>>                         if (pos == bh_max) {
>>                                 bh->b_size = PAGE_ALIGN(end - pos);
>>                                 bh->b_state = 0;
>> -                               retval = get_block(inode, block, bh,
>> -                                                  iov_iter_rw(iter) ==
>> WRITE);
>> -                               if (retval)
>> +                               rc = get_block(inode, block, bh, rw ==
>> WRITE);
>> +                               if (rc)
>>                                         break;
>>                                 if (!buffer_size_valid(bh))
>>                                         bh->b_size = 1 << blkbits;
>> @@ -178,8 +213,9 @@ static ssize_t dax_io(struct inode *inode, struct
>> iov_iter *iter,
>>
>>         if (need_wmb)
>>                 wmb_pmem();
>> +       dax_unmap_bh(bh, kmap);
>>
>> -       return (pos == start) ? retval : pos - start;
>> +       return (pos == start) ? rc : pos - start;
>>   }
>
>
> The problem is if get_block fails and returns an error code, it will still
> call dax_unmap_bh which tries to dereference bh->b_bdev. However, seeing
> get_block failed, that pointer is NULL. Maybe a null check in dax_unmap_bh
> would be sufficient?

Thanks for the report, I have this fixed up in v2.  Will post shortly.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ