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>
This commit is contained in:
Alexander Aring 2022-11-17 17:11:54 -05:00 committed by David Teigland
parent 6f0b0b5d7a
commit e9dd5fd849

View File

@ -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);