[LLC]: fix net_device refcounting bug

parent 3f5b025e
...@@ -187,6 +187,8 @@ static int llc_ui_release(struct socket *sock) ...@@ -187,6 +187,8 @@ static int llc_ui_release(struct socket *sock)
llc_release_sockets(llc->sap); llc_release_sockets(llc->sap);
llc_sap_close(llc->sap); llc_sap_close(llc->sap);
} }
if (llc->dev)
dev_put(llc->dev);
sock_put(sk); sock_put(sk);
llc_sk_free(sk); llc_sk_free(sk);
out: out:
...@@ -257,6 +259,7 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr) ...@@ -257,6 +259,7 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)
rc = -ENETUNREACH; rc = -ENETUNREACH;
if (!dev) if (!dev)
goto out; goto out;
dev_hold(dev);
llc->dev = dev; llc->dev = dev;
} }
/* bind to a specific sap, optional. */ /* bind to a specific sap, optional. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment