Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp439314iog; Mon, 13 Jun 2022 06:03:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXq2VHDFC21KlsuVbJ1/FUu2Erftic1dJy/Z5dpNxWb361APHo9GYJHI/LqvDuueRBQ5Av X-Received: by 2002:a17:906:7308:b0:710:dabe:d651 with SMTP id di8-20020a170906730800b00710dabed651mr42875920ejc.75.1655125295176; Mon, 13 Jun 2022 06:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125295; cv=none; d=google.com; s=arc-20160816; b=chym2tYlaHgG6Hcg7mTg2a21tth+SxxU2tjceo/95wqwL357uOIrPuKaN63P+kqOS4 nhPgGR7EQkDr2b6KjbY7cAOkjCjYwmHAaRjF3gqNp2w8HgWDvBOz7aU/dCbL+GGi9zMM IM9WCVOMCz2VOk0Whc7NF+NiOWu96KPbCI7oP2Hzvyo+gUnRLPJpxXclnESr3O6FkZCd XMVDcSBPIEszm6tyIlkSL0vkyneIkIooIvNRgjIMq9wnmqPH3sR1bO1s/fPz3iPCn64J Heis6+SE5LYVIUDOMUOPGEm7hajlJ0CALXgloj61SqPBZ9VGLyjoC9n89yS83EQu7VRY NB5A== 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=GhhB4MsmRAceXnLEOsnvAmLepBWyMZXiGsf+sWPy8S8=; b=FuSV6olj7+9AhtoZ/VfcS6QliwQTNbU86aB1M9CNyFBPFIeVk2dRlFRYami6N4LAaZ mjrnE+oh4yWG7W4btdqWxXMZJr2NNNcDy4bO8WsIKN2G+ddqRgdzTroWHxqE4OTFkstw KphVCUj7KfAvzOXsIVyEZ8vnWEivB0kZA71FrCt63QAOAgg/mcS7rHFrDBfnZ206A48+ RzxsEn1c+YqTOfLfTEWZCgwvAqiWSB5k8+dZT64HdxGuUD52ZteUtLpdzUSeWk1f8Ykg 5FDOODqZiLhdVfXAoCb7IY59/4Y37CGAm0uS7CXQSZVUROTWIyhJqDjoI/XUP3Sv5KBN yBZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iWrTJCrC; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo12-20020a0564020b2c00b00425c6df678bsi7306400edb.377.2022.06.13.06.01.07; Mon, 13 Jun 2022 06:01:35 -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=@linuxfoundation.org header.s=korg header.b=iWrTJCrC; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349683AbiFMK5p (ORCPT + 99 others); Mon, 13 Jun 2022 06:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350036AbiFMKyj (ORCPT ); Mon, 13 Jun 2022 06:54:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6740E3055C; Mon, 13 Jun 2022 03:28:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2433CB80E5E; Mon, 13 Jun 2022 10:28:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F7AEC34114; Mon, 13 Jun 2022 10:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116112; bh=0jYq7SrEBjoFSLyblsX/VqNdX518v94WFZHXPitwbSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iWrTJCrCApudX0r975NzaSY3Qina9Q8zS4lOirY/7jnUtMFwbcD2MS3jrgxAAkaL7 JH18kntOH1jgv4jVBeCiDQOzgCOnUhkcovKnEFbMWLoM5TRIG72qGAdeWFEDEpqEpy rQPInzmnzyERyb/y9tOUb2LxSzlC+i/qY8FMeBZk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haowen Bai , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 016/411] ipw2x00: Fix potential NULL dereference in libipw_xmit() Date: Mon, 13 Jun 2022 12:04:49 +0200 Message-Id: <20220613094928.988723467@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Haowen Bai [ Upstream commit e8366bbabe1d207cf7c5b11ae50e223ae6fc278b ] crypt and crypt->ops could be null, so we need to checking null before dereference Signed-off-by: Haowen Bai Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1648797055-25730-1-git-send-email-baihaowen@meizu.com Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/ipw2x00/libipw_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c index d9baa2fa603b..e4c60caa6543 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_tx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_tx.c @@ -383,7 +383,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) /* Each fragment may need to have room for encryption * pre/postfix */ - if (host_encrypt) + if (host_encrypt && crypt && crypt->ops) bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + crypt->ops->extra_mpdu_postfix_len; -- 2.35.1