mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
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 a8059512b1
("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>
This commit is contained in:
parent
7b46ac4e77
commit
c69d4407d8
@ -262,10 +262,9 @@ int pn_skb_send(struct sock *sk, struct sk_buff *skb,
|
|||||||
else if (phonet_address_lookup(net, daddr) == 0) {
|
else if (phonet_address_lookup(net, daddr) == 0) {
|
||||||
dev = phonet_device_get(net);
|
dev = phonet_device_get(net);
|
||||||
skb->pkt_type = PACKET_LOOPBACK;
|
skb->pkt_type = PACKET_LOOPBACK;
|
||||||
} else if (pn_sockaddr_get_object(target) == 0) {
|
} else if (dst == 0) {
|
||||||
/* Resource routing (small race until phonet_rcv()) */
|
/* Resource routing (small race until phonet_rcv()) */
|
||||||
struct sock *sk = pn_find_sock_by_res(net,
|
struct sock *sk = pn_find_sock_by_res(net, res);
|
||||||
target->spn_resource);
|
|
||||||
if (sk) {
|
if (sk) {
|
||||||
sock_put(sk);
|
sock_put(sk);
|
||||||
dev = phonet_device_get(net);
|
dev = phonet_device_get(net);
|
||||||
|
Loading…
Reference in New Issue
Block a user