Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp11697rwb; Fri, 12 Aug 2022 13:16:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR4YVygocQsPccT6yiCCP50Ba3TtBA6KrCt4r9t07JzjGlXmhVWb1893ICgAT2+U5W+8LZXr X-Received: by 2002:a17:907:7b94:b0:731:1b11:c241 with SMTP id ne20-20020a1709077b9400b007311b11c241mr3707570ejc.676.1660335394954; Fri, 12 Aug 2022 13:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660335394; cv=none; d=google.com; s=arc-20160816; b=Bh/tURrjbH7C7eFarXAwnx3HcPLPKeUwKqAJsyMzIJERu4J1khQBxKbsgx866yn4Yl 5k0dUES/bg5WOT3/3uNZcgR0PQg1seE6R7Sn4QfyGtd6BxNapIG4xXJ2f6ou45Mr0FgM b2r8tR1SOIL7qBKhlPzJ6GXsHv08nhNZ2PzuMRAzhgkgD9C2QYqX4m0gi0rQH6FuWf4Z X9nmKkfcno+7i/qFWXkofBzNVbn6NtazydYaRS+w8YWqWzM8jMXZvldi5pDqtrc4H5jR gGRR2niWJvHGhiXf6CmPAoTe5VR0CDBrqUOVHvvJNxoFXjrLYAHAsjJ9JxCOQcBrEqFu QTCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:from:subject:cc:to :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=Iq/5xRoUiwhIFx5/vJDa4DTExyHthpSWn/1B/QHBuX8=; b=NzvJExC3ySoNO8v7gHVeJl/NEKs6/GQaEYYTnwTw4SOxQeLlw+BpMzdhDg6IdBhGSj jUD042oLH4BWjWIgyG/00gE+K1qamL6TMNsiSvmHBb7M3wkWXlbo5S594cbRbFNKnxwh SfkXZU8YfpQnYN+8twAQm89nS6YzPELhPFJRhHydagLXrtMEV6MAVxs3kNqIGnrzQwtP UfDWjffqDzk9KVMDp2OvWvCO1BaXB6bWlbtziwIDPjszdT64gSJ5QaPquOMoUC0sUXkU IXJZcJTijoeRszRBUwUhE9g2VXHCjQ4Eb72/JkBbpL+vr7dju8hJ/13IEGKSQ5LPlSOA qAaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kPsTgBeX; 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 ga33-20020a1709070c2100b0072afc158ff0si2536158ejc.315.2022.08.12.13.16.00; Fri, 12 Aug 2022 13:16:34 -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=kPsTgBeX; 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 S236046AbiHLTlt (ORCPT + 99 others); Fri, 12 Aug 2022 15:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236062AbiHLTlr (ORCPT ); Fri, 12 Aug 2022 15:41:47 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E81F3B284C for ; Fri, 12 Aug 2022 12:41:46 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id l4so2169214wrm.13 for ; Fri, 12 Aug 2022 12:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:from:to:cc; bh=Iq/5xRoUiwhIFx5/vJDa4DTExyHthpSWn/1B/QHBuX8=; b=kPsTgBeX9cktKrXNkL/lPRmjzfAy4L6XD79mQmQG95/00rEk+ceM3GIn4BgNva38hg amUDp2pkk6KTBKklZzBmhq3a833FiUIfLr68tYN8bqJ73UZbCacqTMmc1q41irSUPPHv AhHuuw+LV+MiPtKSneGmZ6qWXS+1E7a/8hgazVTRHxk5jcSjaguDUBylbsrgybIH685R 0hA3gK1l7201GHKEBLPIC6zeZzBqqL1Eu3/V529Q2pR6EjALlleAzg15z/+dBhpKNs/7 xZfFKycaDbcDdlL/Ivv88WYV0K+poyzmg7JTSWHk7IsjkmRHzZqz0SP2qGp3bZ+ZsVLL opwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc; bh=Iq/5xRoUiwhIFx5/vJDa4DTExyHthpSWn/1B/QHBuX8=; b=p+bvwF6RzgGMVXNhaGoQFxGCUuouKVcAU0UuPlVt9hjQj+U+iz4c6LhZ2EeA02FuzV W3/dZ6iHF3UD8ltHCIzA6WwMtA0+xqeC91A2/uHv/p1uVM1MHWqYdp1ABJezUxVDw19S CL8aRMeV76TkHo+NvxPKRzGZk127yU6XtCUERUlKAaN7CwW6dw1upAO9WaH5dnhQ2ZIa I4xKeMRhAitchsteNXUZYbRqRPzzJL0vA2poGE1tCZ6mDdl29xCMRtL7cfgaW7F11A4A gNgg2W+UE5g6MqEFXB5aqOr9+wK+/Di1uXoX+iRTaJxgttz2GC2dJImi5yqGyTuoZvFu lTTg== X-Gm-Message-State: ACgBeo1GM+3t1EgNY8p4WiweHF7F0W7dirc6pt4rAqSi4IrCWokWNcjB r+0BIvmuI5FnV7XMJPsg0/L9AnVJU9QgnfL23sQ= X-Received: by 2002:a05:6000:10d1:b0:220:5c89:50e5 with SMTP id b17-20020a05600010d100b002205c8950e5mr2999111wrx.335.1660333305255; Fri, 12 Aug 2022 12:41:45 -0700 (PDT) Received: from localhost ([84.255.184.228]) by smtp.gmail.com with ESMTPSA id q8-20020a05600c2e4800b003a3561d4f3fsm384771wmf.43.2022.08.12.12.41.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Aug 2022 12:41:44 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 12 Aug 2022 22:41:35 +0300 Message-Id: To: "Starke, Daniel" Cc: "jirislaby@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-kernel-mentees@lists.linuxfoundation.org" , "skhan@linuxfoundation.org" , "paskripkin@gmail.com" , "syzbot+e3563f0c94e188366dbb@syzkaller.appspotmail.com" , "Greg KH" Subject: Re: [PATCH] tty: n_gsm: fix missing assignment of gsm->receive() in gsmld_attach_gsm() From: "Mazin Al Haddad" X-Mailer: aerc 0.11.0-85-g6b1afc3ae3d8 References: In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Wed Aug 10, 2022 at 12:08 PM +03, Starke, Daniel wrote: > > Fix this by setting the gsm->receive() function when the line=20 > > discipline is being attached to the terminal device, inside=20 > > gsmld_attach_gsm(). This will guarantee that the function is assigned= =20 > > and a call to TIOCSTI, which calls gsmld_receive_buf(), will not > > reference a null pointer. > > In my opinion there are only two possible ways to fix this: > a) Move the gsm->receive initialization from gsm_activate_mux() to > gsmld_attach_gsm(). > b) Avoid calling gsm->receive in gsmld_receive_buf() if not initialized. > > The current code might assume that gsm->receive is only called after MUX > activation. Therefore, variant a) may break the code in other places. > I see no need to initialize gsm->receive in gsm_activate_mux() and > gsmld_attach_gsm(). Thanks for the feedback! I will send a v2 patch that implements a check shortly.=20