ocfs2: Fix use of slab data with sendpage
authorDavid Howells <dhowells@redhat.com>
Fri, 23 Jun 2023 22:55:10 +0000 (23:55 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 24 Jun 2023 22:50:13 +0000 (15:50 -0700)
commit86d7bd6e66e9925f0f04a7bcf3c92c05fdfefb5a
treef9b407f9aebacfc84db35c2cecbd97e30aeeec4a
parentd2fe21077d6d4687ecab642ffe97c2e4acf3a547
ocfs2: Fix use of slab data with sendpage

ocfs2 uses kzalloc() to allocate buffers for o2net_hand, o2net_keep_req and
o2net_keep_resp and then passes these to sendpage.  This isn't really
allowed as the lifetime of slab objects is not controlled by page ref -
though in this case it will probably work.  sendmsg() with MSG_SPLICE_PAGES
will, however, print a warning and give an error.

Fix it to use folio_alloc() instead to allocate a buffer for the handshake
message, keepalive request and reply messages.

Fixes: 98211489d414 ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Mark Fasheh <mark@fasheh.com>
cc: Kurt Hackel <kurt.hackel@oracle.com>
cc: Joel Becker <jlbec@evilplan.org>
cc: Joseph Qi <joseph.qi@linux.alibaba.com>
cc: ocfs2-devel@oss.oracle.com
Link: https://lore.kernel.org/r/20230623225513.2732256-14-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
fs/ocfs2/cluster/tcp.c