Spam is a reality in LinkedIn too. Even if you have the choice to select your connections, you might allow someone by mistake. Sometimes a fake or misused profile can fill your inbox with unwanted promotions or spam that is not really necessary, apart that they would have access to some of your personal data.
To block a member for viewing your profile, go to his or her profile and move your cursor over the down arrow next to the button in the top section, select Block or report, and then click Block and Continue. The final step would be to click Agree to confirm your action.

The blocked member won’t receive any notification but you would need to add this person again to your network if you decide to unblock him. All their endorsements and recommendations from your profile will also be removed permanently.

You can unblock a member in the Privacy & Setting section, under “Manage who you’re blocking”.