hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/netdevice.h
....@@ -264,9 +264,11 @@
264264 * relationship HH alignment <= LL alignment.
265265 */
266266 #define LL_RESERVED_SPACE(dev) \
267
- ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
267
+ ((((dev)->hard_header_len + READ_ONCE((dev)->needed_headroom)) \
268
+ & ~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
268269 #define LL_RESERVED_SPACE_EXTRA(dev,extra) \
269
- ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
270
+ ((((dev)->hard_header_len + READ_ONCE((dev)->needed_headroom) + (extra)) \
271
+ & ~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
270272
271273 struct header_ops {
272274 int (*create) (struct sk_buff *skb, struct net_device *dev,
....@@ -749,8 +751,11 @@
749751 /* We only give a hint, preemption can change CPU under us */
750752 val |= raw_smp_processor_id();
751753
752
- if (table->ents[index] != val)
753
- table->ents[index] = val;
754
+ /* The following WRITE_ONCE() is paired with the READ_ONCE()
755
+ * here, and another one in get_rps_cpu().
756
+ */
757
+ if (READ_ONCE(table->ents[index]) != val)
758
+ WRITE_ONCE(table->ents[index], val);
754759 }
755760 }
756761
....@@ -1780,7 +1785,6 @@
17801785 * @tipc_ptr: TIPC specific data
17811786 * @atalk_ptr: AppleTalk link
17821787 * @ip_ptr: IPv4 specific data
1783
- * @dn_ptr: DECnet specific data
17841788 * @ip6_ptr: IPv6 specific data
17851789 * @ax25_ptr: AX.25 specific data
17861790 * @ieee80211_ptr: IEEE 802.11 specific data, assign before registering
....@@ -2059,9 +2063,6 @@
20592063 void *atalk_ptr;
20602064 #endif
20612065 struct in_device __rcu *ip_ptr;
2062
-#if IS_ENABLED(CONFIG_DECNET)
2063
- struct dn_dev __rcu *dn_ptr;
2064
-#endif
20652066 struct inet6_dev __rcu *ip6_ptr;
20662067 #if IS_ENABLED(CONFIG_AX25)
20672068 void *ax25_ptr;
....@@ -4513,6 +4514,24 @@
45134514 void __hw_addr_init(struct netdev_hw_addr_list *list);
45144515
45154516 /* Functions used for device addresses handling */
4517
+static inline void
4518
+__dev_addr_set(struct net_device *dev, const u8 *addr, size_t len)
4519
+{
4520
+ memcpy(dev->dev_addr, addr, len);
4521
+}
4522
+
4523
+static inline void dev_addr_set(struct net_device *dev, const u8 *addr)
4524
+{
4525
+ __dev_addr_set(dev, addr, dev->addr_len);
4526
+}
4527
+
4528
+static inline void
4529
+dev_addr_mod(struct net_device *dev, unsigned int offset,
4530
+ const u8 *addr, size_t len)
4531
+{
4532
+ memcpy(&dev->dev_addr[offset], addr, len);
4533
+}
4534
+
45164535 int dev_addr_add(struct net_device *dev, const unsigned char *addr,
45174536 unsigned char addr_type);
45184537 int dev_addr_del(struct net_device *dev, const unsigned char *addr,