Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp950880iog; Thu, 30 Jun 2022 13:37:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uRgKdgpMmFtgaKG2K4/9hhepDtewrnavLwVgCMDs6GKn6Ireec9nkDLs6EUCKvbr811Jrl X-Received: by 2002:a63:258:0:b0:40d:3156:6d61 with SMTP id 85-20020a630258000000b0040d31566d61mr9165260pgc.190.1656621441092; Thu, 30 Jun 2022 13:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656621441; cv=none; d=google.com; s=arc-20160816; b=LqUQfrNkBNmgrE5LqueLBlMygrHxqd9wvNrdoIoLOp/Bxnmxh0HjF/aVfK5a1KxN+T jpT5Rqx27LsAnNVvySnyynWNd3AIKn4hFU750x3f8ivphxbta/vJUkjzPmfE7ou0OqHe J26IQEELOjBm7OddljGhqHEQVzc7YjUk27Yv1X1kaqZ+OT54YF53s/UFrZCkguktbioQ VDUXk02CHcAuZQdJvJwPYbuCtucI2LIeJ+8+oZTPwJotABHQXsTAGl2gOKIPgWXoPrJa 5fpw/+73MAde0zYes6tkhzbv7BDseA4At7qEU398OQL42S6wuhu273v3Mpv582r5iIXL xfPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Y6xqv8hs+XRgwjFSDNBYvhusbDhaYngjQ59D9YVxo8g=; b=T9FSApED3Abu9ONYpVoZOj297UrtnFbD9lqdMt0Kg1L8ZVZMFB5vnhK+cKYzWCNe5E RiPjc7NV7sb54zF6uiMzm2VDIRMGDqiPLTtleyJkut7bPunTJvGfxH1+ClN7wm/sMMh2 6/CuH0Hp7U/MH5Xy6IAj9QySHbAA8okzfURp7N/XTmdN+0Fmydg2bFqKFzF651t3DWn+ X15B7TO+0FQb0la1MYjn/4LvQpJCuFGjN9OD+l5OHZD/eQlw8uV6J6xxjN4JkG0KXx1r kQS6jeU6k7+KJXLDGNRRigSgDCQLrTN5PXtNh0lMJ7o0q5spsaeWmt+RFoTvBHzaIFwJ h0FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bA2kSgjH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a170902eb8700b00156b46e2407si23392433plg.471.2022.06.30.13.37.08; Thu, 30 Jun 2022 13:37:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bA2kSgjH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236931AbiF3Twp (ORCPT + 99 others); Thu, 30 Jun 2022 15:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236930AbiF3Twk (ORCPT ); Thu, 30 Jun 2022 15:52:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 18B54443D3 for ; Thu, 30 Jun 2022 12:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656618759; h=from:from: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; bh=Y6xqv8hs+XRgwjFSDNBYvhusbDhaYngjQ59D9YVxo8g=; b=bA2kSgjHSPTsc5ub1XnKsushvrd6jkycReQ9+rKpI+Ge65Bv3ADrlNjfLm2hlBDihQ5f0d +pKQoGq47aO1ELdO01wVG/vU3FL2K7JUxkkUbWfM+8MDP78VI4zyc+1DFnA7QC0kq8VE+j pIzNODGzdjNTAiRfKjMoCoOmZLlvLWo= Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-596-NXJQJwhJMnOqFbtM61eodA-1; Thu, 30 Jun 2022 15:52:37 -0400 X-MC-Unique: NXJQJwhJMnOqFbtM61eodA-1 Received: by mail-il1-f197.google.com with SMTP id n16-20020a056e02141000b002dabb875f0aso43540ilo.10 for ; Thu, 30 Jun 2022 12:52:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=Y6xqv8hs+XRgwjFSDNBYvhusbDhaYngjQ59D9YVxo8g=; b=jZApNz0snq0YtYGSn7Vf1Q9aLRalgRZFm0GkZxortn3y50JB1tik/WLMxkmbLuQz2T ArjvZ2vT4TlacuCXyWEimKjiwDDRh1nEtw8T+eDVqKuaej912CRirwiIyyTLv/NqoCHw yLB2ry/x3MraSH9Q0xYta4s68YSQiJ003mKp7Irn0keWAdliPfFcLzS1ocfJwoChB8XS o45QvLXKGlmHe8Iht60it6EI+TfEO48XN6Tbf/wFRUrvV3chI0z9MusE8R844LxPuCwd SgM3WBdRhaZxLR5HjJfgKGSNnNQAMNZxIYEuDhpfChO+FKIMzrHER+77woWK2xZsL6JC N3kA== X-Gm-Message-State: AJIora/kbNXhg7i0pD1DzWcvziwUl/ctUtHExho8HSa+yRY6x5lyulZn FxCxgYyZvZD2K14JrJJvNYTumegZNd7WdTdGlbeuA0F2zzXCGvzabK6p5YnJv66+oVZNHAqamNG nIlphaXczVVKTSf4nkbzs8x+v X-Received: by 2002:a05:6e02:1a68:b0:2da:9b52:28c5 with SMTP id w8-20020a056e021a6800b002da9b5228c5mr5618981ilv.253.1656618756969; Thu, 30 Jun 2022 12:52:36 -0700 (PDT) X-Received: by 2002:a05:6e02:1a68:b0:2da:9b52:28c5 with SMTP id w8-20020a056e021a6800b002da9b5228c5mr5618968ilv.253.1656618756764; Thu, 30 Jun 2022 12:52:36 -0700 (PDT) Received: from redhat.com ([38.15.36.239]) by smtp.gmail.com with ESMTPSA id x42-20020a0294ad000000b00330c5581c03sm8880286jah.1.2022.06.30.12.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 12:52:36 -0700 (PDT) Date: Thu, 30 Jun 2022 13:51:40 -0600 From: Alex Williamson To: Schspa Shi Cc: cohuck@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] vfio: Clear the caps->buf to NULL after free Message-ID: <20220630135140.2dd079c9.alex.williamson@redhat.com> In-Reply-To: <20220629022948.55608-1-schspa@gmail.com> References: <20220629022948.55608-1-schspa@gmail.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 29 Jun 2022 10:29:48 +0800 Schspa Shi wrote: > On buffer resize failure, vfio_info_cap_add() will free the buffer, > report zero for the size, and return -ENOMEM. As additional > hardening, also clear the buffer pointer to prevent any chance of a > double free. > > Signed-off-by: Schspa Shi > Applied to vfio next branch for v5.20. Thanks, Alex