mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
netlink: add validation function to policy
Add the ability to have an arbitrary validation function attached to a netlink policy that doesn't already use the validation_data pointer in another way. This can be useful to validate for example the content of a binary attribute, like in nl80211 the "(information) elements", which must be valid streams of "u8 type, u8 length, u8 value[length]". Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
3e48be05f3
commit
33188bd643
@@ -300,6 +300,13 @@ static int validate_nla(const struct nlattr *nla, int maxtype,
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
case NLA_VALIDATE_FUNCTION:
|
||||
if (pt->validate) {
|
||||
err = pt->validate(nla, extack);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user