瀏覽代碼

[NET]: sockfd_lookup_light() returns random error for -EBADFD

This applies to 2.6.17-rc2.

There is a missing initialization of err in sockfd_lookup_light() that
could return random error for an invalid file handle.

Signed-off-by: Hua Zhong <hzhong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Hua Zhong 19 年之前
父節點
當前提交
3672558c61
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      net/socket.c

+ 1 - 0
net/socket.c

@@ -490,6 +490,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)
 	struct file *file;
 	struct socket *sock;
 
+	*err = -EBADF;
 	file = fget_light(fd, fput_needed);
 	if (file) {
 		sock = sock_from_file(file, err);