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
b9ff5bc5
Commit
b9ff5bc5
authored
Jul 27, 2002
by
Ralf Bächle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect listen_list also with a spinlock instead of cli / sti.
parent
3652c0a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
17 deletions
+14
-17
net/ax25/TODO
net/ax25/TODO
+2
-4
net/ax25/ax25_iface.c
net/ax25/ax25_iface.c
+12
-13
No files found.
net/ax25/TODO
View file @
b9ff5bc5
...
...
@@ -10,7 +10,5 @@ af_ax25.c:ax25_connect:
}
Do the ax25_list_lock, ax25_uid_lock, ax25_route_lock, protocol_list_lock,
ax25_dev_lock, linkfail_lockreally and ax25_frag_lock have to be interrupt
safe?
What locking will be needed for listen_list?
ax25_dev_lock, linkfail_lockreally, ax25_frag_lock and listen_lock have to
be interrupt safe?
net/ax25/ax25_iface.c
View file @
b9ff5bc5
...
...
@@ -54,6 +54,7 @@ static struct listen_struct {
ax25_address
callsign
;
struct
net_device
*
dev
;
}
*
listen_list
;
static
spinlock_t
listen_lock
=
SPIN_LOCK_UNLOCKED
;
int
ax25_protocol_register
(
unsigned
int
pid
,
int
(
*
func
)(
struct
sk_buff
*
,
ax25_cb
*
))
{
...
...
@@ -176,31 +177,27 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
listen
->
callsign
=
*
callsign
;
listen
->
dev
=
dev
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
listen_lock
,
flags
);
listen
->
next
=
listen_list
;
listen_list
=
listen
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
listen_lock
,
flags
);
return
1
;
}
void
ax25_listen_release
(
ax25_address
*
callsign
,
struct
net_device
*
dev
)
{
struct
listen_struct
*
s
,
*
listen
=
listen_list
;
struct
listen_struct
*
s
,
*
listen
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
listen_lock
,
flags
);
listen
=
listen_list
;
if
(
listen
==
NULL
)
return
;
save_flags
(
flags
);
cli
();
if
(
ax25cmp
(
&
listen
->
callsign
,
callsign
)
==
0
&&
listen
->
dev
==
dev
)
{
listen_list
=
listen
->
next
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
listen_lock
,
flags
);
kfree
(
listen
);
return
;
}
...
...
@@ -209,15 +206,14 @@ void ax25_listen_release(ax25_address *callsign, struct net_device *dev)
if
(
ax25cmp
(
&
listen
->
next
->
callsign
,
callsign
)
==
0
&&
listen
->
next
->
dev
==
dev
)
{
s
=
listen
->
next
;
listen
->
next
=
listen
->
next
->
next
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
listen_lock
,
flags
);
kfree
(
s
);
return
;
}
listen
=
listen
->
next
;
}
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
listen_lock
,
flags
);
}
int
(
*
ax25_protocol_function
(
unsigned
int
pid
))(
struct
sk_buff
*
,
ax25_cb
*
)
...
...
@@ -240,10 +236,13 @@ int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *)
int
ax25_listen_mine
(
ax25_address
*
callsign
,
struct
net_device
*
dev
)
{
struct
listen_struct
*
listen
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
listen_lock
,
flags
);
for
(
listen
=
listen_list
;
listen
!=
NULL
;
listen
=
listen
->
next
)
if
(
ax25cmp
(
&
listen
->
callsign
,
callsign
)
==
0
&&
(
listen
->
dev
==
dev
||
listen
->
dev
==
NULL
))
return
1
;
spin_unlock_irqrestore
(
&
listen_lock
,
flags
);
return
0
;
}
...
...
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