Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2459168yba; Mon, 15 Apr 2019 12:05:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9jmdhsmOROjU2AjxtiNcquFEklym5fkHsp4vSehJ9jxopGS0D/rOU/6tWKQzFv4BWxnl2 X-Received: by 2002:a17:902:a50d:: with SMTP id s13mr21457141plq.58.1555355136194; Mon, 15 Apr 2019 12:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555355136; cv=none; d=google.com; s=arc-20160816; b=L5FXb666baLnuUk0I0J//vgW17G4pvlrUcWsP1mO00H3TL+AC/Jy6oSm8Jn+PA0zLN xY/++3k/J8ZGqH2vkJQ/3V3KxM4bj/5/uUy5dkKEIly8ShfD8tDFYGGzsdv/k9LBI2EV MplKi2Fu+L/qTipQe7OrLCGd71iIE921TUmt+tmlpuFIIQnlqxMgwWpech4mGxuRsP7q eWfPoj9cVLR6BsnOcf90VccDje2BxOTMRwK29VWpVkIKh92ttO1LsZ1XJDaQjET6QgyA MjbhK3JfafwwkyOSVkJyEtt7fJSb1E2b5Fd4SW1moDvKKJhvp6/h7gPCDuF4vmimNEC4 IgBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0frHnrfiDDbLyZNpvlnTAbQEGySTVAqKzkZtFoYkNqQ=; b=lpc/dGeh84Wf8Aigpj9t7fqacN0NRTIoTNducxdzT3CrfHvpH0zVDrPKWVP5kLUGXO SRXNBWle9a7lFWjIr371rPmDXD9xAX5A1TPW2JrP/wPMTvrfEoeQhhuQKoo24fK9SjaS rGzj8rgUMv4mJ4aMAUbFLf/7IS+Aw0pCSsFGZSHplLHQxTCnYvLWOomael4lWNlaNE7r Djh0Hj9zyikiFL/8w0fVWvnVUtJq1Gu8A4/Bhq6qWigo9aD/kmP5oPYHUfHtadqv7Rc+ wlU4TC3O9v+W1YE93Giyu60WVxnotdKRtF9AdyO/22lRez/wXf5DHNfYq3/7sVaybxSf l2pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AGOYUOFK; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si44476241pft.98.2019.04.15.12.05.19; Mon, 15 Apr 2019 12:05:36 -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=@kernel.org header.s=default header.b=AGOYUOFK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729440AbfDOTEF (ORCPT + 99 others); Mon, 15 Apr 2019 15:04:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:36590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728627AbfDOTED (ORCPT ); Mon, 15 Apr 2019 15:04:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 74C542087C; Mon, 15 Apr 2019 19:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355042; bh=qAjLeI4y7mshz633X3144W3Gv1o1XJv8lhRXta9DLvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AGOYUOFK0WnAkD0z9L4m2nc/sslshcNL3ZyKOQ8IcsMQpCRj85iECthUS4VD9jp7g U0Fj2PYrVgmmonq8WXzv8gkHim8wMzZyi5ThzN4o7QjuXQ1ApT40LL/oK/USMAlkyd l3eLjr2t/0DZG8GZnqKwRPFechZXSPsfwgJCqZEs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Anand Jain , David Sterba Subject: [PATCH 4.14 47/69] btrfs: prop: fix zstd compression parameter validation Date: Mon, 15 Apr 2019 20:59:05 +0200 Message-Id: <20190415183733.789591359@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183726.036654568@linuxfoundation.org> References: <20190415183726.036654568@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anand Jain commit 50398fde997f6be8faebdb5f38e9c9c467370f51 upstream. We let pass zstd compression parameter even if it is not fully valid. For example: $ btrfs prop set /btrfs compression zst $ btrfs prop get /btrfs compression compression=zst zlib and lzo are fine. Fix it by checking the correct prefix length. Fixes: 5c1aab1dd544 ("btrfs: Add zstd support") CC: stable@vger.kernel.org # 4.14+ Reviewed-by: Nikolay Borisov Signed-off-by: Anand Jain Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/props.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/props.c +++ b/fs/btrfs/props.c @@ -416,7 +416,7 @@ static int prop_compression_apply(struct btrfs_set_fs_incompat(fs_info, COMPRESS_LZO); } else if (!strncmp("zlib", value, 4)) { type = BTRFS_COMPRESS_ZLIB; - } else if (!strncmp("zstd", value, len)) { + } else if (!strncmp("zstd", value, 4)) { type = BTRFS_COMPRESS_ZSTD; btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD); } else {