Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4410209pxu; Mon, 12 Oct 2020 19:25:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOzv5H49T0gd2XJ+UHfG4YYAgRfgfDNfcKMf0D8jFAL/bgaZ2NHLv45jMRLkF1EIUCwVlM X-Received: by 2002:a17:906:ae48:: with SMTP id lf8mr19215799ejb.345.1602555906189; Mon, 12 Oct 2020 19:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602555906; cv=none; d=google.com; s=arc-20160816; b=wrLX+oyg8MdLAbi0zLqK5VG7nJGcvs6xAKlUa2m56RSRb5mxAzuE95DTEPUyNpuoR5 i8wqP3rkIlawhEhwkE4WLIWFTSZhWrl53WUnHpRo7XwSHCqBjiLWqAp92MmREqMEIGfx /ohm6svGutXHz+IP/1Ymk1Hnw+NI0WLgO18C5r9vM9nhCEC5omF+0YK24t68Hw3NfXqJ Je/NzelwGMtHR6urBnfNmg2qJFe7o95/HwRmIUigp75azF41nL6+qp1MEuMiMxVdEWU+ Rrn1Thza8xyJR2pIqG5LHm+YXxo0m7/hFnYFqUhlnsQWZSyyJovHJDjj8SfOsDcvbyNi mBcw== 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=XKYsEqhTrR2aRB7BcXKFCb2UTia8sUZVyrtWu1cQTco=; b=BkVt+mJTnptpC5GSC7p3KambM3sjIBRxn93XikxH6Nfde0zlF9/O1HZ3f3ElLsLz9b D9SJAvhz9KeZ9Z33sUsiZ/MSI4p0BAo0/zJ9McZlPNxb+hKBI41RrEqS2J9l82pwrVVm 5WwoOxI3dzN3gAp8TWdAuKQWY2UJbrC/duDcFIP0fAwev2/qZeIHNTrM+1zF0DopYLI4 AhQkzY4m10aXTB69T0RsA2Hixt+PUddFWszV42chNVNLr5rv49k2cZYotr1xwszMCZsz d4fNzFkC0TOmXCHzXLw4/XMlr8xqzH5MMUOi+hGQo6lXY/hpFRbeN+GGWkRwtfgHsh+A Ktig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="HWy/z2jX"; 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=fail (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 f5si4887181edw.9.2020.10.12.19.24.44; Mon, 12 Oct 2020 19:25:06 -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=@kernel.org header.s=default header.b="HWy/z2jX"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390785AbgJLOCQ (ORCPT + 99 others); Mon, 12 Oct 2020 10:02:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:40156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730285AbgJLNiB (ORCPT ); Mon, 12 Oct 2020 09:38:01 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A424622268; Mon, 12 Oct 2020 13:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602509868; bh=g9eZMOySVwoeHzqMnMxXsSUskHfz637tZ/TK/8hEtgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HWy/z2jXvaMe4Z3+uOZhhWE1B47ufqujbUDpI5/fJ+kscbyk7/hNpu/2Ndcask3n3 U2gIdWNCasBroVgR9uJY9DM0NKH+memnjQ4fZ3glM+643KZjXE8kiTnER/E0ckt692 xy0cXgmfIFosFsdDQuNF4+kHqShCUkH/cWog9eKw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Sasha Levin Subject: [PATCH 4.14 64/70] rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read() Date: Mon, 12 Oct 2020 15:27:20 +0200 Message-Id: <20201012132633.284230434@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132630.201442517@linuxfoundation.org> References: <20201012132630.201442517@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: David Howells [ Upstream commit 9a059cd5ca7d9c5c4ca5a6e755cf72f230176b6a ] If rxrpc_read() (which allows KEYCTL_READ to read a key), sees a token of a type it doesn't recognise, it can BUG in a couple of places, which is unnecessary as it can easily get back to userspace. Fix this to print an error message instead. Fixes: 99455153d067 ("RxRPC: Parse security index 5 keys (Kerberos 5)") Signed-off-by: David Howells Signed-off-by: Sasha Levin --- net/rxrpc/key.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c index fead67b42a993..1fe203c56faf0 100644 --- a/net/rxrpc/key.c +++ b/net/rxrpc/key.c @@ -1110,7 +1110,8 @@ static long rxrpc_read(const struct key *key, break; default: /* we have a ticket we can't encode */ - BUG(); + pr_err("Unsupported key token type (%u)\n", + token->security_index); continue; } @@ -1226,7 +1227,6 @@ static long rxrpc_read(const struct key *key, break; default: - BUG(); break; } -- 2.25.1