Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3485148ybi; Mon, 29 Jul 2019 07:22:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFX9eSys8yXxvuY9GNaVgq6ARp2qcrJk4X9NGq2cZ8mztsb0mBNSeu5Dpbg6DuMs4w4MQr X-Received: by 2002:aa7:93a8:: with SMTP id x8mr38119250pff.49.1564410146368; Mon, 29 Jul 2019 07:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564410146; cv=none; d=google.com; s=arc-20160816; b=t/IK2A6Im187bFnH4lrc6ubmTkAAQ4tEHOjSvGQcv3RKT3sEjlph/IMIdbfWX+Y9Bk 99+4/ol0/1hLZuVdVae4Lqkj0EugexxvtxyaZ9mGlAEL2UDIW1w8QIclwNt1diFBaK47 3EubCu0WCuzeUiNe5TW92uNTaHpf6UVr9EjsuY9AgpFXjTlGjG9uliG11ZxkAnW67ylB xmsnF4XQ4tLUypxkmp4cQuso+2BYYtv6Bv6VnHo7xbKXwonO0ly/62Zrx3f6aHOmgRhP Fq1NDB8L08bBapwsOyMOduKwwj0uUseU/qt1kFjT7aqAIF03Vf//0Wlors8+4krVc+BJ h/7w== 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=3Z/kfa9fM3G4V3a6xOuotsKa6lAoDW+2j1EfLl7AEuU=; b=iIf8WBY9tMCKoJuhCmM2kJ98UJQTwCdfm/AsrfLncyO39xH/O8sYsUHlzE2ZCWNFnB KLhByWY47si9C1dy1zJGUd6vGoEeFo4atdABh9TlCWrUF2BdQI66pnwll+2zv+ZMx0ef +0oiUVlYhNwR3/vFmpRnI32zKXmk+NLFpAQouJOgXADxsrjOYOxbHvSarjSn/RU9NtzX mOJSDH1kGHbJEzyu+02WTbENyFnZIRpXS7m8R6sxnpkouZJR4R78MGL5WSqzTFXlNl+4 Lqhc2eJ6U/x6fyumqFd+dqTxtJESwCuLUw6vOG+8ihhN2HfxBbivZ6D6lJlxsc1pm1Bn w/Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=Hy53qEOj; 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 g23si12358859pfo.186.2019.07.29.07.22.11; Mon, 29 Jul 2019 07:22:26 -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=fail header.i=@lunn.ch header.s=20171124 header.b=Hy53qEOj; 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 S2387665AbfG2Np5 (ORCPT + 99 others); Mon, 29 Jul 2019 09:45:57 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:44786 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbfG2Np5 (ORCPT ); Mon, 29 Jul 2019 09:45:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3Z/kfa9fM3G4V3a6xOuotsKa6lAoDW+2j1EfLl7AEuU=; b=Hy53qEOjo79ssYqLSRDTY4m1D+ jAAhCFM/KVIVhnYg4OdMgJDqJMzmxs3bA6JZnlmlzw4U/A8LOduOw0jX6KtRmC7UHzLIetv8MB7Mp qz/Rt3WWfTMWcwWjpyqhKMI5luFT+cJLYh+TgXPLu4qiB1gQjyQyQIbhzh6aor9e8lBY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1hs5yL-0001QT-BW; Mon, 29 Jul 2019 15:45:53 +0200 Date: Mon, 29 Jul 2019 15:45:53 +0200 From: Andrew Lunn To: Jia-Ju Bai Cc: f.fainelli@gmail.com, hkallweit1@gmail.com, davem@davemloft.net, 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() Message-ID: <20190729134553.GC4110@lunn.ch> References: <20190729092424.30928-1-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190729092424.30928-1-baijiaju1990@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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'? Thanks Andrew