Skip to content

Commit

Permalink
nfc: s3fwrn5: replace the assertion with a WARN_ON
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Aditya Pakki authored and David S. Miller committed Dec 20, 2019
1 parent a019739 commit 615f22f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/nfc/s3fwrn5/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 615f22f

Please sign in to comment.