Merge tag 'usb-5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux-2.6-microblaze.git] / net / x25 / af_x25.c
index 3583354..3a17182 100644 (file)
@@ -1765,10 +1765,15 @@ void x25_kill_by_neigh(struct x25_neigh *nb)
 
        write_lock_bh(&x25_list_lock);
 
-       sk_for_each(s, &x25_list)
-               if (x25_sk(s)->neighbour == nb)
+       sk_for_each(s, &x25_list) {
+               if (x25_sk(s)->neighbour == nb) {
+                       write_unlock_bh(&x25_list_lock);
+                       lock_sock(s);
                        x25_disconnect(s, ENETUNREACH, 0, 0);
-
+                       release_sock(s);
+                       write_lock_bh(&x25_list_lock);
+               }
+       }
        write_unlock_bh(&x25_list_lock);
 
        /* Remove any related forwards */