From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbdGGIku (ORCPT ); Fri, 7 Jul 2017 04:40:50 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:38217 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751782AbdGGIkt (ORCPT ); Fri, 7 Jul 2017 04:40:49 -0400 Date: Fri, 7 Jul 2017 11:40:36 +0300 From: Dan Carpenter To: "Luis R. Rodriguez" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/3] lib/test_kmod: take the lock in register_test_dev_kmod() Message-ID: <20170707084036.f6jxmffxk67qtmce@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170707083933.2mgnpqafhspbwu7h@mwanda> X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We accidentally just drop the lock twice instead of taking it and then releasing it. Fixes: 39258f448d71 ("kmod: add test driver to stress test the module loader") Signed-off-by: Dan Carpenter diff --git a/lib/test_kmod.c b/lib/test_kmod.c index 8797400b8bda..093b44771197 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c @@ -1146,7 +1146,7 @@ static struct kmod_test_device *register_test_dev_kmod(void) struct kmod_test_device *test_dev = NULL; int ret; - mutex_unlock(®_dev_mutex); + mutex_lock(®_dev_mutex); /* int should suffice for number of devices, test for wrap */ if (unlikely(num_test_devs + 1) < 0) {