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: 13890692 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 7658A200BB7 for ; Mon, 2 Dec 2024 13:49:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147370; cv=none; b=sXmuWgy68GZaUx0eWi5Bz2LtkX37G4NQmE2sSxvC1b7yZiBN4aR4kToeCfxSY5YUnh9yRQZYEN4bL+Bjoxhjn323Eb/BcUmKfcYj6DQsV8ldeh657/po41AAH6LfEiyPNJyd5SEx4hbNdsO4ueJdYKX4fTrEk6Hwkyzx4yZDAQ4= 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.178 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-f178.google.com with SMTP id 38308e7fff4ca-2ffd6882dcbso33554721fa.0 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=n3//j/ehhquqJ3Wf+Gdh/38IT5g6RGJdFgg6SHaFQwI4iGgschROwIkp780/PNRXF3 WwE1z5IiP87aPT42A9IPDb898BR9/RRp5sy8U+ffOCAV7oDdI9Q3ouakQHoTmHbBMl40 WLVZjtELzwiK1TGLKULGulZl7pONYGjkV9ggPEIBqe9E8jaIT0mX07ev3zQSYZ6bjFqG Mz6HC4zhVmas9wKERoImQcIEuBpDlvuV+g0EWhPhT15rtY5zNfylFd6w6cxG58NHp7iD e7iFgIAbTG5nMIAMAHvbJNmJdZEh/uMakhfwMh5meR+oPbwY/3Zid+xehtzWUYYve1sX HtvA== X-Forwarded-Encrypted: i=1; AJvYcCVuvcSG7EpZtEgshn2hnsvyAEASMadZsIDsODR2Fv4fSN6iu3xw2Gcx/LnaT6ASNea7OyxielKkKaLijZ0tGBGRyQ==@vger.kernel.org X-Gm-Message-State: AOJu0YzUG/+GwrbMVV7B6UVd0BhWPgXkQzNqmQPuFjEpB5xSbGQ+C2dL llz51tZW//ePQPdkHdSLcvvPZMGwW1pWsa5Lu4OJmEqwOvplQdisLvDxOy9Ij0A= X-Gm-Gg: ASbGncshyKwNHFats9FIGRuMCZMd7xHw9mARm2c+Df5xNVIm39QDrGFupiGMiSOVI8H 0lSG6taM57r7gnFcUH760IdyQwVj2AQpSexemfISypcpqkQCzVVitJ17AxfcOPWMzfT3MBiNowr W7oT5tdoWG4fI69pLQfpr62ruNu3bPNDEpxXKS5zBGYBF0NF8qC117xP3RohGeaJCcTFztBwrZ5 1ulF5LIqS2uuX66dY4lKRCtLcOYMdWzZsr+wag3Y9RlKplPHXNXDXvaSL7L1avt 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: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13890693 X-Patchwork-Delegate: geert@linux-m68k.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 4C630202F68 for ; Mon, 2 Dec 2024 13:49:30 +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=1733147372; cv=none; b=REqgrAgDevlcYLvOAK/C/O35myytHDaU4wlqazZRDTWs6wy/cUHyxbk+MKl1iIXJvsM7oQEGGBIRP4kHybGu01bc2jBtuHz1goeKFnukJuEl7KppEKC7AqJxCiY7gcYyLJAeX+XKYdK7fwKJoyLMqPMZ7RY4lNSYe5vcbyo7z5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147372; c=relaxed/simple; bh=ikLggKYh0Un8afUAvMUCGvNq/h+HGVzb6q6YC7Oxa3A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RUHPMr0CeYqdXtXRvpbaD1tAK3qsgYCL83LX89sqKZHByS82lxzzJXoCuKZBrtma4Jpk4Zs4vniKgjN8sRWhqUxDqwT0wrR6rg/DU+0EdWOItnjBf/rvePSzSXhM6UE+ZwLQW5UjBA3PJa4Sgf4osVQ4k2g2opi5nKF0e0cgfOo= 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.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="Hq3T9o5Z" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2ffdf564190so48404661fa.3 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=R8jeeQ7sMJ32idVPsZLK9+TSDx9WFbFweqwfsNg/Yhly53kFLyaLEws7ZB+cAiyhbY 0F+6zBQ6t3r2x9IrwmOX282bZmW8d43M0bGYXn1R3MHBhK8PVEz7geDQrAQxD/EIv2N3 l4R2xY7DucDJT6G1SupcwwgDCGSy3FFzhoRGUr9Jm1DMXAlvAKRDQFs692rusxLs+Jeg N7UAefA4U0mhsBAA8MrxpZLTfSf5i4LhsnVYbVV5lg+hKhDurUgvv0AQrfyYU7SpyL6M DqkRNUT1bFyKPYv7hpFnnEHLXL4HZq4xD+qnkrjUMQEF1KSoAsAjmqT61t7Yacsqwab+ vY8A== X-Forwarded-Encrypted: i=1; AJvYcCVGR0+QHUuY6tjM8WkxFJp/Al8hbK4B1aotxBJc+TLA5IKS0V7qAKOugwaQL2DHXQ0ckzD2I096taqRN2Mt7f1yig==@vger.kernel.org X-Gm-Message-State: AOJu0YyDWSi7lvuaTcaX50F1KJQ3f864/lGrvyrQpUIDFgrApustbcHU j5TFppvQxWBbt0pK+UAo/64/hnyx40TgyiFxpETFCHvsnL5iaXJb1pCrswkkOOA= X-Gm-Gg: ASbGnctauI7a0mrI2EeMY8kLAYLGAWyAxuWD2/52M/gSZaYSv75SWda63hq8ZiZ437U x+xiw+/Zjr44uK5Ey5nTyd4E0DwApEyAQDKEBA6XAYC+I5ICNNFyGCUdyYJ5gP0kPlZYxrwGgRQ HdriCK9j79WLAfOeFrIRR/FXV30PQSl1YMU+p1xfOY/rhAS7hti4hboPR8EY8NrmsQfe8AVfNzY ctc1Gqfi5IaAwRRpIUI44GlxYS/oSzq94BDmKKU0j4IAHhu9QEsQDWmrpAZNF2a 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: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13890694 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 21DBB203707 for ; Mon, 2 Dec 2024 13:49:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147373; cv=none; b=Z5Fdy756e/v83M/sCQvu6Q0IewWzgOLa/zwhyP+AvgD9YWEnmpVLluvjVYiUAChnCw4Ihn9HBPAecIu7mNgvIWW/LXy1jH+fMRNMULlxpcuBYOvZtZlm2E2/SaXmXRJK+OpanQUCVlbFEAYWVUq602V5qv825jFKIknDK5ctrog= 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.181 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-f181.google.com with SMTP id 38308e7fff4ca-2ffbea0acc2so45146151fa.1 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=AGYX0itZiVUmBUJ1waLJjJcoKTAXuV3e/sO7uMScBttceUAtczoFWsAKwheeTEjIQ2 XLbdKkC40XWKTf/MF+3NhtVJWZ3FCC/2JEwu5TiwliuWymhOoKNcWd/rjxT01/QVsEE2 /rYgQNegtAd0Ddc9ZFi+wNCpvVnCSz9BCsGaJtNCrtpR5NzRxhmKs93CE9nOS2QQpKid JGAlJZoByN9PtP7cmEvbVvv1K2fxBc8g2PH5cxp9vKRdgCkXywZ99tToFGk9PoQ8JhNr aARKv6k78cruOZ0+uGoUJEDvmMC55A2GItokR+tlM+nzeN/GOEOS13oxMkLFlQcnYs70 9xKw== X-Forwarded-Encrypted: i=1; AJvYcCURi9Oz69yw2GQthvfRuJsbCkTUm0x+oIG7sQ/G8zbt4RinYwB5zS3Lab9AvZ3KTpju/szzfiTRS0zAc7gkz+kY1A==@vger.kernel.org X-Gm-Message-State: AOJu0YwIrIaKUX4crsZbm0EzZqmAMAMZQ35K915tEBEfKxOX0eZs5pS9 87CgSsjbTMN5i2r4Fan64CjSj5sw35Iu3GlN8PbnKJcJSDlhJ5zHG3QdROh5VB4= X-Gm-Gg: ASbGncvIJOKMcqThoGDlOB3r3EZc4Y7oWZ1bvmZFYVSSZDibYiFCzP5s5Xm+we6jYaI UzUsXSomwbVGsxkGAnDBlAS7sSjD7EJkmow/lUwSb3Np2LTMEfzEjgRuB/N6FjiS9p8r/cl5LSH 0D/lg7nQp1zvFQYJ6Xs3rIIk6uduC/YmXwOUbSUZ9s+pUgygHVpNGVQWgOmMIKuicu5D1wB6NCg eAXDk8p6KX0+l9mqpf8l0VzWZEVVdHqGduhsLemKU/TZDeRr0+qcsfavgLoZmyk 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: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13890695 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 EC7122040A4 for ; Mon, 2 Dec 2024 13:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733147375; cv=none; b=AU+H9e4avckS0ALIc64TZdJBjsNwlMs3ne/DQhiznf7GKrTxGMCcA+PvCIHXQfan1n8uAJOgyeX7ID4PONLHJK4cDN86CMTXjWA+5AbUleIx6I05etX24eL/hkHsCibHwX/9y9xoVK+m11YF7GXxjt2D7hWwqBYrDtIXpyezCS0= 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.181 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-f181.google.com with SMTP id 38308e7fff4ca-2ffc80318c9so44187171fa.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=l4bWMoWzk+owJ+YGHggm5xC29p4OB9gei2eveqpL6xiidUICVWolZoKnRXbvFH0Ojd /hLPaw5YvVtAy+P+BvMPOmXU23cE0uI/JLeHpFHfxJlJqkJ1nE+G2FUtemNQ3Um3nCX+ MzLyovEsmNdzq5eOD4qjrza9zHYlI99pUC0jdZC4hdL0I9VBfTFrlxhzdGhvvH/i+OWI PzNtdj4WaZ5XqFA5STpKGkInYJy9OxpiZwQSPv0IFd5yIMsyBZRyikc5Y+XwdfiKEBKS A/pZHA2cxvEkdvOrtEWEF/gUl5o44cjJ+OuUbqLqKxf6tsJ083FACdT3lt8T0FaRupbb TMSQ== X-Forwarded-Encrypted: i=1; AJvYcCVIcHqsxgULVfbPbPeF9aojtsMnNwkB8e316w4/7yp3nDPygywEojpuS1bGg+cRpFuZalxwd0RKLQ4u5crfDFkWWw==@vger.kernel.org X-Gm-Message-State: AOJu0YxbALijtOKRnDMcVprFERBUTO/HmCSSrki4yT9YwTSqgXsarL8W XSJz3NNwukgtOEe7WegpGnAgU/BioGn/yuqRNGagsgeshWXSSXdTiaKvF2sWa70= X-Gm-Gg: ASbGnctX7vs6BMn0LjVWf5EZiCsbv66uhKio+Nq4TVzAcUK0OwPiWfPAcX2wdcVXrDL uXXC66M5yBn/LQPcCRSjE/VC+exxqLYba3m7CKWn7/GKP7ZrHLOUjQEarS7sx+NcHDP+UTlAPew eo6neRhUFcffKNYj28c7/5JDuuujD/S9abcUVmYsoQUzped0z3u6nKizpQuOXapvagyQDh2kDxW 6NqdedGApC/iw68sJnjFsLqyaWHWahMq6vel4aHvEqFaNuifP1LolifixMPQA2C 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: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13890696 X-Patchwork-Delegate: geert@linux-m68k.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 A0B5E204F72 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-2ffc3f2b3a9so54562211fa.1 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=R64oIfqh3ZgI0CgQ1CAg6+A8Pecf90DRydWs0bGoOuM2JRJhVY6URx6uxHhvD8zV21 qOiDzBdW2Be8Nbxj8vlxwu9j5+IWHa9piHbz6V3qanXDfc3jR2jrDV/cZcdn8c6tqQ1N BKH/FCBjhSqLEfmnR7lY3l9MXcypCL6NnZxZyg7h/J0gsnFNVsScFhNm/K40vL61gNj6 DCuUfb3u5h/2a8wUb4jiSnTLFMtu+3a4CPbAtctxcnXVLAvccNA+caZI4h2JMLY9CCFE jIp0yHcOX0zu65SYgJGP4L6FyA30t8BknAmyn7sh7exQQ7bvbOfP17Rj5RGqnzMdscO6 Fg3g== X-Forwarded-Encrypted: i=1; AJvYcCUUmn6+vbPWMRwVp8FGGeu7lVD9wB47e9Ld/WB3o97SHuuXVCoyxg5hDQMdC6g/oeYtCwjp2b6SZGiCGyMVp5uTwQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yw/5/As7SNC2nAR+fufMtUs5+4gk+fMyeYgu9FC5EUyUVEsvWV7 KPw5VuLHp8AEy09dmojMehPIV70PhMheiige3TEBDTCuoy6oYwxBsPGu7/HcrZaiuNEZHSRbHHP Xtww= X-Gm-Gg: ASbGncu4Krz17SNJRKCRSm1IhMg+X/vPg6edIEck7Z5OZJoL4OdKFznkVnvDbcAcbr1 FUeuNSz0UmOgXJzoW1i1yBRP0/uLgePM5LhuNg3hugE1eV5SG8jF3HRXUK7Zfn1Da7YLe4VOcJJ fhaiJhpnx3aYpjl2LCoOaa5ge4DA8PqUVDuIiRrpPA2csPdznUrg16n1kSR0BXrKW0Zn5od0A63 oUyUqm6UekLykA4pm+sWNjCBliiPz7EMLVbTk6BD/2Ft16Lm/XQkQm67ba9HAFt 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: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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