While in most cases commit b1d9e6b064 ("LSM: Switch to lists of hooks") retained previous error returns, in three cases it altered them without any explanation in the commit message. Restore all of them - in the security_old_inode_init_security() case this led to reiserfs using uninitialized data, sooner or later crashing the system (the only other user of this function - ocfs2 - was unaffected afaict, since it passes pre-initialized structures).
Unified · Split
| @@ -380,8 +380,8 @@ int security_inode_init_security(struct inode *inode, struct inode *dir, · 379 unmodified lines | ||
| 380 | 380 | return 0; |
| 381 | 381 | |
| 382 | 382 | if (!initxattrs) |
| 383 | − return call_int_hook(inode_init_security, 0, inode, dir, qstr, | |
| 384 | − NULL, NULL, NULL); | |
| 383 | + return call_int_hook(inode_init_security, -EOPNOTSUPP, inode, | |
| 384 | + dir, qstr, NULL, NULL, NULL); | |
| 385 | 385 | memset(new_xattrs, 0, sizeof(new_xattrs)); |
| 386 | 386 | lsm_xattr = new_xattrs; |
| 387 | 387 | ret = call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir, qstr, |
| @@ -409,8 +409,8 @@ int security_old_inode_init_security(struct inode *inode, struct inode *dir, · 21 unmodified lines | ||
| 409 | 409 | { |
| 410 | 410 | if (unlikely(IS_PRIVATE(inode))) |
| 411 | 411 | return -EOPNOTSUPP; |
| 412 | − return call_int_hook(inode_init_security, 0, inode, dir, qstr, | |
| 413 | − name, value, len); | |
| 412 | + return call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir, | |
| 413 | + qstr, name, value, len); | |
| 414 | 414 | } |
| 415 | 415 | EXPORT_SYMBOL(security_old_inode_init_security); |
| 416 | 416 | |
| @@ -1281,7 +1281,8 @@ int security_socket_getpeersec_stream(struct socket *sock, char __user *optval, · 864 unmodified lines | ||
| 1281 | 1281 | |
| 1282 | 1282 | int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) |
| 1283 | 1283 | { |
| 1284 | − return call_int_hook(socket_getpeersec_dgram, 0, sock, skb, secid); | |
| 1284 | + return call_int_hook(socket_getpeersec_dgram, -ENOPROTOOPT, sock, | |
| 1285 | + skb, secid); | |
| 1285 | 1286 | } |
| 1286 | 1287 | EXPORT_SYMBOL(security_socket_getpeersec_dgram); |
| 1287 | 1288 | |