Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2483128pxj; Mon, 10 May 2021 04:11:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKT3suhWW7heB35Zj/w0quS42FvsLznlX+tf0rGtMhmyjUmtgTw3HqaCHgKDl0ble48LYS X-Received: by 2002:a92:cd8a:: with SMTP id r10mr21237151ilb.282.1620645062981; Mon, 10 May 2021 04:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645062; cv=none; d=google.com; s=arc-20160816; b=jFnmYxsWcu/r6d+eSgX3fTfXh9fEip9eMBME/ToP02QnIPnDWPcLlFLM/CftiVGuZl O+tMKE97pjB1357ygGpTHYRiu+xdi6YGOOmZfLChVKur12fYPS1oGJOnWUwM8KbnHkm1 wWB4uDd5igF2Ri4jG3yYTKBPuSCcTvtrEPBIsxofES1zSQsj6Sn8Ng9C+CoPXafnAXex dfdGUn4LzpQkuXMO+IQxKLRdlqSXaeq1i2yWgBZ+3iuUlN3arS9or2uybg0AKyD6G2Aq IINYHcCS3Hdvx5tzdc2Bn6+K5yWlnB15SxsCnOzLZlyABJklva4ST2NGr1K1X0dOF1K4 zGzg== 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=cgMq5Vh3nVV7unMgy//yL7m8MoAJR8pAtxRIY+LeLOs=; b=ajA93C6lN7zSkNL7aK0oe95/xolFNIZgTWYdd16KUiXEg3ksrzukMbmI64VqpXg1XP 8djt44Kzsmo7khcDn8tP3aZINBr+MJKPXiQQp5o9qUYDloB4rJ8zjpxNNED8pu5qomxF RiqxZhm9VxVkhtYMFlsSmvr1CHzDbVKFygWi9aosAtkDpzPvrf1G8EejTbrdWRAIuqTl DKklELNVQEun9EbVoPK9IhOuaF8aXJxsJEOYLh9k1w/ZNz7UBsuY2PJC30F8CjtFGWHp lNKQtYNS4WZ76+Gq8EsyaC7WluxdQt7W2I+eFZLfKCw+pvBwJmOTJ6kdSk9kF787jTrE m28g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PuS4f5yr; 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 g2si4015809jam.93.2021.05.10.04.10.50; Mon, 10 May 2021 04:11:02 -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=PuS4f5yr; 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 S236649AbhEJLIY (ORCPT + 99 others); Mon, 10 May 2021 07:08:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:58270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232250AbhEJKsT (ORCPT ); Mon, 10 May 2021 06:48:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B3D5D619AE; Mon, 10 May 2021 10:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643079; bh=4p5NJe1BEEKVnw69vR2Ih0nK846XewJfLwVadjUya+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PuS4f5yrSBrXhQ/TL6IDq/giVj5xdij1dZgiJ1nCH//X0tiwSgZvX6s28CZxsXKCO 9mY8lM7Y8EKirhXkTaC3DE2AuPaxbsI/B7iKwd0W+RLbyCfw3U3zaeP92Ds6eIXJqB NopT3VznTgAPStgFsHp6eoziYnl6X4EmOLicPAIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+889397c820fa56adf25d@syzkaller.appspotmail.com, Muhammad Usama Anjum , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 170/299] media: em28xx: fix memory leak Date: Mon, 10 May 2021 12:19:27 +0200 Message-Id: <20210510102010.566682686@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: Muhammad Usama Anjum [ Upstream commit 0ae10a7dc8992ee682ff0b1752ff7c83d472eef1 ] If some error occurs, URB buffers should also be freed. If they aren't freed with the dvb here, the em28xx_dvb_fini call doesn't frees the URB buffers as dvb is set to NULL. The function in which error occurs should do all the cleanup for the allocations it had done. Tested the patch with the reproducer provided by syzbot. This patch fixes the memleak. Reported-by: syzbot+889397c820fa56adf25d@syzkaller.appspotmail.com Signed-off-by: Muhammad Usama Anjum Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/em28xx/em28xx-dvb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index fb9cbfa81a84..3cd9e9556fa9 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1984,6 +1984,7 @@ ret: return result; out_free: + em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE); kfree(dvb); dev->dvb = NULL; goto ret; -- 2.30.2