From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF5BAC433ED for ; Mon, 19 Apr 2021 13:34:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5917B610CC for ; Mon, 19 Apr 2021 13:34:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5917B610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYU2Y-0004XN-CU for qemu-devel@archiver.kernel.org; Mon, 19 Apr 2021 09:34:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYU1O-0003yz-59 for qemu-devel@nongnu.org; Mon, 19 Apr 2021 09:33:04 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:34603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYU1M-0006rV-0f for qemu-devel@nongnu.org; Mon, 19 Apr 2021 09:33:01 -0400 Received: by mail-ed1-x531.google.com with SMTP id i3so15033603edt.1 for ; Mon, 19 Apr 2021 06:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=P+o04o6g5Rd/J13Yr5Uu55otUu/W1uQsnOynmTwxsOk=; b=U/ikKvlOJWTWwuR67yYXm8Aqz/WjOIbN6RjcMwCJs1MhFsyYQXaKYAoP6VuvQDWxjG m4BRc9pM9R4p44Om5N9sS0ytgUWu7GojFUBbuqCyqMPer/QxjVbzMindfCdOtnapKNCO KK5Mz+54pcgklFzFdMKM54pRzL7FCevOnkH0TseLBkNgfPA6+fGBKC74T23AzAPaELEr hGafmia4DSGz7dkM5smImV1JAXv/cRCu34HRASW+P5QfWksSehuPGWGwajTrL9kMVR1v lwRVe9iiik2yEYwI2gSPn07DW3M3GHKFPGz6pcbDtXflibvWps9agbCYF1akxoJpLzpO QkUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=P+o04o6g5Rd/J13Yr5Uu55otUu/W1uQsnOynmTwxsOk=; b=HthQ+8GwkPCaC00FiXDQQTmYWVRjn+94Ii87UeFvsmg6EaXb5Z1pZIe8I8cTVOLDno cWNrdRB055tmBcn6wBQ37/G3UArCJ0hLkm0qiilr3/eeEax7H7PPQ85UWMNmYSGtXeW3 8jHX56V1t7OaLsse60DEO0unC3Nn/dqK+x6pXAmoiT4vcYgG8LcFX9SvjzWLwzKtMNLj ALX/H1O0oTnvmqk1obaiNMIbhdu1xxWZCO2WO28vK8A9doN0jdhWLyuzib5TQ/xy0QAs ZrpiWEWWdkM/r1oCvdDxxj6SJ0MBzQwAJkvjZ3l5YhfG9TDWYk7V0yh62NlP9BfLR0VB flOQ== X-Gm-Message-State: AOAM530ZjH9uL9lyS+IW/h2ky6N0rOEN5Odbjp52qaSNnGlwXIbM8+cR PuGm/YiycEpEaotPgnvj8Z/1P5WAexAoFK4JK6vOOg== X-Google-Smtp-Source: ABdhPJwmGD6DINd1u6Tuiug9yL2kJtX8SdKHuH23VdlvFF9uOHAt5gyYnC35sKbz5E4LOkDxHEyM6FBHJ/eUtdevfQc= X-Received: by 2002:a05:6402:4244:: with SMTP id g4mr25625500edb.204.1618839177470; Mon, 19 Apr 2021 06:32:57 -0700 (PDT) MIME-Version: 1.0 References: <20210418053039.811996-1-philmd@redhat.com> In-Reply-To: <20210418053039.811996-1-philmd@redhat.com> From: Peter Maydell Date: Mon, 19 Apr 2021 14:32:06 +0100 Message-ID: Subject: Re: [PATCH-for-6.0? v2] mptsas: Remove unused MPTSASState 'pending' field (CVE-2021-3392) To: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=peter.maydell@linaro.org; helo=mail-ed1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Mauro Matteo Cascella , Prasad J Pandit , Michael Tokarev , Don Slutz , Li Qiang , QEMU Developers , qemu-stable , Paolo Bonzini , Cheolwoo Myung Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Sun, 18 Apr 2021 at 06:30, Philippe Mathieu-Daud=C3=A9 wrote: > > From: Michael Tokarev > > While processing SCSI i/o requests in mptsas_process_scsi_io_request(), > the Megaraid emulator appends new MPTSASRequest object 'req' to > the 's->pending' queue. In case of an error, this same object gets > dequeued in mptsas_free_request() only if SCSIRequest object > 'req->sreq' is initialised. This may lead to a use-after-free issue. > > Since s->pending is actually not used, simply remove it from > MPTSASState. > > Cc: qemu-stable@nongnu.org > Signed-off-by: Michael Tokarev > Reviewed-by: Philippe Mathieu-Daud=C3=A9 > Message-Id: <20210416102243.1293871-1-mjt@msgid.tls.msk.ru> > Reported-by: Cheolwoo Myung > BugLink: https://bugs.launchpad.net/qemu/+bug/1914236 (CVE-2021-3392) > Fixes: e351b826112 ("hw: Add support for LSI SAS1068 (mptsas) device") > [PMD: Reworded description, added more tags] > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- > Supersedes: <20210416102243.1293871-1-mjt@msgid.tls.msk.ru> > > MJT patch: > https://www.mail-archive.com/qemu-devel@nongnu.org/msg799236.html > > Since rc4 is soon, I'm directly respining his patch with my comments > addressed. > > This is not a new regression (present since QEMU v2.6.0) but is a > CVE... > > PJP first patch: > https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg02660.html > --- > hw/scsi/mptsas.h | 1 - > hw/scsi/mptsas.c | 4 ---- > 2 files changed, 5 deletions(-) This fails to compile: ../../hw/scsi/mptsas.c: In function =E2=80=98mptsas_free_request=E2=80=99: ../../hw/scsi/mptsas.c:254:18: error: unused variable =E2=80=98s=E2=80=99 [-Werror=3Dunused-variable] MPTSASState *s =3D req->dev; ^ cc1: all warnings being treated as errors thanks -- PMM