[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170118.114505.1855687422610394730.davem@davemloft.net>
Date: Wed, 18 Jan 2017 11:45:05 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: darcari@...hat.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] net: ethtool: avoid allocation failure for dump_regs
From: David Arcari <darcari@...hat.com>
Date: Wed, 18 Jan 2017 08:34:05 -0500
> If the user executes 'ethtool -d' for an interface and the associated
> get_regs_len() function returns 0, the user will see a call trace from
> the vmalloc() call in ethtool_get_regs(). This patch modifies
> ethtool_get_regs() to avoid the call to vmalloc when the size is zero.
>
> Signed-off-by: David Arcari <darcari@...hat.com>
I think when the driver indicates this, it is equivalent to saying that
the operation isn't supported.
Also, this guards us against ->get_regs() methods that don't handle
zero length requests properly. I see many which are going to do
really terrible things in that situation.
Therefore, if get_regs_len() returns zero, treat it the safe as if the
ethtool operations were NULL.
Thanks.
Powered by blists - more mailing lists