tun: fix group permission check
Subsystems (8)
Sasha Levin
maintainerPATCH 1/7 tun: fix group permission check
From: Stas Sergeev <[email protected]>
[ Upstream commit 3ca459eaba1bf96a8c7878de84fa8872259a01e3 ]
Currently tun checks the group permission even if the user have matched. Besides going against the usual permission semantic, this has a very interesting implication: if the tun group is not among the supplementary groups of the tun user, then effectively no one can access the tun device. CAP_SYS_ADMIN still can, but its the same as not setting the tun ownership.
This patch relaxes the group checking so that either the user match or the group match is enough. This avoids the situation when no one can access the device even though the ownership is properly set.
Also I simplified the logic by removing the redundant inversions:tun_not_capable() --> !tun_capable()
--- drivers/net/tun.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/tun.c +9 -5
@@ -636,14 +636,18 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,return ret; } -static inline bool tun_not_capable (struct tun_struct *tun) +static inline bool tun_capable (struct tun_struct *tun) {const struct cred *cred =current_cred ();struct net *net =dev_net (tun->dev); -return ((uid_valid (tun->owner) && !uid_eq (cred->euid, tun->owner)) || - (gid_valid (tun->group) && !in_egroup_p (tun->group))) && - !ns_capable (net->user_ns,CAP_NET_ADMIN ); +if (ns_capable (net->user_ns,CAP_NET_ADMIN )) +return 1 ; +if (uid_valid (tun->owner) &&uid_eq (cred->euid, tun->owner)) +return 1 ; +if (gid_valid (tun->group) &&in_egroup_p (tun->group)) +return 1 ; +return 0 ; }static void tun_set_real_num_queues (struct tun_struct *tun)
@@ -2838,7 +2842,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) !!(tun->flags & IFF_MULTI_QUEUE))return -EINVAL ; -if (tun_not_capable (tun)) +if (!tun_capable (tun))return -EPERM ; err =security_tun_dev_open (tun->security);if (err <0 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/7 mmc: core: Respect quirk_max_rate for non-UHS SDIO card
From: Shawn Lin <[email protected]>
[ Upstream commit a2a44f8da29352f76c99c6904ee652911b8dc7dd ]
The card-quirk was added to limit the clock-rate for a card with UHS-mode support, although let's respect the quirk for non-UHS mode too, to make the behaviour consistent.
Message-ID: <[email protected]>
--- drivers/mmc/core/sdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mmc/core/sdio.c +2 -0
@@ -379,6 +379,8 @@ static unsigned mmc_sdio_get_max_clock(struct mmc_card *card)if (card->type ==MMC_TYPE_SD_COMBO ) max_dtr =min (max_dtr,mmc_sd_get_max_clock (card)); + max_dtr =min_not_zero (max_dtr, card->quirk_max_rate); +return max_dtr; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/7 wifi: brcmsmac: add gain range check to wlc_phy_iqcal_gainparams_nphy()
In reply to Sasha LevinFrom: Dmitry Antipov <[email protected]>
[ Upstream commit 3f4a0948c3524ae50f166dbc6572a3296b014e62 ]
In 'wlc_phy_iqcal_gainparams_nphy()', add gain range check to WARN() instead of possible out-of-bounds 'tbl_iqcal_gainparams_nphy' access. Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +3 -0
@@ -23445,6 +23445,9 @@ wlc_phy_iqcal_gainparams_nphy(struct brcms_phy *pi, u16 core_no, } } +if (WARN_ON (k ==NPHY_IQCAL_NUMGAINS )) +return ; + params->txgm = tbl_iqcal_gainparams_nphy[band_idx][k][1 ]; params->pga = tbl_iqcal_gainparams_nphy[band_idx][k][2 ]; params->pad = tbl_iqcal_gainparams_nphy[band_idx][k][3 ];
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/7 tomoyo: don't emit warning in tomoyo_write_control()
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 3df7546fc03b8f004eee0b9e3256369f7d096685 ]
syzbot is reporting too large allocation warning at tomoyo_write_control(), for one can write a very very long line without new line character. To fix this warning, I use __GFP_NOWARN rather than checking for KMALLOC_MAX_SIZE, for practically a valid line should be always shorter than 32KB where the "too small to fail" memory-allocation rule applies.
One might try to write a valid line that is longer than 32KB, but such request will likely fail with -ENOMEM. Therefore, I feel that separately returning -EINVAL when a line is longer than KMALLOC_MAX_SIZE is redundant. There is no need to distinguish over-32KB and over-KMALLOC_MAX_SIZE.
--- security/tomoyo/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/tomoyo/common.c +1 -1
@@ -2674,7 +2674,7 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head,if (head->w.avail >= head->writebuf_size -1 ) {const int len = head->writebuf_size *2 ; -char *cp =kzalloc (len,GFP_NOFS ); +char *cp =kzalloc (len,GFP_NOFS | __GFP_NOWARN);if (!cp) { error = -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/7 mfd: lpc_ich: Add another Gemini Lake ISA bridge PCI device-id
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 1e89d21f8189d286f80b900e1b7cf57cb1f3037e ]
On N4100 / N4120 Gemini Lake SoCs the ISA bridge PCI device-id is 31e8 rather the 3197 found on e.g. the N4000 / N4020.
While at fix the existing GLK PCI-id table entry breaking the table being sorted by device-id.
--- drivers/mfd/lpc_ich.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mfd/lpc_ich.c +2 -1
@@ -685,8 +685,9 @@ static const struct pci_device_id lpc_ich_ids[] = { { PCI_VDEVICE(INTEL, 0x2917), LPC_ICH9ME}, { PCI_VDEVICE(INTEL, 0x2918), LPC_ICH9}, { PCI_VDEVICE(INTEL, 0x2919), LPC_ICH9M}, - { PCI_VDEVICE(INTEL, 0x3197), LPC_GLK}, { PCI_VDEVICE(INTEL, 0x2b9c), LPC_COUGARMOUNTAIN}, + { PCI_VDEVICE(INTEL, 0x3197), LPC_GLK}, + { PCI_VDEVICE(INTEL, 0x31e8), LPC_GLK}, { PCI_VDEVICE(INTEL, 0x3a14), LPC_ICH10DO}, { PCI_VDEVICE(INTEL, 0x3a16), LPC_ICH10R}, { PCI_VDEVICE(INTEL, 0x3a18), LPC_ICH10},
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/7 HID: Wacom: Add PCI Wacom device support
In reply to Sasha LevinFrom: Even Xu <[email protected]>
[ Upstream commit c4c123504a65583e3689b3de04a61dc5272e453a ]
Add PCI device ID of wacom device into driver support list.
--- drivers/hid/wacom_wac.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/wacom_wac.c +5 -0
@@ -4851,6 +4851,10 @@ static const struct wacom_features wacom_features_0x94 = HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ .driver_data = (kernel_ulong_t)&wacom_features_##prod +#define PCI_DEVICE_WACOM (prod) \ + HID_DEVICE(BUS_PCI, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ + .driver_data = (kernel_ulong_t)&wacom_features_##prod +#define USB_DEVICE_LENOVO (prod) \ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ .driver_data = (kernel_ulong_t)&wacom_features_##prod
@@ -5020,6 +5024,7 @@ const struct hid_device_id wacom_ids[] = { { USB_DEVICE_WACOM(HID_ANY_ID) }, { I2C_DEVICE_WACOM(HID_ANY_ID) }, + { PCI_DEVICE_WACOM(HID_ANY_ID) }, { BT_DEVICE_WACOM(HID_ANY_ID) }, { } };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/7 APEI: GHES: Have GHES honor the panic= setting
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
[ Upstream commit 5c0e00a391dd0099fe95991bb2f962848d851916 ]
The GHES driver overrides the panic= setting by force-rebooting the system after a fatal hw error has been reported. The intent being that such an error would be reported earlier.
However, this is not optimal when a hard-to-debug issue requires long time to reproduce and when that happens, the box will get rebooted after 30 seconds and thus destroy the whole hw context of when the error happened.
So rip out the default GHES panic timeout and honor the global one.
In the panic disabled (panic=0) case, the error will still be logged to dmesg for later inspection and if panic after a hw error is really required, then that can be controlled the usual way - use panic= on the cmdline or set it in the kernel .config's CONFIG_PANIC_TIMEOUT.
--- drivers/acpi/apei/ghes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/acpi/apei/ghes.c +5 -5
@@ -128,8 +128,6 @@ static unsigned long ghes_estatus_pool_size_request;static struct ghes_estatus_cache *ghes_estatus_caches[GHES_ESTATUS_CACHES_SIZE ];static atomic_t ghes_estatus_cache_alloced; -static int ghes_panic_timeout__read_mostly =30 ; -static void __iomem *ghes_map (u64 pfn,enum fixed_addresses fixmap_idx) {phys_addr_t paddr;
@@ -707,14 +705,16 @@ static void __ghes_panic(struct ghes *ghes,struct acpi_hest_generic_status *estatus, u64 buf_paddr, enum fixed_addresses fixmap_idx) { + const char *msg = GHES_PFX "Fatal hardware error"; +__ghes_print_estatus (KERN_EMERG , ghes->generic, estatus);ghes_clear_estatus (ghes, estatus, buf_paddr, fixmap_idx); -/* reboot to log the error! */ if (!panic_timeout) - panic_timeout = ghes_panic_timeout; -panic ("Fatal hardware error!" ); +pr_emerg ("%s but panic disabled\n" , msg); + +panic (msg); }static int ghes_proc (struct ghes *ghes)
Signature · 1 line
2.39.5