[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47e01747a5c648c8809c77055e981e80@huawei.com>
Date: Tue, 3 Aug 2021 02:17:20 +0000
From: "zhudi (J)" <zhudi21@...wei.com>
To: Nicholas Richardson <richardsonnick@...gle.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>
CC: "nrrichar@...u.edu" <nrrichar@...u.edu>,
"arunkaly@...gle.com" <arunkaly@...gle.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
"yebin (H)" <yebin10@...wei.com>,
Yejune Deng <yejune.deng@...il.com>,
Leesoo Ahn <dev@...eel.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: 答复: [PATCH v3] pktgen: Fix invalid clone_skb override
> From: Nick Richardson <richardsonnick@...gle.com>
>
> When the netif_receive xmit_mode is set, a line is supposed to set
> clone_skb to a default 0 value. This line is made redundant due to a
> preceding line that checks if clone_skb is more than zero and returns
> -ENOTSUPP.
>
> Only the positive case for clone_skb needs to be checked. It
> is impossible for a user to set clone_skb to a negative number.
> When a user passes a negative value for clone_skb, the num_arg()
> function stops parsing at the first nonnumeric value.
>
> For example: "clone_skb -200" would stop parsing at the
> first char ('-') and return zero for the new clone_skb value.
>
> The value read by num_arg() cannot be overflow-ed into the negative
> range, since it is an unsigned long.
>
module_param(pg_clone_skb_d, int, 0);
This kernel parameter can also set the value of pkt_dev->clone_skb
In pktgen_add_device() and the value can be negative.
> Remove redundant line that sets clone_skb to zero. If clone_skb is
> equal to zero then set xmit_mode to netif_receive as usual and return
> no error.
>
> Signed-off-by: Nick Richardson <richardsonnick@...gle.com>
> ---
> net/core/pktgen.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 7e258d255e90..314f97acf39d 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -1190,11 +1190,6 @@ static ssize_t pktgen_if_write(struct file *file,
> * pktgen_xmit() is called
> */
> pkt_dev->last_ok = 1;
> -
> - /* override clone_skb if user passed default value
> - * at module loading time
> - */
> - pkt_dev->clone_skb = 0;
> } else if (strcmp(f, "queue_xmit") == 0) {
> pkt_dev->xmit_mode = M_QUEUE_XMIT;
> pkt_dev->last_ok = 1;
> --
> 2.32.0.554.ge1b32706d8-goog
Powered by blists - more mailing lists