From mboxrd@z Thu Jan 1 00:00:00 1970 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 A880BC678D5 for ; Tue, 7 Mar 2023 17:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231486AbjCGRZY (ORCPT ); Tue, 7 Mar 2023 12:25:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbjCGRY7 (ORCPT ); Tue, 7 Mar 2023 12:24:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDA77907B9 for ; Tue, 7 Mar 2023 09:20:12 -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 A2777B819AE for ; Tue, 7 Mar 2023 17:20:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9D7CC433EF; Tue, 7 Mar 2023 17:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678209610; bh=P5HzVKcEUCVyb5REcopqsBZna/jJTH8Ems7YQtTQ/AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hrO0lgv51HKeJ8ZOimLwtVSys4rXlLo7zNg0FIA3uYgfUP1y5jDUfo4YRX/ynXvhu CmxDJ2fbP9Zyp1KXDjbpNqhat5lSCV5E5Zk2YCwQgKudn+gf03sF2jEkINI3k25vhi zjO5cyBjPV8W851sMD4AI9e95lEyBy+RrbmaSIWU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Halil Pasic , Janosch Frank , Tony Krowiak , Pierre Morel , Heiko Carstens , Sasha Levin Subject: [PATCH 6.2 0274/1001] s390: vfio-ap: tighten the NIB validity check Date: Tue, 7 Mar 2023 17:50:46 +0100 Message-Id: <20230307170033.568930511@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307170022.094103862@linuxfoundation.org> References: <20230307170022.094103862@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Halil Pasic [ Upstream commit a64a6d23874c574d30a9816124b2dc37467f3811 ] The NIB is architecturally invalid if the address designates a storage location that is not installed or if it is zero. Signed-off-by: Halil Pasic Reported-by: Janosch Frank Fixes: ec89b55e3bce ("s390: ap: implement PAPQ AQIC interception in kernel") Reviewed-by: Tony Krowiak Reviewed-by: Pierre Morel Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin --- drivers/s390/crypto/vfio_ap_ops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index b0b25bc95985b..2bba5ed83dfcf 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -349,6 +349,8 @@ static int vfio_ap_validate_nib(struct kvm_vcpu *vcpu, dma_addr_t *nib) { *nib = vcpu->run->s.regs.gprs[2]; + if (!*nib) + return -EINVAL; if (kvm_is_error_hva(gfn_to_hva(vcpu->kvm, *nib >> PAGE_SHIFT))) return -EINVAL; -- 2.39.2