Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2005846rwb; Wed, 30 Nov 2022 00:36:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf6SdIpNJd8KXQJn/v2L7YGw+2o8Aae0e3ob719pv4Q8Hpep2QjtN7Fy+RnxI99YsU+j0Ccq X-Received: by 2002:a17:903:93:b0:189:5c4d:6046 with SMTP id o19-20020a170903009300b001895c4d6046mr29025297pld.4.1669797374706; Wed, 30 Nov 2022 00:36:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669797374; cv=none; d=google.com; s=arc-20160816; b=KX8hEqWByuU/CWM8NE4KQuzXMXvBBuftxLFLH0Hdwl5AEtLZ9Kle3LG8bzMSMsmHab 3oi4nzL03gDxKfq1O6N1OwMpDYlZw5K+SnPV8oc6ZNpMnYOoq3/EGsu9UkHV3tNYQOAB JCVJImsNn8Ol+Qbd9pFXUscLhLkOgkg4uEr8I7sVGjQzojNv+yqa/toHwnmJEdlauwtZ tg8Tti5yjzlIlhCCtIYn8ofivHtzhU5AcFVVnaHOAgH5gR8eg509BPDLKIxIYDvdD6y4 5539WvcusBk39vjhQYOSczzhF8Qdz8vThRAixA8OSLGyNg8O6y8ye2Iq/bFtML3A7Q34 6I1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MUWs0peHeFh8I8V0mHaov2V5/9takFBfLQgSzUIxJn0=; b=OqNi5w7IFN+TTRTpbAuPiVH68m3soDh+kZ/5zEbWwjLZ/hLq6gmN5N5/JhWrT8fkU0 UPNukO6PoYV6N7UmpvDuyFi3Ef4FWXTnvjTKPIUi2UJkkLW1E0YPOXj5eoPmEH/3M9IE eKmVKl2Ra44pCc1VoDstWuFbuX8L0oRz6EcjK7oPp5o9FWp4TX+V4cYNKtfq5im+YXaj hVQ/NffUT/zzLSbu6OCGq/s5imL1gYPzp5TyicqylRviid5SzC6CoBhdWI2fKZtB2Nbv 4Oa8Um6UMwrwp/EFwubuFb/gg0cCI/1SOhVjbMa689cHzMqc8mIpuO+5CwFN9530THqC G7rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=JUgDJers; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020aa78884000000b0057472b5b590si1115040pfe.287.2022.11.30.00.36.04; Wed, 30 Nov 2022 00:36:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=JUgDJers; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234634AbiK3IXg (ORCPT + 84 others); Wed, 30 Nov 2022 03:23:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234768AbiK3IXN (ORCPT ); Wed, 30 Nov 2022 03:23:13 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A6C4E04 for ; Wed, 30 Nov 2022 00:23:11 -0800 (PST) X-UUID: 8e3436dd24714848a86fc3ecd72f2dfc-20221130 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=MUWs0peHeFh8I8V0mHaov2V5/9takFBfLQgSzUIxJn0=; b=JUgDJersQILyGgks6V+jTGR4BNCqTeBDlr7wVwFoPiNTcaXa2F77UVDQvw9HsEZw22R5+kW20stFeJNQ0iRMYesii4tlQmIgIQFxd0Ej9sBj4Dk0MCkWkPm+edPiwalDKJUlZC7jnBi7zrurHNEqt+swkl37eNjnw7YwzDHCJ2I=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:5e55e971-5f05-4353-90ea-9fd3211dfef7,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.14,REQID:5e55e971-5f05-4353-90ea-9fd3211dfef7,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:dcaaed0,CLOUDID:f62c216c-41fe-47b6-8eb4-ec192dedaf7d,B ulkID:221130162307VUMOZIKQ,BulkQuantity:1,Recheck:0,SF:28|17|19|48,TC:nil, Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:43,QS:nil,BEC:nil,COL:0 X-UUID: 8e3436dd24714848a86fc3ecd72f2dfc-20221130 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 487435394; Wed, 30 Nov 2022 16:23:07 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 30 Nov 2022 16:23:06 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 30 Nov 2022 16:23:06 +0800 From: Andrew Yang To: CC: , , , , , , Subject: [PATCH v2] mm/writeback: fix dereferencing NULL mapping->host Date: Wed, 30 Nov 2022 16:23:02 +0800 Message-ID: <20221130082303.30859-1-andrew.yang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20221129095620.4c1a8056@gandalf.local.home> References: <20221129095620.4c1a8056@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "andrew.yang" Check before dereferencing mapping->host Suggested-by: Steven Rostedt Signed-off-by: andrew.yang --- v2: add parenthesis --- include/trace/events/writeback.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 86b2a82da546..54e353c9f919 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h @@ -68,7 +68,7 @@ DECLARE_EVENT_CLASS(writeback_folio_template, strscpy_pad(__entry->name, bdi_dev_name(mapping ? inode_to_bdi(mapping->host) : NULL), 32); - __entry->ino = mapping ? mapping->host->i_ino : 0; + __entry->ino = (mapping && mapping->host) ? mapping->host->i_ino : 0; __entry->index = folio->index; ), -- 2.18.0