Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6563220ybi; Wed, 31 Jul 2019 17:04:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBOkZGNmtHSx2sNOQbMedizZ34o+yRMWD7sxVQF9qUetIf4Rw2bujKkw0ytOt+KbxBuSBj X-Received: by 2002:a63:d30f:: with SMTP id b15mr115002214pgg.341.1564617897600; Wed, 31 Jul 2019 17:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564617897; cv=none; d=google.com; s=arc-20160816; b=vmdi6fd4gMb4uHlIXYwFronO09HTLGzWOLgrbk20DWraneH47H8OS362V1Lgke81xO ViWEYCUWkTM5aWkQ8iKv+5zq4+VogTn7V7Jn4JL8w3YJ+JZFoMD9O9c8r3y2aPQTAsE8 9G/um5eDRjxVXrS03dtrfNA6gSYHW+CjewRkP5Mpr+aZ5bqlE4wctPrmlfQwR93CKqRZ tHLijrHolDK3DIWLfW1/ehotWYuLtnoD6uNmk+5SaXi6jGR+YTy+npTfks81j/bQY1hD 6Ic4zsw9bZthvu3k2Yg98YunL/R49dTmSAzcC9C74Jgbd6DwxvymUsDzcpZmgHPFvatZ jNBw== 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=Vq4bYsTDg1PMyVSb90EBwVK+4LNRPs4lLfzUHwL10vc=; b=NkS34q2C1/BItv0/d5ohm3cCh9ckv0UaXmJwxBBWtcJZkMEirVZwtG7IeIirBNs4Fe 2QnCoEMMXpwL9r93GPL9eEa4qWEurUawWpfsPGZwRXBLsR3PddLJ3w7ln7PYsPkcAQV3 W+AYqR0Tv0oVLDacIV4ZdsoeQ6zuV5W+EGAIwiiqu7rmzq93HkRtz9o1EKsUI++gnLKl jrDBZgk2+priFsBFSF2qGgCMf7QRbl7XyOYi6dUYvcw5QJO0dLoigHkv9z7tr+b5tflE VeLmw+mR9chE3ZllGmXTw+xwWPsqtnigtd21QxiCy5Z43hrbsKeca/9342hRWsFQfBn9 KsgQ== 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 f22si2737283pgk.349.2019.07.31.17.04.41; Wed, 31 Jul 2019 17:04:57 -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 S1730388AbfGaW5I (ORCPT + 99 others); Wed, 31 Jul 2019 18:57:08 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:45114 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbfGaW5I (ORCPT ); Wed, 31 Jul 2019 18:57:08 -0400 Received: from localhost (c-24-20-22-31.hsd1.or.comcast.net [24.20.22.31]) (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 6017F1264EC7E; Wed, 31 Jul 2019 15:57:07 -0700 (PDT) Date: Wed, 31 Jul 2019 18:57:05 -0400 (EDT) Message-Id: <20190731.185705.323737673654483593.davem@davemloft.net> To: baijiaju1990@gmail.com Cc: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] net: phy: phy_led_triggers: Fix a possible null-pointer dereference in phy_led_trigger_change_speed() From: David Miller In-Reply-To: <20190730080813.15363-1-baijiaju1990@gmail.com> References: <20190730080813.15363-1-baijiaju1990@gmail.com> 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]); Wed, 31 Jul 2019 15:57:07 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jia-Ju Bai Date: Tue, 30 Jul 2019 16:08:13 +0800 > 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 > the OSLAB group in Tsinghua University. > > Signed-off-by: Jia-Ju Bai Applied, thanks.