mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
net: fix nla_strcmp to handle more then one trailing null character
[ Upstream commit2c16db6c92
] Android userspace has been using TCA_KIND with a char[IFNAMESIZ] many-null-terminated buffer containing the string 'bpf'. This works on 4.19 and ceases to work on 5.10. I'm not entirely sure what fixes tag to use, but I think the issue was likely introduced in the below mentioned 5.4 commit. Reported-by: Nucca Chen <nuccachen@google.com> Cc: Cong Wang <xiyou.wangcong@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: David S. Miller <davem@davemloft.net> Cc: Jakub Kicinski <jakub.kicinski@netronome.com> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: Jiri Pirko <jiri@mellanox.com> Cc: Jiri Pirko <jiri@resnulli.us> Fixes:62794fc4fb
("net_sched: add max len check for TCA_KIND") Change-Id: I66dc281f165a2858fc29a44869a270a2d698a82b Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
235c477d49
commit
f482637f73
1 changed files with 1 additions and 1 deletions
|
@ -316,7 +316,7 @@ int nla_strcmp(const struct nlattr *nla, const char *str)
|
||||||
int attrlen = nla_len(nla);
|
int attrlen = nla_len(nla);
|
||||||
int d;
|
int d;
|
||||||
|
|
||||||
if (attrlen > 0 && buf[attrlen - 1] == '\0')
|
while (attrlen > 0 && buf[attrlen - 1] == '\0')
|
||||||
attrlen--;
|
attrlen--;
|
||||||
|
|
||||||
d = attrlen - len;
|
d = attrlen - len;
|
||||||
|
|
Loading…
Reference in a new issue