diff options
author | Mark Brown <broonie@kernel.org> | 2018-12-21 09:57:36 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-12-21 09:57:36 +0000 |
commit | 43603a35574c2e594f9e10a97a40874d1282dd7e (patch) | |
tree | a814e05e3d87e221339e4fc9b5e2bd202faee716 /net/irda/af_irda.c | |
parent | 38f53ef7bce9f848946a2ad4874d715186e32144 (diff) | |
parent | 1b2dbf3c8689071ab54298f1f999f092bb0b2410 (diff) |
Merge tag 'v4.9.145-rt124' into linux-linaro-lsk-v4.9-rt
Linux 4.9.145-rt124
Diffstat (limited to 'net/irda/af_irda.c')
-rw-r--r-- | net/irda/af_irda.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 101ed6c42808..0a78f17006a4 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -774,6 +774,13 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) return -EINVAL; lock_sock(sk); + + /* Ensure that the socket is not already bound */ + if (self->ias_obj) { + err = -EINVAL; + goto out; + } + #ifdef CONFIG_IRDA_ULTRA /* Special care for Ultra sockets */ if ((sk->sk_type == SOCK_DGRAM) && @@ -2016,7 +2023,11 @@ static int irda_setsockopt(struct socket *sock, int level, int optname, err = -EINVAL; goto out; } - irias_insert_object(ias_obj); + + /* Only insert newly allocated objects */ + if (free_ias) + irias_insert_object(ias_obj); + kfree(ias_opt); break; case IRLMP_IAS_DEL: |