Re: [BK PATCHES] libata fixes

From: Jeff Garzik
Date: Fri Dec 05 2003 - 13:53:05 EST


Linus Torvalds wrote:

On Fri, 5 Dec 2003, Jeff Garzik wrote:

Linus, please do a

bk pull bk://gkernel.bkbits.net/libata-2.5

This will update the following files:

drivers/scsi/libata-core.c | 17 ++---
drivers/scsi/sata_promise.c | 128 +++++++++++++++++++++++++-------------------


Right now, I'm accepting one-liners that I think are "obvious" and also
"very important" (ie fixes for oopses that anybody can trigger, rather
than for example updates to one particular driver). So it sounds like I
might accept _one_ of these:


<jgarzik@xxxxxxxxxx> (03/12/05 1.1498)
[libata] fix use-after-free

Fixes oops some were seeing on module unload.

Caught by Jon Burgess.


If this is basically an obvious one-liner ("move a kfree")?

Andrew is still off, and he can make a decision independently, but right
now I'm not going to apply anything bigger.


Yep, split out and attached...

Jeff


# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1497 -> 1.1498
# drivers/scsi/libata-core.c 1.8 -> 1.9
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/12/05 jgarzik@xxxxxxxxxx 1.1498
# [libata] fix use-after-free
#
# Fixes oops some were seeing on module unload.
#
# Caught by Jon Burgess.
# --------------------------------------------
#
diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c Fri Dec 5 13:46:54 2003
+++ b/drivers/scsi/libata-core.c Fri Dec 5 13:46:54 2003
@@ -3224,8 +3224,6 @@
scsi_host_put(ap->host); /* FIXME: check return val */
}

- kfree(host_set);
-
pci_release_regions(pdev);

for (i = 0; i < host_set->n_ports; i++) {
@@ -3242,6 +3240,7 @@
}
}

+ kfree(host_set);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
}