From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62F5482886; Mon, 15 Apr 2024 14:34:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713191670; cv=none; b=b53F6TTzesJcJFLlX314gVwiXKiYbtfRp4/k4Bt935fkl2QGH8IllUKM5htLjTSpzweDr4cDAMJ8c28CE9ROg2tw4QoRhDJQFpoAtX99C6Np5/jbmk4trYemSh2UwjbtnDe3N0QgTef1x2aI7TByDiTmbraOn6hwSdxWMh7Ryy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713191670; c=relaxed/simple; bh=lUxqvDNGXiJNfzTTeRTqVSrzrsFc6vNhec7DP8qgAfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tlc4UEqPnmlwSx0V8ZBtiqAdjssmpitT8geal+COY/iCeE8Pxjenab+ozhnW19R7uhJZulGY5kfGoolzfrrhTy00dpJ+Yg0CFsPyfydorPh38+JF2TM/WCtUOqauUTqDk3WGfg7WtkzaQnQJVKu2NuAUB3Kd7TiCRwmmUKRnHc8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cyJ2FagY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cyJ2FagY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCDF1C113CC; Mon, 15 Apr 2024 14:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1713191670; bh=lUxqvDNGXiJNfzTTeRTqVSrzrsFc6vNhec7DP8qgAfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cyJ2FagYTuRBp5UykF4APSD53+ZVUEIfE8EuH1ituWod9epj6spLkqDO3UPZ0U3y2 NPpU19Gx+M9xjXRQ+QUlJskVQcXxmrrsVQcRCxrnU5OgbqkBhpYc6qimYJYnPlaZqZ P+BnaIt16W1hJyhosucGwKeM9D6bvCv705rGs+zE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com, Dmitry Antipov , Luiz Augusto von Dentz Subject: [PATCH 6.6 009/122] Bluetooth: Fix memory leak in hci_req_sync_complete() Date: Mon, 15 Apr 2024 16:19:34 +0200 Message-ID: <20240415141953.656503334@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240415141953.365222063@linuxfoundation.org> References: <20240415141953.365222063@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Antipov commit 45d355a926ab40f3ae7bc0b0a00cb0e3e8a5a810 upstream. In 'hci_req_sync_complete()', always free the previous sync request state before assigning reference to a new one. Reported-by: syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=39ec16ff6cc18b1d066d Cc: stable@vger.kernel.org Fixes: f60cb30579d3 ("Bluetooth: Convert hci_req_sync family of function to new request API") Signed-off-by: Dmitry Antipov Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/hci_request.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -105,8 +105,10 @@ void hci_req_sync_complete(struct hci_de if (hdev->req_status == HCI_REQ_PEND) { hdev->req_result = result; hdev->req_status = HCI_REQ_DONE; - if (skb) + if (skb) { + kfree_skb(hdev->req_skb); hdev->req_skb = skb_get(skb); + } wake_up_interruptible(&hdev->req_wait_q); } }