Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753134AbcCVQs7 (ORCPT ); Tue, 22 Mar 2016 12:48:59 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:9090 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbcCVQsu (ORCPT ); Tue, 22 Mar 2016 12:48:50 -0400 Subject: Re: [PATCH] mpt3sas: Don't overreach ioc->reply_post[] during initialization To: Calvin Owens , Sathya Prakash , Chaitra P B , Suganath Prabu Subramani , "James E.J. Bottomley" , "Martin K. Petersen" References: CC: , , , From: Jens Axboe Message-ID: <56F1775E.3020500@fb.com> Date: Tue, 22 Mar 2016 10:48:30 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-22_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2179 Lines: 47 On 03/18/2016 01:45 PM, Calvin Owens wrote: > In _base_make_ioc_operational(), we walk ioc->reply_queue_list and pull > a pointer out of successive elements of ioc->reply_post[] for each entry > in that list if RDPQ is enabled. > > Since the code pulls the pointer for the next iteration at the bottom of > the loop, it triggers the a KASAN dump on the final iteration: > > BUG: KASAN: slab-out-of-bounds in _base_make_ioc_operational+0x47b7/0x47e0 [mpt3sas] at addr ffff880754816ab0 > Read of size 8 by task modprobe/305 > > Call Trace: > [] dump_stack+0x4d/0x6c > [] print_trailer+0xf9/0x150 > [] object_err+0x34/0x40 > [] kasan_report_error+0x221/0x530 > [] __asan_report_load8_noabort+0x43/0x50 > [] _base_make_ioc_operational+0x47b7/0x47e0 [mpt3sas] > [] mpt3sas_base_attach+0x1991/0x2120 [mpt3sas] > [] _scsih_probe+0xeb3/0x16b0 [mpt3sas] > [] local_pci_probe+0xc7/0x170 > [] pci_device_probe+0x20f/0x290 > [] really_probe+0x17d/0x600 > [] __driver_attach+0x153/0x190 > [] bus_for_each_dev+0x11c/0x1a0 > [] driver_attach+0x3d/0x50 > [] bus_add_driver+0x44a/0x5f0 > [] driver_register+0x18c/0x3b0 > [] __pci_register_driver+0x156/0x200 > [] _mpt3sas_init+0x135/0x1000 [mpt3sas] > [] do_one_initcall+0x113/0x2b0 > [] do_init_module+0x1d0/0x4d8 > [] load_module+0x6729/0x8dc0 > [] SYSC_init_module+0x183/0x1a0 > [] SyS_init_module+0xe/0x10 > [] entry_SYSCALL_64_fastpath+0x12/0x6a > > Fix this by pulling the value at the beginning of the loop. > > Signed-off-by: Calvin Owens Looks good to me. Reviewed-by: Jens Axboe -- Jens Axboe