[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN6PR11MB1714D12902D60AA9502DF6A2FA480@BN6PR11MB1714.namprd11.prod.outlook.com>
Date: Mon, 11 Mar 2019 18:50:27 +0000
From: <Bryan.Whitehead@...rochip.com>
To: <davem@...emloft.net>
CC: <netdev@...r.kernel.org>, <UNGLinuxDriver@...rochip.com>
Subject: RE: [PATCH v2 net] lan743x: Fix RX Kernel Panic
> -----Original Message-----
> From: David Miller <davem@...emloft.net>
> Sent: Monday, March 11, 2019 2:37 PM
> To: Bryan Whitehead - C21958 <Bryan.Whitehead@...rochip.com>
> Cc: netdev@...r.kernel.org; UNGLinuxDriver
> <UNGLinuxDriver@...rochip.com>
> Subject: Re: [PATCH v2 net] lan743x: Fix RX Kernel Panic
>
> From: Bryan Whitehead <Bryan.Whitehead@...rochip.com>
> Date: Mon, 11 Mar 2019 13:39:39 -0400
>
> > @@ -2290,7 +2306,9 @@ static int lan743x_rx_ring_init(struct lan743x_rx
> *rx)
> >
> > rx->last_head = 0;
> > for (index = 0; index < rx->ring_size; index++) {
> > - ret = lan743x_rx_allocate_ring_element(rx, index);
> > + struct sk_buff *new_skb = lan743x_rx_allocate_skb(rx);
> > +
> > + ret = lan743x_rx_init_ring_element(rx, index, new_skb);
>
> Need to check new_skb for NULL.
>
> Again....
David,
In this case the function lan743x_rx_init_ring_element does not assume that
new_skb is not NULL. It does check for NULL and returns error in that case.
It does this because allocation use to be inside lan743x_rx_init_ring_element,
when its name was lan743x_rx_allocate_ring_element.
I pulled the allocation part out to solve the other problem, but functionally it
Is exactly the same and will clean up appropriately if allocation returns NULL.
Regards,
Bryan
Powered by blists - more mailing lists