Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9105791pxu; Mon, 28 Dec 2020 06:47:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZRHblqvsw2R4tuty3leyILVHkjx1MqGJo0Yn/cHyQUb8Jkn4k8Wfk2nAIbjEJNYlN98Pn X-Received: by 2002:a17:906:ec9:: with SMTP id u9mr42868304eji.400.1609166829483; Mon, 28 Dec 2020 06:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166829; cv=none; d=google.com; s=arc-20160816; b=JNkAffat1nMzjA53Qw/6yL+blUHKIUhp5QDxwsZeLQeRLJYPC0XBBfGXHMdtfYGHAG T9OCmBYCVO3TWkIuLzP/si2ECI5/rFZ9rIeVhyDejJS7lFIySCOezz0ao1qVjJxHeAQl X+3ijIyS598DP+/43WHodEZ1R7B3tSId6sK3WBH9zP3ZAzUPvIyJP5gh8o++t8m17af3 HwwwdKaxppm8IOaySAv41LuvSRdJgf6+y58o4h0SHDLo78CEEAAdk4ynDe+N23Bmklx1 QFlGJvm0uZWSbw7CQ2Rfz6WyVW7i90adH/fHLTsPADTON6OjR1sA8kkgBqZRcWahSFCH RMvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=clKDvTUwhgmvAz4xY7kmX++wf/KBOHwotHMGYgFySZs=; b=FNWtCmXc6fEfO2sTyb1cv3JwYPsKkKYconQxvRsphsyoY8DkPbN+zoOzYJmwBRz5K8 Ww8uo2o5T+OIvGkb+uL3gW0mAKUzs8TKUAd1GLTTzVOuenhZdBe7l4hlMLImid/9AA0B G/d1FLbfYvcjQtl93KSwqXCraxCQ2OHiBijoi4C7qzQz8bZuhoRsrxPLPKKI9sDcCETx n2UPkQkJQcJ9jQp+IAJQYBp1ta4QZRHp4N/tXUg77gRbqPGY/anFFwDCs0W2F9xTyx7W JkEZj2xCH/2LZEpeJalNm2bAllT5EHuTqd3JMXjiwLf4UB8nELStZqmb7V/nbYv10jWX 05Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fKlf+EuU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs21si19582174ejc.395.2020.12.28.06.46.47; Mon, 28 Dec 2020 06:47:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fKlf+EuU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439267AbgL1OZJ (ORCPT + 99 others); Mon, 28 Dec 2020 09:25:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:60742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503164AbgL1OY6 (ORCPT ); Mon, 28 Dec 2020 09:24:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7EC2D221F0; Mon, 28 Dec 2020 14:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165483; bh=0O7lhUQg3Vk3mTZyYdpKNC64PDrNQGDsmxZneg17+/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fKlf+EuUOUdDdvHTt/iEzpmOPCMc/cQLtBtKV6FDJI6ywpN2qzXI+kfl47k6K6fnI Ad+Uhgzv2ZGJm8H9rT4KJyRxxMqzNssKibe9NEchQ+RUl1jxL3+rlzKlMips5pAGKU gxGDoCRFNPCkxS5XzyG+oh2z3PuWfdhcdONJeqiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.10 517/717] io_uring: fix 0-iov read buffer select Date: Mon, 28 Dec 2020 13:48:35 +0100 Message-Id: <20201228125045.724452992@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Begunkov commit dd20166236953c8cd14f4c668bf972af32f0c6be upstream. Doing vectored buf-select read with 0 iovec passed is meaningless and utterly broken, forbid it. Cc: # 5.7+ Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3048,9 +3048,7 @@ static ssize_t io_iov_buffer_select(stru iov[0].iov_len = kbuf->len; return 0; } - if (!req->rw.len) - return 0; - else if (req->rw.len > 1) + if (req->rw.len != 1) return -EINVAL; #ifdef CONFIG_COMPAT