From patchwork Tue Sep 1 15:08:40 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: 264628 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 381E1C433E7 for ; Tue, 1 Sep 2020 16:10:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FBB9204EC for ; Tue, 1 Sep 2020 16:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598976642; bh=zfO5Px0cuNgz5aYbaRY/cUP3auSyMfk+lJIYLA6LNuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mP7B6YOt8rc/969hN3IP1qdDETTOKvs67JAwQtsy0BYlORzGfSwBcLBr5bYbM50qJ oZc9BujYDJCjokpXPeJ5RE+CH4bLKrvsL+px8+NrvDAZorCkX5N7060bIYe9tWSeno r7xOxPb5nnbI525Ty6+AA1wwyTOgNwgGIKjKzivg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730217AbgIAQKO (ORCPT ); Tue, 1 Sep 2020 12:10:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:47556 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728313AbgIAPi1 (ORCPT ); Tue, 1 Sep 2020 11:38:27 -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 0131D20E65; Tue, 1 Sep 2020 15:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974707; bh=zfO5Px0cuNgz5aYbaRY/cUP3auSyMfk+lJIYLA6LNuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IwrVNMJwMxBrPHL+VQlNPifzf+2IYIZToPEoyjmVG7zojdx5lnrLtW5AYZXB+Vef8 rNdLbxw2BpzCVyzLQSLbdrQc4aRNYwN7kfKhnyXEzG1HDBYG8MYWnQ5yUvOJI8ABxf q3N74MIoVRPZ2iHkPlXHUcfFYCoFeS/B9hUAqaas= 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.8 064/255] media: davinci: vpif_capture: fix potential double free Date: Tue, 1 Sep 2020 17:08:40 +0200 Message-Id: <20200901151003.794449484@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901151000.800754757@linuxfoundation.org> References: <20200901151000.800754757@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 d9ec439faefa6..72a0e94e2e21a 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; }