diff options
-rw-r--r-- | net/socket.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/socket.c b/net/socket.c index fc74930f1443..5f374e1ff526 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1514,8 +1514,9 @@ asmlinkage long sys_sendto(int fd, void __user *buff, size_t len, | |||
1514 | struct file *sock_file; | 1514 | struct file *sock_file; |
1515 | 1515 | ||
1516 | sock_file = fget_light(fd, &fput_needed); | 1516 | sock_file = fget_light(fd, &fput_needed); |
1517 | err = -EBADF; | ||
1517 | if (!sock_file) | 1518 | if (!sock_file) |
1518 | return -EBADF; | 1519 | goto out; |
1519 | 1520 | ||
1520 | sock = sock_from_file(sock_file, &err); | 1521 | sock = sock_from_file(sock_file, &err); |
1521 | if (!sock) | 1522 | if (!sock) |
@@ -1542,6 +1543,7 @@ asmlinkage long sys_sendto(int fd, void __user *buff, size_t len, | |||
1542 | 1543 | ||
1543 | out_put: | 1544 | out_put: |
1544 | fput_light(sock_file, fput_needed); | 1545 | fput_light(sock_file, fput_needed); |
1546 | out: | ||
1545 | return err; | 1547 | return err; |
1546 | } | 1548 | } |
1547 | 1549 | ||
@@ -1573,12 +1575,13 @@ asmlinkage long sys_recvfrom(int fd, void __user *ubuf, size_t size, | |||
1573 | int fput_needed; | 1575 | int fput_needed; |
1574 | 1576 | ||
1575 | sock_file = fget_light(fd, &fput_needed); | 1577 | sock_file = fget_light(fd, &fput_needed); |
1578 | err = -EBADF; | ||
1576 | if (!sock_file) | 1579 | if (!sock_file) |
1577 | return -EBADF; | 1580 | goto out; |
1578 | 1581 | ||
1579 | sock = sock_from_file(sock_file, &err); | 1582 | sock = sock_from_file(sock_file, &err); |
1580 | if (!sock) | 1583 | if (!sock) |
1581 | goto out; | 1584 | goto out_put; |
1582 | 1585 | ||
1583 | msg.msg_control = NULL; | 1586 | msg.msg_control = NULL; |
1584 | msg.msg_controllen = 0; | 1587 | msg.msg_controllen = 0; |
@@ -1597,8 +1600,9 @@ asmlinkage long sys_recvfrom(int fd, void __user *ubuf, size_t size, | |||
1597 | if (err2 < 0) | 1600 | if (err2 < 0) |
1598 | err = err2; | 1601 | err = err2; |
1599 | } | 1602 | } |
1600 | out: | 1603 | out_put: |
1601 | fput_light(sock_file, fput_needed); | 1604 | fput_light(sock_file, fput_needed); |
1605 | out: | ||
1602 | return err; | 1606 | return err; |
1603 | } | 1607 | } |
1604 | 1608 | ||