From patchwork Mon Nov 13 09:45:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 10055443 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 C04406029B for ; Mon, 13 Nov 2017 09:45:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B62DF291F8 for ; Mon, 13 Nov 2017 09:45:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA4C72920A; Mon, 13 Nov 2017 09:45:52 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 90176291F8 for ; Mon, 13 Nov 2017 09:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751122AbdKMJpv (ORCPT ); Mon, 13 Nov 2017 04:45:51 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:54779 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbdKMJpu (ORCPT ); Mon, 13 Nov 2017 04:45:50 -0500 Received: by mail-wr0-f194.google.com with SMTP id l22so13825290wrc.11; Mon, 13 Nov 2017 01:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=+zafvvr9g5G3zs2qQYqXWRfBDZn+PBhfczrefTz9zCI=; b=rhDwUjqVV+RnAVm5vnsuICj3bd46GjIPSqKS4oUpADOQgRQaYIXJdOZf5m8XOMwOt+ aor375utmgx8Nq+kaDKjuM2Tn/h7m7z7Z1rbtbmfjYlarWeyRsbANMfhSrmGSqqbovZd p6mKJw1H9dCfyxz//ejinsaryBCvQzWGRbC/7YX3AYMy/XoCO3bcFMZp9qMp3QI8ZjNS mQ+WhggvyxT5axlZnqTl0Albyn9IpWtNwPwGKrZ7e85RPoqjJAmH2+epQkC6l54rFUHx dZKceV+SwgJMfP0YI4DsSXNZZImnGF2ojpWTP+uX6LOswB+LwgZgEbYIrXVJB1ueq/ju sDSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+zafvvr9g5G3zs2qQYqXWRfBDZn+PBhfczrefTz9zCI=; b=LAA/SWJtBf1Z0PUN7bEeklAyiyD76f+Yl2i0Q/GasU6Jmu8d1OdwI+HMxNDr6wcMBN 6OcCuD0zq0fry5TE16RqCwFXbcin4W313mPvIK+TRiIWs5mYV1+vo4aW+xPUqZoGZuXz Y4EOiyLTIOMXp/nL5GoPVmQ/uz80VEkul2M+SxqoOMYE7SdgfMt/80khpmYoKETxvCNH Lu0WwK+qpjFCG/c9OhTtn1Xey4Y8aj/MP+UczWJJ/FAfFTY5C2jPol28TkbiLALFiX/E jv90iAabi1wsxKkMvTU50cyGg0KsI6t6CLUtMyw13W0bmiiKdK/0M8nzCnXuSLOnDMnW yNQg== X-Gm-Message-State: AJaThX7IpYWnD5r8On92pqg8JboeNH1Czzzn0J6RuyaKtZkAwLUQa8Il NwvIsFNaJ2HNfHoyb6N+WAg= X-Google-Smtp-Source: AGs4zMYHN8mHBOEfUf1Upn3CxmVvwrHgWBEQMWC5CsBVxSIWCav1oEz28MZ/zepSiHtwFogpSDQcJw== X-Received: by 10.223.139.8 with SMTP id n8mr5810249wra.225.1510566348726; Mon, 13 Nov 2017 01:45:48 -0800 (PST) Received: from localhost (p200300E41BCE5F0013EC961859056908.dip0.t-ipconnect.de. [2003:e4:1bce:5f00:13ec:9618:5905:6908]) by smtp.gmail.com with ESMTPSA id h3sm25730916wre.63.2017.11.13.01.45.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Nov 2017 01:45:48 -0800 (PST) From: Thierry Reding To: Bartlomiej Zolnierkiewicz Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kees Cook Subject: [PATCH] fbcon: Initialize ops->info early Date: Mon, 13 Nov 2017 10:45:46 +0100 Message-Id: <20171113094546.16593-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.14.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding During console takeover, which happens for all DRM/KMS setups using the fbdev helpers, fbcon_startup() is called before fbcon_init() and as a result con2fb_acquire_newinfo() will not be called (info->fbcon_par was set to non-NULL in fbcon_startup()) to assign ops->info. This causes the cursor_timer_handler() to unreference a NULL pointer. Avoid this by unconditionally assigning ops->info during fbcon_startup() so that it will be available early, but keep the additional assignment in con2fb_acquire_newinfo() to support console remapping at runtime. Cc: Kees Cook Signed-off-by: Thierry Reding --- drivers/video/fbdev/core/fbcon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 3b4a96379128..929ca472c524 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -962,6 +962,7 @@ static const char *fbcon_startup(void) ops->graphics = 1; ops->cur_rotate = -1; ops->cur_blink_jiffies = HZ / 5; + ops->info = info; info->fbcon_par = ops; if (initial_rotation != -1) p->con_rotate = initial_rotation;