From patchwork Tue Aug 11 09:36:28 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: 6990141 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D89BAC05AC for ; Tue, 11 Aug 2015 09:34:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 132D420582 for ; Tue, 11 Aug 2015 09:34:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D95C2057F for ; Tue, 11 Aug 2015 09:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933753AbbHKJeu (ORCPT ); Tue, 11 Aug 2015 05:34:50 -0400 Received: from bby1mta03.pmc-sierra.com ([216.241.235.118]:37394 "EHLO bby1mta03.pmc-sierra.bc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933709AbbHKJeu (ORCPT ); Tue, 11 Aug 2015 05:34:50 -0400 Received: from bby1mta03.pmc-sierra.bc.ca (localhost.pmc-sierra.bc.ca [127.0.0.1]) by localhost (Postfix) with SMTP id CFE7C10708A3; Tue, 11 Aug 2015 02:34:49 -0700 (PDT) Received: from smtp.pmcs.com (bby1cas02.pmc-sierra.internal [216.241.227.143]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by bby1mta03.pmc-sierra.bc.ca (Postfix) with ESMTP id BCAAB1070782; Tue, 11 Aug 2015 02:34:49 -0700 (PDT) Received: from localhost (216.241.227.4) by bby1cas02.pmc-sierra.internal (216.241.227.143) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 11 Aug 2015 02:34:49 -0700 From: To: CC: Jack Wang , , Tomas Henzl , , , Hannes Reinecke Subject: [PATCH V2 4/8] pm80xx: Fix for Incorrect DMA Unmapping of SG List Date: Tue, 11 Aug 2015 15:06:28 +0530 Message-ID: <1439285792-12030-5-git-send-email-Viswas.G@pmcs.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1439285792-12030-1-git-send-email-Viswas.G@pmcs.com> References: <1439285792-12030-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=pUzTNlvC1uNRDwvstyMRlqPnkZr5nULYZUpxLurknDE=; b=jzkJTJZuUo7vTFJlZj9OC5jwG6W9ZE9Hioaj+PAZ1J4+kMaJaJw5xvz2FNR5FXfDFFK/b+E+pkMVbpFIbFy+KLxgE8losVKVce2ugRvop6jv5T4a0vjcUWsMMnXNatQmHNWpXNzhWgfOMd1vjh//902jiVWm5ZPYd4qVOiIG8Jg= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.0 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. Changes From V1: None Signed-off-by: Viswas G Reviewed-by: Suresh Thiagarajan Reviewed-by: Hannes Reinecke Reviewed-by: Jack Wang 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 48f4627..949198c 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);