Skip to contentSkip to conversation

net/handshake: Create a NETLINK service for handling handshake requests

bug report Dan Carpenter 1 participant 1 message May 4, 2023 Handshake upcall for transport layer security

lore
Share & tools
lore
#0 lore raw

Hello Chuck Lever,

The patch 3b3009ea8abb: "net/handshake: Create a NETLINK service for handling handshake requests" from Apr 17, 2023, leads to the following Smatch static checker warning:

net/handshake/netlink.c:195 handshake_nl_done_doit()
error: uninitialized symbol 'req'.

net/handshake/netlink.c

    159 int handshake_nl_done_doit(struct sk_buff *skb, struct genl_info *info)
    160 {
    161         struct net *net = sock_net(skb->sk);
    162         struct socket *sock = NULL;
    163         struct handshake_req *req;

uninitialized

    164         int fd, status, err;
    165 
    166         if (GENL_REQ_ATTR_CHECK(info, HANDSHAKE_A_DONE_SOCKFD))
    167                 return -EINVAL;
    168         fd = nla_get_u32(info->attrs[HANDSHAKE_A_DONE_SOCKFD]);
    169 
    170         err = 0;
    171         sock = sockfd_lookup(fd, &err);
    172         if (err) {
    173                 err = -EBADF;
    174                 goto out_status;

goto

    175         }
    176 
    177         req = handshake_req_hash_lookup(sock->sk);
    178         if (!req) {
    179                 err = -EBUSY;
    180                 fput(sock->file);
    181                 goto out_status;
    182         }
    183 
    184         trace_handshake_cmd_done(net, req, sock->sk, fd);
    185 
    186         status = -EIO;
    187         if (info->attrs[HANDSHAKE_A_DONE_STATUS])
    188                 status = nla_get_u32(info->attrs[HANDSHAKE_A_DONE_STATUS]);
    189 
    190         handshake_complete(req, status, info);
    191         fput(sock->file);
    192         return 0;
    193 
    194 out_status:
--> 195         trace_handshake_cmd_done_err(net, req, sock->sk, err);
                                                  ^^^

warn

    196         return err;
    197 }

regards,
dan carpenter