mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 01:24:33 +00:00
crypto: chtls - fix null dereference chtls_free_uld()
call chtls_free_uld() only for the initialized cdev, this fixes NULL dereference in chtls_free_uld() Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: Atul Gupta <atul.gupta@chelsio.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
7fa885e2a2
commit
65b2c12dcd
@ -96,6 +96,10 @@ enum csk_flags {
|
|||||||
CSK_CONN_INLINE, /* Connection on HW */
|
CSK_CONN_INLINE, /* Connection on HW */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum chtls_cdev_state {
|
||||||
|
CHTLS_CDEV_STATE_UP = 1
|
||||||
|
};
|
||||||
|
|
||||||
struct listen_ctx {
|
struct listen_ctx {
|
||||||
struct sock *lsk;
|
struct sock *lsk;
|
||||||
struct chtls_dev *cdev;
|
struct chtls_dev *cdev;
|
||||||
@ -146,6 +150,7 @@ struct chtls_dev {
|
|||||||
unsigned int send_page_order;
|
unsigned int send_page_order;
|
||||||
int max_host_sndbuf;
|
int max_host_sndbuf;
|
||||||
struct key_map kmap;
|
struct key_map kmap;
|
||||||
|
unsigned int cdev_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct chtls_hws {
|
struct chtls_hws {
|
||||||
|
@ -160,6 +160,7 @@ static void chtls_register_dev(struct chtls_dev *cdev)
|
|||||||
tlsdev->hash = chtls_create_hash;
|
tlsdev->hash = chtls_create_hash;
|
||||||
tlsdev->unhash = chtls_destroy_hash;
|
tlsdev->unhash = chtls_destroy_hash;
|
||||||
tls_register_device(&cdev->tlsdev);
|
tls_register_device(&cdev->tlsdev);
|
||||||
|
cdev->cdev_state = CHTLS_CDEV_STATE_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chtls_unregister_dev(struct chtls_dev *cdev)
|
static void chtls_unregister_dev(struct chtls_dev *cdev)
|
||||||
@ -281,8 +282,10 @@ static void chtls_free_all_uld(void)
|
|||||||
struct chtls_dev *cdev, *tmp;
|
struct chtls_dev *cdev, *tmp;
|
||||||
|
|
||||||
mutex_lock(&cdev_mutex);
|
mutex_lock(&cdev_mutex);
|
||||||
list_for_each_entry_safe(cdev, tmp, &cdev_list, list)
|
list_for_each_entry_safe(cdev, tmp, &cdev_list, list) {
|
||||||
chtls_free_uld(cdev);
|
if (cdev->cdev_state == CHTLS_CDEV_STATE_UP)
|
||||||
|
chtls_free_uld(cdev);
|
||||||
|
}
|
||||||
mutex_unlock(&cdev_mutex);
|
mutex_unlock(&cdev_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user