Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
57989ed4
Commit
57989ed4
authored
Jul 17, 2003
by
Alan Cox
Committed by
Linus Torvalds
Jul 17, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] fix failed sethostname corrupting the data
(Stephan Maciej)
parent
da602a16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
kernel/sys.c
kernel/sys.c
+7
-3
No files found.
kernel/sys.c
View file @
57989ed4
...
...
@@ -1159,6 +1159,7 @@ asmlinkage long sys_newuname(struct new_utsname __user * name)
asmlinkage
long
sys_sethostname
(
char
__user
*
name
,
int
len
)
{
int
errno
;
char
tmp
[
__NEW_UTS_LEN
];
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
...
...
@@ -1166,7 +1167,8 @@ asmlinkage long sys_sethostname(char __user *name, int len)
return
-
EINVAL
;
down_write
(
&
uts_sem
);
errno
=
-
EFAULT
;
if
(
!
copy_from_user
(
system_utsname
.
nodename
,
name
,
len
))
{
if
(
!
copy_from_user
(
tmp
,
name
,
len
))
{
memcpy
(
system_utsname
.
nodename
,
tmp
,
len
);
system_utsname
.
nodename
[
len
]
=
0
;
errno
=
0
;
}
...
...
@@ -1198,6 +1200,7 @@ asmlinkage long sys_gethostname(char __user *name, int len)
asmlinkage
long
sys_setdomainname
(
char
__user
*
name
,
int
len
)
{
int
errno
;
char
tmp
[
__NEW_UTS_LEN
];
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
...
...
@@ -1206,9 +1209,10 @@ asmlinkage long sys_setdomainname(char __user *name, int len)
down_write
(
&
uts_sem
);
errno
=
-
EFAULT
;
if
(
!
copy_from_user
(
system_utsname
.
domainname
,
name
,
len
))
{
errno
=
0
;
if
(
!
copy_from_user
(
tmp
,
name
,
len
))
{
memcpy
(
system_utsname
.
domainname
,
tmp
,
len
)
;
system_utsname
.
domainname
[
len
]
=
0
;
errno
=
0
;
}
up_write
(
&
uts_sem
);
return
errno
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment