From: Tony Battersby <tonyb@cybernetics.com>
To: Matthew Wilcox <matthew@wil.cx>, James.Bottomley@HansenPartnership.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] sym53c8xx: fix shost use-after-free and memory leak
Date: Tue, 16 Dec 2008 14:35:50 -0500 [thread overview]
Message-ID: <49480316.3000503@cybernetics.com> (raw)
This patch fixes two bugs:
1) rmmod sym53c8xx uses shost after freeing it with scsi_put_host(shost).
2) insmod sym53c8xx doesn't call scsi_put_host(shost) if scsi_add_host()
fails, causing a memory leak on the error path.
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---
--- linux-2.6.28-rc8/drivers/scsi/sym53c8xx_2/sym_glue.c.orig 2008-12-16 14:18:46.000000000 -0500
+++ linux-2.6.28-rc8/drivers/scsi/sym53c8xx_2/sym_glue.c 2008-12-16 14:19:41.000000000 -0500
@@ -1660,6 +1660,7 @@ static int sym_detach(struct Scsi_Host *
OUTB(np, nc_istat, 0);
sym_free_resources(np, pdev);
+ scsi_host_put(shost);
return 1;
}
@@ -1749,7 +1750,6 @@ static void sym2_remove(struct pci_dev *
struct Scsi_Host *shost = pci_get_drvdata(pdev);
scsi_remove_host(shost);
- scsi_host_put(shost);
sym_detach(shost, pdev);
pci_release_regions(pdev);
pci_disable_device(pdev);
reply other threads:[~2008-12-16 20:06 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=49480316.3000503@cybernetics.com \
--to=tonyb@cybernetics.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.