From patchwork Wed Jul 5 12:42:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 9826449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19E4960317 for ; Wed, 5 Jul 2017 12:42:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0480625404 for ; Wed, 5 Jul 2017 12:42:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBB3525F3E; Wed, 5 Jul 2017 12:42:35 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 5BA3F25404 for ; Wed, 5 Jul 2017 12:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752044AbdGEMme (ORCPT ); Wed, 5 Jul 2017 08:42:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:41847 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751772AbdGEMme (ORCPT ); Wed, 5 Jul 2017 08:42:34 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0CCC9AB9D; Wed, 5 Jul 2017 12:42:33 +0000 (UTC) Date: Wed, 5 Jul 2017 14:42:29 +0200 From: Johannes Thumshirn To: Chris Clayton Cc: linux-scsi@vger.kernel.org Subject: Re: Nero 4 Linux applications broken in 4.12 Message-ID: <20170705124229.GH4076@linux-x5ow.site> References: <460fefb4-d002-6989-0c90-63ea0e209fc3@googlemail.com> <20170705073928.GA4076@linux-x5ow.site> <9c58bac7-ddf4-3e47-b729-76e595804836@googlemail.com> <20170705084447.GD4076@linux-x5ow.site> <20170705084810.GE4076@linux-x5ow.site> <20170705115235.GF4076@linux-x5ow.site> <3790b5ad-c02f-6406-173b-f2a0563f642b@googlemail.com> <20170705120927.GG4076@linux-x5ow.site> <8834e9d2-3018-ee8f-b40e-ccd8aecc367c@googlemail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <8834e9d2-3018-ee8f-b40e-ccd8aecc367c@googlemail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Jul 05, 2017 at 01:19:09PM +0100, Chris Clayton wrote: > I'm happy to test any patches you may propose. Can you verify this fix? Preferedably with using Nero. It passes my small reproducer: From f52502180cc3843f8acc956253af2575245546a8 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 5 Jul 2017 14:31:47 +0200 Subject: [PATCH] scsi: sg: fix SG_DXFER_FROM_DEV transfers SG_DXFER_FROM_DEV transfers do not have a dxferp as we set it to NULL, but must have a length bigger than 0. This fixes a regression introduced by commit 28676d869bbb ("scsi: sg: check for valid direction before starting the request") Signed-off-by: Johannes Thumshirn Fixes: 28676d869bbb ("scsi: sg: check for valid direction before starting the request") Tested-by: Chris Clayton --- drivers/scsi/sg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 21225d62b0c1..3c91593260aa 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -758,8 +758,11 @@ static bool sg_is_valid_dxfer(sg_io_hdr_t *hp) if (hp->dxferp || hp->dxfer_len > 0) return false; return true; - case SG_DXFER_TO_DEV: case SG_DXFER_FROM_DEV: + if (hp->dxferp || hp->dxfer_len < 0) + return false; + return true; + case SG_DXFER_TO_DEV: case SG_DXFER_TO_FROM_DEV: if (!hp->dxferp || hp->dxfer_len == 0) return false;