From patchwork Tue Sep 1 15:09:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 310512 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB1B8C433E2 for ; Tue, 1 Sep 2020 15:29:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 888C720684 for ; Tue, 1 Sep 2020 15:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974169; bh=TajFQRDmtSBDvAbjV8hFef1jraq1/CpRJs8Ui/LFgC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FHkRyCyANAAsZOvVXrTptzu4EiSOhUlZvGCuLKi2lbw0YmEq5rDyBIuKP89Agp/G3 8LNt0RIgbcLP1cNQ/FqfKC3rA8ffsJznvSQSiBQj48vHfdkpntm/sJ1DNMYdqqg98/ 6I2ntWDNnu7d6sJQk14RUo/6qN1aAcGoPHOISZCI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729723AbgIAP3Z (ORCPT ); Tue, 1 Sep 2020 11:29:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:58546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730528AbgIAP3U (ORCPT ); Tue, 1 Sep 2020 11:29:20 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 315CE20684; Tue, 1 Sep 2020 15:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974159; bh=TajFQRDmtSBDvAbjV8hFef1jraq1/CpRJs8Ui/LFgC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wx3c4lUei1wNmSeCbQomEKGX2XUzQt0oB0oTZhcxBeLUaPxVaZ+utKXZe7Y4zDixo rIwjw1iHc2Q61/CQh0MEsfr1Za00/mUoH0FpICgRpOHZDxO3SoyeDgiw2DzPLx0p3A yrm/92DTNs3vzEMeJ4TWpbaWIKP2GbWpjZ5z+Jn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evgeny Novikov , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 060/214] media: davinci: vpif_capture: fix potential double free Date: Tue, 1 Sep 2020 17:09:00 +0200 Message-Id: <20200901150955.858876664@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150952.963606936@linuxfoundation.org> References: <20200901150952.963606936@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Evgeny Novikov [ Upstream commit 602649eadaa0c977e362e641f51ec306bc1d365d ] In case of errors vpif_probe_complete() releases memory for vpif_obj.sd and unregisters the V4L2 device. But then this is done again by vpif_probe() itself. The patch removes the cleaning from vpif_probe_complete(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/davinci/vpif_capture.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 71f4fe882d138..74f68ac3c9a75 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1482,8 +1482,6 @@ probe_out: /* Unregister video device */ video_unregister_device(&ch->video_dev); } - kfree(vpif_obj.sd); - v4l2_device_unregister(&vpif_obj.v4l2_dev); return err; }