From patchwork Mon Dec 2 13:49:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13890698 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 677AC1FF7C2 for ; Mon, 2 Dec 2024 13:49:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147370; cv=none; b=WiSNWSfz3K5m3pbAvcVu22B9byYSHcqBrdVLrGs0tDeXvMpIKpf8uxeZ+n8gf1I1qa79KQ8uTNF5/gkvpMcFvTWh1aezrc1RNHFhIiCOg9FlIz2UkOZtArXngJswq6qHPtiIftXYCug6cwF31/FbJYFZHicbGru2UDnJy6IUfKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147370; c=relaxed/simple; bh=SI27lQ6ouPyc6VSvj6mijRBvLjbpSdfHHV2X5cxHAlw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SklG54h4bsPggluJuhTcuS+TQJzWuMFE/XWVBSROdYOVBxYa8/X+7tgn+drFCXhnmTctYnG8C8WFg3u6dYQ59AJSuWDi0qq1VAccGeIMLUzz4Fj9ItTVyzxps2Oz5c+4QOpRynwwups269NLjP5YysFyfDIZdJtWqWmojqeGz0g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=qTVpSCx6; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="qTVpSCx6" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ffb5b131d0so42431291fa.2 for ; Mon, 02 Dec 2024 05:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1733147367; x=1733752167; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cynV8pOJrKJvNaQFqaJO/JMUBstzgBuJjjWcaNQed4I=; b=qTVpSCx6nDrSBxfGPmm8KRQIza1xs8O+P2CMhuBLjzwZ+1/K+LOyRjrwf31ALA5B0Z fV2pN9Ro5NwmhF5Ow5oK5q78qT5YOkCWs5luj5egPC6fSomWZikC8qxVI/LpP/ZCF5Kn k+gvMiMkYG0LQqzPY5oWD6UwwQ9tUJDbQ40mo59KN/zFeQhqSYurkShbpQ4FoLUnwXSn RCFtJnFymsFKpwyiqbuYVmbKnwjra+6Ycq2QoME9r6li75Gnw697/b+XV3vF0yPw5oTF 2qogEYnGPaZZjvQaBh1CEtzVtD9dujafXPdnZmV1O3e8srVM79RcprWWHpvGJIKb6tmK 122w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733147367; x=1733752167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cynV8pOJrKJvNaQFqaJO/JMUBstzgBuJjjWcaNQed4I=; b=eK5n1somdE4ZDUKUxCB0hyS0p0MA32a5kM9E5IrRu+oMv7+watWN30Tflfq590R5wl 2277sWqzpRSTOyTH8LAamWC0m0RtemeOSyy15hX1xUNDvkKLF7JkpbtEUyt0YTtwZPeF pEbxWa9zRBDK8ONJ86z12qSA6jXlhNVC26V1Z1fAUCbrdeSu8/RrYwhwO6zpyZ55yAP6 E3TVATS2zsZ1froGuDXsvmKUGnKOYJXRI2Tbf7ELKSCAmE6ZjAQVb3kazxthBxT5qBeV CAbRdBkmp1zUKUuUwsjzp7NlOOkcOovY7UcjsXxJ4GEcOsbpeFbmMSrlAFJ9K6NPyHkE ZRZg== X-Gm-Message-State: AOJu0Yz3Nauvk1l98AQUHsr0OqflXsBd/giB/Q5GPAp/DWM6Z3OsPBGR zEpmpLRR1GAHwPc8RTO/3W/qIC4IKoOKh87WVCzs5OfrVxwFKXsUfsIvAwydbzM= X-Gm-Gg: ASbGncuZAgrqQbLaa479ooqxmSKhZmsk3FrIrFCuZebN6Z1VwliqMNFOaDkEI0HTkrV DB1UEfTZrrp6984kljyB7GHGmAW58hkV5Mqr7690NwBtfyOvv88OYRgYddJB91A6a0MmCx3wwWs uewvA0wdqJhYuUBQ3NuHQrNSVZfaSysQqC8VqTA6dhxxRxN7gn4tQ8OsXqEOA6Ix1cisJrIeWiE VLP47xU1tFQ24KjFoYH7eJnEpFNPQLL/kzJGn2GrQAok+EJ0yBwatHjjn/WokLj X-Google-Smtp-Source: AGHT+IGMSwQqN8YQrvqohBJn4xVh/kPUa6r3akG6CJKNWLEOJ8q9gtd0peH+hJ9kwJ7mo6G0r5fDTQ== X-Received: by 2002:a05:651c:1547:b0:2ff:8f5f:1adf with SMTP id 38308e7fff4ca-2ffd5fcc1bemr59514231fa.5.1733147366620; Mon, 02 Dec 2024 05:49:26 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffdfbb8f2csm12972661fa.15.2024.12.02.05.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 05:49:26 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH 1/5] net: renesas: rswitch: fix possible early skb release Date: Mon, 2 Dec 2024 18:49:00 +0500 Message-Id: <20241202134904.3882317-2-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> References: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org When sending frame split into multiple descriptors, hardware processes descriptors one by one, including writing back DT values. The first descriptor could be already marked as completed when processing of next descriptors for the same frame is still in progress. Although only the last descriptor is configured to generate interrupt, completion of the first descriptor could be noticed by the driver when handling interrupt for the previous frame. Currently, driver stores skb in the entry that corresponds to the first descriptor. This results into skb could be unmapped and freed when hardware did not complete the send yet. This opens a window for corrupting the data being sent. Fix this by saving skb in the entry that corresponds to the last descriptor used to send the frame. Fixes: d2c96b9d5f83 ("net: rswitch: Add jumbo frames handling for TX") Signed-off-by: Nikita Yushchenko Reviewed-by: Jacob Keller --- drivers/net/ethernet/renesas/rswitch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index b80aa27a7214..32b32aa7e01f 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1681,8 +1681,9 @@ static netdev_tx_t rswitch_start_xmit(struct sk_buff *skb, struct net_device *nd if (dma_mapping_error(ndev->dev.parent, dma_addr_orig)) goto err_kfree; - gq->skbs[gq->cur] = skb; - gq->unmap_addrs[gq->cur] = dma_addr_orig; + /* Stored the skb at the last descriptor to avoid skb free before hardware completes send */ + gq->skbs[(gq->cur + nr_desc - 1) % gq->ring_size] = skb; + gq->unmap_addrs[(gq->cur + nr_desc - 1) % gq->ring_size] = dma_addr_orig; /* DT_FSTART should be set at last. So, this is reverse order. */ for (i = nr_desc; i-- > 0; ) { From patchwork Mon Dec 2 13:49:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13890699 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 495A5202F65 for ; Mon, 2 Dec 2024 13:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147371; cv=none; b=mfh2qmaMlDZoJ7h6gpcDTkGLmIfBc5Uggscr/R+1qZNZyDSZ3j30h6tNAcqcBoK0mETIXYLwdIRIKVR3tO9iZUTPdJUIYkVfVr/aiC6m7Q8PW59nYGYLRz6ZqKFagBOrZ25U6kvcvWO2QviL5B6DPJTlbQwQep0b4a8nrz75tro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147371; c=relaxed/simple; bh=ikLggKYh0Un8afUAvMUCGvNq/h+HGVzb6q6YC7Oxa3A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cgEjSZLsxt17mv6+aGyfUETE/YHg0CePOJdawcfcv+mhMhx6AXZxEXUJqk4yUUaJMwD4iD/+cXpqyOB3QxHOOu9KZ5ft493qOyqRI0LVaDqgWvL+tJivC9bHZ1m8fB+dQHm6gJ0sRlw/BDF21PH2Rxv+T30uLo0G9717trnrTjE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=Hq3T9o5Z; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="Hq3T9o5Z" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2ffe2700e91so35117151fa.2 for ; Mon, 02 Dec 2024 05:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1733147368; x=1733752168; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P4PkmDMX0LCsciSdEuZzJRFJdqj1nfUT/bpDSGbr0kc=; b=Hq3T9o5ZO8J/XNIYur/Mmrju6aQ+W7TP1s6nkkl+uuMQYSvzGImfNbnr4pyur+Z7TB 2Tfacnc3UObebZLIykraVC8fROTkMBbk0WxpSPlXDF9vqggZx/NAYHXGijxWQf2mfFqB y51TLTKjsOUUdln0rF453qR0OU9A82yjTuH2MbmHIujPOZ5Os9YPDT/7TIZSNs7uhXrl GQyRg0zfdONLZNjWMiO+wNAl51t23mFnZ8K6Onj1Ixhx1p/nK00fYGi10hgCOZoGtFWF AyuqD5Whz1QqtORL+i/dNpZY4bEMA+pAm5qVckSJn7RNiyIpcoNDp6Js4cInKNajIGOx b9mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733147368; x=1733752168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P4PkmDMX0LCsciSdEuZzJRFJdqj1nfUT/bpDSGbr0kc=; b=M4V+olIoJizlqHXRXTm+SKgKJ9n9S2tKU4NWzk7PuszSTQTRqxya6C6U1F3nkYFJWD duKzoAw5SNnVzOl9eOnf2Jy3ZyPD9cvwWzu1ZKjUl6m0UcQfZTkdc8k4apKhRWrBWnQ/ f/Q+F7uKJ4r8D2MDf6ehJ/MlMhheB4jbAevuWqIgkVysKJaM9ekNi8/+0hM5RnONQGCZ Ixes1Og+wu3Cpua6OvR4Iw8wRvph5AkCWvtBPHiCgXJzAZFP7izcpdCWMBUDgIxXqTtk +TT4pUEuarA5xekpKsPEGoI4e1Qn/av4eeSF08udFweCLj01H4ygSAkXliaKJQS9O+Di C2ow== X-Gm-Message-State: AOJu0YwrydRLoNBGRCXOOA71/VamQgVS7Bas2a1uRE4wbkDB0ggfjskN 3LJENn4j8RCi5nk0wwrZUq8Ziqz3fzOTdPL1P033eJvxSfcByTBJ/pJoJQqLXP4= X-Gm-Gg: ASbGncsgb8Ojg+K9Y9fQMj6qEzm3RLRNAfGA5BZthdirBi5+5WPlOcW5JjTuvL3bzgx GofpdS4eVLVGToTDVDoTtpQrgP6yyrCZqtLV+5maI2Gy1V+3JQkCwKTBO8aGJxt7N11JuQrHzio KxGdcvXjIB2r/fhteoii7/oL0IE3SXaaqApU0q1W1zzpb+6Xowhh9gr0DVbx5BzzCf5ZwfJyvY6 X9zinYQA0n64ii19P2X48knSjeaIT1QHAbNn/XO44Xzh0lUEM/BPXU3+zQihtlO X-Google-Smtp-Source: AGHT+IEsaH+gdxnFkWmsXqpHCD1Zei6m+iH0fYiLGHgbg3pVjQplVpLyAye27YVe8QxL4WzDTSyj7w== X-Received: by 2002:a05:651c:2207:b0:2ff:566e:b583 with SMTP id 38308e7fff4ca-2ffd5fff0cemr104563321fa.11.1733147368492; Mon, 02 Dec 2024 05:49:28 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffdfbb8f2csm12972661fa.15.2024.12.02.05.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 05:49:28 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH 2/5] net: renesas: rswitch: fix leaked pointer on error path Date: Mon, 2 Dec 2024 18:49:01 +0500 Message-Id: <20241202134904.3882317-3-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> References: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org If error path is taken while filling descriptor for a frame, skb pointer is left in the entry. Later, on the ring entry reuse, the same entry could be used as a part of a multi-descriptor frame, and skb for that new frame could be stored in a different entry. Then, the stale pointer will reach the completion routine, and passed to the release operation. Fix that by clearing the saved skb pointer at the error path. Fixes: d2c96b9d5f83 ("net: rswitch: Add jumbo frames handling for TX") Signed-off-by: Nikita Yushchenko Reviewed-by: Jacob Keller --- drivers/net/ethernet/renesas/rswitch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 32b32aa7e01f..3ad5858d3cdd 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1703,6 +1703,7 @@ static netdev_tx_t rswitch_start_xmit(struct sk_buff *skb, struct net_device *nd return ret; err_unmap: + gq->skbs[(gq->cur + nr_desc - 1) % gq->ring_size] = NULL; dma_unmap_single(ndev->dev.parent, dma_addr_orig, skb->len, DMA_TO_DEVICE); err_kfree: From patchwork Mon Dec 2 13:49:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13890700 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 078FD201025 for ; Mon, 2 Dec 2024 13:49:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147373; cv=none; b=ukh8ouUkHesoVZrUum5MISekGXQ1KeJzr80fdU2jzyifYcf/JCr2pQX3I58YuBRfO3gLYzurXISnP8Y8ScNViEDQonqTS91Vnkog+lalKAVdoJALjZjscWokTRbMlrjjh7kzI8PournUjjJ8WHSkKThn2geaYZ1f3A5g13dGdHE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147373; c=relaxed/simple; bh=CiFizkoZC96MbaXexVr7inWPwfe5IbT1lj8DVa6YGI4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XJXqMG/RLyuRGZHkHmjjLGovqcsMFirDkC6bHxuzZqh/AMIF2AXD11pes4S7LugDgsV8ZHAAioaTWWw/q4kz7h2ORaa9DVxGolOyOYHnSQcmMev3w7mwh2DSnQLB2/JEhDF16WiaKihrp8Y/6WOY9uZKFeYqE4ojUcT7EfQ28zA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=F8/07/rg; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="F8/07/rg" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2ffbf4580cbso43228601fa.2 for ; Mon, 02 Dec 2024 05:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1733147370; x=1733752170; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/CpslHNkV2YabLsAqY6bUT0+pw/mS+82i2gGXOOdRhQ=; b=F8/07/rgvh5Yl/27rrroF8u/2iOYFCZMyru4a3SKjcp1W1fxnVUvuXZv8nlmFawmKc 3PV45IGE9CLf7FNXbmJkE5RU1gapus+p6u118pS2ff9cCx+wH213UUP6Ffjy+k/AVAFh nY6aX+Ite08eSMNj2quAobcza8eVZcOAP+tEduBb/2KBZnwNQq5RIsCQC9kwEbneo2Gy lyBIvFExwk+h6rGqrLWxTEDwnlaSMfB/vy/GQGG4QMgNe/1h3EnGnaTbmyrckHoyfbFx XCQUij99dAUkujTg9O8M2Ku0pK5CytyOy8TAc9NkIxYKm4s6lzdclyfCRdkfctGBDksH dglw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733147370; x=1733752170; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/CpslHNkV2YabLsAqY6bUT0+pw/mS+82i2gGXOOdRhQ=; b=b932970lBoR6pqVcXJnx3FCMAj30PoXv0eUP8Q0DcKYRffvYCQH1d8uC7vsQhSPADl sXm7BCv1qEyFK5F3ax3yj+wXSz3XTAehc1cgphdpQkj5wh7mxrujbGO8K6fKq2bNAxhT 2btvHsh6Q7AUOsVYmgVBJ3opvXY9hiLgPpwnpNLKiHleW6DQktgQXsqE8XJsQGsy9mlT ul9Q6DUH4KuKUAb+65QsOs6osYPSoHx1Rp6Q2olLGOoubGNGl8pfXwGKDSuerkbaWU3J qr8vsc/weNswN3w2gE40BIO5HcRq+Jo6FQ09tqcfsQnhQwUJ2U2Xb0v8Ju5fbrmGXb8X vfcw== X-Gm-Message-State: AOJu0Yypu54GOQp3hV+LxO86NZm3h78eN0SYcG9YPVrPgreSvspEsn8n gHETRE8P0Mzj7ESxKDO1nCN1i+65RAmJYLZsmU1zS8VeA2OREZUmMWinTzzo51o= X-Gm-Gg: ASbGncsynicYNljL5E/2MpfHOfiSKh/FzrI+ZWvt3ytg/QzGYxdE8bhGRmU2DiNNht3 ybUxXlLQq5PgvSg/K+LS4yJHXAaVVHV0f1u45lm3uWTqJkt4Zv3DLnnG/SdSDFwRiqtW7Hl6uIf MBuTnV3B8Rq1uA6qYSCESrppcjhgt15DpeRe2sMQaDz1co8G8jNn/n13Scorwlw1us5QwFvsGWT Du/QjNufjVQYVkjRVv2zr73FkrPyEoZbFfX3lSq0iVE7Y51DU+XnIIKoQYwFqbk X-Google-Smtp-Source: AGHT+IGOSgW0kQ/hZQdxpAEuxf3UJ+J6ThcTY+XhOdDP1TnARSGU6yBkX5H1G3ekAl2LQYW/fupQTQ== X-Received: by 2002:a05:651c:2225:b0:2fb:45cf:5eef with SMTP id 38308e7fff4ca-2ffd6120fa0mr125832051fa.30.1733147370261; Mon, 02 Dec 2024 05:49:30 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffdfbb8f2csm12972661fa.15.2024.12.02.05.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 05:49:30 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH 3/5] net: renesas: rswitch: avoid use-after-put for a device tree node Date: Mon, 2 Dec 2024 18:49:02 +0500 Message-Id: <20241202134904.3882317-4-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> References: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The device tree node saved in the rswitch_device structure is used at several driver locations. So passing this node to of_node_put() after the first use is wrong. Move of_node_put() for this node to exit paths. Fixes: b46f1e579329 ("net: renesas: rswitch: Simplify struct phy * handling") Signed-off-by: Nikita Yushchenko Reviewed-by: Jacob Keller --- drivers/net/ethernet/renesas/rswitch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 3ad5858d3cdd..779c05b8e05f 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1891,7 +1891,6 @@ static int rswitch_device_alloc(struct rswitch_private *priv, unsigned int index rdev->np_port = rswitch_get_port_node(rdev); rdev->disabled = !rdev->np_port; err = of_get_ethdev_address(rdev->np_port, ndev); - of_node_put(rdev->np_port); if (err) { if (is_valid_ether_addr(rdev->etha->mac_addr)) eth_hw_addr_set(ndev, rdev->etha->mac_addr); @@ -1921,6 +1920,7 @@ static int rswitch_device_alloc(struct rswitch_private *priv, unsigned int index out_rxdmac: out_get_params: + of_node_put(rdev->np_port); netif_napi_del(&rdev->napi); free_netdev(ndev); @@ -1934,6 +1934,7 @@ static void rswitch_device_free(struct rswitch_private *priv, unsigned int index rswitch_txdmac_free(ndev); rswitch_rxdmac_free(ndev); + of_node_put(rdev->np_port); netif_napi_del(&rdev->napi); free_netdev(ndev); } From patchwork Mon Dec 2 13:49:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13890701 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA42233F6 for ; Mon, 2 Dec 2024 13:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147375; cv=none; b=CojF8E4xa9Z58lxNKXLFjZYP31ilKgnIfxhfsGH0k+YgEpG8X/h66NtcbkQ/3Yr8I+4kPqdebew6wfKqoIcbX/5paxhsVUeexUyCKU1Ape94Q1dRsrrxH+k/dV3pvS65/jk2xiaCEehQV6nmIbLQK1EyE0Fq+mUFMoqRs26P1mc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147375; c=relaxed/simple; bh=4aBJjV9AGG6v/ueyNuXxKCEwqM57vbdIvUBj15x4HvQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JqIZ6gqkcK5SdYmQgDnanLsGK8TQcdE7yHFhEfI8jz77AnnW1BFo0Opqt2R33BdWN6Mwyr+ihZr5cNmMnwPztREGx29xxpCXQic/9azsW7tREXeWlgZk27iuuCF0/CpR4siNZAveYCNwN7aY7gsFYqcG+zkJumCIDueFhvBuIqY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=1FOEisxi; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="1FOEisxi" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ffc80318c9so44187191fa.2 for ; Mon, 02 Dec 2024 05:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1733147372; x=1733752172; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=utmDOcX/I6M6gZgQOmT31f/v0I8skcbfVHDvau0Ra4U=; b=1FOEisxi8IeZv5FtSncX0miSxtfjQCXPiV6a4To0epk0J6OBPluPKE6FJzKwaAJMsG sebG4bzW+1pWdJMOIxMqDJGs23DzOebc+Yjf8UG4zmfch/F0br82YIJAeTSM16pmCLxY g4C89tJm1kYelawNphTjRms5tJuvfPOOM19acK89J3rfeNltTxq4FdubQatpMwn4O3it J4F/7uBkodCrQyxwG7W3F10IKaTpG1QwSBvTpfemKvAVCxAV57fKHXrK5XviSDv1eUL9 x3UEJ1hJunUYtVCA1UXoW4Cwdfq7s/ln9Ah79Q+mofoPwRlm7CeNFMrG/3X9jS1xvVY0 74vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733147372; x=1733752172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=utmDOcX/I6M6gZgQOmT31f/v0I8skcbfVHDvau0Ra4U=; b=AsD+PH+dkiAHlMbYmi1BUpJlRWNniqKSfjsjtU9tKWeIbevYVZckCY8beuxgysuuYv kMFAsnQN76qIb+WPltv9q453SRBSj2MAMGCIIbShLMI8uc+5bDZ8OCytfTZRtxxneONz YtHxctOLKAcf8ivVoYbBnjbyQsoxkwgsd4EmXA7O1GclhAL+YHQ4UcAI9DkCZvtlbUkw CEYhd0DLUwKNk/YhdtLgLMEuwnObs8z6QvZcZ4MM8cgqyiILcBWmlMtRSXp3dorM5vZU vXOnnc0J0X771wJibIxZ0gGnatdjlnb6HrScXEmN5uweWRhTWCiYq9UWfuv3OsMr/hQt M5GA== X-Gm-Message-State: AOJu0Yz8xMDjdsht+pG7ihu6oxV63STUg3brOq9/MQSdV9icfe9+ns3i YX4o+04mOPDb4vmb8nHKeypSF6jPNdQaTpE0lviyuups+JIc5+oYYsqwD/y9TZE= X-Gm-Gg: ASbGncvRws3MBpovgI+NachkW6OF5GkxabcEAY8LpKmHomjgffIxyy8H1oq1GSqpkiL 9Mhtm0fC+aavHuvPTQBSOlvrY4te+4HOSjE3NyYtF7pnaoTksNURmFAQamLWcvdj95NQ640faon AZVinLMx0RY7KHCKKqfl3ar9Vs1//3jabLwvxMwMGdWuOTD8Gll1dyUVAKdENu/pK0W1O839A1/ KE6FEd7jW5ggOY4vQEBFW7/ErkksaSglqjxasBaGDGyy9fSONzh+uZ7zAZEIuRL X-Google-Smtp-Source: AGHT+IEumbL0xz4LEy0IxGz1T5wriVQbKuAxxhzOUJEXRi0z23STaQZgb5byEvsRsYGGQEBKO7tgYg== X-Received: by 2002:a05:651c:211a:b0:2fb:5688:55a4 with SMTP id 38308e7fff4ca-2ffd6099734mr102259291fa.17.1733147372085; Mon, 02 Dec 2024 05:49:32 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffdfbb8f2csm12972661fa.15.2024.12.02.05.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 05:49:31 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH 4/5] net: renesas: rswitch: do not deinit disabled ports Date: Mon, 2 Dec 2024 18:49:03 +0500 Message-Id: <20241202134904.3882317-5-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> References: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org In rswitch_ether_port_init_all(), only enabled ports are initialized. Then, rswitch_ether_port_deinit_all() shall also only deinitialize enabled ports. Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"") Signed-off-by: Nikita Yushchenko Reviewed-by: Jacob Keller --- drivers/net/ethernet/renesas/rswitch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 779c05b8e05f..5980084d9211 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1527,7 +1527,7 @@ static void rswitch_ether_port_deinit_all(struct rswitch_private *priv) { unsigned int i; - for (i = 0; i < RSWITCH_NUM_PORTS; i++) { + rswitch_for_each_enabled_port(priv, i) { phy_exit(priv->rdev[i]->serdes); rswitch_ether_port_deinit_one(priv->rdev[i]); } From patchwork Mon Dec 2 13:49:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13890702 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0B00204F71 for ; Mon, 2 Dec 2024 13:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147377; cv=none; b=e09wKHXQcJfqP9ydzr84W/dbguCmntAh/CwVUGO07w2LXeyui4On8dQUftUakbIUbu7jd7AUW3fL1n9w1+WnBRCFyoZ6GhHluzNnOEk+ZfFIJY1uOsV4TP71nI1hbNSB5iqnOtZUH8xyVq2i/zk67BW3CJqaqHlisNN+sK0AgqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147377; c=relaxed/simple; bh=gi4r/9fiAEQcJ1/VpsFKftfVoGeRUSEvG5SkeQqi7t8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CjOqqrThX/7TGTZYhrvKTnlwiHHOaP32CPklTpetg3tDbhC4TKGxCrgEqAd0OdDzY8UGmfmTzYjF1Qe6BbohmVkXFtmxpaDGT479Q8tgajSxTgZ9K2IMholsES90Qu8XPWk7oR0eOwtuWKCQcrSlSU7IFxez41kXdo/LvCif82E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=X5Cjly/K; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="X5Cjly/K" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2ffc76368c6so62643781fa.0 for ; Mon, 02 Dec 2024 05:49:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1733147374; x=1733752174; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fwe209DAaje+GcWep9b6H0DEbfZW0MKQs07MfOwMWx4=; b=X5Cjly/KKUHZFYcDu1VQKm21CzLtryFHPMONpoaSCvLJL9wXEvLnlzYJV2IXy8qu5o LdBW5v6M5A+gFG9cXDnnN3BsYSA2gwMTB0slzdOhaEI6O1gp+EAut5bCKTspmQ9/uU2+ X45mj0IDppXB+EHNj5sXaVTgiLHYaV+o2ol1lvp5Go+wllXUXJ/sGzlCpM/qLzuYDWO0 +RY7gNcr2O2qv6t3UvqCjimuYBvPZU5fVwe3ucdgVnrTAhUNQubnOQkeo1Gk0T3/NOQc e9S9MUrba3uuwDUFPVPgqbQV7c1b58SDrupqXSk3uPoUWa7SJiDnEMuldd1KxqRf3WGt lyFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733147374; x=1733752174; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fwe209DAaje+GcWep9b6H0DEbfZW0MKQs07MfOwMWx4=; b=LwwTmnXAJ/KP8Y5Eunh0opfcSoL0274f039GqF2lGno5orxeTF4+pM2JpdD6YxnONr +a+jGaHACRB8zqeYfO7r46++ersuRezRZZBpafi32npxauyeqhdX4bMNqNzPiFQABVL5 7bV5Rol56egWhenQIv+MepC5UDBDpjDcxDZ13QsY2QPCEizYmkxYTTJ2bmDayw1zQqh6 WH766RQSo1ahSNvB3jddDSLRTkcVWHzpQc54JSft44/b42TlWgpwdkr63sFuUu2lXLmM mwSElnOvze/Q5EedqsctfSini6opa8nAhycEEY8byqalZqkCYEM8xGQoIW+XN+Ixesg8 bZ6A== X-Gm-Message-State: AOJu0YxTWQ2GSSckeWrICyfG9XG7GqiRgxr1N5M2qg47XXwTTEtEZEuo yyyVeFTji1jWBvtKT5z6mgEjfCgV6xWg/5Uh5QJq1UOpDMxbN9POGvIY/g5DRKI= X-Gm-Gg: ASbGncuB0H4Xn4rKpTiVP/07tPgN5/sDdrgUhPhHvzei7D6/gQ1ieU+eRB6eSZvaVmi EA+UTXtSb8/d+Bb0wvPJndx72tl5NZzlRk0S7jaV4pvNWsQ+hMAlespq6EM5tKo0y29Xr8+hIiA lNxxoew09nNPsrivv2PGZ7ZXYq3IJ4dqWDDc+zWd9s8pp+7s0JAcXt5zi+fDpvlXQl+667Myqhd qprJO8IbsJnjwK45QwoCLb7nDVL9T4eNbAlvL14YIZxzh7+e/XyOjKoGq3zCE4u X-Google-Smtp-Source: AGHT+IGPDUqvNQWOZK2p/wfCfolkShxEPG/W6xNxeCm8LRmsFRVGzSdVT9pHra7gpWP6h2+ulPowbQ== X-Received: by 2002:a2e:a583:0:b0:2f7:5a41:b0b with SMTP id 38308e7fff4ca-2ffd60a96f8mr185401491fa.26.1733147373869; Mon, 02 Dec 2024 05:49:33 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffdfbb8f2csm12972661fa.15.2024.12.02.05.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 05:49:33 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH 5/5] net: renesas: rswitch: remove speed from gwca structure Date: Mon, 2 Dec 2024 18:49:04 +0500 Message-Id: <20241202134904.3882317-6-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> References: <20241202134904.3882317-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org This field is set but never used. GWCA is rswitch CPU interface module which connects rswitch to the host over AXI bus. Speed of the switch ports is not anyhow related to GWCA operation. Signed-off-by: Nikita Yushchenko Reviewed-by: Jacob Keller --- drivers/net/ethernet/renesas/rswitch.c | 3 --- drivers/net/ethernet/renesas/rswitch.h | 1 - 2 files changed, 4 deletions(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 5980084d9211..bef344e0b1fd 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1902,9 +1902,6 @@ static int rswitch_device_alloc(struct rswitch_private *priv, unsigned int index if (err < 0) goto out_get_params; - if (rdev->priv->gwca.speed < rdev->etha->speed) - rdev->priv->gwca.speed = rdev->etha->speed; - err = rswitch_rxdmac_alloc(ndev); if (err < 0) goto out_rxdmac; diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h index 72e3ff596d31..303883369b94 100644 --- a/drivers/net/ethernet/renesas/rswitch.h +++ b/drivers/net/ethernet/renesas/rswitch.h @@ -993,7 +993,6 @@ struct rswitch_gwca { DECLARE_BITMAP(used, RSWITCH_MAX_NUM_QUEUES); u32 tx_irq_bits[RSWITCH_NUM_IRQ_REGS]; u32 rx_irq_bits[RSWITCH_NUM_IRQ_REGS]; - int speed; }; #define NUM_QUEUES_PER_NDEV 2