summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/stackcollapse.py
diff options
context:
space:
mode:
authorHui Peng <benquike@gmail.com>2026-09-30 04:46:11 +0000
committerJakub Kicinski <kuba@kernel.org>2026-10-06 18:15:13 -0700
commit538b529509c7ab0d909cb65bb7264edca1788d30 (patch)
treed73dd0ba8ad84a6f608b31b2abf1109f7cb785de /tools/perf/scripts/python/stackcollapse.py
parentc8a900ded7759ca982910d3fb4a56f11529079b4 (diff)
downloadlinux-538b529509c7ab0d909cb65bb7264edca1788d30.tar.gz
linux-538b529509c7ab0d909cb65bb7264edca1788d30.zip
sctp: copy zeroed stats to user in sctp_getsockopt_pr_streamstatus() when !streamoute
When an SCTP stream output extension structure (streamoute) has not yet been allocated, sctp_getsockopt_pr_streamstatus() sets the local stack variables params.sprstat_abandoned_unsent = 0 and params.sprstat_abandoned_sent = 0, but then immediately jumps to 'out:', bypassing copy_to_user(). As a result, when an uninitialized user buffer is passed to getsockopt(SCTP_PR_STREAM_STATUS), the kernel returns success (0) without copying the zeroed stats back to user space, leaving uninitialized data in the user buffer. Refactor the !streamoute check into an if-else chain so that when streamoute is NULL, params is zeroed and falls through to copy_to_user(), copying the zeroed stats to user space and setting retval = 0 once before returning. Tested in QEMU against Linux 7.3.0-rc3 using an uninitialized sctp_prstatus user struct passed to getsockopt(SCTP_PR_STREAM_STATUS) on a freshly created stream: on the unfixed kernel the user struct contains uninitialized stack garbage; whereas with this fix applied, getsockopt() copies zeroed stats into user space and returns 0. Cc: stable@vger.kernel.org Reviewed-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Hui Peng <benquike@gmail.com> Fixes: f952be79cebd ("sctp: introduce struct sctp_stream_out_ext") Link: https://patch.msgid.link/20260930044611.204739-1-benquike@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions