* [PATCH AUTOSEL 5.15 44/45] skbuff: don't mix ubuf_info from different sources
[not found] <20220808013551.315446-1-sashal@kernel.org>
@ 2022-08-08 1:35 ` Sasha Levin
2022-08-08 18:44 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2022-08-08 1:35 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Pavel Begunkov, Jakub Kicinski, Sasha Levin, davem, edumazet,
pabeni, imagedong, luiz.von.dentz, vasily.averin, jk, netdev
From: Pavel Begunkov <asml.silence@gmail.com>
[ Upstream commit 1b4b2b09d4fb451029b112f17d34792e0277aeb2 ]
We should not append MSG_ZEROCOPY requests to skbuff with non
MSG_ZEROCOPY ubuf_info, they might be not compatible.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skbuff.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5ebef94e14dc..891db074981e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1213,6 +1213,10 @@ struct ubuf_info *msg_zerocopy_realloc(struct sock *sk, size_t size,
const u32 byte_limit = 1 << 19; /* limit to a few TSO */
u32 bytelen, next;
+ /* there might be non MSG_ZEROCOPY users */
+ if (uarg->callback != msg_zerocopy_callback)
+ return NULL;
+
/* realloc only when socket is locked (TCP, UDP cork),
* so uarg->len and sk_zckey access is serialized
*/
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH AUTOSEL 5.15 44/45] skbuff: don't mix ubuf_info from different sources
2022-08-08 1:35 ` [PATCH AUTOSEL 5.15 44/45] skbuff: don't mix ubuf_info from different sources Sasha Levin
@ 2022-08-08 18:44 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2022-08-08 18:44 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Pavel Begunkov, davem, edumazet, pabeni,
imagedong, luiz.von.dentz, vasily.averin, jk, netdev
On Sun, 7 Aug 2022 21:35:48 -0400 Sasha Levin wrote:
> From: Pavel Begunkov <asml.silence@gmail.com>
>
> [ Upstream commit 1b4b2b09d4fb451029b112f17d34792e0277aeb2 ]
>
> We should not append MSG_ZEROCOPY requests to skbuff with non
> MSG_ZEROCOPY ubuf_info, they might be not compatible.
This is prep for later patches which add a different type of zerocopy.
No need to backport.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-08 18:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220808013551.315446-1-sashal@kernel.org>
2022-08-08 1:35 ` [PATCH AUTOSEL 5.15 44/45] skbuff: don't mix ubuf_info from different sources Sasha Levin
2022-08-08 18:44 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).