Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4690041pxb; Tue, 28 Sep 2021 01:37:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0TCWNji3BmKsQE16+Xq3/UbEHIIiwWHMXRaQVZIJYfEgT7innAB7d6QPk+Am2+dMTUqa8 X-Received: by 2002:a17:90a:7385:: with SMTP id j5mr4124142pjg.211.1632818236025; Tue, 28 Sep 2021 01:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632818236; cv=none; d=google.com; s=arc-20160816; b=EX9dMmts3+khORO1hUiMGQ3cRZIvtmOGyLgC9H4C1Jqxlizv/U1PwsU4e5JGHCj5Kw GqR5TTZoYvIQquO0A5gcxesKfKN+TCzdTEuRumh0s+K9YYWe/6Ocme+HDN5PuaQ1FW/y 1OXjvgNteYh6SyswEJMXyZGkU/NZOlthYkIsWO0ANlRg/W9yimbUoVvhBLFLxBOB0+Un 7lM2SHnEZpaE79BU1/5RiDcJ3ytrVaGeAr5cPhbGtsl+Fb+uUR7eFOBxd6QC991g9kI7 nPtRzIoXK3pLazx2W+6U0zgnrprmA7I4opbWHK/Xz0c8ug20cVi+CfCHZ0mexydJfhVD /CKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VkqOXfHINA+UZ7ncjJqcgVt9KM5mqN2AU4qxmIR04Ww=; b=z267AM70vnlBBoXW8IH3MFsCzW/ArmCpKO+RnwLUl+/UkZ9liQUoRV5iBNfZreHNoi junbbbd5zUKYaYz2F2AXoT92PoIUghaBQ1X261ESZFXozbL61Zc5j1qNH1M7ajX9XSkl S/O/VOZQQ1uFUE0lM/7BOpMthN+gDNzdqJmRuwcbHEkm4ILWGZ2Voo6qtNBNX1+JP6zB wYMO3MmpnWqFFTtnkxJ9dZkyk6aRwZ5d8h1wc8pu2491rIlvoig3BVvnBauweNKI2WFf y+/5PKQs0xzOXYXTRQwlcH4+PTfebLlgzg9o0QZHOd/U9/78V6mU9s0e1mYzyMJTNKjP K1CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KwmceUcp; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c4si21807780pfj.165.2021.09.28.01.36.48; Tue, 28 Sep 2021 01:37:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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=@gmail.com header.s=20210112 header.b=KwmceUcp; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239555AbhI1Ihb (ORCPT + 99 others); Tue, 28 Sep 2021 04:37:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235918AbhI1Iha (ORCPT ); Tue, 28 Sep 2021 04:37:30 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 718F2C061575; Tue, 28 Sep 2021 01:35:51 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id b82so29223157ybg.1; Tue, 28 Sep 2021 01:35:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VkqOXfHINA+UZ7ncjJqcgVt9KM5mqN2AU4qxmIR04Ww=; b=KwmceUcpNHtIhwmgml8dRJAWZBkf3N1tz0837q7wOglPnhgZbiBiaHveMoI+GKCkaO 9fSRAuTZqHX/B2+Wz8yq6JlVanohWSYcMGNt+k1n05jAdqgZVPrRT+q6KDUuxVf5+FYe nUan9ZSqN603cNiZhtD/zIZRjqAVEHmZGGg2OKd3/Wr11Bm24G8bPnxYR2w/WoqDSdrA L8k7ZZ/aGoP0gaWuL8/ZtoS+022b4ofGF0gNoW65h9ztD2mU15MFNH+IDWPYzSjf49Wy 0XYrqkD/YsDSyoLqg29hVIv8S7m5BhPfbCjggfCMtKtfj88B9uj8VSK5/SbIukv3josw 97Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VkqOXfHINA+UZ7ncjJqcgVt9KM5mqN2AU4qxmIR04Ww=; b=3m6aAKhJmWbVv5DYz499ERg8rGFSc7A5n2PTWbAIpBAGvqWUjDRQm1a6qK2bJcsqoJ 0hIFEcsX2sSKJsBySKhuR9bEJdFNK+mYTFWtkOg3NNPXaonSW2uoLYHyvBHfadnZ9CkA 2bdWHNKAQdf+QW9hqdFfLz5o35il9i9CAexELXssavMgO4JEfRmamDlsjjEYckDDKuoH 1un0zBdi24QQVaDM6BQtVrGe9rTxrtzlJJKqxzLXW9L9soIlzBG6I40LX6igMGMIvPrM kn7Ck1TxlzUew3Q3XeHWpiNrE5Qgh2U5M82QyZSVUAsR0EFImTTWmVEjj0Ymp1UCq3xT LLxg== X-Gm-Message-State: AOAM533dXooNO5bSQwzC1LuYWQjKMzN7oFvpFEhGt3JrJupOJElCwfh9 jRzZlyEf75WvZtMWgEl+sxVNhEhqZhng+CBA638= X-Received: by 2002:a25:cc8:: with SMTP id 191mr5207905ybm.63.1632818150581; Tue, 28 Sep 2021 01:35:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: butt3rflyh4ck Date: Tue, 28 Sep 2021 16:35:39 +0800 Message-ID: Subject: Re: There is an array-index-out-bounds bug in detach_capi_ctr in drivers/isdn/capi/kcapi.c To: Arnd Bergmann Cc: Karsten Keil , "David S. Miller" , Networking , LKML , Bluez mailing list , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Content-Type: multipart/mixed; boundary="000000000000dac7b105cd0a1934" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --000000000000dac7b105cd0a1934 Content-Type: text/plain; charset="UTF-8" Hi, I make a patch for this issue. Regards, butt3rflyh4ck. On Fri, Sep 24, 2021 at 6:02 PM butt3rflyh4ck wrote: > > > When I last touched the capi code, I tried to remove it all, but we then > > left it in the kernel because the bluetooth cmtp code can still theoretically > > use it. > > > > May I ask how you managed to run into this? Did you find the bug through > > inspection first and then produce it using cmtp, or did you actually use > > cmtp? > > I fuzz the bluez system and find a crash to analyze it and reproduce it. > > > If the only purpose of cmtp is now to be a target for exploits, then I > > would suggest we consider removing both cmtp and capi for > > good after backporting your fix to stable kernels. Obviously > > if it turns out that someone actually uses cmtp and/or capi, we > > should not remove it. > > > Yes, I think this should be feasible. > > Regards > butt3rflyh4ck. > > > -- > Active Defense Lab of Venustech -- Active Defense Lab of Venustech --000000000000dac7b105cd0a1934 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-isdn-cpai-check-ctr-cnr-to-avoid-array-index-out-of-.patch" Content-Disposition: attachment; filename="0001-isdn-cpai-check-ctr-cnr-to-avoid-array-index-out-of-.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ku3tr7kr0 RnJvbSAxNTQ0OWJiNWFhYzFmODI4ZGM4MjA1NDY1MWZlOGY0ZGNhMzdiZWY3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm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