diff options
author | Alexander Aring <aahringo@redhat.com> | 2022-11-17 17:11:54 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2022-11-21 09:45:49 -0600 |
commit | e9dd5fd849f1ac125919a79eb4be66f078dd7f51 (patch) | |
tree | 18dbca229cc7ed7508011e1a8981f38690c970f7 /fs/dlm | |
parent | 6f0b0b5d7ae70423c94915989c45b29e87c61ad7 (diff) | |
download | linux-e9dd5fd849f1ac125919a79eb4be66f078dd7f51.tar.gz linux-e9dd5fd849f1ac125919a79eb4be66f078dd7f51.tar.bz2 linux-e9dd5fd849f1ac125919a79eb4be66f078dd7f51.zip |
fs: dlm: use sock2con without checking null
This patch removes null checks on private data for sockets. If we have a
null dereference there we having a bug in our implementation that such
callback occurs in this state.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/lowcomms.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index ed3cd3757199..677e31144ca0 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -472,10 +472,9 @@ int dlm_lowcomms_addr(int nodeid, struct sockaddr_storage *addr, int len) /* Data available on socket or listen socket received a connect */ static void lowcomms_data_ready(struct sock *sk) { - struct connection *con; + struct connection *con = sock2con(sk); - con = sock2con(sk); - if (con && !test_and_set_bit(CF_READ_PENDING, &con->flags)) + if (!test_and_set_bit(CF_READ_PENDING, &con->flags)) queue_work(recv_workqueue, &con->rwork); } @@ -486,11 +485,7 @@ static void lowcomms_listen_data_ready(struct sock *sk) static void lowcomms_write_space(struct sock *sk) { - struct connection *con; - - con = sock2con(sk); - if (!con) - return; + struct connection *con = sock2con(sk); if (!test_and_set_bit(CF_CONNECTED, &con->flags)) { log_print("connected to node %d", con->nodeid); @@ -573,14 +568,10 @@ int dlm_lowcomms_nodes_set_mark(int nodeid, unsigned int mark) static void lowcomms_error_report(struct sock *sk) { - struct connection *con; + struct connection *con = sock2con(sk); void (*orig_report)(struct sock *) = NULL; struct inet_sock *inet; - con = sock2con(sk); - if (con == NULL) - goto out; - orig_report = listen_sock.sk_error_report; inet = inet_sk(sk); |