// SPDX-License-Identifier: GPL-2.0/* * NETLINK Generic Netlink Family * * Authors: Jamal Hadi Salim * Thomas Graf <tgraf@suug.ch> * Johannes Berg <johannes@sipsolutions.net> */#include<linux/module.h>#include<linux/kernel.h>#include<linux/slab.h>#include<linux/errno.h>#include<linux/types.h>#include<linux/socket.h>#include<linux/string.h>#include<linux/skbuff.h>#include<linux/mutex.h>#include<linux/bitmap.h>#include<linux/rwsem.h>#include<linux/idr.h>#include<net/sock.h>#include<net/genetlink.h>staticDEFINE_MUTEX(genl_mutex);/* serialization of message processing */staticDECLARE_RWSEM(cb_lock);atomic_tgenl_sk_destructing_cnt=ATOMIC_INIT(0);DECLARE_WAIT_QUEUE_HEAD(genl_sk_destructing_waitq);voidgenl_lock(void){mutex_lock(&genl_mutex);}EXPORT_SYMBOL(genl_lock);voidgenl_unlock(void){mutex_unlock(&genl_mutex);}EXPORT_SYMBOL(genl_unlock);#ifdef CONFIG_LOCKDEPboollockdep_genl_is_held(void){returnlockdep_is_held(&genl_mutex);}EXPORT_SYMBOL(lockdep_genl_is_held);#endifstaticvoidgenl_lock_all(void){down_write(&cb_lock);genl_lock();}staticvoidgenl_unlock_all(void){genl_unlock();up_write(&cb_lock);}staticDEFINE_IDR(genl_fam_idr);/* * Bitmap of multicast groups that are currently in use. * * To avoid an allocation at boot of just one unsigned long, * declare it global instead. * Bit 0 is marked as already used since g