From patchwork Sun Oct 29 15:00:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 10031541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4381C602B5 for ; Sun, 29 Oct 2017 15:03:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F96A28764 for ; Sun, 29 Oct 2017 15:03:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 226F62876A; Sun, 29 Oct 2017 15:03:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD9A628764 for ; Sun, 29 Oct 2017 15:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751385AbdJ2PC7 (ORCPT ); Sun, 29 Oct 2017 11:02:59 -0400 Received: from m12-15.163.com ([220.181.12.15]:43143 "EHLO m12-15.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751324AbdJ2PC6 (ORCPT ); Sun, 29 Oct 2017 11:02:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=vJja6s6CcZHpKi/Fg6 lrpwgI2WD2ItZtagOF+50kwx8=; b=lBLakdqhcmSuL6q60fjE7K543TVx8zAFIE G6w7+BF7CCegxoynoi8b3VI/iAoUVhCb0cJr+sEuMCRvkW1q3wIWk62Z4xWsLEIZ gZgBgsv//vk9RdgduNTk0WBFREHjZpsmfR4kSRXSD+zcKKRTNZ7wXIejAPVlqbev ZPgMpnn48= Received: from localhost.localdomain (unknown [1.202.77.139]) by smtp11 (Coremail) with SMTP id D8CowACnYs4p7fVZpkXLJA--.46116S3; Sun, 29 Oct 2017 23:01:00 +0800 (CST) From: Pan Bian To: Matthew Wilcox , Hannes Reinecke , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: scsi: advansys: fix improper function call to kfree Date: Sun, 29 Oct 2017 23:00:54 +0800 Message-Id: <1509289254-15924-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: D8CowACnYs4p7fVZpkXLJA--.46116S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7WryUCF47KF47WF48Wry8Zrb_yoW3Crb_uw 4Igr92kryDGF1xKw1fArW7Zry0ka1UX3ZYvr1Sq34ayryUZw45J3WS9r1rZrsrGF40yw1D ur1qv34fAw10kjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU0CzutUUUUU== X-Originating-IP: [1.202.77.139] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiVAyAclUMCElGpwAAsT Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In function advansys_eisa_probe(), data->host[i] holds the return value of scsi_host_alloc(). The memory allocated by scsi_host_alloc() should be deallocated with scsi_host_put(), not kfree(). Signed-off-by: Pan Bian --- drivers/scsi/advansys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 24e57e7..1f56a6d 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -11678,8 +11678,8 @@ static int advansys_eisa_probe(struct device *dev) return 0; free_data: - kfree(data->host[0]); - kfree(data->host[1]); + scsi_host_put(data->host[0]); + scsi_host_put(data->host[1]); kfree(data); fail: return err;