mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
net/rds: reset op_nents when zerocopy page pin fails
When iov_iter_get_pages2() fails in rds_message_zcopy_from_user(),
the pinned pages are released with put_page(), and
rm->data.op_mmp_znotifier is cleared. But we fail to properly
clear rm->data.op_nents.
Later when rds_message_purge() is called from rds_sendmsg() the
cleanup loop iterates over the incorrectly non zero number of
op_nents and frees them again.
Fix this by properly resetting op_nents when it should be in
rds_message_zcopy_from_user().
Fixes: 0cebaccef3 ("rds: zerocopy Tx support.")
Signed-off-by: Allison Henderson <achender@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260505234336.2132721-1-achender@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a450063ef8
commit
e174929793
|
|
@ -448,6 +448,7 @@ static int rds_message_zcopy_from_user(struct rds_message *rm, struct iov_iter *
|
|||
|
||||
for (i = 0; i < rm->data.op_nents; i++)
|
||||
put_page(sg_page(&rm->data.op_sg[i]));
|
||||
rm->data.op_nents = 0;
|
||||
mmp = &rm->data.op_mmp_znotifier->z_mmp;
|
||||
mm_unaccount_pinned_pages(mmp);
|
||||
ret = -EFAULT;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user