Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp693426ybb; Fri, 3 Apr 2020 10:04:17 -0700 (PDT) X-Google-Smtp-Source: APiQypIWiXsjH9hTIcyEYknRr8NSFcg5xWUTj8G1eFVYIU87+3jGO+wivAGxAJgvLv5eSWpYhOTq X-Received: by 2002:aca:ecd0:: with SMTP id k199mr3959221oih.60.1585933457651; Fri, 03 Apr 2020 10:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585933457; cv=none; d=google.com; s=arc-20160816; b=hy0tDv4rEcwzn77bnMaIoW9RHHzHiDMqR93V0v2IkNKEL2yfaFhzsAbKB10CiN9YNR xjQ+pZhmM7dAVUlvMM+t+AgPNlrc1IxgUl/1SDXBxOrV2SVN2ZXx6WgpsWx2HFt69Una JAo7UwlfyjsvsDANfC46kozURIBld/PckiABcC1vQjpL5rJBJAcOFV/3HJNoCyRqRjdM 0h4A73pzDbTx4HJ7h5oeQA4iGi67FpT0T3NpUFzZvNdw9TVSnKW1bE5HjogDenoNX5yc PemTtHxeXzMe4r+9F+dQNe+Q/k17OqyQBBGkMubujKHsDe6gU+R6rIsrzXR0jlg/ICiW VKmQ== 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 :content-disposition:mime-version:references:in-reply-to:subject:cc :to:from:message-id:date:dkim-signature; bh=C18c1IugNAFxFaCXPQKTt7OVFB64Oo1MwWK6g2EBugk=; b=zs20L59LBTZI16EDuGqwpQs1TPoZVEdGJ1gWX9G4F9js71Nxt1MB/fvsw4J0gMQg4C OpbPcLnrmGElDid3n+CwZ7didREWPc8F7TUe/2SdIYg1OxGm5clsuUeYLLmQlMDZIsPU 2aSLZzdBkMfR38TmVNGxltrWzR+nVu7PRXB6Ic8G7TaroVlwzNetnY5a8tX9eN6pXKLs UJQLsy9psFgquG9khlfTErX+bDOL937Pcq5JfHtI9wxBJuz0M/r5mnhisto0t4oFPpJ6 i62Irw8I7qm9vT22I7oxVQBYobmvHhBZrTBg9054hHiIO3uBk6jdWFqLR7+e1GBi6GDr VkMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hENydy7D; 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 u16si4477520oth.230.2020.04.03.10.04.05; Fri, 03 Apr 2020 10:04:17 -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=hENydy7D; 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 S1728296AbgDCRDK (ORCPT + 99 others); Fri, 3 Apr 2020 13:03:10 -0400 Received: from mail-qv1-f68.google.com ([209.85.219.68]:41164 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728117AbgDCRDK (ORCPT ); Fri, 3 Apr 2020 13:03:10 -0400 Received: by mail-qv1-f68.google.com with SMTP id t4so3929549qvz.8; Fri, 03 Apr 2020 10:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:from:to:cc:subject:in-reply-to:references :mime-version:content-disposition:content-transfer-encoding; bh=C18c1IugNAFxFaCXPQKTt7OVFB64Oo1MwWK6g2EBugk=; b=hENydy7D0JCIgFa87b7M0ed1qoGpz0QGXHyXVDmHGDh7zw+L+WUhbK8IW02pBk8qHM ADsA25xAJ67o4Ra6VRdXBwMhcZMuHy475xAxlyiU1YuRkbqv+PF2ir5V5qEjMcANfQVn jGY8UQU13Viwi+GDqFDM01+/XrhVQbFZPaY/Tb2zki4oxJUEWTJXSoycxyeREVVBXM5T uUK7ezP46TqBapFishKlJi3Sy21RVUbp0ZoycRDNJ8VBJIH1oXob0kZUNKCSq+meSRlw PvtxAFdZSw3sGPJDdA0MlyJjyUWjLDDi5bCftL5qN/hJ4Jis+/StdK4ZXo5AsP3JJEfj 3FBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:from:to:cc:subject:in-reply-to :references:mime-version:content-disposition :content-transfer-encoding; bh=C18c1IugNAFxFaCXPQKTt7OVFB64Oo1MwWK6g2EBugk=; b=rybU4ozIerctSM0MzTB0k3ERvOnYEv6ZCk0L2c4W6/1IYwZN8R+xDAFiT8Pd59MexN UFTVEdcfYD5zv8ByxFHsGXipcbXgxsLLYFmYUk5qTzyyb5rvnmQbousLiaburYrS/dTN 47iTws+XsMaZX3YUuQd3RkiQBiAP97qOVLYQEbIuJHSzEkRSU+H/olyY2alErw2q0DtC twBn3MWyVsGQMRk/Lvj+FynUL7QaF4alci5buJE4RyJYrUDR+ziDeKKKIsEMalzXqrBn 3+Bx2IG///BqqOgXeXuLIQ265ouq3uOxdIFBqOy3BOhXfbqmnNOyZeb2NzEp+OaFATFL q5Ig== X-Gm-Message-State: AGi0Pub7mxwRCDhfmmPwPQPG+PIW8qszdXyOnYgo1qSsXoaeIqhEOFoO jpERSXYDFTJyuaFz6rQNkGg= X-Received: by 2002:a05:6214:1933:: with SMTP id es19mr9320626qvb.186.1585933389339; Fri, 03 Apr 2020 10:03:09 -0700 (PDT) Received: from localhost (modemcable249.105-163-184.mc.videotron.ca. [184.163.105.249]) by smtp.gmail.com with ESMTPSA id k2sm6777761qte.16.2020.04.03.10.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 10:03:08 -0700 (PDT) Date: Fri, 3 Apr 2020 13:03:05 -0400 Message-ID: <20200403130305.GB6453@t480s.localdomain> From: Vivien Didelot To: Chuanhong Guo Cc: netdev@vger.kernel.org, Chuanhong Guo , stable@vger.kernel.org, Sean Wang , Andrew Lunn , Florian Fainelli , "David S. Miller" , Matthias Brugger , =?UTF-8?B?UmVuw6k=?= van Dorst , Russell King , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: dsa: mt7530: fix null pointer dereferencing in port5 setup In-Reply-To: <20200403112830.505720-1-gch981213@gmail.com> References: <20200403112830.505720-1-gch981213@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 3 Apr 2020 19:28:24 +0800, Chuanhong Guo wrote: > The 2nd gmac of mediatek soc ethernet may not be connected to a PHY > and a phy-handle isn't always available. > Unfortunately, mt7530 dsa driver assumes that the 2nd gmac is always > connected to switch port 5 and setup mt7530 according to phy address > of 2nd gmac node, causing null pointer dereferencing when phy-handle > isn't defined in dts. > This commit fix this setup code by checking return value of > of_parse_phandle before using it. > > Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5") > Signed-off-by: Chuanhong Guo > Cc: stable@vger.kernel.org Reviewed-by: Vivien Didelot