diff options
author | Gal Pressman <[email protected]> | 2023-11-14 09:56:18 +0200 |
---|---|---|
committer | David S. Miller <[email protected]> | 2023-11-15 11:05:08 +0000 |
commit | 674e318089468ece99aef4796eaef7add57f36b2 (patch) | |
tree | f6486b70fb01391bd9993a8b0e5e15c375deb621 /tools/perf/scripts/python | |
parent | efc0c8363bc6dab2cd540acc886e6097deee8bb9 (diff) |
net: Fix undefined behavior in netdev name allocation
Cited commit removed the strscpy() call and kept the snprintf() only.
It is common to use 'dev->name' as the format string before a netdev is
registered, this results in 'res' and 'name' pointers being equal.
According to POSIX, if copying takes place between objects that overlap
as a result of a call to sprintf() or snprintf(), the results are
undefined.
Add back the strscpy() and use 'buf' as an intermediate buffer.
Fixes: 7ad17b04dc7b ("net: trust the bitmap in __dev_alloc_name()")
Cc: Jakub Kicinski <[email protected]>
Reviewed-by: Vlad Buslov <[email protected]>
Signed-off-by: Gal Pressman <[email protected]>
Reviewed-by: Jakub Kicinski <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions