Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp643008rdb; Sat, 19 Aug 2023 17:58:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlGMQ/96/KNZkIsgf8TyrOWNke1cE0zlP8Afz+rYD6gullQzTHWjnkolNdW7HlytVQnUOa X-Received: by 2002:a05:6870:830e:b0:1bf:43d2:526c with SMTP id p14-20020a056870830e00b001bf43d2526cmr4552904oae.15.1692493131356; Sat, 19 Aug 2023 17:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692493131; cv=none; d=google.com; s=arc-20160816; b=cYp0/Yhse290k3Fy3ECGee/HONe5bBHSKbCSbWLSVjJ8n2l3gLVLfvSF+TumMRTPG7 BJxhVANURptLSgx0mOi80pI29mRFAHfuPQfKN6LU685nIbpNoOFG9YQiY1RL6V1e/wTQ MKU9MOlVlRa9oAJtZN3FeXQ2F1xaOJcS8TMTxG39xSKWXRY61ajPh3x6VGw8Zfd3Ns+8 KCRdZPonaRJMa2TGEppjk61Re+O/7tvDFN67Ly54Y/EZ6Rpup4yGJNY/1l6jv51qZkxa VY9wmhG1nVHFWtBsteF5+ZRWADnLLV5kv9SwqvV7ihbVR3IgRlDkveQWCjTcRvdLywZY HDSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=9T3XUf3/S3tKYrftdrTRx1HN3mdWhO0/Am74w6gbAfA=; fh=YbXCETN7uz00Xh9E+PIYjUEUNAlD+0JwMX6W6W03ZLU=; b=OIpAN1NZWCTXSBtqSt/cRx6snHdAiTwBixbQ3F59GW8JrXkaA53CGUBYodV1v+N/S+ en9im+ytL9S3E3F/bj8vmuKkIfYKXAf+vJsylAZShqdWuanzwjSAoneweR2ObfyfS0Nx 141TEM1dQ9AvqT/J440cizqZRbYG+PuQzfk6xh/1QnUKTPc6VSf55+i1BfPOE30HfcL5 fxY6CoEf7nWlpLPIPkUG2PtTtVoAJQYCxSzqHYGDQCzb+d5ySRMrpTSHBrEtS6orSYhf VYjpHFdNpdw8pPvBLP+UNxDgjhV6EheDB4OhQCGlvTFw0sY7jCaoyVfz2UGDLt42DEg5 dK0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk3-20020a17090b080300b0025bc95b20b8si5882340pjb.15.2023.08.19.17.58.39; Sat, 19 Aug 2023 17:58:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229569AbjHTANM convert rfc822-to-8bit (ORCPT + 99 others); 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== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,PDS_BAD_THREAD_QP_64, SPF_HELO_NONE,T_SPF_PERMERROR autolearn=ham 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 ----- 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