Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2108286rdb; Mon, 9 Oct 2023 12:50:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5XyhSYVdL6fTWkfC7DmRpI4QgJmbWS8p2siMuW9xZzb8Ulk86SQ9bm4MJfaOeD27JQ34S X-Received: by 2002:a05:6a00:1a89:b0:692:a727:1fde with SMTP id e9-20020a056a001a8900b00692a7271fdemr18290242pfv.14.1696881059160; Mon, 09 Oct 2023 12:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696881059; cv=none; d=google.com; s=arc-20160816; b=wIVILMMMqNwDSvDegc75BxvTGC8N5RM4pdSqAdQkc4pFedT+p7WVSHGdmb3Opgw+Bv WlxR/hvJlIf2jku9oKllP1/fBWtzea7a4cYfEyjP48Uk2w+OlTB99s6uMxY0nSC2XxTO /0tBIgEHYk57NcKPFmcAOjRAPrrG3fRLTz60vrwsFtGtNNca/xef2YtjVcCzJjTJYQPk 2Fz0EhudyiEOvLKSrzvXQm8qXlFO/zRz3BzOLofksMLX2vauhHUhTeFDaBfwmXo4CZ8+ KflnmgR4G3C7ZdkLTKfnud1BvIvSX2/UyleNw6Otv5URknPfbkTJ5cBwEpv24yCiP4CX qPvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=DCvsz/h9TY+Rnr8NBomSPRGnNvjlH7+ApWAJqBGhCEg=; fh=phhax/yStn1yqNnY4UZ19pMT3tYTdfvAw3eNLjl8/+o=; b=eAuaqxCHxRgpwJ+Gjc/mGkB0jigbr3+KO8gyoBt/2JsXgB8q1m2ipzPo60Rw52fPAs eTQB/rOjRznHKJWtSdcKGEYeSbmxb/tBgUYqs0LS01T09mnKbqMaxTOGh7RYEZmbVwNL m+fXecSLhQafLbv+fTgiMrxJwVHGGX+1NSqSK52HUChr6+h49v6Af9HwATYsfCDGVuI6 0R6gCDcBcWvuFc311gpAvanUi3kR9dzbVQyHcIjJz1cw5pz9TjkOxMBkrZAq2DP3Q7ua LvsydcmDL30/zQTGzwpyL/NJbVpnHzyufSq7DjHUJ7D+4JZCaptt46Xjy9492eQkX7L9 v7GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SdHtX6Pa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id f6-20020a63e306000000b0056fa1ac3722si10391340pgh.698.2023.10.09.12.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 12:50:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SdHtX6Pa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8CF458083A80; Mon, 9 Oct 2023 12:50:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378475AbjJITup (ORCPT + 99 others); Mon, 9 Oct 2023 15:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346695AbjJITum (ORCPT ); Mon, 9 Oct 2023 15:50:42 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CD8EB6; Mon, 9 Oct 2023 12:50:39 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2c008042211so59165611fa.2; Mon, 09 Oct 2023 12:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696881038; x=1697485838; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DCvsz/h9TY+Rnr8NBomSPRGnNvjlH7+ApWAJqBGhCEg=; b=SdHtX6PaPsXjEn/Of0ZvXVxjHqCijRL9dANCdgj8EPNV6piJePyCrciAnll9+Wp+cZ vgjTwSsbbm+FWMKcidB7CI5vmXnCuJIx5VhDX705RylyUdfnOc51W61SSuFBdBQwmuB5 PHdGJewJ3Z55HTu2Wdd+yFBAa9vbtHV1hvFv7XeoHAayPrTbBrAhN/ZmplXXAwxY7l7g AQOs6GPvzNW+VTzgMJVhIA/azjaUj3sgIC8V+H6NM5g6O9eTXfY9ibh/UCW/fgsu1cP8 pr2LWCR76AM/11IDHl2jzJ2nVOXVLW1EFEw9aSw8lzRJltUBbjatepDh5ODoYBwI+Hov KO7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696881038; x=1697485838; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DCvsz/h9TY+Rnr8NBomSPRGnNvjlH7+ApWAJqBGhCEg=; b=TvBjXcv/gMZS7xvtv8w5gKf/RdqyHPZ6Wq53hufIYSCbxlfZef44xHrIAAbfiA/gc1 rhWPViJqtmxD7eMyMvW3uy0TLIjZkq7SVQOy/wHCT3nDcmsTJSRTm5Ao8qBFRqF8gX63 KgB/5MrA6jFYvhGeJgvIoXjRgq1B+5tazVQjYNmaimCkXXmm+HdCCYwWBMaszwCCcTd8 rJXzYqz51uIMw4ZuWxHiMK3U7Uxb96k0Og9yQwj4a5fzgzAc6g91lWRsOtBHueR/ilSR hyk6Bbzi9K4xSbfMqVW3oeCtPSGrzeDW8mhkxIU3EMH7unwaoHAY4TOHvcYEL7k9Tvsa 9d/A== X-Gm-Message-State: AOJu0YxVEg/1VK4kDTEgNNqnsigdD6tjrcB4Nk6etvhN9kTP6bx/GpMS NYAoLWOsYFjT9pHX0zoXwSthJkySx5GAXg4vJr4= X-Received: by 2002:a2e:998e:0:b0:2ba:18e5:1064 with SMTP id w14-20020a2e998e000000b002ba18e51064mr14217882lji.14.1696881037531; Mon, 09 Oct 2023 12:50:37 -0700 (PDT) MIME-Version: 1.0 References: <2023100727-passive-untidy-8df4@gregkh> In-Reply-To: From: Luiz Augusto von Dentz Date: Mon, 9 Oct 2023 12:50:25 -0700 Message-ID: Subject: Re: [PATCH] Bluetooth: hci_conn_failed: Fixes memory leak To: Yuran Pereira Cc: Greg KH , "marcel@holtmann.org" , "johan.hedberg@gmail.com" , "linux-kernel@vger.kernel.org" , "linux-bluetooth@vger.kernel.org" , "syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com" , "linux-kernel-mentees@lists.linuxfoundation.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 12:50:56 -0700 (PDT) X-Spam-Level: ** Hi Yuran, On Sat, Oct 7, 2023 at 10:39=E2=80=AFAM Yuran Pereira wrote: > > Hello Greg, > My apologies, I just noticed that my patch is based on the mainline tree.= I'll re-submit one based on the Bluetooth tree and I'll ensure to include = the commit id that it's fixing. > > Thanks, > Yuran Pereira > ________________________________ > De: Greg KH > Enviado: 7 de outubro de 2023 11:41 > Para: Yuran Pereira > Cc: marcel@holtmann.org ; johan.hedberg@gmail.com ; linux-kernel@vger.kernel.org ; linux-bluetooth@vger.kernel.org ; luiz.dentz@gmail.com ; syzbot+39ec16ff6cc18b1d066d= @syzkaller.appspotmail.com ; linux-kernel-mentees@lists.linuxfoundation.org > Assunto: Re: [PATCH] Bluetooth: hci_conn_failed: Fixes memory leak > > On Sat, Oct 07, 2023 at 05:09:01PM +0530, Yuran Pereira wrote: > > The hci_conn_failed() function currently calls hci_connect_cfm(), which > > indirectly leads to the allocation of an l2cap_conn struct in l2cap_con= n_add(). > > This operation results in a memory leak, as the l2cap_conn structure > > becomes unreferenced. > > > > To address this issue and prevent the memory leak, this patch modifies > > hci_conn_failed() to replace the call to hci_connect_cfm() with a > > call to hci_disconn_cfm(). I suspect this is not quite right, hci_disconn_cfm is called when a disconnection has been requested, hci_connect_cfm is correct here since it is meant to notify the result of connection request procedure so I can only assume that the culprit here is that hci_conn_failed is called with status 0 which is invalid and needs fixing. > > Reported-by: syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com > > Signed-off-by: Yuran Pereira > > --- > > net/bluetooth/hci_conn.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > What commit id does this fix? > > thanks, > > greg k-h --=20 Luiz Augusto von Dentz