--- ip_vs_ctl.c 6 Sep 2002 01:16:26 -0000 +++ ip_vs_ctl.c 7 Nov 2002 10:27:00 -0000 @@ -1922,10 +1922,14 @@ sprintf(buf, "IP Virtual Server version %d.%d.%d (size=%d)", NVERSION(IP_VS_VERSION_CODE), IP_VS_CONN_TAB_SIZE); - if (*len < strlen(buf)+1) - return -EINVAL; - if (copy_to_user(user, buf, strlen(buf)+1) != 0) - return -EFAULT; + if (*len < strlen(buf)+1) { + ret = -EINVAL; + break; + } + if (copy_to_user(user, buf, strlen(buf)+1) != 0) { + ret = -EFAULT; + break; + } *len = strlen(buf)+1; } break; @@ -1937,7 +1941,7 @@ info.size = IP_VS_CONN_TAB_SIZE; info.num_services = ip_vs_num_services; if (copy_to_user(user, &info, sizeof(info)) != 0) - return -EFAULT; + ret = -EFAULT; } break; @@ -1947,14 +1951,18 @@ if (*len < sizeof(get)) { IP_VS_ERR("length: %u < %u\n", *len, sizeof(get)); - return -EINVAL; + ret = -EINVAL; + break; + } + if (copy_from_user(&get, user, sizeof(get))) { + ret = -EFAULT; + break; } - if (copy_from_user(&get, user, sizeof(get))) - return -EFAULT; if (*len != (sizeof(get)+sizeof(struct ip_vs_service_user)*get.num_services)) { IP_VS_ERR("length: %u != %u\n", *len, sizeof(get)+sizeof(struct ip_vs_service_user)*get.num_services); - return -EINVAL; + ret = -EINVAL; + break; } ret = __ip_vs_get_service_entries(&get, user); } @@ -1967,10 +1975,13 @@ if (*len != sizeof(get)) { IP_VS_ERR("length: %u != %u\n", *len, sizeof(get)); - return -EINVAL; + ret = -EINVAL; + break; + } + if (copy_from_user(&get, user, sizeof(get))) { + ret = -EFAULT; + break; } - if (copy_from_user(&get, user, sizeof(get))) - return -EFAULT; if (get.fwmark) svc = __ip_vs_svc_fwm_get(get.fwmark); @@ -1998,7 +2009,8 @@ if (*len < sizeof(get)) { IP_VS_ERR("length: %u < %u\n", *len, sizeof(get)); - return -EINVAL; + ret = -EINVAL; + break; } if (copy_from_user(&get, user, sizeof(get))) return -EFAULT; @@ -2006,7 +2018,8 @@ sizeof(struct ip_vs_dest_user)*get.num_dests)) { IP_VS_ERR("length: %u != %u\n", *len, sizeof(get)+sizeof(struct ip_vs_dest_user)*get.num_dests); - return -EINVAL; + ret = -EINVAL; + break; } ret = __ip_vs_get_dest_entries(&get, user); } @@ -2018,7 +2031,7 @@ if (*len < sizeof(u)) { IP_VS_ERR("length: %u < %u\n", *len, sizeof(u)); - return -EINVAL; + ret = -EINVAL; } __ip_vs_get_timeouts(&u); if (copy_to_user(user, &u, sizeof(u)) != 0) @@ -2032,7 +2045,8 @@ if (*len < sizeof(u)) { IP_VS_ERR("length: %u < %u\n", *len, sizeof(u)); - return -EINVAL; + ret = -EINVAL; + break; } u.state = ip_vs_sync_state; strcpy(u.mcast_ifn, ip_vs_mcast_ifn);