Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nUSgd-0000RH-28 for mharc-grub-devel@gnu.org; Wed, 16 Mar 2022 08:23:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUSga-0000Lv-P1 for grub-devel@gnu.org; Wed, 16 Mar 2022 08:23:28 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3799) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUSgX-0000iD-Up for grub-devel@gnu.org; Wed, 16 Mar 2022 08:23:28 -0400 Received: from kwepemi500003.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KJTsh6nq7zfYwF; Wed, 16 Mar 2022 20:21:44 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by kwepemi500003.china.huawei.com (7.221.188.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Mar 2022 20:23:12 +0800 Received: from dggpeml500002.china.huawei.com (7.185.36.158) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Mar 2022 20:23:12 +0800 Received: from dggpeml500002.china.huawei.com ([7.185.36.158]) by dggpeml500002.china.huawei.com ([7.185.36.158]) with mapi id 15.01.2308.021; Wed, 16 Mar 2022 20:23:12 +0800 From: zhangqiumiao To: Daniel Kiper , Glenn Washburn CC: Qiumiao Zhang via Grub-devel , "Fengtao (fengtao, Euler)" , "Chenxiang (EulerOS)" , "Yanan (Euler)" Subject: Re: Re: [PATCH] net: fix null pointer dereference when parsing ICMP6_ROUTER_ADVERTISE messages Thread-Topic: Re: [PATCH] net: fix null pointer dereference when parsing ICMP6_ROUTER_ADVERTISE messages Thread-Index: Adg5L0PwSIk+hmDJTfeZVAoapBxfsQ== Date: Wed, 16 Mar 2022 12:23:12 +0000 Message-ID: <11a21716f44d4eb490830471cd214d7c@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.136.117.208] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.188; envelope-from=zhangqiumiao1@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Mar 2022 12:23:29 -0000 On Thu, Feb 17, 2022 at 03:32:52PM -0600, Glenn Washburn wrote: > On Thu, 17 Feb 2022 21:48:58 +0800 > Qiumiao Zhang via Grub-devel wrote: > > > During UEFI PXE boot in IPv6 network, if the DHCP server adopts=20 > > stateful automatic configuration, when the client receives the=20 > > ICMP6_ROUTER_ADVERTISE message multicast from the server, it will=20 > > cause the problem of dereference null pointer and cause the grub2 progr= am to crash. > > This commit message could be more clear. Maybe have something like: > > During UEFI PXE boot in IPv6 network, if the DHCP server adopts > stateful automatic configuration, then the client receives a > ICMP6_ROUTER_ADVERTISE multicast message from the server. This may be > received without the interfaced having a configured network address, > so orig_inf will be null, which can lead to a null dereference when > creating the default route. > Yes, that's a better description. > Of course, assuming that the above is in fact correct. > > > > > Fixes bug: https://savannah.gnu.org/bugs/index.php?62072 > > --- > > grub-core/net/icmp6.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c index=20 > > 2cbd95d..264fc4a 100644 > > --- a/grub-core/net/icmp6.c > > +++ b/grub-core/net/icmp6.c > > @@ -477,7 +477,7 @@ grub_net_recv_icmp6_packet (struct grub_net_buff=20 > > *nb, > > > > /* May not have gotten slaac info, find a global address on this > > card. */ > > - if (route_inf =3D=3D NULL) > > + if (route_inf =3D=3D NULL && orig_inf !=3D NULL) > > So if orig_inf =3D=3D NULL and route_inf =3D=3D NULL here, we do not set = a=20 > default route. Does this have any implications to be concerned about? > > In this case, can we still find a good route interface and setup a=20 > default route? If the DHCP server adopts stateful automatic configuration, the client obta= ins the default route through DHCPv6 instead of RA messages. So if orig_inf= =3D=3D NULL and route_inf =3D=3D null, we should not set the default route= . Qiumiao