Skip to content

Commit 5046720

Browse files
rsa9000davem330
authored andcommitted
net: wwan: core: purge rx queue on port close
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c230035 commit 5046720

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/wwan/wwan_core.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ static void wwan_port_destroy(struct device *dev)
240240

241241
ida_free(&minors, MINOR(port->dev.devt));
242242
mutex_destroy(&port->data_lock);
243-
skb_queue_purge(&port->rxq);
244243
mutex_destroy(&port->ops_lock);
245244
kfree(port);
246245
}
@@ -462,8 +461,11 @@ static void wwan_port_op_stop(struct wwan_port *port)
462461
{
463462
mutex_lock(&port->ops_lock);
464463
port->start_count--;
465-
if (port->ops && !port->start_count)
466-
port->ops->stop(port);
464+
if (!port->start_count) {
465+
if (port->ops)
466+
port->ops->stop(port);
467+
skb_queue_purge(&port->rxq);
468+
}
467469
mutex_unlock(&port->ops_lock);
468470
}
469471

0 commit comments

Comments
 (0)