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: <CANq1E4T3v9DPnj8z7B3Qj0NT98M648r+KDWT7Os4SpbCjNxQ8A@mail.gmail.com>
Date:	Fri, 20 Jun 2014 16:14:55 +0200
From:	David Herrmann <dh.herrmann@...il.com>
To:	Yongtaek Lee <ytk.lee@...sung.com>
Cc:	Henrik Rydberg <rydberg@...omail.se>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	daniels@...labora.com,
	"open list:HID CORE LAYER" <linux-input@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Input: evdev - Fix incorrect kfree of err_free_client
 after vzalloc

Hi

On Thu, Jun 12, 2014 at 3:45 AM, Yongtaek Lee <ytk.lee@...sung.com> wrote:
> This bug was introduced by commit 92eb77d ("Input: evdev - fall back
> to vmalloc for client event buffer").
>
> vzalloc is used to alloc memory as fallback in case of failure
> of kzalloc. But err_free_client was not considered on below case.
> 1. kzalloc fail
> 2. vzalloc success
> 3. evdev_open_device fail
> 4. kfree
>
> So that address checking is needed to call correct free function.
>
> Signed-off-by: Yongtaek Lee <ytk.lee@...sung.com>
> Reviewed-by: Daniel Stone <daniels@...labora.com>

Reviewed-by: David Herrmann <dh.herrmann@...il.com>

Thanks
David

> ---
>  drivers/input/evdev.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index ce953d8..f60daa0 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -422,7 +422,10 @@ static int evdev_open(struct inode *inode, struct file *file)
>
>   err_free_client:
>         evdev_detach_client(evdev, client);
> -       kfree(client);
> +       if (is_vmalloc_addr(client))
> +               vfree(client);
> +       else
> +               kfree(client);
>         return error;
>  }
>
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists