Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp336256pxj; Fri, 7 May 2021 09:40:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQyoCEfElI4W8U6kgExQr78gUdKs16sv+jkEA0ShHkQAf48QJnVWkCsab0WZB/UGN4tPzj X-Received: by 2002:a17:90b:8cf:: with SMTP id ds15mr11265921pjb.110.1620405642890; Fri, 07 May 2021 09:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620405642; cv=none; d=google.com; s=arc-20160816; b=vS85ns9wze58ajfoJkm+aNBM3P2XCBN092ouaOxg4po++lF6ZCiEsSyReJp24kdVPb rMiYpbNjOiAJJ4N2upndN5gN0iu7t/hSasULIZ2IYDmvK0SvAZbJsnOeOWJBaOO19YnD +fxtTxaEu4oueP4LY05rWFs1b7qs8AeLL/A+Agl7sjbYz/sCHlwBSVDTTNuq6KNpMDGh 47EgUGz14c4wGeVzjp5iGnDgvOUUpkX+RvehpdZa5j8xfZacM1E/2zMKCRujlKd/Lhg3 oo8RUtmIYVv3VwZTj6KCwaKD525at/RI+yDm1wE/tB4F3AunTZ33z2ptq8RQ9MiHAnqV aE/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gbo+pAN5ZGQdkgVth2ZT+5bpiEQC93c2KAqT0/J7tE0=; b=Fv97TQvlkM29yTxvUbpJitBZssd178IX1LWF5qhd+dN4JY1pwPZZi/G9tnyo5dqY8d GHN0WgkJaRJ5Je6IkKiJ0o8j9FacBzXzQASjzhNcSSDTE94KTGUU13oZUxJaYJmxTwQF pP1Zssk21I/8zXJEndjpA3FpNRvtWZRqkVD1xlgJ2lWm/Z3gnO2t72EpD5WDX6uZbXW5 wDsY5Fjw8ebv8ToGoZ2EdPCal94I93SSrGTHj8SeRgMKZ3c3fGv/YBuPBbKOaA16QO2W ufo3GQAYFHw9W914HCLmxPbYUxDskS5vfO2/s32Uash9dUQ799WxIvVJv49nm+OH4bal JxNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rCOimIwu; 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=pass (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 l8si1210885pjn.147.2021.05.07.09.40.29; Fri, 07 May 2021 09:40:42 -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=@linuxfoundation.org header.s=korg header.b=rCOimIwu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236280AbhEGM2V (ORCPT + 99 others); Fri, 7 May 2021 08:28:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:54554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233468AbhEGM2U (ORCPT ); Fri, 7 May 2021 08:28:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EB0566145D; Fri, 7 May 2021 12:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620390440; bh=lHRE9JXgDKU9qUnQDDKQaDp6aEcA34kwR1z9u6Fuyak=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rCOimIwut6DOuOjoh8E37kjHgxSWf3y0Y96ZpFT/zuz9Gie5ehgEPtT87zouAz3HK Mu6cprjw+29uhikMWAE59cfqOvvcxdigBWwXaRRL1zlSNCWMiX+SGbUDcESzVkPPgl Hs16dL6VNmW3HZHADLbz+ZyG8bu0+UCXyxIkK2/o= Date: Fri, 7 May 2021 14:27:17 +0200 From: Greg Kroah-Hartman To: Ondrej Mosnacek Cc: linux-serial@vger.kernel.org, David Howells , Matthew Garrett , Kees Cook , Jiri Slaby , selinux@vger.kernel.org, linux-security-module@vger.kernel.org, James Morris , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] serial: core: fix suspicious security_locked_down() call Message-ID: References: <20210507115719.140799-1-omosnace@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210507115719.140799-1-omosnace@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 07, 2021 at 01:57:19PM +0200, Ondrej Mosnacek wrote: > The commit that added this check did so in a very strange way - first > security_locked_down() is called, its value stored into retval, and if > it's nonzero, then an additional check is made for (change_irq || > change_port), and if this is true, the function returns. However, if > the goto exit branch is not taken, the code keeps the retval value and > continues executing the function. Then, depending on whether > uport->ops->verify_port is set, the retval value may or may not be reset > to zero and eventually the error value from security_locked_down() may > abort the function a few lines below. > > I will go out on a limb and assume that this isn't the intended behavior > and that an error value from security_locked_down() was supposed to > abort the function only in case (change_irq || change_port) is true. Are you _sure_ about this? Verification from the authors and users of this odd feature might be good to have, as I am loath to change how this works without them weighing in here. thanks, greg k-h