Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp193291pxx; Wed, 28 Oct 2020 02:19:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwggRW2QPuct3imQ/hZoo5koguSeUpfzcACbFzcQ8D33GcdZabEsPaJY+8Ry8GWQgKR55qn X-Received: by 2002:a05:6402:1615:: with SMTP id f21mr6982731edv.257.1603876752096; Wed, 28 Oct 2020 02:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603876752; cv=none; d=google.com; s=arc-20160816; b=abFt1VpxaubQLeKzG3Ixp+ugAxRK4BCC3INTrsHVbnHBM64EVr7PH5HCOKu63eYBdZ IBPGuqdI1GP4p65oH8Smxsi6n30x7CqNVR3+uiZ2/SrBVA42FAOBfMmetKDRvCXdWIVp L7fIb2jqs4eNJEoGICJMqXXoFpNmcwoJR2ljLsPVcXL3/1oo0d3ZuJHuGxj9gwnp/HXL prmQTa8TgISdfidoh3bCotxGkTDIcxeroZW+kJpPXUuaKgnoCuvsxnKxtVEYMS0EEAL4 6Y9euuSEn/bNKrTKwLZHckSrA1OMJaGwVj1AvxzyZzP5n66deMQcnQ0sBmGi5QUPVDzs 6VRQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D7s20osoYBOB8EVj6HCWY/zOZk3I6/flaHMH1UFdvq0=; b=LU1VUJplS/vruKRix1ns0hnmGmKT1ErkQgm7XFv4eVn7EbTKBztIY8x44oErYsKrJJ sgcddwpg6+yrwX7gEQZWuatEe6d6y2rb8O9OdSdAjoz6Er6qKPwGJu8XvW2xn6sHxgQq CMHD5Je8F4fjOnWgfNncL6WWoRSgbatEKJ9KSPDnTjEW6Zbcl8bMN2t0J3TZyRSNgDrQ bg0F6J48RO2hdE/ZsTf6I93PMyMcytdXsg8Dt6+LQPM1YkfzoYBfIlpsVwOhyJNtat3L 25cNZpE2tBx+pDAKhKCp7+uaGKuYJpwLC/Q2CvJ6ma/p6a4aRP7i03Thq3mmkaqBIsFl ZNqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OmV9JNvd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si2969573ejk.629.2020.10.28.02.18.49; Wed, 28 Oct 2020 02:19:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OmV9JNvd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757381AbgJ0OS6 (ORCPT + 99 others); Tue, 27 Oct 2020 10:18:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:38104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757066AbgJ0OQG (ORCPT ); Tue, 27 Oct 2020 10:16:06 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 268462072D; Tue, 27 Oct 2020 14:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808165; bh=ENhYOI+QU7ybTUoEpjs1AxbjjXkfmaC7fwvl73sHl0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OmV9JNvdpdpF6hk+65xrqz2F8VCkq2kQY4Jg5zzLIrws8snIbI9hvlkwP836tNe+k IQt9Ot92yfS59Kfgyr7NY9DS/YjwVYZn7YJWkb//M43/4XS4CNRfz7TT2xvCcvpe99 Va/+bHKPSytoVnurTyLjQ8U9YyRaCowycdiamZ0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Ganapathi Bhat , Brian Norris , Tetsuo Handa , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 181/191] mwifiex: dont call del_timer_sync() on uninitialized timer Date: Tue, 27 Oct 2020 14:50:36 +0100 Message-Id: <20201027134918.438826185@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tetsuo Handa [ Upstream commit 621a3a8b1c0ecf16e1e5667ea5756a76a082b738 ] syzbot is reporting that del_timer_sync() is called from mwifiex_usb_cleanup_tx_aggr() from mwifiex_unregister_dev() without checking timer_setup() from mwifiex_usb_tx_init() was called [1]. Ganapathi Bhat proposed a possibly cleaner fix, but it seems that that fix was forgotten [2]. "grep -FrB1 'del_timer' drivers/ | grep -FA1 '.function)'" says that currently there are 28 locations which call del_timer[_sync]() only if that timer's function field was initialized (because timer_setup() sets that timer's function field). Therefore, let's use same approach here. [1] https://syzkaller.appspot.com/bug?id=26525f643f454dd7be0078423e3cdb0d57744959 [2] https://lkml.kernel.org/r/CA+ASDXMHt2gq9Hy+iP_BYkWXsSreWdp3_bAfMkNcuqJ3K+-jbQ@mail.gmail.com Reported-by: syzbot Cc: Ganapathi Bhat Cc: Brian Norris Signed-off-by: Tetsuo Handa Reviewed-by: Brian Norris Acked-by: Ganapathi Bhat Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200821082720.7716-1-penguin-kernel@I-love.SAKURA.ne.jp Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index 50890cab8807b..44d5005188c93 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -1335,7 +1335,8 @@ static void mwifiex_usb_cleanup_tx_aggr(struct mwifiex_adapter *adapter) skb_dequeue(&port->tx_aggr.aggr_list))) mwifiex_write_data_complete(adapter, skb_tmp, 0, -1); - del_timer_sync(&port->tx_aggr.timer_cnxt.hold_timer); + if (port->tx_aggr.timer_cnxt.hold_timer.function) + del_timer_sync(&port->tx_aggr.timer_cnxt.hold_timer); port->tx_aggr.timer_cnxt.is_hold_timer_set = false; port->tx_aggr.timer_cnxt.hold_tmo_msecs = 0; } -- 2.25.1