Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp918981ybe; Fri, 6 Sep 2019 09:12:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxedwLKt9mrjap9NVBuajvbTOIomEMikZRZ8Lwchtb4pUbvCcrL9KGzD2d9ZmJLAC1CwZdi X-Received: by 2002:a17:902:b40c:: with SMTP id x12mr10227160plr.236.1567786363129; Fri, 06 Sep 2019 09:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567786363; cv=none; d=google.com; s=arc-20160816; b=Fehmm8VmEPbkQJcCR+vmphqJ92wzbgJbUdRBT6YJ2RMaaiRFjKKJizvstO6e6sIWGc xhTJSAMlTuEVpNIppTwM+hNNZHQVdXb9uStSVU822hvLbhBS+7vF2BNZ88wiV29jcaLH z5d89OzE6Lv+Tus7bpKBH3tgWx6U/4hJYmMcJfuzeW70umlfx1fxh9eicTMmzJBLT1RO WvgLm30g5Bz4viX7ryYFqUQtNEwrG0AqqPEbvLtze2q3kNl5Fg9LYFoyhHn4nQL9U5DI GKnWllTvAXpZ+rDD1ElKm/tASCQf3Vijaaw2jJGSaoUPR85nMlrnAZpH3W7ITQr0ZVTG jiSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OFpQKBmn3XqWcFjUHLf2jmFMG4yWzAFz+tfICWEyUr4=; b=Ffba5dsAhFcq+TV4wWlhnmfrOdoGWtWqOUwVAWgL+J7wZC5PFtKLxWIac/8Ax7gujd VA1XYetdR216LB1YNjIkjjx7cBvK0+Pw5RXjwIMzpPKYhu4SJHcxmpDjarBz7sHxdmzH mEGFdyEcAT0i1N6C6WXjMtdN29CyaoyAWHW0AnDHcAkVygzFbrfrc3eFcs846vVWTHZL yqNH0ZymcxKVbfOvx305w7KQGD8RRbdqnioyx6vKPIqAAVvtYjA8yewR3OrMHGVM/tCd CyEJ+bq5R+lNtmAe6bKHHQe1ydAORYZKZuvJc8V2pNwTiRcZ2Ux+8dCrg/rZfz1/glf3 N/kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="X34lVF1/"; 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 i8si5877892pfa.192.2019.09.06.09.12.26; Fri, 06 Sep 2019 09:12:43 -0700 (PDT) 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="X34lVF1/"; 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 S2391317AbfIFKxz (ORCPT + 99 others); Fri, 6 Sep 2019 06:53:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:39840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731515AbfIFKxz (ORCPT ); Fri, 6 Sep 2019 06:53:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 AA37A2070C; Fri, 6 Sep 2019 10:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567767234; bh=H+yTWQX57cegf2t72h7LJ305mRugKGEYc05Jr3cLZl0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X34lVF1/1G4jA3xOv7encmcLEKgk6EnvfH47jJK/im4kRjv2V70PBlcg4SG3UEw8P VXV4kn/prPJPDQ0mvUVnK9YWs2xTRyqTwh+MEo3YvXamvvAht+6tt8L3mZQEMuvq99 BqTWRvdDx3LNTkLZ3D/CoiT09yEmkIdXHjg1jAE0= Date: Fri, 6 Sep 2019 12:53:52 +0200 From: Greg KH To: Peter Zijlstra Cc: Austin Kim , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, dvhart@infradead.org, andy@infradead.org, hpa@zytor.com, allison@lohutok.net, armijn@tjaldur.nl, kjlu@umn.edu, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/platform/uv: move kmalloc() NULL check routine Message-ID: <20190906105352.GA8656@kroah.com> References: <20190905232951.GA28779@LGEARND20B15> <20190906093252.GB16843@kroah.com> <20190906104341.GW2349@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906104341.GW2349@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 06, 2019 at 12:43:41PM +0200, Peter Zijlstra wrote: > On Fri, Sep 06, 2019 at 11:32:52AM +0200, Greg KH wrote: > > On Fri, Sep 06, 2019 at 08:29:51AM +0900, Austin Kim wrote: > > > The result of kmalloc should have been checked ahead of below statement: > > > pqp = (struct bau_pq_entry *)vp; > > > > > > Move BUG_ON(!vp) before above statement. > > > > > > Signed-off-by: Austin Kim > > > --- > > > arch/x86/platform/uv/tlb_uv.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c > > > index 20c389a..5f0a96bf 100644 > > > --- a/arch/x86/platform/uv/tlb_uv.c > > > +++ b/arch/x86/platform/uv/tlb_uv.c > > > @@ -1804,9 +1804,9 @@ static void pq_init(int node, int pnode) > > > > > > plsize = (DEST_Q_SIZE + 1) * sizeof(struct bau_pq_entry); > > > vp = kmalloc_node(plsize, GFP_KERNEL, node); > > > - pqp = (struct bau_pq_entry *)vp; > > > - BUG_ON(!pqp); > > > + BUG_ON(!vp); > > > > Ick! Don't crash the whole machine if you are out of memory, that's a > > totally lazy and broken driver. Fix this up properly please. > > This is boot time init; if memory allocation fails, we're in trouble, no > way forward no way back. > > It is not uncommon to have BUG_ON() for alloc failing during boot. Hey, how come you get to get away with this here, and in the tty layer I had to do all sorts of foolish things just for the same "impossible" thing because syzbot found a way to emulate such lunacy? Just you wait until the fuzzers get ahold of this code... :) greg k-h