Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752513AbdHHX26 (ORCPT ); Tue, 8 Aug 2017 19:28:58 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:34343 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752081AbdHHX25 (ORCPT ); Tue, 8 Aug 2017 19:28:57 -0400 From: Daniel Mentz To: linux-kernel@vger.kernel.org Cc: Daniel Mentz , "Luis R . Rodriguez" , Greg Kroah-Hartman , Andrew Morton Subject: [PATCH] kmod: test_kmod: Correctly lock reg_dev_mutex Date: Tue, 8 Aug 2017 16:27:33 -0700 Message-Id: <20170808232733.28415-1-danielmentz@google.com> X-Mailer: git-send-email 2.14.0.434.g98096fd7a8-goog Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 965 Lines: 29 It appears that, in the preamble of register_test_dev_kmod(), mutex_lock() has been confused with mutex_unlock(). Previously, register_test_dev_kmod() never called mutex_lock() but instead, it called mutex_unlock() twice. Signed-off-by: Daniel Mentz Cc: Luis R. Rodriguez Cc: Greg Kroah-Hartman Cc: Andrew Morton --- 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 6c1d678bcf8b..f458130a5e65 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) { -- 2.14.0.434.g98096fd7a8-goog