mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 15:50:59 +07:00
tcp: fix out-of-bounds access in ULP sysctl
KASAN reports out-of-bound access in proc_dostring() coming from
proc_tcp_available_ulp() because in case TCP ULP list is empty
the buffer allocated for the response will not have anything
printed into it. Set the first byte to zero to avoid strlen()
going out-of-bounds.
Fixes: 734942cc4e
("tcp: ULP infrastructure")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
239946314e
commit
926f38e974
@ -88,6 +88,7 @@ void tcp_get_available_ulp(char *buf, size_t maxlen)
|
||||
struct tcp_ulp_ops *ulp_ops;
|
||||
size_t offs = 0;
|
||||
|
||||
*buf = '\0';
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(ulp_ops, &tcp_ulp_list, list) {
|
||||
offs += snprintf(buf + offs, maxlen - offs,
|
||||
|
Loading…
Reference in New Issue
Block a user