Skip to content

Commit

Permalink
net: wwan: core: purge rx queue on port close
Browse files Browse the repository at this point in the history
Purge the rx queue as soon as a user closes the port, just after the
port stop callback invocation. This is to prevent feeding a user that
will open the port next time with outdated and possibly unrelated
data.

While at it also remove the odd skb_queue_purge() call in the port
device destroy callback. The queue will be purged just before the
callback is ivoncated in the wwan_remove_port() function.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sergey Ryazanov authored and David S. Miller committed Jun 8, 2021
1 parent c230035 commit 5046720
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/wwan/wwan_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ static void wwan_port_destroy(struct device *dev)

ida_free(&minors, MINOR(port->dev.devt));
mutex_destroy(&port->data_lock);
skb_queue_purge(&port->rxq);
mutex_destroy(&port->ops_lock);
kfree(port);
}
Expand Down Expand Up @@ -462,8 +461,11 @@ static void wwan_port_op_stop(struct wwan_port *port)
{
mutex_lock(&port->ops_lock);
port->start_count--;
if (port->ops && !port->start_count)
port->ops->stop(port);
if (!port->start_count) {
if (port->ops)
port->ops->stop(port);
skb_queue_purge(&port->rxq);
}
mutex_unlock(&port->ops_lock);
}

Expand Down

0 comments on commit 5046720

Please sign in to comment.