Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4768351ybi; Tue, 30 Jul 2019 07:50:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqztkHEJDi5pQV/Zhzg5cl/lJmlFaHn3opGtOyqZ/MEsFybeLyLYSa9lmxXFbfIalIWa7d7s X-Received: by 2002:a63:ec48:: with SMTP id r8mr32944904pgj.387.1564498212718; Tue, 30 Jul 2019 07:50:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564498212; cv=none; d=google.com; s=arc-20160816; b=Uy2h+ia2nS09NEN7wSFy100Z6VjnlW4jfKHUzQtQEo5ldKvp2YFie52B8ZF9m/he+g f0P2n9rxOlsiWmQC4tcsqZQHbThOexaw0s/kmj4RXk365OZrj+MA80EYRH0/h7qa2fxk XMgdAEW6huzz4U9oZr959SS9+R6RNL08JhmXfk6cwoN79qW8cyTgz7k2yy1HWzOZS2SK Y5VNZTWrtaK7ad6xovPi0h2oeNFy/7NGW0jz5LnG9gESte9mri3e262Aegs/MyRYKcz1 HyCMdvT01RU91X1fBHo3GsBkhIzd3oBCIuHOUd19BTBUDgnQMFitkbroMBYGtmHwH32C 58yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=VChiJaSG46ybZALSFOV8/YPDL/6pdPPKzTJ+KlFjbec=; b=JmW7hrs45ZMHt5+DO6u8f/G28aSCP0rcqCDB4WrfkBLbg4vQc6kA+PUCNzk2OX1Rhh rw0KqgBBIw9Vatt32pNZfs0hvFfIFswJSEs6vRBR9lansU6MXw/nQcASFxdN/sSgigKw 6e58Zioq+oURjFFVgXHc2KdmBzOYy0mPTwawC3YFb4hgYVQ0gf87yreYPKp0BYty/rRV RTpPgHWQJ7a02PYgm079IA7r2xe7+XgLY9Q/whv4KQV0dFbW0lw79HWP9OyzPjqz739K EmDV0YW53kMg8eskG0huV/187pqm2UjERRhMp1taEdHcf+xv381VbfW9oJQUL1iuCD6Y RKQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JXtXAVMk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si27981291pgn.467.2019.07.30.07.49.58; Tue, 30 Jul 2019 07:50:12 -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=@gmail.com header.s=20161025 header.b=JXtXAVMk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730769AbfG3IDB (ORCPT + 99 others); Tue, 30 Jul 2019 04:03:01 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35658 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729810AbfG3IDB (ORCPT ); Tue, 30 Jul 2019 04:03:01 -0400 Received: by mail-pg1-f196.google.com with SMTP id s1so23331058pgr.2; Tue, 30 Jul 2019 01:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=VChiJaSG46ybZALSFOV8/YPDL/6pdPPKzTJ+KlFjbec=; b=JXtXAVMkkw5n/mrWdLnavDkNKc9V87C4Koawc720nJ2ynLsSg+yvLSEpfiVYghyOzj s2y64EygboGQCSPzeB7ai/5a1Vcc0xsMuuGZka9xo3fIEvYDsvLpBPj3G3WdNK91oDYP Iw7MPSnE46V7MKFt5ziBNtVOXoONAHNK6S4YC0WEmzqbKM2PZLfezS0v2nYg6BHjYQ3R hatIE3AU+bAR25ExlwAYeHX5/y5HriF19R3sIwwbb9dxZMsCnfszGPq1Ch4M1EgsbnDm MuCXtcyxbkN87YKJrAjUoXfYzbGUYq8wVHqzNPcPkvvVPaTz7q5IZfABOq3tT+rOu3bb OfzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=VChiJaSG46ybZALSFOV8/YPDL/6pdPPKzTJ+KlFjbec=; b=MqvMnb/3Dae2yrBG+Hz7/lLGOVxtv+86ApgvdPzvQ9o+Uduelg5VPGwxEa++Sh36xP PY0zz39cf8VMJIVqbhXXXZDAZhFN3284PP/b/R3i9OkLCnLeHAzy6sGTTs3Y9ZY8+9P9 MSzO3hyHhj2JkGudj96vCVzIZIImO6iDXSjsEj34uUBEDnzB+23P9aORnbBAiyFW8wx3 ZDAFqJxKO6A8VsfQYjoc7Qd3lCgVf4261uv5ItlbC/GYeXVDhn8kmWGIq7/AKkJ6z/d1 DZB72ld5oi6om0d8VXmQzXbEs7Bt/Wqi8PB0Zwrn6QR5du5LFDyGGC0Hhh5xpnHV33p3 i5yQ== X-Gm-Message-State: APjAAAVdjNRGAxjhz5udOqj/MMfh7QkmnxWjqz5gIS6jdESD7rIYDD3T MQxV7YtV3cuSDRknQAGS8AoRX7PpBqM= X-Received: by 2002:a65:4948:: with SMTP id q8mr49355881pgs.214.1564473780195; Tue, 30 Jul 2019 01:03:00 -0700 (PDT) Received: from ?IPv6:2402:f000:4:72:808::177e? ([2402:f000:4:72:808::177e]) by smtp.gmail.com with ESMTPSA id v184sm59805009pgd.34.2019.07.30.01.02.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jul 2019 01:02:59 -0700 (PDT) Subject: Re: [PATCH] net: phy: phy_led_triggers: Fix a possible null-pointer dereference in phy_led_trigger_change_speed() To: David Miller , andrew@lunn.ch Cc: f.fainelli@gmail.com, hkallweit1@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190729134553.GC4110@lunn.ch> <20190730033229.GA20628@lunn.ch> <20190729.204113.316505378355498068.davem@davemloft.net> From: Jia-Ju Bai Message-ID: Date: Tue, 30 Jul 2019 16:03:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190729.204113.316505378355498068.davem@davemloft.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/7/30 11:41, David Miller wrote: > 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 Thanks for the advice. I will add my organization in the patch. Best wishes, Jia-Ju Bai