diff options
author | Aditya Pakki <pakki001@umn.edu> | 2019-12-17 21:43:00 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-12-20 02:33:23 +0100 |
commit | 615f22f58029aa747b12768985e7f91cd053daa2 (patch) | |
tree | eb400c7346bab7b096faa5c553553397df76b728 /drivers/nfc | |
parent | Merge branch 'macb-fix-probing-of-PHY-not-described-in-the-dt' (diff) | |
download | linux-615f22f58029aa747b12768985e7f91cd053daa2.tar.xz linux-615f22f58029aa747b12768985e7f91cd053daa2.zip |
nfc: s3fwrn5: replace the assertion with a WARN_ON
In s3fwrn5_fw_recv_frame, if fw_info->rsp is not empty, the
current code causes a crash via BUG_ON. However, s3fwrn5_fw_send_msg
does not crash in such a scenario. The patch replaces the BUG_ON
by returning the error to the callers and frees up skb.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/s3fwrn5/firmware.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c index be110d9cef02..de613c623a2c 100644 --- a/drivers/nfc/s3fwrn5/firmware.c +++ b/drivers/nfc/s3fwrn5/firmware.c @@ -507,7 +507,10 @@ int s3fwrn5_fw_recv_frame(struct nci_dev *ndev, struct sk_buff *skb) struct s3fwrn5_info *info = nci_get_drvdata(ndev); struct s3fwrn5_fw_info *fw_info = &info->fw_info; - BUG_ON(fw_info->rsp); + if (WARN_ON(fw_info->rsp)) { + kfree_skb(skb); + return -EINVAL; + } fw_info->rsp = skb; |