patch for 2.1.88 smbfs proc.c

Bill Hawes (whawes@star.net)
Mon, 02 Mar 1998 09:43:34 -0500


This is a multi-part message in MIME format.
--------------F08FE6529F05FD94BE1155D8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The attached patch for 2.1.88 smbfs/proc.c replaces a reference to file->fd[]
with fget().

Regards,
Bill
--------------F08FE6529F05FD94BE1155D8
Content-Type: text/plain; charset=us-ascii; name="smbfs_88-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="smbfs_88-patch"

--- linux-2.1.88/fs/smbfs/proc.c.old Sat Jan 24 10:13:16 1998
+++ linux-2.1.88/fs/smbfs/proc.c Sun Mar 1 10:24:22 1998
@@ -9,10 +9,11 @@
* by Riccardo Facchetti
*/

-#include <linux/fs.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/malloc.h>
+#include <linux/fs.h>
+#include <linux/file.h>
#include <linux/stat.h>
#include <linux/fcntl.h>
#include <linux/dcache.h>
@@ -621,31 +622,26 @@
#ifdef SMBFS_DEBUG_VERBOSE
printk("smb_newconn: fd=%d, pid=%d\n", opt->fd, current->pid);
#endif
- error = -EBADF;
- if (opt->fd < 0 || opt->fd >= NR_OPEN)
- goto out;
- if (!(filp = current->files->fd[opt->fd]))
- goto out;
- if (!smb_valid_socket(filp->f_dentry->d_inode))
- goto out;
-
- error = -EACCES;
- if ((current->uid != server->mnt->mounted_uid) && !suser())
- goto out;
-
/*
* Make sure we don't already have a pid ...
*/
error = -EINVAL;
if (server->conn_pid)
- {
- printk("SMBFS: invalid ioctl call\n");
goto out;
- }
- server->conn_pid = current->pid;

- filp->f_count += 1;
+ error = -EACCES;
+ if (current->uid != server->mnt->mounted_uid && !suser())
+ goto out;
+
+ error = -EBADF;
+ filp = fget(opt->fd);
+ if (!filp)
+ goto out;
+ if (!smb_valid_socket(filp->f_dentry->d_inode))
+ goto out_putf;
+
server->sock_file = filp;
+ server->conn_pid = current->pid;
smb_catch_keepalive(server);
server->opt = *opt;
server->generation += 1;
@@ -659,6 +655,10 @@
out:
wake_up_interruptible(&server->wait);
return error;
+
+out_putf:
+ fput(filp);
+ goto out;
}

/* smb_setup_header: We completely set up the packet. You only have to

--------------F08FE6529F05FD94BE1155D8--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu