Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6117123rwb; Sun, 11 Dec 2022 19:27:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf6zReaZbghDOBkz3aucgj/NNGUuviicGX7zn4DPlyNEAq2tD27CvXIy/a6YrYMdjhYzX9Sp X-Received: by 2002:a62:e806:0:b0:578:83e2:f1bd with SMTP id c6-20020a62e806000000b0057883e2f1bdmr1113617pfi.29.1670815674583; Sun, 11 Dec 2022 19:27:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670815674; cv=none; d=google.com; s=arc-20160816; b=zcXDXarbWsCBA61y5wQwo7Hojf/lq2NliOBdT8HRfcrKGBYr1fAqvuhRrygS5vppMy ausNhoEBgrkQAUO8bKICJhZIKasEg1Vv3J1Ia9tl0jaCqF1pdV76nzGn5yvElu4ZrH5/ qtyhacpgT8l/77dxPiDVQdBGgKs6IydJ3TczpDYkjfS8E/aT+/rEiPy92QqDsPxpXgoJ D3VHo/zssnpWfz+y/kMDXDbjaQXbTebJ3JLaHb0ft3Ig0oxgweAP+WzkvlccI1++LCW5 yDsuxNRvW4h0O3Q+SI4uB8NW0g1hCFjeyyY7IMcAIp/vRsbzjCqinrap/0qrEFgKkbaO qWvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=jJif3iHYVhWXXHlPb2fzA6xD814HVS4BXtlDfCnFVXQ=; b=miHcIMciYwsdk4ZS0RFRXmk+YP4LOe7JMCnnFPr7qd3DGNEKQnaCREbmP40cQN/ONY XS7LpbDf4JNkgOBg7IX+mNKvCDNbsShN2OXRZKV70JywF0ahdpmlvZusyfZeuCuDqLUs 3cyefEKwckSwXOCPECbuqYEYnR3tGlu1cZ++Yw2/ILUBXqbe5k5AebYOsmjQGPzezFJ+ ZzkM7df1HCYSZHBEHKcjmMUzxsgHU0GHtczS1dBNFQ9sHFnAhCiY/vQbG+2NzAvrt77R mw0vU6WJrAUsMw1axnaoTVyArNFrSWZC59CrT4y4/ogVAVDVPKtj7dwBmaE4GadmCBPr HPng== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h129-20020a636c87000000b00478794d20e5si7997323pgc.407.2022.12.11.19.27.44; Sun, 11 Dec 2022 19:27:54 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231144AbiLLDIV (ORCPT + 75 others); Sun, 11 Dec 2022 22:08:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbiLLDIT (ORCPT ); Sun, 11 Dec 2022 22:08:19 -0500 Received: from hmat.qianxin.com (hmat.qianxin.com [220.181.41.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9BB66376; Sun, 11 Dec 2022 19:08:13 -0800 (PST) Received: from hmat.qianxin.com (srv-mail05.esg.360es.cn [172.24.6.25]) by hmat.qianxin.com (SkyGuard) with ESMTPS id 4NVmlt6RSDz2LZWK; Mon, 12 Dec 2022 11:08:10 +0800 (CST) Received: from qax-bjmail03.ESG.360ES.CN (10.44.121.89) by SRV-MAIL02.ESG.360ES.CN (172.24.6.22) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Mon, 12 Dec 2022 11:07:41 +0800 Received: from qax-bjmail06.ESG.360ES.CN (2402:d040:0:8425:2849:52e7:3abe:7096) by qax-bjmail03.ESG.360ES.CN (2402:d040:0:8425:dab:9a82:67c8:970d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 12 Dec 2022 11:07:41 +0800 Received: from qax-bjmail06.ESG.360ES.CN ([fe80::2849:52e7:3abe:7096]) by qax-bjmail06.ESG.360ES.CN ([fe80::2849:52e7:3abe:7096%5]) with mapi id 15.01.2308.020; Mon, 12 Dec 2022 11:07:41 +0800 From: =?utf-8?B?5p+z6I+B5bOw?= To: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" CC: "syzkaller@googlegroups.com" Subject: Found a memory leak in kvm module Thread-Topic: Found a memory leak in kvm module Thread-Index: AdkN1svXVRrWKvJvSge7YI3WbO6bxg== Date: Mon, 12 Dec 2022 03:07:41 +0000 Message-ID: <7144ff750e554ad28aaa59e98c36d4fc@qianxin.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.110.38.193] Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 SGVsbG8sSSBoYXZlIGZvdW5kIGEgbWVtb3J5IGxlYWsgYnVnIGluIGt2bSBtb2R1bGUgYnkgc3l6 a2FsbGVyLkl0IHdhcyBmb3VuZCBpbiBsaW51eC01LjQgYnV0IGl0IGFsc28gY291bGQgYmUgcmVw cm9kdWNlZCBpbiB0aGUgbGF0ZXN0IGxp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