From: Weidong Wang <wangweidong1@huawei.com>
To: Felix Fietkau <nbd@openwrt.org>
Cc: Paolo Abeni <pabeni@redhat.com>,
David Miller <davem@davemloft.net>, <zajec5@gmail.com>,
<hauke@hauke-m.de>, Joe Perches <joe@perches.com>,
<peter.senna@gmail.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: bgmac: fix a missing check for build_skb
Date: Wed, 13 Jan 2016 19:31:59 +0800 [thread overview]
Message-ID: <569635AF.4070204@huawei.com> (raw)
In-Reply-To: <56962DAF.9040807@openwrt.org>
On 2016/1/13 18:57, Felix Fietkau wrote:
> On 2016-01-13 11:25, Weidong Wang wrote:
>> On 2016/1/13 16:34, Paolo Abeni wrote:
>>> On Wed, 2016-01-13 at 11:06 +0800, Weidong Wang wrote:
>>>> when build_skb failed, it may occure a NULL pointer.
>>>> So add a 'NULL check' for it.
>>>>
>>>> Signed-off-by: Weidong Wang <wangweidong1@huawei.com>
>>>> ---
>>>> drivers/net/ethernet/broadcom/bgmac.c | 5 +++++
>>>> 1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
>>>> index 21e3c38..d75180a 100644
>>>> --- a/drivers/net/ethernet/broadcom/bgmac.c
>>>> +++ b/drivers/net/ethernet/broadcom/bgmac.c
>>>> @@ -466,6 +466,11 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
>>>> len -= ETH_FCS_LEN;
>>>>
>>>> skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE);
>>>> + if (unlikely(skb)) {
>>>
>>> Should that be instead:
>>>
>>> if (unlikely(!skb)) {
>>>
>>> ?
>>>
>>
>> What to instead of it?
> Your patch has a logic error (missing the !), and it's breaking the
> ethernet driver completely instead of fixing anything.
> Did you even test this?
>
Yep, you are right.
Sorry for that.
I just review the source code without any test.
I should resent it again.
> Dave, why did you apply this patch so fast without any chance of review?
>
> - Felix
>
> .
>
Regards,
Weidong
next prev parent reply other threads:[~2016-01-13 11:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 3:06 bgmac: fix a missing check for build_skb Weidong Wang
2016-01-13 5:24 ` David Miller
2016-01-13 8:34 ` Paolo Abeni
2016-01-13 10:25 ` Weidong Wang
2016-01-13 10:57 ` Felix Fietkau
2016-01-13 11:31 ` Weidong Wang [this message]
2016-01-13 15:34 ` David Miller
2016-01-13 11:53 ` [PATCH net-next v2] " Weidong Wang
2016-01-13 14:52 ` Eric Dumazet
2016-01-14 2:10 ` Weidong Wang
2016-01-13 12:10 ` Sergei Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=569635AF.4070204@huawei.com \
--to=wangweidong1@huawei.com \
--cc=davem@davemloft.net \
--cc=hauke@hauke-m.de \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@openwrt.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peter.senna@gmail.com \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).