Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3590747ybc; Thu, 21 Nov 2019 10:32:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzEJWWc0fta9iGa9DS/lX1tE8wla/2TgtZUqP/hFjs7IbuZiMhAtPTR1SdrLRcFvR96ASN5 X-Received: by 2002:ac2:528e:: with SMTP id q14mr8137721lfm.151.1574361164014; Thu, 21 Nov 2019 10:32:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574361163; cv=none; d=google.com; s=arc-20160816; b=WN6aOE5IVXgU9KRtelGUxfGy1WaGv9130y2q5NrG8v9Dd4VK2lsK20Gdt3bVXlE9d6 5butnFbUQOpMGjguAhF85ogLfSVtMJ/aa042wteXC0C66ARWVZpAopaEOx9kisMelhv9 Dg8xt8K75NKBxKvl08a3dwaeAT3IfjhlJiYmh+y3VNwReAY1/J5Ot45u8KO9hgjaNvSA nudypoh9LJIva2z2NBDx9OYJJecoBXWj1OUDKTt9P9gkbubyFLqvIhujm6SOmY6++f1/ vnavuGglMuIvmKQQm5ntfNZiheU+QtMpNOX4cI2HK9ZJ8UkULjn0NGeQaKkBUOEA54EM QIyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=KIV6C8dEDRsWYAQ2tTt3LiUnyRDtIsvpcdrWmt9koPk=; b=P3VD5N47ij+QjiHYjHgHPAjfijdjZXgi+vqRLlDyAFu1O9xepwUlHwl6n8rynXx65r mHHKJj64yNwVOFIjKoBxk5Eyuxi71Eag3HYI3z18fCLPC6IzZK3o+iyVZA2WsPcCYpEm W3LZ3hp19Oh090exvPts2mSlZpPXjpPyNeQPHYXjL6Pl/xKkXM49P22YJLDO+0lQ3DDq ffOab/QLjVT5VjaR0un8ftImBDRnANTKrzEe/GtqX+BY1yJaQVEi8+hBM0bDRaoDH638 +d/a0xIrNkkrWnNBAaBfFoPlqU2kMeVCw6SmLwgiEKJm5TLq+gSA/+LbOg+yu7d8bCBt pWGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=GKNVzz82; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12si2408500eja.47.2019.11.21.10.32.19; Thu, 21 Nov 2019 10:32:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=GKNVzz82; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726939AbfKUSaX (ORCPT + 99 others); Thu, 21 Nov 2019 13:30:23 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:42026 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfKUSaW (ORCPT ); Thu, 21 Nov 2019 13:30:22 -0500 Received: by mail-qk1-f193.google.com with SMTP id i3so3926451qkk.9 for ; Thu, 21 Nov 2019 10:30:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KIV6C8dEDRsWYAQ2tTt3LiUnyRDtIsvpcdrWmt9koPk=; b=GKNVzz82IHSesvkhRwLOrdR1guhy1ks2Zlv5Ig9t4AOGgFyjYCJJLijnX+MsFowaXV RsyaqXjmaAhEKGmtYxEH+iPKkLHXHFpTuRz1wKvwFc70VrQxaOGVXyBOhjWMJ0JMhJfB 8v+EDESV8ao55NbiACdWSRh4IaD2WVhHfWfoBmYoqyjjdN56d6gqKA7Cu41Pm+WwmeDB tyO7+rhHbotOPjRQIwIj/EKC9fMRPXOZ6XbEU38Q4t5aqxY1CA+7/LlSoWUbFjfiiLLT reR0lZBlCbK1tCyqtsYZVzBMydx8fC7iTyCWACTRNYORaRYTgseS+RgEGgiaHgUtbuc8 240g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KIV6C8dEDRsWYAQ2tTt3LiUnyRDtIsvpcdrWmt9koPk=; b=mhCiNX8pqzyYwxANgSvURFfAHGW5P8SB82HumrmN8/UxYCO9pe8NDfb5+yzCMYc6a7 c0HiWmjLHBzUANWTgYrLtt5bbdjtzVT14E15L3TEUMBCXI2n8dsOikBRwJi783LIajUd t+wQ1Yi0fvRIKd//XKpYdGc9HIyLW4pIMgyr1ltdjTZQ4Jj+LrYm2gJA80hpYWyLxHq8 isrOHwmU/kZQgemkshIYl8sDvR0k/uS9WH05j0Yn6MkZ5sQuQs9iEKmLsFiIsejqH0xV LFQIjNC0ZGf0P0HWhnGvbTgw/w7ItMvomcj67aOxTeUXwVxK2ApFjqb52kZy3yDD3Y6k CZTw== X-Gm-Message-State: APjAAAUn2FlrVo7kLSmjuvLbGvw77lQyp88+NUcJQ2S5XLKnzlWUeedw e9zvd+0meOX/vwvkRnOBGUkMWg== X-Received: by 2002:a37:78f:: with SMTP id 137mr8854398qkh.321.1574361020373; Thu, 21 Nov 2019 10:30:20 -0800 (PST) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id g17sm2036642qte.89.2019.11.21.10.30.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Nov 2019 10:30:19 -0800 (PST) Date: Thu, 21 Nov 2019 13:30:17 -0500 From: Josef Bacik To: Navid Emamdoost Cc: emamd001@umn.edu, smccaman@umn.edu, kjlu@umn.edu, Josef Bacik , Jens Axboe , linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nbd: prevent memory leak Message-ID: <20191121183017.h3qkpib5re27ty3b@MacBook-Pro-91.local> References: <20190923200959.29643-1-navid.emamdoost@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190923200959.29643-1-navid.emamdoost@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 23, 2019 at 03:09:58PM -0500, Navid Emamdoost wrote: > In nbd_add_socket when krealloc succeeds, if nsock's allocation fail the > reallocted memory is leak. The correct behaviour should be assigning the > reallocted memory to config->socks right after success. > > Signed-off-by: Navid Emamdoost > --- Reviewed-by: Josef Bacik Thanks, Josef