aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-11-19 06:21:53 -0800
committerDavid S. Miller <davem@davemloft.net>2021-11-20 12:25:57 +0000
commitd07b26f5bbea9ade34dfd6abea7b3ca056c03cd1 (patch)
tree4a907941337e5445e0834277647ba4c04269523e /net/core/dev.c
parentnet: unexport dev_addr_init() & dev_addr_flush() (diff)
downloadlinux-d07b26f5bbea9ade34dfd6abea7b3ca056c03cd1.tar.gz
linux-d07b26f5bbea9ade34dfd6abea7b3ca056c03cd1.zip
dev_addr: add a modification check
netdev->dev_addr should only be modified via helpers, but someone may be casting off the const. Add a runtime check to catch abuses. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 92c9258cbf28..9219e319e901 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1377,6 +1377,7 @@ static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
int ret;
ASSERT_RTNL();
+ dev_addr_check(dev);
if (!netif_device_present(dev)) {
/* may be detached because parent is runtime-suspended */