Received: by 10.192.165.148 with SMTP id m20csp2476100imm; Sun, 22 Apr 2018 07:50:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49AVX5qYwtUQan7vCQs4sr+/GzL4m+4n/5GiEY3m0hwB3XsZ3ME8Du9hexw1oJ7IhC9wXZb X-Received: by 2002:a17:902:bd03:: with SMTP id p3-v6mr17596217pls.236.1524408642238; Sun, 22 Apr 2018 07:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408642; cv=none; d=google.com; s=arc-20160816; b=k9gyZoNARCNJMIBW44YZL0Sg06LqQPxWnZx81ZMIgHK8/kQ2bckPGQicpMEAHizaDn xQIqpYjEQTTBCmiMxaTwJvkfzz2KAxV9h1gs/m4N8ir8xDHvIcBNeL3DMyNi6VIQQoTv NYB4rdGNQemqL+qdOG1NZi/9QMNKzFp6xfllf3s1687ZNhBMUPAGZkdLeu1t0MZjbNCQ KsDpUyqslgmOWucPJjeiaGYulvEBkM2PFH5a3JNRfXhj8k9Ws5GKQ5+w565lKNJYj/Tx ExGI+QIq6rOTQTTkF4lA0Qc/8rS8b+a5QobMs9s9XT3LPRXfr1hVjcz0kf+lxTrsv5hs k5zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=iUNr/JLEc8wB7SJbtakl2Sh3i338kodDQMiBIqressM=; b=NdQyhsFfR3I4lAtGzW2wpjCnxggHimtQThgA/DXT+rkSWeBUAU0vxcEU/ICF4s0OOw 0krPuyM0OT2EOrb0aYOaulFeKlOAlTMQmmWqxcbSu9Q3ExwKwUE7LEIlHZFMfVDMP3fr oRWMnPxKL+j560tUuMdtss5EoNB8lqY3JZUtzLc6IHy4I5k36RW3302ZTKGMb6NzU8Bs umlJBanHXfLV+v7ZOdOSVaJeiWbOTltI8Dm4QTKJNtWp25tXMyQcUA45EDlpR1YW95of muZbwR2SZ5kO5S9p/v1HHzQVV4BJ0Oc61kH1L+mIjwMJqtD/iZMJVpTA8hRzjZgjwvoG znpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u184si3316081pgc.223.2018.04.22.07.50.28; Sun, 22 Apr 2018 07:50:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932171AbeDVOPs (ORCPT + 99 others); Sun, 22 Apr 2018 10:15:48 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56948 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756709AbeDVOPl (ORCPT ); Sun, 22 Apr 2018 10:15:41 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BA33C12; Sun, 22 Apr 2018 14:15:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudhir Sreedharan , Kalle Valo Subject: [PATCH 4.4 14/97] rtl8187: Fix NULL pointer dereference in priv->conf_mutex Date: Sun, 22 Apr 2018 15:52:52 +0200 Message-Id: <20180422135305.425164589@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sudhir Sreedharan commit 7972326a26b5bf8dc2adac575c4e03ee7e9d193a upstream. This can be reproduced by bind/unbind the driver multiple times in AM3517 board. Analysis revealed that rtl8187_start() was invoked before probe finishes(ie. before the mutex is initialized). INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 0 PID: 821 Comm: wpa_supplicant Not tainted 4.9.80-dirty #250 Hardware name: Generic AM3517 (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (register_lock_class+0x4f4/0x55c) [] (register_lock_class) from [] (__lock_acquire+0x74/0x1938) [] (__lock_acquire) from [] (lock_acquire+0xfc/0x23c) [] (lock_acquire) from [] (mutex_lock_nested+0x50/0x3b0) [] (mutex_lock_nested) from [] (rtl8187_start+0x2c/0xd54) [] (rtl8187_start) from [] (drv_start+0xa8/0x320) [] (drv_start) from [] (ieee80211_do_open+0x2bc/0x8e4) [] (ieee80211_do_open) from [] (__dev_open+0xb8/0x120) [] (__dev_open) from [] (__dev_change_flags+0x88/0x14c) [] (__dev_change_flags) from [] (dev_change_flags+0x18/0x48) [] (dev_change_flags) from [] (devinet_ioctl+0x738/0x840) [] (devinet_ioctl) from [] (sock_ioctl+0x164/0x2f4) [] (sock_ioctl) from [] (do_vfs_ioctl+0x8c/0x9d0) [] (do_vfs_ioctl) from [] (SyS_ioctl+0x6c/0x7c) [] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x1c) Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = cd1ec000 [00000000] *pgd=8d1de831, *pte=00000000, *ppte=00000000 Internal error: Oops: 817 [#1] PREEMPT ARM Modules linked in: CPU: 0 PID: 821 Comm: wpa_supplicant Not tainted 4.9.80-dirty #250 Hardware name: Generic AM3517 (Flattened Device Tree) task: ce73eec0 task.stack: cd1ea000 PC is at mutex_lock_nested+0xe8/0x3b0 LR is at mutex_lock_nested+0xd0/0x3b0 Cc: stable@vger.kernel.org Signed-off-by: Sudhir Sreedharan Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c @@ -1454,6 +1454,7 @@ static int rtl8187_probe(struct usb_inte goto err_free_dev; } mutex_init(&priv->io_mutex); + mutex_init(&priv->conf_mutex); SET_IEEE80211_DEV(dev, &intf->dev); usb_set_intfdata(intf, dev); @@ -1627,7 +1628,6 @@ static int rtl8187_probe(struct usb_inte printk(KERN_ERR "rtl8187: Cannot register device\n"); goto err_free_dmabuf; } - mutex_init(&priv->conf_mutex); skb_queue_head_init(&priv->b_tx_status.queue); wiphy_info(dev->wiphy, "hwaddr %pM, %s V%d + %s, rfkill mask %d\n",