From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steffen Klassert Subject: Re: xfrm: Return error on unknown switch in init_state Date: Fri, 5 Jan 2018 09:32:47 +0100 Message-ID: <20180105083247.ce7hu2lmy64fyff5@gauss3.secunet.de> References: <20180104112104.GA6437@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: To: Herbert Xu Return-path: Received: from a.mx.secunet.com ([62.96.220.36]:44048 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751366AbeAEIct (ORCPT ); Fri, 5 Jan 2018 03:32:49 -0500 Content-Disposition: inline In-Reply-To: <20180104112104.GA6437@gondor.apana.org.au> Sender: netdev-owner@vger.kernel.org List-ID: On Thu, Jan 04, 2018 at 10:21:04PM +1100, Herbert Xu wrote: > Currently esp will happily create an xfrm state with an unknown > encap type for IPv4 or an unknown mode for IPv6, without setting > the necessary state parameters. This patch fixes it by returning > -EINVAL. Looks like we catch the unknown mode in __xfrm_init_state(). But in any case, if we want to return -EINVAL on unknown mode, we should do it for IPv6 and for IPv4.