diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2021-03-16 10:00:44 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2021-03-17 10:02:09 +0100 |
commit | 0f8fe3c76b9ecdf52c1690295f7dcc7b7ade16b6 (patch) | |
tree | 19a4ebbff0d30be6bdbd0dd9244e5062b791a4ed /src/nm-initrd-generator/nmi-cmdline-reader.c | |
parent | 9c0c0ac966cb4dddaeba72580edc20c777280858 (diff) | |
download | NetworkManager-bg/initrd-znet-empty.tar.gz |
initrd: fix crash parsing empty rd.znet argumentbg/initrd-znet-empty
Ignore a rd.znet argument without subchannels. When using net.ifnames
(the default), subchannels are used to build the interface name, which
is required to match the right connection.
With net.ifnames=0 the interface name is build using a prefix and a
global counter and therefore in theory it is possible to omit
subchannels. However, without subchannels there won't be a udev rule
that renames the interface and so it can't work.
https://bugzilla.redhat.com/show_bug.cgi?id=1931284
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/783
Diffstat (limited to 'src/nm-initrd-generator/nmi-cmdline-reader.c')
-rw-r--r-- | src/nm-initrd-generator/nmi-cmdline-reader.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nm-initrd-generator/nmi-cmdline-reader.c b/src/nm-initrd-generator/nmi-cmdline-reader.c index d6b84c2e57..37f3f51c3d 100644 --- a/src/nm-initrd-generator/nmi-cmdline-reader.c +++ b/src/nm-initrd-generator/nmi-cmdline-reader.c @@ -924,6 +924,11 @@ reader_parse_rd_znet(Reader *reader, char *argument, gboolean net_ifnames) subchannels[0] = get_word(&argument, ','); subchannels[1] = get_word(&argument, ','); + /* Without subchannels we can't univocally match + * a device. */ + if (!subchannels[0] || !subchannels[1]) + return; + if (nm_streq0(nettype, "ctc")) { if (net_ifnames == TRUE) { prefix = "sl"; |