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
Kirill Smelkov
linux
Commits
c314fb5d
Commit
c314fb5d
authored
Jul 27, 2002
by
Ralf Bächle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect ax25_route_list by a spinlock.
parent
14971321
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
net/ax25/TODO
net/ax25/TODO
+2
-1
net/ax25/ax25_route.c
net/ax25/ax25_route.c
+16
-8
No files found.
net/ax25/TODO
View file @
c314fb5d
...
...
@@ -9,4 +9,5 @@ af_ax25.c:ax25_connect:
return sock_error(sk); /* Always set at this point */
}
Do the spinlocks ax25_list_lock and ax25_uid_lock really have to be interrupt safe?
Do the spinlocks ax25_list_lock, ax25_uid_lock and ax25_route_lock really
have to be interrupt safe?
net/ax25/ax25_route.c
View file @
c314fb5d
...
...
@@ -56,6 +56,7 @@
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <net/sock.h>
#include <asm/uaccess.h>
#include <asm/system.h>
...
...
@@ -65,6 +66,7 @@
#include <linux/init.h>
static
ax25_route
*
ax25_route_list
;
static
spinlock_t
ax25_route_lock
=
SPIN_LOCK_UNLOCKED
;
static
ax25_route
*
ax25_find_route
(
ax25_address
*
,
struct
net_device
*
);
...
...
@@ -86,8 +88,11 @@ static inline void ax25_route_invert(ax25_digi *in, ax25_digi *out)
void
ax25_rt_device_down
(
struct
net_device
*
dev
)
{
ax25_route
*
s
,
*
t
,
*
ax25_rt
=
ax25_route_list
;
ax25_route
*
s
,
*
t
,
*
ax25_rt
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
ax25_route_lock
,
flags
);
ax25_rt
=
ax25_route_list
;
while
(
ax25_rt
!=
NULL
)
{
s
=
ax25_rt
;
ax25_rt
=
ax25_rt
->
next
;
...
...
@@ -111,6 +116,7 @@ void ax25_rt_device_down(struct net_device *dev)
}
}
}
spin_unlock_irqrestore
(
&
ax25_route_lock
,
flags
);
}
int
ax25_rt_ioctl
(
unsigned
int
cmd
,
void
*
arg
)
...
...
@@ -167,10 +173,11 @@ int ax25_rt_ioctl(unsigned int cmd, void *arg)
ax25_rt
->
digipeat
->
calls
[
i
]
=
route
.
digi_addr
[
i
];
}
}
s
ave_flags
(
flags
);
cli
(
);
s
pin_lock_irqsave
(
&
ax25_route_lock
,
flags
);
ax25_rt
->
next
=
ax25_route_list
;
ax25_route_list
=
ax25_rt
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
ax25_route_lock
,
flags
);
break
;
case
SIOCDELRT
:
...
...
@@ -239,13 +246,14 @@ int ax25_rt_ioctl(unsigned int cmd, void *arg)
int
ax25_rt_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
{
ax25_route
*
ax25_rt
;
unsigned
long
flags
;
int
len
=
0
;
off_t
pos
=
0
;
off_t
begin
=
0
;
char
*
callsign
;
int
i
;
cli
(
);
spin_lock_irqsave
(
&
ax25_route_lock
,
flags
);
len
+=
sprintf
(
buffer
,
"callsign dev mode digipeaters
\n
"
);
...
...
@@ -286,13 +294,13 @@ int ax25_rt_get_info(char *buffer, char **start, off_t offset, int length)
if
(
pos
>
offset
+
length
)
break
;
}
sti
();
spin_unlock_irqrestore
(
&
ax25_route_lock
,
flags
);
*
start
=
buffer
+
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
if
(
len
>
length
)
len
=
length
;
if
(
len
>
length
)
len
=
length
;
return
len
;
}
...
...
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