From patchwork Fri Jun 21 20:31:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cabaj X-Patchwork-Id: 1950966 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W5TYJ2j2Bz20Wb for ; Sat, 22 Jun 2024 06:32:03 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sKkvG-00013j-8D; Fri, 21 Jun 2024 20:31:50 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sKkvE-00013J-Md for kernel-team@lists.ubuntu.com; Fri, 21 Jun 2024 20:31:48 +0000 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 5A0613FE09 for ; Fri, 21 Jun 2024 20:31:48 +0000 (UTC) Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-6f8f8b59250so2583199a34.2 for ; Fri, 21 Jun 2024 13:31:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719001906; x=1719606706; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9gay1chi/kxpoYYD+QFjbY6V6x3fHgBPPwq5gw98sDk=; b=VMyZHDzJsHph0W2ht72yPP/cER1/Z0TfrdPLa4AJCEpvBif4kJEMlRCznHAeafJEy2 YHT+WBjnMgnOEijs5YfP7OywTGhx7cmXGqCaYe7UO+GrZGAIP7X/o7Ohin6IfO5uEvBH +BHTRmEhv8J8bvyeusb1M3wVRxUAWm7qVpCfnuyp4AEFN+0c2MU5EZ7Lc7+TtXVWBNWx 16wUa6qLtYU+YaalumxcbFnfq8D5q6eAMK6ndNzITvkBLiIxwHuMJjyybkICTKnmV+1S zs8milVpIrjkzQSGtqA2j3ZZQZqVT8IT3qNGw0UTPi/WGmCtLzGmSKm8t334VMuRKLGT ZN+w== X-Gm-Message-State: AOJu0Yxl8rRBtV10yVsxMsXgEeVFgi5VpUaYD+MPEtchWSUQvpZ4k8rT 5TSLP5F4ZMr8oIXlBoY9Vlk4gp9hDTXY3a2Tf/+EU9xqYrmEe9AOS2/3KwHdpLx9SXCN6s5x8h1 ELCTrfKDpwkqShVpjm/JtIcaNDYUWRcNiR3ZhtQP/49zAt0amGoh8zrG1JXsUquvqKMylDhpdAV V4UMWRqTUVOg== X-Received: by 2002:a9d:7a47:0:b0:6f9:b609:5a0c with SMTP id 46e09a7af769-7007401bb22mr11187746a34.17.1719001906729; Fri, 21 Jun 2024 13:31:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEWcAWHhi8pUsxX/BllspkQPt4h9EbRNsAtZdK+jT5aTqHK3OdcQ9VTAXrCwsXNT3/k9kEyQ== X-Received: by 2002:a9d:7a47:0:b0:6f9:b609:5a0c with SMTP id 46e09a7af769-7007401bb22mr11187717a34.17.1719001906212; Fri, 21 Jun 2024 13:31:46 -0700 (PDT) Received: from smtp.gmail.com (h208-73-92-250.mdtnwi.broadband.dynamic.tds.net. [208.73.92.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b51ed4bd10sm11838246d6.57.2024.06.21.13.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 13:31:45 -0700 (PDT) From: John Cabaj To: kernel-team@lists.ubuntu.com Subject: [SRU][j:azure][PATCH 1/1] keys: Fix overwrite of key expiration on instantiation Date: Fri, 21 Jun 2024 15:31:43 -0500 Message-Id: <20240621203143.200561-2-john.cabaj@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240621203143.200561-1-john.cabaj@canonical.com> References: <20240621203143.200561-1-john.cabaj@canonical.com> MIME-Version: 1.0 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: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Silvio Gissi BugLink: https://bugs.launchpad.net/bugs/2070076 The expiry time of a key is unconditionally overwritten during instantiation, defaulting to turn it permanent. This causes a problem for DNS resolution as the expiration set by user-space is overwritten to TIME64_MAX, disabling further DNS updates. Fix this by restoring the condition that key_set_expiry is only called when the pre-parser sets a specific expiry. Fixes: 39299bdd2546 ("keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry") Signed-off-by: Silvio Gissi cc: David Howells cc: Hazem Mohamed Abuelfotoh cc: linux-afs@lists.infradead.org cc: linux-cifs@vger.kernel.org cc: keyrings@vger.kernel.org cc: netdev@vger.kernel.org cc: stable@vger.kernel.org Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen (cherry picked from commit 9da27fb65a14c18efd4473e2e82b76b53ba60252) Signed-off-by: John Cabaj --- security/keys/key.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/keys/key.c b/security/keys/key.c index e65240641ca5..f2a84d86eab4 100644 --- a/security/keys/key.c +++ b/security/keys/key.c @@ -464,7 +464,8 @@ static int __key_instantiate_and_link(struct key *key, if (authkey) key_invalidate(authkey); - key_set_expiry(key, prep->expiry); + if (prep->expiry != TIME64_MAX) + key_set_expiry(key, prep->expiry); } }