ipw2x00: Fix potential NULL dereference in libipw_xmit()
authorHaowen Bai <baihaowen@meizu.com>
Fri, 1 Apr 2022 07:10:54 +0000 (15:10 +0800)
committerKalle Valo <kvalo@kernel.org>
Wed, 6 Apr 2022 12:14:44 +0000 (15:14 +0300)
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
drivers/net/wireless/intel/ipw2x00/libipw_tx.c

index 36d1e6b2568db858f1cf7f71422887815ddff77d..4aec1fce1ae297502c1f2c35c9f6f02c2a4ad0a8 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;