From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796050694; b=TQNzgyflduumPoHRApjNYagTEP2p60j1brkVzeDGGSzsAGeIVFCNHTkbowyHCCVEGEgZ rW49pwU8AWP2GG25j9ttY8ydpGYvIE9qMiDQDeSqbna6T2hJvcoqeG1qXZznfzbvjRf1a MRJl28spURIn1cg9dIiEejuXCU7RvU62MO50XnyF/Eg6IZlPLwKIaDfoWYRKxeQNImVA5 S7dfFcFaNNNMvCGm8WnL4czOcakAyQjLzOea1FJra6YkiwckRixFPctqpqM+TcydI4C6p MVSMqD59eD3QY2vr0Tuo7xSwFg5gxvIYEyBG2t28N2eaLk55JF4KKMiMUEsxoRc+Lbw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796050694; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ODi4nbdknXlxAlpVXrCZO0+l8Zv4Z/PbffQLDKxxtuI=; b=ttRp3eDxZS8GkAXEEwxUooUPxrI74fdr1IXkgDbCYYFOCNR7yXFp3/xQjXCivZRTxnCs Tfi6S3NTu9rahcc+XRVJEmAoU8KbtUHrqkbhApGoZzhZjPIxM6L8n9HyYDeCwI2VKr1tk 4bowZBgr9ucKMarhsLhcNbZx5t2ryiD+R1rV8R1esa9boep0vCaooapq2ejk7xmk/evRs ysT/EiJQmsjuhG9L60QFh9k+wSWipFNvO4L/BcMmrZfqCdcQw1qJS6a9rtZzICw299Ejs NxuZ2LO3QzHvnxak3aHacWXfgvLZF8WO+j0te1GAbpn+6IUevUw+TWy659LJLMae8iA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eB5jzFok; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95FB9606A327 for ; Mon, 30 Nov 2026 14:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eB5jzFok Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DEE31F00897; Mon, 30 Nov 2026 14:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796050694; bh=ODi4nbdknXlxAlpVXrCZO0+l8Zv4Z/PbffQLDKxxtuI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=eB5jzFokLnL+J99T0XT6OvarTeapAjEx5obSkOzD5pMA9wMBeKldjj/KAAO4NHri2 tpCAtzy/Y7b4EivwLGuvXrYQ+GZKY+QbPnebPnycBBT5wsIDjvLxcbtYhzax+SxF1j Af1Tc+C4sS/59xHT3knr79Cb6YRqlkCMdfDsnClCBmkD6F1AnpCreJA9/n56u7uIlY /SJeWJRkLUa38IANAZCQwq2rI9zr+/Lh0lED5APiEJhAUTyG4t++q6DwrR5s9vioSH VDpraJKbH4o0B0NxWqT7WVOwRnW3u8f7ai6+99QzsWNJK/D0JzQTFix6NZ8TfecjDx rriICDoqOpU0Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net] rds: free zerocopy cookies when the socket is destroyed Reply-To: sashiko-reviews@lists.linux.dev To: "Nguyen Ngoc Thang" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261130145025.123903-1-ngocthang2710.1999@gmail.com> References: <20261130145025.123903-1-ngocthang2710.1999@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 14:58:13 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > 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: >=20 > - over loopback, the receiver's queue holds the message itself, so it > outlives the sender if the sender closes first; >=20 > - 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(). >=20 > 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: >=20 > unreferenced object 0xffff88812a3e1880 (size 64): > backtrace: > __kmalloc_cache_noprof > rds_message_copy_from_user > rds_sendmsg >=20 > 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. >=20 > Fixes: 401910db4cd4 ("rds: deliver zerocopy completion notification with = data") > Reported-by: syzbot+b3f058b8e3b0d80d5bfb@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=3Db3f058b8e3b0d80d5bfb > Signed-off-by: Nguyen Ngoc Thang Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130145025.1239= 03-1-ngocthang2710.1999@gmail.com?part=3D1