ide: fix barriers support

Freeing non-slab objects is bad and results in an oops.  Fix it.
Reported-and-tested-by: default avatarAndrew Price <andy@andrewprice.me.uk>
Cc: Theodore Tso <tytso@mit.edu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent d5f840bf
...@@ -102,11 +102,14 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) ...@@ -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; drive->dev_flags |= IDE_DFLAG_PARKED;
} }
if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
memcpy(rq->special, cmd, sizeof(*cmd)); struct ide_cmd *orig_cmd = rq->special;
if (cmd->tf_flags & IDE_TFLAG_DYN) if (cmd->tf_flags & IDE_TFLAG_DYN)
kfree(cmd); kfree(orig_cmd);
else
memcpy(orig_cmd, cmd, sizeof(*cmd));
}
} }
/* obsolete, blk_rq_bytes() should be used instead */ /* obsolete, blk_rq_bytes() should be used instead */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment