Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1795581imm; Thu, 24 May 2018 00:41:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoqexl9yS6aJvONUH3eGvuyw4HZCHRpH+AnGJ/w6V2eT7Jw6Zbs5C7eyIaMWk0OuTTx1Qka X-Received: by 2002:a62:c898:: with SMTP id i24-v6mr6183069pfk.35.1527147708205; Thu, 24 May 2018 00:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527147708; cv=none; d=google.com; s=arc-20160816; b=y0SIy+ucMH/gWgLj0A6fOV23rErGeiNRSUuN8VL5v9wb0OMxcuu/oCw/vrZhbG4f0A RVAn2oaqfWTSHKwNhZ3Bz4XM5eexI6SK7suAJz7bjp9LQOpIOdE3qDpUprTCyz9Qg5N0 rkMqgoDhDfgg81gyKGy3Hx0r0KlCTxFQe6w8FyxL74t6ONJTfb9VrIemxUVf3Re+r8fl ChpTzAO+mxl/Alp2cqVJjjx5UWz1AOWDrR5loo598/aC9YQGii33SA16WiGwNhtn3Dkh yGUqNAVPBohc4C16FRWRE0f/LlefN9kAut1CQNTtasVkwk2WQdZ/dfv0zFs7P4+uXcrX VfJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ZfvuLZV78FePGbX9eQEUwOqay5BEw1jm8PYx0c0dCoQ=; b=JUJBKxu1jwdZAipX8iKO63lLBwSOA990Jrf66DIN5mQzbJyaLSHzXO4+ieEKFM6SZZ ijRoj5NW2KBzVJwvUZDrzYfXzvc0VrypP/SxYkKD/+jnQPjg4C+y68YqX7EsUXjkgpOb kFHPayUK1+Z+Cx3X836QLzaMUI3q9zXsSgV1tKWu9fqdh6NHYTX34K+TT4S36NYsaBjj RFwVWh2nYvavx0Txx7CI7n5LXC0YcxTTQC4RhLoNHIKmSUG9Gk6qHRbMjOprEI+M88i5 ECc6HXJfLVUzrpAjifYK3uX6zGK5HwFHqJkhtw5Aubqkw1FWlUtt7qyUc9dL5eOWaoOJ KGsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BbeP63pS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7-v6si16174051pgv.658.2018.05.24.00.41.33; Thu, 24 May 2018 00:41:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BbeP63pS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964823AbeEXHhb (ORCPT + 99 others); Thu, 24 May 2018 03:37:31 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60410 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935498AbeEXHh2 (ORCPT ); Thu, 24 May 2018 03:37:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZfvuLZV78FePGbX9eQEUwOqay5BEw1jm8PYx0c0dCoQ=; b=BbeP63pSc4Hp6REcoYFJuVgg4 OVkGHyYELBrTPL0MmHIdcD1BUtvoI/MkaBF89Et2BzqeTeF1m/PDdYg4pREd3bSZf2gFX7PxZC6LJ qRZq4RtekE72xbTQucbm6JLkeKbGhixVtlhn7ZBmU3Z25s5IL6US+fkhKqrILRkq20V7xEpJZo/bu 8bohz8Ov7O8UAZn3w3rqKbhabOkMLK/1Iea0yFcIWfhuwpnnx/MTp1IMG6JecGhm9DKA0oiFUQQ00 JaxbbBGcHd5DGV+E0XEkMl9N5Y7i7QDAdOOYSTIIN0D1Hhv3DqBPcrgz+nj/54qaMf54uFtU1yYLi 9lAc724lw==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLknu-0006xL-W6; Thu, 24 May 2018 07:36:55 +0000 Date: Thu, 24 May 2018 00:36:54 -0700 From: Christoph Hellwig To: Kees Cook Cc: "Martin K. Petersen" , Jens Axboe , Christoph Hellwig , James Bottomley , Tejun Heo , Borislav Petkov , "David S. Miller" , "Manoj N. Kumar" , "Matthew R. Ochs" , Uma Krishnan , linux-block , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, LKML Subject: Re: [PATCH 3/6] block: Create scsi_sense.h for SCSI and ATAPI Message-ID: <20180524073654.GA32083@infradead.org> References: <8d4af5c4-96fa-54ee-d5c1-b887b1de5a3c@kernel.dk> <9A0BC289-4203-4C77-A012-AAB07F42061F@kernel.dk> <20180523142545.GA16248@infradead.org> <24d36869-e037-042d-cb16-20a81b34eb76@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.