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.
Showing the changes to security (1 of 1 file). Show all
Unified · Split
| @@ -386,11 +386,12 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask) · 385 unmodified lines | ||
| 386 | 386 | if (!S_ISSOCK(inode->i_mode) || |
| 387 | 387 | ((mask & (MAY_WRITE | MAY_APPEND)) == 0)) |
| 388 | 388 | return 0; |
| 389 | − | |
| 390 | 389 | sock = SOCKET_I(inode); |
| 391 | 390 | sk = sock->sk; |
| 391 | + if (sk == NULL) | |
| 392 | + return 0; | |
| 392 | 393 | sksec = sk->sk_security; |
| 393 | − if (sksec->nlbl_state != NLBL_REQUIRE) | |
| 394 | + if (sksec == NULL || sksec->nlbl_state != NLBL_REQUIRE) | |
| 394 | 395 | return 0; |
| 395 | 396 | |
| 396 | 397 | local_bh_disable(); |