aboutsummaryrefslogtreecommitdiffstats
path: root/net/phonet/af_phonet.c
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>2011-03-08 17:44:06 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-09 14:59:29 -0500
commitc69d4407d8884e8a127f95d07b1896443f3716ff (patch)
tree85989f9259365d5470113e810237b567ba93af37 /net/phonet/af_phonet.c
parent7b46ac4e77f3224a1befe032c77f1df31d1b42c4 (diff)
Phonet: fix NULL dereference on TX path with implicit source
The previous Phonet patch series introduced per-socket implicit destination (i.e. connect()). In that case, the destination socket address is NULL in the transmit function. However commit a8059512b120362b15424f152b2548fe8b11bd0c ("Phonet: implement per-socket destination/peer address") is incomplete and would trigger a NULL dereference. (Fortunately, the code is not in released kernel, and in fact currently not reachable.) Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet/af_phonet.c')
-rw-r--r--net/phonet/af_phonet.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index 30cc676c35fd..4706b77e67bf 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -262,10 +262,9 @@ int pn_skb_send(struct sock *sk, struct sk_buff *skb,
262 else if (phonet_address_lookup(net, daddr) == 0) { 262 else if (phonet_address_lookup(net, daddr) == 0) {
263 dev = phonet_device_get(net); 263 dev = phonet_device_get(net);
264 skb->pkt_type = PACKET_LOOPBACK; 264 skb->pkt_type = PACKET_LOOPBACK;
265 } else if (pn_sockaddr_get_object(target) == 0) { 265 } else if (dst == 0) {
266 /* Resource routing (small race until phonet_rcv()) */ 266 /* Resource routing (small race until phonet_rcv()) */
267 struct sock *sk = pn_find_sock_by_res(net, 267 struct sock *sk = pn_find_sock_by_res(net, res);
268 target->spn_resource);
269 if (sk) { 268 if (sk) {
270 sock_put(sk); 269 sock_put(sk);
271 dev = phonet_device_get(net); 270 dev = phonet_device_get(net);