[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190308.144213.516996685809491495.davem@davemloft.net>
Date: Fri, 08 Mar 2019 14:42:13 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: Bryan.Whitehead@...rochip.com
Cc: netdev@...r.kernel.org, UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH v1 net] lan743x: Fix RX Kernel Panic
From: Bryan Whitehead <Bryan.Whitehead@...rochip.com>
Date: Tue, 5 Mar 2019 14:46:04 -0500
> @@ -2060,8 +2068,19 @@ static int lan743x_rx_process_packet(struct lan743x_rx *rx)
> /* packet is available */
> if (first_index == last_index) {
> /* single buffer packet */
> + struct sk_buff *new_skb = NULL;
> int packet_length;
>
> + new_skb = lan743x_rx_allocate_skb(rx);
> + if (!new_skb) {
> + /* failed to allocate next skb.
...
> @@ -2096,8 +2116,9 @@ static int lan743x_rx_process_packet(struct lan743x_rx *rx)
> (index <= last_index)) {
> lan743x_rx_release_ring_element(rx,
> index);
> - lan743x_rx_allocate_ring_element(rx,
> - index);
> + new_skb = lan743x_rx_allocate_skb(rx);
> + lan743x_rx_init_ring_element(rx, index,
> + new_skb);
> index = lan743x_rx_next_index(rx,
> index);
> }
> @@ -2106,14 +2127,16 @@ static int lan743x_rx_process_packet(struct lan743x_rx *rx)
> (index <= last_index)) {
> lan743x_rx_release_ring_element(rx,
> index);
> - lan743x_rx_allocate_ring_element(rx,
> - index);
> + new_skb = lan743x_rx_allocate_skb(rx);
> + lan743x_rx_init_ring_element(rx, index,
> + new_skb);
In the second and third hunk, you have to check lan743x_rx_allocate_skb() for
NULL too and act accordingly.
Powered by blists - more mailing lists