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 X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20CC0C433DF for ; Mon, 12 Oct 2020 13:44:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D241421BE5 for ; Mon, 12 Oct 2020 13:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510272; bh=Ut6KHLaSy8tNe7tzpQc8C15DiC5Rw6/5u5gY2qHqNGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hAX2gSYahMgT3BLdPTa5dNvUPBz5d8bBEGIsx1X+fqUi6QN+Bn/fg49WnA2oAQ75X qzAhLVmMvI4lhamnR2ebrQIwvR3F0FGv5HldiyMgIp3ccAX3XgRVPkwaG+xfaR9La+ jARnQHnafoCTwvlYw6P/myV1UmR/wNKnGptdt6EU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389498AbgJLNo3 (ORCPT ); Mon, 12 Oct 2020 09:44:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:46910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731563AbgJLNmx (ORCPT ); Mon, 12 Oct 2020 09:42:53 -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 EDF0920878; Mon, 12 Oct 2020 13:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510173; bh=Ut6KHLaSy8tNe7tzpQc8C15DiC5Rw6/5u5gY2qHqNGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4L+dhN8875rxV6u/NfPyvK+Atq88tf03aOo7zybh4symVvinnrl1fRHXa4ZBoHKh kAjRwxD5DpX3x0857HbbvcPEFWF0275roxO0g1/yyJfk+/8LuScYZyHDdLYaHakkmH sabLYrUExbWiwqUPjh7raH8kogkX6nP1W+xBmWrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Sasha Levin Subject: [PATCH 5.4 71/85] rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read() Date: Mon, 12 Oct 2020 15:27:34 +0200 Message-Id: <20201012132636.259092014@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132632.846779148@linuxfoundation.org> References: <20201012132632.846779148@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 d77e89766406a..32f46edcf7c67 100644 --- a/net/rxrpc/key.c +++ b/net/rxrpc/key.c @@ -1108,7 +1108,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; } @@ -1224,7 +1225,6 @@ static long rxrpc_read(const struct key *key, break; default: - BUG(); break; } -- 2.25.1