X25 remove bkl from causediag ioctls
authorandrew hendry <andrew.hendry@gmail.com>
Thu, 25 Nov 2010 02:18:43 +0000 (02:18 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Nov 2010 19:12:21 +0000 (11:12 -0800)
Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/x25/af_x25.c

index e2eea0aec466fa2d17c70db8fdfcddd9962d1a4d..8cfc419cef4b45a6f4f5361a70eac03f5ee374c9 100644 (file)
@@ -1538,23 +1538,22 @@ out_dtefac_release:
                }
 
                case SIOCX25GCAUSEDIAG: {
-                       struct x25_causediag causediag;
-                       lock_kernel();
-                       causediag = x25->causediag;
-                       rc = copy_to_user(argp, &causediag,
-                                         sizeof(causediag)) ? -EFAULT : 0;
-                       unlock_kernel();
+                       lock_sock(sk);
+                       rc = copy_to_user(argp, &x25->causediag,
+                                       sizeof(x25->causediag))
+                                       ? -EFAULT : 0;
+                       release_sock(sk);
                        break;
                }
 
                case SIOCX25SCAUSEDIAG: {
                        struct x25_causediag causediag;
                        rc = -EFAULT;
-                       lock_kernel();
                        if (copy_from_user(&causediag, argp, sizeof(causediag)))
                                break;
+                       lock_sock(sk);
                        x25->causediag = causediag;
-                       unlock_kernel();
+                       release_sock(sk);
                        rc = 0;
                        break;