mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
qeth: Fix invalid router settings handling
Give a bad return code when specifying a router setting that is either invalid or not support on the respective device type. In addition, fall back the previous setting instead of silently switching back to 'no routing'. Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
82f77cf970
commit
82e2e782a3
2 changed files with 13 additions and 6 deletions
|
@ -623,7 +623,7 @@ static int qeth_l3_send_setrouting(struct qeth_card *card,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void qeth_l3_correct_routing_type(struct qeth_card *card,
|
||||
static int qeth_l3_correct_routing_type(struct qeth_card *card,
|
||||
enum qeth_routing_types *type, enum qeth_prot_versions prot)
|
||||
{
|
||||
if (card->info.type == QETH_CARD_TYPE_IQD) {
|
||||
|
@ -632,7 +632,7 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card,
|
|||
case PRIMARY_CONNECTOR:
|
||||
case SECONDARY_CONNECTOR:
|
||||
case MULTICAST_ROUTER:
|
||||
return;
|
||||
return 0;
|
||||
default:
|
||||
goto out_inval;
|
||||
}
|
||||
|
@ -641,17 +641,18 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card,
|
|||
case NO_ROUTER:
|
||||
case PRIMARY_ROUTER:
|
||||
case SECONDARY_ROUTER:
|
||||
return;
|
||||
return 0;
|
||||
case MULTICAST_ROUTER:
|
||||
if (qeth_is_ipafunc_supported(card, prot,
|
||||
IPA_OSA_MC_ROUTER))
|
||||
return;
|
||||
return 0;
|
||||
default:
|
||||
goto out_inval;
|
||||
}
|
||||
}
|
||||
out_inval:
|
||||
*type = NO_ROUTER;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int qeth_l3_setrouting_v4(struct qeth_card *card)
|
||||
|
@ -660,8 +661,10 @@ int qeth_l3_setrouting_v4(struct qeth_card *card)
|
|||
|
||||
QETH_CARD_TEXT(card, 3, "setrtg4");
|
||||
|
||||
qeth_l3_correct_routing_type(card, &card->options.route4.type,
|
||||
rc = qeth_l3_correct_routing_type(card, &card->options.route4.type,
|
||||
QETH_PROT_IPV4);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = qeth_l3_send_setrouting(card, card->options.route4.type,
|
||||
QETH_PROT_IPV4);
|
||||
|
@ -683,8 +686,10 @@ int qeth_l3_setrouting_v6(struct qeth_card *card)
|
|||
|
||||
if (!qeth_is_supported(card, IPA_IPV6))
|
||||
return 0;
|
||||
qeth_l3_correct_routing_type(card, &card->options.route6.type,
|
||||
rc = qeth_l3_correct_routing_type(card, &card->options.route6.type,
|
||||
QETH_PROT_IPV6);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = qeth_l3_send_setrouting(card, card->options.route6.type,
|
||||
QETH_PROT_IPV6);
|
||||
|
|
|
@ -87,6 +87,8 @@ static ssize_t qeth_l3_dev_route_store(struct qeth_card *card,
|
|||
rc = qeth_l3_setrouting_v6(card);
|
||||
}
|
||||
out:
|
||||
if (rc)
|
||||
route->type = old_route_type;
|
||||
mutex_unlock(&card->conf_mutex);
|
||||
return rc ? rc : count;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue