Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp897023ybt; Wed, 8 Jul 2020 14:43:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRfGuNP2kaIdCJHNksOHLLsH1dqDdjFO/r8dhC7XD6V7C6RR8Hwun2Vmh1Sjow0lo5aEEz X-Received: by 2002:aa7:ce84:: with SMTP id y4mr68123351edv.113.1594244623640; Wed, 08 Jul 2020 14:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594244623; cv=none; d=google.com; s=arc-20160816; b=Ggn27F2qnH1WpzhgWuN7QODcQXW2CBcTpCK0rXBwcsnzrqpMj+nwLvna4Et+1GPK8p KLruE26qY7CPbXNVX5Ki+pytp6aXYWTEkIsPSVIsBzTqie6SYQRy8ytRcrARjYezmnJL 5wlqMM/SsqFte4lHAOORSwGmvW9q5KmyUbAjBYZ07P1WfO6re4R6dSKigfk+R21ghAUm DEz3EVZxpC6vzy5+0ANag/wJEki4Ou3kHoInoPREM8LYfIS8hZyU0qeHUW1H1sHM+zZv CbL6pc4J/QIXJYN07iqJJG5pH8BPcE7yd0LLMjb9gT67aK24t9IUNrQvQArkVNKIlc9H 5iHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=LDdlqqViKy4NCWMYpbRbkVG8WrQZL6OuDPANlMIK/JI=; b=s63tI03FODSFe8cUYDONRujLX0JO9jyTvDR/0soWLe6srkzsl4IBoYWRyMmbpfsodG ObaShgec4jYzomV5TQoYECZJrIqpG4F39B/8I0n2LW/5uLBT6DRcwVOHQC8xi4dN2R4p +sYgwyeqWwIKGq/raX+kLeEF7JiCEXfpFg9JtfObuIwc7nFx6wQoF18zln/QoCx2iCc9 qaTZ9tqigxDSX3/TYfL1lcDGA9wTf4KOxfgMGZrERgqjXNhU4+Y0Zhe2z+Ruq/I94z0J 7DIG9dYbGT18LT62L/VrdfgOQ193OAmmixOwy32SZpJF8WVl5Ffp37bcEU8TZUiG63JK C9Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=18LQyLoT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc26si685351edb.329.2020.07.08.14.43.17; Wed, 08 Jul 2020 14:43:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=18LQyLoT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726006AbgGHVmj (ORCPT + 99 others); Wed, 8 Jul 2020 17:42:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbgGHVmi (ORCPT ); Wed, 8 Jul 2020 17:42:38 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57B18C08C5C1 for ; Wed, 8 Jul 2020 14:42:38 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id k5so138602pjg.3 for ; Wed, 08 Jul 2020 14:42:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=LDdlqqViKy4NCWMYpbRbkVG8WrQZL6OuDPANlMIK/JI=; b=18LQyLoTvbAC6GnFTcC6drJgLAXGofZzdiN1mbx2ijUEH3DQWigQ64u0JpQJPOMEBT eumfGnUTryqlWU5Uwm0nweGFiTB3BrRTxALHN20vcmzaI4EY0vDbBCcjo8hdHL6julph dDF7O+Tzxqr26YIv/q2nDWRhjYjvH6SN7Bzx0AI+UOhpczQBbIAbkZ5SXsnjpzuB8w0i eAKAWXeSKeBTbAKQoUg1PgKDRXHg3hIRsA6UR/+DBidPV1mk31BeQWnA8yV9a4K09r8X 1gUJlzZtKgfrg/eZeo0+STc9uJX7ku1z/pVfQCGTZ+NVAbhqHiTwIRTJeQ8dNa5oATQ/ xpgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LDdlqqViKy4NCWMYpbRbkVG8WrQZL6OuDPANlMIK/JI=; b=oj6v7eTXU5S8nv4EO6GBZ/zWC1lK1TulJHxixAccyZjIYwkySbEeI8+oSpsFduWeEs 41M6LxQfLcIganemDBLgdbqu6omZx7jfrQe9T8lXabFY15AKbBgexDGV3I6fFqaUJW2G wajkIxAZlzQYT2hpgj18c9M1Nn9LTYdJR/Antf5D1/8H7CZIjOV9UJa6TcP/Xpb1jUB5 Xl3v8HcbbAjA3bvfMnlwJL/DE3eo/6IUZvfjuCFFv8vgSfv/KDROJ1wJxLjgx+anFNmE 9/3yQfbDQJeK0m4XehHc1DxYHeXbDXJK6W4qjMg91DwoyG5dADw5quccV+kN/vXhWb3S Xs2Q== X-Gm-Message-State: AOAM531DOwJfvwG8591Hcdhgri6jXCNgjH8sxUBxz0V4+ROw9iZpz+b/ vk3aiySlUne8sczWuP3Cle6nVg== X-Received: by 2002:a17:90a:1089:: with SMTP id c9mr11731466pja.180.1594244557753; Wed, 08 Jul 2020 14:42:37 -0700 (PDT) Received: from [192.168.1.182] ([66.219.217.173]) by smtp.gmail.com with ESMTPSA id 207sm663258pfa.100.2020.07.08.14.42.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jul 2020 14:42:37 -0700 (PDT) Subject: Re: [PATCH v4] nbd: Fix memory leak in nbd_add_socket To: Zheng Bin , mchristi@redhat.com, ebiggers@kernel.org, josef@toxicpanda.com, navid.emamdoost@gmail.com, linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org Cc: yi.zhang@huawei.com References: <20200629012349.26641-1-zhengbin13@huawei.com> From: Jens Axboe Message-ID: <5a7597c2-2d51-8382-5b60-73cd39e55fda@kernel.dk> Date: Wed, 8 Jul 2020 15:42:35 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200629012349.26641-1-zhengbin13@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/28/20 7:23 PM, Zheng Bin wrote: > When adding first socket to nbd, if nsock's allocation failed, the data > structure member "config->socks" was reallocated, but the data structure > member "config->num_connections" was not updated. A memory leak will occur > then because the function "nbd_config_put" will free "config->socks" only > when "config->num_connections" is not zero. Applied, thanks. -- Jens Axboe