浏览代码

ide-tape: fix potential fs requests bug

ide-tape had a potential bug for fs requests when preparing the command
packet: it was writing the transfer length as a number of fixed blocks.
However, the block layer implies 512 byte blocks and ide-tape can have
other block sizes so account for that too.

ide-floppy does this calculation properly with the block size factor
(floppy->bs_factor).

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Borislav Petkov 16 年之前
父节点
当前提交
10c0b3437c
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/ide/ide-tape.c

+ 1 - 1
drivers/ide/ide-tape.c

@@ -586,7 +586,7 @@ static void ide_tape_create_rw_cmd(idetape_tape_t *tape,
 				   struct ide_atapi_pc *pc, struct request *rq,
 				   struct ide_atapi_pc *pc, struct request *rq,
 				   u8 opcode)
 				   u8 opcode)
 {
 {
-	unsigned int length = blk_rq_sectors(rq);
+	unsigned int length = blk_rq_sectors(rq) / (tape->blk_size >> 9);
 
 
 	ide_init_pc(pc);
 	ide_init_pc(pc);
 	put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
 	put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);