Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1271337rdb; Sat, 7 Oct 2023 23:06:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfL+LsUJ5e+em9VD3q3yNHdMr96mMi8DbLoCEugfnjnUwTLxMGeIdazIZIWSTW6kWObuSv X-Received: by 2002:a05:6a20:394a:b0:13d:df16:cf29 with SMTP id r10-20020a056a20394a00b0013ddf16cf29mr13081620pzg.15.1696745160509; Sat, 07 Oct 2023 23:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696745160; cv=none; d=google.com; s=arc-20160816; b=duYBg0aDoPNHRqfROkBJR1W0Pf6ZqCriiBT7dmCIxlnrztyGjlyvjENBHpTqTB5FpA 2CKi93zM+LqFTyokF7FhLD4Tea06TT4DRt1TogXBvToeH6Gt9Tm/s9l4s3AHDsWv3O4N wohbpkc6vyvISIxF92ExkFmfka8/IYlkA1fIkRNMBLyLrwu7yEM3XVyqWTde3cfEGvyD vS/Jh2cqo/4iICyZZjE4c0aJHUzkgTpt9GaNAjY0PCZXuO8L6GPYWertDfLwzNV33/um g8ZSM+3gU7QRS7NOVEQ4SCcj2ssgW28S5KY/aaMElNIummsrde8ESYFheDPoWjZWNj9H NI3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=20zaGCnaWTDoFcBYSDqzXIMeNQvC8tLwVyJtzx8GFpY=; fh=c6uD4orkmLJukMws3VP3+jmVxgfmr1GMQAazm9X2Yag=; b=J0zG6cjSz7X09gjowVneSadE9Q9yGcWQavrxxKm5in4JCgCiiOZXwm+DL1unPmWBcf hpXD4P1FSTjSjeWE3aW7EQqmpN2yz/5dI1l2S3eRrUoyHbabSKPUDYKYR36/2sNuiGqH rLkwLYSuAJ/vkxghVhwWXkH9W98Dpz6vN22Rbj0Z7xZ3kXf/xRBN7Zw37U0LvM6SKveb HFL4kAu4+c+Qr+LlfjQOp4u8qho0jGRNLrcTgdbKdB5qKBc6frEcbqTPNv58bV4F+5vf qITzqui1CA+aecnOZHqSg4RjDgBpAmYitKfk+fQlpP7pW06EZkiDPS181DPnYlTLccp+ K0kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PuqeMXVc; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id w2-20020a170902c78200b001bbacfdad2fsi6780414pla.291.2023.10.07.23.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 23:06:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PuqeMXVc; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id EC065807CF56; Sat, 7 Oct 2023 23:05:57 -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 S1344410AbjJHGFq (ORCPT + 99 others); Sun, 8 Oct 2023 02:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344392AbjJHGFp (ORCPT ); Sun, 8 Oct 2023 02:05:45 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 095F7C6; Sat, 7 Oct 2023 23:05:43 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FA68C433C9; Sun, 8 Oct 2023 06:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696745143; bh=6G4E2k0CfxZ9RMVM/HKCgdTvuF8wdlnMz5WMcwKbtiE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PuqeMXVcKbcaBDb+fC1tnut7M9vrgyJMrCuNtLsk/3bJoBgGgW22YJk1NZzmTVLbw +t8OLkbdY5K541GwTxUqJ7J+MU7Vjq0eQvD0o4W1/0PC9lOoXljrbbu8vqzDRZbz75 x0daNe4E/8V0YueTZfR4j2fKeO1D4NUq2inl0+hA= Date: Sun, 8 Oct 2023 08:05:41 +0200 From: Greg KH To: Yuran Pereira Cc: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com Subject: Re: [PATCH] Bluetooth: hci_conn_failed: Fix memory leak Message-ID: <2023100830-agreeably-jokingly-e6b4@gregkh> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sat, 07 Oct 2023 23:05:58 -0700 (PDT) X-Spam-Level: ** On Sun, Oct 08, 2023 at 11:33:34AM +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_conn_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(). > > Fixes: 9b3628d79b46 ("Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted") > Reported-by: syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=39ec16ff6cc18b1d066d > Signed-off-by: Yuran Pereira > --- > net/bluetooth/hci_conn.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c > index 7a6f20338db8..1d2d03b4a98a 100644 > --- a/net/bluetooth/hci_conn.c > +++ b/net/bluetooth/hci_conn.c > @@ -1248,7 +1248,7 @@ void hci_conn_failed(struct hci_conn *conn, u8 status) > } > > conn->state = BT_CLOSED; > - hci_connect_cfm(conn, status); > + hci_disconn_cfm(conn, status); > hci_conn_del(conn); > } > > -- > 2.25.1 > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documetnation/process/stable-kernel-rules.rst file for how to resolve this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot