Skip to content

Commit

Permalink
ide: fix barriers support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Apr 18, 2009
1 parent d5f840b commit f505d49
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/ide/ide-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit f505d49

Please sign in to comment.