Commit 00fe1ae9 authored by Eric Dumazet's avatar Eric Dumazet Committed by Patrick McHardy

netfilter: xt_rateest: fix xt_rateest_mt_checkentry()

commit 4a5a5c73 (slightly better error reporting) added some
useless code in xt_rateest_mt_checkentry().

Fix this so that different error codes can really be returned.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
CC: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 55f9c40f
...@@ -78,7 +78,7 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par) ...@@ -78,7 +78,7 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par)
{ {
struct xt_rateest_match_info *info = par->matchinfo; struct xt_rateest_match_info *info = par->matchinfo;
struct xt_rateest *est1, *est2; struct xt_rateest *est1, *est2;
int ret = false; int ret = -EINVAL;
if (hweight32(info->flags & (XT_RATEEST_MATCH_ABS | if (hweight32(info->flags & (XT_RATEEST_MATCH_ABS |
XT_RATEEST_MATCH_REL)) != 1) XT_RATEEST_MATCH_REL)) != 1)
...@@ -101,13 +101,12 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par) ...@@ -101,13 +101,12 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par)
if (!est1) if (!est1)
goto err1; goto err1;
est2 = NULL;
if (info->flags & XT_RATEEST_MATCH_REL) { if (info->flags & XT_RATEEST_MATCH_REL) {
est2 = xt_rateest_lookup(info->name2); est2 = xt_rateest_lookup(info->name2);
if (!est2) if (!est2)
goto err2; goto err2;
} else }
est2 = NULL;
info->est1 = est1; info->est1 = est1;
info->est2 = est2; info->est2 = est2;
...@@ -116,7 +115,7 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par) ...@@ -116,7 +115,7 @@ static int xt_rateest_mt_checkentry(const struct xt_mtchk_param *par)
err2: err2:
xt_rateest_put(est1); xt_rateest_put(est1);
err1: err1:
return -EINVAL; return ret;
} }
static void xt_rateest_mt_destroy(const struct xt_mtdtor_param *par) static void xt_rateest_mt_destroy(const struct xt_mtdtor_param *par)
......
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