Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9130987pxu; Mon, 28 Dec 2020 07:22:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFRoAYjz7CQ3tC4j17bRKXB5BUPWi8+ZKN9r5MFHNlWYlICbr4Xp6XxXRHMgHl/3V78UVo X-Received: by 2002:a17:906:4c55:: with SMTP id d21mr42309230ejw.116.1609168972056; Mon, 28 Dec 2020 07:22:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168972; cv=none; d=google.com; s=arc-20160816; b=inzmIQFUV1vdZRYotLki7y5LynPSN2uRn/LeaBfNeQfUABESwnZ4Yfpm0QfC0zRp6x 2A9huSwDVDacO2tdpeWXgmGmDnDahM5hfmezqgpFlSVjO8tt7mWXSsWipsraYxgMCwzR 9pi37TWcPO9uwqz54n58PsaxrtKG/23wmfvyfWe4WRt8eG0LpyV6/oOCSNsHDCuSpR9e hVJHPT2HltMpDghLiMajMc0nHGqdFrgItG02+bneKdRdJenSQ39XKg/E5LA/W6oIGhGY LfIQpXuRlQ+fCXr8xsCTg2fXSWnbfVo4Mf8ZEcVXJAZ074fqls52uUduDXcxJrs4WiSW POGA== 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=eeUtvThtem/WPWyyIL9THlNk6s/nI8iWZYIbfVd8mPk=; b=LJv0638pGrxiYyO4/wVgoCH5m7dNU8lWwPgSqCcobiolBz2eiLZN+nDB54MH0UxPEA IxKLkOd+dSEm0EjHfkBnRbkVwUzgv4NX+3syrMAvmg8xjsAlZCy0Q0hxnUriIGnVdcOI U00PSse4QcYGWSufsQgoE3JA0I1VOUNl9oYi+M2vxOsRdPaPTr0mJgziXScOXeQcXMxL R+ZepyC44ObpbOSRlQUNxptKEYFRqHM1De6YiM8jkYbCS6u113tQ85rNH/tHlB7Uv4tW 9TaMYomlrYcgL5wBi6bPhAAaJ+2jhKgQYacut2h9fgiwlN+jdl54XL84flVhsAkm7A14 /2pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NrA4RWBx; 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 q11si18256455ejx.0.2020.12.28.07.22.29; Mon, 28 Dec 2020 07:22:52 -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=NrA4RWBx; 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 S2408174AbgL1PUW (ORCPT + 99 others); Mon, 28 Dec 2020 10:20:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:36052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436904AbgL1OCg (ORCPT ); Mon, 28 Dec 2020 09:02:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C82F20791; Mon, 28 Dec 2020 14:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164141; bh=/5STrloNs2nu2JCCq9RsRk6WhJ0fulxCFNj5mtFP1i0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NrA4RWBxFd1HUlVPzsrdxKIqFjZiXHGOOvd3GHIbokKI1ZMm0C2MHRbn1/Nw3FWfN yVOE3eMwxUpdzKMR9W310pKgkgJlQ2CEgFaJU6Ja4ZhpXAsWJQRVO5DoBYoxRAOqcF MpW1BCgsTEHNmX+tAHTUzBWEZ53KQBsFwJa9FjYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+6ce141c55b2f7aafd1c4@syzkaller.appspotmail.com, Anant Thazhemadam , Hans de Goede , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.10 074/717] Bluetooth: hci_h5: fix memory leak in h5_close Date: Mon, 28 Dec 2020 13:41:12 +0100 Message-Id: <20201228125024.540491926@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Anant Thazhemadam [ Upstream commit 855af2d74c870d747bf53509f8b2d7b9dc9ee2c3 ] When h5_close() is called, h5 is directly freed when !hu->serdev. However, h5->rx_skb is not freed, which causes a memory leak. Freeing h5->rx_skb and setting it to NULL, fixes this memory leak. Fixes: ce945552fde4 ("Bluetooth: hci_h5: Add support for serdev enumerated devices") Reported-by: syzbot+6ce141c55b2f7aafd1c4@syzkaller.appspotmail.com Tested-by: syzbot+6ce141c55b2f7aafd1c4@syzkaller.appspotmail.com Signed-off-by: Anant Thazhemadam Reviewed-by: Hans de Goede Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_h5.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 981d96cc76959..78d635f1d1567 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -245,6 +245,9 @@ static int h5_close(struct hci_uart *hu) skb_queue_purge(&h5->rel); skb_queue_purge(&h5->unrel); + kfree_skb(h5->rx_skb); + h5->rx_skb = NULL; + if (h5->vnd && h5->vnd->close) h5->vnd->close(h5); -- 2.27.0