s390: network bug fixes for net
Subsystems (5)
cover s390: network bug fixes for net
Hi Dave,
here are 2 bug fixes for net.
shortlog:
Hendrik Brueckner (1)af_iucv: recvmsg: use correct skb_pull() function
Stefan Raspl (1)
qeth: fix qeth_wait_for_threads() deadlock for OSN devices
Thanks,
Frank
PATCH 1/2 af_iucv: recvmsg: use correct skb_pull() function
From: Hendrik Brueckner <[email protected]>
When receiving data messages, the "BUG_ON(skb->len < skb->data_len)" in the skb_pull() function triggers a kernel panic.
Check if the skb uses paged data (is non-linear) and use the pskb_pull() function. Use skb_pull() for linear skbs' only.
--- net/iucv/af_iucv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/iucv/af_iucv.c +4 -1
@@ -1382,7 +1382,10 @@ static int iucv_sock_recvmsg(struct kioc/* SOCK_STREAM: re-queue skb if it contains unreceived data */ if (sk->sk_type ==SOCK_STREAM ) { -skb_pull (skb, copied); +if (skb_is_nonlinear (skb)) +pskb_pull (skb, copied); +else +skb_pull (skb, copied);if (skb->len) {skb_queue_head (&sk->sk_receive_queue, skb); goto done;
Re: [patch 1/2] af_iucv: recvmsg: use correct skb_pull() function
Quoted 20 lines · On Tue, 2013-04-02 at 12:56 +0200, [email protected] wrote:
plain text document attachment (601-af-iucv-skb-pull.diff)
From: Hendrik Brueckner <[email protected]>When receiving data messages, the "
BUG_ON(skb->len < skb->data_len)" in theskb_pull()function triggers a kernel panic.Check if the skb uses paged data (is non-linear) and use the
pskb_pull()function. Useskb_pull()for linear skbs' only.Reviewed-by Ursula Braun <[email protected]>Signed-off-by Hendrik Brueckner <[email protected]>Signed-off-by Frank Blaschka <[email protected]>--- net/iucv/af_iucv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)net/iucv/af_iucv.c +0
-0@@ -1382,7 +1382,10 @@ static int iucv_sock_recvmsg(struct kioc
net/iucv/af_iucv.c static int iucv_sock_recvmsg(struct kioc · line 1391
Quoted 10 lines
net/iucv/af_iucv.c +4
-1/* SOCK_STREAM: re-queue skb if it contains unreceived data */ if (sk->sk_type ==SOCK_STREAM ) { -skb_pull (skb, copied); +if (skb_is_nonlinear (skb)) +pskb_pull (skb, copied); +else +skb_pull (skb, copied);if (skb->len) {skb_queue_head (&sk->sk_receive_queue, skb); goto done;
That cant be right. You can not ignore pskb_pull() return value.
Its also not very efficient.
I would advise using a per skb offset, to avoid skb_pull()
PATCH 2/2 qeth: fix qeth_wait_for_threads() deadlock for OSN devices
In reply to [email protected]From: Stefan Raspl <[email protected]>
Any recovery thread will deadlock when calling qeth_wait_for_threads(), most notably when triggering a recovery on an OSN device.
This patch will store the recovery thread's task pointer on recovery invocation and check in qeth_wait_for_threads() respectively to avoid deadlocks.
--- drivers/s390/net/qeth_core.h | 3 +++ drivers/s390/net/qeth_core_main.c | 19 +++++++++++++++++++ drivers/s390/net/qeth_l2_main.c | 2 ++ drivers/s390/net/qeth_l3_main.c | 2 ++ 4 files changed, 26 insertions(+)
drivers/s390/net/qeth_core.h +3 -0
@@ -769,6 +769,7 @@ struct qeth_card {unsigned long thread_start_mask;unsigned long thread_allowed_mask;unsigned long thread_running_mask; +struct task_struct *recovery_task;spinlock_t ip_lock;struct list_head ip_list;struct list_head *ip_tbd_list;
@@ -862,6 +863,8 @@ extern struct qeth_card_list_struct qethextern struct kmem_cache *qeth_core_header_cache;extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS ]; +void qeth_set_recovery_task (struct qeth_card *); +void qeth_clear_recovery_task (struct qeth_card *);void qeth_set_allowed_threads (struct qeth_card *,unsigned long ,int );int qeth_threads_running (struct qeth_card *,unsigned long );int qeth_wait_for_threads (struct qeth_card *,unsigned long );
drivers/s390/net/qeth_core_main.c +19 -0
@@ -177,6 +177,23 @@ const char *qeth_get_cardname_short(strureturn "n/a" ; } +void qeth_set_recovery_task (struct qeth_card *card) +{ + card->recovery_task = current; +} +EXPORT_SYMBOL_GPL (qeth_set_recovery_task); + +void qeth_clear_recovery_task (struct qeth_card *card) +{ + card->recovery_task =NULL ; +} +EXPORT_SYMBOL_GPL (qeth_clear_recovery_task); + +static bool qeth_is_recovery_task (struct qeth_card *card) +{ +return (card->recovery_task == current); +} +void qeth_set_allowed_threads (struct qeth_card *card,unsigned long threads,int clear_start_mask) {
@@ -205,6 +222,8 @@ EXPORT_SYMBOL_GPL(qeth_threads_running);int qeth_wait_for_threads (struct qeth_card *card,unsigned long threads) { +if (qeth_is_recovery_task (card)) +return 0 ;return wait_event_interruptible (card->wait_q,qeth_threads_running (card, threads) ==0 ); }
drivers/s390/net/qeth_l2_main.c +2 -0
@@ -1143,6 +1143,7 @@ static int qeth_l2_recover(void *ptr)QETH_CARD_TEXT (card,2 ,"recover2" );dev_warn (&card->gdev->dev,"A recovery process has been started for the device\n" ); +qeth_set_recovery_task (card);__qeth_l2_set_offline (card->gdev,1 ); rc =__qeth_l2_set_online (card->gdev,1 );if (!rc)
@@ -1153,6 +1154,7 @@ static int qeth_l2_recover(void *ptr)dev_warn (&card->gdev->dev,"The qeth device driver " "failed to recover an error on the device\n" ); } +qeth_clear_recovery_task (card);qeth_clear_thread_start_bit (card,QETH_RECOVER_THREAD );qeth_clear_thread_running_bit (card,QETH_RECOVER_THREAD );return 0 ;
drivers/s390/net/qeth_l3_main.c +2 -0
@@ -3515,6 +3515,7 @@ static int qeth_l3_recover(void *ptr)QETH_CARD_TEXT (card,2 ,"recover2" );dev_warn (&card->gdev->dev,"A recovery process has been started for the device\n" ); +qeth_set_recovery_task (card);__qeth_l3_set_offline (card->gdev,1 ); rc =__qeth_l3_set_online (card->gdev,1 );if (!rc)
@@ -3525,6 +3526,7 @@ static int qeth_l3_recover(void *ptr)dev_warn (&card->gdev->dev,"The qeth device driver " "failed to recover an error on the device\n" ); } +qeth_clear_recovery_task (card);qeth_clear_thread_start_bit (card,QETH_RECOVER_THREAD );qeth_clear_thread_running_bit (card,QETH_RECOVER_THREAD );return 0 ;
Re: [patch 2/2] qeth: fix qeth_wait_for_threads() deadlock for OSN devices
drivers/s390/net/qeth_core_main.c const char *qeth_get_cardname_short(stru · line 196
Quoted 8 lines · On Tue, 2013-04-02 at 12:56 +0200, [email protected] wrote:
plain text document attachment (602-qeth-thread-deadlock.diff)
From: Stefan Raspl <[email protected]>drivers/s390/net/qeth_core_main.c +5
-0+static bool qeth_is_recovery_task (struct qeth_card *card) +{ +return (card->recovery_task == current); +} +
static bool qeth_is_recovery_task(const struct qeth_card *card)
{
return card->recovery_task == current;
}