Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4538981imm; Mon, 17 Sep 2018 16:07:13 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda6o2tH66IsLaEqTvfWVhUJ2l+3jqj49GJ1v7dk+iphk/guZAfuq3PzD4ArRxQ4m0NeMo4v X-Received: by 2002:a17:902:aa49:: with SMTP id c9-v6mr26284646plr.195.1537225633457; Mon, 17 Sep 2018 16:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537225633; cv=none; d=google.com; s=arc-20160816; b=hi/x4AYld2KRKbce5tNGk3Fb+7xg11wY6HLR+PRL1c+90M3uvL/8WpLwYQnShbO3/F 6rgrWbp7hPFsSu65Lz1LVEVJeW6mOXJfG95vhAYp0BTPkfQu2+rDY1bVO4shTvkq7IP0 EVOClYLUDX5e842Ut2iHzEhMnQylONwkFqdLtKMI7XPX9toc1HhAt4AgpLTbWFkcOF8s w9z8c7f2Xcc5dlNO1ss5MCxFAJ/h8JXjQN+DA4o7j4bKSdyxUJ5E2pcq0o7yFOfI5XNg WA3nkKliELZuFftfRVhDC/iWGmMJoz2KHEjd6xdfoS54/aIRyxxnqzDyIKN61ARVK336 eZNg== 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; bh=YShT++CGyrlCzrzjwmzbbOYyCaLWsPc48NzCfG6ruDI=; b=q/2PhKEfKi2m7wp8oNPh8okKw0No78Z8vItFQZuindQnlsFks5Q5QxqkyeH/SS+ijc TN9LZWij8dx2O/h2jEosKa9Nbky4VWWo/Y3N5jgCxHEA9WzTGNLxT5wxAglYdvGbxFSJ kQY2a2Gh4EnbGd2dzDOKEUgZMGsc0fhD16whD2JryECC6KcE3hocCGm7nksi/+/r7zdE SaRUJK7UfC77EPgMag6WN6wQZtouuyyuesoi0sNgQUjhlHvyb4feLSz69nl5aMf7z/1+ cP+JwFjrRoFotyizVBZuEwpW+4VluBvwK5AbvM5qDE1bo6ewbQkOlrcrgVEgb/CzGxWh 6JNw== ARC-Authentication-Results: i=1; mx.google.com; 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 205-v6si16115509pgd.271.2018.09.17.16.06.58; Mon, 17 Sep 2018 16:07:13 -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; 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 S1731370AbeIREgU (ORCPT + 99 others); Tue, 18 Sep 2018 00:36:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49574 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728677AbeIREgU (ORCPT ); Tue, 18 Sep 2018 00:36:20 -0400 Received: from localhost (li1825-44.members.linode.com [172.104.248.44]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1EB8FC49; Mon, 17 Sep 2018 23:06:49 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+87c3c541582e56943277@syzkaller.appspotmail.com, Ian Kent , Andrew Morton , Linus Torvalds , Zubin Mithra Subject: [PATCH 4.14 125/126] autofs: fix autofs_sbi() does not check super block type Date: Tue, 18 Sep 2018 00:42:53 +0200 Message-Id: <20180917211712.156565386@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917211703.481236999@linuxfoundation.org> References: <20180917211703.481236999@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ian Kent commit 0633da48f0793aeba27f82d30605624416723a91 upstream. autofs_sbi() does not check the superblock magic number to verify it has been given an autofs super block. Backport Note: autofs4 has been renamed to autofs upstream. As a result the upstream patch does not apply cleanly onto 4.14.y. Link: http://lkml.kernel.org/r/153475422934.17131.7563724552005298277.stgit@pluto.themaw.net Reported-by: Signed-off-by: Ian Kent Reviewed-by: Andrew Morton Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Zubin Mithra Signed-off-by: Greg Kroah-Hartman --- fs/autofs4/autofs_i.h | 4 +++- fs/autofs4/inode.c | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h @@ -26,6 +26,7 @@ #include #include #include +#include /* This is the range of ioctl() numbers we claim as ours */ #define AUTOFS_IOC_FIRST AUTOFS_IOC_READY @@ -124,7 +125,8 @@ struct autofs_sb_info { static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb) { - return (struct autofs_sb_info *)(sb->s_fs_info); + return sb->s_magic != AUTOFS_SUPER_MAGIC ? + NULL : (struct autofs_sb_info *)(sb->s_fs_info); } static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry) --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c @@ -14,7 +14,6 @@ #include #include #include -#include #include "autofs_i.h" #include