Skip to content

Commit

Permalink
llc: Check address length before reading address field
Browse files Browse the repository at this point in the history
KMSAN will complain if valid address length passed to bind() is shorter
than sizeof(struct sockaddr_llc) bytes.

Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Tetsuo Handa authored and davem330 committed Apr 12, 2019
1 parent bd7d46d commit c68e747
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/llc/af_llc.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,13 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
struct llc_sap *sap;
int rc = -EINVAL;

dprintk("%s: binding %02X\n", __func__, addr->sllc_sap);

lock_sock(sk);
if (unlikely(!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr)))
goto out;
rc = -EAFNOSUPPORT;
if (unlikely(addr->sllc_family != AF_LLC))
goto out;
dprintk("%s: binding %02X\n", __func__, addr->sllc_sap);
rc = -ENODEV;
rcu_read_lock();
if (sk->sk_bound_dev_if) {
Expand Down

0 comments on commit c68e747

Please sign in to comment.