From nobody Wed Apr 16 07:43:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576837580; cv=none; d=zohomail.com; s=zohoarc; b=QSlDWxMiEAagjNixxa1wk2NusQGmoY07At3Mv+zdXvoAM7E0UK818ei6drpwez9m81Exv/V6FtKWpRiItiit4/HagcAwfN1R8bzvDPDQHF7TyA40+HvzPaD7NPsWK5udovOBSmON5JzlMM/fM56IFlsjWldU4BltK2n2uVl+C1Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576837580; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cbdbFL7gAJjs6YCJRctscwCdL9GqFqSyjm8ZrJd7Qqg=; b=jhIeClitFx1M2yjXqWiguSffwkGs+swOkyCAQKfCF4MVBCCAUU3jh9a4eKOE4sDyvCXUAmRpSY9/T2P+JODYIbPciEtxbE+qJ9d5V86WEU8202n2sBnTTqTEoyUDycQxV51Qjpc4pWzsXp125TUVJvZ2DM2/V3XY/R1XeEJGDYg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576837580804578.086292658629; Fri, 20 Dec 2019 02:26:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-182-3g5wCfRwPUWH0Yltz4uG2A-1; Fri, 20 Dec 2019 05:25:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CE68800053; Fri, 20 Dec 2019 10:25:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 742F363F66; Fri, 20 Dec 2019 10:25:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2AC80252D4; Fri, 20 Dec 2019 10:25:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBKAPe3C023598 for ; Fri, 20 Dec 2019 05:25:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6225560C87; Fri, 20 Dec 2019 10:25:40 +0000 (UTC) Received: from localhost (unknown [10.36.118.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 360BA60C18; Fri, 20 Dec 2019 10:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576837579; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cbdbFL7gAJjs6YCJRctscwCdL9GqFqSyjm8ZrJd7Qqg=; b=Oh1KaXJhUL3+uDJZ7itKLhiRpAH7xX7JOlgTN1PM45IBdu0ggHzyCryzmLXMnV2NcX5oH5 cNEGmr4fL2nzFdiEDQgeP4pcxekwHsSbqbjJW4vMZfZGhhypgrFpTQdhbI5HBIGCaI4nAF BgoG7OsT/suqQ5Z9PG7jPXf16PgX0EM= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Fri, 20 Dec 2019 10:25:20 +0000 Message-Id: <20191220102520.1637190-4-stefanha@redhat.com> In-Reply-To: <20191220102520.1637190-1-stefanha@redhat.com> References: <20191220102520.1637190-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Maydell , Xie Yongji , Eduardo Habkost , qemu-block@nongnu.org, libvir-list@redhat.com, Jason Wang , qemu-stable@nongnu.org, Max Reitz , Chai Wen , Stefan Hajnoczi , Li Hangjing Subject: [libvirt] [PULL 3/3] virtio-blk: fix out-of-bounds access to bitmap in notify_guest_bh X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 3g5wCfRwPUWH0Yltz4uG2A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Li Hangjing When the number of a virtio-blk device's virtqueues is larger than BITS_PER_LONG, the out-of-bounds access to bitmap[ ] will occur. Fixes: e21737ab15 ("virtio-blk: multiqueue batch notify") Cc: qemu-stable@nongnu.org Cc: Stefan Hajnoczi Signed-off-by: Li Hangjing Reviewed-by: Xie Yongji Reviewed-by: Chai Wen Message-id: 20191216023050.48620-1-lihangjing@baidu.com Message-Id: <20191216023050.48620-1-lihangjing@baidu.com> Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-bl= k.c index 119906a5fe..1b52e8159c 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -67,7 +67,7 @@ static void notify_guest_bh(void *opaque) memset(s->batch_notify_vqs, 0, sizeof(bitmap)); =20 for (j =3D 0; j < nvqs; j +=3D BITS_PER_LONG) { - unsigned long bits =3D bitmap[j]; + unsigned long bits =3D bitmap[j / BITS_PER_LONG]; =20 while (bits !=3D 0) { unsigned i =3D j + ctzl(bits); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list