Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3600992pxb; Mon, 24 Jan 2022 13:14:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJn6Kz07IidYVFRjFaQUjHfdOJCY0h7ZuzFlgRtLYpOFdg3yfRZShYdKMxd3WodisVQ/Wc X-Received: by 2002:a05:6a00:1906:b0:44c:b35d:71a8 with SMTP id y6-20020a056a00190600b0044cb35d71a8mr15471484pfi.51.1643058775469; Mon, 24 Jan 2022 13:12:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058775; cv=none; d=google.com; s=arc-20160816; b=R1z+T1m880ksVIgknXbhkVWA/fM1vwY5A3fq51m2wPuxETcSIwduhq4bw8eBJApfM2 xt3gTQ8Hlyr8K8gjbIDe8a1yTSxvTVtM+6Op/k/P1o57FnXTr1fa5os3m4cTV87tcqse he4d+aVWzuozEkzwfPydg1Nzvjp246syQCMImHa/pZmjCQiH9pD4fsnpTPnvljI7aC/W 81H/24tbTbmDBVIirpZFuE24AJtyXCofs6WD4yN+T25Y8c6Ikke34sDS03oyogrzxC+D G8lDVYyRn+ktrygHDIvfEPZCtoHq8etWxIVAfQv7RACVzNPNv3aHc0d25Z4/Py9aiuTM ETvQ== 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=OnrQZ0e9eNF2v5MiJfv/IgvQxVWEcACjpIyGGNOFaEE=; b=eURdLTjjvmo6yzbhU5sxLdgoWlMdrwYv8rAm93CzIr9xupWqq2vx81AU0tAjUIJ+Sx V1GUub6gF5yBQ+8dFBOFYyvhA2XNp86eVDh1wwuKa5ZBc98YQNy4P1qRtXF541TuViql 7a2vFBQ8f2+bro1VueK8cLZ0G8pKGQJApI0eP66/5dU4pb3jE0haF6yDU9qxQJa64aWk xt5sfEY68B3Fo4TKvx3Oxreolrd/37FUiO5L14lsTkzKhlGGL1eBYl8NJW51hsy2r3ON yqd7CFGqbWY09ppwI2frFC8lfZY5fuASTt3Sd32WgSCtkTMiyUpZs1E4gZ5mkGwYTLsD R2HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cI0bDlUu; 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 17si360731pjk.9.2022.01.24.13.12.43; Mon, 24 Jan 2022 13:12:55 -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=cI0bDlUu; 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 S1387416AbiAXUgt (ORCPT + 99 others); Mon, 24 Jan 2022 15:36:49 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40908 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345402AbiAXUN6 (ORCPT ); Mon, 24 Jan 2022 15:13:58 -0500 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 DDA8F61482; Mon, 24 Jan 2022 20:13:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA139C340E7; Mon, 24 Jan 2022 20:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055237; bh=5mn8xY2Rw2yKpuokmAWh9/JaNI4qxPL/snAS97h6juY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cI0bDlUuZR0NgZTk72RIYSfciu8BjPmrC31429nWYr5ywQfGUw3eA0gzJ2N4voD+8 f9vZET0DURUUaHAgihZVI5f0ETGi1J2eeumUID5E3gY+jIWFSAtv1XyhXY62Vs9S5b KOzDODvhtF/Ug1fMweoQpJ4crBsc5araCiLh5ki8= 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 5.15 086/846] Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails Date: Mon, 24 Jan 2022 19:33:23 +0100 Message-Id: <20220124184103.955444523@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 0a2d78e811cf5..83eb84e8e688f 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -501,9 +501,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