Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2606629pxb; Sun, 17 Oct 2021 20:19:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbeBi5cOuQWJu4mdTo05FINZ9uMH+vr0hD/mgwkm/ny6/Ko6NkNZo6VC+yxgvojD06rb99 X-Received: by 2002:a17:903:1248:b0:13e:7226:9f3a with SMTP id u8-20020a170903124800b0013e72269f3amr24808218plh.32.1634527157652; Sun, 17 Oct 2021 20:19:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634527157; cv=none; d=google.com; s=arc-20160816; b=lQARZYSIXUEQWuP/xiAu0BRWVdohrOTffsXmVhXHpexoYmJEJ4mtFSaJdSh+62VQjc dt+xb1LJ9blOglDCMr4kaaHipfBxF0Z21KnCvlgRzFPCfp4rDaA9UuvJ8oK4/Lymb4sb gKWA7Gizcagj/HbLnSk89xO0Ep5QkeuLF2TFbvc683g+7mxJvewRrNruJr/YwXXy6Oov +zedX3CGDjWwJe6vMOh+E05z8KkRROaHdyymgzakxpkDgwlQd+l5eR82GqeuqJHfAJsv uo1PUGIG4svWmdzJZzqQx+QaFDkd6UoDVfQhoqXdY2HiJ4c/JhT47wbCowCgLw+Qx+Im davw== 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=lpQOF8ljkSI/4dDg2nxxNGKv7ipoQK47ni5xb0J/OI0=; b=NUANc3QPSi8KIYgC5Tpky29lo/QUk4Hlf456XpktKDy98xOiu4LCU2dvd3c0HOkcOL sh9dR4NabqTikypLbKmmI67zp4iN9L2Um9OGsydKsPEYhsPC/bVyZMOi2b2Y1KjXFvOO dtCKeqDYcQI6Mhwq81rxbC52F+phPWi15XsS6WcFBEaF32s7gS/e7fjuilZ9lM/9ItXL yF/DCf84cDzxlteHHVdKKrU4IOzqvQqMeNV9i2UwLm0kamdPxTzsSGxpzWTLy8fp8BG+ RF4+gGp27tgXmrNOr83BL0Xd0RlM3tgWAuH6dFsWOduqFkmn+n60wwY0TpYDm6e6/0FB ZK0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-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 h191si2962950pge.456.2021.10.17.20.19.04; Sun, 17 Oct 2021 20:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243429AbhJOXA1 (ORCPT + 99 others); Fri, 15 Oct 2021 19:00:27 -0400 Received: from giacobini.uberspace.de ([185.26.156.129]:48181 "EHLO giacobini.uberspace.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243393AbhJOXA1 (ORCPT ); Fri, 15 Oct 2021 19:00:27 -0400 X-Greylist: delayed 399 seconds by postgrey-1.27 at vger.kernel.org; Fri, 15 Oct 2021 19:00:26 EDT Received: (qmail 988 invoked from network); 15 Oct 2021 22:51:36 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by giacobini.uberspace.de with SMTP; 15 Oct 2021 22:51:36 -0000 From: Soenke Huster To: soenke.huster@eknoes.de Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() Date: Sat, 16 Oct 2021 00:50:48 +0200 Message-Id: <20211015225048.342949-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-bluetooth@vger.kernel.org On the reception of packets with a packet type that is not processed by the virtbt driver, 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 --- drivers/bluetooth/virtio_bt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c index 57908ce4fae8..2de0f54ada73 100644 --- a/drivers/bluetooth/virtio_bt.c +++ b/drivers/bluetooth/virtio_bt.c @@ -202,6 +202,8 @@ 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); } } -- 2.33.1