]> git.baikalelectronics.ru Git - kernel.git/commit
net: fix uninitialised msghdr->sg_from_iter
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 21 Jul 2022 14:25:46 +0000 (15:25 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 22 Jul 2022 21:52:32 +0000 (14:52 -0700)
commita76698baba73ddb66bf5bf7f01e4698455411824
tree767c8a995d6172596843abdbe03f4b1413f5a105
parent793fd3a555ff7b60b194ec013dd350a214980f59
net: fix uninitialised msghdr->sg_from_iter

Because of how struct msghdr is usually initialised some fields and
sg_from_iter in particular might be left out not initialised, so we
can't safely use it in __zerocopy_sg_from_iter().

For now use the callback only when there is ->msg_ubuf set relying on
the fact that they're used together and we properly zero ->msg_ubuf.

Fixes: 87ca2c61921273 ("net: Allow custom iter handler in msghdr")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Message-Id: <ce8b68b41351488f79fd998b032b3c56e9b1cc6c.1658401817.git.asml.silence@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/datagram.c