unexport sock_map_fd(), switch to sock_alloc_file()
Both modular callers of sock_map_fd() had been buggy; sctp one leaks descriptor and file if copy_to_user() fails, 9p one shouldn't be exposing file in the descriptor table at all. Switch both to sock_alloc_file(), export it, unexport sock_map_fd() and make it static. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -65,6 +65,7 @@ typedef enum {
|
||||
struct poll_table_struct;
|
||||
struct pipe_inode_info;
|
||||
struct inode;
|
||||
struct file;
|
||||
struct net;
|
||||
|
||||
#define SOCK_ASYNC_NOSPACE 0
|
||||
@@ -246,7 +247,7 @@ extern int sock_sendmsg(struct socket *sock, struct msghdr *msg,
|
||||
size_t len);
|
||||
extern int sock_recvmsg(struct socket *sock, struct msghdr *msg,
|
||||
size_t size, int flags);
|
||||
extern int sock_map_fd(struct socket *sock, int flags);
|
||||
extern struct file *sock_alloc_file(struct socket *sock, int flags);
|
||||
extern struct socket *sockfd_lookup(int fd, int *err);
|
||||
extern struct socket *sock_from_file(struct file *file, int *err);
|
||||
#define sockfd_put(sock) fput(sock->file)
|
||||
|
Reference in New Issue
Block a user