From patchwork Sat Sep 17 19:43:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 9337357 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4671860839 for ; Sat, 17 Sep 2016 19:44:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3890E291CE for ; Sat, 17 Sep 2016 19:44:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D583291EB; Sat, 17 Sep 2016 19:44:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5959291CE for ; Sat, 17 Sep 2016 19:44:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754535AbcIQTnw (ORCPT ); Sat, 17 Sep 2016 15:43:52 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33638 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752346AbcIQTnL (ORCPT ); Sat, 17 Sep 2016 15:43:11 -0400 Received: by mail-wm0-f68.google.com with SMTP id w84so1520643wmg.0; Sat, 17 Sep 2016 12:43:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=BjWnMOD2cxU72PgkDa3fwobwkdgYuky6AwT4z9e9oYI=; b=WQ4nbwB4BZ5JKrmdcEX9NYiXKAxUckw2YzqAS0gfAtUCMQ1rvD68OkGzrUmOHsRWFu FTW4M6v8buLS+8oM2YACBuzj6BneC33fk2TSRnom9+himTooqxrsBw4gfchv1Z6F7hKk 4zLcOsxV5/AbRCGX564VDP/OhCfZKpia8vkh+S942WwjaoynG+nsjbz3NqNhyM+lffw/ F7rGbnPG0auKfjSbuF8c1oKIxKiQZYXjb/gpOaOsCREJ5ivMP4UcDQMy7Klj7XVNhOPb WZ1TQ6o9TnYSOCF41biqzCcvAZOMC4pMujR+xeoMWtRxJbeXjg66arooDy1xeC20ed91 gF3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=BjWnMOD2cxU72PgkDa3fwobwkdgYuky6AwT4z9e9oYI=; b=MMAJKCaTybVRU2wHBxqNntCsrEYQL7SXe1HaMdO1PnmMwfzG7UBNVJbfNeeSu5PbD9 XJZAVDOlsgLKnjbEF82Fi7lTgqn5d5W3BYIvR0BbU9nk15Df2CGD3tfLpMPYfX3jTt8x TqcRR9C39y349L8c8+QAtMtPoQnPzVP4PHTNeJXCDVvYuwm1wnf2BoJLyQ6onnuMYQet QrErDwC1HQGL/u5b3m8ur0WHbWQLH/YtgpxkS7Gi42ObY3+MLVKS+znFzJt1V3mlVJeH dH7zyWAHxSKD/RnzxLq+LRRZ+Gwh3BJ8+JZ7nS1JfTioDgZs4FkaFmRR9T4KBZwHKDUd ru8A== X-Gm-Message-State: AE9vXwNlT36IqJDGOHaATtnx4BBcP9eU+P0yeJ2NHLpMII1T2Qr6hpeDWqBVLIbWTplrmw== X-Received: by 10.28.54.196 with SMTP id y65mr2730382wmh.73.1474141389988; Sat, 17 Sep 2016 12:43:09 -0700 (PDT) Received: from debian64.daheim (pD9F8BE97.dip0.t-ipconnect.de. [217.248.190.151]) by smtp.gmail.com with ESMTPSA id u185sm8012976wmu.20.2016.09.17.12.43.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Sep 2016 12:43:08 -0700 (PDT) From: Christian Lamparter X-Google-Original-From: Christian Lamparter Received: from chuck by debian64.daheim with local (Exim 4.87) (envelope-from ) id 1blLVz-0006ss-8C; Sat, 17 Sep 2016 21:43:07 +0200 To: gregkh@linuxfoundation.org, Kalle Valo Cc: Christian Lamparter , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, Nicolai Stange , Ben Greear , Larry Finger Subject: [PATCH 3/4] b43: fix debugfs crash Date: Sat, 17 Sep 2016 21:43:03 +0200 Message-Id: <60f368dd08cafebc3d39de18996d1df85f525887.1474140477.git.chunkeey@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <48411543620969bebb37a1a9ea7b8f451cdfdd31.1474140477.git.chunkeey@gmail.com> References: <48411543620969bebb37a1a9ea7b8f451cdfdd31.1474140477.git.chunkeey@gmail.com> In-Reply-To: References: <48411543620969bebb37a1a9ea7b8f451cdfdd31.1474140477.git.chunkeey@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes a crash that happens because b43's debugfs code expects file->f_op to be a pointer to its own b43_debugfs_fops struct. This is no longer the case since commit 9fd4dcece43a ("debugfs: prevent access to possibly dead file_operations at file open") Reviewed-by: Nicolai Stange Signed-off-by: Christian Lamparter --- drivers/net/wireless/broadcom/b43/debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/debugfs.c b/drivers/net/wireless/broadcom/b43/debugfs.c index b4bcd94..7704638 100644 --- a/drivers/net/wireless/broadcom/b43/debugfs.c +++ b/drivers/net/wireless/broadcom/b43/debugfs.c @@ -524,7 +524,8 @@ static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, goto out_unlock; } - dfops = container_of(file->f_op, struct b43_debugfs_fops, fops); + dfops = container_of(debugfs_real_fops(file), + struct b43_debugfs_fops, fops); if (!dfops->read) { err = -ENOSYS; goto out_unlock; @@ -585,7 +586,8 @@ static ssize_t b43_debugfs_write(struct file *file, goto out_unlock; } - dfops = container_of(file->f_op, struct b43_debugfs_fops, fops); + dfops = container_of(debugfs_real_fops(file), + struct b43_debugfs_fops, fops); if (!dfops->write) { err = -ENOSYS; goto out_unlock;