The difference in points between Real Madrid and Barcelona is not a big problem because the journey of this season is still very long.
Barcelona's defeat to Sociedad was indeed a bit surprising because Barcelona, who were in top form, failed to win the match, but if we look at Barcelona's performance in the match, I think they still played well, it's just that in that match they were unlucky.
Difference between them is not too big and the season is very long with many uncertain changes or twists in future. Barcelona have advantage now, that is good, but they have to play carefully to secure the difference or better expand it bigger. They are a big club with experience in competing for La Liga titles in many seasons and sometimes they won, sometimes they failed and in some seasons they experienced big shock of losing La Liga title in very least match days. It can happen again in this season but if Barcelona play carefully, they will reduce risk of losing points as well as increasing their chance to win La Liga title.
For Real Madrid who are currently trying to rise from their slump, I think they only need to focus on improving their performance, what happened to Barcelona has nothing to do with Real Madrid and I think Barcelona's progress this season has motivated Real Madrid to be better in order to defend the title.
Real Madrid know that they still have chance and the season is long enough for them to come back. With small difference like this, two or three match days can change their position against Barcelona. They are a chaser in this race as of now, so pressure on Real Madrid is bigger on Barcelona, but dealing with pressure is not too strange with Real Madrid players.