浏览代码

packet: fix error handling

The packet driver is assuming (reasonably) that the (undocumented)
request.errors is an errno.  But it is in fact some mysterious bitfield.  When
things go wrong we return weird positive numbers to the VFS as pointers and it
goes oops.

Thanks to William Heimbigner for reporting and diagnosis.

(It doesn't oops, but this driver still doesn't work for William)

Cc: William Heimbigner <icxcnika@mar.tar.cc>
Cc: Peter Osterlund <petero2@telia.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andrew Morton 18 年之前
父节点
当前提交
cbc31a475a
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/block/pktcdvd.c

+ 2 - 1
drivers/block/pktcdvd.c

@@ -777,7 +777,8 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
 		rq->cmd_flags |= REQ_QUIET;
 		rq->cmd_flags |= REQ_QUIET;
 
 
 	blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0);
 	blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0);
-	ret = rq->errors;
+	if (rq->errors)
+		ret = -EIO;
 out:
 out:
 	blk_put_request(rq);
 	blk_put_request(rq);
 	return ret;
 	return ret;