pid: tighten pidmap spinlock critical section by removing kfree()
[safe/jmp/linux-2.6] / fs / smbfs / proc.c
index a5ced9e..71c29b6 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/stat.h>
 #include <linux/fcntl.h>
 #include <linux/dcache.h>
-#include <linux/dirent.h>
 #include <linux/nls.h>
 #include <linux/smp_lock.h>
 #include <linux/net.h>
@@ -510,7 +509,7 @@ date_unix2dos(struct smb_sb_info *server,
                month = 2;
        } else {
                nl_day = (year & 3) || day <= 59 ? day : day - 1;
-               for (month = 0; month < 12; month++)
+               for (month = 1; month < 12; month++)
                        if (day_n[month] > nl_day)
                                break;
        }
@@ -865,7 +864,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
                goto out;
 
        error = -EACCES;
-       if (current->uid != server->mnt->mounted_uid && 
+       if (current_uid() != server->mnt->mounted_uid &&
            !capable(CAP_SYS_ADMIN))
                goto out;
 
@@ -877,7 +876,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
                goto out_putf;
 
        server->sock_file = filp;
-       server->conn_pid = current->pid;
+       server->conn_pid = get_pid(task_pid(current));
        server->opt = *opt;
        server->generation += 1;
        server->state = CONN_VALID;
@@ -971,8 +970,8 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
        }
 
        VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n",
-               server->opt.protocol, server->opt.max_xmit, server->conn_pid,
-               server->opt.capabilities);
+               server->opt.protocol, server->opt.max_xmit,
+               pid_nr(server->conn_pid), server->opt.capabilities);
 
        /* FIXME: this really should be done by smbmount. */
        if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) {
@@ -2593,7 +2592,7 @@ smb_proc_getattr_ff(struct smb_sb_info *server, struct dentry *dentry,
        fattr->f_mtime.tv_sec = date_dos2unix(server, date, time);
        fattr->f_mtime.tv_nsec = 0;
        VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n",
-               mask, date, time, fattr->f_mtime);
+               mask, date, time, fattr->f_mtime.tv_sec);
        fattr->f_size = DVAL(req->rq_data, 12);
        /* ULONG allocation size */
        fattr->attr = WVAL(req->rq_data, 20);