Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2099735iof; Tue, 7 Jun 2022 19:43:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbjwp1KSjSFhiQBkDxOyHlHTdMRXy6MljJh2BvWDPdQleRcMKmIvuqyzfZWlWUkZv9sDt9 X-Received: by 2002:a65:67c1:0:b0:3fd:ebd6:5dab with SMTP id b1-20020a6567c1000000b003fdebd65dabmr7638639pgs.75.1654656236739; Tue, 07 Jun 2022 19:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654656236; cv=none; d=google.com; s=arc-20160816; b=ztV88gaIjUSU9mHsmSBhzt4VmT5JRVM3D87BswTCr+9EjOy6y4W2gjZhnzGFsyMpbI WdrPMw+MO7l/+EYKVRdYjyT41H+wguiZCTRTo0wCBsnBGDX7oiphAHe8k5IjPiqFeBQg VePwWCULyxpilf+KGGIc6XFDIFv6WID4v6e+M2U4f+LG41cKaTEY+4dfQd8e+outQc9w yrmHhXoUqTeZW0qrmJk+DGoBbZ4r7MUM2mor6FJ9FkvH2wpvD/Eh6aTmvSnhsvcrUh1n yQyByfPN7tg8jqWwi5EQ6psFPVIfzmIaATzzm1jzakEx1Cq0TTsdSywLIzvm5Tc8zZ3U qQIg== 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=sHC8t0/2usqVnySTkkglLVUiJYCoybvBxEmtT+Jhcbk=; b=Z0BsDqxbaXzQW/f6Km5dkQlMx+9+DxpOczT6TEAuEmk65mVANNLDfGmAeAlaGaFdeK b3aBFO68KKn1xtPUfxeNQWogCxq5PlRQxL/aDWnakbeTu+Um2dstcQp2LpyuCfbIhymv iYDHlUsHxGUB3s97mvotaVafk74DX+/aamBH+s4S5Xk4kQOwJKayvg5XENev2a2mggEs cDf162HYzz5rPt3nyPmMD3vVFIu5nTgBbPEbiGfeRBkDcGPVX6h7ODZvY9bTMKRKK5+Q eClX6C3JgJEVE03QgoEL7/NChQRcNFuBYSkY2/fRf+s5lOSKVr3R9Vhi9IGorHfkYnNw qhOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f5L5RdUw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m15-20020a17090b068f00b001e690d223casi20566710pjz.177.2022.06.07.19.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:43:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f5L5RdUw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CC12924932F; Tue, 7 Jun 2022 18:07:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383750AbiFGWIT (ORCPT + 99 others); Tue, 7 Jun 2022 18:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379915AbiFGVGg (ORCPT ); Tue, 7 Jun 2022 17:06:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6842122BC; Tue, 7 Jun 2022 11:50:37 -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 E154EB81FE1; Tue, 7 Jun 2022 18:50:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AAAAC385A2; Tue, 7 Jun 2022 18:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627821; bh=gam7VJRU5tQrQ47mhnmERO7Bdx+TDXwHG5e3vtQwqLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f5L5RdUwRWmhPS89uRl14+v8OOU/2ia8UCONp81jln4Luys/+/qEA9zy3oHF7zJzE vLJSSXS3x9Mzp3oz1HOuuo0n7iTtnnOJt9cdvSnpQMvYRsfntj8pYo1uSAJk5OgFT2 GkUE5uQ2MTPJwApGxTgCFV11a7qGBgXDlEXWFNbQ= 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.18 068/879] ipw2x00: Fix potential NULL dereference in libipw_xmit() Date: Tue, 7 Jun 2022 18:53:06 +0200 Message-Id: <20220607165004.666232980@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 36d1e6b2568d..4aec1fce1ae2 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