Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1054360rwb; Thu, 1 Dec 2022 11:41:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf42a8Am05N8X57dqQ0XtBAznlBlUXkLcAKVP4ZT4Ol+Nys+y2kKX6CGHP6L+PBV00YAxoRC X-Received: by 2002:a17:90a:67c1:b0:212:d484:b410 with SMTP id g1-20020a17090a67c100b00212d484b410mr78870884pjm.211.1669923706358; Thu, 01 Dec 2022 11:41:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669923706; cv=none; d=google.com; s=arc-20160816; b=RNB1CJr66vWKy6HzKLLbnbQ5Q45MJbxlsY5BPy7o3+mduNRtbYhVv8kD8Mw90giY4f dApdXddFYADlHIRPUjXyXkb9mVusU99U9fafrrZLUbvccPjxTnc2NLCSPu5/rqIyf/6W Z6i86Qp1DYKeV0cqFtcubejS/+/n2TXSo3oBll/q6+0wiARMgcI3So1Ka1/tD0qwrcqR ZkZ25VQz46fdY8ootPbOzVmB2s7VXUafGjoFXBvM/pnnVfr10qTz0pWJQjQp/vMyl/R7 Syl8J65/977Lp4gk8Sa+DPao0IK6IX2BIBDHsDnw1Dx/0RZZq0vq6J9r0Rv7+70ueSFt 2MRQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=8eBwg/WkVKKRq5V5iuZT02lew7yh9xvIm2cx4SjW0HQ=; b=r8ncksj7uzfUkIiig85zNXq0fC13FfXtDuKnwaCPtA6+N2jtYbD4MCFUzrV7b3l7Ow M9ACX2XWgihw1UglfFL8KJsHDqv3MrwD7uZZYjuA8D4G4gQua9V9BEWWB5coLWCQUGHb XWwKuyf1heMTZUmQthfnNiTSyerOu643Ip2GXcmkJ7BF+Otk8k7xvu/46cfZ9DTSEOAx DYHjtdqkYKXqJkmaNl8djmbtJhnFJ7inhWIViEDtNJ2KDXs6OUZy1RsK8M0NGwhA158K BPW+rWaNTQ7+ppNkO7NJlbvy7RA34bVo6/EJuDiQowOb9GafWSsTHUZd6BaL5ToU+V+/ i+aA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a170902ce8600b00189274c157bsi475825plg.518.2022.12.01.11.41.36; Thu, 01 Dec 2022 11:41:46 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230334AbiLATAU (ORCPT + 82 others); Thu, 1 Dec 2022 14:00:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbiLATAT (ORCPT ); Thu, 1 Dec 2022 14:00:19 -0500 X-Greylist: delayed 440 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 01 Dec 2022 11:00:16 PST Received: from mail.enpas.org (zhong.enpas.org [IPv6:2a03:4000:2:537::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2BD1DC23F4; Thu, 1 Dec 2022 11:00:16 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail.enpas.org (Postfix) with ESMTPSA id A3484100AD8; Thu, 1 Dec 2022 18:52:49 +0000 (UTC) Date: Fri, 2 Dec 2022 03:52:42 +0900 From: Max Staudt To: "Jiri Slaby (SUSE)" Cc: dario.binacchi@amarulasolutions.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Palethorpe , Petr Vorel , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-can@vger.kernel.org, netdev@vger.kernel.org, stable@vger.kernel.org, ltp@lists.linux.it Subject: Re: [PATCH] can: slcan: fix freed work crash Message-ID: <20221202035242.155d54f4.max@enpas.org> In-Reply-To: <20221201073426.17328-1-jirislaby@kernel.org> References: <20221201073426.17328-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 (CC: ltp@lists.linux.it because Petr did so.) Hi Jiry, Thanks for finding this! Your patch looks correct to me, so please have a Reviewed-by: Max Staudt for both this patch to slcan, as well as an 1:1 patch to can327. Some history: This is actually my code from can327, which was backported to slcan as part of Dario's larger modernisation effort. The rationale for moving it was to flush the UART TX buffer in case of ndo_close(), in order to bring the device into a more predictable state between ndo_close() and ndo_open(). I guess that's actually counterproductive - whatever is in the TX buffer at that time should likely be fully sent. For example, can327 sends one last byte to abort any running chatty monitoring mode from the adapter. So your patch also fixes this as well ;) Of course, this resulted in calling flush_worker() in both ndo_stop() and ldisc_close(), so I wanted to avoid code duplication, and relied on ndo_stop(). Oops. Thanks, Max