@@ -124,6 +124,7 @@ static unsigned char bus_mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
124
124
125
125
/* Device structures */
126
126
static struct net_device * dev_lec [MAX_LEC_ITF ];
127
+ static DEFINE_MUTEX (lec_mutex );
127
128
128
129
#if IS_ENABLED (CONFIG_BRIDGE )
129
130
static void lec_handle_bridge (struct sk_buff * skb , struct net_device * dev )
@@ -685,6 +686,7 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
685
686
int bytes_left ;
686
687
struct atmlec_ioc ioc_data ;
687
688
689
+ lockdep_assert_held (& lec_mutex );
688
690
/* Lecd must be up in this case */
689
691
bytes_left = copy_from_user (& ioc_data , arg , sizeof (struct atmlec_ioc ));
690
692
if (bytes_left != 0 )
@@ -710,6 +712,7 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
710
712
711
713
static int lec_mcast_attach (struct atm_vcc * vcc , int arg )
712
714
{
715
+ lockdep_assert_held (& lec_mutex );
713
716
if (arg < 0 || arg >= MAX_LEC_ITF )
714
717
return - EINVAL ;
715
718
arg = array_index_nospec (arg , MAX_LEC_ITF );
@@ -725,6 +728,7 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)
725
728
int i ;
726
729
struct lec_priv * priv ;
727
730
731
+ lockdep_assert_held (& lec_mutex );
728
732
if (arg < 0 )
729
733
arg = 0 ;
730
734
if (arg >= MAX_LEC_ITF )
@@ -742,6 +746,7 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)
742
746
snprintf (dev_lec [i ]-> name , IFNAMSIZ , "lec%d" , i );
743
747
if (register_netdev (dev_lec [i ])) {
744
748
free_netdev (dev_lec [i ]);
749
+ dev_lec [i ] = NULL ;
745
750
return - EINVAL ;
746
751
}
747
752
@@ -1003,6 +1008,7 @@ static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1003
1008
return - ENOIOCTLCMD ;
1004
1009
}
1005
1010
1011
+ mutex_lock (& lec_mutex );
1006
1012
switch (cmd ) {
1007
1013
case ATMLEC_CTRL :
1008
1014
err = lecd_attach (vcc , (int )arg );
@@ -1017,6 +1023,7 @@ static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1017
1023
break ;
1018
1024
}
1019
1025
1026
+ mutex_unlock (& lec_mutex );
1020
1027
return err ;
1021
1028
}
1022
1029
0 commit comments