Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EBE2C46467 for ; Tue, 10 Jan 2023 08:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230086AbjAJIIo (ORCPT ); Tue, 10 Jan 2023 03:08:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237979AbjAJIIb (ORCPT ); Tue, 10 Jan 2023 03:08:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2A34658E for ; Tue, 10 Jan 2023 00:08:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95428B81106 for ; Tue, 10 Jan 2023 08:08:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F4BBC433EF; Tue, 10 Jan 2023 08:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673338105; bh=zPy9juPe3B21MiO7RTcTVqF/L/o4TYALiNc60hbSIN0=; h=Subject:To:Cc:From:Date:From; b=2U5mqD3jMPvWFFEXL1349wEsoWzL48r7H1xxft1ZxZ0nXi+tLPL7z4/WAtuDYIj/t 0DmrtBjB29/EP65ALF1U2XdyufjfNOG62I5l/ADl7WdP4gl/Kmq2N8eZLHKqExXpMv Va6T0CW/SEvis499Rdi6Oy6YGNI3DvdTZa9E5/zA= Subject: FAILED: patch "[PATCH] virtio_blk: Fix signedness bug in virtblk_prep_rq()" failed to apply to 6.0-stable tree To: rafaelmendsr@gmail.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, stefanha@redhat.com, suwan.kim027@gmail.com Cc: From: Date: Tue, 10 Jan 2023 09:08:06 +0100 Message-ID: <1673338086125255@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 6.0-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Possible dependencies: a26116c1e740 ("virtio_blk: Fix signedness bug in virtblk_prep_rq()") 258896fcc786 ("virtio-blk: use a helper to handle request queuing errors") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From a26116c1e74028914f281851488546c91cbae57d Mon Sep 17 00:00:00 2001 From: Rafael Mendonca Date: Fri, 21 Oct 2022 17:41:26 -0300 Subject: [PATCH] virtio_blk: Fix signedness bug in virtblk_prep_rq() The virtblk_map_data() function returns negative error codes, however, the 'nents' field of vbr->sg_table is an unsigned int, which causes the error handling not to work correctly. Cc: stable@vger.kernel.org Fixes: 0e9911fa768f ("virtio-blk: support mq_ops->queue_rqs()") Signed-off-by: Rafael Mendonca Message-Id: <20221021204126.927603-1-rafaelmendsr@gmail.com> Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella Reviewed-by: Suwan Kim Reviewed-by: Stefan Hajnoczi Acked-by: Jason Wang diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index dcbf86cd2155..6a77fa917428 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -334,14 +334,16 @@ static blk_status_t virtblk_prep_rq(struct blk_mq_hw_ctx *hctx, struct virtblk_req *vbr) { blk_status_t status; + int num; status = virtblk_setup_cmd(vblk->vdev, req, vbr); if (unlikely(status)) return status; - vbr->sg_table.nents = virtblk_map_data(hctx, req, vbr); - if (unlikely(vbr->sg_table.nents < 0)) + num = virtblk_map_data(hctx, req, vbr); + if (unlikely(num < 0)) return virtblk_fail_to_queue(req, -ENOMEM); + vbr->sg_table.nents = num; blk_mq_start_request(req);