aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--net/can/isotp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/can/isotp.c b/net/can/isotp.c
index 1662103ce125..6b6c82206c30 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -1046,12 +1046,16 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
{
struct sock *sk = sock->sk;
struct sk_buff *skb;
+ struct isotp_sock *so = isotp_sk(sk);
int err = 0;
int noblock;
noblock = flags & MSG_DONTWAIT;
flags &= ~MSG_DONTWAIT;
+ if (!so->bound)
+ return -EADDRNOTAVAIL;
+
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (!skb)
return err;