qcacmn: SSR protect the pktlog_fops functions
Protect pktlog_fops callback function from sub system restart. Change-Id: Iaaa50f609a96058e5f1a669f88c97e4a97193562 CRs-Fixed: 2131028
This commit is contained in:

committed by
snandini

parent
3e8add86bb
commit
fe0b0d43c2
@@ -551,7 +551,7 @@ static void pktlog_detach(struct ol_txrx_pdev_t *handle)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pktlog_open(struct inode *i, struct file *f)
|
static int __pktlog_open(struct inode *i, struct file *f)
|
||||||
{
|
{
|
||||||
struct hif_opaque_softc *scn;
|
struct hif_opaque_softc *scn;
|
||||||
struct ol_pktlog_dev_t *pl_dev;
|
struct ol_pktlog_dev_t *pl_dev;
|
||||||
@@ -573,6 +573,11 @@ static int pktlog_open(struct inode *i, struct file *f)
|
|||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cds_is_load_or_unload_in_progress() || cds_is_driver_recovering()) {
|
||||||
|
pr_info("%s: Load/Unload or recovery is in progress", __func__);
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
pl_info->curr_pkt_state = PKTLOG_OPR_IN_PROGRESS_READ_START;
|
pl_info->curr_pkt_state = PKTLOG_OPR_IN_PROGRESS_READ_START;
|
||||||
scn = cds_get_context(QDF_MODULE_ID_HIF);
|
scn = cds_get_context(QDF_MODULE_ID_HIF);
|
||||||
if (!scn) {
|
if (!scn) {
|
||||||
@@ -608,7 +613,18 @@ static int pktlog_open(struct inode *i, struct file *f)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pktlog_release(struct inode *i, struct file *f)
|
static int pktlog_open(struct inode *i, struct file *f)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
cds_ssr_protect(__func__);
|
||||||
|
ret = __pktlog_open(i, f);
|
||||||
|
cds_ssr_unprotect(__func__);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __pktlog_release(struct inode *i, struct file *f)
|
||||||
{
|
{
|
||||||
struct hif_opaque_softc *scn;
|
struct hif_opaque_softc *scn;
|
||||||
struct ol_pktlog_dev_t *pl_dev;
|
struct ol_pktlog_dev_t *pl_dev;
|
||||||
@@ -623,6 +639,11 @@ static int pktlog_release(struct inode *i, struct file *f)
|
|||||||
if (!pl_info)
|
if (!pl_info)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (cds_is_load_or_unload_in_progress() || cds_is_driver_recovering()) {
|
||||||
|
pr_info("%s: Load/Unload or recovery is in progress", __func__);
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
scn = cds_get_context(QDF_MODULE_ID_HIF);
|
scn = cds_get_context(QDF_MODULE_ID_HIF);
|
||||||
if (!scn) {
|
if (!scn) {
|
||||||
pl_info->curr_pkt_state = PKTLOG_OPR_NOT_IN_PROGRESS;
|
pl_info->curr_pkt_state = PKTLOG_OPR_NOT_IN_PROGRESS;
|
||||||
@@ -658,6 +679,17 @@ static int pktlog_release(struct inode *i, struct file *f)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pktlog_release(struct inode *i, struct file *f)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
cds_ssr_protect(__func__);
|
||||||
|
ret = __pktlog_release(i, f);
|
||||||
|
cds_ssr_unprotect(__func__);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef MIN
|
#ifndef MIN
|
||||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
@@ -828,6 +860,11 @@ __pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
|
|||||||
struct ath_pktlog_info *pl_info;
|
struct ath_pktlog_info *pl_info;
|
||||||
struct ath_pktlog_buf *log_buf;
|
struct ath_pktlog_buf *log_buf;
|
||||||
|
|
||||||
|
if (cds_is_load_or_unload_in_progress() || cds_is_driver_recovering()) {
|
||||||
|
pr_info("%s: Load/Unload or recovery is in progress", __func__);
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
pl_info = (struct ath_pktlog_info *)
|
pl_info = (struct ath_pktlog_info *)
|
||||||
PDE_DATA(file->f_path.dentry->d_inode);
|
PDE_DATA(file->f_path.dentry->d_inode);
|
||||||
if (!pl_info)
|
if (!pl_info)
|
||||||
@@ -970,9 +1007,12 @@ pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
|
|||||||
PDE_DATA(file->f_path.dentry->d_inode);
|
PDE_DATA(file->f_path.dentry->d_inode);
|
||||||
if (!pl_info)
|
if (!pl_info)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
cds_ssr_protect(__func__);
|
||||||
mutex_lock(&pl_info->pktlog_mutex);
|
mutex_lock(&pl_info->pktlog_mutex);
|
||||||
ret = __pktlog_read(file, buf, nbytes, ppos);
|
ret = __pktlog_read(file, buf, nbytes, ppos);
|
||||||
mutex_unlock(&pl_info->pktlog_mutex);
|
mutex_unlock(&pl_info->pktlog_mutex);
|
||||||
|
cds_ssr_unprotect(__func__);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1037,7 +1077,7 @@ static struct vm_operations_struct pktlog_vmops = {
|
|||||||
fault:pktlog_fault,
|
fault:pktlog_fault,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pktlog_mmap(struct file *file, struct vm_area_struct *vma)
|
static int __pktlog_mmap(struct file *file, struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
struct ath_pktlog_info *pl_info;
|
struct ath_pktlog_info *pl_info;
|
||||||
|
|
||||||
@@ -1054,12 +1094,28 @@ static int pktlog_mmap(struct file *file, struct vm_area_struct *vma)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cds_is_load_or_unload_in_progress() || cds_is_driver_recovering()) {
|
||||||
|
pr_info("%s: Load/Unload or recovery is in progress", __func__);
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
vma->vm_flags |= VM_LOCKED;
|
vma->vm_flags |= VM_LOCKED;
|
||||||
vma->vm_ops = &pktlog_vmops;
|
vma->vm_ops = &pktlog_vmops;
|
||||||
pktlog_vopen(vma);
|
pktlog_vopen(vma);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pktlog_mmap(struct file *file, struct vm_area_struct *vma)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
cds_ssr_protect(__func__);
|
||||||
|
ret = __pktlog_mmap(file, vma);
|
||||||
|
cds_ssr_unprotect(__func__);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int pktlogmod_init(void *context)
|
int pktlogmod_init(void *context)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
Reference in New Issue
Block a user