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>

+7 -4
+7 -4
drivers/ide/ide-io.c
··· 102 102 drive->dev_flags |= IDE_DFLAG_PARKED; 103 103 } 104 104 105 - if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) 106 - memcpy(rq->special, cmd, sizeof(*cmd)); 105 + if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 106 + struct ide_cmd *orig_cmd = rq->special; 107 107 108 - if (cmd->tf_flags & IDE_TFLAG_DYN) 109 - kfree(cmd); 108 + if (cmd->tf_flags & IDE_TFLAG_DYN) 109 + kfree(orig_cmd); 110 + else 111 + memcpy(orig_cmd, cmd, sizeof(*cmd)); 112 + } 110 113 } 111 114 112 115 /* obsolete, blk_rq_bytes() should be used instead */