]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ipv4: Check !in_dev earlier for ioctl(SIOCSIFADDR).
authorKuniyuki Iwashima <kuniyu@amazon.com>
Fri, 9 Aug 2024 23:54:02 +0000 (16:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:26 +0000 (15:11 +0200)
commitbabfc87445bf6ba9d9e6dadac39fabcb13050a57
treeca651758c448fbe9f174adf5a656b211675deceb
parent4fd17b6152a40ec66b86e20632fd3a2eab3e10e9
ipv4: Check !in_dev earlier for ioctl(SIOCSIFADDR).

[ Upstream commit e3af3d3c5b26c33a7950e34e137584f6056c4319 ]

dev->ip_ptr could be NULL if we set an invalid MTU.

Even then, if we issue ioctl(SIOCSIFADDR) for a new IPv4 address,
devinet_ioctl() allocates struct in_ifaddr and fails later in
inet_set_ifa() because in_dev is NULL.

Let's move the check earlier.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20240809235406.50187-2-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/devinet.c