> -----Original Message----- > From: David Miller <da...@davemloft.net> > Sent: Monday, March 11, 2019 2:37 PM > To: Bryan Whitehead - C21958 <bryan.whiteh...@microchip.com> > Cc: netdev@vger.kernel.org; UNGLinuxDriver > <unglinuxdri...@microchip.com> > Subject: Re: [PATCH v2 net] lan743x: Fix RX Kernel Panic > > From: Bryan Whitehead <bryan.whiteh...@microchip.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