Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3820289ybi; Mon, 29 Jul 2019 13:15:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdQaaSKhOpJDdq4otcc7zGQO0NlzHsdQKyhzPjugrrOocpxCpSSMJQ9xCf3Hd1rapuLsKB X-Received: by 2002:a63:1341:: with SMTP id 1mr21494083pgt.48.1564431344233; Mon, 29 Jul 2019 13:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431344; cv=none; d=google.com; s=arc-20160816; b=UVvMbFr4SEtTEX59b2rSfjk4GJolEZITbek0mQ77/+O4tBRF0pNiovHPC3F21FdJF5 nhORjxHtD245QuTwnxOtGJz89vx/0CG/trppHiD+wNDCii1+ch4+fioohl6qVSW4A/Fd dgy2+RSFKBzCY65nW5Ro9h0U9jrL0YllGlAhrrWrU08mWvzX9wMxUMTMGrlsJEBNOfrX 535py2XiXytzP+kJ07aP9SJNVSqm3Ird+NOpgVE+0qg6qR5IJF0AUN+oTC9I0/hHI3HB lBmDizrEiTw3mzQu01p6oGlg6D5eH/cuEmz+DP7+VG+t/AMdsGheW174+lK8n/GUsDkn yjfg== 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=f8sRyLMf7H+bVnL9YGcmZE74HjcmqUqsTOBcYg9VnJA=; b=eHxw2kIAcmi3qwbEcT2HaCB9dlmqpZtFJKFJQ01vA4nkiDb22WYQBVhkKoQVg2L33A OGkUXvi1/LidFeSdcPBRv/pSmt9kazlsCcpfOasEjbwvLSUUbAv+go7uxQBLhrWh1fiS P5AhET5myJ7HDbebdcOC68rz6+vGMpuulJw1Job6cCe6D8iClAShKuBdI2vwU69SufOg ZpZfKsPxhTd0LGwOMYrBzJO29qqbPteVA5sfby2fzV6kUELm/BasuQyIun2UcTewFe1v 6lfR8S6w+SvvksQimyKzrn7CWjebe6aS2yuTf445d/tL50wS3JkINlVfonghEh3s/ZHy boog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wDukipXF; 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 s14si29961867pgj.347.2019.07.29.13.15.28; Mon, 29 Jul 2019 13:15:44 -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=wDukipXF; 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 S1728927AbfG2T21 (ORCPT + 99 others); Mon, 29 Jul 2019 15:28:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:41112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727585AbfG2T2Z (ORCPT ); Mon, 29 Jul 2019 15:28:25 -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 190332070B; Mon, 29 Jul 2019 19:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428504; bh=pL1Aa3SPAtQ1KsmWD8g3jrklpTWaWSpltuulPbI1cwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wDukipXFR8n+SINXUjR/+A7qipMlMnA/5C495zpz3m1IPhhNUiGJpB+b84278Oj7Y zw9inOUWGPdxiDK5GEIcV/9rtqe4VNVEhu3kSRQ7BYzIXMneks6fnsQgGmDkHjwlex Vcbrru/mL8eBS1hhIxpcwgiKERyiBa1Xk6WmrTLQ= 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 4.14 096/293] Bluetooth: hci_bcsp: Fix memory leak in rx_skb Date: Mon, 29 Jul 2019 21:19:47 +0200 Message-Id: <20190729190831.970958989@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 d880f4e33c75..57a7f4255ac0 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c @@ -757,6 +757,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