From patchwork Wed Oct 9 19:10:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175653 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1172554ill; Wed, 9 Oct 2019 12:12:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqymAdXecMc4B4BN/aQYPIhmWvLL+1YyTcQoIr4wJmYK5MrbP0EPl+9p/wWI7mJvrj7HqWCM X-Received: by 2002:a17:906:7212:: with SMTP id m18mr4380085ejk.88.1570648374661; Wed, 09 Oct 2019 12:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570648374; cv=none; d=google.com; s=arc-20160816; b=PHCSiIt4dTzMzi3XDm1vm6mx3C0XfwiiCXLH9e6wMNHjQrZgznmt86x9jUVglv4Xvb Wvfkknj6luy9lA5+AK/szh/7gj0ao3sgpI8xHLyiuisc4BCDqbSRw+oLAenFMKH/2+JP 8qlJAWeEfUrvL5XQQ/W5sswCIVAzL4/Oh7dcsWgi0zj6AfkkZDuu9ZcYsbcZTk29R5yG Dv+3okEd337ysrXXUPFgmG4j07Up5dEg3I+va4yLNvQGfMFe8wVo3iIKW9F4hPKhaIPb TjnO02M2mPWEXVXD4LpI/EBjsZT5YkDSGBOXM3Fo3BBj2hImNK3BC3ldXm3876Z4NsIK L9lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/9A2n7GDM7hDpgWBvtRqRyhIZY6IBO7xQteYcmgJx6w=; b=LXNIKppUSo31lWIyv7B6EQwQvzZYrUwOtoMeHDAw7iCh42ZLYlSpZv0n3ylrIEUieB a2y0boQbEoQdpbqWTTFYOhlzpukeooOG1RuehHhG2yEpWMrQFRdKik+phWRmZdYHWT1P pkYmckezxz7FWeE1pVWVSd0jiO55b18NvHB5NSxE2HZG2DxkuYtm64kyGrHL/Bd1NT6P Q6NwiAT9zcrHSanfKr/hr/XWbtxSbBdTMhrPU8r2krGomoA8JCvsDfaoXDujjXNyZIGF x3fBR3l3wED6HWyjQViAE6TSAiIOL4Oe6E038lBrTSXCrmVbYg57r0fAhP62vVBOIh2Q /S9w== ARC-Authentication-Results: i=1; mx.google.com; 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 e23si1759589edq.344.2019.10.09.12.12.54; Wed, 09 Oct 2019 12:12:54 -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; 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 S1732356AbfJITMw (ORCPT + 26 others); Wed, 9 Oct 2019 15:12:52 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:46385 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732044AbfJITLa (ORCPT ); Wed, 9 Oct 2019 15:11:30 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MofLl-1hleRX2T5V-00p7Pi; Wed, 09 Oct 2019 21:11:22 +0200 From: Arnd Bergmann To: Al Viro Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, Arnd Bergmann , linux-scsi@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" Subject: [PATCH v6 43/43] scsi: sd: enable compat ioctls for sed-opal Date: Wed, 9 Oct 2019 21:10:44 +0200 Message-Id: <20191009191044.308087-44-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191009190853.245077-1-arnd@arndb.de> References: <20191009190853.245077-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:zX1dBOxTNEIjEWC6S6Aboc9GLFenI7/73H9gQTcEXZJuXQOOPKQ m3Fd1C/SOXXiF/vgpisdbgSmCcJpi/8S/vO/qXr1qfrJIStRYB3s3dEawxyMSUMn+0NTfXy Ab9xMpMNOALYbbrUsRd2FLw0Ye7wS9Iq5k27P/7uitVAlIrvvypAqXWfA5vkc0tbPYZF+1m NIF5nP/JU3XKb21XnisJw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lFQ+r8yms6g=:sbWCiEgDC0Wd/x2FxEm0lO HIOHewpro6Y6RhDe6KbndIDg0JNlUin7WJAs+q2iO5twgzE03hJmvtw+q/+cNaD+grzoD4Oda gFzYZwLfS9Ef35ZuoxQBOuKAIMQZ7UrTAbC7A4HGnHBdrCJeuL+FAvMkx8d9Q3v8oDLoRK99G guyQ9i6W0+p2M2w3TlNGT+w7ZOCMJIl9i//enaD+YsHcY26KZ2FFZUau1fGlpuhXhAcqODDXX SIcsD74vNvgKtyEPxV9tc3Q2lfXhV6s74yPR+l6P2GlsQnPmu3EOvVNP8zyq8PBq4AP4/0PxD 8mt6NCkQTa6kLkw69qrXpOki8HjCDcvQ2jcGjludeml2Gae0+PG+4flcA4nJzyRMb5pG2bXde Gss218kuyh26mcuzvCMUzxMxLCoTBtDQiVx8PY3oe69kv15zMI+htD6Ocko1S9T0fX+4tn3KN g/dqGY4gdlj/BH/PsPlw7NfC3JvJtW5J8KgG0SAfphyamwOela5x8WVCzovCgjr4yuqFbGZXi /0zOytzYJdzQerNej9emCJzBg4g//n0fKkVR99ce+YbHmaRFLD0+QnF41NuB2SNqlkNEVDWLQ JkJ/iUs6UBYMGqIj35uk/P8skn4f3tiRIkaDlpRk4Rb8G8J9bl8MaT4JrR+dlNzyR1EswTS2M NFx1iku9lwAxHQrhCwDBbP+1xC3i60il2GQ0PiXA9ETGMcBWbWH3QQYqw3bkOQebzBgN1ezzI ucj68bPQaHNnBwPCpejCq7sFoYI8x1G2hI0OzAx8IWJrONDM4BrJghfQQvnMXkjO57YmRW3KR ppoc3ztmdrjMOaKOPqMKgvjeTkKkkZM5MPa/hI7eeaQeYRXyvd6rEK8MQdP/6fH4SgeGNu6Ru eU2kfW0Ze1W96JFfciaA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sed_ioctl() function is written to be compatible between 32-bit and 64-bit processes, however compat mode is only wired up for nvme, not for sd. Add the missing call to sed_ioctl() in sd_compat_ioctl(). Fixes: d80210f25ff0 ("sd: add support for TCG OPAL self encrypting disks") Cc: linux-scsi@vger.kernel.org Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Signed-off-by: Arnd Bergmann --- drivers/scsi/sd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 50928bc266eb..5abdf03083ae 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1692,20 +1692,30 @@ static void sd_rescan(struct device *dev) static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { - struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; + struct gendisk *disk = bdev->bd_disk; + struct scsi_disk *sdkp = scsi_disk(disk); + struct scsi_device *sdev = sdkp->device; + void __user *p = compat_ptr(arg); int error; + error = scsi_verify_blk_ioctl(bdev, cmd); + if (error < 0) + return error; + error = scsi_ioctl_block_when_processing_errors(sdev, cmd, (mode & FMODE_NDELAY) != 0); if (error) return error; + + if (is_sed_ioctl(cmd)) + return sed_ioctl(sdkp->opal_dev, cmd, p); /* * Let the static ioctl translation table take care of it. */ if (!sdev->host->hostt->compat_ioctl) return -ENOIOCTLCMD; - return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); + return sdev->host->hostt->compat_ioctl(sdev, cmd, p); } #endif