netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.18 52/53] skbuff: don't mix ubuf_info from different sources
       [not found] <20220808013350.314757-1-sashal@kernel.org>
@ 2022-08-08  1:33 ` Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2022-08-08  1:33 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 c90c74de90d5..7d35cee8b00e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1210,6 +1210,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] only message in thread

only message in thread, other threads:[~2022-08-08  1:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220808013350.314757-1-sashal@kernel.org>
2022-08-08  1:33 ` [PATCH AUTOSEL 5.18 52/53] skbuff: don't mix ubuf_info from different sources Sasha Levin

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).