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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfSY0U9fiZ+AS70Rt=daxAmvw4JTDjGHu5E_8TYsJZcAA@mail.gmail.com>
Date:   Tue, 1 Aug 2017 16:29:04 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Anton Vasilyev <vasilyev@...ras.ru>
Cc:     Colin Ian King <colin.king@...onical.com>,
        Jiri Kosina <jkosina@...e.cz>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        ldv-project@...uxtesting.org
Subject: Re: [PATCH v2] misc: Return error on error path

On Tue, Aug 1, 2017 at 4:25 PM, Anton Vasilyev <vasilyev@...ras.ru> wrote:
> If ibmasm_event_buffer_init() or ibmasm_heartbeat_init() fails,
> then ibmasm_init_one() release all resources and return 0 on error path.
>
> The patch adds corresponding error for fails.
>
> Found by Linux Driver Verification project (linuxtesting.org).

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Signed-off-by: Anton Vasilyev <vasilyev@...ras.ru>
> ---
> v2: change ibmasm_event_buffer_init() to return corresponding error and
>  check return values as Andy Shevchenko suggested.
> ---
>  drivers/misc/ibmasm/event.c  | 2 +-
>  drivers/misc/ibmasm/module.c | 6 ++++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/ibmasm/event.c b/drivers/misc/ibmasm/event.c
> index 8e540f4..7e33025 100644
> --- a/drivers/misc/ibmasm/event.c
> +++ b/drivers/misc/ibmasm/event.c
> @@ -155,7 +155,7 @@ int ibmasm_event_buffer_init(struct service_processor *sp)
>
>         buffer = kmalloc(sizeof(struct event_buffer), GFP_KERNEL);
>         if (!buffer)
> -               return 1;
> +               return -ENOMEM;
>
>         buffer->next_index = 0;
>         buffer->next_serial_number = 1;
> diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
> index c5a456b..e914b8c 100644
> --- a/drivers/misc/ibmasm/module.c
> +++ b/drivers/misc/ibmasm/module.c
> @@ -94,12 +94,14 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
>         snprintf(sp->dirname, IBMASM_NAME_SIZE, "%d", sp->number);
>         snprintf(sp->devname, IBMASM_NAME_SIZE, "%s%d", DRIVER_NAME, sp->number);
>
> -       if (ibmasm_event_buffer_init(sp)) {
> +       result = ibmasm_event_buffer_init(sp);
> +       if (result) {
>                 dev_err(sp->dev, "Failed to allocate event buffer\n");
>                 goto error_eventbuffer;
>         }
>
> -       if (ibmasm_heartbeat_init(sp)) {
> +       result = ibmasm_heartbeat_init(sp);
> +       if (result) {
>                 dev_err(sp->dev, "Failed to allocate heartbeat command\n");
>                 goto error_heartbeat;
>         }
> --
> 2.7.4
>



-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ