summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-18 17:42:20 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-18 17:42:20 +0200
commitf505d49ffd25ed062e76ffd17568d3937fcd338c (patch)
tree1ffafdccffd2373ec8b5f60bb72da841d4d200d8
parentd5f840bf74c09ca5a31e518c9d984999926b5f44 (diff)
downloadop-kernel-dev-f505d49ffd25ed062e76ffd17568d3937fcd338c.zip
op-kernel-dev-f505d49ffd25ed062e76ffd17568d3937fcd338c.tar.gz
ide: fix barriers support
Freeing non-slab objects is bad and results in an oops. Fix it. Reported-and-tested-by: Andrew Price <andy@andrewprice.me.uk> Cc: Theodore Tso <tytso@mit.edu> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-io.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 2ae02b8..35dc38d 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -102,11 +102,14 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
drive->dev_flags |= IDE_DFLAG_PARKED;
}
- if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
- memcpy(rq->special, cmd, sizeof(*cmd));
+ if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
+ struct ide_cmd *orig_cmd = rq->special;
- if (cmd->tf_flags & IDE_TFLAG_DYN)
- kfree(cmd);
+ if (cmd->tf_flags & IDE_TFLAG_DYN)
+ kfree(orig_cmd);
+ else
+ memcpy(orig_cmd, cmd, sizeof(*cmd));
+ }
}
/* obsolete, blk_rq_bytes() should be used instead */
OpenPOWER on IntegriCloud