From patchwork Mon Oct 29 17:34:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10659855 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 96BD013B5 for ; Mon, 29 Oct 2018 17:36:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 901382930E for ; Mon, 29 Oct 2018 17:36:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81DE329684; Mon, 29 Oct 2018 17:36:34 +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.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3199C2930E for ; Mon, 29 Oct 2018 17:36:34 +0000 (UTC) Received: from localhost ([::1]:47625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHBSr-000469-EN for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Oct 2018 13:36:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHBRE-0002qM-Vr for qemu-devel@nongnu.org; Mon, 29 Oct 2018 13:34:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHBR8-0001By-AF for qemu-devel@nongnu.org; Mon, 29 Oct 2018 13:34:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37288) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHBR8-00011k-0w for qemu-devel@nongnu.org; Mon, 29 Oct 2018 13:34:46 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03AC932A28AB; Mon, 29 Oct 2018 17:34:40 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-24.ams2.redhat.com [10.36.112.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAAD610D8980; Mon, 29 Oct 2018 17:34:38 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 29 Oct 2018 18:34:33 +0100 Message-Id: <20181029173437.32559-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 29 Oct 2018 17:34:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 0/4] scsi-generic: fixes for Block Limits emulation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Henrique Barboza , mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP scsi-generic (pass through) devices are able to inject an artificial Block Limits VPD page in order to communicate host HBA limits to the guest. However, Max Reitz found a few issues with the implementation of this feature; this series should fix them all. Paolo Paolo Bonzini (4): scsi-generic: keep VPD page list sorted scsi-generic: avoid out-of-bounds access to VPD page list scsi-generic: avoid invalid access to struct when emulating block limits scsi-generic: do not do VPD emulation for sense other than ILLEGAL_REQUEST hw/scsi/Makefile.objs | 2 +- hw/scsi/emulation.c | 42 +++++++++++++++++ hw/scsi/scsi-disk.c | 92 ++++++++----------------------------- hw/scsi/scsi-generic.c | 51 +++++++++++++++----- include/hw/scsi/emulation.h | 16 +++++++ include/hw/scsi/scsi.h | 1 - 6 files changed, 119 insertions(+), 85 deletions(-) create mode 100644 hw/scsi/emulation.c create mode 100644 include/hw/scsi/emulation.h