diff options
author | Andy Walker <andy@puszczka.com> | 2006-09-18 10:11:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-09-18 10:11:36 -0400 |
commit | b9c54f91a48146778fe91423d4d467a0ee8c719b (patch) | |
tree | f123be6ee2fb44b5795a3aa6f0ccbc8e9ea19d2b /arch/sparc | |
parent | b9b64e6e89fc5a6ef220747115c5b7764614ca3f (diff) |
[SPARC]: Fix regression in sys_getdomainname()
This patch corrects the buffer length checking in the
sys_getdomainname() implementation for sparc/sparc64.
Signed-off-by: Andy Walker <andy@puszczka.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/sys_sparc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c index 94ff58c9d4a9..896863fb208a 100644 --- a/arch/sparc/kernel/sys_sparc.c +++ b/arch/sparc/kernel/sys_sparc.c | |||
@@ -470,19 +470,21 @@ asmlinkage int sys_getdomainname(char __user *name, int len) | |||
470 | { | 470 | { |
471 | int nlen, err; | 471 | int nlen, err; |
472 | 472 | ||
473 | if (len < 0 || len > __NEW_UTS_LEN) | 473 | if (len < 0) |
474 | return -EINVAL; | 474 | return -EINVAL; |
475 | 475 | ||
476 | down_read(&uts_sem); | 476 | down_read(&uts_sem); |
477 | 477 | ||
478 | nlen = strlen(system_utsname.domainname) + 1; | 478 | nlen = strlen(system_utsname.domainname) + 1; |
479 | if (nlen < len) | 479 | err = -EINVAL; |
480 | len = nlen; | 480 | if (nlen > len) |
481 | goto out; | ||
481 | 482 | ||
482 | err = -EFAULT; | 483 | err = -EFAULT; |
483 | if (!copy_to_user(name, system_utsname.domainname, len)) | 484 | if (!copy_to_user(name, system_utsname.domainname, nlen)) |
484 | err = 0; | 485 | err = 0; |
485 | 486 | ||
487 | out: | ||
486 | up_read(&uts_sem); | 488 | up_read(&uts_sem); |
487 | return err; | 489 | return err; |
488 | } | 490 | } |