Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2527422imu; Thu, 29 Nov 2018 06:26:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/UUBW0dVxmVVR30gLfCDSmRJEKCeQ9S89DW8OhNXLkkTU2xJippL3hRbBLc2F9R1Kyy2vKb X-Received: by 2002:a17:902:9b93:: with SMTP id y19mr1701227plp.336.1543501577098; Thu, 29 Nov 2018 06:26:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501577; cv=none; d=google.com; s=arc-20160816; b=RtI5NIcL9asqqDIvyGegWDADCBvY4AxQpcbmQzfNyg+OEaaZbDFiZw2+J72/OzcOJH CtCs3QzaIg9JCL2ou+hFqDjyY7SolJyLu0mM+gnMVe1+IozqhhmDFPxCmsVnyiO11+Mx yVV1/QgZ1gUrOSyOTFFNTH24eIQmhiyIEzsUJf77UScshCDLhdb3HfDITWfRMyuvCgvc Ri6ip9tagw7odioKjCtDV6/jLjKjoLcWVbsVvdl7MTgM7aegktZEaBB2lAn0V8QoBgK7 Rasc6GElwKfVKsP6XN9I5VP3bKavWoOp8M8Z/9BKxMVZcLRAbxHFndtf4C4xIU6420di pUbg== 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=0gUy/oa8Tt9aPsF/QAfvTMOQmqZWNWOty73/0DlOMYM=; b=PertOUjqYreyCl8NEV8w+ZXnF79WHfBah19WVXUuPyn2k2rcpn0MbrfbX/jfbdN8+p OejYtD+dKXwZo34Yy8g7DSPccuS8pOiqELIDJtO98vG/FQNsl/xPpUxhjthRjP2GGf+O Y76ZQwjs23oKKm07xvYvuV6Udenbjqv459zmPt/KcNt5BSEn8HvGffsBte0GBfbcJHg6 g1BT+S3lKJPSohk58g4xQ13gfAV8qJy+F4BtEMqEgK3QDFQDiKxu+rDjnbjBaw0n5idb fgfC1r6JFmGUoW7Lzaud8jSJvuQKOPAxYjGKT15/0HT1t6u7nsnvWej0pp1ODDJhnMV/ XmHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VqmJFibJ; 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 d69si1987081pga.184.2018.11.29.06.26.01; Thu, 29 Nov 2018 06:26:17 -0800 (PST) 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=VqmJFibJ; 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 S1732863AbeK3Baj (ORCPT + 99 others); Thu, 29 Nov 2018 20:30:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:57766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732853AbeK3Bai (ORCPT ); Thu, 29 Nov 2018 20:30:38 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 D9A8F205C9; Thu, 29 Nov 2018 14:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501506; bh=Vv2cPjs+cqncFpXmftdLT9pw5iIF72SfvWopc8RzXWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VqmJFibJ/cZms8x7z3yO5RTGcLoV1+Ty7TOMKaWXBzFFqANF7Ir1wxaZXnzHdJOHH JZrJrjp3YS7xeY0K7orJkc9HkGYYmyko5dfpQoIZWso2eeyJ/0CDQIsO7Px4zDET/u Swv/ZJdLnhpvxt0FOWDRuoTKzvpPrjLNt05WZ6Ow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+dcb8b3587445007f5808@syzkaller.appspotmail.com, Andrew Price , Bob Peterson Subject: [PATCH 4.14 026/100] gfs2: Dont leave s_fs_info pointing to freed memory in init_sbd Date: Thu, 29 Nov 2018 15:11:56 +0100 Message-Id: <20181129140100.989374861@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140058.768942700@linuxfoundation.org> References: <20181129140058.768942700@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: Andrew Price commit 4c62bd9cea7bcf10292f7e4c57a2bca332942697 upstream. When alloc_percpu() fails, sdp gets freed but sb->s_fs_info still points to the same address. Move the assignment after that error check so that s_fs_info can only point to a valid sdp or NULL, which is checked for later in the error path, in gfs2_kill_super(). Reported-by: syzbot+dcb8b3587445007f5808@syzkaller.appspotmail.com Signed-off-by: Andrew Price Signed-off-by: Bob Peterson Signed-off-by: Greg Kroah-Hartman --- fs/gfs2/ops_fstype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -72,13 +72,13 @@ static struct gfs2_sbd *init_sbd(struct if (!sdp) return NULL; - sb->s_fs_info = sdp; sdp->sd_vfs = sb; sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats); if (!sdp->sd_lkstats) { kfree(sdp); return NULL; } + sb->s_fs_info = sdp; set_bit(SDF_NOJOURNALID, &sdp->sd_flags); gfs2_tune_init(&sdp->sd_tune);