From patchwork Wed Sep 26 14:37:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 975188 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42L0sj5mccz9s89; Thu, 27 Sep 2018 00:38:01 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1g5Awr-0007NC-EZ; Wed, 26 Sep 2018 14:37:53 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1g5Awp-0007Mu-5J for kernel-team@lists.ubuntu.com; Wed, 26 Sep 2018 14:37:51 +0000 Received: from mail-it1-f198.google.com ([209.85.166.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1g5Awo-0002vA-RQ for kernel-team@lists.ubuntu.com; Wed, 26 Sep 2018 14:37:50 +0000 Received: by mail-it1-f198.google.com with SMTP id w196-v6so3391754itb.4 for ; Wed, 26 Sep 2018 07:37:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=AHn/0RHed0enbEXcZheniiPtz+l3SkBp18gYFDuTCeo=; b=XrHYc0e9CnJLzSaa+2AA4R2pck+e90aTKaev2R2YiwgHbdFqDB+6Lp9y8kFflL9avp qEPQcPcdIKBTi+8sXXZIElA+QDlaxQbn6aNTNIoXyeA2y1sePeyukw2tbHF03m9CIMLd z6Ds2Kp6ljwOcjQOgHG7MSaimxc3xYfhIw9LWemlyS4hxhJ58tmWMjdJ5Y8xU0M7vHMs klwwazDcE2l2mfVMQMQVKD0yxF9pyJVh4sNIOKUlgSGpGydPaDovb2Rby3jvwh9rLPtf VzBO9lz31UN5OeNWvIvqGoj/lBQo6MoI7/6caQaDcQ0B3fPEaKm1a49u7SvkQColfnaO y2lA== X-Gm-Message-State: ABuFfohSC0g/+UaKgsYFAsUW3Lz7TVgrcU/lRKQbqYRtuMkKc00TZ/7S 9jiZz+goosz66ZlmvSqASkcWvzhmfNNHYRpzQgiGk139zxbGE/GJyxcmSU2TTEfV82+xg+dFhH0 Ko4yatuVuE5Euu0CdEf748W/Ci2H9NDVT219nTlfWJQ== X-Received: by 2002:a02:97c5:: with SMTP id v5-v6mr5776531jaj.72.1537972669485; Wed, 26 Sep 2018 07:37:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV61G1ECIlzTymPPhBS+5QOfAcYChyu6QXcJj17GkUXcQRoZHKQVNAZ4tbCnF1U6nl49BPiR0Ug== X-Received: by 2002:a02:97c5:: with SMTP id v5-v6mr5776500jaj.72.1537972669116; Wed, 26 Sep 2018 07:37:49 -0700 (PDT) Received: from localhost ([2605:a601:ac7:2a20:7891:1d10:21bb:42d5]) by smtp.gmail.com with ESMTPSA id g10-v6sm1894354iom.76.2018.09.26.07.37.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 07:37:48 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][Bionic] s390/crypto: Fix return code checking in cbc_paes_crypt() Date: Wed, 26 Sep 2018 09:37:46 -0500 Message-Id: <20180926143746.5992-2-seth.forshee@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926143746.5992-1-seth.forshee@canonical.com> References: <20180926143746.5992-1-seth.forshee@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Ingo Franzki BugLink: http://bugs.launchpad.net/bugs/1794294 The return code of cpacf_kmc() is less than the number of bytes to process in case of an error, not greater. The crypt routines for the other cipher modes already have this correctly. Cc: stable@vger.kernel.org # v4.11+ Fixes: 279378430768 ("s390/crypt: Add protected key AES module") Signed-off-by: Ingo Franzki Acked-by: Harald Freudenberger Signed-off-by: Martin Schwidefsky (cherry picked from commit b81126e01a8c6048249955feea46c8217ebefa91) Signed-off-by: Seth Forshee Acked-by: Colin Ian King Acked-by: Stefan Bader --- arch/s390/crypto/paes_s390.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c index 80b27294c1de..ab9a0ebecc19 100644 --- a/arch/s390/crypto/paes_s390.c +++ b/arch/s390/crypto/paes_s390.c @@ -208,7 +208,7 @@ static int cbc_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier, walk->dst.virt.addr, walk->src.virt.addr, n); if (k) ret = blkcipher_walk_done(desc, walk, nbytes - k); - if (n < k) { + if (k < n) { if (__cbc_paes_set_key(ctx) != 0) return blkcipher_walk_done(desc, walk, -EIO); memcpy(param.key, ctx->pk.protkey, MAXPROTKEYSIZE);