[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180524073654.GA32083@infradead.org>
Date: Thu, 24 May 2018 00:36:54 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Kees Cook <keescook@...omium.org>
Cc: "Martin K. Petersen" <martin.petersen@...cle.com>,
Jens Axboe <axboe@...nel.dk>,
Christoph Hellwig <hch@...radead.org>,
James Bottomley <James.Bottomley@...senpartnership.com>,
Tejun Heo <tj@...nel.org>, Borislav Petkov <bp@...en8.de>,
"David S. Miller" <davem@...emloft.net>,
"Manoj N. Kumar" <manoj@...ux.vnet.ibm.com>,
"Matthew R. Ochs" <mrochs@...ux.vnet.ibm.com>,
Uma Krishnan <ukrishn@...ux.vnet.ibm.com>,
linux-block <linux-block@...r.kernel.org>,
linux-ide@...r.kernel.org, linux-scsi@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/6] block: Create scsi_sense.h for SCSI and ATAPI
On Wed, May 23, 2018 at 02:17:14PM -0700, Kees Cook wrote:
>
> True, though I'm finding other robustness issues in the CDROM code.
> They're probably all insane corner cases, but it seems like it'd be
> nice to just fix them:
>
> diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
> index 3522d2cae1b6..7726c8618c30 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -2222,9 +2223,12 @@ static int cdrom_read_cdda_bpc(struct
> cdrom_device_info *cdi, __u8 __user *ubuf,
>
> blk_execute_rq(q, cdi->disk, rq, 0);
> if (scsi_req(rq)->result) {
> - struct request_sense *s = req->sense;
> + struct scsi_sense_hdr sshdr;
> +
> ret = -EIO;
> - cdi->last_sense = s->sense_key;
> + scsi_normalize_sense(req->sense, req->sense_len,
> + &sshdr);
> + cdi->last_sense = sshdr.sense_key;
> }
>
> if (blk_rq_unmap_user(bio))
The proper fix here is to rewrite this function to use the the
->generic_packet cdrom_device_ops method. Is is the only caller
going straight to the scsi passthrough requests, which is a layering
violation.
Powered by blists - more mailing lists