Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1212066pxx; Tue, 27 Oct 2020 10:49:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRFbPgemBvKiaP1b44/cBGoepZEOhTJCh6KIG8aZ3nT9WL8J55fKmdEckCSQ5CnYjvwg/4 X-Received: by 2002:a17:906:f185:: with SMTP id gs5mr3509443ejb.107.1603820956984; Tue, 27 Oct 2020 10:49:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603820956; cv=none; d=google.com; s=arc-20160816; b=lcc5hrktV6VdTesyG44SEEUylNEJWuruOOzWkJqZt3Sbtm4udKpWosYMwpEn2AYPk8 NQINh5O3s4iboZM64J8g7Puqt7oGnqtDZM3e9T3BNr/tXvli6VCuEcTQF/jYwi8SJgXP MnxGaTgGlYzmo1sc1sQvEeoAYZVw1ZpX7kecxoPf0VE1JeloCJJuSox2Hv7UNJ7c+NVf T9trfReU/n6mPO7AhVvT+cfo4KVc6GwwELq1zmF2/KESjOO356auiZhldyq/ndKgqZ8g vx4BWtDyprAgI0V+bfI748kkY484VA1RralUzmyVpI3mxr3fJ0CoeQUYVc3fvfaLTfI/ 2PIQ== 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=KkFQ9tisYk+oLJZzFtW6qFgVGeNmm8/91li3euIDCL4=; b=Q02mvFNp/O9o5b/ijsEJynJQjutejta/61qj0dM7R0WtrqUUo+ZvRTiTYlzXUKcDcr VtmcW0xElHkc8cv6a3be2ItNg7box/qIB2V3kOYsCtxLCc1uA7X+d4Jp2vf6CQMXzQ8R DdsOUG7ksiqUN3ZR/obQGwquKi/IZDFe3liDCC1WK1rfshV+hPY53+4Ofk9U0JJ4dAaT iMq95QOIzza/apioyxANbFBJAyEYIsBW+yPuHY0QRbZoohBRMNz7s6C90rPQfXICPwva cHc7HYjOqqtVBWD+kdz551DvuxI3yh6aRRvsQ4MN8d3Hd91kVaFJl13h4tviS8olvfy8 LhOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="S/zIdsxC"; 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 d12si1724338ejj.595.2020.10.27.10.48.54; Tue, 27 Oct 2020 10:49:16 -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="S/zIdsxC"; 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 S1781948AbgJ0O4a (ORCPT + 99 others); Tue, 27 Oct 2020 10:56:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:46328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764157AbgJ0Oq1 (ORCPT ); Tue, 27 Oct 2020 10:46:27 -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 A675520773; Tue, 27 Oct 2020 14:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809987; bh=9bdljlj0og6yj1113oLlLPoGPsY+WEZ0OnPIY9wahxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/zIdsxCcjtmWeAYOefd8G2zsWnyEwwBOUh7/8bV8/Maf5cEGBZgGZRZKlD6pHoZP XJi6EJZ5R2R9MpDFcSF7vKq3/9/qjv8K8t8W22tXpUwmfzcHXfGMOczm2w2P0/OfJ6 FmK/LVpq7Y1hWzKaTK+MH1wqB2DMSHVzCTKSRObg= 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 5.4 390/408] mwifiex: dont call del_timer_sync() on uninitialized timer Date: Tue, 27 Oct 2020 14:55:28 +0100 Message-Id: <20201027135513.071682368@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 c2365eeb70168..528107d70c1cb 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -1353,7 +1353,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