From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 8912226B2D3; Mon, 17 Aug 2026 15:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786979569; cv=none; b=XQZsfMV4vli488Jk0JLtLVfbn3cKD6HsTFABIQApXTWC4hybQszZq4rAgIpBCMKoscp8xtpo564bpgzNWgsJ9lbPNWXSRJsEBfkk3uQmIq/z/jKtQt5JaGuMRUS1SeULehIvHHzy4QuJlk7Y5capywnMSD2ahBAPbwlH1AEo9sY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786979569; c=relaxed/simple; bh=QR2iazUfxS7X170d2nW9kH1LophByUwmcwkSdsZHyzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rWhonZlrsyFvMYbiKY/xxoyasGie/1BRwRGsE+LJUwtaoWFLzcPikEZWASDNwk98cb0Znc3U2hWdtNhygrdEeC8E32stDQtNor4vnhn/uPo/FHJiH2VjzF0J0z/sIWptlMthl64FgAxyX619SAeqIM0w3t6xvg/1aJ0SVWfT9ag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l52XYQN4; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="l52XYQN4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D31B21F000E9; Mon, 17 Aug 2026 15:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786979568; bh=0WKi+BrhdNHoGeu5gtIDq1fNVXbUcVYnwB3XbUjXRes=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=l52XYQN4YgfPZysRgeQuaeBtkJkwGDsDaogSeIZ0XPfWC9h3ujiS52dUpMPT4KIBG 3A2LM5F4F4aRzlW3mNib7Wl2xfTPjUIIyDxa/BHtoQgh8Lrg9OBTEoTn8jIv9eR0fk B4jj7aWinRgGMz6xYOmopnxbcB4bNiuuQfkBk2Eo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Raphael Zimmer , Ilya Dryomov Subject: [PATCH 6.1 270/609] rbd: Reset positive result codes to zero in object map update path Date: Mon, 17 Aug 2026 15:29:26 +0200 Message-ID: <20260817132553.157330162@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132543.039278408@linuxfoundation.org> References: <20260817132543.039278408@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Raphael Zimmer commit a6c4250b81bd30beae94e1b7a4b26fa1193ad2e4 upstream. In a reply message to an RBD request, a positive result code indicates a data payload, which is not allowed for writes. While rbd_osd_req_callback() already resets a positive result code for writes to zero, rbd_object_map_callback() does not. This allows a corrupted reply to an object map update to trigger the rbd_assert(*result < 0) in __rbd_obj_handle_request(). This happens, because rbd_object_map_callback() calls rbd_obj_handle_request() -> __rbd_obj_handle_request() and passes this positive result code. From __rbd_obj_handle_request(), rbd_obj_advance_write() is called, which leaves the positive result code unchanged and returns true. Therefore, the if(done && *result) branch is executed in __rbd_obj_handle_request() and the assertion triggers. This patch fixes the issue by adjusting the logic in the rbd_object_map_callback() path. A positive result code for an object map update is now reset to zero (similar to rbd_osd_req_callback()), and the message is subsequently handled the same way as if the result code was zero from the beginning. Additionally, a WARN_ON_ONCE() is added for this case. Cc: stable@vger.kernel.org Fixes: 22e8bd51bb04 ("rbd: support for object-map and fast-diff") Signed-off-by: Raphael Zimmer Reviewed-by: Ilya Dryomov Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- drivers/block/rbd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1957,10 +1957,15 @@ static int rbd_object_map_update_finish( bool has_current_state; void *p; - if (osd_req->r_result) + if (osd_req->r_result < 0) return osd_req->r_result; /* + * Writes aren't allowed to return a data payload. + */ + WARN_ON_ONCE(osd_req->r_result > 0); + + /* * Nothing to do for a snapshot object map. */ if (osd_req->r_num_ops == 1)