diff options
author | Kees Cook <keescook@chromium.org> | 2018-07-31 15:51:52 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-08-02 17:22:39 -0400 |
commit | 4e178c17cac07d58df7d31ef6fe10036cfa3883d (patch) | |
tree | 36dcbbaa0e078c465202a21e1ef636fc92719501 /drivers/cdrom/cdrom.c | |
parent | 7a6873be1b11517a0c55ab4534e4de54b3e228a3 (diff) |
cdrom: Use struct scsi_sense_hdr internally
This removes more casts of struct request_sense and uses the standard
struct scsi_sense_hdr instead. This also fixes any possible stale values
since the prior code did not check the sense length.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/cdrom/cdrom.c')
-rw-r--r-- | drivers/cdrom/cdrom.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 86619472d916..113fc6edb2b0 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -282,6 +282,7 @@ | |||
282 | #include <linux/blkdev.h> | 282 | #include <linux/blkdev.h> |
283 | #include <linux/times.h> | 283 | #include <linux/times.h> |
284 | #include <linux/uaccess.h> | 284 | #include <linux/uaccess.h> |
285 | #include <scsi/scsi_common.h> | ||
285 | #include <scsi/scsi_request.h> | 286 | #include <scsi/scsi_request.h> |
286 | 287 | ||
287 | /* used to tell the module to turn on full debugging messages */ | 288 | /* used to tell the module to turn on full debugging messages */ |
@@ -2222,9 +2223,12 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2222 | 2223 | ||
2223 | blk_execute_rq(q, cdi->disk, rq, 0); | 2224 | blk_execute_rq(q, cdi->disk, rq, 0); |
2224 | if (scsi_req(rq)->result) { | 2225 | if (scsi_req(rq)->result) { |
2225 | struct request_sense *s = req->sense; | 2226 | struct scsi_sense_hdr sshdr; |
2227 | |||
2226 | ret = -EIO; | 2228 | ret = -EIO; |
2227 | cdi->last_sense = s->sense_key; | 2229 | scsi_normalize_sense(req->sense, req->sense_len, |
2230 | &sshdr); | ||
2231 | cdi->last_sense = sshdr.sense_key; | ||
2228 | } | 2232 | } |
2229 | 2233 | ||
2230 | if (blk_rq_unmap_user(bio)) | 2234 | if (blk_rq_unmap_user(bio)) |