Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4450634ioa; Wed, 27 Apr 2022 04:16:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVKgPy4OQ51O7NANGTnCPxtUMMs1C11BvXg9LVFjNnYPB7xE4XHdXyNzwtD0MIKBWNmPgk X-Received: by 2002:aa7:8256:0:b0:4e0:78ad:eb81 with SMTP id e22-20020aa78256000000b004e078adeb81mr29410407pfn.30.1651058178043; Wed, 27 Apr 2022 04:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651058178; cv=none; d=google.com; s=arc-20160816; b=tJpDOM4GC/Pq4eUZaMj28Rp4UPsPTyxJQe2oGo/V6PSUpEnpr/iqY1sNY9MsrLXIWv XFS7KwKawOsxHUF5qSnpwaAOqp6Crmglno8l8rqZtycYJDj1Fozct3DTdJfi2lf31S/T PKT5IOujBArEJNojDxHVV+tdg4DHGTD5I9Ur7HDgihwGB2G2+uc7kqozzauvv7NV8DR7 JYC2OVCkUjAVm9NAbSgeqCIYYFv2M3EuiXlpLYWLq1Qsq+NncxYAss3b6uAjiM5SV9w7 CptJCVxu37q5HwgxTbJVbVjXio867ZzhRGJIRJOYIaLLtnAmnYedcsMpM8aqq7PqCGob gJJQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LKMVajePCkLYTsdraPhfT8Y66xPcxgdHhTEjl6+Zw6c=; b=iwSTybjD0N860ZGXghpuA/YXI7hRoFbPr5gmZYHrCUag3w683HPXBBQ9N0HosDAX6P CGA1oyKxCusRYUjH7S0Jhe6xWKViA/g4iqvhLFRT7UBx+sxOs753MBuRipQ1aoLAAgnQ /wCQiE0mjvHyfIqCiDkrNxj1lGN9E7Tcu0qun5ZcZ3jdILZdpTcL2Y411/ZN06Tea4yT 1kb9DsWsEhoo/lqeEvaGKgbXuVzj2H3369mmu/l6Eu40RFhKjnKFOQU8X6TMuRsFZWTr NyuDNEzOfnIo4CzHqyzKWcsPRNx772tT51OdtmJi/HV/bDN0IA0UrzLC4bhxEgUxvcwU 9IFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GkFWtWhg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m4-20020a655644000000b0039d6e35354asi1270899pgs.170.2022.04.27.04.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:16:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GkFWtWhg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BC544302372; Wed, 27 Apr 2022 03:10:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244686AbiDZGJU (ORCPT + 99 others); Tue, 26 Apr 2022 02:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244682AbiDZGJS (ORCPT ); Tue, 26 Apr 2022 02:09:18 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C2D73C493; Mon, 25 Apr 2022 23:06:11 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id i62so3083887pgd.6; Mon, 25 Apr 2022 23:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LKMVajePCkLYTsdraPhfT8Y66xPcxgdHhTEjl6+Zw6c=; b=GkFWtWhghH/aU5YmVPJwx1tYmqzCheL7g82PjRfM2Ac6OF26X/DAjLyME/EF8VTZUb LjtodfwIVJiX2qwpsTrYdGw/TJ9uRyj3SwNTcM90ndrnryyCt3AhufuWhZwtsEgx0lcD hvH9eJU11TuUihuw6N8Wn1NmffAS6dg4Y1niWGjhXm4186QsNT7XfT95fm7YCkE4y5H/ QPMG+tTprovlO1s86pHoAQnynOW0FZYvECnIj1fDp5ieu/N7hbp4VoMUGQ3gCszE0aZo dFzCgxmpIHFNC8kdcvg85oXJu7a5P4dCkgoo1/75iJ772w+FYNX8jPixoUGpRM+KNQ0Z o0NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LKMVajePCkLYTsdraPhfT8Y66xPcxgdHhTEjl6+Zw6c=; b=5OrBq3BQ+3iw7THXTGwPce2yr5FPY7spaMS9CmQO7jF105J6NlYOToGpbY0XQkSYAw bbooXspatbeJibA20dsYVL1eE8LHSO85E5By/GYMhHRQmgx/mYMvKh2JVasJiKG2jbYm iDNjKIFnhhdCnlyq4gZm7kgJtllBkvHvW5Fd0zf4w+mgdfPxFfJ0W6X8Xj6WdppgIOFl tE81K2jtaCiv3nBCkRBf3ZXtNwJtSX9HgbWeMDF5gcuSit5C1Lp8HNeGJ7UDgMxQmzM3 2MfrXRP4bRH/QacxLTODnuuds5tYXi30dXPjqFlFW0mfFAASewzEHJq/94vUph/jM2K0 /Nmg== X-Gm-Message-State: AOAM531XZaxRl8St4xF7l7ggmCrvsuW19QeSiNnCu3AX1TKGqHf7nXNp 5nzjx59cNsKtEUIxM9K0Ats= X-Received: by 2002:a05:6a00:2402:b0:4e1:3df2:5373 with SMTP id z2-20020a056a00240200b004e13df25373mr22857741pfh.40.1650953171099; Mon, 25 Apr 2022 23:06:11 -0700 (PDT) Received: from localhost.localdomain ([103.84.139.165]) by smtp.gmail.com with ESMTPSA id k13-20020a056a00134d00b0050a5867dd73sm13969135pfu.157.2022.04.25.23.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 23:06:10 -0700 (PDT) From: Hangyu Hua To: bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, arnaud.pouliquen@foss.st.com Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Hangyu Hua Subject: [PATCH v2 2/3] rpmsg: virtio: fix possible double free in rpmsg_virtio_add_ctrl_dev() Date: Tue, 26 Apr 2022 14:05:35 +0800 Message-Id: <20220426060536.15594-3-hbh25y@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426060536.15594-1-hbh25y@gmail.com> References: <20220426060536.15594-1-hbh25y@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vch will be free in virtio_rpmsg_release_device() when rpmsg_ctrldev_register_device() fails. There is no need to call kfree() again. Fixes: c486682ae1e2 ("rpmsg: virtio: Register the rpmsg_char device") Signed-off-by: Hangyu Hua Tested-by: Arnaud Pouliquen --- drivers/rpmsg/virtio_rpmsg_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 0130d0ba548c..291fc1cfab7f 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -851,7 +851,7 @@ static struct rpmsg_device *rpmsg_virtio_add_ctrl_dev(struct virtio_device *vdev err = rpmsg_ctrldev_register_device(rpdev_ctrl); if (err) { - kfree(vch); + /* vch will be free in virtio_rpmsg_release_device() */ return ERR_PTR(err); } -- 2.25.1