lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 14 Jun 2018 10:58:41 +0100
From:   Ian Abbott <abbotti@....co.uk>
To:     Zhouyang Jia <jiazhouyang09@...il.com>,
        Dan Carpenter <dan.carpenter@...cle.com>
Cc:     devel@...verdev.osuosl.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: comedi: add error handling for vmap

On 14/06/18 08:57, Zhouyang Jia wrote:
> Hi,
> 
> I reported this bug since more than 90% callsites of vmap are
> well handled in kernel. The caller function __comedi_buf_alloc
> has no return value, so I don't know how the error is handled in
> its caller.
> 
> I believe there would be a better error handling method, but I
> have limited domain knowledge, so I'm sorry I can't help here.
> 
> Thanks for your kind reply.
> 
> Best,
> Zhouyang

__comedi_buf_alloc is just a helper function factored out of, and called 
by comedi_buf_alloc.  __comedi_buf_alloc does not clean up after itself 
on error because it expects comedi_buf_alloc to detect the error and 
call __comedi_buf_free to clean up any partially allocated mess:

     __comedi_buf_alloc(dev, s, n_pages);
     if (!async->prealloc_buf) {
         /*
          * [This is not the actual comment in the code!]
          *
          * Error occured in __comedi_buf_alloc().
          * Buffer may be partially allocated.
          * Call __comedi_buf_free() to clean it up.
          */
         __comedi_buf_free(dev, s);
         return -ENOMEM;
     }

> 
> 
> 
> 2018-06-12 19:50 GMT+08:00 Dan Carpenter <dan.carpenter@...cle.com 
> <mailto:dan.carpenter@...cle.com>>:
> 
>     On Tue, Jun 12, 2018 at 11:25:35AM +0800, Zhouyang Jia wrote:
>     > When vmap fails, the lack of error-handling code may
>     > cause unexpected results.
>     > 
>     > This patch adds error-handling code after calling vmap.
>     > 
> 
>     Again, this is not error handling, this is just an error message.  This
>     error condition is handled in the caller.
> 
>     regards,
>     dan carpenter
> 
> 
> 


-- 
-=( Ian Abbott <abbotti@....co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ