Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rds: rds_rm_zerocopy_callback() use list_first_entry()

rds_rm_zerocopy_callback() uses list_entry() on the head of a list
causing a type confusion.
Use list_first_entry() to actually access the first element of the
rs_zcookie_queue list.

Fixes: 9426bbc6de99 ("rds: use list structure to track information for zerocopy completion notification")
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
Link: https://lore.kernel.org/r/20230202-rds-zerocopy-v3-1-83b0df974f9a@diag.uniroma1.it
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Pietro Borrello and committed by
Paolo Abeni
f753a689 646be03e

+3 -3
+3 -3
net/rds/message.c
··· 104 104 spin_lock_irqsave(&q->lock, flags); 105 105 head = &q->zcookie_head; 106 106 if (!list_empty(head)) { 107 - info = list_entry(head, struct rds_msg_zcopy_info, 108 - rs_zcookie_next); 109 - if (info && rds_zcookie_add(info, cookie)) { 107 + info = list_first_entry(head, struct rds_msg_zcopy_info, 108 + rs_zcookie_next); 109 + if (rds_zcookie_add(info, cookie)) { 110 110 spin_unlock_irqrestore(&q->lock, flags); 111 111 kfree(rds_info_from_znotifier(znotif)); 112 112 /* caller invokes rds_wake_sk_sleep() */