From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763125AbbA3VxT (ORCPT ); Fri, 30 Jan 2015 16:53:19 -0500 Received: from mail-bn1bon0134.outbound.protection.outlook.com ([157.56.111.134]:63597 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754148AbbA3VxS (ORCPT ); Fri, 30 Jan 2015 16:53:18 -0500 Message-ID: <1422654781.10544.173.camel@freescale.com> Subject: Re: [PATCH] powerpc/mm: bail out early when flushing TLB page From: Scott Wood To: Arseny Solokha CC: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , , Date: Fri, 30 Jan 2015 15:53:01 -0600 In-Reply-To: <1422619707-30864-1-git-send-email-asolokha@kb.kras.ru> References: <1422619707-30864-1-git-send-email-asolokha@kb.kras.ru> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.7-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:2:5800:3f7:12bf:48ff:fe84:c9a0] X-ClientProxiedBy: CO1PR06CA040.namprd06.prod.outlook.com (10.242.160.30) To BN1PR0301MB0723.namprd03.prod.outlook.com (25.160.78.142) Authentication-Results: kb.kras.ru; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0723; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004);SRVR:BN1PR0301MB0723; X-Forefront-PRVS: 04724A515E X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(979002)(6009001)(377424004)(51704005)(24454002)(42186005)(86362001)(47776003)(103116003)(50466002)(23676002)(50986999)(76176999)(87976001)(46102003)(110136001)(122386002)(92566002)(36756003)(40100003)(2950100001)(33646002)(77156002)(62966003)(50226001)(99106002)(3826002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR0301MB0723;H:[IPv6:2601:2:5800:3f7:12bf:48ff:fe84:c9a0];FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0723; X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2015 21:53:07.9852 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0723 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2015-01-30 at 19:08 +0700, Arseny Solokha wrote: > MMU_NO_CONTEXT is conditionally defined as 0 or (unsigned int)-1. For nohash it is specifically -1. > However, in __flush_tlb_page() a corresponding variable is only tested > for open coded 0, which can cause NULL pointer dereference if `mm' > argument was legitimately passed as such. > > Bail out early in case the first argument is NULL, thus eliminate confusion > between different values of MMU_NO_CONTEXT and avoid disabling and then > re-enabling preemption unnecessarily. How did you notice this? Did you see an oops, or was it code inspection? I'm wondering what codepath gets here with mm == NULL. -Scott