Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753034AbcCUIZ4 (ORCPT ); Mon, 21 Mar 2016 04:25:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:51405 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751730AbcCUIZp convert rfc822-to-8bit (ORCPT ); Mon, 21 Mar 2016 04:25:45 -0400 From: Johannes Thumshirn To: Calvin Owens Cc: Sathya Prakash , Chaitra P B , Suganath Prabu Subramani , "James E.J. Bottomley" , "Martin K. Petersen" , MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] mpt3sas: Don't overreach ioc->reply_post[] during initialization Date: Mon, 21 Mar 2016 09:25:41 +0100 Message-ID: <2254143.89zXHNL1JB@c203> User-Agent: KMail/5.1.2 (Linux/4.4.3-1-default; KDE/5.19.0; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2469 Lines: 51 On Freitag, 18. M?rz 2016 12:45:42 CET 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 Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850