Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10422779ybi; Wed, 24 Jul 2019 22:57:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOIcCpo10vVbf42HkNBge/BQohNhvH2IeCBT1PnEltGfH6LiYFqjKmqBppUw5ex44RF6PD X-Received: by 2002:a17:902:8ec7:: with SMTP id x7mr88148048plo.224.1564034261763; Wed, 24 Jul 2019 22:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034261; cv=none; d=google.com; s=arc-20160816; b=pqlhvr0K2EfJXTZNMJebYXpeHSJM1njYTeShliNzt6BIIy+AMvEtbLUg+Z/uVKG9yj 1sZIOqcZsEi+hHV2smYM69a7Tdo1G2xhAWxDVs1YeMwQhy3mezT/BHF5P51dcOBw1E8E TFsdEEsO+fy8DLygnXdy9lJVJSNMHSSJQ2ewVFCjbSokvIn5sIATqex8v46kp1k54rg+ 7YSi2emTt01mZv25VY2DVzXLtdzCawtZFP+irDA37Y9Kg59uhzLicexjceNNrqcQiERb sNBiM/lW2npOanA/vbHkjOu712egkJjLt++Nh2/gp0YVrXEHlu/MLX+itZ3l8Fg04M1p Erjg== 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=kmN+zpCrnPOzhQMAGgSTU1UCEIB5E1/Vi3PHRvJERM4=; b=0v4Rcog+Iue3mST4/vdc2vqU73bX/nnbNFLQft+m5fuUyoCzN5ZzX1OFg5IU0pdZez 5TbrqJ0UrXNAE6k/2ovaJQd94/jjmGPiYBtZ1tm8W+8f+Lnkf6q2jd0hitvfEuL8mMOa pmbATTzrV5a7trwtcR8smwHUojZRh1bZVvWcJQabMz77t8Y9aDnXsvuGhUm/b1pnC3oQ squ/GjCIfyM5CyQGklelCOZ2UXh9uPwsHSfXqi87Id6TTutXjlMQoxYuGwxYhqPSSvEd Vz3Pq3tZG+nHY7phvGN9Wz3eM2Kt7xv150Tm5KP4f0lPza5cqOw2XbzmrGAY7DGZqLqG P0TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lkkhXw99; 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 r17si16687430pgr.277.2019.07.24.22.57.26; Wed, 24 Jul 2019 22:57:41 -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=lkkhXw99; 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 S2390757AbfGYFk6 (ORCPT + 99 others); Thu, 25 Jul 2019 01:40:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:55638 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390734AbfGYFk4 (ORCPT ); Thu, 25 Jul 2019 01:40:56 -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 DCC8822C7D; Thu, 25 Jul 2019 05:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033255; bh=HVHYAs4JnrwG5NegSRAus12ZMc46mWLCWSvnS4Pd7pM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkkhXw99652MoxuTIu3IOQBkCwskVj66j4BLsBMDtRM5Vo25TxxKC5FXrficu5y1F nKVl/k9m8BaFHZkhE/IV7bN1+uQIyqP0bM1/9KpLSmt0Oe5qYh1uulms7NOomGCfyI taCs78pbx2nJ155YRyqZxClx4DNNpif8HJYh0jaI= 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.19 146/271] Bluetooth: hci_bcsp: Fix memory leak in rx_skb Date: Wed, 24 Jul 2019 21:20:15 +0200 Message-Id: <20190724191707.703875330@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 1a7f0c82fb36..66fe1e6dc631 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