Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1703142 > unrolled thread

drivers/s390/char/keyboard.c NULL pointer reference

Started bysohu0106 <sohu0106@126.com>
First post2017-08-03 16:00 +0200
Last post2017-08-05 10:00 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  drivers/s390/char/keyboard.c NULL pointer reference sohu0106 <sohu0106@126.com> - 2017-08-03 16:00 +0200
    Re: drivers/s390/char/keyboard.c NULL pointer reference Heiko Carstens <heiko.carstens@de.ibm.com> - 2017-08-04 11:30 +0200
      Re:Re: drivers/s390/char/keyboard.c NULL pointer reference sohu0106 <sohu0106@126.com> - 2017-08-05 03:50 +0200
        Re: Re: drivers/s390/char/keyboard.c NULL pointer reference Heiko Carstens <heiko.carstens@de.ibm.com> - 2017-08-05 10:00 +0200

#1703142 — drivers/s390/char/keyboard.c NULL pointer reference

Fromsohu0106 <sohu0106@126.com>
Date2017-08-03 16:00 +0200
Subjectdrivers/s390/char/keyboard.c NULL pointer reference
Message-ID<uaoPn-Jx-7@gated-at.bofh.it>

Local users able to send the NULL arg argument to kbd_ioctl(), which could cause kernel crash




diff --git a/keyboard.c 
b/keyboard.c
index ba0e4f9..3ec16b1 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -456,6 +456,8 @@ int kbd_ioctl(struct kbd_data *kbd, unsigned int cmd, unsigned long arg)
        int perm;
 
        argp = (void __user *)arg;
+       if( !argp )
+               return -EFAULT;
 
        /*
         * To have permissions to do most of the vt ioctls, we either have


https://bugzilla.kernel.org/show_bug.cgi?id=196575

[toc] | [next] | [standalone]


#1703821

FromHeiko Carstens <heiko.carstens@de.ibm.com>
Date2017-08-04 11:30 +0200
Message-ID<uaH5E-5ax-21@gated-at.bofh.it>
In reply to#1703142
On Thu, Aug 03, 2017 at 09:57:38PM +0800, sohu0106 wrote:
> 
> 
> Local users able to send the NULL arg argument to kbd_ioctl(), which could cause kernel crash
> 
> 
> 
> 
> diff --git a/keyboard.c 
> b/keyboard.c
> index ba0e4f9..3ec16b1 100644
> --- a/keyboard.c
> +++ b/keyboard.c
> @@ -456,6 +456,8 @@ int kbd_ioctl(struct kbd_data *kbd, unsigned int cmd, unsigned long arg)
>         int perm;
>  
>         argp = (void __user *)arg;
> +       if( !argp )
> +               return -EFAULT;

This doesn't make sense as well. All uaccess functions are able to handle
NULL pointers within user space.

[toc] | [prev] | [next] | [standalone]


#1704544

Fromsohu0106 <sohu0106@126.com>
Date2017-08-05 03:50 +0200
Message-ID<uaWo1-6wz-5@gated-at.bofh.it>
In reply to#1703821

I don't understand a bit,My idea is 

in userland

fd=open("tty3270",O_RDONLY)
...
ret=ioctl(fd,KDGKBDIACR,NULL)
...

then here 
drivers/s390/char/keyboard.c
477 
case KDGKBDIACR:
	{
		struct kbdiacrs __user *a = argp;
		struct kbdiacr diacr;
		int i;
		
		//a is NULL,a->kb_cnt will crash
		if (put_user(kbd->accent_table_size, &a->kb_cnt))




At 2017-08-04 17:26:08, "Heiko Carstens" <heiko.carstens@de.ibm.com> wrote:
>On Thu, Aug 03, 2017 at 09:57:38PM +0800, sohu0106 wrote:
>> 
>> 
>> Local users able to send the NULL arg argument to kbd_ioctl(), which could cause kernel crash
>> 
>> 
>> 
>> 
>> diff --git a/keyboard.c 
>> b/keyboard.c
>> index ba0e4f9..3ec16b1 100644
>> --- a/keyboard.c
>> +++ b/keyboard.c
>> @@ -456,6 +456,8 @@ int kbd_ioctl(struct kbd_data *kbd, unsigned int cmd, unsigned long arg)
>>         int perm;
>>  
>>         argp = (void __user *)arg;
>> +       if( !argp )
>> +               return -EFAULT;
>
>This doesn't make sense as well. All uaccess functions are able to handle
>NULL pointers within user space.
>

[toc] | [prev] | [next] | [standalone]


#1704600

FromHeiko Carstens <heiko.carstens@de.ibm.com>
Date2017-08-05 10:00 +0200
Message-ID<ub2a5-1U0-3@gated-at.bofh.it>
In reply to#1704544
On Sat, Aug 05, 2017 at 09:44:45AM +0800, sohu0106 wrote:
> 
> 
> I don't understand a bit,My idea is 
> 
> in userland
> 
> fd=open("tty3270",O_RDONLY)
> ...
> ret=ioctl(fd,KDGKBDIACR,NULL)
> ...
> 
> then here 
> drivers/s390/char/keyboard.c
> 477 
> case KDGKBDIACR:
> 	{
> 		struct kbdiacrs __user *a = argp;
> 		struct kbdiacr diacr;
> 		int i;
> 		
> 		//a is NULL,a->kb_cnt will crash
> 		if (put_user(kbd->accent_table_size, &a->kb_cnt))

a->kb_cnt and &a->kb_cnt is not the same...

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web