aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-12-14 18:50:34 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-18 00:59:09 -0500
commit81dcd1690697efbdf8126e78fbbf7c76d359377f (patch)
treee4408697d6e40efed6f876b7bcd133fdc93c7eb5 /net/ax25
parent8d5cf596d10d740b69b5f4bbdb54b85abf75810d (diff)
[AX.25]: Fix unchecked ax25_listen_register uses
Fix ax25_listen_register to return something that's a sane error code, then all callers to use it. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/ax25_iface.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index dd9b7fee3df8..51e293420b7f 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -154,7 +154,7 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
154 return 0; 154 return 0;
155 155
156 if ((listen = kmalloc(sizeof(*listen), GFP_ATOMIC)) == NULL) 156 if ((listen = kmalloc(sizeof(*listen), GFP_ATOMIC)) == NULL)
157 return 0; 157 return -ENOMEM;
158 158
159 listen->callsign = *callsign; 159 listen->callsign = *callsign;
160 listen->dev = dev; 160 listen->dev = dev;
@@ -164,7 +164,7 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
164 listen_list = listen; 164 listen_list = listen;
165 spin_unlock_bh(&listen_lock); 165 spin_unlock_bh(&listen_lock);
166 166
167 return 1; 167 return 0;
168} 168}
169 169
170EXPORT_SYMBOL(ax25_listen_register); 170EXPORT_SYMBOL(ax25_listen_register);
@@ -225,7 +225,8 @@ int ax25_listen_mine(ax25_address *callsign, struct net_device *dev)
225 225
226 spin_lock_bh(&listen_lock); 226 spin_lock_bh(&listen_lock);
227 for (listen = listen_list; listen != NULL; listen = listen->next) 227 for (listen = listen_list; listen != NULL; listen = listen->next)
228 if (ax25cmp(&listen->callsign, callsign) == 0 && (listen->dev == dev || listen->dev == NULL)) { 228 if (ax25cmp(&listen->callsign, callsign) == 0 &&
229 (listen->dev == dev || listen->dev == NULL)) {
229 spin_unlock_bh(&listen_lock); 230 spin_unlock_bh(&listen_lock);
230 return 1; 231 return 1;
231 } 232 }