Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3964784pxb; Mon, 4 Oct 2021 13:52:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaftLSGLVaAFlXyDYwDyz8MA0cffHSgRpicdLzWn/ShpLw4N+YKxfEvSQC6ihIC3oz8zmq X-Received: by 2002:a05:6402:694:: with SMTP id f20mr21395567edy.100.1633380759792; Mon, 04 Oct 2021 13:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633380759; cv=none; d=google.com; s=arc-20160816; b=VGEFuZgYpxOKwfAjdivwjjDyYUjXNjjDhdL2wizI4N4S4cxzqQWZnjvhVTnLwlj4K7 gFygAh15ItOJSiCkUBxcQY1ctv6SgfXNn8THu5Q7nK08d+SayOeMehxaEpBTvp8BVuep 99n9FjvZncqpnU6zjPj11xzDvqo4AMQgWkeDBOVuQGdzQ8AuY3UvPxq6SJ9hfQtDysKn K7aB/4QaqzNuWFsnyc4YxcTUh7n0uXwOfaMneqbJR8R8DfDaa9hvMRktQDopz1Wy/ROh w7ntiLOymktbAsS/xrr9jf6auaaSXaYhB4XxwlBiXrvn7PCSd/bhj0X5NfmVk9UB5B+k L47g== 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=HfDUYoQzJwy4R/8fL8iAgZHCzQjEL/kY20VL7MgcC5w=; b=b9xhkhSUKbFOZjokdbBrQdNc9k20UsuIrdjSjSd+X3BFSlokncHZaiD1uLSQ+2zFXq U3K9yehBvM/kPnOd6FXhC0d0z4JonU4BDBr4F4dl8psFD31gHUHTFcjpJn1BtEPROE6+ iBesUn5x/vYGGTS+AC/WZSXWcWzpUQQIdTrsJdv4G+OwVgmQjXbMOKch/CM4+BCGk5O8 X2785MMbqn2IhtC6F9TwGvrdAmgP8mcg2bfMgLRYtTOVSgZOh1iziVUlFxSLvTcPAzhi SU8GWPBG/2DojXCLxCmeD8/pkJeIeI9GiAb2mXwMTX4Z9norjAu62wm908MvvuzhF5AX oQXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EFLzgJFe; 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 n20si14358637ejb.299.2021.10.04.13.52.15; Mon, 04 Oct 2021 13:52:39 -0700 (PDT) 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=EFLzgJFe; 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 S238346AbhJDNoM (ORCPT + 99 others); Mon, 4 Oct 2021 09:44:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:51850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238289AbhJDNl7 (ORCPT ); Mon, 4 Oct 2021 09:41:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF1D161B52; Mon, 4 Oct 2021 13:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353553; bh=IzX+7kyTjOmmo3IZvMRuxS+FxjknT4JV4igwfZ8qs3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFLzgJFeeF+P2W1HHXeLoqYlD9gDShCKuhQWLcPDoagSImgiwoOjUIXhF0k05hZlr 9FXaR48uQknio6ifPsipHrnUFBvguYirQ4Rx1PYVUHSWP8S5ERX++yg6VVbmlzdk58 M1s19T45fsxhhqOZfrkJA2kyx74LFNOidZ2MqN+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+20191dc583eff8602d2d@syzkaller.appspotmail.com, Shreyansh Chouhan , Herbert Xu Subject: [PATCH 5.14 167/172] crypto: aesni - xts_crypt() return if walk.nbytes is 0 Date: Mon, 4 Oct 2021 14:53:37 +0200 Message-Id: <20211004125050.365000165@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@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: Shreyansh Chouhan commit 72ff2bf04db2a48840df93a461b7115900f46c05 upstream. xts_crypt() code doesn't call kernel_fpu_end() after calling kernel_fpu_begin() if walk.nbytes is 0. The correct behavior should be not calling kernel_fpu_begin() if walk.nbytes is 0. Reported-by: syzbot+20191dc583eff8602d2d@syzkaller.appspotmail.com Signed-off-by: Shreyansh Chouhan Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- arch/x86/crypto/aesni-intel_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c @@ -849,7 +849,7 @@ static int xts_crypt(struct skcipher_req return -EINVAL; err = skcipher_walk_virt(&walk, req, false); - if (err) + if (!walk.nbytes) return err; if (unlikely(tail > 0 && walk.nbytes < walk.total)) {