Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1261223pxb; Wed, 20 Oct 2021 01:16:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf1oZVJx1UaYPdCh+eCcW9anov4Syo/Jp78mSz+oiiN+zVtAbghzPbw3PEYBELkjVxMHfV X-Received: by 2002:a17:90a:be02:: with SMTP id a2mr5730021pjs.59.1634717793233; Wed, 20 Oct 2021 01:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634717793; cv=none; d=google.com; s=arc-20160816; b=v/AEN4HSvzU4aLgallHo9hVKBUwPDJu0d4/740BNOif5blZbQObRuGCr8H1tc5phyn r0aQH8QQL/F6uftuiy9/pAuAau3/XOD2PPrLHhyylMoaGywQad5ViCrsDiyXQPZ8V3Md VRbJ4FuaUT3fq9gODsSFcss+XPn0sT2WkxvsEt8J1i/W1lVVVaAAfqDWARcKziUQ/995 2208q+NcAQuLgguGkSL3DPJZfkUB+BVP8YR/4mWhGjDphyCpm359b8mVBbvybaRsQoXV 5cOBzeEZIF1EJgDIib3oakhZv+eYi/O7hS4oDqQKlgFQdKZN3g4umMNj2AOtTX91L+Ga aXlw== 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 :message-id:date:subject:cc:to:from; bh=JM0p5pBRMXJbVB0Wcec5BRyXQ1PW5nWadi1SKcFuIKg=; b=kxGw+7fL1lxdw6Muuc2v6KIUYHZMIu4AxK3EEocT3hCJ7TGT4KVMrwIVedJ/SrVak6 Uw6WyAbo3T09yRbhtoq5TCJILUQbX05WdTa0dB9n01S/Gg9v6JzDPERF1w1AOKY3HQou TPHOp9PCtv+zcFa+kKnQU2BGrc75FmKvEan4nkDbggftwswmJrLXTbbUu90bsx4FL/i1 r1qOaDghJJ987BYbsUQ9U2dPsvMAEjPDEms5oigkMsn5SmoH568mDupeRdDDT9bHLoe3 s18qvj2bekqf1lqwS0RER0jAvAvbGWNYgoebCrb5WwS7bHncZfvAQFMUsGIGKfr2vzpM a5ag== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 17si1829877pgo.400.2021.10.20.01.16.20; Wed, 20 Oct 2021 01:16:33 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229555AbhJTIR1 (ORCPT + 99 others); Wed, 20 Oct 2021 04:17:27 -0400 Received: from giacobini.uberspace.de ([185.26.156.129]:52614 "EHLO giacobini.uberspace.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbhJTIRW (ORCPT ); Wed, 20 Oct 2021 04:17:22 -0400 Received: (qmail 18277 invoked from network); 20 Oct 2021 08:15:01 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by giacobini.uberspace.de with SMTP; 20 Oct 2021 08:15:01 -0000 From: Soenke Huster To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: Soenke Huster , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() Date: Wed, 20 Oct 2021 10:14:44 +0200 Message-Id: <20211020081444.37324-1-soenke.huster@eknoes.de> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On the reception of packets with an invalid packet type, the memory of the allocated socket buffers is never freed. Add a default case that frees these to avoid a memory leak. Signed-off-by: Soenke Huster --- Changes in v2: - Add break; to default case drivers/bluetooth/virtio_bt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c index 57908ce4fae8..076e4942a3f0 100644 --- a/drivers/bluetooth/virtio_bt.c +++ b/drivers/bluetooth/virtio_bt.c @@ -202,6 +202,9 @@ static void virtbt_rx_handle(struct virtio_bluetooth *vbt, struct sk_buff *skb) hci_skb_pkt_type(skb) = pkt_type; hci_recv_frame(vbt->hdev, skb); break; + default: + kfree_skb(skb); + break; } } -- 2.33.1