mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
block-7.2-20260815
-----BEGIN PGP SIGNATURE----- iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmqBJfoQHGF4Ym9lQGtl cm5lbC5kawAKCRD301j7KXHgpnZvEAC5y7aQuMkr++q00K/+gkRF2mef/kZPyySR N7alVJW69FgAluun+2MD9Sg1SXNXKlJ+8WAouKwhwbo/LuzzxdrJhJ8FO+94JTqn Dnf01ZCsbSU2KU1/D5Nk81vJTJMHTAmaefvejdJ1X0R8arBNLJ+8TZRRtuxixyez 6kt5HZTEY4n7WtkJs1sDUrbUCYt3jGXRz+sE+bNSzNFOCaTDBqCEquucZpa5QGRl Z7uVdHmpl8aQBCPNJq3H9l3HCav3FYCP8j+6DOzw8wNamlFdBj7ALldEz6uX1Kr9 EySUjW5MT9WwkN6dbSGOmF5bNQYuO8Umv0VsWTnIxXmEb34Jsz7PwVKZ+lJydsp5 Lm1JN9qT0uvN0CHyAL4ni3FnsTZnWDiTozBrZ4+vEPO8jRhTHg52eWtF4kfpaMxJ h2gw0MmPW+TaMQ13EiJ6fqppm/BrqtsX7WBKyKyflZIDXTy+KOoXxaiMO/IDMV0i ttS3yc6qLtvTR9BacLKlGc6YkiP4R9/1xSLWpOjNh18qljzgFFYjxOuszbcCE0/p vrefCd8J14HcCt5Qlw2XGYBptowbsNkEJ/k6L8Og36RAnyYzE84kbfVpiWddk0EU WqwAFWKc1J+1Ujf0TvmiprU1OfCPPeNp2xbDMMCGMRgLb6WSDUgUwBTiM9Hl2TmN N59eL2LfxA== =jmZj -----END PGP SIGNATURE----- Merge tag 'block-7.2-20260815' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux Pull block fix from Jens Axboe: "A single fix for a regression in this cycle, where drbd would leak shared secrets over netlink. This restores the behavior to match what we had before" * tag 'block-7.2-20260815' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: drbd: don't leak the shared secret to unprivileged netlink dumps
This commit is contained in:
commit
dcb68831ea
|
|
@ -3306,6 +3306,26 @@ static int nla_put_drbd_cfg_context(struct sk_buff *skb,
|
|||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
* net_conf_to_skb() serializes the shared secret verbatim. Any path that can
|
||||
* answer a request from an unprivileged process must pass exclude_sensitive,
|
||||
* so the secret is blanked in a private copy before it reaches the skb.
|
||||
*/
|
||||
static int net_conf_to_skb_sanitized(struct sk_buff *skb, struct net_conf *nc,
|
||||
bool exclude_sensitive)
|
||||
{
|
||||
struct net_conf nc_clean;
|
||||
|
||||
if (!exclude_sensitive)
|
||||
return net_conf_to_skb(skb, nc);
|
||||
|
||||
nc_clean = *nc;
|
||||
memset(nc_clean.shared_secret, 0, sizeof(nc_clean.shared_secret));
|
||||
nc_clean.shared_secret_len = 0;
|
||||
|
||||
return net_conf_to_skb(skb, &nc_clean);
|
||||
}
|
||||
|
||||
/*
|
||||
* The generic netlink dump callbacks are called outside the genl_lock(), so
|
||||
* they cannot use the simple attribute parsing code which uses global
|
||||
|
|
@ -3621,7 +3641,8 @@ int drbd_nl_get_connections_dumpit(struct sk_buff *skb, struct netlink_callback
|
|||
goto out;
|
||||
net_conf = rcu_dereference(connection->net_conf);
|
||||
if (net_conf) {
|
||||
err = net_conf_to_skb(skb, net_conf);
|
||||
err = net_conf_to_skb_sanitized(skb, net_conf,
|
||||
!capable(CAP_SYS_ADMIN));
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -3842,18 +3863,8 @@ static int nla_put_status_info(struct sk_buff *skb, struct drbd_device *device,
|
|||
struct net_conf *nc;
|
||||
|
||||
nc = rcu_dereference(first_peer_device(device)->connection->net_conf);
|
||||
if (nc) {
|
||||
if (exclude_sensitive) {
|
||||
struct net_conf nc_clean = *nc;
|
||||
|
||||
memset(nc_clean.shared_secret, 0,
|
||||
sizeof(nc_clean.shared_secret));
|
||||
nc_clean.shared_secret_len = 0;
|
||||
err = net_conf_to_skb(skb, &nc_clean);
|
||||
} else {
|
||||
err = net_conf_to_skb(skb, nc);
|
||||
}
|
||||
}
|
||||
if (nc)
|
||||
err = net_conf_to_skb_sanitized(skb, nc, exclude_sensitive);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
if (err)
|
||||
|
|
@ -4058,7 +4069,7 @@ static int get_one_status(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
struct net_conf *nc;
|
||||
|
||||
nc = rcu_dereference(connection->net_conf);
|
||||
if (nc && net_conf_to_skb(skb, nc) != 0)
|
||||
if (nc && net_conf_to_skb_sanitized(skb, nc, true) != 0)
|
||||
goto cancel;
|
||||
}
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user