Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1322281yba; Tue, 2 Apr 2019 06:51:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIPhrti9MSazLDg47CNERY/ng1O1lV7ZK0L+fYcGqmTxpvzaoYWpO1ZM/E+8MM3KjnzSGg X-Received: by 2002:a62:524e:: with SMTP id g75mr48906418pfb.106.1554213094819; Tue, 02 Apr 2019 06:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554213094; cv=none; d=google.com; s=arc-20160816; b=Z6i/vdCA6rEc7Q8PNwCwpcCryfH8PqmldXKTOuv6U7KM5+f5rt3RJAbSJ8NZS1vq3F g7vPQXKzlI95WNBKwnPgZQwRemKbOoYKExbnIS8RVkT+6PybkBvE080HrIt1CBpmqmLx NY7Mk0Lr/AAScrxOmc6mKZI2Ij00gct6roxkckbYRc3LR5u2Y0JhCll3A8t4zQIvOss6 g8Un4gOkS4E51mrP/ADBJEnQ5xdlQQKrXQ8fLDkZvc8YqfNGUMTZn9FB6RvA/jZrh6Nk 4gvhoKHW/TnIYP/k/8E80IAWiDC9D8URA/9wC6hSibIj2zs1YYeSB9jmwluucL+/a5XB CBaQ== 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:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=WUE7pBnvZsxoHZXa375gqh5YMMSZ4/ZXpZX99B7ibdI=; b=KB9cFUrQwlFa6SAeQUihdi2m9OZ+Tph3ovjNKJPWzeqzwiTZMfV9FgrKZD0X2aQgKi gx49GrvnU4eS0IdMB7FXid7nD3bRzLZU8utatBtCAv/8ZGDf+10CPP5b6CfPxadmnb9m uxposbESfwlQOL0BNtYm4s/odRzLegAINNzvIsObYvR0IYF1g4HZvTIN91jRJGEYxVEk UkJ+O6bGO1b1QYNOiH1BAq5od+8gX/ihsqtl1bXAt8cwKJLBy41b+bsMWet/pww71avb tfB722hs8f8pF/SHYjb1fR52Fwfdam9HUOqvKFsIbjckQL/0/9jWM5UyL06qtoQJGmKj p+zA== ARC-Authentication-Results: i=1; mx.google.com; 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 w8si11077199ply.303.2019.04.02.06.51.19; Tue, 02 Apr 2019 06:51:34 -0700 (PDT) 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; 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 S1731949AbfDBNtu (ORCPT + 99 others); Tue, 2 Apr 2019 09:49:50 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:42800 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730966AbfDBNkB (ORCPT ); Tue, 2 Apr 2019 09:40:01 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJdu-0002mT-3F; Tue, 02 Apr 2019 14:39:58 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdt-0004qf-7s; Tue, 02 Apr 2019 14:39:57 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "David Teigland" , "Vasily Averin" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 05/99] dlm: fixed memory leaks after failed ls_remove_names allocation In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Vasily Averin commit b982896cdb6e6a6b89d86dfb39df489d9df51e14 upstream. If allocation fails on last elements of array need to free already allocated elements. v2: just move existing out_rsbtbl label to right place Fixes 789924ba635f ("dlm: fix race between remove and lookup") Signed-off-by: Vasily Averin Signed-off-by: David Teigland Signed-off-by: Ben Hutchings --- fs/dlm/lockspace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c @@ -673,11 +673,11 @@ static int new_lockspace(const char *nam kfree(ls->ls_recover_buf); out_lkbidr: idr_destroy(&ls->ls_lkbidr); + out_rsbtbl: for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) { if (ls->ls_remove_names[i]) kfree(ls->ls_remove_names[i]); } - out_rsbtbl: vfree(ls->ls_rsbtbl); out_lsfree: if (do_unreg)