Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1132836ybi; Fri, 2 Aug 2019 09:49:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMfI55qQpHP2IbKoyqiCJ3NSczG3exlZ2/KnZyQctBh5CVMuBUD/XRIJVpeOLiFA+bDkn4 X-Received: by 2002:a17:902:e383:: with SMTP id ch3mr131736735plb.23.1564764595835; Fri, 02 Aug 2019 09:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564764595; cv=none; d=google.com; s=arc-20160816; b=M4goNcTSAeeTodW6QinefCKeAtqrr6n+Jgv/4hBRKhL6lkPIRHCL1nlXwnMjSsb5UZ j/cGpo6gtJUW0DEoW516cTAHS6O/lx+Mgjvmz5sYoSzlzRLUcDbqnGobW0zLz7+VZCe7 znCU9wEF5m5wytOD20LipR12d1T9YPG1KlcGDJfwEi3+ohn7No8blI0WbSHyUXORKoWt MiIRo473fblfCI83cP3aPphozgkNfaCyvNE1ytj8K2EY7q2VTP+7GwJ08oDCGhFnoNnU AM7ksXDg+eYjKbCfRWJR/7euREHYz7XoSnN69QN7XVvTGMp/MiIrGf4YMgV8mn4LzvNv 6s5Q== 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=DwrUxABpaJE05v8vV/cCpDR146A9XbjGhXyfvOjx61Y=; b=pU1EhxZtuChb9OS5yLfZSrrb4AQP7XZtr8hZjD+bV0FfuvUGmZvLe/1bxkDk+2vF9L DbRCjpDyHQR62lLDZ9LVjDhUAdVYllVXZUqIujHSzB6NvsjJj5eE1TJaRi5PIfAxruSS RPaRXvQH/XDfmS7cUPFBy068MmyYRFs1QcXfqKeRWqOOZKeuph74q6iwj3M3Lm79gxF6 aHJJPeqZkkebmQlshF57dO1BJcqGqYrzW096Q68l2cT8EApdDjxsSdyU5GnPZCTK6A4d 9NF0U9Wina5+pe8CyYfyvOPv0IHliEcBu1MqzUKnlYmLBdIL9KxzTLB7/M4uQnsGJIxk bmYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b2iQ1wIt; 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 b28si40927682pfp.92.2019.08.02.09.49.40; Fri, 02 Aug 2019 09:49:55 -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=b2iQ1wIt; 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 S2405090AbfHBJnk (ORCPT + 99 others); Fri, 2 Aug 2019 05:43:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:46494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405070AbfHBJnd (ORCPT ); Fri, 2 Aug 2019 05:43:33 -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 6DCFC20679; Fri, 2 Aug 2019 09:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739012; bh=dGCY5vtQGFBStBU3gPtvOtTWgzaoYpYLKYHf/KhdXpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2iQ1wIt3Dcs0yHzCTz6ky+5NCFYAWqyrrRPLWwvMqK9kkdnlHpOg9xrx+37tlsXY 16SPH2o8bwDUzRi+4e8ZAKPSDyaIaKa98+h0U5Onr6JG1XecfYkclvoMT63sCunlgE 0KNwjF2aiYAT69hHmKtICHDBGN2blbLIP7HbA2Sc= 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.9 068/223] Bluetooth: hci_bcsp: Fix memory leak in rx_skb Date: Fri, 2 Aug 2019 11:34:53 +0200 Message-Id: <20190802092243.221837948@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@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 a2c921faaa12..34e04bf87a62 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c @@ -759,6 +759,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