From: Pan Bian <bianpan2016@163.com>
To: Matthew Wilcox <matthew@wil.cx>, Hannes Reinecke <hare@suse.com>,
"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
Pan Bian <bianpan2016@163.com>
Subject: [PATCH] scsi: advansys: fix improper function call to kfree
Date: Sun, 5 Nov 2017 22:30:12 +0800 [thread overview]
Message-ID: <1509892212-10489-1-git-send-email-bianpan2016@163.com> (raw)
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 <bianpan2016@163.com>
---
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;
--
1.9.1
reply other threads:[~2017-11-05 14:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509892212-10489-1-git-send-email-bianpan2016@163.com \
--to=bianpan2016@163.com \
--cc=hare@suse.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=matthew@wil.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®