Commit 32f8c9aa authored by David S. Miller's avatar David S. Miller

[NET]: Cleanup now that sockfd_lookup/sockfd_put are exported.

- Delete redefinitions of sockfd_{lookup,put}
- Fix socket fd leaks in route ioctl32 code.
parent a64cda04
...@@ -1664,20 +1664,11 @@ cmsg32_recvmsg_fixup (struct msghdr *kmsg, unsigned long orig_cmsg_uptr) ...@@ -1664,20 +1664,11 @@ cmsg32_recvmsg_fixup (struct msghdr *kmsg, unsigned long orig_cmsg_uptr)
kmsg->msg_control = (void *) orig_cmsg_uptr; kmsg->msg_control = (void *) orig_cmsg_uptr;
} }
static inline void
sockfd_put (struct socket *sock)
{
fput(sock->file);
}
/* XXX This really belongs in some header file... -DaveM */ /* XXX This really belongs in some header file... -DaveM */
#define MAX_SOCK_ADDR 128 /* 108 for Unix domain - #define MAX_SOCK_ADDR 128 /* 108 for Unix domain -
16 for IP, 16 for IPX, 16 for IP, 16 for IPX,
24 for IPv6, 24 for IPv6,
about 80 for AX.25 */ about 80 for AX.25 */
extern struct socket *sockfd_lookup (int fd, int *err);
/* /*
* BSD sendmsg interface * BSD sendmsg interface
*/ */
......
...@@ -2084,20 +2084,12 @@ verify_iovec32(struct msghdr *m, struct iovec *iov, char *address, int mode) ...@@ -2084,20 +2084,12 @@ verify_iovec32(struct msghdr *m, struct iovec *iov, char *address, int mode)
return err; return err;
} }
extern __inline__ void
sockfd_put(struct socket *sock)
{
fput(sock->file);
}
/* XXX This really belongs in some header file... -DaveM */ /* XXX This really belongs in some header file... -DaveM */
#define MAX_SOCK_ADDR 128 /* 108 for Unix domain - #define MAX_SOCK_ADDR 128 /* 108 for Unix domain -
16 for IP, 16 for IPX, 16 for IP, 16 for IPX,
24 for IPv6, 24 for IPv6,
about 80 for AX.25 */ about 80 for AX.25 */
extern struct socket *sockfd_lookup(int fd, int *err);
/* /*
* BSD sendmsg interface * BSD sendmsg interface
*/ */
......
...@@ -754,8 +754,6 @@ struct in6_rtmsg32 { ...@@ -754,8 +754,6 @@ struct in6_rtmsg32 {
s32 rtmsg_ifindex; s32 rtmsg_ifindex;
}; };
extern struct socket *sockfd_lookup(int fd, int *err);
static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
{ {
int ret; int ret;
...@@ -804,6 +802,9 @@ static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -804,6 +802,9 @@ static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
ret = sys_ioctl (fd, cmd, (long) r); ret = sys_ioctl (fd, cmd, (long) r);
set_fs (old_fs); set_fs (old_fs);
if (mysock)
sockfd_put(mysock);
return ret; return ret;
} }
......
...@@ -2891,13 +2891,6 @@ __inline__ struct cmsghdr32 *cmsg32_nxthdr (struct msghdr *__msg, ...@@ -2891,13 +2891,6 @@ __inline__ struct cmsghdr32 *cmsg32_nxthdr (struct msghdr *__msg,
__cmsg, __cmsg_len); __cmsg, __cmsg_len);
} }
extern struct socket *sockfd_lookup(int fd, int *err);
extern __inline__ void sockfd_put(struct socket *sock)
{
fput(sock->file);
}
static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg, struct msghdr32 *umsg) static inline int msghdr_from_user32_to_kern(struct msghdr *kmsg, struct msghdr32 *umsg)
{ {
u32 tmp1, tmp2, tmp3; u32 tmp1, tmp2, tmp3;
......
...@@ -2129,14 +2129,6 @@ asmlinkage int sys32_getrusage(int who, struct rusage32 *ru) ...@@ -2129,14 +2129,6 @@ asmlinkage int sys32_getrusage(int who, struct rusage32 *ru)
24 for IPv6, 24 for IPv6,
about 80 for AX.25 */ about 80 for AX.25 */
extern struct socket *sockfd_lookup(int fd, int *err);
/* XXX This as well... */
extern __inline__ void sockfd_put(struct socket *sock)
{
fput(sock->file);
}
struct msghdr32 { struct msghdr32 {
u32 msg_name; u32 msg_name;
int msg_namelen; int msg_namelen;
......
...@@ -797,8 +797,6 @@ struct in6_rtmsg32 { ...@@ -797,8 +797,6 @@ struct in6_rtmsg32 {
s32 rtmsg_ifindex; s32 rtmsg_ifindex;
}; };
extern struct socket *sockfd_lookup(int fd, int *err);
static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
{ {
int ret; int ret;
...@@ -847,6 +845,9 @@ static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -847,6 +845,9 @@ static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
ret = sys_ioctl (fd, cmd, (long) r); ret = sys_ioctl (fd, cmd, (long) r);
set_fs (old_fs); set_fs (old_fs);
if (mysock)
sockfd_put(mysock);
return ret; return ret;
} }
......
...@@ -2133,14 +2133,6 @@ asmlinkage int sys32_getrusage(int who, struct rusage32 *ru) ...@@ -2133,14 +2133,6 @@ asmlinkage int sys32_getrusage(int who, struct rusage32 *ru)
24 for IPv6, 24 for IPv6,
about 80 for AX.25 */ about 80 for AX.25 */
extern struct socket *sockfd_lookup(int fd, int *err);
/* XXX This as well... */
extern __inline__ void sockfd_put(struct socket *sock)
{
fput(sock->file);
}
struct msghdr32 { struct msghdr32 {
u32 msg_name; u32 msg_name;
int msg_namelen; int msg_namelen;
......
...@@ -715,8 +715,6 @@ struct in6_rtmsg32 { ...@@ -715,8 +715,6 @@ struct in6_rtmsg32 {
s32 rtmsg_ifindex; s32 rtmsg_ifindex;
}; };
extern struct socket *sockfd_lookup(int fd, int *err);
static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
{ {
int ret; int ret;
...@@ -765,6 +763,9 @@ static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -765,6 +763,9 @@ static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
ret = sys_ioctl (fd, cmd, (long) r); ret = sys_ioctl (fd, cmd, (long) r);
set_fs (old_fs); set_fs (old_fs);
if (mysock)
sockfd_put(mysock);
return ret; return ret;
} }
......
...@@ -7,14 +7,6 @@ ...@@ -7,14 +7,6 @@
24 for IPv6, 24 for IPv6,
about 80 for AX.25 */ about 80 for AX.25 */
extern struct socket *sockfd_lookup(int fd, int *err);
/* XXX This as well... */
extern __inline__ void sockfd_put(struct socket *sock)
{
fput(sock->file);
}
struct msghdr32 { struct msghdr32 {
u32 msg_name; u32 msg_name;
int msg_namelen; int msg_namelen;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment