Skip to content

Commit

Permalink
rxrpc: Check address length before reading srx_service 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_rxrpc) 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 d852be8 commit a9107a1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/rxrpc/af_rxrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,15 @@ static int rxrpc_bind(struct socket *sock, struct sockaddr *saddr, int len)
struct sockaddr_rxrpc *srx = (struct sockaddr_rxrpc *)saddr;
struct rxrpc_local *local;
struct rxrpc_sock *rx = rxrpc_sk(sock->sk);
u16 service_id = srx->srx_service;
u16 service_id;
int ret;

_enter("%p,%p,%d", rx, saddr, len);

ret = rxrpc_validate_address(rx, srx, len);
if (ret < 0)
goto error;
service_id = srx->srx_service;

lock_sock(&rx->sk);

Expand Down

0 comments on commit a9107a1

Please sign in to comment.