From patchwork Wed Jan 17 16:46:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 124818 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp90764lja; Wed, 17 Jan 2018 07:54:51 -0800 (PST) X-Google-Smtp-Source: ACJfBovWpjZ3QDOHbupb0/4IUYzmLi1YHCwv9WRwHpX4Zw3sdm4uSr7ahmJH53bVa0FEf2ws9/J2 X-Received: by 10.98.10.79 with SMTP id s76mr25573221pfi.63.1516204491232; Wed, 17 Jan 2018 07:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516204491; cv=none; d=google.com; s=arc-20160816; b=Gmzmox5y3il8Rz2q21ZlHuwxBo5aof2avRHMMe6ZKioEzVw6X96JI2cuJo8hBpWA6r UCeWA6QCjnd5uCY0tnL6ZHdjtbJn9+cmvAo0++vCxqwU0IEmoTm8DfUTIqhE4KgbG1Pl 6K9LyDTbtYF5nP/bJ1Nj1wIeTlwuEdi3o79nav3xoSp8Z+CrHXvtkoty+NW0sKRsKtkI lVUljBZ3j64+VvXsT0F5YUqTRCf+NrEk7lVpkP0EG3QuYM3+zyjxYnzIZ7ZlHKE9NiCH hskClSKy7kIKsJLeq3YnuYbt8KzCASPlDKIi09zfsLy41sSWvtflRWGvAl6SZ4daIHtM HV1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=oaj4+LChqO9clOIZP87mBOk/gacnd/qDkcViQ3bGSrY=; b=DfP1fQF6bFBzSsEAc+4TUDU1U7P3VU7eoCnfCpsHLzWw9YHbJk3xCwokgQzshe7/jB g3LBvi16F+mFnSEvqsq8HrI/tPII9bJafpuYWpjezvZns+u8N30LXbWPmaV+is44DHQ5 sSkU1/LC2U3y6ZXkCHpTIR6UPMQVh/5AF6iWIImB8K54fbGl17Augu88LnM+rc4AJUo1 x2lhTaJmKPWwBVJkKg3ePhjwNOpOOod+iDlEpXuCr2XvVMuLqgY2bEE9U083QgjFBRhU oqb/18z1FlyIZlT+xtov66aiEWBn8AZ6eQM5mm9UG9AQX/tS14LF24nHfjdqkHUgKxSr S+Bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6si4022204pgq.273.2018.01.17.07.54.50; Wed, 17 Jan 2018 07:54:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753833AbeAQPyt (ORCPT + 28 others); Wed, 17 Jan 2018 10:54:49 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:38187 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753690AbeAQPyn (ORCPT ); Wed, 17 Jan 2018 10:54:43 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5D24CBB636B8B; Wed, 17 Jan 2018 23:54:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.361.1; Wed, 17 Jan 2018 23:54:16 +0800 From: John Garry To: , , , CC: , , , , Xiang Chen , John Garry Subject: [PATCH 3/3] scsi: hisi_sas: fix a bug in hisi_sas_dev_gone() Date: Thu, 18 Jan 2018 00:46:54 +0800 Message-ID: <1516207614-159721-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516207614-159721-1-git-send-email-john.garry@huawei.com> References: <1516207614-159721-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen When device gone, NULL pointer can be accessed in free_device callback if during SAS controller reset as we clear structure sas_dev prior. Actually we can only set dev_type as SAS_PHY_UNUSED and not clear structure sas_dev as all the members of structure sas_dev will be re-initialized after device found. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 1 - 1 file changed, 1 deletion(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 791462d..2d4dbed 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -796,7 +796,6 @@ static void hisi_sas_dev_gone(struct domain_device *device) hisi_hba->hw->clear_itct(hisi_hba, sas_dev); device->lldd_dev = NULL; - memset(sas_dev, 0, sizeof(*sas_dev)); } if (hisi_hba->hw->free_device)