Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1904905imm; Sun, 8 Jul 2018 14:07:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdUUL3uRlGRzNpdB0Mj/w0I9ZvJBPVKxbfHMwVK+joQlKMJrYSo7xhEJ5/z6yKHBscf5IrL X-Received: by 2002:a63:b505:: with SMTP id y5-v6mr16864463pge.213.1531084051260; Sun, 08 Jul 2018 14:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531084051; cv=none; d=google.com; s=arc-20160816; b=XgEfYYMdnhNRlYAcciRdkgeVA+zCMK3EsOmhCufVMMJxuXyN/nic/USe5ZopgNaj0J 9viKgdDOHoeQQ0RD4n5RUG54yZ6IaoLL+1R7qOn97jqPAgp+DFc+Y8Q8yDg1sQ2l7AuZ uvEb07T8it3OWIJZb25+DT+eqko4u+eLsEUuYBPl6CtcfJUK9fX/a3LyV3c/Cl5mNlZ3 HRdMLif6Csq32fA7CzlYWg45VTtQn9fv5CoyE806qiN62j5N/DiGzPMK4meEsc0zWf0L czGXBMqlh0BkZGTi7Vp+RSRRk7Ks1uCVqjz0jM8IK45Xd6RfXFJz2sk14EhR1VpFsJSu an6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=tQgirrJxXJmTmU+afvcNHwBLtlIR/mauWurgdutbcLM=; b=oVuSywrYMNbhvgweIOs4pQhx+bbkxwgCIMg0Bgvnx4h2nzDp8e8qleob1vio/EbO1e VnSSzvv8zR8mVNt2oOsGk1fs87VWrYWlGYxmjV5FPTlbAhPFYzviUYWLc2O8A88tUeeg Ant6CIj78+xnyYTTPp+gIB9IIJNkumYqLxyNym4RShhZ+yVo46axc6T4q7kyjnFlEXxR pmET9aE/vQuF6c3LlQ/NeMCOZeDOMJcEXmaTDvO2qglIHGSoihJfu88djWalgv0slLHb y/0wyCqtNEyNm3B8Cl8V4GQtLavdsu+6GC0akaU3XfDb3Q7mwpr/dV8LOraqzhoC0nAh EoTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iEN9obSj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y22-v6si12734329plp.489.2018.07.08.14.07.17; Sun, 08 Jul 2018 14:07:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iEN9obSj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933542AbeGHVFw (ORCPT + 99 others); Sun, 8 Jul 2018 17:05:52 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:37723 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932437AbeGHVFr (ORCPT ); Sun, 8 Jul 2018 17:05:47 -0400 Received: by mail-pf0-f196.google.com with SMTP id x10-v6so2291937pfm.4; Sun, 08 Jul 2018 14:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tQgirrJxXJmTmU+afvcNHwBLtlIR/mauWurgdutbcLM=; b=iEN9obSjbeaiXGTbCgnC05ErOUwahBXXOvzWhxO0lsuv0A4xlgmR9wvcaQ9d90vt11 y3CQOSQaE2HnWT/nMM6RzyHr0m3UYfDQdb5QhNRzT51655NqqRO5QwJM+CXsDtIp++qa AJlaBeF/m2N6a6GVsX5/NI4HlT9WeJ5yqXINfKWlsCuhjImx5ANZim3SVuWTor9pSI4W yXwfKEmCL8Oh5jv+hviDebeQ7RKFUb0mcA6baSQyyaXPNfo8yPZXQM0uSTEH0Rrt4HA6 nYP0FHcsrLDoLuQkQjgN9/5oNUDTfE7TYedST9MVD4jB/i8AtE9gDZGhfTLQHPejQOJ5 +TsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tQgirrJxXJmTmU+afvcNHwBLtlIR/mauWurgdutbcLM=; b=mlR/it91E1PJEoikksZ1DVEWY7BxbM5+hVw8piwT2ZGPqeZpR1Ng3z3BcLzBxQEi9V 7LVCWJAD0vWIPNkDmKhmmDOF5UOV34jThSHkZOgvqtYawUW15wIXzCD0ovQa4py8BLW+ vWPCGuVxV0ouxolvPv1Xc5Q7SdERpcpkvc4Nl86oOT/7aTww7aJF9S44Th8cU4yGwW/G vnZu7D4Si5shTa4QMpCaToSTm4URJcXsN7egVc7LqN0bOmRLUy7FVDGUmirK2Hrz1Cou UJzwOWddFcjnEbRBupnBctabVMJ9Lpu9IfXUad4w8/mLuLaW1+h1UbVNgwUqZAn73G/Y Ajmg== X-Gm-Message-State: APt69E3ddPAmUX4iglqz3yfKpDUIU2Kh9Kc1Iw+pL7JwM68cl0e41Kh1 gzbhzuFhpAtV82oPBnbIEJk= X-Received: by 2002:a62:d10b:: with SMTP id z11-v6mr18671440pfg.255.1531083946982; Sun, 08 Jul 2018 14:05:46 -0700 (PDT) Received: from sol.localdomain (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id x68-v6sm23355681pfb.138.2018.07.08.14.05.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jul 2018 14:05:46 -0700 (PDT) From: Eric Biggers To: David Howells , Alexander Viro , linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Eric Biggers Subject: [PATCH 17/18] fs_context: de-obfuscate command validation Date: Sun, 8 Jul 2018 14:01:53 -0700 Message-Id: <20180708210154.10423-18-ebiggers3@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180708210154.10423-1-ebiggers3@gmail.com> References: <20180708210154.10423-1-ebiggers3@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers Signed-off-by: Eric Biggers --- fs/fsopen.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/fsopen.c b/fs/fsopen.c index dd38f6b65aace..34d7292bb398e 100644 --- a/fs/fsopen.c +++ b/fs/fsopen.c @@ -50,10 +50,10 @@ static ssize_t fscontext_write(struct file *file, case 'x': break; default: - goto err_bad_cmd; + return -EINVAL; } if (opt[1] != ' ') - goto err_bad_cmd; + return -EINVAL; data = memdup_user_nul(_buf + 2, len - 2); if (IS_ERR(data)) @@ -136,8 +136,7 @@ static ssize_t fscontext_write(struct file *file, err_free: kfree(data); return ret; -err_bad_cmd: - return -EINVAL; + wrong_phase: ret = -EBUSY; goto err_unlock; -- 2.18.0