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>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a6a774c-156e-3e13-eda8-ed6c81722888@cogentembedded.com>
Date:   Tue, 12 Jun 2018 13:11:13 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Zhouyang Jia <jiazhouyang09@...il.com>
Cc:     Karsten Keil <isdn@...ux-pingi.de>,
        Kees Cook <keescook@...omium.org>,
        Annie Cherkaev <annie.cherk@...il.com>,
        Al Viro <viro@...iv.linux.org.uk>,
        Jiten Thakkar <jitenmt@...il.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] isdn/i4l: add error handling for try_module_get

On 6/12/2018 7:43 AM, Zhouyang Jia wrote:

> When try_module_get fails, the lack of error-handling code may
> cause unexpected results.
> 
> This patch adds error-handling code after calling try_module_get.
> 
> Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
> ---
>   drivers/isdn/i4l/isdn_common.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
> index 7c6f3f5..7e52851 100644
> --- a/drivers/isdn/i4l/isdn_common.c
> +++ b/drivers/isdn/i4l/isdn_common.c
> @@ -71,7 +71,8 @@ static int isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding);
>   static inline void
>   isdn_lock_driver(isdn_driver_t *drv)
>   {
> -	try_module_get(drv->interface->owner);
> +	if (!try_module_get(drv->interface->owner))
> +		printk(KERN_WARNING "isdn_lock_driver: cannot get module\n");

    Do you call this error handling code? :-)
    And BTW we have pr_warn() for that.

>   	drv->locks++;
>   }
>   

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ