Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5844934imm; Tue, 26 Jun 2018 20:11:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL8mru089YLT5WOwQwk5jQX3coaeNsZvnQPV4HR+uzenGOcUpZZplUUdK4NmUCg5dhOE8M2 X-Received: by 2002:a17:902:3303:: with SMTP id a3-v6mr4210870plc.209.1530069088776; Tue, 26 Jun 2018 20:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530069088; cv=none; d=google.com; s=arc-20160816; b=MPK5lGWf1hWQ4+B63BmaiYnCVdnQ7wRsUWvzz5OMMFpsqj/Kaoga4vNf7tn6ZhZ3dC dFNz0Zk3C+Tq7zDZwtRyH6u8S3qXIuXHN0ilEB7zzpyM3bhStTK9IH1c2JgkJxtPLrAn CA6Xdo8XvzBp635sTJx6r476KZTQdAqGOtAPul1n0xljcmK2uVTAfaUpdRBbvd4Kn/1+ BPYlExauLMWtyAMJLI+UcrNQGR7HPlgVRNMfDknXhHeK60N3V/aMV0A5KcxZeqS6naY4 JakBtD1QwRXIRQ9zQxs8VfbbkplzFnjVCDPeJUYtdLqkR7cpNy0aeIVvem9JSimoF5Ti 9aOA== 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-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=HuiVcmxENrV1SQKd5rqsT5aIVMTsgW3eF06pnrtxYyE=; b=Spf5s9PBZpWJfHfR9bRZ/RxWkI41kOq5e9/N3fTBgitkSdRZFjV4SdYirJtQd/HHKu uFcWNDAhuarHSZwWf6vXQ9fKstrxEa8NzHH/gmceOSUBXiSxjDtTUKx4e3PsNnrY8VwH Lzqh/0qlFzXTKazHZhwQWv3yPFNwiIQ/ndgMVuXompDPbyzElcgcSOklWH3SUJrWMBY9 hVL7/fniXw4oYMY+sXKY4m1+ji1naUS4Tbkr3LoeGP5xrqTL9EkTAej5UdZqa1xIvUKs 4t6TtM+aS2Kle1LeDEnWtoZYn3SpQQZLsNkuwFklFIHBIWvwZYq9WKsP/Vs0GvB4avjO oVdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P4MxYmUM; 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 y190-v6si2665804pgy.22.2018.06.26.20.11.14; Tue, 26 Jun 2018 20:11:28 -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=P4MxYmUM; 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 S1752563AbeFZV7z (ORCPT + 99 others); Tue, 26 Jun 2018 17:59:55 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:46432 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752108AbeFZV7w (ORCPT ); Tue, 26 Jun 2018 17:59:52 -0400 Received: by mail-ed1-f67.google.com with SMTP id r17-v6so1866730edo.13; Tue, 26 Jun 2018 14:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HuiVcmxENrV1SQKd5rqsT5aIVMTsgW3eF06pnrtxYyE=; b=P4MxYmUMmJ7wGXdOPiISyjODoMT373/qtWavwmJP3nWG3zY/5qtzzJCDK7huGbcFrE YyGFVDnEgpJUXjc1JLYOoHFst5dB534PUFDg6XJbD5dvIvjkKm92xdIGqcZ/ZQrtUwsN rYXxg3dg6D+0Ei+0PN0EE1o5ieIOYe3DI6d0K115S8drwUuOtqLY+ZboU/5JYimSvVng S1fIAGZALRKgIDUaVyJncvnuZ96BP267jwpfZNBoJQV6hJigzaqgKUocHesTcEVWqJoe WayK1vBum34Q7olmHnLBBq/GPIsAYdFZML8MHzqxZhjStChSi2cuzhIAQfSAkHMIX9/q QB4A== 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:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=HuiVcmxENrV1SQKd5rqsT5aIVMTsgW3eF06pnrtxYyE=; b=G/CYr19n23Tqj3WRNeZNAStPmbnWBQzqppINu5Gne+tUSbJ1czL1fCsS/V1WwvTE0i OXmRPmGrfykrlA/cCcuhpY0KHUqgOTPkQ4gffZc9xWS9mydf7v8uRYe1q4qf2m+lVxVS 7WSwET0o4J08v2dLSYAKMRxPzXtl4hgtPALRzTaZtG0AteHIiosOzhegjTT2nzFUA3F1 1ru6LlA3wD7OhIXTbZxim85M1yIwKZycQkJVr10/E6e5GBRz6GPXXyBLsT/Vx5ScJWO3 aUmk5ZoD8HIk1NcHz3IKlgXlqtCqPjEC7TmUtKWN851NQGB4Lq6yktva9nSuo3BtP9/F 8TWA== X-Gm-Message-State: APt69E3GLx7RGcYTkoh7sbOTI1O+jeH6uOuuvEaY1uffbaSDwjCEj8KZ dmIT2LxbDyS9rQgwdTMFEJNPe3pW X-Received: by 2002:a50:c211:: with SMTP id n17-v6mr3216744edf.11.1530050391051; Tue, 26 Jun 2018 14:59:51 -0700 (PDT) Received: from [10.69.41.93] ([192.19.223.250]) by smtp.googlemail.com with ESMTPSA id c20-v6sm1498677ede.3.2018.06.26.14.59.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 14:59:50 -0700 (PDT) Subject: Re: [PATCH net-next v2 1/3] net: phy: xgmiitorgmii: Check phy_driver ready before accessing To: Brandon Maier , netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, michal.simek@xilinx.com, clayton.shotwell@rockwellcollins.com, kristopher.cory@rockwellcollins.com, linux-kernel@vger.kernel.org References: <20180626175050.71165-1-brandon.maier@rockwellcollins.com> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlIgVoOAJbh qIWgvr3SIEuR6ayY3f5j0f2ejUMYlYYnKdiHXFlF9uXm1ELrb0YX4GMHz80nRmxvcmlhbiBG YWluZWxsaSA8Zi5mYWluZWxsaUBnbWFpbC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9i/qoV8QCo12MQEo244RRA6VMud06y/E449rWZFSTwGqb0FS0seTcYNvxt8PB2izX+ HZA8SL54j479ubxhfuoTu5nXdtFYFj5Lj5x34LKPx7MpgAmj0H7SDhpFWF2FzcC1bjiW9mjW HaKaX23Awt97AqQZXegbfkJwX2Y53ufq8Np3e1542lh3/mpiGSilCsaTahEGrHK+lIusl6mz Joil+u3k01ofvJMK0ZdzGUZ/aPMZ16LofjFA+MNxWrZFrkYmiGdv+LG45zSlZyIvzSiG2lKy kuVag+IijCIom78P9jRtB1q1Q5lwZp2TLAJlz92DmFwBg1hyFzwDADjZ2nrDxKUiybXIgZp9 aU2d++ptEGCVJOfEW4qpWCCLPbOT7XBr+g/4H3qWbs3j/cDDq7LuVYIe+wchy/iXEJaQVeTC y5arMQorqTFWlEOgRA8OP47L9knl9i4xuR0euV6DChDrguup2aJVU8JPBBgRAgAPAhsMBQJU X9LxBQkeXB3fAAoJEGFXmRW1Y3YOj4UAn3nrFLPZekMeqX5aD/aq/dsbXSfyAKC45Go0YyxV HGuUuzv+GKZ6nsysJw== Message-ID: <6387da90-c0de-00d9-9744-d4386a316e79@gmail.com> Date: Tue, 26 Jun 2018 14:59:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180626175050.71165-1-brandon.maier@rockwellcollins.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/26/2018 10:50 AM, Brandon Maier wrote: > Since a phy_device is added to the global mdio_bus list during > phy_device_register(), but a phy_device's phy_driver doesn't get > attached until phy_probe(). It's possible of_phy_find_device() in > xgmiitorgmii will return a valid phy with a NULL phy_driver. Leading to > a NULL pointer access during the memcpy(). > > Fixes this Oops: > > Unable to handle kernel NULL pointer dereference at virtual address 00000000 > pgd = c0004000 > [00000000] *pgd=00000000 > Internal error: Oops: 5 [#1] PREEMPT SMP ARM > Modules linked in: > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.40 #1 > Hardware name: Xilinx Zynq Platform > task: ce4c8d00 task.stack: ce4ca000 > PC is at memcpy+0x48/0x330 > LR is at xgmiitorgmii_probe+0x90/0xe8 > pc : [] lr : [] psr: 20000013 > sp : ce4cbb54 ip : 00000000 fp : ce4cbb8c > r10: 00000000 r9 : 00000000 r8 : c0c49178 > r7 : 00000000 r6 : cdc14718 r5 : ce762800 r4 : cdc14710 > r3 : 00000000 r2 : 00000054 r1 : 00000000 r0 : cdc14718 > Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none > Control: 18c5387d Table: 0000404a DAC: 00000051 > Process swapper/0 (pid: 1, stack limit = 0xce4ca210) > ... > [] (memcpy) from [] (xgmiitorgmii_probe+0x90/0xe8) > [] (xgmiitorgmii_probe) from [] (mdio_probe+0x28/0x34) > [] (mdio_probe) from [] (driver_probe_device+0x254/0x414) > [] (driver_probe_device) from [] (__device_attach_driver+0xac/0x10c) > [] (__device_attach_driver) from [] (bus_for_each_drv+0x84/0xc8) > [] (bus_for_each_drv) from [] (__device_attach+0xd0/0x134) > [] (__device_attach) from [] (device_initial_probe+0x1c/0x20) > [] (device_initial_probe) from [] (bus_probe_device+0x98/0xa0) > [] (bus_probe_device) from [] (device_add+0x43c/0x5d0) > [] (device_add) from [] (mdio_device_register+0x34/0x80) > [] (mdio_device_register) from [] (of_mdiobus_register+0x170/0x30c) > [] (of_mdiobus_register) from [] (macb_probe+0x710/0xc00) > [] (macb_probe) from [] (platform_drv_probe+0x44/0x80) > [] (platform_drv_probe) from [] (driver_probe_device+0x254/0x414) > [] (driver_probe_device) from [] (__driver_attach+0x10c/0x118) > [] (__driver_attach) from [] (bus_for_each_dev+0x8c/0xd0) > [] (bus_for_each_dev) from [] (driver_attach+0x2c/0x30) > [] (driver_attach) from [] (bus_add_driver+0x50/0x260) > [] (bus_add_driver) from [] (driver_register+0x88/0x108) > [] (driver_register) from [] (__platform_driver_register+0x50/0x58) > [] (__platform_driver_register) from [] (macb_driver_init+0x24/0x28) > [] (macb_driver_init) from [] (do_one_initcall+0x60/0x1a4) > [] (do_one_initcall) from [] (kernel_init_freeable+0x15c/0x1f8) > [] (kernel_init_freeable) from [] (kernel_init+0x18/0x124) > [] (kernel_init) from [] (ret_from_fork+0x14/0x20) > Code: ba000002 f5d1f03c f5d1f05c f5d1f07c (e8b151f8) > ---[ end trace 3e4ec21905820a1f ]--- > > Signed-off-by: Brandon Maier Reviewed-by: Florian Fainelli -- Florian