Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3547607pxb; Mon, 24 Jan 2022 11:57:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCh2xLRatMm8E/pkvs8aQqB63zqo8W0DWVmz+fwPD251mXtFndMCGJVCAq4/e5C49hpqrC X-Received: by 2002:a17:90a:e387:: with SMTP id b7mr346144pjz.89.1643054246990; Mon, 24 Jan 2022 11:57:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054246; cv=none; d=google.com; s=arc-20160816; b=Y9c2bbgnGv2RgawMPEXFiaLJ1qWwN5Xhm0sZJti5OXqBu7LIuLX4WGwcixzCZHuUxM es154x6/ksrLMF9AEgylSOXosBdoSIlgN4GaedlZo4Md5+yQ/eC9VLawa6ibUcduLbhH t+pmoT+kU6Y5dzO9/PYIgdAdoFby2GrobfW1SlOe/kKk1SxAb6/7QddQu2OnrJofNRJ6 xrVxyDoX/98WTC7njFGNGknL707vG9+j2+TtJzSaa/ATCCZeTNMq9rZXRNcQjJb0XiEX UHzZjhbckoZrhp0Du5/B0mVgAMLbGJCWZev/nWr4/F7ZLCgR5eFQzhzgfO3v4SSHTgwb XgqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XUyLtjxnnSqEItarL247OTCMuIZA2yL61zWL3k+WB34=; b=APZ7TMvy2xnp/cxnfEL8eCcSlOjCoQXxmWlBofVjCyxtw2GW8wn4Tiy0SGozg/j8bt nk8OjAOz5f5+G0YSYkICpIYB8qFqzhJXsJj6sqS5mKVg54tfwC/LK/anXYGWRlpAduME Ymvp+TeGse5xczgM+nPKrAhJ1In6fknS+5dlmqdFZcB5FgRFZCY/araG8BFKzUgoAquN LdGah39Hk4dG4d6zXgJGxcdWYF3wLCEVpuhIFBuG4jhZuhNLskn+OQIqEg4GXAuzHFI+ kqzKVAPQYxq1ip8opoSswI/K6uGbkxGRwoY+MAS5SUXyUjMKTMwziKsbZYSy/PTBDfwO DmNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z4hec8MJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n22si13978075pfu.185.2022.01.24.11.57.13; Mon, 24 Jan 2022 11:57:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z4hec8MJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245450AbiAXSvw (ORCPT + 99 others); Mon, 24 Jan 2022 13:51:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245344AbiAXSuh (ORCPT ); Mon, 24 Jan 2022 13:50:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7432AC061401; Mon, 24 Jan 2022 10:50:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 11A4E61502; Mon, 24 Jan 2022 18:50:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9CCDC340E5; Mon, 24 Jan 2022 18:50:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050236; bh=yDBSgpBW6dgHBL2qjwJh5vA0ZzJY2QqpuiH7rtUVgX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4hec8MJns+B6zOTsiGbXgOiOP7MVKEGb9aw/lhtZ4EtkUZSQ53LrYcfJjcAfgVdr bNKw6wG59ftNHEp062T/pJTrPR9khfLUYXLbDWq0w7FNiZhH8v+V9a9DH+mdK0lssw 6jnAp9uCo/TUfGdJ4vj8K+ngPut97XaO1F0u2p20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Marcel Holtmann , Sasha Levin Subject: [PATCH 4.4 020/114] Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails Date: Mon, 24 Jan 2022 19:41:55 +0100 Message-Id: <20220124183927.749639988@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Hai [ Upstream commit 2a7ca7459d905febf519163bd9e3eed894de6bb7 ] I got a kernel BUG report when doing fault injection test: ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:45! ... RIP: 0010:__list_del_entry_valid.cold+0x12/0x4d ... Call Trace: proto_unregister+0x83/0x220 cmtp_cleanup_sockets+0x37/0x40 [cmtp] cmtp_exit+0xe/0x1f [cmtp] do_syscall_64+0x35/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae If cmtp_init_sockets() in cmtp_init() fails, cmtp_init() still returns success. This will cause a kernel bug when accessing uncreated ctmp related data when the module exits. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot Signed-off-by: Wang Hai Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/cmtp/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index b1757895c4ad2..23bad44bb0850 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -500,9 +500,7 @@ static int __init cmtp_init(void) { BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); - cmtp_init_sockets(); - - return 0; + return cmtp_init_sockets(); } static void __exit cmtp_exit(void) -- 2.34.1