All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nguyen Ngoc Thang" <ngocthang2710.1999@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net] rds: free zerocopy cookies when the socket is destroyed
Date: Mon, 30 Nov 2026 14:58:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-241449@kernel.org> (raw)
In-Reply-To: <20261130145025.123903-1-ngocthang2710.1999@gmail.com>

> rds_release() frees the zerocopy completion cookies still queued on the
> socket, but more can be queued after that. A cookie is only queued when
> the last reference to its message is dropped, and rds_send_drop_to()
> does not wait for references held elsewhere:
> 
>  - over loopback, the receiver's queue holds the message itself, so it
>    outlives the sender if the sender closes first;
> 
>  - rds_send_xmit() holds a reference to the message it is sending, and
>    may be running in a worker or in another socket's sendmsg().
> 
> rds_message_purge() then adds the cookie to the closed socket and drops
> the message's socket reference. Nothing empties the queue again before
> the socket is freed, so the cookie is leaked:
> 
>   unreferenced object 0xffff88812a3e1880 (size 64):
>     backtrace:
>       __kmalloc_cache_noprof
>       rds_message_copy_from_user
>       rds_sendmsg
> 
> Free the cookies in rds_sock_destruct() instead. Each queued message
> holds a socket reference until its cookie has been queued, so none can
> be added after that. The purge doesn't sleep, so it is safe in the RCU
> callback that destroys bound sockets.
> 
> Fixes: 401910db4cd4 ("rds: deliver zerocopy completion notification with data")
> Reported-by: syzbot+b3f058b8e3b0d80d5bfb@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=b3f058b8e3b0d80d5bfb
> Signed-off-by: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130145025.123903-1-ngocthang2710.1999@gmail.com?part=1

  reply	other threads:[~2026-11-30 14:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 14:50 [PATCH net] rds: free zerocopy cookies when the socket is destroyed Nguyen Ngoc Thang
2026-11-30 14:58 ` sashiko-bot [this message]
2026-12-01 21:55 ` Allison Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-241449@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=ngocthang2710.1999@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.