Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10111416ybi; Wed, 24 Jul 2019 16:15:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdwgagtIVKIcBEeJ8nLKRp77UmKG6jtXKj5+pD64RrirXbb9MaFZx548nV3ZoYN46LaChS X-Received: by 2002:a17:90a:ba93:: with SMTP id t19mr88558618pjr.139.1564010119855; Wed, 24 Jul 2019 16:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564010119; cv=none; d=google.com; s=arc-20160816; b=HTz0j6bSIS/RGlO+H/nLdTIT1fvq2k3O886pvzbjAw0A4pb5i9As8C7gVSNvvZPVba we7eaUPnuw2mNp7utDmp1lSXOGYyjiYxrfB3zkKV7TRdqXz2DAdC8ZQVKbtJRfK8RA7J fZeRNSvAZe5p3Fj7MJgp9cNzUluqAfeznqGEb7pXIxTHMU3yNczvk5bRLfvzoM4hkeWP z+aAmSrI0SJJQt4pxsjGg15uUbF1uS9txKQLU72X7h0bJLJPPjv2LnkR8I0GCZdY/W09 GJL7Vin0ZuDMonslljZw2BSLODLl/1u4MaOIuvBLuBw7V4SvHJBk2UrAMvN7YtrNQibK aEfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XeWgfSUpk+65c0c6bhEZpp27ywBbBBEHPWMZTwRuTDY=; b=lIIWiRAD+Uur9p2WY6TDC5BzME67md6I0JOUqiP9Yj9QgQe9gFN674f5EjewYMrllI eFNoZ9r2G/hGyn3CfhDUv+AHOiJHIBsgSc4oGxqQh6fOXha+hVtNjXn+mMP8ceQA0oZY Hg07l1O+9OkvRC+R3lI35mY62V1PZJm7317+71MFqntRIV+Fo9VCXBW6Dq7+Ygj5nhCx QuMhJDCO6q/29m16L4vRyBURvlfLRwTNAC3AODfVTJMfkhs0l+4mg/sgDNA2sWVDQgnN O2UWPBhiauHVQtAeQ8rctfgQkRO3rvjGS2tS4lW9y2yYVGv0F5NR8Zvr8YVn7ImLwg5C K3Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ve89iJQ3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a186si14734822pge.365.2019.07.24.16.15.04; Wed, 24 Jul 2019 16:15:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ve89iJQ3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729146AbfGXTZH (ORCPT + 99 others); Wed, 24 Jul 2019 15:25:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:41600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727884AbfGXTZC (ORCPT ); Wed, 24 Jul 2019 15:25:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93A68218EA; Wed, 24 Jul 2019 19:25:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996302; bh=9VSPAULSkYkmOOckj8slrEPHJhxuOoc1hLA0TxgAhFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ve89iJQ3mcY8Hqzf19yJWUcr6oja42dg/OgNg1NY4lEkjtwUw6Dw/Qm2689Ctm+TF 9RVTQbY3keYNkc8vfdVYnjIP5Q71rRdPhiRp+NxgiNdbZhId8ZK0EpliDuJAWdje3r varmHu+mgs50CqWS2ladFw6fMn4Oiyxoh6U3wKBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shailendra Verma , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.2 050/413] media: staging: media: davinci_vpfe: - Fix for memory leak if decoder initialization fails. Date: Wed, 24 Jul 2019 21:15:41 +0200 Message-Id: <20190724191739.085922740@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 6995a659101bd4effa41cebb067f9dc18d77520d ] Fix to avoid possible memory leak if the decoder initialization got failed.Free the allocated memory for file handle object before return in case decoder initialization fails. Signed-off-by: Shailendra Verma Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/davinci_vpfe/vpfe_video.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 510202a3b091..84cca18e3e9d 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -419,6 +419,9 @@ static int vpfe_open(struct file *file) /* If decoder is not initialized. initialize it */ if (!video->initialized && vpfe_update_pipe_state(video)) { mutex_unlock(&video->lock); + v4l2_fh_del(&handle->vfh); + v4l2_fh_exit(&handle->vfh); + kfree(handle); return -ENODEV; } /* Increment device users counter */ -- 2.20.1