lkml.org 
[lkml]   [2023]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net v2] team: fix null-ptr-deref when team device type is changed
From
Date
> On Tue, Sep 05, 2023 at 03:46:38PM +0800, Ziyang Xuan wrote:
>> diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>> index d3dc22509ea5..12fb5f4cff06 100644
>> --- a/drivers/net/team/team.c
>> +++ b/drivers/net/team/team.c
>> @@ -2127,7 +2127,10 @@ static const struct ethtool_ops team_ethtool_ops = {
>> static void team_setup_by_port(struct net_device *dev,
>> struct net_device *port_dev)
>> {
>> - dev->header_ops = port_dev->header_ops;
>> + if (port_dev->type == ARPHRD_ETHER)
>> + dev->header_ops = &eth_header_ops;
>> + else
>> + dev->header_ops = port_dev->header_ops;
>> dev->type = port_dev->type;
>> dev->hard_header_len = port_dev->hard_header_len;
>> dev->needed_headroom = port_dev->needed_headroom;
>
> Hmm.. Do we need to export eth_header_ops? I got error like
> ERROR: modpost: "eth_header_ops" [drivers/net/team/team.ko] undefined!
>
> But I saw function loopback_setup() could reference this. Not sure what
> I missed here.

Yes, I also got the same error, and gave v3 patch with exporting eth_header_ops.

drivers/net/loopback.o controlled by CONFIG_NET, CONFIG_NET is bool type and usually Y.
So drivers/net/loopback.o does not need to export eth_header_ops.

>
> Thanks
> Hangbin
>
> .
>

\
 
 \ /
  Last update: 2023-09-05 18:24    [W:0.048 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site