Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9982402ybi; Wed, 24 Jul 2019 13:30:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJYGzKKqdhz/NZwouMtKvQf6Uyih9B74zUO6P+UrvMoP74kcOJw/2T/2OqW6gzFdtMLrt0 X-Received: by 2002:a17:902:381:: with SMTP id d1mr85565598pld.331.1564000231846; Wed, 24 Jul 2019 13:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000231; cv=none; d=google.com; s=arc-20160816; b=ZupQi4KnAqVe7X55fcIqORLFC4HqvoGl6uXRPyUszmFWiUx3Q9bkY5y7Wnlh/nawSU ZTbsIYcbAoWYeyWDgDSx3W9FJj8aVCQnx3xIvYUarWbtM+XpivXogm4JnIN3BmTE7R7q wsP6wGxKbQLJyxm/u1HUxJlVSStGLn02Z3J7iFgQjN/i3ua1SZK6Y7dxk3meRLZFQckp T5ZzhndELJTpCEzwM9rbanH0cG1CfK8A2/Ch69alMcFXuPR3Y22x7JfyGHGheY5oztQg tIg53c9NmtZpPeqJ9I+dNAS2YIsZyMFZMEWQ7Abk4cdt9YO//OCfAsZ22rpruMid3VzX /+5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2Xr8Iow+i7EJt2rCjHChPQI/FtSEibWcd7ieFegkpFU=; b=OMx4b0u/z8hVpSXIs2R7IJ9tLLcowuJmazgmBZcEtw6w9KJBgE3wlZALM8XR4z5E3g qLfrzj4bSAOygd1SDUHdsFGVbxIkvxUZleRGas70Fdl54btnhcet7L+4GIy7BA9a+rZA DHBGEAOVgpAaDXU3/cT3foM9lYEc7ZhiFpMXS7kCmpG5j8EeTdHR7Em5h2feBEItmnlT nrlCWTTCEOrwK/uE9601zQbYT2He+zjU5djGAytEfBvzSBL6LTJ4TdfNGLzYxfmrukr+ +qg7BMhAiyPN8+BRurAUcOcFWDR14+COC7Sk6W6+7qAEHG6G2kExjSlwVwcS2I4UYEmI p6mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MDJJbP0K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x190si14772274pgd.146.2019.07.24.13.30.17; Wed, 24 Jul 2019 13:30:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MDJJbP0K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388856AbfGXTdo (ORCPT + 99 others); Wed, 24 Jul 2019 15:33:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:55616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388899AbfGXTdm (ORCPT ); Wed, 24 Jul 2019 15:33:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 20455229F4; Wed, 24 Jul 2019 19:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996821; bh=PgKnROCQHhUXgNF+sEJkwgBPQQeZ1guqkKm9GmCfoGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDJJbP0KcrYOV6848DwLXdL+U8952TGaxDuJI1vEL24tV2+wQk45P7Ml2BZQKqHo2 iHHEnbeY0ED5u9uGFFyZ+DzxIk8tlnEHZoYbgjzpdcPPNHMnB6vKrcnxfN1PAJ2OI+ fl7lE6yQR+1aheVUcjtvV/zzmJcQsIkl+jTjpuVU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomas Bortoli , syzbot+98162c885993b72f19c4@syzkaller.appspotmail.com, Marcel Holtmann , Sasha Levin Subject: [PATCH 5.2 228/413] Bluetooth: hci_bcsp: Fix memory leak in rx_skb Date: Wed, 24 Jul 2019 21:18:39 +0200 Message-Id: <20190724191751.299627738@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 4ce9146e0370fcd573f0372d9b4e5a211112567c ] Syzkaller found that it is possible to provoke a memory leak by never freeing rx_skb in struct bcsp_struct. Fix by freeing in bcsp_close() Signed-off-by: Tomas Bortoli Reported-by: syzbot+98162c885993b72f19c4@syzkaller.appspotmail.com Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_bcsp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index 82b13faa9422..fe2e307009f4 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c @@ -744,6 +744,11 @@ static int bcsp_close(struct hci_uart *hu) skb_queue_purge(&bcsp->rel); skb_queue_purge(&bcsp->unrel); + if (bcsp->rx_skb) { + kfree_skb(bcsp->rx_skb); + bcsp->rx_skb = NULL; + } + kfree(bcsp); return 0; } -- 2.20.1