Skip to content

Commit b06f58a

Browse files
committed
Merge tag 'driver-core-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here is the set of driver core updates for 6.7-rc1. Nothing major in here at all, just a small number of changes including: - minor cleanups and updates from Andy Shevchenko - __counted_by addition - firmware_loader update for aborting loads cleaner - other minor changes, details in the shortlog - documentation update All of these have been in linux-next for a while with no reported issues" * tag 'driver-core-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (21 commits) firmware_loader: Abort all upcoming firmware load request once reboot triggered firmware_loader: Refactor kill_pending_fw_fallback_reqs() Documentation: security-bugs.rst: linux-distros relaxed their rules driver core: Release all resources during unbind before updating device links driver core: class: remove boilerplate code driver core: platform: Annotate struct irq_affinity_devres with __counted_by resource: Constify resource crosscheck APIs resource: Unify next_resource() and next_resource_skip_children() resource: Reuse for_each_resource() macro PCI: Implement custom llseek for sysfs resource entries kernfs: sysfs: support custom llseek method for sysfs entries debugfs: Fix __rcu type comparison warning device property: Replace custom implementation of COUNT_ARGS() drivers: base: test: Make property entry API test modular driver core: Add missing parameter description to __fwnode_link_add() device property: Clarify usage scope of some struct fwnode_handle members devres: rename the first parameter of devm_add_action(_or_reset) driver core: platform: Unify the firmware node type check driver core: platform: Use temporary variable in platform_device_add() driver core: platform: Refactor error path in a couple places ...
2 parents d99b91a + effd7c7 commit b06f58a

File tree

22 files changed

+195
-101
lines changed

22 files changed

+195
-101
lines changed

Documentation/process/security-bugs.rst

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,32 @@ lifted, in perpetuity.
6666
Coordination with other groups
6767
------------------------------
6868

69-
The kernel security team strongly recommends that reporters of potential
70-
security issues NEVER contact the "linux-distros" mailing list until
71-
AFTER discussing it with the kernel security team. Do not Cc: both
72-
lists at once. You may contact the linux-distros mailing list after a
73-
fix has been agreed on and you fully understand the requirements that
74-
doing so will impose on you and the kernel community.
75-
76-
The different lists have different goals and the linux-distros rules do
77-
not contribute to actually fixing any potential security problems.
69+
While the kernel security team solely focuses on getting bugs fixed,
70+
other groups focus on fixing issues in distros and coordinating
71+
disclosure between operating system vendors. Coordination is usually
72+
handled by the "linux-distros" mailing list and disclosure by the
73+
public "oss-security" mailing list, both of which are closely related
74+
and presented in the linux-distros wiki:
75+
<https://oss-security.openwall.org/wiki/mailing-lists/distros>
76+
77+
Please note that the respective policies and rules are different since
78+
the 3 lists pursue different goals. Coordinating between the kernel
79+
security team and other teams is difficult since for the kernel security
80+
team occasional embargoes (as subject to a maximum allowed number of
81+
days) start from the availability of a fix, while for "linux-distros"
82+
they start from the initial post to the list regardless of the
83+
availability of a fix.
84+
85+
As such, the kernel security team strongly recommends that as a reporter
86+
of a potential security issue you DO NOT contact the "linux-distros"
87+
mailing list UNTIL a fix is accepted by the affected code's maintainers
88+
and you have read the distros wiki page above and you fully understand
89+
the requirements that contacting "linux-distros" will impose on you and
90+
the kernel community. This also means that in general it doesn't make
91+
sense to Cc: both lists at once, except maybe for coordination if and
92+
while an accepted fix has not yet been merged. In other words, until a
93+
fix is accepted do not Cc: "linux-distros", and after it's merged do not
94+
Cc: the kernel security team.
7895

7996
CVE assignment
8097
--------------

drivers/base/class.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,8 @@ int class_register(const struct class *cls)
193193
lockdep_register_key(key);
194194
__mutex_init(&cp->mutex, "subsys mutex", key);
195195
error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name);
196-
if (error) {
197-
kfree(cp);
198-
return error;
199-
}
196+
if (error)
197+
goto err_out;
200198

201199
cp->subsys.kobj.kset = class_kset;
202200
cp->subsys.kobj.ktype = &class_ktype;

drivers/base/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static bool fw_devlink_best_effort;
4949
* __fwnode_link_add - Create a link between two fwnode_handles.
5050
* @con: Consumer end of the link.
5151
* @sup: Supplier end of the link.
52+
* @flags: Link flags.
5253
*
5354
* Create a fwnode link between fwnode handles @con and @sup. The fwnode link
5455
* represents the detail that the firmware lists @sup fwnode as supplying a

drivers/base/dd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,8 +1274,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
12741274
if (dev->bus && dev->bus->dma_cleanup)
12751275
dev->bus->dma_cleanup(dev);
12761276

1277-
device_links_driver_cleanup(dev);
12781277
device_unbind_cleanup(dev);
1278+
device_links_driver_cleanup(dev);
12791279

12801280
klist_remove(&dev->p->knode_driver);
12811281
device_pm_check_callbacks(dev);

drivers/base/firmware_loader/fallback.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,21 @@ static inline int fw_sysfs_wait_timeout(struct fw_priv *fw_priv, long timeout)
4646

4747
static LIST_HEAD(pending_fw_head);
4848

49-
void kill_pending_fw_fallback_reqs(bool only_kill_custom)
49+
void kill_pending_fw_fallback_reqs(bool kill_all)
5050
{
5151
struct fw_priv *fw_priv;
5252
struct fw_priv *next;
5353

5454
mutex_lock(&fw_lock);
5555
list_for_each_entry_safe(fw_priv, next, &pending_fw_head,
5656
pending_list) {
57-
if (!fw_priv->need_uevent || !only_kill_custom)
57+
if (kill_all || !fw_priv->need_uevent)
5858
__fw_load_abort(fw_priv);
5959
}
60+
61+
if (kill_all)
62+
fw_load_abort_all = true;
63+
6064
mutex_unlock(&fw_lock);
6165
}
6266

@@ -86,7 +90,7 @@ static int fw_load_sysfs_fallback(struct fw_sysfs *fw_sysfs, long timeout)
8690
}
8791

8892
mutex_lock(&fw_lock);
89-
if (fw_state_is_aborted(fw_priv)) {
93+
if (fw_load_abort_all || fw_state_is_aborted(fw_priv)) {
9094
mutex_unlock(&fw_lock);
9195
retval = -EINTR;
9296
goto out;

drivers/base/firmware_loader/fallback.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int firmware_fallback_sysfs(struct firmware *fw, const char *name,
1313
struct device *device,
1414
u32 opt_flags,
1515
int ret);
16-
void kill_pending_fw_fallback_reqs(bool only_kill_custom);
16+
void kill_pending_fw_fallback_reqs(bool kill_all);
1717

1818
void fw_fallback_set_cache_timeout(void);
1919
void fw_fallback_set_default_timeout(void);
@@ -28,7 +28,7 @@ static inline int firmware_fallback_sysfs(struct firmware *fw, const char *name,
2828
return ret;
2929
}
3030

31-
static inline void kill_pending_fw_fallback_reqs(bool only_kill_custom) { }
31+
static inline void kill_pending_fw_fallback_reqs(bool kill_all) { }
3232
static inline void fw_fallback_set_cache_timeout(void) { }
3333
static inline void fw_fallback_set_default_timeout(void) { }
3434
#endif /* CONFIG_FW_LOADER_USER_HELPER */

drivers/base/firmware_loader/firmware.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ struct fw_priv {
8686

8787
extern struct mutex fw_lock;
8888
extern struct firmware_cache fw_cache;
89+
extern bool fw_load_abort_all;
8990

9091
static inline bool __fw_state_check(struct fw_priv *fw_priv,
9192
enum fw_status status)

drivers/base/firmware_loader/main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static inline struct fw_priv *to_fw_priv(struct kref *ref)
9393
DEFINE_MUTEX(fw_lock);
9494

9595
struct firmware_cache fw_cache;
96+
bool fw_load_abort_all;
9697

9798
void fw_state_init(struct fw_priv *fw_priv)
9899
{
@@ -1524,10 +1525,10 @@ static int fw_pm_notify(struct notifier_block *notify_block,
15241525
case PM_SUSPEND_PREPARE:
15251526
case PM_RESTORE_PREPARE:
15261527
/*
1527-
* kill pending fallback requests with a custom fallback
1528-
* to avoid stalling suspend.
1528+
* Here, kill pending fallback requests will only kill
1529+
* non-uevent firmware request to avoid stalling suspend.
15291530
*/
1530-
kill_pending_fw_fallback_reqs(true);
1531+
kill_pending_fw_fallback_reqs(false);
15311532
device_cache_fw_images();
15321533
break;
15331534

@@ -1612,7 +1613,7 @@ static int fw_shutdown_notify(struct notifier_block *unused1,
16121613
* Kill all pending fallback requests to avoid both stalling shutdown,
16131614
* and avoid a deadlock with the usermode_lock.
16141615
*/
1615-
kill_pending_fw_fallback_reqs(false);
1616+
kill_pending_fw_fallback_reqs(true);
16161617

16171618
return NOTIFY_DONE;
16181619
}

drivers/base/platform.c

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,19 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
178178
ret = dev->archdata.irqs[num];
179179
goto out;
180180
#else
181+
struct fwnode_handle *fwnode = dev_fwnode(&dev->dev);
181182
struct resource *r;
182183

183-
if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) {
184-
ret = of_irq_get(dev->dev.of_node, num);
184+
if (is_of_node(fwnode)) {
185+
ret = of_irq_get(to_of_node(fwnode), num);
185186
if (ret > 0 || ret == -EPROBE_DEFER)
186187
goto out;
187188
}
188189

189190
r = platform_get_resource(dev, IORESOURCE_IRQ, num);
190-
if (has_acpi_companion(&dev->dev)) {
191+
if (is_acpi_device_node(fwnode)) {
191192
if (r && r->flags & IORESOURCE_DISABLED) {
192-
ret = acpi_irq_get(ACPI_HANDLE(&dev->dev), num, r);
193+
ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), num, r);
193194
if (ret)
194195
goto out;
195196
}
@@ -222,8 +223,8 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
222223
* the device will only expose one IRQ, and this fallback
223224
* allows a common code path across either kind of resource.
224225
*/
225-
if (num == 0 && has_acpi_companion(&dev->dev)) {
226-
ret = acpi_dev_gpio_irq_get(ACPI_COMPANION(&dev->dev), num);
226+
if (num == 0 && is_acpi_device_node(fwnode)) {
227+
ret = acpi_dev_gpio_irq_get(to_acpi_device_node(fwnode), num);
227228
/* Our callers expect -ENXIO for missing IRQs. */
228229
if (ret >= 0 || ret == -EPROBE_DEFER)
229230
goto out;
@@ -291,7 +292,7 @@ EXPORT_SYMBOL_GPL(platform_irq_count);
291292

292293
struct irq_affinity_devres {
293294
unsigned int count;
294-
unsigned int irq[];
295+
unsigned int irq[] __counted_by(count);
295296
};
296297

297298
static void platform_disable_acpi_irq(struct platform_device *pdev, int index)
@@ -312,7 +313,7 @@ static void devm_platform_get_irqs_affinity_release(struct device *dev,
312313
for (i = 0; i < ptr->count; i++) {
313314
irq_dispose_mapping(ptr->irq[i]);
314315

315-
if (has_acpi_companion(dev))
316+
if (is_acpi_device_node(dev_fwnode(dev)))
316317
platform_disable_acpi_irq(to_platform_device(dev), i);
317318
}
318319
}
@@ -655,23 +656,21 @@ EXPORT_SYMBOL_GPL(platform_device_add_data);
655656
*/
656657
int platform_device_add(struct platform_device *pdev)
657658
{
659+
struct device *dev = &pdev->dev;
658660
u32 i;
659661
int ret;
660662

661-
if (!pdev)
662-
return -EINVAL;
663-
664-
if (!pdev->dev.parent)
665-
pdev->dev.parent = &platform_bus;
663+
if (!dev->parent)
664+
dev->parent = &platform_bus;
666665

667-
pdev->dev.bus = &platform_bus_type;
666+
dev->bus = &platform_bus_type;
668667

669668
switch (pdev->id) {
670669
default:
671-
dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
670+
dev_set_name(dev, "%s.%d", pdev->name, pdev->id);
672671
break;
673672
case PLATFORM_DEVID_NONE:
674-
dev_set_name(&pdev->dev, "%s", pdev->name);
673+
dev_set_name(dev, "%s", pdev->name);
675674
break;
676675
case PLATFORM_DEVID_AUTO:
677676
/*
@@ -681,18 +680,18 @@ int platform_device_add(struct platform_device *pdev)
681680
*/
682681
ret = ida_alloc(&platform_devid_ida, GFP_KERNEL);
683682
if (ret < 0)
684-
goto err_out;
683+
return ret;
685684
pdev->id = ret;
686685
pdev->id_auto = true;
687-
dev_set_name(&pdev->dev, "%s.%d.auto", pdev->name, pdev->id);
686+
dev_set_name(dev, "%s.%d.auto", pdev->name, pdev->id);
688687
break;
689688
}
690689

691690
for (i = 0; i < pdev->num_resources; i++) {
692691
struct resource *p, *r = &pdev->resource[i];
693692

694693
if (r->name == NULL)
695-
r->name = dev_name(&pdev->dev);
694+
r->name = dev_name(dev);
696695

697696
p = r->parent;
698697
if (!p) {
@@ -705,18 +704,20 @@ int platform_device_add(struct platform_device *pdev)
705704
if (p) {
706705
ret = insert_resource(p, r);
707706
if (ret) {
708-
dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r);
707+
dev_err(dev, "failed to claim resource %d: %pR\n", i, r);
709708
goto failed;
710709
}
711710
}
712711
}
713712

714-
pr_debug("Registering platform device '%s'. Parent at %s\n",
715-
dev_name(&pdev->dev), dev_name(pdev->dev.parent));
713+
pr_debug("Registering platform device '%s'. Parent at %s\n", dev_name(dev),
714+
dev_name(dev->parent));
716715

717-
ret = device_add(&pdev->dev);
718-
if (ret == 0)
719-
return ret;
716+
ret = device_add(dev);
717+
if (ret)
718+
goto failed;
719+
720+
return 0;
720721

721722
failed:
722723
if (pdev->id_auto) {
@@ -730,7 +731,6 @@ int platform_device_add(struct platform_device *pdev)
730731
release_resource(r);
731732
}
732733

733-
err_out:
734734
return ret;
735735
}
736736
EXPORT_SYMBOL_GPL(platform_device_add);
@@ -1447,21 +1447,22 @@ static void platform_shutdown(struct device *_dev)
14471447
static int platform_dma_configure(struct device *dev)
14481448
{
14491449
struct platform_driver *drv = to_platform_driver(dev->driver);
1450+
struct fwnode_handle *fwnode = dev_fwnode(dev);
14501451
enum dev_dma_attr attr;
14511452
int ret = 0;
14521453

1453-
if (dev->of_node) {
1454-
ret = of_dma_configure(dev, dev->of_node, true);
1455-
} else if (has_acpi_companion(dev)) {
1456-
attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode));
1454+
if (is_of_node(fwnode)) {
1455+
ret = of_dma_configure(dev, to_of_node(fwnode), true);
1456+
} else if (is_acpi_device_node(fwnode)) {
1457+
attr = acpi_get_dma_attr(to_acpi_device_node(fwnode));
14571458
ret = acpi_dma_configure(dev, attr);
14581459
}
1460+
if (ret || drv->driver_managed_dma)
1461+
return ret;
14591462

1460-
if (!ret && !drv->driver_managed_dma) {
1461-
ret = iommu_device_use_default_domain(dev);
1462-
if (ret)
1463-
arch_teardown_dma_ops(dev);
1464-
}
1463+
ret = iommu_device_use_default_domain(dev);
1464+
if (ret)
1465+
arch_teardown_dma_ops(dev);
14651466

14661467
return ret;
14671468
}

drivers/base/test/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ config DM_KUNIT_TEST
1414
depends on KUNIT
1515

1616
config DRIVER_PE_KUNIT_TEST
17-
bool "KUnit Tests for property entry API" if !KUNIT_ALL_TESTS
18-
depends on KUNIT=y
17+
tristate "KUnit Tests for property entry API" if !KUNIT_ALL_TESTS
18+
depends on KUNIT
1919
default KUNIT_ALL_TESTS

0 commit comments

Comments
 (0)