Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=67b23219ce2f78352b0c566a472ff16c1b0fea9a
Commit:     67b23219ce2f78352b0c566a472ff16c1b0fea9a
Parent:     3becd578c5c9aafde6f562bb1dfe20d420bce6e8
Author:     Julia Lawall <[EMAIL PROTECTED]>
AuthorDate: Mon Jan 7 22:38:42 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 15:00:48 2008 -0800

    [BLUETOOTH]: Use sockfd_put()
    
    The function sockfd_lookup uses fget on the value that is stored in
    the file field of the returned structure, so fput should ultimately be
    applied to this value.  This can be done directly, but it seems better
    to use the specific macro sockfd_put, which does the same thing.
    
    The problem was fixed using the following semantic patch.
    (http://www.emn.fr/x-info/coccinelle/)
    
    // <smpl>
    @@
    expression s;
    @@
    
       s = sockfd_lookup(...)
       ...
    +  sockfd_put(s);
    ?- fput(s->file);
    // </smpl>
    
    Signed-off-by: Julia Lawall <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/bluetooth/bnep/sock.c |    4 ++--
 net/bluetooth/cmtp/sock.c |    4 ++--
 net/bluetooth/hidp/sock.c |   10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
index 9ebd3c6..81065e5 100644
--- a/net/bluetooth/bnep/sock.c
+++ b/net/bluetooth/bnep/sock.c
@@ -94,7 +94,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int 
cmd, unsigned long
                        return err;
 
                if (nsock->sk->sk_state != BT_CONNECTED) {
-                       fput(nsock->file);
+                       sockfd_put(nsock);
                        return -EBADFD;
                }
 
@@ -103,7 +103,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned 
int cmd, unsigned long
                        if (copy_to_user(argp, &ca, sizeof(ca)))
                                err = -EFAULT;
                } else
-                       fput(nsock->file);
+                       sockfd_put(nsock);
 
                return err;
 
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 783edab..8c7f7bc 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -88,7 +88,7 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int 
cmd, unsigned long
                        return err;
 
                if (nsock->sk->sk_state != BT_CONNECTED) {
-                       fput(nsock->file);
+                       sockfd_put(nsock);
                        return -EBADFD;
                }
 
@@ -97,7 +97,7 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int 
cmd, unsigned long
                        if (copy_to_user(argp, &ca, sizeof(ca)))
                                err = -EFAULT;
                } else
-                       fput(nsock->file);
+                       sockfd_put(nsock);
 
                return err;
 
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
index 3292b95..f4dd02c 100644
--- a/net/bluetooth/hidp/sock.c
+++ b/net/bluetooth/hidp/sock.c
@@ -86,13 +86,13 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned 
int cmd, unsigned long
 
                isock = sockfd_lookup(ca.intr_sock, &err);
                if (!isock) {
-                       fput(csock->file);
+                       sockfd_put(csock);
                        return err;
                }
 
                if (csock->sk->sk_state != BT_CONNECTED || isock->sk->sk_state 
!= BT_CONNECTED) {
-                       fput(csock->file);
-                       fput(isock->file);
+                       sockfd_put(csock);
+                       sockfd_put(isock);
                        return -EBADFD;
                }
 
@@ -101,8 +101,8 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned 
int cmd, unsigned long
                        if (copy_to_user(argp, &ca, sizeof(ca)))
                                err = -EFAULT;
                } else {
-                       fput(csock->file);
-                       fput(isock->file);
+                       sockfd_put(csock);
+                       sockfd_put(isock);
                }
 
                return err;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to