mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
[NETLINK]: attr: add nested compat attribute type
Add a nested compat attribute type that can be used to convert attributes that contain a structure to nested attributes in a backwards compatible way. Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
334a8132d9
commit
1092cb2197
2 changed files with 95 additions and 0 deletions
|
|
@ -72,6 +72,17 @@ static int validate_nla(struct nlattr *nla, int maxtype,
|
|||
return -ERANGE;
|
||||
break;
|
||||
|
||||
case NLA_NESTED_COMPAT:
|
||||
if (attrlen < pt->len)
|
||||
return -ERANGE;
|
||||
if (attrlen < NLA_ALIGN(pt->len))
|
||||
break;
|
||||
if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN)
|
||||
return -ERANGE;
|
||||
nla = nla_data(nla) + NLA_ALIGN(pt->len);
|
||||
if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN + nla_len(nla))
|
||||
return -ERANGE;
|
||||
break;
|
||||
default:
|
||||
if (pt->len)
|
||||
minlen = pt->len;
|
||||
|
|
|
|||
Loading…
Reference in a new issue