netlink: revert broken, broken "2-clause nla_ok()"
Commit 4f7df337fe
"netlink: 2-clause nla_ok()" is BROKEN.
First clause tests if "->nla_len" could even be accessed at all,
it can not possibly be omitted.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a220871be6
commit
3e1ed981b7
1 changed files with 2 additions and 1 deletions
|
@ -698,7 +698,8 @@ static inline int nla_len(const struct nlattr *nla)
|
|||
*/
|
||||
static inline int nla_ok(const struct nlattr *nla, int remaining)
|
||||
{
|
||||
return nla->nla_len >= sizeof(*nla) &&
|
||||
return remaining >= (int) sizeof(*nla) &&
|
||||
nla->nla_len >= sizeof(*nla) &&
|
||||
nla->nla_len <= remaining;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue