From patchwork Fri Dec 18 10:55:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 346203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A0D0C4361B for ; Fri, 18 Dec 2020 10:58:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3D8123A62 for ; Fri, 18 Dec 2020 10:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389318AbgLRK6B (ORCPT ); Fri, 18 Dec 2020 05:58:01 -0500 Received: from mail-vi1eur05on2110.outbound.protection.outlook.com ([40.107.21.110]:62177 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389290AbgLRK6A (ORCPT ); Fri, 18 Dec 2020 05:58:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BBn1N7wFfZqEMkR0xU4gEFP/1LO3xtB/9sKLddq9xzvHcaSSK/IoIzRYnEL9+vXV7+R2MHZjjxB9QU9pZOCNc7BLnjdQ9MqpdfRF6tsaXrgxgeRokQeQxfXfsPIyYsO9kdXI8JPn4UqDaTJRS8fbcBggPokDkEupAtgIsFsDXMujSWPnS47CN5QPzWamI8N86mvTyPVrGo63HEtTNgVqYJRdSUjrhveG0ausoJ0rqx+6I0k26wclGNJT88goe6MybwEFy1v8e4JNR2n85wHQa3dsqLi8jbatBnXIzWTzOi/w1qyB4g+hK/jDfOHn9aPYM5Hrmpo458UWgRDWHCza7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qvWQa9GJbeHHpYLFRbIUYYJ7VqMhR/u01W5562zRcTA=; b=aDaVcMMUfk8P9a7Go1gIXOFdTnJHJJieDqLbtmzfNHoLRx8FWjhwvt/gkJjT2fHcO7a9As1bkcX/bYdt+CvMGwRhYmmNye/8FPFayQ6UYHMlmO2/T7XWvBQsnzKh5zVUNqwDIbWKbmjB+qTEx9O54/7vGfomd1qkXKHm3w2LZM3Earok9aEDVShXh0e5qO1YwtmUz+owc9GHpm0V+793ysp+up2pi5BjvHfXTMb1TYA9KrUgUBu+F9R9gVPpKyifGqvmyL67OuwCzrAeUdZECiQ4QpgnyeDKky18tKr/ieibZB+8H7tVtXw4tocrKkg7+HgmYejVMpEgxgc4MZHCcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qvWQa9GJbeHHpYLFRbIUYYJ7VqMhR/u01W5562zRcTA=; b=ZexDRCm8L96O2wIroK7peEwqj5JX+DDyYUky4nQ4eC/ztE1KsPhJikOTehYPDCBLMv6kslFSo4aR4Qne4aLN4iLO7xsKgLCBLI4JHy1OKrZDHkcgt1MjeK2rWEeVIJuLTWgaJPL/KDvJMZWYZY6SKDmXCVSyT4PDxiMe+ucupCA= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM8PR10MB4163.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:1e4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.13; Fri, 18 Dec 2020 10:56:39 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3654.025; Fri, 18 Dec 2020 10:56:39 +0000 From: Rasmus Villemoes To: "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Zhao Qiang , Li Yang , Andrew Lunn , linux-kernel@vger.kernel.org, Rasmus Villemoes , Vladimir Oltean Subject: [PATCH net v2 1/3] ethernet: ucc_geth: set dev->max_mtu to 1518 Date: Fri, 18 Dec 2020 11:55:36 +0100 Message-Id: <20201218105538.30563-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20201218105538.30563-1-rasmus.villemoes@prevas.dk> References: <20201218105538.30563-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::41) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Fri, 18 Dec 2020 10:56:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05124c28-6f95-4beb-c3d2-08d8a3439889 X-MS-TrafficTypeDiagnostic: AM8PR10MB4163: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XAb94YHceBYBy/IrB1ReJUwzHA8QEb+NCAXS9w5dBAdpTyvDLNsW2fwuJyWVnIuQi8Hhhsbmc/qtweLBt0zUNbbVTSN51k+k6EHcqE8YZBeQQFCMEVsPeRAWVNRVcR7mhq+Adi+AfKwVdmL2QFXlKmOMgH92/496dej8oYhSOunAuof+eX5BLBUtPiiv/PHMz7a2NOWt0sydmF8bw/koX1hpt8qQKCKcH6fw3qMCUivkYSrCaDfa7+yqqaYeRzmY7hdB6rMPZ7V6jCA8Szja7F4B4w8FfEnSmMkGyOKosKNfv3zX+V7Viq6WTu9dah+XOx2f+lR+6caosGI4snT73Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(376002)(39840400004)(396003)(366004)(136003)(346002)(44832011)(66946007)(36756003)(26005)(66556008)(2616005)(52116002)(478600001)(316002)(86362001)(54906003)(8976002)(956004)(1076003)(186003)(2906002)(16526019)(8676002)(6486002)(6506007)(4326008)(83380400001)(5660300002)(110136005)(66476007)(6512007)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 5+kJ8rsjnx2gjvQL4GOgERrtAP0+W0i1S2VcVXk1hMIbJmdBdA/SPzBKx7aW6E3WF4j3Z3TtdHkArKE462ZiLzhO5O/2aCC1GbZA552RbsMQT6Orqv9XSfv18dOzclUCojyDOtqhex92/V7zrxgsnOhBuYiN6WWvcpojYrtUjx3z4m/sSiCTEkakbvYwnmKN56d/mTSy/Qj9rScETgjycsDnnmfBQoQ5Vr7hgoFCg1sM7HoFv7IPOhCs0eq191AWspXMAYPQluNw9c4qgNPno+rZ1jgmMC1pg52il84yPdA+aXYBDyv2sM0qo4jFmzz1xGXbIRigN8nuSG8BJ//PZHtobCc1Wj18LDba9yp2Fb9MauPtgrCtBi51tv+jiYDyrN73i0GKR4vWrdq1OAmrZTxzsrksq0AKZ3Kvn1B86voEdJVofufy1R0xWOCGxUdLnUQaE3b7n9nHDqwdo/G5g9cj0k1vsEptQM+N6hqviPSFCzru7sNy7PDHIoKMzgTwAhQxiHuAqI5BD3SfKxjdd54NuOv0gEZSz/xJHVycK6cocJLYT52lRYY0l+OmvtmozMnEXbGkAnIuLLeURkQXN49G5gL9+v/o8A5vuV5uAbENd6rZsbV83Dn14hTk45ZUvpTCgv70FXfmA0YdWaL8mtP+X6kxbdc2IhdBKUAK+fqA4pLxuMOmFjgph7WmHcokR5VfOig21U68/ClzYrUsh5je21IkUo+pTx1ax3lWPqw/MPAhSQqjydO1diiR2aG8IBrHFfPXyiCZqRlBo5k6cgWE6g/58lxVNpor2118NxhTCMgmuKQ+Y7MsUCHvSsIZ675DJUsw1/W8Xa96PFLT2eieZ92SoxeovWBMbwWiYRy6dGgy42eWEHvxmWUhd3LenoeX1WroXI35WCO0Cox0o05f7pn9vcEWPpsJOGYJpcuyTwv/8z98dGhlI0tphgul6EZsTgp8Y4PXc9+iy9CIiAzLA1gXhE3QTl6ZkWqf0FdtonKfoyU7VS62Ak12JS2Y X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2020 10:56:38.9267 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-Network-Message-Id: 05124c28-6f95-4beb-c3d2-08d8a3439889 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xb4+NGZvzLbPkAYDAywlc6Tz7r0tMHUlkI3aYFxmHZkDzRgJ4LA+T+g+Cq4RS3AM08XTVMkSxiCFO9Ql6W/OKU4iJMVeywyaZAJuuXPgJpI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR10MB4163 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org All the buffers and registers are already set up appropriately for an MTU slightly above 1500, so we just need to expose this to the networking stack. AFAICT, there's no need to implement .ndo_change_mtu when the receive buffers are always set up to support the max_mtu. This fixes several warnings during boot on our mpc8309-board with an embedded mv88e6250 switch: mv88e6085 mdio@e0102120:10: nonfatal error -34 setting MTU 1500 on port 0 ... mv88e6085 mdio@e0102120:10: nonfatal error -34 setting MTU 1500 on port 4 ucc_geth e0102000.ethernet eth1: error -22 setting MTU to 1504 to include DSA overhead The last line explains what the DSA stack tries to do: achieving an MTU of 1500 on-the-wire requires that the master netdevice connected to the CPU port supports an MTU of 1500+the tagging overhead. Fixes: bfcb813203e6 ("net: dsa: configure the MTU for switch ports") Cc: Vladimir Oltean Reviewed-by: Andrew Lunn Signed-off-by: Rasmus Villemoes Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/freescale/ucc_geth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 714b501be7d0..380c1f09adaf 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3889,6 +3889,7 @@ static int ucc_geth_probe(struct platform_device* ofdev) INIT_WORK(&ugeth->timeout_work, ucc_geth_timeout_work); netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, 64); dev->mtu = 1500; + dev->max_mtu = 1518; ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT); ugeth->phy_interface = phy_interface; From patchwork Fri Dec 18 10:55:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 346204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1F69C2BBD5 for ; Fri, 18 Dec 2020 10:58:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F91423A82 for ; Fri, 18 Dec 2020 10:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389270AbgLRK5b (ORCPT ); Fri, 18 Dec 2020 05:57:31 -0500 Received: from mail-eopbgr20092.outbound.protection.outlook.com ([40.107.2.92]:62798 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732744AbgLRK5a (ORCPT ); Fri, 18 Dec 2020 05:57:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DuwHOg47Ke64x11O0b/cIEn8illAbDOZsKMNGTOw0+wev6DEjjGq2kiEuh1iZZIQfqaag8l7k2tdNg8xq7YJHUhxiVsGqEltWS98Kr6u/HPzblx6cs5bWqnQhTgBpNbxrLLoTMClRILC4Um4kZ9PNHFsOBr5bKxi+F/h5jqZRlNZD/ArIRfbzjSNRK4C80sVre0g/QMHmr+iddD5m3dQ7PL70u5rf2Em6lSdHBzbyGrxcWe/6+YW3Fuf0DHWyWlehA9dTM9kA5tj2BGm6Y5/J1WP2nPqxTnmkvAEihTEbW3nA0NYlq1oAokAwWvsFid8Cnm2oiRHDi6tJpZU2AO8oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gkCRv1cpcMBcINj2tEY21IZ9I/xHKv6lZzxZhPcmuQ8=; b=gE95HLQy2D5MxPozcK5Tbt+I8yj+HpjgYwJOzWy0djZ71CH+rlntHaLoH3XESnmk/O3FTbefT72O5XaQtz1vKruSNeuznMUXcdp4Ul6GknOSXUQlwnXrY/OcqtaCr2jAyhwd4NyYPMUiTtMJF8Rl+rqyvJ1mlJXypj8QCZ88dpGx2cKcO3h+6XqWMjJ6ul3Kw0ull9lKXv3TPvqtflr5wavAYaHXvDkxGXF4tQ3Cv7WnVKYTHiFtMjsYkfDRV1ScUtRRqOD42N77sz0lfJgcL/VO+4o7yNO5E2JAzRJpR4DIykKuv4yFSn1DJdYzWW+ndrZabZeAYQLAvqkRyBqDsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gkCRv1cpcMBcINj2tEY21IZ9I/xHKv6lZzxZhPcmuQ8=; b=enYgCSAFQgXZm/rIja/d7ndYmdtH0/hXJHXlHfDxLV2WNmF3s0J9NtTmiF4Lcs88/CLsRIvyN1xRmvunGssHGYem8QX7QeAoNj8G+VRlpHdiu5WOfnalYrpOcmrNo1+Ld/iA56omBrMtGK3LFzwqcC0YrK57+sf01Pi/sNNWmpo= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB2675.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:12d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.13; Fri, 18 Dec 2020 10:56:40 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3654.025; Fri, 18 Dec 2020 10:56:40 +0000 From: Rasmus Villemoes To: "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Zhao Qiang , Li Yang , Andrew Lunn , linux-kernel@vger.kernel.org, Rasmus Villemoes Subject: [PATCH net v2 2/3] ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram Date: Fri, 18 Dec 2020 11:55:37 +0100 Message-Id: <20201218105538.30563-3-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20201218105538.30563-1-rasmus.villemoes@prevas.dk> References: <20201218105538.30563-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::41) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Fri, 18 Dec 2020 10:56:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fcf8bbf9-43dc-47ee-3a10-08d8a34399b2 X-MS-TrafficTypeDiagnostic: AM0PR10MB2675: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d3P+TXNwEUEGfVnSo56ZmIQJvSHQJa3bDpIe7V/XyAHacadE49MjKQ6kzUd5GigAY2zsj3eAWUfMZQ0EHnxdWd5S8EgtVD/4Yc+4djlvnVMnA+QQStc4CQdZnAIxnKGIsDHZLawE+uydXhx1606BJ+XWaxdLU0sL4z6lJCuuxNnP/8aJ6I7aStYx5RaVWREBPHRj9shs4/nVp41eKBx3Z6K6U8oqIS/p7FdGohX4VhT6qAKjwlAXPmRbluKY1IPfFsvG4GfdBKK/38TVM26HKzAhpgfLKbG0ng1jSBBepzmE8ZvS+KKNdoIL3AQ+v/JAV4jM6EQsVGGGELV1RNh/vQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(16526019)(54906003)(8976002)(6506007)(36756003)(52116002)(186003)(107886003)(8936002)(478600001)(4326008)(110136005)(26005)(66476007)(316002)(6486002)(2906002)(6512007)(5660300002)(86362001)(66556008)(83380400001)(44832011)(66946007)(2616005)(8676002)(956004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: a7HVqVcdW77A44DT5E7SQLE7ktEtJxWDKz7Eue5Ie44Ko3mvq+aqr0fFEgaQ7S3Lmf7l7LSUNoRhnOPzI6syN171MyYyoz8kiW+3/Ck7fsGwCk6pbS0p5INSeNwL2lyIv7JNQReH4FEsiTBkOUQ2uM3D6IcnfBjh/9pE5adsJB+6aE9FQHlw80e8tDPf6TC02UdkkKoi+VGRzgagpuYkIRCg/1yPS8EDfE0GYVNV3CCJ9Dra8gLREON3+3rWPypYNGZzGoMIweXg+qoXxt1Di0o1sBSDms6Nv/FTKtSeMF1yoaFA7KPCbqvifDEEg0ozMYaSiBLdcVkAXugRPMZY9N4rXPzRkPR2yYWySStQ/4J/rslsxpQ7oy1PiZzOCqsg2lj+rWE4nBslTm+co3qXymCa3NnOBYPLb2ArOHUh3TywEYSBrSPm0DigopfKj8wfIdAVXkkEr0MvOhcbyg3WyNNQ5dy56Yg6MIISIuNMXDnbcvYJ7VfTcRDCie28R9FoU+ZZ8r1QOgi8FuWt/s5gRvLC1/LZg0z3WEPkvj0B24S5MnWndfqD4g7iPKLUZyWTpHSXox0kA53EMLQRgOs4JivgQ2k/rDVEvemMDh16Clg8Z4cJqJaJWJq9EoFWQC28VjFeOFABwP6qgkuyIuwzYX+ef+y7XxRVf41H6QuE9mMMG0qvtnjcMHArXm9EECV0IBFTEpVASw1CVG81Lv8f/++xU6zmNJ/JKgLkuF3sRTa5kurcqi6NpVo7uVdLiqUreBT/2os1RjzoQfNvLjXawY3G2A+8CLfHrH86N++59g6fYx13C1DSL5tnqeHQsbM2kPMKQ1xQrgu62v4HdG8gHEmvMTkq3ebVXamkHJyjd38ceRgGSFrQN3TZEvuLBW6RXBBcUXWrIhD0amfRLdC5SA/Sk5HM9/nzAqkucZkQueBXShKu6z26lz54mHSvjV0CU7xl+FDq3WIbQfGzEvMVBjaFft3ZS73GLPDPyi9XbEAiTamRRqqOXCMk9KVxSM06 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2020 10:56:39.8812 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-Network-Message-Id: fcf8bbf9-43dc-47ee-3a10-08d8a34399b2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OckUCGAaqB8rC7elRF1/+x4s24hzdAARagiFU0qaj+5LFfuOhTK+dCMlHVhwOfUfX4Taks0gsJDVPe/P6+yillYyKKj4OEq03ZZ/novZiLs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB2675 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Table 8-53 in the QUICC Engine Reference manual shows definitions of fields up to a size of 192 bytes, not just 128. But in table 8-111, one does find the text Base Address of the Global Transmitter Parameter RAM Page. [...] The user needs to allocate 128 bytes for this page. The address must be aligned to the page size. I've checked both rev. 7 (11/2015) and rev. 9 (05/2018) of the manual; they both have this inconsistency (and the table numbers are the same). Adding a bit of debug printing, on my board the struct ucc_geth_tx_global_pram is allocated at offset 0x880, while the (opaque) ucc_geth_thread_data_tx gets allocated immediately afterwards, at 0x900. So whatever the engine writes into the thread data overlaps with the tail of the global tx pram (and devmem says that something does get written during a simple ping). I haven't observed any failure that could be attributed to this, but it seems to be the kind of thing that would be extremely hard to debug. So extend the struct definition so that we do allocate 192 bytes. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h index 3fe903972195..c80bed2c995c 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.h +++ b/drivers/net/ethernet/freescale/ucc_geth.h @@ -575,7 +575,14 @@ struct ucc_geth_tx_global_pram { u32 vtagtable[0x8]; /* 8 4-byte VLAN tags */ u32 tqptr; /* a base pointer to the Tx Queues Memory Region */ - u8 res2[0x80 - 0x74]; + u8 res2[0x78 - 0x74]; + u64 snums_en; + u32 l2l3baseptr; /* top byte consists of a few other bit fields */ + + u16 mtu[8]; + u8 res3[0xa8 - 0x94]; + u32 wrrtablebase; /* top byte is reserved */ + u8 res4[0xc0 - 0xac]; } __packed; /* structure representing Extended Filtering Global Parameters in PRAM */ From patchwork Fri Dec 18 10:55:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 345900 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 412CEC2BBD4 for ; Fri, 18 Dec 2020 10:58:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1143A23A7D for ; Fri, 18 Dec 2020 10:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389336AbgLRK6E (ORCPT ); Fri, 18 Dec 2020 05:58:04 -0500 Received: from mail-am6eur05on2091.outbound.protection.outlook.com ([40.107.22.91]:14817 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389320AbgLRK6D (ORCPT ); Fri, 18 Dec 2020 05:58:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f0o+b9TSn3tmpZVqisxNKPpYYvQ0Uwq8EwrnG8FGnWnrK0WB/PJ/bOOf5H3D+XJ4mxVpj+vqvdU2r50/qDR77O+VE+LBlouCNTzs19L5+SD9kAmrXZRo59gYtxIn/9AGHXEH61wv5B+4CCkgyJQXyv0Z056KbZo5q2sVOEJFT/vA328G853k+N0jbCJuXCIs0V4pXcC560jbgD+t5ULiT0mBatZEm2TDToLygBgrZCBdqC1Njpe/JyLPmR/euhun1eYdcTcgHqi3aSUMM72tR1pwiegCWQv6Oiq9WyyTsWRYSDRw7oVGYi+1H4USxQ/0uejCLhEGz1AqIoZXpMmETQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PB0k3Bnfct1PffRRGNKMNfOgMxsNzekRSMbeyMqp8go=; b=Q4jL5Y7Sj7cWQEK3/G7PttNPMjOdA6WE6b8UnUCgnf8IOtRkZpEywHVVpxkfNRPN81t1Kx0MTLCEilyx51OJ91OsFtcSqUm2P2sYkII7Odr1SyOEPbyXptwdjlGEOxPafW9qmDWAyb+86qNav4yYj/68GB0bbNP/8Tf/uM5yqZv3MGWFS1m9sVlu6GPTzNQOUHPnm8eB9mbRfPsOmtDG3q4oud3vW+As1C2WO/WD9wJc2SB7lrboNhF/i3qOm30mJmejLft1NgzwHry2kB/PM3l34pXM1iZuZFsH/H02yCn2uu0CC7tSQ278TTuPS3fn3AnU0fhFGzNZAatJUEvZew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PB0k3Bnfct1PffRRGNKMNfOgMxsNzekRSMbeyMqp8go=; b=codgDWSDJebTjg8pYKMrMKA0zwgFeXdLlKrVHf/Gr9Ooq6i8lgK57OVpj8z69Efj3N/MecM6S3fy4neXqfaeD5bWkma6bxwsaXa9erlksjICqML+MPABEhj88c3MvjzFzU01aRlZlRByxlfaJ2gZ5YCVm4C7DkhvofuCf4sukfI= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB2675.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:12d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.13; Fri, 18 Dec 2020 10:56:41 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3654.025; Fri, 18 Dec 2020 10:56:41 +0000 From: Rasmus Villemoes To: "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Zhao Qiang , Li Yang , Andrew Lunn , linux-kernel@vger.kernel.org, Rasmus Villemoes Subject: [PATCH net v2 3/3] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove() Date: Fri, 18 Dec 2020 11:55:38 +0100 Message-Id: <20201218105538.30563-4-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20201218105538.30563-1-rasmus.villemoes@prevas.dk> References: <20201218105538.30563-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::41) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR10CA0100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Fri, 18 Dec 2020 10:56:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9dd0446-01b3-46b6-ad8e-08d8a3439a47 X-MS-TrafficTypeDiagnostic: AM0PR10MB2675: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cu0Nqtb9wbcEy2+cMA1aJcHqOGx12mGw1ES/Y78GJ+yd8HY20WJfjqT1enFze3+ZBD472Iib3a9PTHhC028xNBnBjN7csCaqn7kSf5hjTabdcllwlx8HjzHvJz9da9IxeaUCbTVIrHiKMwyBYzkY/dPOKFB7yjxJJYhQPmcZ0eC/waR1DphhlRrRU1pXOL/AeQo3O08lBqnpBNPWzGaTn9GPMVUfZHxzy6mcRoRkwkIyka6wJtFvKyz1SKWaZ6/tL//nncNh89vuWl5wnDKO4QkyMzjI8FodiGrA+tYVLFehOo+oFXTDHp2+ld/rkI8oe8d3NN3R16SjOtoKESMPOA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(16526019)(6666004)(54906003)(8976002)(4744005)(6506007)(36756003)(52116002)(186003)(107886003)(8936002)(478600001)(4326008)(110136005)(26005)(66476007)(316002)(6486002)(2906002)(6512007)(5660300002)(86362001)(66556008)(83380400001)(44832011)(66946007)(2616005)(8676002)(956004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: NHtVKlC3RW1iUTt+7s0yTqepN7uaO6DIMQb/AyFdTlGqXgvDECGP8A+CkvXivFHm2GFkyyEB/QJw3X0EBCE35a/4lTT2pfmY4X/7muwbTdydFrgMo8d/xJZdPdHP4B/AH5pk7EJBRZpl9DGTQ+2BdlpVz8ZqHpQ58ujCf/9pXT1QP/KeYhwQJfDlBRvF7H2zwlRthlB1yUlG8Lk20M98qHzdcFr7KeG721FNVusaofQvv17PC6n8f0mbT6afUbJ8P6EdTh8F/MqbrCLnXIHRkjE7F5AKZvSEtGhLrQRmG7qaE5efV5beC/2HuygCsszoofJb4h94glvB3I1b33MLrbNKb7QrrPpLepiPAhVb1lgie1hTQlXwFtARq0HbhOettkmDi3qbAD31lIPW4grI+NmZcceCVpUcfdBkhxDFzx0uUQ+RHVF/pBT4LjHeU0b2d46WeoNnGj7ewFNWxn4B9d72KgofEBgm9Gb/EvDrzAKBY5t9gIO6Y1iL0yt1m1/RLukb29jb8H+qDMC6c3pa2yGvuQO0J2L3/rdlIpBGaKrEIbYUmm3NsKaHOS0RkPIbr+LqsNX/ASTaq0VbVgtFOqKKXoNPl7D9BV7BwkKPjiKmDFnfT0o5bZiyrP/3GYwn4RMojZCO4wOjvG+D/SChkDpOATvA7Q+2DSJfrELfTvPy/Rwd5b7MmIHDTccs7hYAEsBqGAwMBGR9KkEUJUYjBBBcNRC1ZZqNA9cLzqqJ8sPtv9xA49NNchuy3J08fid3sBHcmfOF+aC0vEWTERyrl9FacW9xo8f4h5LOxzOV2HARjLnof9/+UvCRuM3H5AvECDKFNscYi3BGt8vxO0mBuHbfLjVf7Z65N/K5c0aMwtxOyXTyCa4ocVpzn3o7G4g2urFzKeDdi1TUBvT0niSOqmeUQ8C8kAMOvoM5p5V6/LPC41KC/HjIfeDK+hM6lEtZOSOo7KJiizoEDKu4ospifA90TGWwTPfDckHanrzO+ydplWCc1JTsQci/VJw2NeZT X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2020 10:56:41.8270 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-Network-Message-Id: a9dd0446-01b3-46b6-ad8e-08d8a3439a47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eZI1OkZXXMJrM5mLnSGAXAqPpJqbYUfibZBzeL0dsN3VaFOuaQ1uLr3KNhlY9tte83U488Uoz/C7grEjVHtIN01ZIS51JW4JcpSOjJvLd9c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB2675 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ugeth is the netdiv_priv() part of the netdevice. Accessing the memory pointed to by ugeth (such as done by ucc_geth_memclean() and the two of_node_puts) after free_netdev() is thus use-after-free. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 380c1f09adaf..3f9fca061cc0 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3935,12 +3935,12 @@ static int ucc_geth_remove(struct platform_device* ofdev) struct device_node *np = ofdev->dev.of_node; unregister_netdev(dev); - free_netdev(dev); ucc_geth_memclean(ugeth); if (of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); of_node_put(ugeth->ug_info->tbi_node); of_node_put(ugeth->ug_info->phy_node); + free_netdev(dev); return 0; }