Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4407267pxu; Mon, 12 Oct 2020 19:17:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0G6oxjXyOlSHNusXyJo3xWbBtdUl+9zwGLmHvvN4Wt/QDf5hC2LDJUPQyWawB9+1+BTXA X-Received: by 2002:aa7:d844:: with SMTP id f4mr17259211eds.194.1602555468391; Mon, 12 Oct 2020 19:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602555468; cv=none; d=google.com; s=arc-20160816; b=g10SpggmV9VuiwNs+N+dyGL00kn+Ge8E9OpdYlzToMyGzqXZvn0bU8mC9aPHq0YuCW XIZzaDv93Hl1m8XmMRvJvEBqMAbwNCESN7tr/FwJdKvvtap+59Zp+b6/Cz+fS/v4KYtD iHJzPfpRBeZveG/LCoC6CakfaNs7f5yYoyoIXDvFaQmCoBUAcDPZxSOUcdil1GwygzN8 AQGJh15y8krnySarBd1j3+JktPX9P/zqIUIJwnxDNPNEn5WqBjVg9bZqpReic+2c95lk c4QFCFklr6IPOPQ4yMKcnnbUmb8uuV6uopYArljqSjucPbMrJEtWTs+uLFugKqyT0mJH YFuw== 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=gfBBT6JOf3vwgQAbEWXL7AGE8gKTSREmZhhFA/Ps/rLJGS1DOk4xGyhi7ArGSCdf+5 HQCQtDl27zouW+EnTQ65xfQGhhedoxi49vzvfwJoHEb/1A6Mq5EOIfAESR6itH+G/sd+ oLR1Iaf7VBvb1Qoq2cevSgFdbwiCTmicDmSSZZ/NsdNJL8eaWIg2pdqc1IPm+Ii9LZPL QW0MNXg/GmSifY7SCbFZmi16zc4+ZrdJhWu8nS4vjcW06hsBt5UYVEMGoEaSfZVjMViT T0u3gdTjURSKG93Znrq8PMg9B2dVdR6liuyRBvarFJ5uXdbCB+Qs7O0it/Dee79o2lko f2Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rGPbaYCV; 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 d12si15463783ejj.595.2020.10.12.19.17.26; Mon, 12 Oct 2020 19:17:48 -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=rGPbaYCV; 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 S2390447AbgJLOAL (ORCPT + 99 others); Mon, 12 Oct 2020 10:00:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:43744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730786AbgJLNjr (ORCPT ); Mon, 12 Oct 2020 09:39:47 -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 31EDF2076E; Mon, 12 Oct 2020 13:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602509986; bh=g9eZMOySVwoeHzqMnMxXsSUskHfz637tZ/TK/8hEtgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGPbaYCVXVWI99tbAJd3ZWTKL8Jod1nYk3RqouQ3tlNgBMkWUSPcIiVMEe2lMTB4a BRMwepJD5g129Bxs0TxrmIdrjRW8nVNNTJM7HzEnDmfyOk81AKUWz08BoM8swLbYIv CV0FgA9hqeUs8rVODIPxEkkM2yK2S2OflysUsZBk= 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.19 43/49] rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read() Date: Mon, 12 Oct 2020 15:27:29 +0200 Message-Id: <20201012132631.396121637@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132629.469542486@linuxfoundation.org> References: <20201012132629.469542486@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