Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2347458imu; Sat, 8 Dec 2018 22:36:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/V/VpoOfVIJFx+NBEHW56KtWBBvdWclc6xkBLlcEkGGCA4QWsMXVcJqpQE1ULnQAhnQAuFs X-Received: by 2002:a17:902:9a9:: with SMTP id 38mr7737865pln.204.1544337364793; Sat, 08 Dec 2018 22:36:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544337364; cv=none; d=google.com; s=arc-20160816; b=M6r3fBmjpKtj4IPyFNidLCUj4uTjb9a4f08PZRx5aL7sY0y4OVM3j6yL7g6qI5p7qT FGvxeZ8+/SKvpiFonRt/cyHfSzm58R65vKMiozhTDbjXRn2u0AS8yru5Tdo/+quNyCWD HpVacKm6v4S4YLRZTkHJZnJALAZqz4UyhdGdBPcEQaeFXnq572KeQBF+cWOcfSCFWOff KnT4tg1T3VClYMfZV/0fu5Hu0Dh7CVbpsvFaQ80s0A5ttzI8TPk+yHRkVTxlK180KYYB Z1jZfMGTRsw75/40NFHuyveuSnDwfT7SwBm6pCC1Z8KeLwYjUkhN62UJY8aCylspG1xb vV/g== 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=YZ31AbecjpmfBvE45dPWvZr2vFQHfNI5+EPFNbSE6dE=; b=XaCthbq2y4BrJKEXkEy+L+KtzoK06YE+frRWgfSN4qFOGHg3cvTI6s20cEdtDntMNf dYsvO0tthM8jIqK2THP8nyFLN1xra9SHXRPNiWM3b0cDRrn7qsyZeqyGGBsv1QM+CiFn S9McUAKez9rYCCB5SzSJWW0fZttjsvEIt92zQ+A6GdifpSGgp1EKEoFAeB5m2ruOCYNF icv6Ljp7Ztvlaun+TC+dJz+WHaDpInXulD4eZHYiybQ+6JMQX4FClQajgpCYZOU63e/T YzaSOJImETjmhopXi0l+iGrDLXWTzTahv9uBJYRvmBYooKOJiMceyoXT4pQQqIO2+L3O 4emA== 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 n5si6791262pgh.422.2018.12.08.22.35.49; Sat, 08 Dec 2018 22:36:04 -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 S1726154AbeLIGfM (ORCPT + 99 others); Sun, 9 Dec 2018 01:35:12 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:53466 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726066AbeLIGfL (ORCPT ); Sun, 9 Dec 2018 01:35:11 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 80DD852CA16A; Sun, 9 Dec 2018 14:35:03 +0800 (CST) Received: from [127.0.0.1] (10.177.31.14) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.408.0; Sun, 9 Dec 2018 14:35:00 +0800 Subject: Re: [PATCH] jffs2: fix invocations of dbg_xattr() for dead jffs2_xattr_ref From: Hou Tao To: , CC: , , References: <20181020110753.98407-1-houtao1@huawei.com> Message-ID: Date: Sun, 9 Dec 2018 14:34:59 +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: <20181020110753.98407-1-houtao1@huawei.com> 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/10/20 19:07, Hou Tao wrote: > When jffs2_xattr_ref is dead, xref->ic or xref->xd will be invalid > because these fields will be reused as xref->ino or xref->xid, > so access xref->ic->ino or xref->xd->xid will lead to Oops. > > Fix the problem by checking whether or not it is a dead xref. > > Signed-off-by: Hou Tao > --- > fs/jffs2/xattr.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c > index 3d40fe02b003..0c4c7891556d 100644 > --- a/fs/jffs2/xattr.c > +++ b/fs/jffs2/xattr.c > @@ -550,7 +550,8 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref) > ref->xseqno = xseqno; > jffs2_add_physical_node_ref(c, phys_ofs | REF_PRISTINE, PAD(sizeof(rr)), (void *)ref); > > - dbg_xattr("success on saving xref (ino=%u, xid=%u)\n", ref->ic->ino, ref->xd->xid); > + dbg_xattr("success on saving xref (ino=%u, xid=%u)\n", > + je32_to_cpu(rr.ino), je32_to_cpu(rr.xid)); > > return 0; > } > @@ -1329,7 +1330,11 @@ int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ > rc = save_xattr_ref(c, ref); > if (!rc) > dbg_xattr("xref (ino=%u, xid=%u) GC'ed from %#08x to %08x\n", > - ref->ic->ino, ref->xd->xid, old_ofs, ref_offset(ref->node)); > + is_xattr_ref_dead(ref) ? > + ref->ino : ref->ic->ino, > + is_xattr_ref_dead(ref) ? > + ref->xid : ref->xd->xid, > + old_ofs, ref_offset(ref->node)); > out: > if (!rc) > jffs2_mark_node_obsolete(c, raw); >