From patchwork Wed Jul 29 06:27:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas.G@pmcs.com X-Patchwork-Id: 6889361 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 0B5009F39D for ; Wed, 29 Jul 2015 06:26:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30723207B1 for ; Wed, 29 Jul 2015 06:26:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 348B0207AE for ; Wed, 29 Jul 2015 06:26:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752211AbbG2G0T (ORCPT ); Wed, 29 Jul 2015 02:26:19 -0400 Received: from bby1mta03.pmc-sierra.com ([216.241.235.118]:35376 "EHLO bby1mta03.pmc-sierra.bc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790AbbG2G0T (ORCPT ); Wed, 29 Jul 2015 02:26:19 -0400 Received: from bby1mta03.pmc-sierra.bc.ca (localhost.pmc-sierra.bc.ca [127.0.0.1]) by localhost (Postfix) with SMTP id EAD0D10705D9; Tue, 28 Jul 2015 23:26:18 -0700 (PDT) Received: from smtp.pmcs.com (bby1cas04.pmc-sierra.internal [216.241.227.182]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by bby1mta03.pmc-sierra.bc.ca (Postfix) with ESMTP id D8722107082B; Tue, 28 Jul 2015 23:26:18 -0700 (PDT) Received: from localhost (216.241.227.4) by bby1cas04.pmc-sierra.internal (216.241.227.182) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 28 Jul 2015 23:26:18 -0700 From: To: CC: , , Tomas Henzl , , Subject: [PATCH 4/8] pm80xx: Fix for Incorrect DMA Unmapping of SG List Date: Wed, 29 Jul 2015 11:57:16 +0530 Message-ID: <1438151240-4097-5-git-send-email-Viswas.G@pmcs.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1438151240-4097-1-git-send-email-Viswas.G@pmcs.com> References: <1438151240-4097-1-git-send-email-Viswas.G@pmcs.com> MIME-Version: 1.0 X-Originating-IP: [216.241.227.4] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmcs.com; h=from:to:cc:subject:date:message-id:in-reply-to:references:mime-version:content-type; s=default; bh=jxP9d5THV2X8pZFmG8xYVK0aO7EXclop2tL9PYCOoHs=; b=EceV11DlqrkoVAliSgnRYfswzB2RFfM0g+JdWBoLh6sRoryqQX8H7lJNy6KQN38tRrqPo+o6u3fw0C4ObxWtyNAS2BFpQpKGBcVgVBxHBgF3PItzcFk7Q3Nv24t5DcqWRL0F6RT7oDGDJsOucwrXohvKi8AUnEX2NRICU6UAs3c= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 From: Viswas G In pm8001_ccb_task_free(), the dma unmapping is done based on ccb->n_elem value. This should be initialized to zero in the task_abort(). Otherwise, pm8001_ccb_task_free() will try for dma_unmap_sg() which is invalid for task abort and can lead to kernel crash. Signed-off-by: Viswas G Signed-off-by: Suresh Thiagarajan Reviewed-by: Hannes Reinecke Reviewed-by: Tomas Henzl --- drivers/scsi/pm8001/pm8001_sas.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 4e6955f..b1c5fb9 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -790,6 +790,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem = 0; res = PM8001_CHIP_DISP->task_abort(pm8001_ha, pm8001_dev, flag, task_tag, ccb_tag);