]> git.baikalelectronics.ru Git - kernel.git/commitdiff
rds: rds_rm_zerocopy_callback() correct order for list_add_tail()
authorPietro Borrello <borrello@diag.uniroma1.it>
Thu, 9 Feb 2023 12:26:23 +0000 (12:26 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:43:41 +0000 (16:43 +0100)
[ Upstream commit 68762148d1b011d47bc2ceed7321739b5aea1e63 ]

rds_rm_zerocopy_callback() uses list_add_tail() with swapped
arguments. This links the list head with the new entry, losing
the references to the remaining part of the list.

Fixes: 6a9be51d976d ("rds: use list structure to track information for zerocopy completion notification")
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/rds/message.c

index be6a0a073b12af898f64de42aa6b1fe39de9859f..75043742d243cdeb2d39f3d9b1d05be2da9f18cc 100644 (file)
@@ -118,7 +118,7 @@ static void rds_rm_zerocopy_callback(struct rds_sock *rs,
        ck = &info->zcookies;
        memset(ck, 0, sizeof(*ck));
        WARN_ON(!rds_zcookie_add(info, cookie));
-       list_add_tail(&q->zcookie_head, &info->rs_zcookie_next);
+       list_add_tail(&info->rs_zcookie_next, &q->zcookie_head);
 
        spin_unlock_irqrestore(&q->lock, flags);
        /* caller invokes rds_wake_sk_sleep() */