All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dan Carpenter" <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH][revised] : request_region auditing
Date: Mon, 02 Apr 2007 20:35:14 +0000	[thread overview]
Message-ID: <a63d67fe0704021335s3f64cce4p886a8700ac750e2@mail.gmail.com> (raw)
In-Reply-To: <1175450907.3396.6.camel@localhost.localdomain>

On 4/2/07, Brendan Burns <bburns@cs.umass.edu> wrote:
> Hey Dan,
> thanks for the patience and the comments.
>

No problem.  That's the point of this list is to be a friendly place
for newbie kernel hackers.

> In this patch, though, I have a question.
> > > --- linux-2.6.20.4.orig/drivers/net/hamradio/scc.c      2007-03-31
> > > 22:29:44.000000000 -0400
> > > +++ linux-2.6.20.4/drivers/net/hamradio/scc.c   2007-03-31
> > > 22:30:44.000000000 -0400
> > > @@ -1808,8 +1808,10 @@ static int scc_net_ioctl(struct net_devi
> > >
> > >                                 if (found)
> > >                                 {
> > > -                                       request_region(SCC_Info[2*Nchips+chan].ctrl, 1, "scc ctrl");
> > > -                                       request_region(SCC_Info[2*Nchips+chan].data, 1, "scc data");
> > > +                                       if (!request_region(SCC_Info[2*Nchips+chan].ctrl, 1, "scc ctrl"))
> > > +                                               return -EBUSY;
> > > +                                       if (!request_region(SCC_Info[2*Nchips+chan].data, 1, "scc data"))
> > > +                                               return -EBUSY;
> > >                                         if (Nchips+chan != 0 &&
> > >                                             scc_net_alloc(device_name,
> > >                                                           &SCC_Info[2*Nchips+chan]))
> > >                                                 return -EINVAL;
> > If the first request succeeds and the second request fails it needs to clean up.
>
> The last line in the "if (Nchips+chan ...)" after my patch returns
> -EINVAL without cleaning up the request_regions. Is this incorrect also?
> Note that this is the way the original code is written.  I'm happy to
> fix up this bug too, I just wanted to verify that it was in fact a bug.
>

Yes.  That is a bug.

It needs to clean up on the error paths.  To be honest I didn't do a
very thourough job auditing so there may be other places that need
cleaned up as well.

regards,
dan carpenter
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

      parent reply	other threads:[~2007-04-02 20:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-01 18:08 [KJ] [PATCH][revised] : request_region auditing Brendan Burns
2007-04-02 19:57 ` Brendan Burns
2007-04-02 20:35 ` Dan Carpenter [this message]

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=a63d67fe0704021335s3f64cce4p886a8700ac750e2@mail.gmail.com \
    --to=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.