diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-04-18 11:42:20 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-04-18 11:42:20 -0400 |
commit | f505d49ffd25ed062e76ffd17568d3937fcd338c (patch) | |
tree | 1ffafdccffd2373ec8b5f60bb72da841d4d200d8 | |
parent | d5f840bf74c09ca5a31e518c9d984999926b5f44 (diff) |
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.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 2ae02b8d7f8e..35dc38d3b2c5 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) | |||
102 | drive->dev_flags |= IDE_DFLAG_PARKED; | 102 | drive->dev_flags |= IDE_DFLAG_PARKED; |
103 | } | 103 | } |
104 | 104 | ||
105 | if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | 105 | if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
106 | memcpy(rq->special, cmd, sizeof(*cmd)); | 106 | struct ide_cmd *orig_cmd = rq->special; |
107 | 107 | ||
108 | if (cmd->tf_flags & IDE_TFLAG_DYN) | 108 | if (cmd->tf_flags & IDE_TFLAG_DYN) |
109 | kfree(cmd); | 109 | kfree(orig_cmd); |
110 | else | ||
111 | memcpy(orig_cmd, cmd, sizeof(*cmd)); | ||
112 | } | ||
110 | } | 113 | } |
111 | 114 | ||
112 | /* obsolete, blk_rq_bytes() should be used instead */ | 115 | /* obsolete, blk_rq_bytes() should be used instead */ |