Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1011411rwi; Mon, 10 Oct 2022 10:00:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WPIjSuwSQQuMi/SXgNSv0IfgPRPrkONm7bw6HuqkQ2zkXBGRL6DfBG3cJZ6jycDdH6ldQ X-Received: by 2002:a63:8141:0:b0:460:5be4:f6a9 with SMTP id t62-20020a638141000000b004605be4f6a9mr10554125pgd.368.1665421228861; Mon, 10 Oct 2022 10:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665421228; cv=none; d=google.com; s=arc-20160816; b=HZgKn86LqSL9UTOr14sXWqRD1BSuWU+4AXam/Vt8Ue8mhWNRLJbdxctF6jgYPbtBjw BP15iGI3p+DbyDWeY6tTnKPYCOCYASHwQpuNnhUsdIluJuqraxp1lpcX4oow8jS8BBzI sLgQEcoHcmAQLLTtM1SQ4F/fkYRvhxtu8XX+VmtxT/84R/SNJj0ZyPPLboA+h1uSIj7V bv2SNqVNR68huwXYZf0Mk8329t5R80of8utg9SDKylVVHKh+q2VTyvIUU5Hc846rvw2A ov7Q0ah+ZvTQZ5Qqy9CjrhHpJMDzjOcI1Kxrwgp/KBB9oaaYfN9UBlPoXmnHuYN2AOEr 2xOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=F7Lu1f1l8aXMTq6jYWIMcge3Ms0HY5uTYXjKT0lkG14=; b=jwhtpflF60P6SeXhKz1EzpcThBQNU1jYXXilL/qEo242J37bpqCtufgfS7PMaWzi4q Dvl8rOb5uaaF0PR2s6168IoAarxkf+KtOPac/kdZQ1wKy/AGJUuBF4CjxJCkwg9Fl3MV tlkagA0gYnBvJ/3OwMTwECBsrdHufuoubrO19IZqAIl6CuOdfNKT0rG1pLagLyc2M+RF YCgc5ZwTeRBEMDNQe4p0aUE34Fw0qu9BbNlmhBwxcwmf2Z7sda4arRTow1sUsdOouh9x SIpzpLbrl0cAILwMuJXHH3tTY/uXhVHNuw2D9a3Ibp+U/agnsortaC9matmgPLpLW7BF P0VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LdYp7um8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ip4-20020a17090b314400b00200b2126ebesi21381435pjb.168.2022.10.10.10.00.15; Mon, 10 Oct 2022 10:00:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LdYp7um8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229821AbiJJQ5B (ORCPT + 99 others); Mon, 10 Oct 2022 12:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbiJJQ47 (ORCPT ); Mon, 10 Oct 2022 12:56:59 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 593541A3B7 for ; Mon, 10 Oct 2022 09:56:57 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id y100so16742654ede.6 for ; Mon, 10 Oct 2022 09:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=F7Lu1f1l8aXMTq6jYWIMcge3Ms0HY5uTYXjKT0lkG14=; b=LdYp7um8bF6F6J2/ysqRXdpaB/GcUaACZwguVsd/lWFeKR5yqORlsqxo6VVPuIdbZX 8MzHwUbPmzzcc7CmQMUnPdA4nuBBdYe0g/oi4UkUQi1l9o7AYYrjOlYtKZslj+a5AYWm 7AJIlTxmecC0t1wLZEDQALOBCWDzg2io6FNoRFO+u2cy48X/SzgJo1Z3y+eGGm5MbSUx CqW3pcwbDyA+j1aVP83PhOHJldBExhBhzDnFl3WpkRFzgjvw3kLIkyTKpRsRrDJQFzHm 1Tn0PxLKnZlgvj65SIi3Jo2jJ4CjKOmnworW807rhEzXV73FU8/v2QA7fJShX5iprBwc Adeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F7Lu1f1l8aXMTq6jYWIMcge3Ms0HY5uTYXjKT0lkG14=; b=CJLcBZqLck9M6N8+9ghsMXVX9v2g4QcUaXtjP2D5/LZHyuXXLC28Bx/kaVBmVev5fO OmwJk0rHSrJTETfvs9h3WVfycKsfl2SIrrn3XPv92+ESrIrxb+mIVr4VucsmG0c3nmy+ zQJJZ3ScaxfKoBEXMEseab3rTEi3/zo9o6glikTO9hHaMN4DR1w6S1eEiHxdyajAuFRU vKJhmT5HzS1xCW8ejxtyr9KMxN1Sv5i/sVUmF62Hw8hfAcXTugAklUvNIjdq8NZE96Ja inkJ3Adidc1Su4dpKTx29PJ+EHImULWKtkRKb05cv3MY5k+JVKUYHjIgIma07V314UvS fn/A== X-Gm-Message-State: ACrzQf3dancX2u3juMqM+zJvmdGreDoAg8H/H4L2g2zfIDUhnP6U/sBD +3Dkvg1VCAEv7FMFeuKjbiw/5idE4c/cHA== X-Received: by 2002:aa7:cc8e:0:b0:457:23db:f0cc with SMTP id p14-20020aa7cc8e000000b0045723dbf0ccmr18818781edt.122.1665421015814; Mon, 10 Oct 2022 09:56:55 -0700 (PDT) Received: from arch.localdomain ([111.119.183.43]) by smtp.gmail.com with ESMTPSA id a1-20020a50c301000000b004580b26e32esm7421429edb.81.2022.10.10.09.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 09:56:55 -0700 (PDT) From: Mushahid Hussain To: gregkh@linuxfoundation.org Cc: samuel.thibault@ens-lyon.org, speakup@linux-speakup.org, linux-kernel@vger.kernel.org, Mushahid Hussain Subject: [PATCH] Speakup: fix a segfault caused by switching consoles Date: Mon, 10 Oct 2022 21:57:20 +0500 Message-Id: <20221010165720.397042-1-mushi.shar@gmail.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes a segfault by adding a null check on synth in speakup_con_update(). The segfault can be reproduced as follows: - Login into a text console - Load speakup and speakup_soft modules - Remove speakup_soft - Switch to a graphics console This is caused by lack of a null check on `synth` in speakup_con_update(). Here's the sequence that causes the segfault: - When we remove the speakup_soft, synth_release() sets the synth to null. - After that, when we change the virtual console to graphics console, vt_notifier_call() is fired, which then calls speakup_con_update(). - Inside speakup_con_update() there's no null check on synth, so it calls synth_printf(). - Inside synth_printf(), synth_buffer_add() and synth_start(), both access synth, when it is null and causing a segfault. Therefore adding a null check on synth solves the issue. Signed-off-by: Mushahid Hussain Signed-off-by: Samuel Thibault --- drivers/accessibility/speakup/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/accessibility/speakup/main.c b/drivers/accessibility/speakup/main.c index f52265293482..73db0cb44fc7 100644 --- a/drivers/accessibility/speakup/main.c +++ b/drivers/accessibility/speakup/main.c @@ -1778,7 +1778,7 @@ static void speakup_con_update(struct vc_data *vc) { unsigned long flags; - if (!speakup_console[vc->vc_num] || spk_parked) + if (!speakup_console[vc->vc_num] || spk_parked || !synth) return; if (!spin_trylock_irqsave(&speakup_info.spinlock, flags)) /* Speakup output, discard */ -- 2.38.0