Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4495597ybi; Tue, 30 Jul 2019 03:05:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYS7qy8rK90fUNhasbsPe1/QcucvqNT5Jbe5MXemPWKVbJK4Q5ckUqhmykZiaB60jo2phb X-Received: by 2002:aa7:9ab5:: with SMTP id x21mr40600951pfi.139.1564481134687; Tue, 30 Jul 2019 03:05:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564481134; cv=none; d=google.com; s=arc-20160816; b=UMeC55kusN6U+GuaGkw9KthnLD4rXQwbem6sAvmJkrzeVV+nj1xq3I1aFXrD8Tnkae qH8lIvWW/F8VaErtcsSp2BVdwHp0cSdw9FjnSWK+EX5iwqWx0uz8IOIh8Sz6btNj/1Ww /oUc0qzdjhCY+46tmaWv83NUy5D0x+j2gUCNFnB9+jsYgb5HtIXsB2Tjc/+BZD9K4Myz 6QJtxDu2Q0/u3zUHy3mgfS1HKvhX0cX+bTnGpKnjHm7FA8wXYtFN6iD/eb3LwRE8fz5D hF8VyShkZfEvXL4wyNBfmA0mHYJrSGHGjb1/gx8e/DKc+52Jsd5k1UmaZKX9lK55a7qv LoZw== 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:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=LM5zBEstXvVhFQ8x7MP/yaaLVdGRp7ylYel5L1UzLTg=; b=O7bMLNZUJk1JOnizgGGJy3ivYsZYn2TCflBZfXzUi05mG+23g/8D97++j8uBu6mUtM bGApWnW3GWhRNez/0YDbNlanPXXZFmyon2VqRFXoF2V4xxt3toSDGqdNe4pCUVgzGKWu HTXv2zbD5FJhthX+39S38dRhxdl8xInsH/StnjaPywLBohTjdzdrGAiwuWmCShA13buY o2IDOAV9YFt6g0qs6n9jcTxN6wXK3HtEcr8r7BRyV913CEvKB/PuLbJaq8GDPn6kBS9z jE7DxOuy8o9YYihoKWobtnVKYPXAMrgUeOQtTR7K/MURj+DBF8QbJBqfOdrjjI2wq9Yb D08w== 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 v99si29674115pjb.82.2019.07.30.03.05.18; Tue, 30 Jul 2019 03:05:34 -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; 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 S1727913AbfG3DlT (ORCPT + 99 others); Mon, 29 Jul 2019 23:41:19 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:43372 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbfG3DlT (ORCPT ); Mon, 29 Jul 2019 23:41:19 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::d71]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 1F764152F1AC6; Mon, 29 Jul 2019 20:41:16 -0700 (PDT) Date: Mon, 29 Jul 2019 20:41:13 -0700 (PDT) Message-Id: <20190729.204113.316505378355498068.davem@davemloft.net> To: andrew@lunn.ch Cc: baijiaju1990@gmail.com, f.fainelli@gmail.com, hkallweit1@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: phy: phy_led_triggers: Fix a possible null-pointer dereference in phy_led_trigger_change_speed() From: David Miller In-Reply-To: <20190730033229.GA20628@lunn.ch> References: <20190729134553.GC4110@lunn.ch> <20190730033229.GA20628@lunn.ch> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 29 Jul 2019 20:41:16 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Lunn Date: Tue, 30 Jul 2019 05:32:29 +0200 > On Tue, Jul 30, 2019 at 10:25:36AM +0800, Jia-Ju Bai wrote: >> >> >> On 2019/7/29 21:45, Andrew Lunn wrote: >> >On Mon, Jul 29, 2019 at 05:24:24PM +0800, Jia-Ju Bai wrote: >> >>In phy_led_trigger_change_speed(), there is an if statement on line 48 >> >>to check whether phy->last_triggered is NULL: >> >> if (!phy->last_triggered) >> >> >> >>When phy->last_triggered is NULL, it is used on line 52: >> >> led_trigger_event(&phy->last_triggered->trigger, LED_OFF); >> >> >> >>Thus, a possible null-pointer dereference may occur. >> >> >> >>To fix this bug, led_trigger_event(&phy->last_triggered->trigger, >> >>LED_OFF) is called when phy->last_triggered is not NULL. >> >> >> >>This bug is found by a static analysis tool STCheck written by us. >> >Who is 'us'? >> >> Me and my colleague... > > Well, we can leave it very vague, giving no idea who 'us' is. But > often you want to name the company behind it, or the university, or > the sponsor, etc. I agree, if you are going to mention that there is a tool you should be clear exactly who and what organization are behind it. Thank you.