Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2052366ybl; Sun, 18 Aug 2019 17:19:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9C6AXVnmVnCKOsMd+TbBpdsBjNaitYwJWSUcHWKKA82UW4VmkMqZcFVFCknh9hoKTvPzr X-Received: by 2002:a65:6259:: with SMTP id q25mr17835233pgv.145.1566173990862; Sun, 18 Aug 2019 17:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566173990; cv=none; d=google.com; s=arc-20160816; b=bODtovcfqlKdddxICr+R7wqmViLUgQCpbEHmQKA5A10EpHW+kQuo4NyGTcB4ugqRl8 CX1a0AarNvAeUzkdNiEid0qvFSkazqnW7KCFFmOQD1waXhDRn3DtY1vJF8Yjm9nzMfLq M/PZwjPmNwtvFCDY7kys0emFy12E2wqgxW0KVPY/dcfACiGmyxYsSUojPFFO1pzTc9YW N4qfXpbnpFIfKW4KPcCvkthFrw0vfqGDpCxr4H2PYrW+c1y9bdGasIcWzFwnYjay6KHv AYPypw/4eNyYwLT5q+hOKeXnMeBpc4bWimlp9y3/oD4mDuwOOKoLGiIl6q+vNqD56dkT TSSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=7J6zazvwWXJHLLGTA9d2Z5bIVQ61P1OZdxnYyH/AmRU=; b=bB7Ay4IIzjGACSI2nfbTbdW6BBcy2iNwjXbX6baQESRpXaszqbdqvrUAE4R6f5mkML chS1ekqxwStqXOS6cONUWHySdhMlYUAM2THJbxw8uqEDx3ctNbC9vAqf30DrRBzgBTUh VqlwgrbIJ5l+4lNZPc8MphLyNv/cPqYWYTFDgFuRP6dKJpTqA0NX+QiXhNsD4p0LLe7H 9Whakpj0X3n3BhKTxOjCIBUFKn1f01gdSPvofclf3OUrYJ3BgdO4vqsowCBACLtS1JEv B67BE4BR+hbGhJ34c1bob/GLUlCm8/vBUZ+ehfaOhmaYSugbkwa9/ewGOiKHg8VCA6u4 N+Fg== 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 j16si9402792pfh.0.2019.08.18.17.19.35; Sun, 18 Aug 2019 17:19:50 -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 S1726295AbfHSASl (ORCPT + 99 others); Sun, 18 Aug 2019 20:18:41 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:35299 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbfHSASk (ORCPT ); Sun, 18 Aug 2019 20:18:40 -0400 Received: by mail-yb1-f195.google.com with SMTP id c9so41762ybq.2 for ; Sun, 18 Aug 2019 17:18:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7J6zazvwWXJHLLGTA9d2Z5bIVQ61P1OZdxnYyH/AmRU=; b=FNuQ1T8CfIyUV2cuQ05eCFM0Uci1l2fjQ0mrftar/xk+RcMB42rXUe5y0Nef5Zl59j yQ3vAMsBd4y3OgMeq3mGWA0qChziuOdO6jlnuA7B4DhM9fKatNJPlN/fXQgWBikjV6tS GPQyUSisY9HhTlCJorNfwpKC5nngXYVhzVYIiL7CX/+GXfTynHvG/qepppDb7AXJ6ooy zsIvaqsNwVmXVct1UeMu5eHV2GEAfwh2JS7YWhrR34JmRZCDcsaJ2StqBI6s8jYH0E1K i+DQLGeg5JBK2jQ0xvc45cpsYqFkoUrAjRtgJW2lxAQbKhnei8VLBzyo11wORzmaX0UG i5KQ== X-Gm-Message-State: APjAAAV+GLjhsinxjYGigsiNa8dlNvnYFhFDMoGEOsPKrsGy/e4r9hM1 d1eOYYOOMBfWm3BuM1VhAw0= X-Received: by 2002:a5b:543:: with SMTP id r3mr9244165ybp.193.1566173919870; Sun, 18 Aug 2019 17:18:39 -0700 (PDT) Received: from localhost.localdomain (24-158-240-219.dhcp.smyr.ga.charter.com. [24.158.240.219]) by smtp.gmail.com with ESMTPSA id w4sm2886984ywa.1.2019.08.18.17.18.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Aug 2019 17:18:39 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Cc: Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com (maintainer:DEVICE-MAPPER (LVM)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] dm raid: add cleanup in raid_ctr() Date: Sun, 18 Aug 2019 19:18:34 -0500 Message-Id: <1566173915-5837-1-git-send-email-wenwen@cs.uga.edu> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If rs_prepare_reshape() fails, no cleanup is executed, leading to memory/resource leaks. To fix this issue, go to the label 'bad' if the error occurs. Signed-off-by: Wenwen Wang --- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 8a60a4a..1f933dd 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3194,7 +3194,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) */ r = rs_prepare_reshape(rs); if (r) - return r; + goto bad; /* Reshaping ain't recovery, so disable recovery */ rs_setup_recovery(rs, MaxSector); -- 2.7.4