Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C801212F389 for ; Tue, 21 May 2024 14:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716301280; cv=none; b=ttGM/ouI9WN+AjwKEC9D9vxtx+Ez0KCmz/7PdxhHEP/UjUMDVSwmPXk6ynQ52fGZFM86lnIADrI0HxCaI1GorhTTvUi5Ten6JthQ7qg5arxFbUZD+3X7fl3dphoM4ERZS1N2qfovBsar3eCUMAJsFPagSv3v0EW24+0Y5RZX23U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716301280; c=relaxed/simple; bh=XKcSAflkk8+VB+/6+GqB5nG5hJE0NmPR7DOa0fht8Dg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=r5B+B7BSH43mZYdtuDJToR6faHncXoMvMnkr9Fq7jbzsQRuMNUmk6lfLSEqlYJhSCqA9MbKYA1PTApHq2CWN+TZKs3jXzMdwvvm5ToW2FPmDpocjN9pYKCSi2fYXKRKrkjkfRp/0M+k3Z2YqhVOJI123c81E51tbEQMswhMCbUU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cIBwu0zR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cIBwu0zR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51277C2BD11; Tue, 21 May 2024 14:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716301280; bh=XKcSAflkk8+VB+/6+GqB5nG5hJE0NmPR7DOa0fht8Dg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=cIBwu0zR/k7/jhkdfR+tcui1rpyCbojhg0N49KJXbAwhMmAZj4fHCdry1KPFPZDhY Be4zBxmhwgqg6/fHJJfCAdRjYKH1GMl31UuPcXRA/YJmMqON9/cAz64s8/izS8wEob 3u79w1PWKe4+GcNO9tUFKwJpqCLTeQY/9PjfbBuU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47249: net: rds: fix memory leak in rds_recvmsg Date: Tue, 21 May 2024 16:20:03 +0200 Message-ID: <2024052144-CVE-2021-47249-ed65@gregkh> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3479; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=XKcSAflkk8+VB+/6+GqB5nG5hJE0NmPR7DOa0fht8Dg=; b=owGbwMvMwCRo6H6F97bub03G02pJDGk+axtc//aWH97z78C/n9MO377vvP1DzLWnUhtkK671a 31+V7EtpyOWhUGQiUFWTJHlyzaeo/srDil6GdqehpnDygQyhIGLUwAmUiPFsGAS27EriS9cmSY0 5VlO2MF5IdZpVg3Dgv2nrz13O2djd7O0dduVpFV+Fq5TpAE= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: net: rds: fix memory leak in rds_recvmsg Syzbot reported memory leak in rds. The problem was in unputted refcount in case of error. int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, int msg_flags) { ... if (!rds_next_incoming(rs, &inc)) { ... } After this "if" inc refcount incremented and if (rds_cmsg_recv(inc, msg, rs)) { ret = -EFAULT; goto out; } ... out: return ret; } in case of rds_cmsg_recv() fail the refcount won't be decremented. And it's easy to see from ftrace log, that rds_inc_addref() don't have rds_inc_put() pair in rds_recvmsg() after rds_cmsg_recv() 1) | rds_recvmsg() { 1) 3.721 us | rds_inc_addref(); 1) 3.853 us | rds_message_inc_copy_to_user(); 1) + 10.395 us | rds_cmsg_recv(); 1) + 34.260 us | } The Linux kernel CVE team has assigned CVE-2021-47249 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.30 with commit bdbe6fbc6a2f and fixed in 4.4.274 with commit 8c3ec88b03e9 Issue introduced in 2.6.30 with commit bdbe6fbc6a2f and fixed in 4.9.274 with commit 423c6939758f Issue introduced in 2.6.30 with commit bdbe6fbc6a2f and fixed in 4.14.238 with commit 1f79bc8ae81c Issue introduced in 2.6.30 with commit bdbe6fbc6a2f and fixed in 4.19.196 with commit 06b7cb0194bd Issue introduced in 2.6.30 with commit bdbe6fbc6a2f and fixed in 5.4.128 with commit 2038cd15eacd Issue introduced in 2.6.30 with commit bdbe6fbc6a2f and fixed in 5.10.46 with commit 5946fbf48355 Issue introduced in 2.6.30 with commit bdbe6fbc6a2f and fixed in 5.12.13 with commit b25b60d07616 Issue introduced in 2.6.30 with commit bdbe6fbc6a2f and fixed in 5.13 with commit 49bfcbfd989a Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2021-47249 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/rds/recv.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/8c3ec88b03e9e4ca117dcdc4204fd3edcd02084f https://git.kernel.org/stable/c/423c6939758fb3b9cf5abbd1e7792068a5c4ae8c https://git.kernel.org/stable/c/1f79bc8ae81c05eb112a53f981cb2c244ee50d02 https://git.kernel.org/stable/c/06b7cb0194bd1ede0dd27f3a946e7c0279fba44a https://git.kernel.org/stable/c/2038cd15eacdf7512755c27686822e0052eb9042 https://git.kernel.org/stable/c/5946fbf48355f5a8caeff72580c7658da5966b86 https://git.kernel.org/stable/c/b25b60d076164edb3025e85aabd2cf50a5215b91 https://git.kernel.org/stable/c/49bfcbfd989a8f1f23e705759a6bb099de2cff9f