]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ipw2x00: Fix potential NULL dereference in libipw_xmit()
authorHaowen Bai <baihaowen@meizu.com>
Fri, 1 Apr 2022 07:10:54 +0000 (15:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:20:50 +0000 (10:20 +0200)
[ Upstream commit e8366bbabe1d207cf7c5b11ae50e223ae6fc278b ]

crypt and crypt->ops could be null, so we need to checking null
before dereference

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/1648797055-25730-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/intel/ipw2x00/libipw_tx.c

index d9baa2fa603b28853f04ec2d4238f6ab726d7769..e4c60caa6543cf235f3274d3dc21802317c041fe 100644 (file)
@@ -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;