Merge ~juliank/grub/+git/ubuntu:ofnet-bootpath-parser-fix into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Proposed by Julian Andres Klode
Status: Merged
Merge reported by: Mathieu Trudel-Lapierre
Merged at revision: 1959453bc10e2ad806c5219bb2fb6499dbfcf60b
Proposed branch: ~juliank/grub/+git/ubuntu:ofnet-bootpath-parser-fix
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu
Diff against target: 81 lines (+44/-4)
4 files modified
debian/.git-dpm (+2/-2)
debian/patches/ofnet-init-structs-in-bootpath-parser.patch (+39/-0)
debian/patches/series (+1/-0)
grub-core/net/drivers/ieee1275/ofnet.c (+2/-2)
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+353662@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

This was previously merged, marking it as such.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/.git-dpm b/debian/.git-dpm
2index c215732..d954250 100644
3--- a/debian/.git-dpm
4+++ b/debian/.git-dpm
5@@ -1,6 +1,6 @@
6 # see git-dpm(1) from git-dpm package
7-e501ac3fa71513f33d20e9b3d6ffbb8262274ea8
8-e501ac3fa71513f33d20e9b3d6ffbb8262274ea8
9+a6f3cf8f157b9f4d03229b007c94b9476b84a2d2
10+a6f3cf8f157b9f4d03229b007c94b9476b84a2d2
11 59aeb1cfaa3d5bfd7bbeeee0f0d37f6d9eed51fe
12 59aeb1cfaa3d5bfd7bbeeee0f0d37f6d9eed51fe
13 grub2_2.02+dfsg1.orig.tar.xz
14diff --git a/debian/patches/ofnet-init-structs-in-bootpath-parser.patch b/debian/patches/ofnet-init-structs-in-bootpath-parser.patch
15new file mode 100644
16index 0000000..cadd7bb
17--- /dev/null
18+++ b/debian/patches/ofnet-init-structs-in-bootpath-parser.patch
19@@ -0,0 +1,39 @@
20+From a6f3cf8f157b9f4d03229b007c94b9476b84a2d2 Mon Sep 17 00:00:00 2001
21+From: Julian Andres Klode <julian.klode@canonical.com>
22+Date: Thu, 23 Aug 2018 13:25:30 +0200
23+Subject: ofnet: Initialize structs in bootpath parser
24+
25+Code later on checks if variables inside the struct are
26+0 to see if they have been set, like if there were addresses
27+in the bootpath.
28+
29+The variables were not initialized however, so the check
30+might suceed with uninitialized data, and a new interface
31+with random addresses has been added. This caused a weird
32+bug in Ubuntu, because when booting from network, we now
33+had two interfaces with the same name, and net_default_mac
34+pointed to the random one.
35+
36+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1785859
37+Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
38+Patch-Name: ofnet-init-structs-in-bootpath-parser.patch
39+Forwarded: https://lists.gnu.org/archive/html/grub-devel/2018-08/msg00074.html
40+---
41+ grub-core/net/drivers/ieee1275/ofnet.c | 4 ++--
42+ 1 file changed, 2 insertions(+), 2 deletions(-)
43+
44+diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
45+index a78d164db..3a753658b 100644
46+--- a/grub-core/net/drivers/ieee1275/ofnet.c
47++++ b/grub-core/net/drivers/ieee1275/ofnet.c
48+@@ -154,8 +154,8 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
49+ char *equal_char = 0;
50+ grub_size_t field_counter = 0;
51+
52+- grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask;
53+- grub_net_link_level_address_t hw_addr;
54++ grub_net_network_level_address_t client_addr = {}, gateway_addr = {}, subnet_mask = {};
55++ grub_net_link_level_address_t hw_addr = {};
56+ grub_net_interface_flags_t flags = 0;
57+ struct grub_net_network_level_interface *inter = NULL;
58+
59diff --git a/debian/patches/series b/debian/patches/series
60index 59c3476..d4f1079 100644
61--- a/debian/patches/series
62+++ b/debian/patches/series
63@@ -86,3 +86,4 @@ bufio_sensible_block_sizes.patch
64 shorter_version_info.patch
65 skip_text_gfxpayload_where_not_supported.patch
66 add-an-auto-nvram-option-to-grub-install.patch
67+ofnet-init-structs-in-bootpath-parser.patch
68diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
69index a78d164..3a75365 100644
70--- a/grub-core/net/drivers/ieee1275/ofnet.c
71+++ b/grub-core/net/drivers/ieee1275/ofnet.c
72@@ -154,8 +154,8 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
73 char *equal_char = 0;
74 grub_size_t field_counter = 0;
75
76- grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask;
77- grub_net_link_level_address_t hw_addr;
78+ grub_net_network_level_address_t client_addr = {}, gateway_addr = {}, subnet_mask = {};
79+ grub_net_link_level_address_t hw_addr = {};
80 grub_net_interface_flags_t flags = 0;
81 struct grub_net_network_level_interface *inter = NULL;
82

Subscribers

People subscribed via source and target branches