LKML Archive on lore.kernel.org
 help / color / Atom feed
From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: akpm@linux-foundation.org
Cc: dmitry.torokhov@gmail.com, keescook@chromium.org,
	jeyu@redhat.com, rusty@rustcorp.com.au, mmarek@suse.com,
	pmladek@suse.com, mbenes@suse.cz, jpoimboe@redhat.com,
	ebiederm@xmission.com, shuah@kernel.org,
	dan.carpenter@oracle.com, colin.king@canonical.com,
	dcb314@hotmail.com, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Luis R . Rodriguez" <mcgrof@kernel.org>
Subject: [PATCH 5/5] test_kmod: fix small memory leak on filesystem tests
Date: Wed,  2 Aug 2017 14:14:50 -0700
Message-ID: <20170802211450.27928-6-mcgrof@kernel.org> (raw)
In-Reply-To: <20170802211450.27928-1-mcgrof@kernel.org>

From: Dan Carpenter <dan.carpenter@oracle.com>

The break was in the wrong place so file system tests don't work as
intended, leaking memory at each test switch.

Fixes: 39258f448d71 ("kmod: add test driver to stress test the module loader")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: David Binderman <dcb314@hotmail.com>
[mcgrof: massaged commit subject, noted memory leak issue without the fix]
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 lib/test_kmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 1bc06bbfc97a..ff9148969b92 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -746,11 +746,11 @@ static int trigger_config_run_type(struct kmod_test_device *test_dev,
 						      strlen(test_str));
 		break;
 	case TEST_KMOD_FS_TYPE:
-		break;
 		kfree_const(config->test_fs);
 		config->test_driver = NULL;
 		copied = config_copy_test_fs(config, test_str,
 					     strlen(test_str));
+		break;
 	default:
 		mutex_unlock(&test_dev->config_mutex);
 		return -EINVAL;
-- 
2.11.0

      parent reply index

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 21:14 [PATCH 0/5] test_kmod: fixes for v4.13-final Luis R. Rodriguez
2017-08-02 21:14 ` [PATCH 1/5] test_kmod: make selftest executable Luis R. Rodriguez
2017-08-02 22:43   ` Andrew Morton
2017-08-02 22:55     ` Luis R. Rodriguez
2017-08-02 23:42       ` Andrew Morton
2017-08-02 23:46         ` Luis R. Rodriguez
2017-08-03  0:01         ` Shuah Khan
2017-08-02 23:57       ` Shuah Khan
2017-08-08  9:50     ` Michael Ellerman
2017-08-08 17:52       ` Luis R. Rodriguez
2017-08-02 21:14 ` [PATCH 2/5] test_kmod: fix spelling mistake: "EMTPY" -> "EMPTY" Luis R. Rodriguez
2017-08-02 21:14 ` [PATCH 3/5] test_kmod: fix bug which allows negative values on two config options Luis R. Rodriguez
2017-08-02 21:14 ` [PATCH 4/5] test_kmod: fix the lock in register_test_dev_kmod() Luis R. Rodriguez
2017-08-02 21:14 ` Luis R. Rodriguez [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170802211450.27928-6-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=colin.king@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dcb314@hotmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=jeyu@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mmarek@suse.com \
    --cc=pmladek@suse.com \
    --cc=rusty@rustcorp.com.au \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git