From patchwork Tue Jul 31 19:51:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10551281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B25111822 for ; Tue, 31 Jul 2018 19:52:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1E0F283D1 for ; Tue, 31 Jul 2018 19:52:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 961B228449; Tue, 31 Jul 2018 19:52:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33E2D283D1 for ; Tue, 31 Jul 2018 19:52:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732535AbeGaVeu (ORCPT ); Tue, 31 Jul 2018 17:34:50 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35674 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732534AbeGaVeA (ORCPT ); Tue, 31 Jul 2018 17:34:00 -0400 Received: by mail-pf1-f194.google.com with SMTP id p12-v6so1506205pfh.2 for ; Tue, 31 Jul 2018 12:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=J917hlJwULr6t35bbsk9fwjW3plGhyyNeLJG8ZXmTjQ=; b=OpgjqZUpWeCQ6UwzWFad6jiuh/ckBc14r8nRghS2td/IsdrW4tY+hCkyAKJTpl9FJo Z5Fow34Tp9z+nf43qI4H1eg34V0GomzGXyB3oPieidO+fAUEt74FwMk5+Y+0SUtxu7M2 x5Kb4MVArmMVPrv6rdJ/xCZsI4fah4viA7TRI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=J917hlJwULr6t35bbsk9fwjW3plGhyyNeLJG8ZXmTjQ=; b=sBdxX03Pg1x3Ds+9vd1dUgVyAZISnhOmCl++bFwGq/sPNtKM7XVjLgwSO13gm/HWxa lPbtNiEDGGA3jDu9PLZG3c+JqYn+WawoQik9zcA+pLkEUHtCG1FxoXBlnYyLguZglmmS N68Tk+yMejL8c2o2Jz3grmre8hjrvSXOJqaIqv9rdUlhB0j/Q0kr3ZY0bfK1O4NYjXzM xRGYWuJTOhu9oiMw5+bzt6UBzOaPCJEr/hzZZJpgRPo0VzdzHbTTt9jR1zBhU+gT26Nf JB3UB7TDCEUiLaz8t9j6zg1SHZDtPyEYI8Of2OZatDIHH717xfsPOLMG9zM/ghgYxx9a uHxw== X-Gm-Message-State: AOUpUlFNb5kSrnu28mtWGQAPoCWxnjOOutaaFZQOzz6AM8PjuyL4QXSZ KVcOZ1syTjsj/NdrxIDjuKtXLg== X-Google-Smtp-Source: AAOMgpeVu3iMR+3CLOFE11Z/sNMLVPJiJAYCNkdcT34WHwlsTmv9/rnXjevNuDqHUB1kDXrderLKLA== X-Received: by 2002:a65:6143:: with SMTP id o3-v6mr22161045pgv.52.1533066726720; Tue, 31 Jul 2018 12:52:06 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id b62-v6sm32348115pfm.97.2018.07.31.12.52.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 12:52:02 -0700 (PDT) From: Kees Cook To: Jens Axboe Cc: Kees Cook , Christoph Hellwig , "Martin K. Petersen" , "James E.J. Bottomley" , Tejun Heo , Borislav Petkov , "David S. Miller" , "Manoj N. Kumar" , "Matthew R. Ochs" , Uma Krishnan , "Nicholas A. Bellinger" , Thomas Gleixner , Philippe Ombredanne , Stephen Boyd , Cyrille Pitchen , Juergen Gross , Viresh Kumar , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Sagar Dharia , Randy Dunlap , Vinod Koul , David Kershner , linux-block@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/9] block: Consolidate scsi sense buffer usage Date: Tue, 31 Jul 2018 12:51:45 -0700 Message-Id: <20180731195155.46664-1-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is a follow-up to commit f7068114d45e ("sr: pass down correctly sized SCSI sense buffer") which further cleans up and removes needless sense character array buffers and "struct request_sense" usage in favor of the common "struct scsi_sense_hdr". First, drop a bunch of unused sense buffers: [PATCH 1/9] ide-cd: Drop unused sense buffers [PATCH 2/9] scsi: cxlflash: Drop unused sense buffers Next, allow the sense buffer to be usable outside SCSI tree: [PATCH 3/9] scsi: build scsi_common.o for all scsi passthrough request users [PATCH 4/9] target: don't depend on SCSI Then move all request_sense usage to scsi_sense_hdr: [PATCH 5/9] block: Switch struct packet_command to use struct scsi_sense_hdr And do some further cleanups for scsi_sense_hdr now that we can: [PATCH 6/9] ide-cd: Remove redundant sense buffer [PATCH 7/9] cdrom: Use struct scsi_sense_hdr internally Finally add a build-time check to make sure we don't pass bad buffer sizes: [PATCH 8/9] libata-scsi: Move sense buffers onto stack [PATCH 9/9] scsi: Check sense buffer size at build time -Kees Christoph Hellwig (2): scsi: build scsi_common.o for all scsi passthrough request users target: don't depend on SCSI Kees Cook (7): ide-cd: Drop unused sense buffers scsi: cxlflash: Drop unused sense buffers block: Switch struct packet_command to use struct scsi_sense_hdr ide-cd: Remove redundant sense buffer cdrom: Use struct scsi_sense_hdr internally libata-scsi: Move sense buffers onto stack scsi: Check sense buffer size at build time drivers/Makefile | 2 +- drivers/ata/libata-scsi.c | 18 +++------ drivers/block/Kconfig | 2 +- drivers/block/pktcdvd.c | 36 +++++++++--------- drivers/cdrom/cdrom.c | 30 ++++++++------- drivers/ide/ide-cd.c | 58 ++++++++++++++--------------- drivers/ide/ide-cd.h | 6 +-- drivers/ide/ide-cd_ioctl.c | 62 +++++++++++++------------------ drivers/scsi/Makefile | 2 +- drivers/scsi/cxlflash/superpipe.c | 8 +--- drivers/scsi/cxlflash/vlun.c | 7 +--- drivers/scsi/scsi_lib.c | 6 +-- drivers/scsi/sr_ioctl.c | 22 +++++------ drivers/target/Kconfig | 5 ++- include/linux/cdrom.h | 3 +- include/scsi/scsi_cmnd.h | 6 +-- include/scsi/scsi_device.h | 14 ++++++- 17 files changed, 136 insertions(+), 151 deletions(-) Acked-by: Martin K. Petersen