From patchwork Sat Nov 7 16:17:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 7575891 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 80BC69F36A for ; Sat, 7 Nov 2015 16:17:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2A012052A for ; Sat, 7 Nov 2015 16:17:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD97920522 for ; Sat, 7 Nov 2015 16:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753930AbbKGQRg (ORCPT ); Sat, 7 Nov 2015 11:17:36 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:25517 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753671AbbKGQRf (ORCPT ); Sat, 7 Nov 2015 11:17:35 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tA7GHQnK030009 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 7 Nov 2015 16:17:27 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id tA7GHQRl029843 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 7 Nov 2015 16:17:26 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id tA7GHQVh030942; Sat, 7 Nov 2015 16:17:26 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 07 Nov 2015 08:17:25 -0800 Date: Sat, 7 Nov 2015 19:17:09 +0300 From: Dan Carpenter To: Kashyap Desai , Sumit Saxena Cc: Uday Lingala , "James E.J. Bottomley" , megaraidlinux.pdl@avagotech.com, linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch 2/2] megaraid_sas: missing curly braces in megasas_detach_one() Message-ID: <20151107161709.GB30686@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The indenting indicates that there are supposed to be some curly braces here. Presumably it means we free something unintentionally leading to a use after free. Fixes: 3761cb4cf65e ('megaraid_sas: JBOD sequence number support') Signed-off-by: Dan Carpenter --- Not tested. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 829e9e9..91e200d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5932,7 +5932,7 @@ static void megasas_detach_one(struct pci_dev *pdev) fusion->max_map_sz, fusion->ld_map[i], fusion->ld_map_phys[i]); - if (fusion->ld_drv_map[i]) + if (fusion->ld_drv_map[i]) { free_pages((ulong)fusion->ld_drv_map[i], fusion->drv_map_pages); if (fusion->pd_seq_sync) @@ -5940,6 +5940,7 @@ static void megasas_detach_one(struct pci_dev *pdev) pd_seq_map_sz, fusion->pd_seq_sync[i], fusion->pd_seq_phys[i]); + } } free_pages((ulong)instance->ctrl_context, instance->ctrl_context_pages);