From patchwork Thu Aug 15 05:21:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Po-Hsu Lin X-Patchwork-Id: 1147407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 468FDf6bMxz9sNf; Thu, 15 Aug 2019 15:21:38 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hy8CY-0004yX-W9; Thu, 15 Aug 2019 05:21:30 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hy8CW-0004w4-5f for kernel-team@lists.ubuntu.com; Thu, 15 Aug 2019 05:21:28 +0000 Received: from mail-pf1-f200.google.com ([209.85.210.200]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hy8CV-0000gE-Mj for kernel-team@lists.ubuntu.com; Thu, 15 Aug 2019 05:21:27 +0000 Received: by mail-pf1-f200.google.com with SMTP id v3so909122pfm.8 for ; Wed, 14 Aug 2019 22:21:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=/fqFCUykoGZgOCd1qrVGT4jI+iaB3ilqagOwaMGm7w0=; b=qAUiw4Gu8ClJw86jS1jZU1KJbaymLdrxfXHaIiVRxxkCZ7bkVvHx7eoZWD9WWZW2FP zGKhBA7S7jcCJUYNFw19vDMgXQQ1Qv1ixsUCk9qSGqRUhhGdiqOOKkzUydLPwqbonC01 YouCf8ZdDJorax007s02PKK8nVsriUjfveDw2WNCVkT99ckdDnkF1ikeKqnNWcj4j16W XnxfJYJ0fHHEx8l8AHdqga1B08S2Y1X6wevLCP3l94p/2MtMWgmYlGqarqe+u+DOzGy6 35DCwTxu+ZoQpGlOdGe87/OillEkMpwDmzl3hbXdyehwQ7Y+fVQ3YFrjWHDavbLiob8+ yquQ== X-Gm-Message-State: APjAAAXxzw5vsFVaDz0naSA3CDEO5zw1D+WDqDyPHiYcU/ESo7QH/98J 3HXYiqL8EpEoMo0O//LECh/YovfqdhgTcIpZ9eJQL2I4/PLR5jAZQKMdT6JopQLj0bQIxwrhk90 RxzhL6vCuBrYWqOjneaM5y0akieFzQ93l68Y9lTZ5 X-Received: by 2002:a63:f048:: with SMTP id s8mr2181482pgj.26.1565846486119; Wed, 14 Aug 2019 22:21:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvs2gSN4BuBwYQJ+umS1crIrnUmTM74lvfm0ZJ+mE744zSPWs/UprC4/8SV5ZvUhhvUfENVg== X-Received: by 2002:a63:f048:: with SMTP id s8mr2181471pgj.26.1565846485744; Wed, 14 Aug 2019 22:21:25 -0700 (PDT) Received: from localhost.localdomain (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id y194sm1682620pfg.116.2019.08.14.22.21.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 22:21:25 -0700 (PDT) From: Po-Hsu Lin To: kernel-team@lists.ubuntu.com Subject: [D][SRU][PATCH 1/1] p54: fix crash during initialization Date: Thu, 15 Aug 2019 13:21:16 +0800 Message-Id: <20190815052116.23430-2-po-hsu.lin@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815052116.23430-1-po-hsu.lin@canonical.com> References: <20190815052116.23430-1-po-hsu.lin@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Christian Lamparter BugLink: https://bugs.launchpad.net/bugs/1839693 This patch fixes a crash that got introduced when the mentioned patch replaced the direct list_head access with skb_peek_tail(). When the device is starting up, there are no entries in the queue, so previously to "Use skb_peek_tail() instead..." the target_skb would end up as the tail and head pointer which then could be used by __skb_queue_after to fill the empty queue. With skb_peek_tail() in its place will instead just return NULL which then causes a crash in the __skb_queue_after(). | BUG: unable to handle kernel NULL pointer dereference at 000000 | #PF error: [normal kernel read fault] | PGD 0 P4D 0 | Oops: 0000 [#1] SMP PTI | CPU: 0 PID: 12 Comm: kworker/0:1 Tainted: GO 5.1.0-rc7-wt+ #218 | Hardware name: MSI MS-7816/Z87-G43 (MS-7816), BIOS V1.11 05/09/2015 | Workqueue: events request_firmware_work_func | RIP: 0010:p54_tx_pending+0x10f/0x1b0 [p54common] | Code: 78 06 80 78 28 00 74 6d <48> 8b 07 49 89 7c 24 08 49 89 04 24 4 | RSP: 0018:ffffa81c81927d90 EFLAGS: 00010086 | RAX: ffff9bbaaf131048 RBX: 0000000000020670 RCX: 0000000000020264 | RDX: ffff9bbaa976d660 RSI: 0000000000000202 RDI: 0000000000000000 | RBP: ffff9bbaa976d620 R08: 00000000000006c0 R09: ffff9bbaa976d660 | R10: 0000000000000000 R11: ffffe8480dbc5900 R12: ffff9bbb45e87700 | R13: ffff9bbaa976d648 R14: ffff9bbaa976d674 R15: ffff9bbaaf131048 | FS: 0000000000000000(0000) GS:ffff9bbb5ec00000(0000) knlGS:00000 | CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 | CR2: 0000000000000000 CR3: 00000003695fc003 CR4: 00000000001606f0 | Call Trace: | p54_download_eeprom+0xbe/0x120 [p54common] | p54_read_eeprom+0x7f/0xc0 [p54common] | p54u_load_firmware_cb+0xe0/0x160 [p54usb] | request_firmware_work_func+0x42/0x80 | process_one_work+0x1f5/0x3f0 | worker_thread+0x28/0x3c0 Cc: stable@vger.kernel.org Fixes: e3554197fc8f ("p54: Use skb_peek_tail() instead of direct head pointer accesses.") Signed-off-by: Christian Lamparter Signed-off-by: Kalle Valo (cherry picked from commit 1645ab931998b39aed5761f095956f0b10a6362f) Signed-off-by: Po-Hsu Lin Acked-by: Connor Kuehl Acked-by: Stefan Bader --- drivers/net/wireless/intersil/p54/txrx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/p54/txrx.c b/drivers/net/wireless/intersil/p54/txrx.c index 79078456..5bf1c19 100644 --- a/drivers/net/wireless/intersil/p54/txrx.c +++ b/drivers/net/wireless/intersil/p54/txrx.c @@ -142,7 +142,10 @@ static int p54_assign_address(struct p54_common *priv, struct sk_buff *skb) unlikely(GET_HW_QUEUE(skb) == P54_QUEUE_BEACON)) priv->beacon_req_id = data->req_id; - __skb_queue_after(&priv->tx_queue, target_skb, skb); + if (target_skb) + __skb_queue_after(&priv->tx_queue, target_skb, skb); + else + __skb_queue_head(&priv->tx_queue, skb); spin_unlock_irqrestore(&priv->tx_queue.lock, flags); return 0; }