Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3640339ybl; Mon, 19 Aug 2019 23:25:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxeBur0K5UQ4REo9FbOhZzgHwUkBtqIOVCdfVsSUyyxV009WDrkTCE5Wl86dEffnW8D9Gq X-Received: by 2002:a62:80cb:: with SMTP id j194mr29152534pfd.183.1566282324773; Mon, 19 Aug 2019 23:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566282324; cv=none; d=google.com; s=arc-20160816; b=P6bWxOuNGbDfM00WZkIcVHo/TNrWcEIIN5+LURRT68HLE1UEvcBfjv5IBTgJx0nBYK VCrbqN0ZfmwfSGZeZhaNpWl31PVFKRCFxqDsrgN8k3rqnqtGclZz0YRsr0WEADEvxEMG GcK8P3kTMdjKA4AXKcyZkabfQLvqGvmNSeCnHnfu0VB/N4xThavCkUK5KfMVTU9fXMKU 6EOG7FIHnqMIy6YAcqndn8Fu0mx2NJUS3EZzC8WnJiPLIMl8W3e7RIZGpqkDQgWFaYQS gsTE+OywQfNTMpDVPQ4xmcdc/etuy12M8UGEWVqgnFDiYMS/6+Q9CFjfncwK/Gn7Kesj w9sg== 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=/o7lpvdOJNBA2JPF2P6JSLDCuaJ3DsC1gxrwOwJhdgU=; b=p3J2bOjFgYCLvjQmpDV2PT3RIRZOX3Z332q2v5+6U+YBA3pTvd1m+dgYFn5oYGP6IO ffuhfZ+IzWJj4X6O6sK7r1i1P7zBYMvcrIMBuHl5iZMjpIA62KjL5mald4Z9kXSfTGkJ e7p+EvNFlJeH2I6f4jHHwuJkVLAfKdtvg3fSKLdypGtlN2R/5Nx3y6YIUq+J8Iw5v2AT kI7s5gOppMAzesvhCO8emLXSUXPWVylQobiyNnBrYTJ4mfqD2dZfRggQjaLO/OCrplEQ GToLlXMCJsLpEGBa2T9X5g22O6uHmItjvdPADXNBR2UTFIUQNrWHsi2ekdgwPZbL9BgG 19tQ== 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 r4si11552135pgb.245.2019.08.19.23.25.09; Mon, 19 Aug 2019 23:25:24 -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 S1729265AbfHTGXH (ORCPT + 99 others); Tue, 20 Aug 2019 02:23:07 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:39665 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729024AbfHTGXG (ORCPT ); Tue, 20 Aug 2019 02:23:06 -0400 Received: by mail-yw1-f66.google.com with SMTP id x74so1956272ywx.6 for ; Mon, 19 Aug 2019 23:23:06 -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=/o7lpvdOJNBA2JPF2P6JSLDCuaJ3DsC1gxrwOwJhdgU=; b=SetFbITNXK1J/cBGKCiK/aB56zqx1bu1Jko0oGUd53xVWMm4Wrc9D39GFgFmpFP8C8 7VumvwoBKBJIhXbEYe3yxeJGFj6WyGA1Mk6i9GHWkKVG/+b+oTvO/BHWmPVd9uhQvZLv 12MwuYQ+NShn2dNCJyJ6FdNGgaLe82C+kjnZT9x1t4nghzwFFL/I88nJIA1d2OOdqGeN WynnaDLl1UhJkmw1rZtlLPxKwfTjB1pdVlN/T09FPLd4FZiNa2I2g1OcjxC767d8Uw5h ti01uxXCxhyIBaXmmP/v+FlDBkL8SEb6pO4DF1Ag0iQi1T3rzBmQIUpGRj3SLsNUzNjz q9NQ== X-Gm-Message-State: APjAAAWbBsefKZq83fgFohRWYKkjkv9bpDelGKnvxSYN+gUGRNvzKXXD BbhnImdduUJP51He3Lq46t0= X-Received: by 2002:a81:6283:: with SMTP id w125mr19357489ywb.335.1566282185786; Mon, 19 Aug 2019 23:23:05 -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 q81sm3387307ywc.24.2019.08.19.23.23.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Aug 2019 23:23:04 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Cc: Bob Copeland , linux-karma-devel@lists.sourceforge.net (open list:OMFS FILESYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] omfs: Fix a memory leak bug Date: Tue, 20 Aug 2019 01:22:59 -0500 Message-Id: <1566282180-10485-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 In omfs_get_imap(), 'sbi->s_imap' is allocated through kcalloc(). However, it is not deallocated in the following execution if 'block' is not less than 'sbi->s_num_blocks', leading to a memory leak bug. To fix this issue, go to the 'nomem_free' label to free 'sbi->s_imap'. Signed-off-by: Wenwen Wang --- fs/omfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index 08226a8..e4d89a6 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c @@ -356,7 +356,7 @@ static int omfs_get_imap(struct super_block *sb) block = clus_to_blk(sbi, sbi->s_bitmap_ino); if (block >= sbi->s_num_blocks) - goto nomem; + goto nomem_free; ptr = sbi->s_imap; for (count = bitmap_size; count > 0; count -= sb->s_blocksize) { -- 2.7.4