hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/net/ax25.h
....@@ -236,6 +236,7 @@
236236 #if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
237237 ax25_dama_info dama;
238238 #endif
239
+ refcount_t refcount;
239240 } ax25_dev;
240241
241242 typedef struct ax25_cb {
....@@ -290,6 +291,17 @@
290291 }
291292 }
292293
294
+static inline void ax25_dev_hold(ax25_dev *ax25_dev)
295
+{
296
+ refcount_inc(&ax25_dev->refcount);
297
+}
298
+
299
+static inline void ax25_dev_put(ax25_dev *ax25_dev)
300
+{
301
+ if (refcount_dec_and_test(&ax25_dev->refcount)) {
302
+ kfree(ax25_dev);
303
+ }
304
+}
293305 static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
294306 {
295307 skb->dev = dev;