Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3546649pxj; Mon, 24 May 2021 09:06:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqQcTKvAMye5dPHdVWu7J+dxTxqDnS+cKs6DR/06iZOC5Mh3rPtEA6Ybt3pAuLeBPF0Y7/ X-Received: by 2002:a5d:94d6:: with SMTP id y22mr6389799ior.62.1621872367854; Mon, 24 May 2021 09:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872367; cv=none; d=google.com; s=arc-20160816; b=LQdx4kpAFbV8Rcyt0fTN2yyYUia5MUw5i9Qh9a1LG1WhqIzFKAHA3Tgjz39dyxSE0f 1untttEBE5Xmyh6oiPmypbKbSy9qK0NDfm6dQe+5ILn0utDdAbJNO472BRUmcg180vJY PXS01dnmKBevwkfxBuukqejbHBXNgqMil+6PiB8CUrAVD+ASo7drOEKumL3dp4dFB2a9 T9zcpIfT0nf+c/JLGSD7zKoSlKI99h6G2UkEQX55P1DPy/j8PPwy2ewYC1V1S1GsvCBi yYdzeBDJ3V7b7rO/UXCWy2Bpqu1Q2EUUP5UuMswoaY9OnKsftZF+J8P0iFPVkbDp03qj r3xQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3GeJFNb8Mo+C3Yy4SvHHatdhftJfuvu5QED2LoiHBjI=; b=iWofBEq2BPPM+mnI+Iw+ujLZcStN0E2URR1Hv9bXNEGomjBsqgzGpojLOwjI22CDAK fuMzimV99LC7D6LjooNQnaUBqcBSIeh4m/jteQA+zVJACORABAavEf0FOsCjCjqNLYcj fgjTjbnA+khm+gQNxBq/1ahIT2hL+k5IQfEDZiGgI7bmkWJ7FKsQI9suMo0wVuykF7Lx Ef9wkdS6XSvbZcZzuEdv59aYL/C3VvscMPG3LDQi4tYTrzVX3zPAIbsv0gbgfnVbqYtY Vado++xbxxdIDoHfACeGyVDKYVPOqQRkeYPkjtKGKHlIO5EGPBcoeoMG0ZQcVSm7Bf/Q fSIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="O/onWhWz"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si15523872jap.46.2021.05.24.09.05.43; Mon, 24 May 2021 09:06:07 -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=@linuxfoundation.org header.s=korg header.b="O/onWhWz"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233540AbhEXQF5 (ORCPT + 99 others); Mon, 24 May 2021 12:05:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:42834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234798AbhEXP71 (ORCPT ); Mon, 24 May 2021 11:59:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 70B526145F; Mon, 24 May 2021 15:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871113; bh=7KfIVN9pHpu0B/eBNxr7NuZtnIQ0ibfV+1Q4rIUF92A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/onWhWzYYny1gdvncIBjS3NKGcrHMNG6MXELyFADCyT9vwOE/siF9qTpJE8YEiAt eFxCqRJclgiXEjPhPAsAAVm/Uh2/H77dBx1h3SRl9kRI36tidNGQwg4jmnPf6NDyQr HZgv7pwvhpQwLd025jrkTOI7FxTlRQ8oHt1TCcro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET Subject: [PATCH 5.12 062/127] uio_hv_generic: Fix another memory leak in error handling paths Date: Mon, 24 May 2021 17:26:19 +0200 Message-Id: <20210524152336.928538044@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET commit 0b0226be3a52dadd965644bc52a807961c2c26df upstream. Memory allocated by 'vmbus_alloc_ring()' at the beginning of the probe function is never freed in the error handling path. Add the missing 'vmbus_free_ring()' call. Note that it is already freed in the .remove function. Fixes: cdfa835c6e5e ("uio_hv_generic: defer opening vmbus until first use") Cc: stable Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/0d86027b8eeed8e6360bc3d52bcdb328ff9bdca1.1620544055.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman --- drivers/uio/uio_hv_generic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -291,7 +291,7 @@ hv_uio_probe(struct hv_device *dev, pdata->recv_buf = vzalloc(RECV_BUFFER_SIZE); if (pdata->recv_buf == NULL) { ret = -ENOMEM; - goto fail_close; + goto fail_free_ring; } ret = vmbus_establish_gpadl(channel, pdata->recv_buf, @@ -351,6 +351,8 @@ hv_uio_probe(struct hv_device *dev, fail_close: hv_uio_cleanup(dev, pdata); +fail_free_ring: + vmbus_free_ring(dev->channel); return ret; }