From patchwork Tue Dec 1 08:52:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 335790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4198FC8301A for ; Tue, 1 Dec 2020 09:21:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5BC3206C0 for ; Tue, 1 Dec 2020 09:21:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wSB+tZrV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389265AbgLAJVr (ORCPT ); Tue, 1 Dec 2020 04:21:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:45100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389261AbgLAJIe (ORCPT ); Tue, 1 Dec 2020 04:08:34 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9BCDD206C1; Tue, 1 Dec 2020 09:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813699; bh=P8mpLxYXQ1w9AvpHN/TsUPBGQJXIfuxUnusKsGvz1HU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wSB+tZrVuKzmFuuolqH62fAcK3JeebNdJZVreSgY/22xfMJIf5tSfdbP6LYDWYHHG Vmtx81mVQekpJO9F+uEC/3Y3oaTfSKH32T0raPYm8BUJ4YYfWJ+CC1IyjNKPUlmst4 M+Bf/yELjhjYXGeCAF1/Ec0HEDN1rAe45FV+OyNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Pavel Begunkov , Jens Axboe Subject: [PATCH 5.9 029/152] io_uring: fix ITER_BVEC check Date: Tue, 1 Dec 2020 09:52:24 +0100 Message-Id: <20201201084715.690223207@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084711.707195422@linuxfoundation.org> References: <20201201084711.707195422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pavel Begunkov commit 9c3a205c5ffa36e96903c2e37eb5f41c0f03c43e upstream. iov_iter::type is a bitmask that also keeps direction etc., so it shouldn't be directly compared against ITER_*. Use proper helper. Fixes: ff6165b2d7f6 ("io_uring: retain iov_iter state over io_read/io_write calls") Reported-by: David Howells Signed-off-by: Pavel Begunkov Cc: # 5.9 Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2991,7 +2991,7 @@ static void io_req_map_rw(struct io_kioc rw->free_iovec = NULL; rw->bytes_done = 0; /* can only be fixed buffers, no need to do anything */ - if (iter->type == ITER_BVEC) + if (iov_iter_is_bvec(iter)) return; if (!iovec) { unsigned iov_off = 0;