From nobody Fri Nov 1 00:05:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1690184354; cv=none; d=zohomail.com; s=zohoarc; b=ZB1UjOllxO1ACsmIcoUFqU4x/cM+xySYit9gCtymf4LgS/Z4URNLTJdWFxkXOBuAgCGj3pBjuy7Gd23z2ll5YWJ86ZE2v5ptuRTxNsTg0m/zq7+Zkps64/3rsSRqhCmZHT3pw1+TUuOjihWoqGODnvvpY4hU7smDD7D7to5TmoA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690184354; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=qlztDq/CKb91JnaGmc1JrV/AEfrFJEe1DDcUZ8Ogc1M=; b=ZeKaJuzZOrTHHOMcuEfN1YbwkUEFZP7Ek5o5011YJik6HaSbgTeChAZgnXkM8zwoVt0zjEndrbphUOPq4dFqe53lRVnwiEOJxymPcyroju5dzU0kVJBqKU1eoenemUazqo8K9MQR8K6EIl8ANcVzlVGak+vqFUprSs2uEhzyXro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169018435441452.593253325779756; Mon, 24 Jul 2023 00:39:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNq9F-0002mo-3R; Mon, 24 Jul 2023 03:38:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNq96-0002mQ-BS for qemu-devel@nongnu.org; Mon, 24 Jul 2023 03:38:20 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNq8o-0008Di-Bq for qemu-devel@nongnu.org; Mon, 24 Jul 2023 03:38:18 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b8b4749013so32493835ad.2 for ; Mon, 24 Jul 2023 00:35:58 -0700 (PDT) Received: from localhost.localdomain.gitgo.cc ([47.75.78.161]) by smtp.gmail.com with ESMTPSA id z15-20020a1709028f8f00b001b8943b37a5sm8129643plo.24.2023.07.24.00.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 00:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20221208.gappssmtp.com; s=20221208; t=1690184157; x=1690788957; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qlztDq/CKb91JnaGmc1JrV/AEfrFJEe1DDcUZ8Ogc1M=; b=dOGvWkuaBb5NW2SWh+TAqdaGAHSEf9OOiveAeeCRAfQ+LC1vG/+hmZXWvWjdEOCWn+ jIkbWQxRtGk0HNBLr69odsSm7Mx5IdDhQChkQ/3AJDQ5bWSL0Z0ud0Q03zhMsOlRXJeN 9Tg7JXCrDX2M2SMf5W6A5Mmws/JOBHBSt6hGfGSkOmzDNNLSUAp+hjoHvuVPeWzwNZ/M z7mJx6VB20oOnEWowWQ+DsCSy6tXYwy5ZMf7G5cpGv4YcOUeOJZn7xKHCh2pCjv89PWi TEGGK5l8h69jy2ISJqKd4wAkinYjUL8nIxmJcEDEqZijFEc7Ahm2qtjc9hyydKbDJSGA 8DnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690184157; x=1690788957; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qlztDq/CKb91JnaGmc1JrV/AEfrFJEe1DDcUZ8Ogc1M=; b=I4BROq0zikyHzKb31ibB/VKrrL9fWx9iUAFunUqEKKwCDq/s0oK2wXrbayUBuak+2h LX95+07++Z/+cf3TsMqt2H9qib4UiDs47itWGe3QIbHcdTVezxGcZL3RQM7eCfaGNzXR SMgj0ArkTeuAs1pqOIbjSLt5kRUQhOdKbMxtfd+bVhe1WzlMdqhUiQTp+eqXxzL/RklX BYEZk0NNBvPyOznYXUTY2CTcXO8UohWVlWYD12/iOpMjVlRJQ2KLWE6kGiM4fwN9TSpO BEZITAVH33yiYfwjwPfT/kqN4x0zLXDdBni+2w5Vg6aF20KJJW3/pLu4jIcFxWM5ktcD iF9Q== X-Gm-Message-State: ABy/qLanX9KFzlJdRqyXLaLxrGhdMWmQ9ej+3JHcKup/udZhV1pEUANb v0+29tFIo8gmkDqrzeDhVlkR0w== X-Google-Smtp-Source: APBJJlHMlc+c0L0Fnu9EBNEKhKEDVvkBbBt3jx1m7KP9yMakwqHo43yK/6x6MZeTr+T6Df+qltlfWQ== X-Received: by 2002:a17:902:da90:b0:1bb:9c73:1a3d with SMTP id j16-20020a170902da9000b001bb9c731a3dmr3724051plx.21.1690184156352; Mon, 24 Jul 2023 00:35:56 -0700 (PDT) From: Li Feng To: "Michael S. Tsirkin" , qemu-devel@nongnu.org (open list:All patches CC here) Cc: lifeng1519@gmail.com, Li Feng Subject: [PATCH] vhost: fix the fd leak Date: Mon, 24 Jul 2023 15:35:01 +0800 Message-ID: <20230724073503.2808832-1-fengli@smartx.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::62b; envelope-from=fengli@smartx.com; helo=mail-pl1-x62b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @smartx-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1690184356364100003 Content-Type: text/plain; charset="utf-8" When the vhost-user reconnect to the backend, the notifer should be cleanup. Otherwise, the fd resource will be exhausted. Fixes: f9a09ca3ea ("vhost: add support for configure interrupt") Signed-off-by: Li Feng --- hw/virtio/vhost.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index abf0d03c8d..e2f6ffb446 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -2044,6 +2044,8 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODev= ice *vdev, bool vrings) event_notifier_test_and_clear( &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier); event_notifier_test_and_clear(&vdev->config_notifier); + event_notifier_cleanup( + &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier); =20 trace_vhost_dev_stop(hdev, vdev->name, vrings); =20 --=20 2.41.0