aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--0002-tty-n_r3964-fix-poll-return-value.patch9
-rw-r--r--0003-tty-n_r3964-remove-n_r3964.h.patch12
-rw-r--r--0004-tty-n_r3964-drop-ancient-header-changelog-text.patch7
-rw-r--r--0005-tty-n_r3964-split-rx-and-tx-header-structures.patch35
-rw-r--r--0006-tty-n_r3964-for-tx_blocks-use-a-real-kernel-list.patch27
-rw-r--r--0007-tty-n_r3964-for-rx_blocks-use-a-real-kernel-list.patch13
-rw-r--r--0008-tty-n_r3964-don-t-hand-roll-a-reference-count.patch21
-rw-r--r--0009-tty-n_r3964-for-messages-use-a-real-kernel-list.patch65
-rw-r--r--0010-tty-n_r3964-for-clients-use-a-real-kernel-list.patch27
-rw-r--r--0011-tty-n_r3964-fix-race-with-add_msg-and-read_telegram.patch21
-rw-r--r--0012-tty-n_r3964-remove-read_lock-from-some-ioctls.patch11
-rw-r--r--0013-tty-n_r3964-properly-protect-sig_flags-of-client-str.patch17
-rw-r--r--0014-tty-n_r3964-properly-reference-count-pids.patch21
-rw-r--r--0015-tty-n_r3964-add-reference-counting-to-the-client-str.patch37
-rw-r--r--lib-raid6-fix-awk-build-warnings.patch33
-rw-r--r--series1
16 files changed, 126 insertions, 231 deletions
diff --git a/0002-tty-n_r3964-fix-poll-return-value.patch b/0002-tty-n_r3964-fix-poll-return-value.patch
index e2e91facfa6269..f30e82114f81db 100644
--- a/0002-tty-n_r3964-fix-poll-return-value.patch
+++ b/0002-tty-n_r3964-fix-poll-return-value.patch
@@ -9,14 +9,12 @@ wanted to have happen did not.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 2 +-
+ drivers/tty/n_r3964.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index 664b201b9abc..b4a205f9f8ac 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
-@@ -1286,7 +1286,7 @@ static __poll_t r3964_poll(struct tty_struct *tty, struct file *file,
+@@ -1286,7 +1286,7 @@ static __poll_t r3964_poll(struct tty_st
if (pMsg)
result |= EPOLLIN | EPOLLRDNORM;
} else {
@@ -25,6 +23,3 @@ index 664b201b9abc..b4a205f9f8ac 100644
}
return result;
}
---
-2.21.0
-
diff --git a/0003-tty-n_r3964-remove-n_r3964.h.patch b/0003-tty-n_r3964-remove-n_r3964.h.patch
index 3831fbbcfef200..ebcd9ce5a42c81 100644
--- a/0003-tty-n_r3964-remove-n_r3964.h.patch
+++ b/0003-tty-n_r3964-remove-n_r3964.h.patch
@@ -11,13 +11,11 @@ drivers/tty/n_r3964.c
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 114 +++++++++++++++++++++++++-
- include/linux/n_r3964.h | 175 ----------------------------------------
+ drivers/tty/n_r3964.c | 114 ++++++++++++++++++++++++++++++-
+ include/linux/n_r3964.h | 175 ------------------------------------------------
2 files changed, 113 insertions(+), 176 deletions(-)
delete mode 100644 include/linux/n_r3964.h
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index b4a205f9f8ac..62a0e869eab5 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -60,10 +60,11 @@
@@ -151,9 +149,6 @@ index b4a205f9f8ac..62a0e869eab5 100644
static void add_tx_queue(struct r3964_info *, struct r3964_block_header *);
static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code);
static void put_char(struct r3964_info *pInfo, unsigned char ch);
-diff --git a/include/linux/n_r3964.h b/include/linux/n_r3964.h
-deleted file mode 100644
-index 9cc0020930ad..000000000000
--- a/include/linux/n_r3964.h
+++ /dev/null
@@ -1,175 +0,0 @@
@@ -332,6 +327,3 @@ index 9cc0020930ad..000000000000
-};
-
-#endif
---
-2.21.0
-
diff --git a/0004-tty-n_r3964-drop-ancient-header-changelog-text.patch b/0004-tty-n_r3964-drop-ancient-header-changelog-text.patch
index 46c61661f16528..5a08eaee47ca39 100644
--- a/0004-tty-n_r3964-drop-ancient-header-changelog-text.patch
+++ b/0004-tty-n_r3964-drop-ancient-header-changelog-text.patch
@@ -9,11 +9,9 @@ in the file.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 45 ++++---------------------------------------
+ drivers/tty/n_r3964.c | 45 ++++-----------------------------------------
1 file changed, 4 insertions(+), 41 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index 62a0e869eab5..6c0abb04c4f0 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -1,48 +1,11 @@
@@ -69,6 +67,3 @@ index 62a0e869eab5..6c0abb04c4f0 100644
*/
#include <linux/module.h>
---
-2.21.0
-
diff --git a/0005-tty-n_r3964-split-rx-and-tx-header-structures.patch b/0005-tty-n_r3964-split-rx-and-tx-header-structures.patch
index 0f633183531e36..dd6ead7b86473f 100644
--- a/0005-tty-n_r3964-split-rx-and-tx-header-structures.patch
+++ b/0005-tty-n_r3964-split-rx-and-tx-header-structures.patch
@@ -13,11 +13,9 @@ of where.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 78 +++++++++++++++++++++----------------------
+ drivers/tty/n_r3964.c | 78 +++++++++++++++++++++++++-------------------------
1 file changed, 39 insertions(+), 39 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index 6c0abb04c4f0..487aa6a38f7d 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -101,6 +101,8 @@ enum {
@@ -97,7 +95,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
static void put_char(struct r3964_info *pInfo, unsigned char ch);
static void trigger_transmit(struct r3964_info *pInfo);
static void retry_transmit(struct r3964_info *pInfo);
-@@ -195,7 +200,7 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg);
+@@ -195,7 +200,7 @@ static int enable_signals(struct r3964_i
static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
unsigned char __user * buf);
static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
@@ -115,7 +113,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
{
unsigned long flags;
-@@ -329,10 +334,10 @@ static void add_tx_queue(struct r3964_info *pInfo,
+@@ -329,10 +334,10 @@ static void add_tx_queue(struct r3964_in
static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
{
@@ -128,7 +126,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
#endif
pHeader = pInfo->tx_first;
-@@ -376,7 +381,7 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
+@@ -376,7 +381,7 @@ static void remove_from_tx_queue(struct
}
static void add_rx_queue(struct r3964_info *pInfo,
@@ -137,7 +135,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
{
unsigned long flags;
-@@ -400,10 +405,10 @@ static void add_rx_queue(struct r3964_info *pInfo,
+@@ -400,10 +405,10 @@ static void add_rx_queue(struct r3964_in
}
static void remove_from_rx_queue(struct r3964_info *pInfo,
@@ -150,7 +148,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
if (pHeader == NULL)
return;
-@@ -517,7 +522,7 @@ static void retry_transmit(struct r3964_info *pInfo)
+@@ -517,7 +522,7 @@ static void retry_transmit(struct r3964_
static void transmit_block(struct r3964_info *pInfo)
{
struct tty_struct *tty = pInfo->tty;
@@ -159,7 +157,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
int room = 0;
if (tty == NULL || pBlock == NULL) {
-@@ -558,7 +563,7 @@ static void on_receive_block(struct r3964_info *pInfo)
+@@ -558,7 +563,7 @@ static void on_receive_block(struct r396
{
unsigned int length;
struct r3964_client_info *pClient;
@@ -168,7 +166,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
unsigned long flags;
length = pInfo->rx_position;
-@@ -596,20 +601,17 @@ static void on_receive_block(struct r3964_info *pInfo)
+@@ -596,20 +601,17 @@ static void on_receive_block(struct r396
del_timer_sync(&pInfo->tmr);
TRACE_PS(" rx success: got %d chars", length);
@@ -192,7 +190,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
memcpy(pBlock->data, pInfo->rx_buf, length);
-@@ -905,7 +907,7 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -905,7 +907,7 @@ static int read_telegram(struct r3964_in
unsigned char __user * buf)
{
struct r3964_client_info *pClient;
@@ -201,7 +199,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
if (!buf) {
return -EINVAL;
-@@ -931,7 +933,7 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -931,7 +933,7 @@ static int read_telegram(struct r3964_in
}
static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
@@ -210,7 +208,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
{
struct r3964_message *pMsg;
unsigned long flags;
-@@ -1014,7 +1016,7 @@ static struct r3964_message *remove_msg(struct r3964_info *pInfo,
+@@ -1014,7 +1016,7 @@ static struct r3964_message *remove_msg(
static void remove_client_block(struct r3964_info *pInfo,
struct r3964_client_info *pClient)
{
@@ -219,7 +217,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
TRACE_PS("remove_client_block PID %d", pid_nr(pClient->pid));
-@@ -1098,7 +1100,7 @@ static void r3964_close(struct tty_struct *tty)
+@@ -1098,7 +1100,7 @@ static void r3964_close(struct tty_struc
struct r3964_info *pInfo = tty->disc_data;
struct r3964_client_info *pClient, *pNext;
struct r3964_message *pMsg;
@@ -228,7 +226,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
unsigned long flags;
TRACE_L("close");
-@@ -1214,7 +1216,7 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
+@@ -1214,7 +1216,7 @@ static ssize_t r3964_write(struct tty_st
const unsigned char *data, size_t count)
{
struct r3964_info *pInfo = tty->disc_data;
@@ -237,7 +235,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
struct r3964_client_info *pClient;
unsigned char *new_data;
-@@ -1239,8 +1241,7 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
+@@ -1239,8 +1241,7 @@ static ssize_t r3964_write(struct tty_st
/*
* Allocate a buffer for the data and copy it from the buffer with header prepended
*/
@@ -247,7 +245,7 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
TRACE_M("r3964_write - kmalloc %p", new_data);
if (new_data == NULL) {
if (pInfo->flags & R3964_DEBUG) {
-@@ -1249,10 +1250,9 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
+@@ -1249,10 +1250,9 @@ static ssize_t r3964_write(struct tty_st
return -ENOSPC;
}
@@ -260,6 +258,3 @@ index 6c0abb04c4f0..487aa6a38f7d 100644
pHeader->owner = NULL;
pClient = findClient(pInfo, task_pid(current));
---
-2.21.0
-
diff --git a/0006-tty-n_r3964-for-tx_blocks-use-a-real-kernel-list.patch b/0006-tty-n_r3964-for-tx_blocks-use-a-real-kernel-list.patch
index 5dacea8486862b..579e960a08fab5 100644
--- a/0006-tty-n_r3964-for-tx_blocks-use-a-real-kernel-list.patch
+++ b/0006-tty-n_r3964-for-tx_blocks-use-a-real-kernel-list.patch
@@ -10,11 +10,9 @@ doing.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 85 +++++++++++++------------------------------
+ drivers/tty/n_r3964.c | 85 +++++++++++++++-----------------------------------
1 file changed, 26 insertions(+), 59 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index 487aa6a38f7d..4a9750adcc56 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -140,7 +140,7 @@ struct rx_block_header {
@@ -36,7 +34,7 @@ index 487aa6a38f7d..4a9750adcc56 100644
unsigned int tx_position;
unsigned int rx_position;
unsigned char last_rx;
-@@ -316,42 +315,25 @@ static void add_tx_queue(struct r3964_info *pInfo,
+@@ -316,42 +315,25 @@ static void add_tx_queue(struct r3964_in
unsigned long flags;
spin_lock_irqsave(&pInfo->lock, flags);
@@ -88,7 +86,7 @@ index 487aa6a38f7d..4a9750adcc56 100644
if (pHeader->owner) {
if (error_code) {
-@@ -364,20 +346,7 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
+@@ -364,20 +346,7 @@ static void remove_from_tx_queue(struct
wake_up_interruptible(&pInfo->tty->read_wait);
}
@@ -109,7 +107,7 @@ index 487aa6a38f7d..4a9750adcc56 100644
}
static void add_rx_queue(struct r3964_info *pInfo,
-@@ -476,7 +445,7 @@ static void trigger_transmit(struct r3964_info *pInfo)
+@@ -476,7 +445,7 @@ static void trigger_transmit(struct r396
spin_lock_irqsave(&pInfo->lock, flags);
@@ -118,7 +116,7 @@ index 487aa6a38f7d..4a9750adcc56 100644
pInfo->state = R3964_TX_REQUEST;
pInfo->nRetry = 0;
pInfo->flags &= ~R3964_ERROR;
-@@ -522,17 +491,19 @@ static void retry_transmit(struct r3964_info *pInfo)
+@@ -522,17 +491,19 @@ static void retry_transmit(struct r3964_
static void transmit_block(struct r3964_info *pInfo)
{
struct tty_struct *tty = pInfo->tty;
@@ -135,17 +133,17 @@ index 487aa6a38f7d..4a9750adcc56 100644
- room = tty_write_room(tty);
+ if (list_empty(&pInfo->tx_blocks))
+ return;
-+
-+ pBlock = list_first_entry(&pInfo->tx_blocks, struct tx_block_header,
-+ node);
- TRACE_PS("transmit_block %p, room %d, length %d",
- pBlock, room, pBlock->length);
++ pBlock = list_first_entry(&pInfo->tx_blocks, struct tx_block_header,
++ node);
++
+ room = tty_write_room(tty);
while (pInfo->tx_position < pBlock->length) {
if (room < 2)
-@@ -1077,7 +1048,7 @@ static int r3964_open(struct tty_struct *tty)
+@@ -1077,7 +1048,7 @@ static int r3964_open(struct tty_struct
pInfo->tty = tty;
pInfo->priority = R3964_MASTER;
pInfo->rx_first = pInfo->rx_last = NULL;
@@ -154,7 +152,7 @@ index 487aa6a38f7d..4a9750adcc56 100644
pInfo->rx_position = 0;
pInfo->tx_position = 0;
pInfo->last_rx = 0;
-@@ -1100,7 +1071,7 @@ static void r3964_close(struct tty_struct *tty)
+@@ -1100,7 +1071,7 @@ static void r3964_close(struct tty_struc
struct r3964_info *pInfo = tty->disc_data;
struct r3964_client_info *pClient, *pNext;
struct r3964_message *pMsg;
@@ -163,7 +161,7 @@ index 487aa6a38f7d..4a9750adcc56 100644
unsigned long flags;
TRACE_L("close");
-@@ -1129,15 +1100,11 @@ static void r3964_close(struct tty_struct *tty)
+@@ -1129,15 +1100,11 @@ static void r3964_close(struct tty_struc
}
/* Remove jobs from tx_queue: */
spin_lock_irqsave(&pInfo->lock, flags);
@@ -182,6 +180,3 @@ index 487aa6a38f7d..4a9750adcc56 100644
/* Free buffers: */
kfree(pInfo->rx_buf);
---
-2.21.0
-
diff --git a/0007-tty-n_r3964-for-rx_blocks-use-a-real-kernel-list.patch b/0007-tty-n_r3964-for-rx_blocks-use-a-real-kernel-list.patch
index 749651594132ab..1ca4ff63029247 100644
--- a/0007-tty-n_r3964-for-rx_blocks-use-a-real-kernel-list.patch
+++ b/0007-tty-n_r3964-for-rx_blocks-use-a-real-kernel-list.patch
@@ -10,11 +10,9 @@ doing.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 67 +++++++++----------------------------------
+ drivers/tty/n_r3964.c | 67 +++++++++-----------------------------------------
1 file changed, 13 insertions(+), 54 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index 4a9750adcc56..8275fb905aeb 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -132,8 +132,7 @@ struct rx_block_header {
@@ -37,7 +35,7 @@ index 4a9750adcc56..8275fb905aeb 100644
struct list_head tx_blocks;
unsigned int tx_position;
unsigned int rx_position;
-@@ -355,71 +353,32 @@ static void add_rx_queue(struct r3964_info *pInfo,
+@@ -355,71 +353,32 @@ static void add_rx_queue(struct r3964_in
unsigned long flags;
spin_lock_irqsave(&pInfo->lock, flags);
@@ -118,7 +116,7 @@ index 4a9750adcc56..8275fb905aeb 100644
}
static void put_char(struct r3964_info *pInfo, unsigned char ch)
-@@ -582,7 +541,7 @@ static void on_receive_block(struct r3964_info *pInfo)
+@@ -582,7 +541,7 @@ static void on_receive_block(struct r396
pBlock->length = length;
pBlock->data = ((unsigned char *)pBlock) + sizeof(*pBlock);
pBlock->locks = 0;
@@ -127,7 +125,7 @@ index 4a9750adcc56..8275fb905aeb 100644
memcpy(pBlock->data, pInfo->rx_buf, length);
-@@ -1047,7 +1006,7 @@ static int r3964_open(struct tty_struct *tty)
+@@ -1047,7 +1006,7 @@ static int r3964_open(struct tty_struct
mutex_init(&pInfo->read_lock);
pInfo->tty = tty;
pInfo->priority = R3964_MASTER;
@@ -136,6 +134,3 @@ index 4a9750adcc56..8275fb905aeb 100644
INIT_LIST_HEAD(&pInfo->tx_blocks);
pInfo->rx_position = 0;
pInfo->tx_position = 0;
---
-2.21.0
-
diff --git a/0008-tty-n_r3964-don-t-hand-roll-a-reference-count.patch b/0008-tty-n_r3964-don-t-hand-roll-a-reference-count.patch
index 0fd59803294b63..898480f7c047b4 100644
--- a/0008-tty-n_r3964-don-t-hand-roll-a-reference-count.patch
+++ b/0008-tty-n_r3964-don-t-hand-roll-a-reference-count.patch
@@ -10,11 +10,9 @@ doing reference counting properly.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 61 ++++++++++++++++++++-----------------------
+ drivers/tty/n_r3964.c | 61 ++++++++++++++++++++++----------------------------
1 file changed, 28 insertions(+), 33 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index 8275fb905aeb..a79c8d485030 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -26,6 +26,7 @@
@@ -36,7 +34,7 @@ index 8275fb905aeb..a79c8d485030 100644
};
/* Header of received block in tx_buf: */
-@@ -200,8 +202,7 @@ static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
+@@ -200,8 +202,7 @@ static void add_msg(struct r3964_client_
int error_code, struct rx_block_header *pBlock);
static struct r3964_message *remove_msg(struct r3964_info *pInfo,
struct r3964_client_info *pClient);
@@ -46,7 +44,7 @@ index 8275fb905aeb..a79c8d485030 100644
static int r3964_open(struct tty_struct *tty);
static void r3964_close(struct tty_struct *tty);
-@@ -357,28 +358,28 @@ static void add_rx_queue(struct r3964_info *pInfo,
+@@ -357,28 +358,28 @@ static void add_rx_queue(struct r3964_in
spin_unlock_irqrestore(&pInfo->lock, flags);
}
@@ -87,7 +85,7 @@ index 8275fb905aeb..a79c8d485030 100644
}
static void put_char(struct r3964_info *pInfo, unsigned char ch)
-@@ -540,7 +541,8 @@ static void on_receive_block(struct r3964_info *pInfo)
+@@ -540,7 +541,8 @@ static void on_receive_block(struct r396
pBlock->length = length;
pBlock->data = ((unsigned char *)pBlock) + sizeof(*pBlock);
@@ -97,7 +95,7 @@ index 8275fb905aeb..a79c8d485030 100644
INIT_LIST_HEAD(&pBlock->node);
memcpy(pBlock->data, pInfo->rx_buf, length);
-@@ -855,7 +857,7 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -855,7 +857,7 @@ static int read_telegram(struct r3964_in
if (copy_to_user(buf, block->data, block->length))
return -EFAULT;
@@ -106,7 +104,7 @@ index 8275fb905aeb..a79c8d485030 100644
return block->length;
}
-@@ -894,9 +896,9 @@ static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
+@@ -894,9 +896,9 @@ queue_the_message:
pClient->msg_count++;
@@ -119,7 +117,7 @@ index 8275fb905aeb..a79c8d485030 100644
spin_unlock_irqrestore(&pClient->lock, flags);
} else {
if ((pClient->last_msg->msg_id == R3964_MSG_ACK)
-@@ -935,7 +937,7 @@ static struct r3964_message *remove_msg(struct r3964_info *pInfo,
+@@ -935,7 +937,7 @@ static struct r3964_message *remove_msg(
pClient->msg_count--;
if (pMsg->block) {
@@ -128,7 +126,7 @@ index 8275fb905aeb..a79c8d485030 100644
pClient->next_block_to_read = pMsg->block;
}
spin_unlock_irqrestore(&pClient->lock, flags);
-@@ -943,21 +945,14 @@ static struct r3964_message *remove_msg(struct r3964_info *pInfo,
+@@ -943,21 +945,14 @@ static struct r3964_message *remove_msg(
return pMsg;
}
@@ -155,6 +153,3 @@ index 8275fb905aeb..a79c8d485030 100644
}
/*************************************************************
---
-2.21.0
-
diff --git a/0009-tty-n_r3964-for-messages-use-a-real-kernel-list.patch b/0009-tty-n_r3964-for-messages-use-a-real-kernel-list.patch
index bafeacf154ba65..d649a1ed124fa3 100644
--- a/0009-tty-n_r3964-for-messages-use-a-real-kernel-list.patch
+++ b/0009-tty-n_r3964-for-messages-use-a-real-kernel-list.patch
@@ -13,11 +13,9 @@ accessed.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 132 ++++++++++++++++++++----------------------
- 1 file changed, 62 insertions(+), 70 deletions(-)
+ drivers/tty/n_r3964.c | 136 +++++++++++++++++++++++---------------------------
+ 1 file changed, 64 insertions(+), 72 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index a79c8d485030..cf2a3dc3a870 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -101,7 +101,6 @@ enum {
@@ -47,7 +45,7 @@ index a79c8d485030..cf2a3dc3a870 100644
};
/* Header of received block in rx_buf: */
-@@ -200,8 +198,7 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -200,8 +198,7 @@ static int read_telegram(struct r3964_in
unsigned char __user * buf);
static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
int error_code, struct rx_block_header *pBlock);
@@ -57,7 +55,7 @@ index a79c8d485030..cf2a3dc3a870 100644
static void remove_client_block(struct r3964_client_info *pClient);
static int r3964_open(struct tty_struct *tty);
-@@ -788,7 +785,7 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -788,7 +785,7 @@ static int enable_signals(struct r3964_i
pid_nr(pid));
*ppClient = pClient->next;
while (pClient->msg_count) {
@@ -66,7 +64,7 @@ index a79c8d485030..cf2a3dc3a870 100644
if (pMsg) {
kfree(pMsg);
TRACE_M("enable_signals - msg "
-@@ -823,8 +820,7 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -823,8 +820,7 @@ static int enable_signals(struct r3964_i
pClient->sig_flags = arg;
pClient->pid = get_pid(pid);
pClient->next = pInfo->firstClient;
@@ -76,7 +74,7 @@ index a79c8d485030..cf2a3dc3a870 100644
pClient->next_block_to_read = NULL;
pClient->msg_count = 0;
pInfo->firstClient = pClient;
-@@ -864,85 +860,83 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -864,85 +860,83 @@ static int read_telegram(struct r3964_in
return -EINVAL;
}
@@ -88,34 +86,34 @@ index a79c8d485030..cf2a3dc3a870 100644
{
struct r3964_message *pMsg;
- unsigned long flags;
-
+-
- if (pClient->msg_count < R3964_MAX_MSG_COUNT - 1) {
-queue_the_message:
-+ pMsg = kmalloc(sizeof(*pMsg), GFP_ATOMIC);
-+ if (pMsg == NULL)
-+ return;
- pMsg = kmalloc(sizeof(*pMsg), GFP_ATOMIC);
- TRACE_M("add_msg - kmalloc %p", pMsg);
- if (pMsg == NULL) {
- return;
- }
++ pMsg = kmalloc(sizeof(*pMsg), GFP_ATOMIC);
++ if (pMsg == NULL)
++ return;
+
+- spin_lock_irqsave(&pClient->lock, flags);
+ pMsg->msg_id = msg_id;
+ pMsg->arg = arg;
+ pMsg->error_code = error_code;
+ pMsg->block = pBlock;
+ INIT_LIST_HEAD(&pMsg->node);
-- spin_lock_irqsave(&pClient->lock, flags);
-+ list_add_tail(&pMsg->node, &pClient->msgs);
-+ pClient->msg_count++;
-
- pMsg->msg_id = msg_id;
- pMsg->arg = arg;
- pMsg->error_code = error_code;
- pMsg->block = pBlock;
- pMsg->next = NULL;
--
++ list_add_tail(&pMsg->node, &pClient->msgs);
++ pClient->msg_count++;
+
- if (pClient->last_msg == NULL) {
- pClient->first_msg = pClient->last_msg = pMsg;
- } else {
@@ -182,26 +180,28 @@ index a79c8d485030..cf2a3dc3a870 100644
- if (pClient->first_msg) {
- spin_lock_irqsave(&pClient->lock, flags);
-+ spin_lock_irqsave(&client->lock, flags);
-+ if (list_empty(&client->msgs)) {
-+ spin_unlock_irqrestore(&client->lock, flags);
-+ return NULL;
-+ }
-
+-
- pMsg = pClient->first_msg;
- pClient->first_msg = pMsg->next;
- if (pClient->first_msg == NULL) {
- pClient->last_msg = NULL;
- }
-+ msg = list_first_entry(&client->msgs, struct r3964_message, node);
-+ list_del(&msg->node);
-
+-
- pClient->msg_count--;
- if (pMsg->block) {
- remove_client_block(pClient);
- pClient->next_block_to_read = pMsg->block;
- }
- spin_unlock_irqrestore(&pClient->lock, flags);
++ spin_lock_irqsave(&client->lock, flags);
++ if (list_empty(&client->msgs)) {
++ spin_unlock_irqrestore(&client->lock, flags);
++ return NULL;
++ }
++
++ msg = list_first_entry(&client->msgs, struct r3964_message, node);
++ list_del(&msg->node);
++
+ client->msg_count--;
+ if (msg->block) {
+ remove_client_block(client);
@@ -213,7 +213,7 @@ index a79c8d485030..cf2a3dc3a870 100644
}
static void remove_client_block(struct r3964_client_info *client)
-@@ -1041,7 +1035,7 @@ static void r3964_close(struct tty_struct *tty)
+@@ -1041,7 +1035,7 @@ static void r3964_close(struct tty_struc
while (pClient) {
pNext = pClient->next;
while (pClient->msg_count) {
@@ -222,7 +222,7 @@ index a79c8d485030..cf2a3dc3a870 100644
if (pMsg) {
kfree(pMsg);
TRACE_M("r3964_close - msg kfree %p", pMsg);
-@@ -1091,7 +1085,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
+@@ -1091,7 +1085,7 @@ static ssize_t r3964_read(struct tty_str
pClient = findClient(pInfo, task_pid(current));
if (pClient) {
@@ -231,7 +231,7 @@ index a79c8d485030..cf2a3dc3a870 100644
if (pMsg == NULL) {
/* no messages available. */
if (tty_io_nonblock(tty, file)) {
-@@ -1100,7 +1094,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
+@@ -1100,7 +1094,7 @@ static ssize_t r3964_read(struct tty_str
}
/* block until there is a message: */
wait_event_interruptible(tty->read_wait,
@@ -240,7 +240,7 @@ index a79c8d485030..cf2a3dc3a870 100644
}
/* If we still haven't got a message, we must have been signalled */
-@@ -1267,7 +1261,6 @@ static __poll_t r3964_poll(struct tty_struct *tty, struct file *file,
+@@ -1267,7 +1261,6 @@ static __poll_t r3964_poll(struct tty_st
{
struct r3964_info *pInfo = tty->disc_data;
struct r3964_client_info *pClient;
@@ -248,7 +248,7 @@ index a79c8d485030..cf2a3dc3a870 100644
unsigned long flags;
__poll_t result = EPOLLOUT;
-@@ -1276,11 +1269,10 @@ static __poll_t r3964_poll(struct tty_struct *tty, struct file *file,
+@@ -1276,11 +1269,10 @@ static __poll_t r3964_poll(struct tty_st
pClient = findClient(pInfo, task_pid(current));
if (pClient) {
poll_wait(file, &tty->read_wait, wait);
@@ -263,6 +263,3 @@ index a79c8d485030..cf2a3dc3a870 100644
} else {
result = EPOLLNVAL | EPOLLERR;
}
---
-2.21.0
-
diff --git a/0010-tty-n_r3964-for-clients-use-a-real-kernel-list.patch b/0010-tty-n_r3964-for-clients-use-a-real-kernel-list.patch
index de4cc61f1ed61a..02a33c6e676bbe 100644
--- a/0010-tty-n_r3964-for-clients-use-a-real-kernel-list.patch
+++ b/0010-tty-n_r3964-for-clients-use-a-real-kernel-list.patch
@@ -9,11 +9,9 @@ making the logic a lot simpler and easier to understand.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 31 ++++++++++++-------------------
+ drivers/tty/n_r3964.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index cf2a3dc3a870..f752eec92448 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -109,8 +109,7 @@ struct r3964_client_info {
@@ -35,7 +33,7 @@ index cf2a3dc3a870..f752eec92448 100644
unsigned int state;
unsigned int flags;
-@@ -549,7 +548,7 @@ static void on_receive_block(struct r3964_info *pInfo)
+@@ -549,7 +548,7 @@ static void on_receive_block(struct r396
/* notify attached client processes: */
spin_lock_irqsave(&pInfo->lock, flags);
@@ -44,7 +42,7 @@ index cf2a3dc3a870..f752eec92448 100644
if (pClient->sig_flags & R3964_SIG_DATA) {
add_msg(pClient, R3964_MSG_DATA, length, R3964_OK,
pBlock);
-@@ -755,11 +754,12 @@ static struct r3964_client_info *findClient(struct r3964_info *pInfo,
+@@ -755,11 +754,12 @@ static struct r3964_client_info *findCli
unsigned long flags;
spin_lock_irqsave(&pInfo->lock, flags);
@@ -58,7 +56,7 @@ index cf2a3dc3a870..f752eec92448 100644
exit:
spin_unlock_irqrestore(&pInfo->lock, flags);
return pClient;
-@@ -768,7 +768,6 @@ static struct r3964_client_info *findClient(struct r3964_info *pInfo,
+@@ -768,7 +768,6 @@ exit:
static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
{
struct r3964_client_info *pClient;
@@ -66,7 +64,7 @@ index cf2a3dc3a870..f752eec92448 100644
struct r3964_message *pMsg;
unsigned long flags;
-@@ -776,14 +775,10 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -776,14 +775,10 @@ static int enable_signals(struct r3964_i
spin_lock_irqsave(&pInfo->lock, flags);
/* Remove client from client list */
@@ -82,7 +80,7 @@ index cf2a3dc3a870..f752eec92448 100644
while (pClient->msg_count) {
pMsg = remove_msg(pClient);
if (pMsg) {
-@@ -793,6 +788,7 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -793,6 +788,7 @@ static int enable_signals(struct r3964_i
}
}
put_pid(pClient->pid);
@@ -90,7 +88,7 @@ index cf2a3dc3a870..f752eec92448 100644
kfree(pClient);
TRACE_M("enable_signals - kfree %p", pClient);
spin_unlock_irqrestore(&pInfo->lock, flags);
-@@ -819,11 +815,10 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -819,11 +815,10 @@ static int enable_signals(struct r3964_i
spin_lock_init(&pClient->lock);
pClient->sig_flags = arg;
pClient->pid = get_pid(pid);
@@ -103,7 +101,7 @@ index cf2a3dc3a870..f752eec92448 100644
spin_unlock_irqrestore(&pInfo->lock, flags);
}
}
-@@ -1001,7 +996,7 @@ static int r3964_open(struct tty_struct *tty)
+@@ -1001,7 +996,7 @@ static int r3964_open(struct tty_struct
pInfo->tx_position = 0;
pInfo->last_rx = 0;
pInfo->blocks_in_rx_queue = 0;
@@ -112,7 +110,7 @@ index cf2a3dc3a870..f752eec92448 100644
pInfo->state = R3964_IDLE;
pInfo->flags = R3964_DEBUG;
pInfo->nRetry = 0;
-@@ -1017,7 +1012,7 @@ static int r3964_open(struct tty_struct *tty)
+@@ -1017,7 +1012,7 @@ static int r3964_open(struct tty_struct
static void r3964_close(struct tty_struct *tty)
{
struct r3964_info *pInfo = tty->disc_data;
@@ -121,7 +119,7 @@ index cf2a3dc3a870..f752eec92448 100644
struct r3964_message *pMsg;
struct tx_block_header *pHeader, *tmp;
unsigned long flags;
-@@ -1031,9 +1026,7 @@ static void r3964_close(struct tty_struct *tty)
+@@ -1031,9 +1026,7 @@ static void r3964_close(struct tty_struc
del_timer_sync(&pInfo->tmr);
/* Remove client-structs and message queues: */
@@ -132,7 +130,7 @@ index cf2a3dc3a870..f752eec92448 100644
while (pClient->msg_count) {
pMsg = remove_msg(pClient);
if (pMsg) {
-@@ -1042,9 +1035,9 @@ static void r3964_close(struct tty_struct *tty)
+@@ -1042,9 +1035,9 @@ static void r3964_close(struct tty_struc
}
}
put_pid(pClient->pid);
@@ -143,6 +141,3 @@ index cf2a3dc3a870..f752eec92448 100644
}
/* Remove jobs from tx_queue: */
spin_lock_irqsave(&pInfo->lock, flags);
---
-2.21.0
-
diff --git a/0011-tty-n_r3964-fix-race-with-add_msg-and-read_telegram.patch b/0011-tty-n_r3964-fix-race-with-add_msg-and-read_telegram.patch
index 8823e994d83ef4..e34558b35198db 100644
--- a/0011-tty-n_r3964-fix-race-with-add_msg-and-read_telegram.patch
+++ b/0011-tty-n_r3964-fix-race-with-add_msg-and-read_telegram.patch
@@ -17,14 +17,12 @@ over a known corruption problems.
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 52 ++++++++++++++++++++++++++++++++++---------
+ drivers/tty/n_r3964.c | 52 ++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 42 insertions(+), 10 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index f752eec92448..1514b17f5615 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
-@@ -193,8 +193,6 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c);
+@@ -193,8 +193,6 @@ static void receive_char(struct r3964_in
static void receive_error(struct r3964_info *pInfo, const char flag);
static void on_timeout(struct timer_list *t);
static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg);
@@ -33,7 +31,7 @@ index f752eec92448..1514b17f5615 100644
static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
int error_code, struct rx_block_header *pBlock);
static struct r3964_message *remove_msg(struct r3964_client_info *client);
-@@ -831,6 +829,10 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -831,6 +829,10 @@ static int read_telegram(struct r3964_in
{
struct r3964_client_info *pClient;
struct rx_block_header *block;
@@ -44,7 +42,7 @@ index f752eec92448..1514b17f5615 100644
if (!buf) {
return -EINVAL;
-@@ -841,18 +843,47 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -841,18 +843,47 @@ static int read_telegram(struct r3964_in
return -EINVAL;
}
@@ -79,7 +77,8 @@ index f752eec92448..1514b17f5615 100644
+ return -EFAULT;
}
+ kfree(data);
-+
+
+- return -EINVAL;
+ /*
+ * Copy succeeded, so grab the lock again, and then drop the buffer, as
+ * remove_client_block() has to have the lock held.
@@ -92,15 +91,14 @@ index f752eec92448..1514b17f5615 100644
+ */
+ spin_lock_irqsave(&pClient->lock, flags);
+ remove_client_block(pClient);
-
-- return -EINVAL;
++
+exit:
+ spin_unlock_irqrestore(&pClient->lock, flags);
+ return retval;
}
static void __add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
-@@ -935,6 +966,7 @@ static struct r3964_message *remove_msg(struct r3964_client_info *client)
+@@ -935,6 +966,7 @@ static struct r3964_message *remove_msg(
}
static void remove_client_block(struct r3964_client_info *client)
@@ -108,6 +106,3 @@ index f752eec92448..1514b17f5615 100644
{
struct rx_block_header *block;
---
-2.21.0
-
diff --git a/0012-tty-n_r3964-remove-read_lock-from-some-ioctls.patch b/0012-tty-n_r3964-remove-read_lock-from-some-ioctls.patch
index cd450701c65fb6..7ffbf114f76303 100644
--- a/0012-tty-n_r3964-remove-read_lock-from-some-ioctls.patch
+++ b/0012-tty-n_r3964-remove-read_lock-from-some-ioctls.patch
@@ -12,11 +12,9 @@ ioctls that need it so that they will not have any problems.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 28 ++++++++++++++++++----------
+ drivers/tty/n_r3964.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index 1514b17f5615..d3f53fa201b7 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -175,7 +175,8 @@ struct r3964_info {
@@ -29,7 +27,7 @@ index 1514b17f5615..d3f53fa201b7 100644
struct list_head clients;
unsigned int state;
-@@ -1219,33 +1220,41 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file,
+@@ -1219,33 +1220,41 @@ static int r3964_ioctl(struct tty_struct
unsigned int cmd, unsigned long arg)
{
struct r3964_info *pInfo = tty->disc_data;
@@ -79,7 +77,7 @@ index 1514b17f5615..d3f53fa201b7 100644
break;
case R3964_READ_TELEGRAM:
retval = read_telegram(pInfo, task_pid(current),
-@@ -1256,7 +1265,6 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file,
+@@ -1256,7 +1265,6 @@ static int r3964_ioctl(struct tty_struct
break;
}
@@ -87,6 +85,3 @@ index 1514b17f5615..d3f53fa201b7 100644
return retval;
}
---
-2.21.0
-
diff --git a/0013-tty-n_r3964-properly-protect-sig_flags-of-client-str.patch b/0013-tty-n_r3964-properly-protect-sig_flags-of-client-str.patch
index cb1010fbeb2d2c..9842a56d052f1e 100644
--- a/0013-tty-n_r3964-properly-protect-sig_flags-of-client-str.patch
+++ b/0013-tty-n_r3964-properly-protect-sig_flags-of-client-str.patch
@@ -9,14 +9,12 @@ structure to allways access it under the client structure's lock.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 20 ++++++++++++++++----
+ drivers/tty/n_r3964.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index d3f53fa201b7..a00c34ea9c27 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
-@@ -193,7 +193,6 @@ static void transmit_block(struct r3964_info *pInfo);
+@@ -193,7 +193,6 @@ static void transmit_block(struct r3964_
static void receive_char(struct r3964_info *pInfo, const unsigned char c);
static void receive_error(struct r3964_info *pInfo, const char flag);
static void on_timeout(struct timer_list *t);
@@ -24,7 +22,7 @@ index d3f53fa201b7..a00c34ea9c27 100644
static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
int error_code, struct rx_block_header *pBlock);
static struct r3964_message *remove_msg(struct r3964_client_info *client);
-@@ -548,7 +547,14 @@ static void on_receive_block(struct r3964_info *pInfo)
+@@ -548,7 +547,14 @@ static void on_receive_block(struct r396
/* notify attached client processes: */
spin_lock_irqsave(&pInfo->lock, flags);
list_for_each_entry(pClient, &pInfo->clients, node) {
@@ -40,7 +38,7 @@ index d3f53fa201b7..a00c34ea9c27 100644
add_msg(pClient, R3964_MSG_DATA, length, R3964_OK,
pBlock);
}
-@@ -799,8 +805,12 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -799,8 +805,12 @@ static int enable_signals(struct r3964_i
} else {
pClient = findClient(pInfo, pid);
if (pClient) {
@@ -53,7 +51,7 @@ index d3f53fa201b7..a00c34ea9c27 100644
} else {
/* add client to client list */
pClient = kmalloc(sizeof(struct r3964_client_info),
-@@ -915,6 +925,7 @@ static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
+@@ -915,6 +925,7 @@ static void add_msg(struct r3964_client_
{
struct r3964_message *pMsg;
unsigned long flags;
@@ -61,7 +59,7 @@ index d3f53fa201b7..a00c34ea9c27 100644
spin_lock_irqsave(&pClient->lock, flags);
-@@ -935,12 +946,13 @@ static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
+@@ -935,12 +946,13 @@ static void add_msg(struct r3964_client_
TRACE_PE("add_msg - queue OVERFLOW-msg");
}
}
@@ -77,6 +75,3 @@ index d3f53fa201b7..a00c34ea9c27 100644
}
static struct r3964_message *remove_msg(struct r3964_client_info *client)
---
-2.21.0
-
diff --git a/0014-tty-n_r3964-properly-reference-count-pids.patch b/0014-tty-n_r3964-properly-reference-count-pids.patch
index 68aec18727fa26..0962fd7154d197 100644
--- a/0014-tty-n_r3964-properly-reference-count-pids.patch
+++ b/0014-tty-n_r3964-properly-reference-count-pids.patch
@@ -14,14 +14,12 @@ pid.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 28 ++++++++++++++++++++++------
+ drivers/tty/n_r3964.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index a00c34ea9c27..aef0befd068d 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
-@@ -770,6 +770,18 @@ static struct r3964_client_info *findClient(struct r3964_info *pInfo,
+@@ -770,6 +770,18 @@ exit:
return pClient;
}
@@ -40,7 +38,7 @@ index a00c34ea9c27..aef0befd068d 100644
static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
{
struct r3964_client_info *pClient;
-@@ -1121,7 +1133,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
+@@ -1121,7 +1133,7 @@ static ssize_t r3964_read(struct tty_str
return -ERESTARTSYS;
}
@@ -49,7 +47,7 @@ index a00c34ea9c27..aef0befd068d 100644
if (pClient) {
pMsg = remove_msg(pClient);
if (pMsg == NULL) {
-@@ -1208,7 +1220,7 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
+@@ -1208,7 +1220,7 @@ static ssize_t r3964_write(struct tty_st
pHeader->length = count;
pHeader->owner = NULL;
@@ -58,7 +56,7 @@ index a00c34ea9c27..aef0befd068d 100644
if (pClient) {
pHeader->owner = pClient;
}
-@@ -1232,6 +1244,7 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file,
+@@ -1232,6 +1244,7 @@ static int r3964_ioctl(struct tty_struct
unsigned int cmd, unsigned long arg)
{
struct r3964_info *pInfo = tty->disc_data;
@@ -66,7 +64,7 @@ index a00c34ea9c27..aef0befd068d 100644
unsigned long flags;
int retval = 0;
-@@ -1249,7 +1262,9 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file,
+@@ -1249,7 +1262,9 @@ static int r3964_ioctl(struct tty_struct
return -ERESTARTSYS;
}
@@ -77,7 +75,7 @@ index a00c34ea9c27..aef0befd068d 100644
mutex_unlock(&pInfo->read_lock);
break;
-@@ -1269,8 +1284,9 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file,
+@@ -1269,8 +1284,9 @@ static int r3964_ioctl(struct tty_struct
spin_unlock_irqrestore(&pInfo->lock, flags);
break;
case R3964_READ_TELEGRAM:
@@ -89,7 +87,7 @@ index a00c34ea9c27..aef0befd068d 100644
break;
default:
retval = -ENOIOCTLCMD;
-@@ -1311,7 +1327,7 @@ static __poll_t r3964_poll(struct tty_struct *tty, struct file *file,
+@@ -1311,7 +1327,7 @@ static __poll_t r3964_poll(struct tty_st
TRACE_L("POLL");
@@ -98,6 +96,3 @@ index a00c34ea9c27..aef0befd068d 100644
if (pClient) {
poll_wait(file, &tty->read_wait, wait);
spin_lock_irqsave(&pClient->lock, flags);
---
-2.21.0
-
diff --git a/0015-tty-n_r3964-add-reference-counting-to-the-client-str.patch b/0015-tty-n_r3964-add-reference-counting-to-the-client-str.patch
index d7fbe7d31aa68e..0cdeb7fcb0ed4e 100644
--- a/0015-tty-n_r3964-add-reference-counting-to-the-client-str.patch
+++ b/0015-tty-n_r3964-add-reference-counting-to-the-client-str.patch
@@ -18,11 +18,9 @@ time.
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/n_r3964.c | 82 +++++++++++++++++++++++++++++++++----------
+ drivers/tty/n_r3964.c | 82 +++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 64 insertions(+), 18 deletions(-)
-diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
-index aef0befd068d..37d03ef8e75d 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -106,6 +106,7 @@ struct tx_block_header;
@@ -64,7 +62,7 @@ index aef0befd068d..37d03ef8e75d 100644
/*************************************************************
* Protocol implementation routines
*************************************************************/
-@@ -339,6 +364,7 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code)
+@@ -339,6 +364,7 @@ static void remove_from_tx_queue(struct
wake_up_interruptible(&pInfo->tty->read_wait);
}
@@ -72,7 +70,7 @@ index aef0befd068d..37d03ef8e75d 100644
kfree(pHeader);
}
-@@ -550,6 +576,7 @@ static void on_receive_block(struct r3964_info *pInfo)
+@@ -550,6 +576,7 @@ static void on_receive_block(struct r396
unsigned long client_flags;
unsigned int sig_flags;
@@ -80,7 +78,7 @@ index aef0befd068d..37d03ef8e75d 100644
spin_lock_irqsave(&pClient->lock, client_flags);
sig_flags = pClient->sig_flags;
spin_unlock_irqrestore(&pClient->lock, client_flags);
-@@ -558,6 +585,7 @@ static void on_receive_block(struct r3964_info *pInfo)
+@@ -558,6 +585,7 @@ static void on_receive_block(struct r396
add_msg(pClient, R3964_MSG_DATA, length, R3964_OK,
pBlock);
}
@@ -88,7 +86,7 @@ index aef0befd068d..37d03ef8e75d 100644
}
spin_unlock_irqrestore(&pInfo->lock, flags);
wake_up_interruptible(&pInfo->tty->read_wait);
-@@ -752,25 +780,40 @@ static void on_timeout(struct timer_list *t)
+@@ -752,25 +780,40 @@ static void on_timeout(struct timer_list
}
}
@@ -133,7 +131,7 @@ index aef0befd068d..37d03ef8e75d 100644
static struct r3964_client_info *find_client_current(struct r3964_info *info)
{
struct r3964_client_info *client;
-@@ -793,6 +836,7 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -793,6 +836,7 @@ static int enable_signals(struct r3964_i
/* Remove client from client list */
list_for_each_entry(pClient, &pInfo->clients, node) {
@@ -141,7 +139,7 @@ index aef0befd068d..37d03ef8e75d 100644
if (pClient->pid == pid) {
TRACE_PS("removing client %d from client list",
pid_nr(pid));
-@@ -804,13 +848,13 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -804,13 +848,13 @@ static int enable_signals(struct r3964_i
"kfree %p", pMsg);
}
}
@@ -159,7 +157,7 @@ index aef0befd068d..37d03ef8e75d 100644
}
spin_unlock_irqrestore(&pInfo->lock, flags);
return -EINVAL;
-@@ -823,6 +867,7 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -823,6 +867,7 @@ static int enable_signals(struct r3964_i
spin_lock_irqsave(&pClient->lock, client_flags);
pClient->sig_flags = arg;
spin_unlock_irqrestore(&pClient->lock, client_flags);
@@ -167,7 +165,7 @@ index aef0befd068d..37d03ef8e75d 100644
} else {
/* add client to client list */
pClient = kmalloc(sizeof(struct r3964_client_info),
-@@ -834,6 +879,7 @@ static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
+@@ -834,6 +879,7 @@ static int enable_signals(struct r3964_i
spin_lock_irqsave(&pInfo->lock, flags);
TRACE_PS("add client %d to client list", pid_nr(pid));
spin_lock_init(&pClient->lock);
@@ -175,7 +173,7 @@ index aef0befd068d..37d03ef8e75d 100644
pClient->sig_flags = arg;
pClient->pid = get_pid(pid);
INIT_LIST_HEAD(&pClient->msgs);
-@@ -887,6 +933,7 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -887,6 +933,7 @@ static int read_telegram(struct r3964_in
if (copy_to_user(buf, data, length)) {
kfree(data);
@@ -183,7 +181,7 @@ index aef0befd068d..37d03ef8e75d 100644
return -EFAULT;
}
kfree(data);
-@@ -906,6 +953,7 @@ static int read_telegram(struct r3964_info *pInfo, struct pid *pid,
+@@ -906,6 +953,7 @@ static int read_telegram(struct r3964_in
exit:
spin_unlock_irqrestore(&pClient->lock, flags);
@@ -191,7 +189,7 @@ index aef0befd068d..37d03ef8e75d 100644
return retval;
}
-@@ -1091,10 +1139,7 @@ static void r3964_close(struct tty_struct *tty)
+@@ -1091,10 +1139,7 @@ static void r3964_close(struct tty_struc
TRACE_M("r3964_close - msg kfree %p", pMsg);
}
}
@@ -203,7 +201,7 @@ index aef0befd068d..37d03ef8e75d 100644
}
/* Remove jobs from tx_queue: */
spin_lock_irqsave(&pInfo->lock, flags);
-@@ -1174,6 +1219,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
+@@ -1174,6 +1219,7 @@ static ssize_t r3964_read(struct tty_str
ret = -EPERM;
unlock:
mutex_unlock(&pInfo->read_lock);
@@ -211,7 +209,7 @@ index aef0befd068d..37d03ef8e75d 100644
return ret;
}
-@@ -1182,7 +1228,6 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
+@@ -1182,7 +1228,6 @@ static ssize_t r3964_write(struct tty_st
{
struct r3964_info *pInfo = tty->disc_data;
struct tx_block_header *pHeader;
@@ -219,7 +217,7 @@ index aef0befd068d..37d03ef8e75d 100644
unsigned char *new_data;
TRACE_L("write request, %d characters", count);
-@@ -1218,12 +1263,12 @@ static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
+@@ -1218,12 +1263,12 @@ static ssize_t r3964_write(struct tty_st
pHeader = (struct tx_block_header *)new_data;
pHeader->data = new_data + sizeof(*pHeader);
pHeader->length = count;
@@ -237,7 +235,7 @@ index aef0befd068d..37d03ef8e75d 100644
memcpy(pHeader->data, data, count); /* We already verified this */
-@@ -1334,6 +1379,7 @@ static __poll_t r3964_poll(struct tty_struct *tty, struct file *file,
+@@ -1334,6 +1379,7 @@ static __poll_t r3964_poll(struct tty_st
if (!list_empty(&pClient->msgs))
result |= EPOLLIN | EPOLLRDNORM;
spin_unlock_irqrestore(&pClient->lock, flags);
@@ -245,6 +243,3 @@ index aef0befd068d..37d03ef8e75d 100644
} else {
result = EPOLLNVAL | EPOLLERR;
}
---
-2.21.0
-
diff --git a/lib-raid6-fix-awk-build-warnings.patch b/lib-raid6-fix-awk-build-warnings.patch
deleted file mode 100644
index bf0caf4aee0fd6..00000000000000
--- a/lib-raid6-fix-awk-build-warnings.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From foo@baz Fri 06 Dec 2019 04:20:42 PM CET
-Date: Fri, 06 Dec 2019 16:20:42 +0100
-To: Greg KH <gregkh@linuxfoundation.org>
-From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Subject: [PATCH] lib: raid6: fix awk build warnings
-
-Newer versions of awk spit out these fun warnings:
- awk: ../lib/raid6/unroll.awk:16: warning: regexp escape sequence `\#' is not a known regexp operator
-
-As commit 700c1018b86d ("x86/insn: Fix awk regexp warnings") showed, it
-turns out that there are a number of awk strings that do not need to be
-escaped and newer versions of awk now warn about this.
-
-Fix the string up so that no warning is produced. The exact same kernel
-module gets created before and after this patch, showing that it wasn't
-needed.
-
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- lib/raid6/unroll.awk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/lib/raid6/unroll.awk
-+++ b/lib/raid6/unroll.awk
-@@ -13,7 +13,7 @@ BEGIN {
- for (i = 0; i < rep; ++i) {
- tmp = $0
- gsub(/\$\$/, i, tmp)
-- gsub(/\$\#/, n, tmp)
-+ gsub(/\$#/, n, tmp)
- gsub(/\$\*/, "$", tmp)
- print tmp
- }
diff --git a/series b/series
index 6702faa6dedb2d..ceaf1e802cabf9 100644
--- a/series
+++ b/series
@@ -1,6 +1,5 @@
#
dynamic_debug-allow-to-work-if-debugfs-is-disabled.patch
-lib-raid6-fix-awk-build-warnings.patch
spdxcheck-print-out-files-without-any-spdx-lines.patch
0001-tty-n_r3964-locking-fixups.patch