Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp687667imu; Sat, 15 Dec 2018 05:25:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/V6YPKBqSunRWz5jImz5Kmx9amKTRaE4Ko97oKWPwfOQ2hVjcVkz+ySED10OSVvOg9g2dnZ X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr6577579plp.180.1544880332120; Sat, 15 Dec 2018 05:25:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544880332; cv=none; d=google.com; s=arc-20160816; b=y2pYjIoHX3eVYDq/E6OxHmKOqtQol5vejwrwDM6Q2rAIxesqYvEUATgqMAYYepHbST kj4Qbqq3Rxz0FJD3GEh8a2y2TrywyvmWwkhjrAjmSEMUCGub2g02+/gY8Ob8qA9qb/72 77AAB4ZDrIaP+TFWIxJQjO/UUIGvwzEJzQdop1e79gDIbpH5NX7pveZHnckRzFH9jUXV s2dLMwxRafNhDnCOJ6fnsAUL4qTeWjqv2Dl9o+WhMo8wDX8HAZhBUG4WVCr6imygkBYb 6AjixzfYQRe5l9MfXHDL3v+OoajCybCwSmERlj/i7RmZ47UnWw3c5EVW++N959TJ0dd4 WZCw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=WmFF08o9bVWOmhmQCyYe3WWZoQY5MvM/KC/9vCka6nA=; b=gp7FfsBigT67+9KovMR2RaIW6zliOuxFuMZrl+rRRhIM7tui8KP34+Tp6x96C4BUGL fgYumpDPcLkwBCN+sedm6FAI8wKvzpSQ9TmNHrIK8r8QpNEFeAxI3hPY+HEJ1TiYhN0l n/l1JbhbJb5INMl9dom4JK3zhAte0eAqCVke2UsXBH+A4UK5baZac2snjoAiajoA+AOI /QG9zq2gDFFb/S/sYwH9e516QQ+zS2ewUpmyUUCAhJsDyQJaHlKXCpqNdYxT11ZycQmL DmLk6WxILeeE+OdHRXXju4JiHqYIc2v2msTUML9bWV3rH4lAegRGare4EBogXwj+IVwo uFgA== 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 a3si2886320pga.297.2018.12.15.05.25.16; Sat, 15 Dec 2018 05:25:32 -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; 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 S1730264AbeLONYP (ORCPT + 99 others); Sat, 15 Dec 2018 08:24:15 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:16140 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729687AbeLONYP (ORCPT ); Sat, 15 Dec 2018 08:24:15 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 68C19BEAC84F8; Sat, 15 Dec 2018 21:24:11 +0800 (CST) Received: from [127.0.0.1] (10.177.31.14) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Sat, 15 Dec 2018 21:24:07 +0800 Subject: Re: [PATCH] jffs2: ensure wbuf_verify is valid before using it. From: Hou Tao To: , CC: , , , References: <20181020120849.65708-1-houtao1@huawei.com> Message-ID: <0c465568-8459-5164-bba9-8a1651b97bb6@huawei.com> Date: Sat, 15 Dec 2018 21:24:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.31.14] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ping ? On 2018/12/9 14:35, Hou Tao wrote: > ping ? > > On 2018/10/20 20:08, Hou Tao wrote: >> Now MTD emulated by UBI volumn doesn't allocate wbuf_verify in >> jffs2_ubivol_setup(), because UBI can do the verifcation itself, >> so when CONFIG_JFFS2_FS_WBUF_VERIFY is enabled and a MTD device >> emulated by UBI volumn is used, a Oops will occur as show in the >> following trace: >> >> general protection fault: 0000 [#1] SMP KASAN PTI >> CPU: 6 PID: 404 Comm: kworker/6:1 Not tainted 4.19.0-rc8 >> Workqueue: events_long delayed_wbuf_sync >> RIP: 0010:ubi_io_read+0x156/0x650 >> Call Trace: >> ubi_eba_read_leb+0x57d/0xba0 >> ubi_leb_read+0xe5/0x1b0 >> gluebi_read+0x10c/0x1a0 >> mtd_read+0x112/0x340 >> jffs2_verify_write+0xef/0x440 >> __jffs2_flush_wbuf+0x3fa/0x3540 >> jffs2_flush_wbuf_gc+0x1b1/0x2e0 >> process_one_work+0x58b/0x11e0 >> worker_thread+0x8f/0xfe0 >> kthread+0x2ae/0x3a0 >> ret_from_fork+0x35/0x40 >> >> Fix the problem by checking the validity of wbuf_verify before >> using it in jffs2_verify_write(). >> >> Cc: stable@vger.kernel.org >> Fixes: 0029da3bf430 ("JFFS2: add UBI support") >> Signed-off-by: Hou Tao >> --- >> fs/jffs2/wbuf.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c >> index c6821a509481..3de45f4559d1 100644 >> --- a/fs/jffs2/wbuf.c >> +++ b/fs/jffs2/wbuf.c >> @@ -234,6 +234,13 @@ static int jffs2_verify_write(struct jffs2_sb_info *c, unsigned char *buf, >> size_t retlen; >> char *eccstr; >> >> + /* >> + * MTD emulated by UBI volume doesn't allocate wbuf_verify, >> + * because it can do the verification itself. >> + */ >> + if (!c->wbuf_verify) >> + return 0; >> + >> ret = mtd_read(c->mtd, ofs, c->wbuf_pagesize, &retlen, c->wbuf_verify); >> if (ret && ret != -EUCLEAN && ret != -EBADMSG) { >> pr_warn("%s(): Read back of page at %08x failed: %d\n", >> > > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ > >