Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp581493img; Fri, 22 Mar 2019 04:30:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5RifYPcEpJvitYxAGtjl3Gnb5vbvCE7KakQ9CqvMwqMjfAtknxu56wNODyVS0OvhsL7B8 X-Received: by 2002:a62:54c5:: with SMTP id i188mr8502059pfb.188.1553254204791; Fri, 22 Mar 2019 04:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553254204; cv=none; d=google.com; s=arc-20160816; b=oDjg+/be/12zyXQODnEQfgWocnHR4MOZ5cAickv8LvTrN2bQb8lVEjMb3EiJWfsVbR lJh8ZCyXjI1ZM+8D8nqPgmgboSy55GYy2YBcApt6S0RuAysEUEKT1G0lUe6yWYbQxpJW /SOnC7auarOH7NEWZr5bXyICvDSz3h4HrPV3rENFW0a/1DXite4GhlW/nTRjxTD7/ZXf izP6VCk4kD/MKzMzarcZ6xG6zFwCxrHBjhiuGzUkdnpmttJfef0BN0+MZ3CzfyV79/lJ pKhyJoYSp5O9D5duc1PRH6mzsSJLPVXW/RGxOOjeZzD4eXMFR1hnBoFFRlFXbJOqZ0RA xYlg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l6pmPNwHsVUYSp8chQzqk97jwKbVxFPU6y8ImmkL42Y=; b=wZcY1DHDqXE671QVluTo/O3J663z4r0IW3W1UygoidfS+8WCJvWuIvA6ufKKPpYDo8 F9fK+SuZJX2uvlSypGOtOzZ/SWzw5S+mPYe4Jbhax0cw8/6srv7VxSPRjdCMhNHLv3hR 0VvJMoIhGBiircoa+mbXmHvgIB35hCoMq/1CYeGbDUqkgXVujtRPdrK5EKz6PpIOCLst Y2dF1iZWv509LgeKVzePmIs6zxRHP96rgqVeCF7zLUxcjfmlboZZJkxBaeS4drZiYO4F R1hSuvKu/rO+xjaFCTqwSbKc93L0Yn3tLCWQOjk7x7/tfzM3bJdZSfiD7E6nluIh9ot3 7MCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wyp6rdjo; 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 r4si6570921plo.416.2019.03.22.04.29.47; Fri, 22 Mar 2019 04:30:04 -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=pass header.i=@kernel.org header.s=default header.b=Wyp6rdjo; 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 S1729461AbfCVL0r (ORCPT + 99 others); Fri, 22 Mar 2019 07:26:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:54478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729454AbfCVL0o (ORCPT ); Fri, 22 Mar 2019 07:26:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 85721218B0; Fri, 22 Mar 2019 11:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553254004; bh=COHtvt5ZrcT74APEONreLYLf+qwDSSTE7+TApVZfll0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wyp6rdjooOH9UotkmTe11rRtEExufcjojMaCzCqTPsLnOnBXUjib3l+K4OgtAeQrJ Ezyd19A3DIIn2CqyTw2w1e5/9xfj8XqhA3Aofada7JGyD30Zkcyh8Iah36DFEV50vr VW74ObNq76y3mWZCk22nGbQ/LhCL2wkOczQ21dSU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felipe Franciosi , Paolo Bonzini , "Martin K. Petersen" Subject: [PATCH 3.18 112/134] scsi: virtio_scsi: dont send sc payload with tmfs Date: Fri, 22 Mar 2019 12:15:25 +0100 Message-Id: <20190322111218.424874403@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felipe Franciosi commit 3722e6a52174d7c3a00e6f5efd006ca093f346c1 upstream. The virtio scsi spec defines struct virtio_scsi_ctrl_tmf as a set of device-readable records and a single device-writable response entry: struct virtio_scsi_ctrl_tmf { // Device-readable part le32 type; le32 subtype; u8 lun[8]; le64 id; // Device-writable part u8 response; } The above should be organised as two descriptor entries (or potentially more if using VIRTIO_F_ANY_LAYOUT), but without any extra data after "le64 id" or after "u8 response". The Linux driver doesn't respect that, with virtscsi_abort() and virtscsi_device_reset() setting cmd->sc before calling virtscsi_tmf(). It results in the original scsi command payload (or writable buffers) added to the tmf. This fixes the problem by leaving cmd->sc zeroed out, which makes virtscsi_kick_cmd() add the tmf to the control vq without any payload. Cc: stable@vger.kernel.org Signed-off-by: Felipe Franciosi Reviewed-by: Paolo Bonzini Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/virtio_scsi.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -653,7 +653,6 @@ static int virtscsi_device_reset(struct return FAILED; memset(cmd, 0, sizeof(*cmd)); - cmd->sc = sc; cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){ .type = VIRTIO_SCSI_T_TMF, .subtype = VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET, @@ -728,7 +727,6 @@ static int virtscsi_abort(struct scsi_cm return FAILED; memset(cmd, 0, sizeof(*cmd)); - cmd->sc = sc; cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){ .type = VIRTIO_SCSI_T_TMF, .subtype = VIRTIO_SCSI_T_TMF_ABORT_TASK,