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 9173D4483B9; Thu, 30 Jul 2026 15:23:53 +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=1785425034; cv=none; b=NrAqqXufxbNjbkCJ8/hrGqyFw2WAv24ZwMutzmK9xhGFhvb9PUhAsySwoKhZnW2gv/219EmQ4WN+Dobvk5vhoWct9h9K9WBf8HZXp/loCTVLwOusCgeeItCOrU1DUoACpgZrXCs1HwgKkuiKGEOuVmUQFzZd36A9mL/2w0Oy44o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785425034; c=relaxed/simple; bh=ZLfH/xJeO0wcYJdw9bPpLYOwiFjYZifF1Wvy5IEHLQ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L0pGF3dXCKdBPAIBDHMQA6bVwXZ8YHJLe6xzsZBM2LyI/dpSNvyTryiVWJDjvPhgiudWc4FP3FEMPr/zkCdYtis6WOzLoaQOzI3ZB6xRT0c6gGou4OAMqxiTs/ji9ebBLbjuh+tTusKR6eWVzDL7YTX0WRk15tc83E8GG1sMap4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fsBsIXpL; 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="fsBsIXpL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED3C01F00A3A; Thu, 30 Jul 2026 15:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785425033; bh=ZVr+TSwb7SG65TH/c8ohDgPvA/TAOJe5V8e+lvgL2es=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fsBsIXpLTk1CoxAZRGI0dRvooQc6E1grHGIgEsKuSsv28x/tCEVNTxucXW3Vgu5Mp lZM+k5Op4zxqMqX6lhANU+QEa9/sPxGv6ceuAUlPYGUg97WpMM3N73dto0yJKC3jK1 ltvyZJus1TyBoplVZt8LmETfgmjs6F3PbJ+WTwWQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Raphael Zimmer , Ilya Dryomov Subject: [PATCH 6.18 549/675] rbd: Reset positive result codes to zero in object map update path Date: Thu, 30 Jul 2026 16:14:39 +0200 Message-ID: <20260730141456.809388381@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141445.110192266@linuxfoundation.org> References: <20260730141445.110192266@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.18-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)