Skip to content

Commit b9a76f1

Browse files
Samuel Ortizlinvjw
authored andcommitted
NFC: Clear LLCP SDPs whan MAC goes down
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 98b3ac1 commit b9a76f1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

net/nfc/llcp/llcp.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local)
9797
mutex_unlock(&local->socket_lock);
9898
}
9999

100+
static void nfc_llcp_clear_sdp(struct nfc_llcp_local *local)
101+
{
102+
mutex_lock(&local->sdp_lock);
103+
104+
local->local_wks = 0;
105+
local->local_sdp = 0;
106+
local->local_sap = 0;
107+
108+
mutex_unlock(&local->sdp_lock);
109+
}
110+
100111
static void nfc_llcp_timeout_work(struct work_struct *work)
101112
{
102113
struct nfc_llcp_local *local = container_of(work, struct nfc_llcp_local,
@@ -857,6 +868,8 @@ void nfc_llcp_mac_is_down(struct nfc_dev *dev)
857868
if (local == NULL)
858869
return;
859870

871+
nfc_llcp_clear_sdp(local);
872+
860873
/* Close and purge all existing sockets */
861874
nfc_llcp_socket_release(local);
862875
}

0 commit comments

Comments
 (0)