From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F033EE49A5 for ; Sun, 20 Aug 2023 00:13:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229576AbjHTANM convert rfc822-to-8bit (ORCPT ); Sat, 19 Aug 2023 20:13:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjHTAM7 (ORCPT ); Sat, 19 Aug 2023 20:12:59 -0400 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E9EC48D7; Sat, 19 Aug 2023 14:01:42 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 81DC4616B2CF; Sat, 19 Aug 2023 23:01:28 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id R-xTUNX53BfU; Sat, 19 Aug 2023 23:01:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id DC29761989EF; Sat, 19 Aug 2023 23:01:27 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id XlOXJxBLBgRp; Sat, 19 Aug 2023 23:01:27 +0200 (CEST) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id B585963DB7EA; Sat, 19 Aug 2023 23:01:27 +0200 (CEST) Date: Sat, 19 Aug 2023 23:01:27 +0200 (CEST) From: Richard Weinberger To: Minjie Du Cc: anton ivanov , Johannes Berg , Stephen Rothwell , linux-um , linux-kernel , bpf , opensource kernel Message-ID: <888265629.6490567.1692478887611.JavaMail.zimbra@nod.at> In-Reply-To: <20230706013911.695-1-duminjie@vivo.com> References: <20230706013911.695-1-duminjie@vivo.com> Subject: Re: [PATCH v4] um: vector: Fix exception handling in vector_eth_configure() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: vector: Fix exception handling in vector_eth_configure() Thread-Index: 4vytQNC34nzS2LWCFohj3c7c7cYvzA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Ursprüngliche Mail ----- > The resource cleanup was incomplete in the implementation > of the function "vector_eth_configure". > Thus replace the jump target > "out_undo_user_init" by "out_free_netdev". > Delate the orphan function "out_undo_user_init" > > PATCH v1-v3: Modify the patch format. > > Signed-off-by: Minjie Du > --- > arch/um/drivers/vector_kern.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c > index 131b7cb29..7ae6ab8df 100644 > --- a/arch/um/drivers/vector_kern.c > +++ b/arch/um/drivers/vector_kern.c > @@ -1646,7 +1646,7 @@ static void vector_eth_configure( > err = register_netdevice(dev); > rtnl_unlock(); > if (err) > - goto out_undo_user_init; > + goto out_free_netdev; > > spin_lock(&vector_devices_lock); > list_add(&device->list, &vector_devices); > @@ -1654,8 +1654,6 @@ static void vector_eth_configure( > > return; > > -out_undo_user_init: > - return; I don't think this is correct. vector_eth_configure() cannot communicate the failure since it is of type void. So, vector_remove() will run and will call unregister_netdev(). That can cause a double-free. Thanks, //richard