From patchwork Wed Feb 19 08:58:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 321785 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8BD942C022C for ; Wed, 19 Feb 2014 19:57:52 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbaBSI5u (ORCPT ); Wed, 19 Feb 2014 03:57:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52384 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752871AbaBSI4m (ORCPT ); Wed, 19 Feb 2014 03:56:42 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1J8ucDr024408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Feb 2014 03:56:38 -0500 Received: from dhcp-26-207.brq.redhat.com (vpn-55-192.rdu2.redhat.com [10.10.55.192]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s1J8uOYu003605; Wed, 19 Feb 2014 03:56:37 -0500 From: Alexander Gordeev To: linux-kernel@vger.kernel.org Cc: Alexander Gordeev , Jens Axboe , Bartlomiej Zolnierkiewicz , Kyungmin Park , linux-pci@vger.kernel.org Subject: [PATCH 6/9] skd: Fix out of array boundary access Date: Wed, 19 Feb 2014 09:58:18 +0100 Message-Id: <06ae7409fef678184a982ace652a299c0018dab8.1392799751.git.agordeev@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org When enabling MSI-X, interrupts are requested for SKD_MAX_MSIX_COUNT entries in skdev->msix_entries array, while the number of actually allocated entries is skdev->msix_count. This might lead to an out of boundary access in case number of allocated entries is less than SKD_MAX_MSIX_COUNT. This update fixes the described misbehaviour. Signed-off-by: Alexander Gordeev Cc: Jens Axboe Cc: Bartlomiej Zolnierkiewicz Cc: Kyungmin Park Cc: linux-pci@vger.kernel.org --- drivers/block/skd_main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c index eb6e1e0..3fa0918 100644 --- a/drivers/block/skd_main.c +++ b/drivers/block/skd_main.c @@ -3989,7 +3989,7 @@ static int skd_acquire_msix(struct skd_device *skdev) } /* Enable MSI-X vectors for the base queue */ - for (i = 0; i < SKD_MAX_MSIX_COUNT; i++) { + for (i = 0; i < skdev->msix_count; i++) { qentry = &skdev->msix_entries[i]; snprintf(qentry->isr_name, sizeof(qentry->isr_name), "%s%d-msix %s", DRV_NAME, skdev->devno,