History

selinux: Fix a panic in selinux_netlbl_inode_permission()

Rick McNeal from LSI identified a panic in selinux_netlbl_inode_permission() caused by a certain sequence of SUNRPC operations. The problem appears to be due to the lack of NULL pointer checking in the function; this patch adds the pointer checks so the function will exit safely in the cases where the socket is not completely initialized.

Paul Moore committed 17 years ago

Commit d7f59dc1 parent 778ef1e1 file · +3 −2Browse files

Showing the changes to security (1 of 1 file). Show all

Unified · Split

security/selinux/netlabel.c+3−2
@@ -386,11 +386,12 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask) · 385 unmodified lines
386386 if (!S_ISSOCK(inode->i_mode) ||
387387 ((mask & (MAY_WRITE | MAY_APPEND)) == 0))
388388 return 0;
389−
390389 sock = SOCKET_I(inode);
391390 sk = sock->sk;
391+ if (sk == NULL)
392+ return 0;
392393 sksec = sk->sk_security;
393− if (sksec->nlbl_state != NLBL_REQUIRE)
394+ if (sksec == NULL || sksec->nlbl_state != NLBL_REQUIRE)
394395 return 0;
395396
396397 local_bh_disable();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t