Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp543366pxj; Thu, 20 May 2021 15:48:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnXZrhsQ0/EjUbgt6ztfRby7G7zi1AnLongGjjZg+29JYgfdpdt4MpVpspVlQnkwhOEAPe X-Received: by 2002:a05:6402:46:: with SMTP id f6mr7448135edu.252.1621550891258; Thu, 20 May 2021 15:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621550891; cv=none; d=google.com; s=arc-20160816; b=lNPMJnNNVx3C9WhGyb2VPVwhZW4jYWPr7RZWzyc9nJe89sdcJ0//jpaPh2gusd7FdQ mvby0IjbzN4Xt90Qp2gYZe+ZY99BKpZUPVtYLxewDVrZKou8+pt7VqgUW16NOgAaDt0O H+HqxEPNbKCsVpfMVcX+LLKOAiLXrHYHOHr3Vkl6a3s3hmjPLir1Ueh15HZJ0G1qN4NW XWuRcOqobet0uZqcnc88P70IH+2tmyuwrNWyxIbNzz2KIXYSFEW4oL6RrU44UxHy3NAp kYX+jek2nWJA4vwO/9sdKPhWuJtGJqFvapIdssbWg8eK0JfCWtIMRu4FZp5axMOgANYZ slAA== 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=AyMzuFY93xTKRHIIKh8B9jET5nFuolz+PkIcHLCVkok=; b=He1aOTWOq7vYYb4i6kwx1ypeup2y6ql4s7i3BH/d2D9sb6yHrpEEnwAB2UgHRMiZgu 9SE0a+eWNrnLdU+dSk2kem21XQmr1BSaFUyae535Uh9TNrl94WR6CsONEleM2hf9H4Ld csB3PvJMiCIlwczlRZ3GshVAr8KzsmmLRWdf4OxVdSxjlECjjMsv4JGiXeQJeLYCVYIM iMEVlUDSy7YbVRzno8Z9mrS77Dm2Ld0D47gPpllaHlEG+lReN6gsgdomAhXl09fVfowl 4qt7Q9vVYLhBVdsjTqGChd5nJAkfSni1n2Q+uwIbmy9gFDk0gTNbx5u6AvPjDk2zY1P8 vh1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fZdBRgid; 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 r1si3258505edp.303.2021.05.20.15.47.46; Thu, 20 May 2021 15:48:11 -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=fZdBRgid; 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 S236226AbhETLHS (ORCPT + 99 others); Thu, 20 May 2021 07:07:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:48144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238422AbhETKse (ORCPT ); Thu, 20 May 2021 06:48:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 17EE461CB4; Thu, 20 May 2021 09:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504725; bh=lnTHb0XBA1ZGFqlEoYHD66Ub6vmZTvOJipcheChA4+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZdBRgiddSkneXpCYE7d8+jWXc7JUkNleAWPzhrqDnlXzXAl6CCEmlHWcNg4p45bs tWxkCZqBq3czaZtt1uOHS09L6SQPPz8Mdl9x3Qvhpp3FddIAUK3n6+qqs4ALs2M1F+ OKHJ6RnWP1joVgttbLmG43F1Fvj3RZm2X/ITt08g= 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 4.9 035/240] media: em28xx: fix memory leak Date: Thu, 20 May 2021 11:20:27 +0200 Message-Id: <20210520092109.835948240@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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 b0aea48907b7..7e259be47252 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1967,6 +1967,7 @@ ret: return result; out_free: + em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE); kfree(dvb); dev->dvb = NULL; goto ret; -- 2.30.2