summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2016-12-13 22:30:15 +0300
committerDavid S. Miller <davem@davemloft.net>2016-12-13 14:54:44 -0500
commit3e1ed981b7a903ba81199d4d25b80c6bba705160 (patch)
tree1ea2510d8302182ef99c1fd48ca3bdcdd90c2c2d /include/net
parenta220871be66f99d8957c693cf22ec67ecbd9c23a (diff)
downloadlinux-3e1ed981b7a903ba81199d4d25b80c6bba705160.tar.bz2
netlink: revert broken, broken "2-clause nla_ok()"
Commit 4f7df337fe79bba1e4c2d525525d63b5ba186bbd "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>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netlink.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h
index dd657a33f8c3..d3938f11ae52 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -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;
}