From patchwork Wed Dec 16 18:45:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 11978375 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F14CFC0018C for ; Wed, 16 Dec 2020 18:47:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0692233F6 for ; Wed, 16 Dec 2020 18:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731954AbgLPSrM (ORCPT ); Wed, 16 Dec 2020 13:47:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35708 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731952AbgLPSrL (ORCPT ); Wed, 16 Dec 2020 13:47:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608144344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=AIYzajPVqHtLZ185/oHUDAZObqULmJkX3kgXqig0Nww=; b=dKd3irJt8yFDfsRpoNG1l3NjAj9wD2MninoWkMP5Q0S5ztpJ/SGe6YmlnfEJrue5so5MtZ qRQ3k5WlLg942h2MIRLHeXin/UgDLu1I2SIi44us576lWWVJVdXaTn0dKXXn47VktdTu0S 6OBM52UR5HWu944ZM75yVHhv2/H6Uh4= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-69-80Bdsi6CO-2Ipt2S5PMYDQ-1; Wed, 16 Dec 2020 13:45:41 -0500 X-MC-Unique: 80Bdsi6CO-2Ipt2S5PMYDQ-1 Received: by mail-ot1-f70.google.com with SMTP id j22so772129otq.16 for ; Wed, 16 Dec 2020 10:45:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=AIYzajPVqHtLZ185/oHUDAZObqULmJkX3kgXqig0Nww=; b=AH3uGrb9o6rx2kBIDCPuDHpNG9ZrHuYccJJBUKHIWu+znzD5FfUSdfx7QDck5nBgoL F2M02ZB41kZqYe7qT+M1d6g/r1vPRKlDD2sfz05l8O3StRph+lSAf49OSmyXQt2iMc9Z HzRL+cHkkPOANAKTSqhFrhK++QsZ+q6KPZxDYCWSjARe9lC2TCHOPj15v8rKsjg++rMT ogNw+x6TlMrayqoKe0zj3tYa/lsgz8Tk5YMVYwJoInD4vSQWzjEtWJ2NWECgG78CVbPI wbB4Of/ylCa964un4xkRfWaZqF9pX3GQyiGrC+w2NAMe3xvo8c8Abq0OzIXl6+dMD0qP 1M2w== X-Gm-Message-State: AOAM533BYMC5ft/xowfnrJrzC9noTiuXMQHmT5SyHWzbofnODiDV0eQV iTbDyfMQ88i4FEQvZ9GTMB7ikVAC2SdMEWFKnwhfmYSQ21l21TfAsLBjUckhry4tVDM5Ez8Q8H/ 7YJWa02YaSQWVt0q+4SDeMpanalI= X-Received: by 2002:a9d:57c8:: with SMTP id q8mr25808871oti.168.1608144340627; Wed, 16 Dec 2020 10:45:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOQqi4/yux6aAX39ztSbeycJrClcF5P87lNAvEc5K8jlJje3O3jOY6pM0hmEbZ6XnhgYUpZg== X-Received: by 2002:a9d:57c8:: with SMTP id q8mr25808862oti.168.1608144340485; Wed, 16 Dec 2020 10:45:40 -0800 (PST) Received: from localhost ([151.66.8.153]) by smtp.gmail.com with ESMTPSA id w138sm571033oie.44.2020.12.16.10.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 10:45:39 -0800 (PST) Date: Wed, 16 Dec 2020 19:45:35 +0100 From: Lorenzo Bianconi To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, nbd@nbd.name Subject: Fwd: [PATCH] mt76: mt76s: fix NULL pointer dereference in mt76s_process_tx_queue Message-ID: <20201216184535.GH2036@lore-desk> MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Kalle, Since net-next is closed now I guess we can consider this patch for wireless-drivers Regards, Lorenzo Fix a possible NULL pointer dereference in mt76s_process_tx_queue that can occur if status thread runs before allocating tx queues Fixes: 6a618acb7e62 ("mt76: sdio: convert {status/net}_work to mt76_worker") Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/sdio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index 7cd995118257..0b6facb17ff7 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -157,10 +157,14 @@ static void mt76s_net_worker(struct mt76_worker *w) static int mt76s_process_tx_queue(struct mt76_dev *dev, struct mt76_queue *q) { - bool mcu = q == dev->q_mcu[MT_MCUQ_WM]; struct mt76_queue_entry entry; int nframes = 0; + bool mcu; + if (!q) + return 0; + + mcu = q == dev->q_mcu[MT_MCUQ_WM]; while (q->queued > 0) { if (!q->entry[q->tail].done) break;