public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Nick Krause <xerofoify@gmail.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	lisa@xenapiadmin.com, Ben Hutchings <ben@decadent.org.uk>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: Check against NULL in fw_download_code
Date: Mon, 11 Aug 2014 11:45:08 -0700	[thread overview]
Message-ID: <53E90F34.9030809@infradead.org> (raw)
In-Reply-To: <CAPDOMViHWMRRMqdEpjft0TDuVSLai8LuWRcXPdMeCtUYgB2sgw@mail.gmail.com>

On 08/11/14 11:26, Nick Krause wrote:
> On Mon, Aug 11, 2014 at 2:07 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
>> On 08/11/14 11:04, Nick Krause wrote:
>>> On Mon, Aug 11, 2014 at 2:02 PM, Nicholas Krause <xerofoify@gmail.com> wrote:
>>>> I am fixing the bug entry , https://bugzilla.kernel.org/show_bug.cgi?id=60461.
>>>> This entry states that we are not checking the skb allocated in fw_download_code
>>>> and after checking I fixed it to check for the NULL value before using the allocate
>>>> skb.
>>>>
>>>> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
>>>> ---
>>>>  drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 14 ++++++++------
>>>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
>>>> index 1a95d1f..0a4c926 100644
>>>> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
>>>> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
>>>> @@ -60,13 +60,15 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
>>>>
>>>>                 }
>>>>
>>>> -               skb  = dev_alloc_skb(frag_length + 4);
>>>> -               memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
>>>> -               tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
>>>> -               tcb_desc->queue_index = TXCMD_QUEUE;
>>>> -               tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT;
>>>> -               tcb_desc->bLastIniPkt = bLastIniPkt;
>>>>
>>>> +               skb  = dev_alloc_skb(frag_length + 4);
>>>> +               if (skb) {
>>>> +                       memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
>>>> +                       tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
>>>> +                       tcb_desc->queue_index = TXCMD_QUEUE;
>>>> +                       tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT;
>>>> +                       tcb_desc->bLastIniPkt = bLastIniPkt;
>>>> +               }
>>
>> and what happens here (below) if skb is NULL?

Nick,
I'm asking if you have completely fixed the bug or only partially fixed it.
The answer is that the patch is only a partial fix.  If skb is NULL, there
is still a problem in the statement below here.  The kernel will oops on
that reference to skb, which is NULL.

>>
>>>>                 seg_ptr = skb->data;
>>>>                 for (i = 0; i < frag_length; i += 4) {
>>>>                         *seg_ptr++ = ((i+0) < frag_length) ?
>>>> --
>>>> 1.9.1
>>>>
>>> And I did check it against Linus's tree to make sure it applies , just
>>> to let you known.
>>> Nick
>>
>>
>> --
>> ~Randy
> Sorry Randy.
>  I may be mis reading this, but are you asking me to write a different
> commit message or is this patch just another bad patch in my series of
> bad patches?


-- 
~Randy

  parent reply	other threads:[~2014-08-11 18:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1407780151-4674-1-git-send-email-xerofoify@gmail.com>
     [not found] ` <CAPDOMVghgyQ72J6MS6uaWEeMFBvzDNmfoAS5Tbd7+XO_KgUmHg@mail.gmail.com>
2014-08-11 18:07   ` [PATCH] staging: Check against NULL in fw_download_code Randy Dunlap
     [not found]     ` <CAPDOMViHWMRRMqdEpjft0TDuVSLai8LuWRcXPdMeCtUYgB2sgw@mail.gmail.com>
2014-08-11 18:45       ` Randy Dunlap [this message]
     [not found]         ` <CAPDOMVj0YcDc5ATxMiTLeciadJPiQxV2ap8Wo3Qg4RM=yeXmVQ@mail.gmail.com>
2014-08-11 19:04           ` Randy Dunlap
     [not found]             ` <CAPDOMVgChPhOfBdMAjQTJKmw5+LFO_7GoYU8A5ttDHMYHYY0fA@mail.gmail.com>
2014-08-11 19:40               ` Randy Dunlap

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=53E90F34.9030809@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=ben@decadent.org.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lisa@xenapiadmin.com \
    --cc=valentina.manea.m@gmail.com \
    --cc=xerofoify@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