net: fix nla_strcmp to handle more then one trailing null character
Subsystems (3)
PATCH 1/1 net: fix nla_strcmp to handle more then one trailing null character
From: Maciej Żenczykowski <[email protected]>
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.
--- lib/nlattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/nlattr.c +1 -1
@@ -828,7 +828,7 @@ int nla_strcmp(const struct nlattr *nla, const char *str)int attrlen =nla_len (nla);int d; -if (attrlen >0 && buf[attrlen -1 ] =='\0' ) +while (attrlen >0 && buf[attrlen -1 ] =='\0' ) attrlen--; d = attrlen - len;
Signature · 1 line
2.31.1.527.g47e6f16901-goog
This patch was applied to netdev/net.git (refs/heads/master):
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
Quoted 8 lines · On Wed, 5 May 2021 09:58:31 -0700 you wrote:
From: Maciej Żenczykowski <[email protected]>
Android userspace has been using
TCA_KINDwith a char[IFNAMESIZ] many-null-terminated buffer containing the string 'bpf'.This works on 4.19 and ceases to work on 5.10.
[...]
Here is the summary with links:
- net: fix nla_strcmp to handle more then one trailing null character
https://git.kernel.org/netdev/net/c/2c16db6c92b0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html