aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorGravatar Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2023-05-27 08:32:07 +0100
committerGravatar Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2023-05-27 08:32:07 +0100
commit0e4daea31d8312dd9f957a62717d4b5f31ef494c (patch)
treea9edacaf51413354d0df35f6faf7f002a6f34bf0 /drivers/net/tun.c
parentserial: Make uart_remove_one_port() return void (diff)
parentLinux 6.4-rc3 (diff)
downloadlinux-0e4daea31d8312dd9f957a62717d4b5f31ef494c.tar.gz
linux-0e4daea31d8312dd9f957a62717d4b5f31ef494c.tar.bz2
linux-0e4daea31d8312dd9f957a62717d4b5f31ef494c.zip
Merge 6.4-rc3 into tty-next
We need the serial/tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d4d0a41a905a..d75456adc62a 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1977,6 +1977,14 @@ napi_busy:
int queue_len;
spin_lock_bh(&queue->lock);
+
+ if (unlikely(tfile->detached)) {
+ spin_unlock_bh(&queue->lock);
+ rcu_read_unlock();
+ err = -EBUSY;
+ goto free_skb;
+ }
+
__skb_queue_tail(queue, skb);
queue_len = skb_queue_len(queue);
spin_unlock(&queue->lock);
@@ -2512,6 +2520,13 @@ build:
if (tfile->napi_enabled) {
queue = &tfile->sk.sk_write_queue;
spin_lock(&queue->lock);
+
+ if (unlikely(tfile->detached)) {
+ spin_unlock(&queue->lock);
+ kfree_skb(skb);
+ return -EBUSY;
+ }
+
__skb_queue_tail(queue, skb);
spin_unlock(&queue->lock);
ret = 1;