Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2490078pxj; Mon, 10 May 2021 04:21:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybwpXyRHrcvNc/dRYxiTTJZMcO7IFRtHlqcXS+eduj32YY0p6WWRW8UfA/mFGEl31vPtei X-Received: by 2002:a05:6e02:13a9:: with SMTP id h9mr9548547ilo.227.1620645690957; Mon, 10 May 2021 04:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645690; cv=none; d=google.com; s=arc-20160816; b=Yt10Dk/ijYdvBoaq1qexmzkwtSfu2tHO99yKcZBJG/9Mp8ikNNixuFosBpvuPsBSCP l9e+S3i7HHCvE1uYEJyKrCaVut4zXBCJiMyTjKC3HeKx+24ZjZidAuj4lvaWS2qRikqk Q5BZ4fy3aSONCA2G4XE8wEHC29pWL6uaXv3NE0LlRu4sjwR4fXqAWSXkFS7CrNV6BZ5p EPaGiaeLm3TAXPB+rD2vLFjOqz953oS+sQ8j7cnJH12OF9tU0IYHycD60TQ8kKK7/6eh TXB6os76q3XSfdve7SDemT4GrTP+1SAC+M4p7jUVv6eusFxkj6o21wXdVl0b0KChZJAi vpUA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jBqxMd/LcJTtKC8/aRjCyge/btKiy18ZBIf7QL4QpxE=; b=y7muCOzIDduHPIpRlP3memtmOWNa2xgrGn5kneyiXYSbkGzJA4G1IiROlG7O3iSNXq HIivUC+6j3UIlLd4wDGWKcSz/hpXrba1WCld/8Gj6EL9JsBH6fbO3r9G6O1v7PwuooS5 EWekmc2Hg8BPUNRtBYpFLENUJBPPWUf1p6hYcV+FeQAjDBEAj8UXpdo7l9DCdatyRh40 11sDT91k322X1pzz0tAwr5CcGYYsGcO1oFZdJ3kBoXlUJYPYj40QQcG4rHAAnhk5gAMw irKE/R5HQfoWmDQZU9jqUWdp2WAzQ5RP7fbJQwd4n6omIOJVSTSA6obAs21dkrDpIeYb 8HIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IymATz3T; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si17896516ilk.9.2021.05.10.04.21.18; Mon, 10 May 2021 04:21:30 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IymATz3T; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238839AbhEJLUK (ORCPT + 99 others); Mon, 10 May 2021 07:20:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:52212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234006AbhEJKzo (ORCPT ); Mon, 10 May 2021 06:55:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 469E661927; Mon, 10 May 2021 10:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643401; bh=L4Z/lavsAkh015cOpILC8zaDta2Yugo6DqHJ9fBvJK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IymATz3TD1OBGJwK1fftIGSD4F8bHygG26CT29opmAI/WS1zv9tvWpUdXzUi2OSUe 9A+jCVLZglNKwXuIeDDfpGEo7Hb+RAekqzTTWjkmZvlicFl0DnvCOvb8Kxk5pmWc0G TXa0k8g8c6aTDDOUL9NTfrY+uHyaiiUF/TJKUp6w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+7f09440acc069a0d38ac@syzkaller.appspotmail.com, Peilin Ye , Mauro Carvalho Chehab Subject: [PATCH 5.10 273/299] media: dvbdev: Fix memory leak in dvb_media_device_free() Date: Mon, 10 May 2021 12:21:10 +0200 Message-Id: <20210510102013.946055161@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peilin Ye commit bf9a40ae8d722f281a2721779595d6df1c33a0bf upstream. dvb_media_device_free() is leaking memory. Free `dvbdev->adapter->conn` before setting it to NULL, as documented in include/media/media-device.h: "The media_entity instance itself must be freed explicitly by the driver if required." Link: https://syzkaller.appspot.com/bug?id=9bbe4b842c98f0ed05c5eed77a226e9de33bf298 Link: https://lore.kernel.org/linux-media/20201211083039.521617-1-yepeilin.cs@gmail.com Cc: stable@vger.kernel.org Fixes: 0230d60e4661 ("[media] dvbdev: Add RF connector if needed") Reported-by: syzbot+7f09440acc069a0d38ac@syzkaller.appspotmail.com Signed-off-by: Peilin Ye Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/dvb-core/dvbdev.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -241,6 +241,7 @@ static void dvb_media_device_free(struct if (dvbdev->adapter->conn) { media_device_unregister_entity(dvbdev->adapter->conn); + kfree(dvbdev->adapter->conn); dvbdev->adapter->conn = NULL; kfree(dvbdev->adapter->conn_pads); dvbdev->adapter->conn_pads = NULL;