From patchwork Sat Mar 3 00:59:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 880968 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NRD8jU2F"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ztSWC2yXGz9s92 for ; Sat, 3 Mar 2018 11:59:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964836AbeCCA7u (ORCPT ); Fri, 2 Mar 2018 19:59:50 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:44354 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964833AbeCCA7s (ORCPT ); Fri, 2 Mar 2018 19:59:48 -0500 Received: by mail-io0-f196.google.com with SMTP id h23so12434854iob.11 for ; Fri, 02 Mar 2018 16:59:48 -0800 (PST) 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=qNwJ+e1qZ3CQ/5VDtohMlBSLG4W7peUdiIiitioh4Wk=; b=NRD8jU2Fl6NraIsPY1W3qsfyeiRZZMN7f4k/ebmyYfWr1wF8sibRpc4AB2Jim7hwha 3qr3I5OE4nVroCktWRhoQIgt58skK1d2D5FnETzWzMkBsofdOw0prkWCo5Sneq+B3xTv kkhjr4MFdjqIaOzrpMf5PMW2Uubm8e6qGAi2X7R4iycXqK6Y75UzU5UdOHXrbq8Mw7ob RkNdcR4L1+DwXPxHZLws8S3jhXqU/ifrn7OUEaQbX2bayfirtNxQtqi1OvLYs9RWMvia 2Ij3iTQQvPVWqcRhFRMOl+OW431Plvg2K7dhwZZXTz/B98nkTeYKu+fOSxTOOaJwoa4Q 9mHA== 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=qNwJ+e1qZ3CQ/5VDtohMlBSLG4W7peUdiIiitioh4Wk=; b=rmKqNyTzgRI7mKCK4R6OlBjX9bJ/+/zfWajepK/C74/iSmbrQ5RtMK828lG3zVjihv ilsOLtnWcBMSKjpC4sVXIXgr2X/rzKD6F73XlsyRyX43W/BuupALIKM+F+ZpriCRbI4X +8OFg1wdsIwgKmZ+CZIKa6h0bssdmhm2Zd0NwRvqZ+F9zpTo1w3pVqCq8Frs/vaTfd+k HbRaA2+hvo1/jEKDB7ou8d6epxROozDu/ScrZX6ciQbqWE0qQIU+6BJQlpUedF02sre7 GaO8+4UH0wtjMyCMdgr69NnBb1riIBvNWT3aIkLfp4P3gZMe3ARn0M+HdioKpt9sIt73 KNow== X-Gm-Message-State: APf1xPBezze7U0eRuuzyuAF/k2uANVierq3NNNAehe3pLEq0PSwuOZQk j7PKqOdICCcICFaHEDMA3dblQUK4 X-Google-Smtp-Source: AG47ELsKKn37x22NCvRjWj6F8iSUptDp06+7D+pCb5UVYZjFX7a4tmLe3M86e4ViWbZH04c+J338gA== X-Received: by 10.107.24.194 with SMTP id 185mr9245437ioy.157.1520038787690; Fri, 02 Mar 2018 16:59:47 -0800 (PST) Received: from ebiggers-linuxstation.kir.corp.google.com ([2620:15c:17:3:dc28:5c82:b905:e8a8]) by smtp.gmail.com with ESMTPSA id p135sm1382972itg.44.2018.03.02.16.59.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Mar 2018 16:59:47 -0800 (PST) From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Eric Biggers Subject: [PATCH 03/10] e2fsck: fix reading fscrypt_symlink_data.len Date: Fri, 2 Mar 2018 16:59:16 -0800 Message-Id: <20180303005923.152761-4-ebiggers3@gmail.com> X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog In-Reply-To: <20180303005923.152761-1-ebiggers3@gmail.com> References: <20180303005923.152761-1-ebiggers3@gmail.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers The ciphertext length field stored at the beginning of encrypted symlink targets is 16-bit. But e2fsck_pass1_check_symlink() is reading it as 32-bit. This was apparently left over from an earlier on-disk format that was not merged. Fix it. This bug caused a small proportion of encrypted symlinks with 4092-byte targets to be considered invalid by e2fsck, but otherwise had no effect. Fixes: 62ad24802c6e ("e2fsck: handle encrypted directories which are indexed using htree") Signed-off-by: Eric Biggers --- e2fsck/pass1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 5015d938..b101df0a 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -249,7 +249,7 @@ int e2fsck_pass1_check_symlink(ext2_filsys fs, ext2_ino_t ino, return 0; if (inode->i_flags & EXT4_ENCRYPT_FL) { - len = ext2fs_le32_to_cpu(*((__u32 *)buf)) + 4; + len = ext2fs_le16_to_cpu(*((__u16 *)buf)) + 2; } else { len = strnlen(buf, fs->blocksize); }